WinUi3-Templates: ScrollView/ScrollView.cpp Source File

  • Main Page
  • Namespaces
  • Classes
  • Files
  • Directories
  • File List
  • File Members
  • ScrollView

ScrollView.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "ScrollPresenter.h"
00009 #include "ScrollView.h"
00010 #include "RuntimeProfiler.h"
00011 #include "FocusHelper.h"
00012 #include "RegUtil.h"
00013 #include "ScrollViewTestHooks.h"
00014
00015 // Change to 'true' to turn on debugging outputs in Output window
00016 bool ScrollViewTrace::s_IsDebugOutputEnabled{ false };
00017 bool ScrollViewTrace::s_IsVerboseDebugOutputEnabled{ false };
00018
00019 const int32_t ScrollView::s_noOpCorrelationId{ -1 };
00020
00021 ScrollView::ScrollView()
00022 {
00023     SCROLLVIEW_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00024
00025     __RP_Marker_ClassById(RuntimeProfiler::ProfId_ScrollView);
00026
00027     EnsureProperties();
00028     SetDefaultStyleKey(this);
00029     HookUISettingsEvent();
00030     HookScrollViewEvents();
00031 }
00032
00033 ScrollView::~ScrollView()
00034 {
00035     SCROLLVIEW_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00036
00037     UnhookHorizontalScrollControllerEvents(true /*isForDestructor*/);
00038     UnhookVerticalScrollControllerEvents(true /*isForDestructor*/);
00039     UnhookCompositionTargetRendering();
00040     UnhookScrollPresenterEvents(true /*isForDestructor*/);
00041     UnhookScrollViewEvents();
00042     ResetHideIndicatorsTimer();
00043 }
00044
00045 #pragma region IScrollView
00046
00047 winrt::UIElement ScrollView::CurrentAnchor()
00048 {
00049     if (auto scrollPresenter = m_scrollPresenter.get())
00050     {
00051         if (const auto scrollPresenterAsAnchorProvider = scrollPresenter.try_as<winrt::Controls::IScrollAnchorProvider>())
00052         {
00053             return scrollPresenterAsAnchorProvider.CurrentAnchor();
00054         }
00055     }
00056
00057     return nullptr;
00058 }
00059
00060 winrt::ScrollPresenter ScrollView::ScrollPresenter() const
00061 {
00062     return m_scrollPresenter.get().as<winrt::ScrollPresenter>();
00063 }
00064
00065 winrt::CompositionPropertySet ScrollView::ExpressionAnimationSources()
00066 {
00067     if (auto scrollPresenter = m_scrollPresenter.get())
00068     {
00069         return scrollPresenter.ExpressionAnimationSources();
00070     }
00071
00072     return nullptr;
00073 }
00074
00075 double ScrollView::HorizontalOffset()
00076 {
00077     if (auto scrollPresenter = m_scrollPresenter.get())
00078     {
00079         return scrollPresenter.HorizontalOffset();
00080     }
00081
00082     return 0.0;
00083 }
00084
00085 double ScrollView::VerticalOffset()
00086 {
00087     if (auto scrollPresenter = m_scrollPresenter.get())
00088     {
00089         return scrollPresenter.VerticalOffset();
00090     }
00091
00092     return 0.0;
00093 }
00094
00095 float ScrollView::ZoomFactor()
00096 {
00097     if (auto scrollPresenter = m_scrollPresenter.get())
00098     {
00099         return scrollPresenter.ZoomFactor();
00100     }
00101
00102     return 0.0f;
00103 }
00104
00105 double ScrollView::ExtentWidth()
00106 {
00107     if (auto scrollPresenter = m_scrollPresenter.get())
00108     {
00109         return scrollPresenter.ExtentWidth();
00110     }
00111
00112     return 0.0;
00113 }
00114
00115 double ScrollView::ExtentHeight()
00116 {
00117     if (auto scrollPresenter = m_scrollPresenter.get())
00118     {
00119         return scrollPresenter.ExtentHeight();
00120     }
00121
00122     return 0.0;
00123 }
00124
00125 double ScrollView::ViewportWidth()
00126 {
00127     if (auto scrollPresenter = m_scrollPresenter.get())
00128     {
00129         return scrollPresenter.ViewportWidth();
00130     }
00131
00132     return 0.0;
00133 }
00134
00135 double ScrollView::ViewportHeight()
00136 {
00137     if (auto scrollPresenter = m_scrollPresenter.get())
00138     {
00139         return scrollPresenter.ViewportHeight();
00140     }
00141
00142     return 0.0;
00143 }
00144
00145 double ScrollView::ScrollableWidth()
00146 {
00147     if (auto scrollPresenter = m_scrollPresenter.get())
00148     {
00149         return scrollPresenter.ScrollableWidth();
00150     }
00151
00152     return 0.0;
00153 }
00154
00155 double ScrollView::ScrollableHeight()
00156 {
00157     if (auto scrollPresenter = m_scrollPresenter.get())
00158     {
00159         return scrollPresenter.ScrollableHeight();
00160     }
00161
00162     return 0.0;
00163 }
00164
00165 winrt::ScrollingInteractionState ScrollView::State()
00166 {
00167     if (auto scrollPresenter = m_scrollPresenter.get())
00168     {
00169         return scrollPresenter.State();
00170     }
00171
00172     return winrt::ScrollingInteractionState::Idle;
00173 }
00174
00175 winrt::ScrollingInputKinds ScrollView::IgnoredInputKinds()
00176 {
00177     // Workaround for Bug 17377013: XamlCompiler codegen for Enum CreateFromString always returns boxed int which is wrong for [flags] enums (should be uint)
00178     // Check if the boxed IgnoredInputKinds is an IReference<int> first in which case we unbox as int.
00179     auto boxedKind = GetValue(s_IgnoredInputKindsProperty);
00180     if (auto boxedInt = boxedKind.try_as<winrt::IReference<int32_t>>())
00181     {
00182         return winrt::ScrollingInputKinds{ static_cast<uint32_t>(unbox_value<int32_t>(boxedInt)) };
00183     }
00184
00185     return auto_unbox(boxedKind);
00186 }
00187
00188 void ScrollView::IgnoredInputKinds(winrt::ScrollingInputKinds const& value)
00189 {
00190     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::InputKindToString(value).c_str());
00191     SetValue(s_IgnoredInputKindsProperty, box_value(value));
00192 }
00193
00194 void ScrollView::RegisterAnchorCandidate(winrt::UIElement const& element)
00195 {
00196     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, element);
00197
00198     if (auto scrollPresenter = m_scrollPresenter.get())
00199     {
00200         if (const auto scrollPresenterAsAnchorProvider = scrollPresenter.try_as<winrt::Controls::IScrollAnchorProvider>())
00201         {
00202             scrollPresenterAsAnchorProvider.RegisterAnchorCandidate(element);
00203             return;
00204         }
00205         throw winrt::hresult_error(E_INVALID_OPERATION, s_IScrollAnchorProviderNotImpl);
00206     }
00207     throw winrt::hresult_error(E_INVALID_OPERATION, s_noScrollPresenterPart);
00208 }
00209
00210 void ScrollView::UnregisterAnchorCandidate(winrt::UIElement const& element)
00211 {
00212     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, element);
00213
00214     if (auto scrollPresenter = m_scrollPresenter.get())
00215     {
00216         if (const auto scrollPresenterAsAnchorProvider = scrollPresenter.try_as<winrt::Controls::IScrollAnchorProvider>())
00217         {
00218             scrollPresenterAsAnchorProvider.UnregisterAnchorCandidate(element);
00219             return;
00220         }
00221         throw winrt::hresult_error(E_INVALID_OPERATION, s_IScrollAnchorProviderNotImpl);
00222     }
00223     throw winrt::hresult_error(E_INVALID_OPERATION, s_noScrollPresenterPart);
00224 }
00225
00226
00227 int32_t ScrollView::ScrollTo(double horizontalOffset, double verticalOffset)
00228 {
00229     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, horizontalOffset, verticalOffset);
00230
00231     if (auto scrollPresenter = m_scrollPresenter.get())
00232     {
00233         return scrollPresenter.ScrollTo(horizontalOffset, verticalOffset);
00234     }
00235
00236     return s_noOpCorrelationId;
00237 }
00238
00239 int32_t ScrollView::ScrollTo(double horizontalOffset, double verticalOffset, winrt::ScrollingScrollOptions const& options)
00240 {
00241     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL_STR, METH_NAME, this,
00242         horizontalOffset, verticalOffset, TypeLogging::ScrollOptionsToString(options).c_str());
00243
00244     if (auto scrollPresenter = m_scrollPresenter.get())
00245     {
00246         return scrollPresenter.ScrollTo(horizontalOffset, verticalOffset, options);
00247     }
00248
00249     return s_noOpCorrelationId;
00250 }
00251
00252 int32_t ScrollView::ScrollBy(double horizontalOffsetDelta, double verticalOffsetDelta)
00253 {
00254     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, horizontalOffsetDelta, verticalOffsetDelta);
00255
00256     if (auto scrollPresenter = m_scrollPresenter.get())
00257     {
00258         return scrollPresenter.ScrollBy(horizontalOffsetDelta, verticalOffsetDelta);
00259     }
00260
00261     return s_noOpCorrelationId;
00262 }
00263
00264 int32_t ScrollView::ScrollBy(double horizontalOffsetDelta, double verticalOffsetDelta, winrt::ScrollingScrollOptions const& options)
00265 {
00266     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL_STR, METH_NAME, this,
00267         horizontalOffsetDelta, verticalOffsetDelta, TypeLogging::ScrollOptionsToString(options).c_str());
00268
00269     if (auto scrollPresenter = m_scrollPresenter.get())
00270     {
00271         return scrollPresenter.ScrollBy(horizontalOffsetDelta, verticalOffsetDelta, options);
00272     }
00273
00274     return s_noOpCorrelationId;
00275 }
00276
00277 int32_t ScrollView::AddScrollVelocity(winrt::float2 offsetsVelocity, winrt::IReference<winrt::float2> inertiaDecayRate)
00278 {
00279     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this,
00280         TypeLogging::Float2ToString(offsetsVelocity).c_str(), TypeLogging::NullableFloat2ToString(inertiaDecayRate).c_str());
00281
00282     if (auto scrollPresenter = m_scrollPresenter.get())
00283     {
00284         return scrollPresenter.AddScrollVelocity(offsetsVelocity, inertiaDecayRate);
00285     }
00286
00287     return s_noOpCorrelationId;
00288 }
00289
00290 int32_t ScrollView::ZoomTo(float zoomFactor, winrt::IReference<winrt::float2> centerPoint)
00291 {
00292     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
00293         TypeLogging::NullableFloat2ToString(centerPoint).c_str(), zoomFactor);
00294
00295     if (auto scrollPresenter = m_scrollPresenter.get())
00296     {
00297         return scrollPresenter.ZoomTo(zoomFactor, centerPoint);
00298     }
00299
00300     return s_noOpCorrelationId;
00301 }
00302
00303 int32_t ScrollView::ZoomTo(float zoomFactor, winrt::IReference<winrt::float2> centerPoint, winrt::ScrollingZoomOptions const& options)
00304 {
00305     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR_FLT, METH_NAME, this,
00306         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
00307         TypeLogging::ZoomOptionsToString(options).c_str(),
00308         zoomFactor);
00309
00310     if (auto scrollPresenter = m_scrollPresenter.get())
00311     {
00312         return scrollPresenter.ZoomTo(zoomFactor, centerPoint, options);
00313     }
00314
00315     return s_noOpCorrelationId;
00316 }
00317
00318 int32_t ScrollView::ZoomBy(float zoomFactorDelta, winrt::IReference<winrt::float2> centerPoint)
00319 {
00320     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
00321         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
00322         zoomFactorDelta);
00323
00324     if (auto scrollPresenter = m_scrollPresenter.get())
00325     {
00326         return scrollPresenter.ZoomBy(zoomFactorDelta, centerPoint);
00327     }
00328
00329     return s_noOpCorrelationId;
00330 }
00331
00332 int32_t ScrollView::ZoomBy(float zoomFactorDelta, winrt::IReference<winrt::float2> centerPoint, winrt::ScrollingZoomOptions const& options)
00333 {
00334     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR_FLT, METH_NAME, this,
00335         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
00336         TypeLogging::ZoomOptionsToString(options).c_str(),
00337         zoomFactorDelta);
00338
00339     if (auto scrollPresenter = m_scrollPresenter.get())
00340     {
00341         return scrollPresenter.ZoomBy(zoomFactorDelta, centerPoint, options);
00342     }
00343
00344     return s_noOpCorrelationId;
00345 }
00346
00347 int32_t ScrollView::AddZoomVelocity(float zoomFactorVelocity, winrt::IReference<winrt::float2> centerPoint, winrt::IReference<float> inertiaDecayRate)
00348 {
00349     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR_FLT, METH_NAME, this,
00350         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
00351         TypeLogging::NullableFloatToString(inertiaDecayRate).c_str(),
00352         zoomFactorVelocity);
00353
00354     if (auto scrollPresenter = m_scrollPresenter.get())
00355     {
00356         return scrollPresenter.AddZoomVelocity(zoomFactorVelocity, centerPoint, inertiaDecayRate);
00357     }
00358
00359     return s_noOpCorrelationId;
00360 }
00361
00362 #pragma endregion
00363
00364 #pragma region IFrameworkElementOverrides
00365
00366 void ScrollView::OnApplyTemplate()
00367 {
00368     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00369
00370     __super::OnApplyTemplate();
00371
00372     m_hasNoIndicatorStateStoryboardCompletedHandler = false;
00373     m_keepIndicatorsShowing = false;
00374
00375     winrt::IControlProtected thisAsControlProtected = *this;
00376
00377     winrt::ScrollPresenter scrollPresenter = GetTemplateChildT<winrt::ScrollPresenter>(s_scrollPresenterPartName, thisAsControlProtected);
00378
00379     UpdateScrollPresenter(scrollPresenter);
00380
00381     winrt::IUIElement horizontalScrollControllerElement = GetTemplateChildT<winrt::IUIElement>(s_horizontalScrollBarPartName, thisAsControlProtected);
00382     winrt::IScrollController horizontalScrollController = horizontalScrollControllerElement.try_as<winrt::IScrollController>();
00383     winrt::ScrollBar horizontalScrollBar = nullptr;
00384
00385     if (horizontalScrollControllerElement && !horizontalScrollController)
00386     {
00387         horizontalScrollBar = horizontalScrollControllerElement.try_as<winrt::ScrollBar>();
00388
00389         if (horizontalScrollBar)
00390         {
00391             if (!m_horizontalScrollBarController)
00392             {
00393                 m_horizontalScrollBarController = winrt::make_self<ScrollBarController>();
00394             }
00395             horizontalScrollController = m_horizontalScrollBarController.as<winrt::IScrollController>();
00396         }
00397     }
00398
00399     if (horizontalScrollBar)
00400     {
00401         m_horizontalScrollBarController->SetScrollBar(horizontalScrollBar);
00402     }
00403     else
00404     {
00405         m_horizontalScrollBarController = nullptr;
00406     }
00407
00408     UpdateHorizontalScrollController(horizontalScrollController, horizontalScrollControllerElement);
00409
00410     winrt::IUIElement verticalScrollControllerElement = GetTemplateChildT<winrt::IUIElement>(s_verticalScrollBarPartName, thisAsControlProtected);
00411     winrt::IScrollController verticalScrollController = verticalScrollControllerElement.try_as<winrt::IScrollController>();
00412     winrt::ScrollBar verticalScrollBar = nullptr;
00413
00414     if (verticalScrollControllerElement && !verticalScrollController)
00415     {
00416         verticalScrollBar = verticalScrollControllerElement.try_as<winrt::ScrollBar>();
00417
00418         if (verticalScrollBar)
00419         {
00420             if (!m_verticalScrollBarController)
00421             {
00422                 m_verticalScrollBarController = winrt::make_self<ScrollBarController>();
00423             }
00424             verticalScrollController = m_verticalScrollBarController.as<winrt::IScrollController>();
00425         }
00426     }
00427
00428     if (verticalScrollBar)
00429     {
00430         m_verticalScrollBarController->SetScrollBar(verticalScrollBar);
00431     }
00432     else
00433     {
00434         m_verticalScrollBarController = nullptr;
00435     }
00436
00437     UpdateVerticalScrollController(verticalScrollController, verticalScrollControllerElement);
00438
00439     winrt::IUIElement scrollControllersSeparator = GetTemplateChildT<winrt::IUIElement>(s_scrollBarsSeparatorPartName, thisAsControlProtected);
00440
00441     UpdateScrollControllersSeparator(scrollControllersSeparator);
00442
00443     UpdateScrollControllersVisibility(true /*horizontalChange*/, true /*verticalChange*/);
00444
00445     winrt::FrameworkElement root = GetTemplateChildT<winrt::FrameworkElement>(s_rootPartName, thisAsControlProtected);
00446
00447     if (root)
00448     {
00449         winrt::IVector<winrt::VisualStateGroup> rootVisualStateGroups = winrt::VisualStateManager::GetVisualStateGroups(root);
00450
00451         if (rootVisualStateGroups)
00452         {
00453             const uint32_t groupCount = rootVisualStateGroups.Size();
00454
00455             for (uint32_t groupIndex = 0; groupIndex < groupCount; ++groupIndex)
00456             {
00457                 winrt::VisualStateGroup group = rootVisualStateGroups.GetAt(groupIndex);
00458
00459                 if (group)
00460                 {
00461                     winrt::IVector<winrt::VisualState> visualStates = group.States();
00462
00463                     if (visualStates)
00464                     {
00465                         const uint32_t stateCount = visualStates.Size();
00466
00467                         for (uint32_t stateIndex = 0; stateIndex < stateCount; ++stateIndex)
00468                         {
00469                             winrt::VisualState state = visualStates.GetAt(stateIndex);
00470
00471                             if (state)
00472                             {
00473                                 auto stateName = state.Name();
00474                                 winrt::Storyboard stateStoryboard = state.Storyboard();
00475
00476                                 if (stateStoryboard)
00477                                 {
00478                                     if (stateName == s_noIndicatorStateName)
00479                                     {
00480                                         const winrt::event_token noIndicatorStateStoryboardCompletedToken = stateStoryboard.Completed({ this, &ScrollView::OnNoIndicatorStateStoryboardCompleted });
00481                                         m_hasNoIndicatorStateStoryboardCompletedHandler = true;
00482                                     }
00483                                     else if (stateName == s_touchIndicatorStateName || stateName == s_mouseIndicatorStateName)
00484                                     {
00485                                         const winrt::event_token indicatorStateStoryboardCompletedToken = stateStoryboard.Completed({ this, &ScrollView::OnIndicatorStateStoryboardCompleted });
00486                                     }
00487                                 }
00488                             }
00489                         }
00490                     }
00491                 }
00492             }
00493         }
00494     }
00495
00496     UpdateVisualStates(false /*useTransitions*/);
00497 }
00498
00499 #pragma endregion
00500
00501 #pragma region IControlOverrides
00502
00503 void ScrollView::OnGotFocus(winrt::RoutedEventArgs const& args)
00504 {
00505     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00506
00507     __super::OnGotFocus(args);
00508
00509     m_preferMouseIndicators =
00510         m_focusInputDeviceKind == winrt::FocusInputDeviceKind::Mouse ||
00511         m_focusInputDeviceKind == winrt::FocusInputDeviceKind::Pen;
00512
00513     UpdateVisualStates(
00514         true  /*useTransitions*/,
00515         true  /*showIndicators*/,
00516         false /*hideIndicators*/,
00517         false /*scrollControllersAutoHidingChanged*/,
00518         true  /*updateScrollControllersAutoHiding*/,
00519         true  /*onlyForAutoHidingScrollControllers*/);
00520 }
00521
00522 #pragma endregion
00523
00524 void ScrollView::OnScrollViewGettingFocus(
00525     const winrt::IInspectable& /*sender*/,
00526     const winrt::GettingFocusEventArgs& args)
00527 {
00528     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00529
00530     m_focusInputDeviceKind = args.InputDevice();
00531 }
00532
00533 void ScrollView::OnScrollViewIsEnabledChanged(
00534     const winrt::IInspectable& /*sender*/,
00535     const winrt::DependencyPropertyChangedEventArgs& /*args*/)
00536 {
00537     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00538
00539     UpdateVisualStates(
00540         true  /*useTransitions*/,
00541         false /*showIndicators*/,
00542         false /*hideIndicators*/,
00543         false /*scrollControllersAutoHidingChanged*/,
00544         true  /*updateScrollControllersAutoHiding*/);
00545 }
00546
00547 void ScrollView::OnScrollViewUnloaded(
00548     const winrt::IInspectable& /*sender*/,
00549     const winrt::RoutedEventArgs& /*args*/)
00550 {
00551     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00552
00553     m_showingMouseIndicators = false;
00554     m_keepIndicatorsShowing = false;
00555     m_bringIntoViewOperations.clear();
00556
00557     UnhookCompositionTargetRendering();
00558     ResetHideIndicatorsTimer();
00559 }
00560
00561 void ScrollView::OnScrollViewPointerEntered(
00562     const winrt::IInspectable& sender,
00563     const winrt::PointerRoutedEventArgs& args)
00564 {
00565     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00566
00567     if (args.Pointer().PointerDeviceType() != winrt::PointerDeviceType::Touch)
00568     {
00569         // Mouse/Pen inputs dominate. If touch panning indicators are shown, switch to mouse indicators.
00570         m_preferMouseIndicators = true;
00571
00572         UpdateVisualStates(
00573             true  /*useTransitions*/,
00574             true  /*showIndicators*/,
00575             false /*hideIndicators*/,
00576             false /*scrollControllersAutoHidingChanged*/,
00577             true  /*updateScrollControllersAutoHiding*/,
00578             true  /*onlyForAutoHidingScrollControllers*/);
00579     }
00580 }
00581
00582 void ScrollView::OnScrollViewPointerMoved(
00583     const winrt::IInspectable& sender,
00584     const winrt::PointerRoutedEventArgs& args)
00585 {
00586     // Don't process if this is a generated replay of the event.
00587     if (args.IsGenerated())
00588     {
00589         return;
00590     }
00591
00592     if (args.Pointer().PointerDeviceType() != winrt::PointerDeviceType::Touch)
00593     {
00594         // Mouse/Pen inputs dominate. If touch panning indicators are shown, switch to mouse indicators.
00595         m_preferMouseIndicators = true;
00596
00597         UpdateVisualStates(
00598             true  /*useTransitions*/,
00599             true  /*showIndicators*/,
00600             false /*hideIndicators*/,
00601             false /*scrollControllersAutoHidingChanged*/,
00602             false /*updateScrollControllersAutoHiding*/,
00603             true  /*onlyForAutoHidingScrollControllers*/);
00604
00605         if (AreScrollControllersAutoHiding() &&
00606             !SharedHelpers::IsAnimationsEnabled() &&
00607             m_hideIndicatorsTimer &&
00608             (m_isPointerOverHorizontalScrollController || m_isPointerOverVerticalScrollController))
00609         {
00610             ResetHideIndicatorsTimer();
00611         }
00612     }
00613 }
00614
00615 void ScrollView::OnScrollViewPointerExited(
00616     const winrt::IInspectable& sender,
00617     const winrt::PointerRoutedEventArgs& args)
00618 {
00619     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00620
00621     if (args.Pointer().PointerDeviceType() != winrt::PointerDeviceType::Touch)
00622     {
00623         // Mouse/Pen inputs dominate. If touch panning indicators are shown, switch to mouse indicators.
00624         m_isPointerOverHorizontalScrollController = false;
00625         m_isPointerOverVerticalScrollController = false;
00626         m_preferMouseIndicators = true;
00627
00628         UpdateVisualStates(
00629             true  /*useTransitions*/,
00630             true  /*showIndicators*/,
00631             false /*hideIndicators*/,
00632             false /*scrollControllersAutoHidingChanged*/,
00633             true  /*updateScrollControllersAutoHiding*/,
00634             true  /*onlyForAutoHidingScrollControllers*/);
00635
00636         if (AreScrollControllersAutoHiding())
00637         {
00638             HideIndicatorsAfterDelay();
00639         }
00640     }
00641 }
00642
00643 void ScrollView::OnScrollViewPointerPressed(
00644     const winrt::IInspectable& /*sender*/,
00645     const winrt::PointerRoutedEventArgs& args)
00646 {
00647     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00648
00649     if (args.Handled())
00650     {
00651         return;
00652     }
00653
00654     if (args.Pointer().PointerDeviceType() == winrt::PointerDeviceType::Mouse)
00655     {
00656         const winrt::PointerPoint pointerPoint = args.GetCurrentPoint(nullptr);
00657         const winrt::PointerPointProperties pointerPointProperties = pointerPoint.Properties();
00658
00659         m_isLeftMouseButtonPressedForFocus = pointerPointProperties.IsLeftButtonPressed();
00660     }
00661
00662     // Show the scroll controller indicators as soon as a pointer is pressed on the ScrollView.
00663     UpdateVisualStates(
00664         true  /*useTransitions*/,
00665         true  /*showIndicators*/,
00666         false /*hideIndicators*/,
00667         false /*scrollControllersAutoHidingChanged*/,
00668         true  /*updateScrollControllersAutoHiding*/,
00669         true  /*onlyForAutoHidingScrollControllers*/);
00670 }
00671
00672 void ScrollView::OnScrollViewPointerReleased(
00673     const winrt::IInspectable& /*sender*/,
00674     const winrt::PointerRoutedEventArgs& args)
00675 {
00676     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00677
00678     bool takeFocus = false;
00679
00680     if (args.Pointer().PointerDeviceType() == winrt::PointerDeviceType::Mouse && m_isLeftMouseButtonPressedForFocus)
00681     {
00682         m_isLeftMouseButtonPressedForFocus = false;
00683         takeFocus = true;
00684     }
00685
00686     if (args.Handled())
00687     {
00688         return;
00689     }
00690
00691     if (takeFocus)
00692     {
00693         SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_METH, METH_NAME, this, L"Focus");
00694
00695         const bool tookFocus = Focus(winrt::FocusState::Pointer);
00696         args.Handled(tookFocus);
00697     }
00698 }
00699
00700 void ScrollView::OnScrollViewPointerCanceled(
00701     const winrt::IInspectable& /*sender*/,
00702     const winrt::PointerRoutedEventArgs& args)
00703 {
00704     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00705
00706     if (args.Pointer().PointerDeviceType() == winrt::PointerDeviceType::Mouse)
00707     {
00708         m_isLeftMouseButtonPressedForFocus = false;
00709     }
00710 }
00711
00712 void ScrollView::OnHorizontalScrollControllerPointerEntered(
00713     const winrt::IInspectable& /*sender*/,
00714     const winrt::PointerRoutedEventArgs& args)
00715 {
00716     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00717
00718     HandleScrollControllerPointerEntered(true /*isForHorizontalScrollController*/);
00719 }
00720
00721 void ScrollView::OnHorizontalScrollControllerPointerExited(
00722     const winrt::IInspectable& /*sender*/,
00723     const winrt::PointerRoutedEventArgs& args)
00724 {
00725     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00726
00727     HandleScrollControllerPointerExited(true /*isForHorizontalScrollController*/);
00728 }
00729
00730 void ScrollView::OnVerticalScrollControllerPointerEntered(
00731     const winrt::IInspectable& /*sender*/,
00732     const winrt::PointerRoutedEventArgs& args)
00733 {
00734     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00735
00736     HandleScrollControllerPointerEntered(false /*isForHorizontalScrollController*/);
00737 }
00738
00739 void ScrollView::OnVerticalScrollControllerPointerExited(
00740     const winrt::IInspectable& /*sender*/,
00741     const winrt::PointerRoutedEventArgs& args)
00742 {
00743     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.Handled(), args.Pointer().PointerDeviceType());
00744
00745     HandleScrollControllerPointerExited(false /*isForHorizontalScrollController*/);
00746 }
00747
00748 // Handler for when the NoIndicator state's storyboard completes animating.
00749 void ScrollView::OnNoIndicatorStateStoryboardCompleted(
00750     const winrt::IInspectable& /*sender*/,
00751     const winrt::IInspectable& /*args*/)
00752 {
00753     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00754
00755     MUX_ASSERT(m_hasNoIndicatorStateStoryboardCompletedHandler);
00756
00757     m_showingMouseIndicators = false;
00758 }
00759
00760 // Handler for when a TouchIndicator or MouseIndicator state's storyboard completes animating.
00761 void ScrollView::OnIndicatorStateStoryboardCompleted(
00762     const winrt::IInspectable& /*sender*/,
00763     const winrt::IInspectable& /*args*/)
00764 {
00765     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00766
00767     // If the cursor is currently directly over either scroll controller then do not automatically hide the indicators
00768     if (AreScrollControllersAutoHiding() &&
00769         !m_keepIndicatorsShowing &&
00770         !m_isPointerOverVerticalScrollController &&
00771         !m_isPointerOverHorizontalScrollController)
00772     {
00773         UpdateScrollControllersVisualState(true /*useTransitions*/, false /*showIndicators*/, true /*hideIndicators*/);
00774     }
00775 }
00776
00777 // Invoked by ScrollViewTestHooks
00778 void ScrollView::ScrollControllersAutoHidingChangedDbg()
00779 {
00780     UpdateScrollControllersAutoHiding(true /*forceUpdate*/);
00781 }
00782
00783 void ScrollView::ValidateAnchorRatio(double value)
00784 {
00785     ScrollPresenter::ValidateAnchorRatio(value);
00786 }
00787
00788 void ScrollView::ValidateZoomFactoryBoundary(double value)
00789 {
00790     ScrollPresenter::ValidateZoomFactoryBoundary(value);
00791 }
00792
00793 // Invoked when a dependency property of this ScrollView has changed.
00794 void ScrollView::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00795 {
00796     auto dependencyProperty = args.Property();
00797
00798     SCROLLVIEW_TRACE_VERBOSE_DBG(nullptr, L"%s(property: %s)\n", METH_NAME, DependencyPropertyToString(dependencyProperty).c_str());
00799
00800     bool horizontalChange = dependencyProperty == s_HorizontalScrollBarVisibilityProperty;
00801     bool verticalChange = dependencyProperty == s_VerticalScrollBarVisibilityProperty;
00802
00803     if (horizontalChange || verticalChange)
00804     {
00805         UpdateScrollControllersVisibility(horizontalChange, verticalChange);
00806         UpdateVisualStates(
00807             true  /*useTransitions*/,
00808             false /*showIndicators*/,
00809             false /*hideIndicators*/,
00810             false /*scrollControllersAutoHidingChanged*/,
00811             true  /*updateScrollControllersAutoHiding*/);
00812     }
00813 }
00814
00815 void ScrollView::OnScrollControllerCanScrollChanged(
00816     const winrt::IScrollController& sender,
00817     const winrt::IInspectable& /*args*/)
00818 {
00819     // IScrollController::CanScroll changed and affect the scroll controller's visibility when its visibility mode is Auto.
00820     if (m_horizontalScrollController && m_horizontalScrollController == sender)
00821     {
00822         SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"HorizontalScrollController.CanScroll changed: ", m_horizontalScrollController.get().CanScroll());
00823
00824         UpdateScrollControllersVisibility(true /*horizontalChange*/, false /*verticalChange*/);
00825     }
00826     else if (m_verticalScrollController && m_verticalScrollController == sender)
00827     {
00828         SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"VerticalScrollController.CanScroll changed: ", m_verticalScrollController.get().CanScroll());
00829
00830         UpdateScrollControllersVisibility(false /*horizontalChange*/, true /*verticalChange*/);
00831     }
00832 }
00833
00834 void ScrollView::OnScrollControllerIsScrollingWithMouseChanged(
00835     const winrt::IScrollController& sender,
00836     const winrt::IInspectable& /*args*/)
00837 {
00838     const bool isScrollControllerScrollingWithMouse = sender.IsScrollingWithMouse();
00839     bool showIndicators = false;
00840     bool hideIndicators = false;
00841
00842     if (m_horizontalScrollController && m_horizontalScrollController == sender)
00843     {
00844         UpdateScrollControllersAutoHiding();
00845
00846         if (m_isHorizontalScrollControllerScrollingWithMouse != isScrollControllerScrollingWithMouse)
00847         {
00848             SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_INT_INT, METH_NAME, this, L"HorizontalScrollController.IsScrollingWithMouse changed: ", m_isHorizontalScrollControllerScrollingWithMouse, isScrollControllerScrollingWithMouse);
00849
00850             m_isHorizontalScrollControllerScrollingWithMouse = isScrollControllerScrollingWithMouse;
00851
00852             if (isScrollControllerScrollingWithMouse)
00853             {
00854                 // Prevent the vertical scroll controller from fading out while the user is scrolling with mouse with the horizontal one.
00855                 m_keepIndicatorsShowing = true;
00856                 showIndicators = true;
00857             }
00858             else
00859             {
00860                 // Make the scroll controllers fade out, after the normal delay, if they are auto-hiding.
00861                 m_keepIndicatorsShowing = false;
00862                 hideIndicators = AreScrollControllersAutoHiding();
00863             }
00864         }
00865
00866         // IScrollController::CanScroll might have changed and affect the scroll controller's visibility
00867         // when its visibility mode is Auto.
00868         UpdateScrollControllersVisibility(true /*horizontalChange*/, false /*verticalChange*/);
00869         UpdateVisualStates(true /*useTransitions*/, showIndicators, hideIndicators);
00870     }
00871     else if (m_verticalScrollController && m_verticalScrollController == sender)
00872     {
00873         UpdateScrollControllersAutoHiding();
00874
00875         if (m_isVerticalScrollControllerScrollingWithMouse != isScrollControllerScrollingWithMouse)
00876         {
00877             SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_INT_INT, METH_NAME, this, L"VerticalScrollController.IsScrollingWithMouse changed: ", m_isVerticalScrollControllerScrollingWithMouse, isScrollControllerScrollingWithMouse);
00878
00879             m_isVerticalScrollControllerScrollingWithMouse = isScrollControllerScrollingWithMouse;
00880
00881             if (isScrollControllerScrollingWithMouse)
00882             {
00883                 // Prevent the horizontal scroll controller from fading out while the user is scrolling with mouse with the vertical one.
00884                 m_keepIndicatorsShowing = true;
00885                 showIndicators = true;
00886             }
00887             else
00888             {
00889                 // Make the scroll controllers fade out, after the normal delay, if they are auto-hiding.
00890                 m_keepIndicatorsShowing = false;
00891                 hideIndicators = AreScrollControllersAutoHiding();
00892             }
00893         }
00894
00895         // IScrollController::CanScroll might have changed and affect the scroll controller's visibility
00896         // when its visibility mode is Auto.
00897         UpdateScrollControllersVisibility(false /*horizontalChange*/, true /*verticalChange*/);
00898         UpdateVisualStates(true /*useTransitions*/, showIndicators, hideIndicators);
00899     }
00900 }
00901
00902 void ScrollView::OnHideIndicatorsTimerTick(
00903     const winrt::IInspectable& /*sender*/,
00904     const winrt::IInspectable& /*args*/)
00905 {
00906     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00907
00908     ResetHideIndicatorsTimer();
00909
00910     if (AreScrollControllersAutoHiding())
00911     {
00912         // As this control may be in the process of being discarded,
00913         // use tracker_ref's safe_get() instead of get() to avoid crashes.
00914         HideIndicators(true /*useTransitions*/, true /*useSafeGet*/);
00915     }
00916 }
00917
00918 void ScrollView::OnScrollPresenterExtentChanged(
00919     const winrt::IInspectable& /*sender*/,
00920     const winrt::IInspectable& args)
00921 {
00922     if (m_extentChangedEventSource)
00923     {
00924         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00925
00926         m_extentChangedEventSource(*this, args);
00927     }
00928 }
00929
00930 void ScrollView::OnScrollPresenterStateChanged(
00931     const winrt::IInspectable& /*sender*/,
00932     const winrt::IInspectable& args)
00933 {
00934     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00935
00936     if (auto scrollPresenter = m_scrollPresenter.get())
00937     {
00938         if (scrollPresenter.State() == winrt::ScrollingInteractionState::Interaction)
00939         {
00940             m_preferMouseIndicators = false;
00941         }
00942     }
00943
00944     if (m_stateChangedEventSource)
00945     {
00946         m_stateChangedEventSource(*this, args);
00947     }
00948 }
00949
00950 void ScrollView::OnScrollAnimationStarting(
00951     const winrt::IInspectable& /*sender*/,
00952     const winrt::ScrollingScrollAnimationStartingEventArgs& args)
00953 {
00954     if (m_scrollAnimationStartingEventSource)
00955     {
00956         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00957
00958         m_scrollAnimationStartingEventSource(*this, args);
00959     }
00960 }
00961
00962 void ScrollView::OnZoomAnimationStarting(
00963     const winrt::IInspectable& /*sender*/,
00964     const winrt::ScrollingZoomAnimationStartingEventArgs& args)
00965 {
00966     if (m_zoomAnimationStartingEventSource)
00967     {
00968         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00969
00970         m_zoomAnimationStartingEventSource(*this, args);
00971     }
00972 }
00973
00974 void ScrollView::OnScrollPresenterScrollStarting(
00975     const winrt::IInspectable& /*sender*/,
00976     const winrt::ScrollingScrollStartingEventArgs& args)
00977 {
00978     if (m_scrollStartingEventSource)
00979     {
00980         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00981
00982         m_scrollStartingEventSource(*this, args);
00983     }
00984 }
00985
00986 void ScrollView::OnScrollPresenterZoomStarting(
00987     const winrt::IInspectable& /*sender*/,
00988     const winrt::ScrollingZoomStartingEventArgs& args)
00989 {
00990     if (m_zoomStartingEventSource)
00991     {
00992         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00993
00994         m_zoomStartingEventSource(*this, args);
00995     }
00996 }
00997
00998 void ScrollView::OnScrollPresenterViewChanged(
00999     const winrt::IInspectable& /*sender*/,
01000     const winrt::IInspectable& args)
01001 {
01002     // Unless the control is still loading, show the scroll controller indicators when the view changes. For example,
01003     // when using Ctrl+/- to zoom, mouse-wheel to scroll or zoom, or any other input type. Keep the existing indicator type.
01004     if (IsLoaded())
01005     {
01006         UpdateVisualStates(
01007             true  /*useTransitions*/,
01008             true  /*showIndicators*/,
01009             false /*hideIndicators*/,
01010             false /*scrollControllersAutoHidingChanged*/,
01011             false /*updateScrollControllersAutoHiding*/,
01012             true  /*onlyForAutoHidingScrollControllers*/);
01013     }
01014
01015     if (m_viewChangedEventSource)
01016     {
01017         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01018
01019         m_viewChangedEventSource(*this, args);
01020     }
01021 }
01022
01023 void ScrollView::OnScrollPresenterScrollCompleted(
01024     const winrt::IInspectable& /*sender*/,
01025     const winrt::ScrollingScrollCompletedEventArgs& args)
01026 {
01027     if (args.CorrelationId() == m_horizontalAddScrollVelocityOffsetChangeCorrelationId)
01028     {
01029         m_horizontalAddScrollVelocityOffsetChangeCorrelationId = s_noOpCorrelationId;
01030     }
01031     else if (args.CorrelationId() == m_verticalAddScrollVelocityOffsetChangeCorrelationId)
01032     {
01033         m_verticalAddScrollVelocityOffsetChangeCorrelationId = s_noOpCorrelationId;
01034     }
01035
01036     if (m_scrollCompletedEventSource)
01037     {
01038         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01039
01040         m_scrollCompletedEventSource(*this, args);
01041     }
01042 }
01043
01044 void ScrollView::OnScrollPresenterZoomCompleted(
01045     const winrt::IInspectable& /*sender*/,
01046     const winrt::ScrollingZoomCompletedEventArgs& args)
01047 {
01048     if (m_zoomCompletedEventSource)
01049     {
01050         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01051
01052         m_zoomCompletedEventSource(*this, args);
01053     }
01054 }
01055
01056 void ScrollView::OnScrollPresenterBringingIntoView(
01057     const winrt::IInspectable& /*sender*/,
01058     const winrt::ScrollingBringingIntoViewEventArgs& args)
01059 {
01060     if (!m_bringIntoViewOperations.empty())
01061     {
01062         auto requestEventArgs = args.RequestEventArgs();
01063
01064         for (auto operationsIter = m_bringIntoViewOperations.begin(); operationsIter != m_bringIntoViewOperations.end(); operationsIter++)
01065         {
01066             auto& bringIntoViewOperation = *operationsIter;
01067
01068             if (requestEventArgs.TargetElement() == bringIntoViewOperation->TargetElement())
01069             {
01070                 // This ScrollPresenter::BringingIntoView notification results from a FocusManager::TryFocusAsync call in ScrollView::HandleKeyDownForXYNavigation.
01071                 // Its BringIntoViewRequestedEventArgs::AnimationDesired property is set to True in order to animate to the target element rather than jumping.
01072                 SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR_INT, METH_NAME, this, bringIntoViewOperation->TargetElement(), bringIntoViewOperation->TicksCount());
01073
01074                 // We either want to cancel this BringIntoView operation (because we are handling the scrolling ourselves) or we want to force the operation to be animated
01075                 if (bringIntoViewOperation->ShouldCancelBringIntoView())
01076                 {
01077                     args.Cancel(true);
01078                 }
01079                 else
01080                 {
01081                     requestEventArgs.AnimationDesired(true);
01082                 }
01083
01084                 break;
01085             }
01086         }
01087     }
01088
01089     if (m_bringingIntoViewEventSource)
01090     {
01091         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01092
01093         m_bringingIntoViewEventSource(*this, args);
01094     }
01095 }
01096
01097 void ScrollView::OnScrollPresenterAnchorRequested(
01098     const winrt::IInspectable& /*sender*/,
01099     const winrt::ScrollingAnchorRequestedEventArgs& args)
01100 {
01101     if (m_anchorRequestedEventSource)
01102     {
01103         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01104
01105         m_anchorRequestedEventSource(*this, args);
01106     }
01107 }
01108
01109 void ScrollView::OnCompositionTargetRendering(
01110     const winrt::IInspectable& /*sender*/,
01111     const winrt::IInspectable& /*args*/)
01112 {
01113     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01114
01115     if (!m_bringIntoViewOperations.empty())
01116     {
01117         for (auto operationsIter = m_bringIntoViewOperations.begin(); operationsIter != m_bringIntoViewOperations.end();)
01118         {
01119             auto& bringIntoViewOperation = *operationsIter;
01120             operationsIter++;
01121
01122             SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR_INT, METH_NAME, this, bringIntoViewOperation->TargetElement(), bringIntoViewOperation->TicksCount());
01123
01124             if (bringIntoViewOperation->HasMaxTicksCount())
01125             {
01126                 // This ScrollView is no longer expected to receive BringingIntoView notifications from its ScrollPresenter,
01127                 // resulting from a FocusManager::TryFocusAsync call in ScrollView::HandleKeyDownForXYNavigation.
01128                 m_bringIntoViewOperations.remove(bringIntoViewOperation);
01129             }
01130             else
01131             {
01132                 // Increment the number of ticks ellapsed since the FocusManager::TryFocusAsync call, and continue to wait for BringingIntoView notifications.
01133                 bringIntoViewOperation->TickOperation();
01134             }
01135         }
01136     }
01137
01138     if (m_bringIntoViewOperations.empty())
01139     {
01140         UnhookCompositionTargetRendering();
01141     }
01142 }
01143
01144 void ScrollView::OnScrollPresenterPropertyChanged(
01145     const winrt::DependencyObject& /*sender*/,
01146     const winrt::DependencyProperty& args)
01147 {
01148     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01149
01150     if (args == winrt::ScrollPresenter::ComputedHorizontalScrollModeProperty())
01151     {
01152         SetValue(s_ComputedHorizontalScrollModeProperty, box_value(m_scrollPresenter.get().ComputedHorizontalScrollMode()));
01153     }
01154     else if (args == winrt::ScrollPresenter::ComputedVerticalScrollModeProperty())
01155     {
01156         SetValue(s_ComputedVerticalScrollModeProperty, box_value(m_scrollPresenter.get().ComputedVerticalScrollMode()));
01157     }
01158 }
01159
01160 void ScrollView::ResetHideIndicatorsTimer(bool restart)
01161 {
01162     if (m_hideIndicatorsTimer && m_hideIndicatorsTimer.IsEnabled())
01163     {
01164         m_hideIndicatorsTimer.Stop();
01165         if (restart)
01166         {
01167             m_hideIndicatorsTimer.Start();
01168         }
01169     }
01170 }
01171
01172 void ScrollView::HookCompositionTargetRendering()
01173 {
01174     if (!m_renderingToken)
01175     {
01176         winrt::Microsoft::UI::Xaml::Media::CompositionTarget compositionTarget{ nullptr };
01177         m_renderingToken = compositionTarget.Rendering(winrt::auto_revoke, { this, &ScrollView::OnCompositionTargetRendering });
01178     }
01179 }
01180
01181 void ScrollView::UnhookCompositionTargetRendering()
01182 {
01183     m_renderingToken.revoke();
01184 }
01185
01186 void ScrollView::HookScrollViewEvents()
01187 {
01188     MUX_ASSERT(!m_onPointerEnteredEventHandler);
01189     MUX_ASSERT(!m_onPointerMovedEventHandler);
01190     MUX_ASSERT(!m_onPointerExitedEventHandler);
01191     MUX_ASSERT(!m_onPointerPressedEventHandler);
01192     MUX_ASSERT(!m_onPointerReleasedEventHandler);
01193     MUX_ASSERT(!m_onPointerCanceledEventHandler);
01194     MUX_ASSERT(m_gettingFocusToken.value == 0);
01195     MUX_ASSERT(m_isEnabledChangedToken.value == 0);
01196     MUX_ASSERT(m_unloadedToken.value == 0);
01197
01198     m_gettingFocusToken = GettingFocus({ this, &ScrollView::OnScrollViewGettingFocus });
01199     m_isEnabledChangedToken = IsEnabledChanged({ this, &ScrollView::OnScrollViewIsEnabledChanged });
01200     m_unloadedToken = Unloaded({ this, &ScrollView::OnScrollViewUnloaded });
01201
01202     m_onPointerEnteredEventHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnScrollViewPointerEntered });
01203     AddHandler(winrt::UIElement::PointerEnteredEvent(), m_onPointerEnteredEventHandler, false);
01204
01205     m_onPointerMovedEventHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnScrollViewPointerMoved });
01206     AddHandler(winrt::UIElement::PointerMovedEvent(), m_onPointerMovedEventHandler, false);
01207
01208     m_onPointerExitedEventHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnScrollViewPointerExited });
01209     AddHandler(winrt::UIElement::PointerExitedEvent(), m_onPointerExitedEventHandler, false);
01210
01211     m_onPointerPressedEventHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnScrollViewPointerPressed });
01212     AddHandler(winrt::UIElement::PointerPressedEvent(), m_onPointerPressedEventHandler, false);
01213
01214     m_onPointerReleasedEventHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnScrollViewPointerReleased });
01215     AddHandler(winrt::UIElement::PointerReleasedEvent(), m_onPointerReleasedEventHandler, true);
01216
01217     m_onPointerCanceledEventHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnScrollViewPointerCanceled });
01218     AddHandler(winrt::UIElement::PointerCanceledEvent(), m_onPointerCanceledEventHandler, true);
01219 }
01220
01221 void ScrollView::UnhookScrollViewEvents()
01222 {
01223     if (m_gettingFocusToken.value != 0)
01224     {
01225         GettingFocus(m_gettingFocusToken);
01226         m_gettingFocusToken.value = 0;
01227     }
01228
01229     if (m_isEnabledChangedToken.value != 0)
01230     {
01231         IsEnabledChanged(m_isEnabledChangedToken);
01232         m_isEnabledChangedToken.value = 0;
01233     }
01234
01235     if (m_unloadedToken.value != 0)
01236     {
01237         Unloaded(m_unloadedToken);
01238         m_unloadedToken.value = 0;
01239     }
01240
01241     if (m_onPointerEnteredEventHandler)
01242     {
01243         RemoveHandler(winrt::UIElement::PointerEnteredEvent(), m_onPointerEnteredEventHandler);
01244         m_onPointerEnteredEventHandler = nullptr;
01245     }
01246
01247     if (m_onPointerMovedEventHandler)
01248     {
01249         RemoveHandler(winrt::UIElement::PointerMovedEvent(), m_onPointerMovedEventHandler);
01250         m_onPointerMovedEventHandler = nullptr;
01251     }
01252
01253     if (m_onPointerExitedEventHandler)
01254     {
01255         RemoveHandler(winrt::UIElement::PointerExitedEvent(), m_onPointerExitedEventHandler);
01256         m_onPointerExitedEventHandler = nullptr;
01257     }
01258
01259     if (m_onPointerPressedEventHandler)
01260     {
01261         RemoveHandler(winrt::UIElement::PointerPressedEvent(), m_onPointerPressedEventHandler);
01262         m_onPointerPressedEventHandler = nullptr;
01263     }
01264
01265     if (m_onPointerReleasedEventHandler)
01266     {
01267         RemoveHandler(winrt::UIElement::PointerReleasedEvent(), m_onPointerReleasedEventHandler);
01268         m_onPointerReleasedEventHandler = nullptr;
01269     }
01270
01271     if (m_onPointerCanceledEventHandler)
01272     {
01273         RemoveHandler(winrt::UIElement::PointerCanceledEvent(), m_onPointerCanceledEventHandler);
01274         m_onPointerCanceledEventHandler = nullptr;
01275     }
01276 }
01277
01278 void ScrollView::HookScrollPresenterEvents()
01279 {
01280     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01281
01282     MUX_ASSERT(m_scrollPresenterExtentChangedToken.value == 0);
01283     MUX_ASSERT(m_scrollPresenterStateChangedToken.value == 0);
01284     MUX_ASSERT(m_scrollPresenterScrollAnimationStartingToken.value == 0);
01285     MUX_ASSERT(m_scrollPresenterZoomAnimationStartingToken.value == 0);
01286     MUX_ASSERT(m_scrollPresenterScrollStartingToken.value == 0);
01287     MUX_ASSERT(m_scrollPresenterZoomStartingToken.value == 0);
01288     MUX_ASSERT(m_scrollPresenterViewChangedToken.value == 0);
01289     MUX_ASSERT(m_scrollPresenterScrollCompletedToken.value == 0);
01290     MUX_ASSERT(m_scrollPresenterZoomCompletedToken.value == 0);
01291     MUX_ASSERT(m_scrollPresenterBringingIntoViewToken.value == 0);
01292     MUX_ASSERT(m_scrollPresenterAnchorRequestedToken.value == 0);
01293     MUX_ASSERT(m_scrollPresenterComputedHorizontalScrollModeChangedToken.value == 0);
01294     MUX_ASSERT(m_scrollPresenterComputedVerticalScrollModeChangedToken.value == 0);
01295
01296     if (auto scrollPresenter = m_scrollPresenter.get())
01297     {
01298         m_scrollPresenterExtentChangedToken = scrollPresenter.ExtentChanged({ this, &ScrollView::OnScrollPresenterExtentChanged });
01299         m_scrollPresenterStateChangedToken = scrollPresenter.StateChanged({ this, &ScrollView::OnScrollPresenterStateChanged });
01300         m_scrollPresenterScrollAnimationStartingToken = scrollPresenter.ScrollAnimationStarting({ this, &ScrollView::OnScrollAnimationStarting });
01301         m_scrollPresenterZoomAnimationStartingToken = scrollPresenter.ZoomAnimationStarting({ this, &ScrollView::OnZoomAnimationStarting });
01302         m_scrollPresenterViewChangedToken = scrollPresenter.ViewChanged({ this, &ScrollView::OnScrollPresenterViewChanged });
01303         m_scrollPresenterScrollCompletedToken = scrollPresenter.ScrollCompleted({ this, &ScrollView::OnScrollPresenterScrollCompleted });
01304         m_scrollPresenterZoomCompletedToken = scrollPresenter.ZoomCompleted({ this, &ScrollView::OnScrollPresenterZoomCompleted });
01305         m_scrollPresenterBringingIntoViewToken = scrollPresenter.BringingIntoView({ this, &ScrollView::OnScrollPresenterBringingIntoView });
01306         m_scrollPresenterAnchorRequestedToken = scrollPresenter.AnchorRequested({ this, &ScrollView::OnScrollPresenterAnchorRequested });
01307
01308         const winrt::IScrollPresenter2 scrollPresenter2 = scrollPresenter.try_as<winrt::IScrollPresenter2>();
01309
01310         if (scrollPresenter2)
01311         {
01312             m_scrollPresenterScrollStartingToken = scrollPresenter2.ScrollStarting({ this, &ScrollView::OnScrollPresenterScrollStarting });
01313             m_scrollPresenterZoomStartingToken = scrollPresenter2.ZoomStarting({ this, &ScrollView::OnScrollPresenterZoomStarting });
01314         }
01315
01316         const winrt::DependencyObject scrollPresenterAsDO = scrollPresenter.try_as<winrt::DependencyObject>();
01317
01318         m_scrollPresenterComputedHorizontalScrollModeChangedToken.value = scrollPresenterAsDO.RegisterPropertyChangedCallback(
01319             winrt::ScrollPresenter::ComputedHorizontalScrollModeProperty(), { this, &ScrollView::OnScrollPresenterPropertyChanged });
01320
01321         m_scrollPresenterComputedVerticalScrollModeChangedToken.value = scrollPresenterAsDO.RegisterPropertyChangedCallback(
01322             winrt::ScrollPresenter::ComputedVerticalScrollModeProperty(), { this, &ScrollView::OnScrollPresenterPropertyChanged });
01323     }
01324 }
01325
01326 void ScrollView::UnhookScrollPresenterEvents(bool isForDestructor)
01327 {
01328     if (isForDestructor)
01329     {
01330         SCROLLVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
01331     }
01332     else
01333     {
01334         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01335     }
01336
01337     if (auto scrollPresenter = isForDestructor ? m_scrollPresenter.safe_get() : m_scrollPresenter.get())
01338     {
01339         if (m_scrollPresenterExtentChangedToken.value != 0)
01340         {
01341             scrollPresenter.ExtentChanged(m_scrollPresenterExtentChangedToken);
01342             m_scrollPresenterExtentChangedToken.value = 0;
01343         }
01344
01345         if (m_scrollPresenterStateChangedToken.value != 0)
01346         {
01347             scrollPresenter.StateChanged(m_scrollPresenterStateChangedToken);
01348             m_scrollPresenterStateChangedToken.value = 0;
01349         }
01350
01351         if (m_scrollPresenterScrollAnimationStartingToken.value != 0)
01352         {
01353             scrollPresenter.ScrollAnimationStarting(m_scrollPresenterScrollAnimationStartingToken);
01354             m_scrollPresenterScrollAnimationStartingToken.value = 0;
01355         }
01356
01357         if (m_scrollPresenterZoomAnimationStartingToken.value != 0)
01358         {
01359             scrollPresenter.ZoomAnimationStarting(m_scrollPresenterZoomAnimationStartingToken);
01360             m_scrollPresenterZoomAnimationStartingToken.value = 0;
01361         }
01362
01363         if (m_scrollPresenterScrollStartingToken.value != 0)
01364         {
01365             const winrt::IScrollPresenter2 scrollPresenter2 = scrollPresenter.try_as<winrt::IScrollPresenter2>();
01366
01367             if (scrollPresenter2)
01368             {
01369                 scrollPresenter2.ScrollStarting(m_scrollPresenterScrollStartingToken);
01370             }
01371
01372             m_scrollPresenterScrollStartingToken.value = 0;
01373         }
01374
01375         if (m_scrollPresenterZoomStartingToken.value != 0)
01376         {
01377             const winrt::IScrollPresenter2 scrollPresenter2 = scrollPresenter.try_as<winrt::IScrollPresenter2>();
01378
01379             if (scrollPresenter2)
01380             {
01381                 scrollPresenter2.ZoomStarting(m_scrollPresenterZoomStartingToken);
01382             }
01383
01384             m_scrollPresenterZoomStartingToken.value = 0;
01385         }
01386
01387         if (m_scrollPresenterViewChangedToken.value != 0)
01388         {
01389             scrollPresenter.ViewChanged(m_scrollPresenterViewChangedToken);
01390             m_scrollPresenterViewChangedToken.value = 0;
01391         }
01392
01393         if (m_scrollPresenterScrollCompletedToken.value != 0)
01394         {
01395             scrollPresenter.ScrollCompleted(m_scrollPresenterScrollCompletedToken);
01396             m_scrollPresenterScrollCompletedToken.value = 0;
01397         }
01398
01399         if (m_scrollPresenterZoomCompletedToken.value != 0)
01400         {
01401             scrollPresenter.ZoomCompleted(m_scrollPresenterZoomCompletedToken);
01402             m_scrollPresenterZoomCompletedToken.value = 0;
01403         }
01404
01405         if (m_scrollPresenterBringingIntoViewToken.value != 0)
01406         {
01407             scrollPresenter.BringingIntoView(m_scrollPresenterBringingIntoViewToken);
01408             m_scrollPresenterBringingIntoViewToken.value = 0;
01409         }
01410
01411         if (m_scrollPresenterAnchorRequestedToken.value != 0)
01412         {
01413             scrollPresenter.AnchorRequested(m_scrollPresenterAnchorRequestedToken);
01414             m_scrollPresenterAnchorRequestedToken.value = 0;
01415         }
01416
01417         const winrt::DependencyObject scrollPresenterAsDO = scrollPresenter.try_as<winrt::DependencyObject>();
01418
01419         if (m_scrollPresenterComputedHorizontalScrollModeChangedToken.value != 0)
01420         {
01421             scrollPresenterAsDO.UnregisterPropertyChangedCallback(winrt::ScrollPresenter::ComputedHorizontalScrollModeProperty(), m_scrollPresenterComputedHorizontalScrollModeChangedToken.value);
01422             m_scrollPresenterComputedHorizontalScrollModeChangedToken.value = 0;
01423         }
01424
01425         if (m_scrollPresenterComputedVerticalScrollModeChangedToken.value != 0)
01426         {
01427             scrollPresenterAsDO.UnregisterPropertyChangedCallback(winrt::ScrollPresenter::ComputedVerticalScrollModeProperty(), m_scrollPresenterComputedVerticalScrollModeChangedToken.value);
01428             m_scrollPresenterComputedVerticalScrollModeChangedToken.value = 0;
01429         }
01430     }
01431 }
01432
01433 void ScrollView::HookHorizontalScrollControllerEvents()
01434 {
01435     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01436
01437     MUX_ASSERT(m_horizontalScrollControllerCanScrollChangedToken.value == 0);
01438     MUX_ASSERT(m_horizontalScrollControllerIsScrollingWithMouseChangedToken.value == 0);
01439     MUX_ASSERT(!m_onHorizontalScrollControllerPointerEnteredHandler);
01440     MUX_ASSERT(!m_onHorizontalScrollControllerPointerExitedHandler);
01441
01442     if (winrt::IScrollController horizontalScrollController = m_horizontalScrollController.get())
01443     {
01444         m_horizontalScrollControllerCanScrollChangedToken =
01445             horizontalScrollController.CanScrollChanged({ this, &ScrollView::OnScrollControllerCanScrollChanged });
01446
01447         m_horizontalScrollControllerIsScrollingWithMouseChangedToken =
01448             horizontalScrollController.IsScrollingWithMouseChanged({ this, &ScrollView::OnScrollControllerIsScrollingWithMouseChanged });
01449     }
01450
01451     if (winrt::IUIElement horizontalScrollControllerElement = m_horizontalScrollControllerElement.get())
01452     {
01453         m_onHorizontalScrollControllerPointerEnteredHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnHorizontalScrollControllerPointerEntered });
01454         horizontalScrollControllerElement.AddHandler(winrt::UIElement::PointerEnteredEvent(), m_onHorizontalScrollControllerPointerEnteredHandler, true);
01455
01456         m_onHorizontalScrollControllerPointerExitedHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnHorizontalScrollControllerPointerExited });
01457         horizontalScrollControllerElement.AddHandler(winrt::UIElement::PointerExitedEvent(), m_onHorizontalScrollControllerPointerExitedHandler, true);
01458     }
01459 }
01460
01461 void ScrollView::UnhookHorizontalScrollControllerEvents(bool isForDestructor)
01462 {
01463     if (isForDestructor)
01464     {
01465         SCROLLVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
01466     }
01467     else
01468     {
01469         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01470     }
01471
01472     if (winrt::IScrollController horizontalScrollController = isForDestructor ? m_horizontalScrollController.safe_get() : m_horizontalScrollController.get())
01473     {
01474         if (m_horizontalScrollControllerCanScrollChangedToken.value != 0)
01475         {
01476             horizontalScrollController.CanScrollChanged(m_horizontalScrollControllerCanScrollChangedToken);
01477         }
01478         m_horizontalScrollControllerCanScrollChangedToken.value = 0;
01479
01480         if (m_horizontalScrollControllerIsScrollingWithMouseChangedToken.value != 0)
01481         {
01482             horizontalScrollController.IsScrollingWithMouseChanged(m_horizontalScrollControllerIsScrollingWithMouseChangedToken);
01483         }
01484         m_horizontalScrollControllerIsScrollingWithMouseChangedToken.value = 0;
01485     }
01486
01487     if (winrt::IUIElement horizontalScrollControllerElement = isForDestructor ? m_horizontalScrollControllerElement.safe_get() : m_horizontalScrollControllerElement.get())
01488     {
01489         if (m_onHorizontalScrollControllerPointerEnteredHandler)
01490         {
01491             horizontalScrollControllerElement.RemoveHandler(winrt::UIElement::PointerEnteredEvent(), m_onHorizontalScrollControllerPointerEnteredHandler);
01492             m_onHorizontalScrollControllerPointerEnteredHandler = nullptr;
01493         }
01494
01495         if (m_onHorizontalScrollControllerPointerExitedHandler)
01496         {
01497             horizontalScrollControllerElement.RemoveHandler(winrt::UIElement::PointerExitedEvent(), m_onHorizontalScrollControllerPointerExitedHandler);
01498             m_onHorizontalScrollControllerPointerExitedHandler = nullptr;
01499         }
01500     }
01501 }
01502
01503 void ScrollView::HookVerticalScrollControllerEvents()
01504 {
01505     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01506
01507     MUX_ASSERT(m_verticalScrollControllerCanScrollChangedToken.value == 0);
01508     MUX_ASSERT(m_verticalScrollControllerIsScrollingWithMouseChangedToken.value == 0);
01509     MUX_ASSERT(!m_onVerticalScrollControllerPointerEnteredHandler);
01510     MUX_ASSERT(!m_onVerticalScrollControllerPointerExitedHandler);
01511
01512     if (winrt::IScrollController verticalScrollController = m_verticalScrollController.get())
01513     {
01514         m_verticalScrollControllerCanScrollChangedToken =
01515             verticalScrollController.CanScrollChanged({ this, &ScrollView::OnScrollControllerCanScrollChanged });
01516
01517         m_verticalScrollControllerIsScrollingWithMouseChangedToken =
01518             verticalScrollController.IsScrollingWithMouseChanged({ this, &ScrollView::OnScrollControllerIsScrollingWithMouseChanged });
01519     }
01520
01521     if (winrt::IUIElement verticalScrollControllerElement = m_verticalScrollControllerElement.get())
01522     {
01523         m_onVerticalScrollControllerPointerEnteredHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnVerticalScrollControllerPointerEntered });
01524         verticalScrollControllerElement.AddHandler(winrt::UIElement::PointerEnteredEvent(), m_onVerticalScrollControllerPointerEnteredHandler, true);
01525
01526         m_onVerticalScrollControllerPointerExitedHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollView::OnVerticalScrollControllerPointerExited });
01527         verticalScrollControllerElement.AddHandler(winrt::UIElement::PointerExitedEvent(), m_onVerticalScrollControllerPointerExitedHandler, true);
01528     }
01529 }
01530
01531 void ScrollView::UnhookVerticalScrollControllerEvents(bool isForDestructor)
01532 {
01533     if (isForDestructor)
01534     {
01535         SCROLLVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
01536     }
01537     else
01538     {
01539         SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01540     }
01541
01542     if (winrt::IScrollController verticalScrollController = isForDestructor ? m_verticalScrollController.safe_get() : m_verticalScrollController.get())
01543     {
01544         if (m_verticalScrollControllerCanScrollChangedToken.value != 0)
01545         {
01546             verticalScrollController.CanScrollChanged(m_verticalScrollControllerCanScrollChangedToken);
01547         }
01548         m_verticalScrollControllerCanScrollChangedToken.value = 0;
01549
01550         if (m_verticalScrollControllerIsScrollingWithMouseChangedToken.value != 0)
01551         {
01552             verticalScrollController.IsScrollingWithMouseChanged(m_verticalScrollControllerIsScrollingWithMouseChangedToken);
01553         }
01554         m_verticalScrollControllerIsScrollingWithMouseChangedToken.value = 0;
01555     }
01556
01557     if (winrt::IUIElement verticalScrollControllerElement = isForDestructor ? m_verticalScrollControllerElement.safe_get() : m_verticalScrollControllerElement.get())
01558     {
01559         if (m_onVerticalScrollControllerPointerEnteredHandler)
01560         {
01561             verticalScrollControllerElement.RemoveHandler(winrt::UIElement::PointerEnteredEvent(), m_onVerticalScrollControllerPointerEnteredHandler);
01562             m_onVerticalScrollControllerPointerEnteredHandler = nullptr;
01563         }
01564
01565         if (m_onVerticalScrollControllerPointerExitedHandler)
01566         {
01567             verticalScrollControllerElement.RemoveHandler(winrt::UIElement::PointerExitedEvent(), m_onVerticalScrollControllerPointerExitedHandler);
01568             m_onVerticalScrollControllerPointerExitedHandler = nullptr;
01569         }
01570     }
01571 }
01572
01573 void ScrollView::UpdateScrollPresenter(const winrt::ScrollPresenter& scrollPresenter)
01574 {
01575     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01576
01577     UnhookScrollPresenterEvents(false /*isForDestructor*/);
01578     m_scrollPresenter.set(nullptr);
01579
01580     SetValue(s_ScrollPresenterProperty, scrollPresenter);
01581
01582     if (scrollPresenter)
01583     {
01584         m_scrollPresenter.set(scrollPresenter);
01585         HookScrollPresenterEvents();
01586     }
01587 }
01588
01589 void ScrollView::UpdateHorizontalScrollController(
01590     const winrt::IScrollController& horizontalScrollController,
01591     const winrt::IUIElement& horizontalScrollControllerElement)
01592 {
01593     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01594
01595     UnhookHorizontalScrollControllerEvents(false /*isForDestructor*/);
01596
01597     m_horizontalScrollController.set(horizontalScrollController);
01598     m_horizontalScrollControllerElement.set(horizontalScrollControllerElement);
01599     HookHorizontalScrollControllerEvents();
01600     UpdateScrollPresenterHorizontalScrollController(horizontalScrollController);
01601 }
01602
01603 void ScrollView::UpdateScrollPresenterHorizontalScrollController(const winrt::IScrollController& horizontalScrollController)
01604 {
01605     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01606
01607     if (auto scrollPresenter = m_scrollPresenter.get())
01608     {
01609         scrollPresenter.HorizontalScrollController(horizontalScrollController);
01610     }
01611 }
01612
01613 void ScrollView::UpdateVerticalScrollController(
01614     const winrt::IScrollController& verticalScrollController,
01615     const winrt::IUIElement& verticalScrollControllerElement)
01616 {
01617     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01618
01619     UnhookVerticalScrollControllerEvents(false /*isForDestructor*/);
01620
01621     m_verticalScrollController.set(verticalScrollController);
01622     m_verticalScrollControllerElement.set(verticalScrollControllerElement);
01623     HookVerticalScrollControllerEvents();
01624     UpdateScrollPresenterVerticalScrollController(verticalScrollController);
01625 }
01626
01627 void ScrollView::UpdateScrollPresenterVerticalScrollController(const winrt::IScrollController& verticalScrollController)
01628 {
01629     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01630
01631     if (auto scrollPresenter = m_scrollPresenter.get())
01632     {
01633         scrollPresenter.VerticalScrollController(verticalScrollController);
01634     }
01635 }
01636
01637 void ScrollView::UpdateScrollControllersSeparator(const winrt::IUIElement& scrollControllersSeparator)
01638 {
01639     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01640
01641     m_scrollControllersSeparatorElement.set(scrollControllersSeparator);
01642 }
01643
01644 void ScrollView::UpdateScrollControllersVisibility(
01645     bool horizontalChange, bool verticalChange)
01646 {
01647     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01648
01649     MUX_ASSERT(horizontalChange || verticalChange);
01650
01651     bool isHorizontalScrollControllerVisible = false;
01652
01653     if (horizontalChange)
01654     {
01655         const auto scrollBarVisibility = HorizontalScrollBarVisibility();
01656
01657         if (scrollBarVisibility == winrt::ScrollingScrollBarVisibility::Auto &&
01658             m_horizontalScrollController &&
01659             m_horizontalScrollController.get().CanScroll())
01660         {
01661             isHorizontalScrollControllerVisible = true;
01662         }
01663         else
01664         {
01665             isHorizontalScrollControllerVisible = (scrollBarVisibility == winrt::ScrollingScrollBarVisibility::Visible);
01666         }
01667
01668         SetValue(s_ComputedHorizontalScrollBarVisibilityProperty, box_value(isHorizontalScrollControllerVisible ? winrt::Visibility::Visible : winrt::Visibility::Collapsed));
01669     }
01670     else
01671     {
01672         isHorizontalScrollControllerVisible = ComputedHorizontalScrollBarVisibility() == winrt::Visibility::Visible;
01673     }
01674
01675     bool isVerticalScrollControllerVisible = false;
01676
01677     if (verticalChange)
01678     {
01679         const auto scrollBarVisibility = VerticalScrollBarVisibility();
01680
01681         if (scrollBarVisibility == winrt::ScrollingScrollBarVisibility::Auto &&
01682             m_verticalScrollController &&
01683             m_verticalScrollController.get().CanScroll())
01684         {
01685             isVerticalScrollControllerVisible = true;
01686         }
01687         else
01688         {
01689             isVerticalScrollControllerVisible = (scrollBarVisibility == winrt::ScrollingScrollBarVisibility::Visible);
01690         }
01691
01692         SetValue(s_ComputedVerticalScrollBarVisibilityProperty, box_value(isVerticalScrollControllerVisible ? winrt::Visibility::Visible : winrt::Visibility::Collapsed));
01693     }
01694     else
01695     {
01696         isVerticalScrollControllerVisible = ComputedVerticalScrollBarVisibility() == winrt::Visibility::Visible;
01697     }
01698
01699     if (m_scrollControllersSeparatorElement)
01700     {
01701         m_scrollControllersSeparatorElement.get().Visibility(isHorizontalScrollControllerVisible && isVerticalScrollControllerVisible ?
01702             winrt::Visibility::Visible : winrt::Visibility::Collapsed);
01703     }
01704 }
01705
01706 bool ScrollView::IsInputKindIgnored(winrt::ScrollingInputKinds const& inputKind)
01707 {
01708     return (IgnoredInputKinds() & inputKind) == inputKind;
01709 }
01710
01711 bool ScrollView::AreAllScrollControllersCollapsed(bool useSafeGet) const
01712 {
01713     return
01714         (m_horizontalScrollControllerElement.safe_get(useSafeGet) == nullptr ||
01715          !SharedHelpers::IsAncestor(m_horizontalScrollControllerElement.try_as<winrt::DependencyObject>() /*child*/, static_cast<winrt::DependencyObject>(*this) /*parent*/, true /*checkVisibility*/)) &&
01716         (m_verticalScrollControllerElement.safe_get(useSafeGet) == nullptr ||
01717          !SharedHelpers::IsAncestor(m_verticalScrollControllerElement.try_as<winrt::DependencyObject>() /*child*/, static_cast<winrt::DependencyObject>(*this) /*parent*/, true /*checkVisibility*/));
01718 }
01719
01720 bool ScrollView::AreBothScrollControllersVisible() const
01721 {
01722     return SharedHelpers::IsAncestor(m_horizontalScrollControllerElement.try_as<winrt::DependencyObject>() /*child*/, static_cast<winrt::DependencyObject>(*this) /*parent*/, true /*checkVisibility*/) &&
01723         SharedHelpers::IsAncestor(m_verticalScrollControllerElement.try_as<winrt::DependencyObject>() /*child*/, static_cast<winrt::DependencyObject>(*this) /*parent*/, true /*checkVisibility*/);
01724 }
01725
01726 bool ScrollView::IsScrollControllersSeparatorVisible() const
01727 {
01728     return m_scrollControllersSeparatorElement && m_scrollControllersSeparatorElement.get().Visibility() == winrt::Visibility::Visible;
01729 }
01730
01731 void ScrollView::HideIndicators(
01732     bool useTransitions,
01733     bool useSafeGet)
01734 {
01735     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, useTransitions, m_keepIndicatorsShowing);
01736
01737     MUX_ASSERT(AreScrollControllersAutoHiding());
01738
01739     if (!AreAllScrollControllersCollapsed(useSafeGet) && !m_keepIndicatorsShowing)
01740     {
01741         GoToState(s_noIndicatorStateName, useTransitions);
01742
01743         if (!m_hasNoIndicatorStateStoryboardCompletedHandler)
01744         {
01745             m_showingMouseIndicators = false;
01746         }
01747     }
01748 }
01749
01750 void ScrollView::HideIndicatorsAfterDelay()
01751 {
01752     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, m_keepIndicatorsShowing);
01753
01754     MUX_ASSERT(AreScrollControllersAutoHiding());
01755
01756     if (!m_keepIndicatorsShowing && IsLoaded())
01757     {
01758         if (m_hideIndicatorsTimer)
01759         {
01760             if (m_hideIndicatorsTimer.IsEnabled())
01761             {
01762                 m_hideIndicatorsTimer.Stop();
01763             }
01764         }
01765         else
01766         {
01767             m_hideIndicatorsTimer = winrt::DispatcherTimer();
01768             m_hideIndicatorsTimer.Interval(winrt::TimeSpan::duration(s_noIndicatorCountdown));
01769             m_hideIndicatorsTimer.Tick({ this, &ScrollView::OnHideIndicatorsTimerTick });
01770         }
01771
01772         m_hideIndicatorsTimer.Start();
01773     }
01774 }
01775
01776 void ScrollView::UpdateVisualStates(
01777     bool useTransitions,
01778     bool showIndicators,
01779     bool hideIndicators,
01780     bool scrollControllersAutoHidingChanged,
01781     bool updateScrollControllersAutoHiding,
01782     bool onlyForAutoHidingScrollControllers)
01783 {
01784     if (updateScrollControllersAutoHiding)
01785     {
01786         UpdateScrollControllersAutoHiding();
01787     }
01788
01789     if (onlyForAutoHidingScrollControllers && !AreScrollControllersAutoHiding())
01790     {
01791         return;
01792     }
01793
01794     UpdateScrollControllersVisualState(useTransitions, showIndicators, hideIndicators);
01795     UpdateScrollControllersSeparatorVisualState(useTransitions, scrollControllersAutoHidingChanged);
01796 }
01797
01798 // Updates the state for the ScrollingIndicatorStates state group.
01799 void ScrollView::UpdateScrollControllersVisualState(
01800     bool useTransitions,
01801     bool showIndicators,
01802     bool hideIndicators)
01803 {
01804     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, useTransitions);
01805     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, showIndicators, hideIndicators);
01806
01807     MUX_ASSERT(!(showIndicators && hideIndicators));
01808
01809     const bool areScrollControllersAutoHiding = AreScrollControllersAutoHiding();
01810
01811     MUX_ASSERT(!(!areScrollControllersAutoHiding && hideIndicators));
01812
01813     if ((!areScrollControllersAutoHiding || showIndicators) && !hideIndicators)
01814     {
01815         if (AreAllScrollControllersCollapsed())
01816         {
01817             return;
01818         }
01819
01820         ResetHideIndicatorsTimer(true /*restart*/);
01821
01822         // Mouse indicators dominate if they are already showing or if we have set the flag to prefer them.
01823         if (m_preferMouseIndicators || m_showingMouseIndicators || !areScrollControllersAutoHiding)
01824         {
01825             GoToState(s_mouseIndicatorStateName, useTransitions);
01826
01827             m_showingMouseIndicators = true;
01828         }
01829         else
01830         {
01831             GoToState(s_touchIndicatorStateName, useTransitions);
01832         }
01833     }
01834     else if (!m_keepIndicatorsShowing)
01835     {
01836         if (SharedHelpers::IsAnimationsEnabled())
01837         {
01838             // By default there is a delay before the NoIndicator state actually shows.
01839             HideIndicators();
01840         }
01841         else
01842         {
01843             // Since OS animations are turned off, use a timer to delay the indicators' hiding.
01844             HideIndicatorsAfterDelay();
01845         }
01846     }
01847 }
01848
01849 // Updates the state for the ScrollBarsSeparatorStates state group.
01850 void ScrollView::UpdateScrollControllersSeparatorVisualState(
01851     bool useTransitions,
01852     bool scrollControllersAutoHidingChanged)
01853 {
01854     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, useTransitions, scrollControllersAutoHidingChanged);
01855
01856     if (!IsScrollControllersSeparatorVisible())
01857     {
01858         return;
01859     }
01860
01861     const bool isEnabled = IsEnabled();
01862     const bool areScrollControllersAutoHiding = AreScrollControllersAutoHiding();
01863     bool showScrollControllersSeparator = !areScrollControllersAutoHiding;
01864
01865     if (!showScrollControllersSeparator &&
01866         AreBothScrollControllersVisible() &&
01867         (m_preferMouseIndicators || m_showingMouseIndicators) &&
01868         (m_isPointerOverHorizontalScrollController || m_isPointerOverVerticalScrollController))
01869     {
01870         showScrollControllersSeparator = true;
01871     }
01872
01873     // Select the proper state for the scroll controllers separator within the ScrollBarsSeparatorStates group:
01874     if (SharedHelpers::IsAnimationsEnabled())
01875     {
01876         // When OS animations are turned on, show the separator when a scroll controller is shown unless the ScrollView is disabled, using an animation.
01877         if (showScrollControllersSeparator && isEnabled)
01878         {
01879             GoToState(s_scrollBarsSeparatorExpanded, useTransitions);
01880         }
01881         else if (isEnabled)
01882         {
01883             GoToState(s_scrollBarsSeparatorCollapsed, useTransitions);
01884         }
01885         else
01886         {
01887             GoToState(s_scrollBarsSeparatorCollapsedDisabled, useTransitions);
01888         }
01889     }
01890     else
01891     {
01892         // OS animations are turned off. Show or hide the separator depending on the presence of scroll controllers, without an animation.
01893         // When the ScrollView is disabled, hide the separator in sync with the ScrollBar(s).
01894         if (showScrollControllersSeparator)
01895         {
01896             if (isEnabled)
01897             {
01898                 GoToState((areScrollControllersAutoHiding || scrollControllersAutoHidingChanged) ? s_scrollBarsSeparatorExpandedWithoutAnimation : s_scrollBarsSeparatorDisplayedWithoutAnimation, useTransitions);
01899             }
01900             else
01901             {
01902                 GoToState(s_scrollBarsSeparatorCollapsed, useTransitions);
01903             }
01904         }
01905         else
01906         {
01907             GoToState(isEnabled ? s_scrollBarsSeparatorCollapsedWithoutAnimation : s_scrollBarsSeparatorCollapsed, useTransitions);
01908         }
01909     }
01910 }
01911
01912 void ScrollView::GoToState(std::wstring_view const& stateName, bool useTransitions)
01913 {
01914     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, stateName.data(), useTransitions);
01915
01916     winrt::VisualStateManager::GoToState(*this, stateName, useTransitions);
01917 }
01918
01919 void ScrollView::OnKeyDown(winrt::KeyRoutedEventArgs const& e)
01920 {
01921     SCROLLVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::KeyRoutedEventArgsToString(e).c_str());
01922
01923     __super::OnKeyDown(e);
01924
01925     m_preferMouseIndicators = false;
01926
01927     if (m_scrollPresenter)
01928     {
01929         winrt::KeyRoutedEventArgs eventArgs = e.as<winrt::KeyRoutedEventArgs>();
01930         if (!eventArgs.Handled())
01931         {
01932             const auto originalKey = eventArgs.OriginalKey();
01933             const bool isGamepadKey = FocusHelper::IsGamepadNavigationDirection(originalKey) || FocusHelper::IsGamepadPageNavigationDirection(originalKey);
01934
01935             if (isGamepadKey)
01936             {
01937                 if (IsInputKindIgnored(winrt::ScrollingInputKinds::Gamepad))
01938                 {
01939                     return;
01940                 }
01941             }
01942             else
01943             {
01944                 if (IsInputKindIgnored(winrt::ScrollingInputKinds::Keyboard))
01945                 {
01946                     return;
01947                 }
01948             }
01949
01950             const bool isXYFocusEnabledForKeyboard = XYFocusKeyboardNavigation() == winrt::XYFocusKeyboardNavigationMode::Enabled;
01951             const bool doXYFocusScrolling = isGamepadKey || isXYFocusEnabledForKeyboard;
01952
01953             if (doXYFocusScrolling)
01954             {
01955                 HandleKeyDownForXYNavigation(eventArgs);
01956             }
01957             else
01958             {
01959                 HandleKeyDownForStandardScroll(eventArgs);
01960             }
01961         }
01962     }
01963 }
01964
01965 void ScrollView::HandleKeyDownForStandardScroll(winrt::KeyRoutedEventArgs args)
01966 {
01967     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::KeyRoutedEventArgsToString(args).c_str());
01968
01969     // Up/Down/Left/Right will scroll by 15% the size of the viewport.
01970     static const double smallScrollProportion = 0.15;
01971
01972     MUX_ASSERT(!args.Handled());
01973     MUX_ASSERT(m_scrollPresenter != nullptr);
01974
01975     const bool isHandled = DoScrollForKey(args.Key(), smallScrollProportion);
01976
01977     args.Handled(isHandled);
01978 }
01979
01980 void ScrollView::HandleKeyDownForXYNavigation(winrt::KeyRoutedEventArgs args)
01981 {
01982     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::KeyRoutedEventArgsToString(args).c_str());
01983
01984     MUX_ASSERT(!args.Handled());
01985     MUX_ASSERT(m_scrollPresenter != nullptr);
01986
01987     bool isHandled = false;
01988     const auto originalKey = args.OriginalKey();
01989     const auto scrollPresenter = m_scrollPresenter.get().as<winrt::ScrollPresenter>();
01990     const bool isPageNavigation = FocusHelper::IsGamepadPageNavigationDirection(originalKey);
01991     const double scrollAmountProportion = isPageNavigation ? 1.0 : 0.5;
01992     bool shouldProcessKeyEvent = true;
01993     winrt::FocusNavigationDirection navigationDirection;
01994
01995     if (isPageNavigation)
01996     {
01997         navigationDirection = FocusHelper::GetPageNavigationDirection(originalKey);
01998
01999         // We should only handle page navigation if we can scroll in that direction.
02000         // Note: For non-paging navigation, we might want to move focus even if we cannot scroll.
02001         shouldProcessKeyEvent = CanScrollInDirection(navigationDirection);
02002     }
02003     else
02004     {
02005         navigationDirection = FocusHelper::GetNavigationDirection(originalKey);
02006     }
02007
02008     if (shouldProcessKeyEvent)
02009     {
02010         bool shouldScroll = false;
02011         bool shouldMoveFocus = false;
02012         winrt::DependencyObject nextElement = nullptr;
02013
02014         if (navigationDirection != winrt::FocusNavigationDirection::None)
02015         {
02016             nextElement = GetNextFocusCandidate(navigationDirection, isPageNavigation);
02017         }
02018
02019         if (nextElement && nextElement != winrt::FocusManager::GetFocusedElement(XamlRoot()))
02020         {
02021             winrt::UIElement nextElementAsUIE = FocusHelper::GetUIElementForFocusCandidate(nextElement);
02022             MUX_ASSERT(nextElementAsUIE != nullptr);
02023
02024             const auto nextElementAsFe = nextElementAsUIE.as<winrt::FrameworkElement>();
02025             const auto rect = winrt::Rect{ 0, 0, static_cast<float>(nextElementAsFe.ActualWidth()), static_cast<float>(nextElementAsFe.ActualHeight()) };
02026             const auto elementBounds = nextElementAsUIE.TransformToVisual(scrollPresenter).TransformBounds(rect);
02027             const auto viewport = winrt::Rect{ 0, 0, static_cast<float>(scrollPresenter.ActualWidth()), static_cast<float>(scrollPresenter.ActualHeight()) };
02028
02029             // Extend the viewport in the direction we are moving:
02030             winrt::Rect extendedViewport = viewport;
02031             switch (navigationDirection)
02032             {
02033             case winrt::FocusNavigationDirection::Down:
02034                 extendedViewport.Height += viewport.Height;
02035                 break;
02036             case winrt::FocusNavigationDirection::Up:
02037                 extendedViewport.Y -= viewport.Height;
02038                 extendedViewport.Height += viewport.Height;
02039                 break;
02040             case winrt::FocusNavigationDirection::Left:
02041                 extendedViewport.X -= viewport.Width;
02042                 extendedViewport.Width += viewport.Width;
02043                 break;
02044             case winrt::FocusNavigationDirection::Right:
02045                 extendedViewport.Width += viewport.Width;
02046                 break;
02047             }
02048
02049             const bool isElementInExtendedViewport = winrt::RectHelper::Intersect(elementBounds, extendedViewport) != winrt::RectHelper::Empty();
02050             const bool isElementFullyInExtendedViewport = winrt::RectHelper::Union(elementBounds, extendedViewport) == extendedViewport;
02051
02052             if (isElementInExtendedViewport)
02053             {
02054                 if (isPageNavigation)
02055                 {
02056                     // Always scroll for page navigation
02057                     shouldScroll = true;
02058
02059                     if (isElementFullyInExtendedViewport)
02060                     {
02061                         // Move focus:
02062                         shouldMoveFocus = true;
02063                     }
02064                 }
02065                 else
02066                 {
02067                     // Non-paging scroll allows partial candidates
02068                     shouldMoveFocus = true;
02069                 }
02070             }
02071             else
02072             {
02073                 // Element is outside extended viewport - scroll but don't focus.
02074                 shouldScroll = true;
02075             }
02076         }
02077         else
02078         {
02079             // No focus candidate: scroll
02080             shouldScroll = true;
02081         }
02082
02083         if (shouldMoveFocus)
02084         {
02085             SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_METH_INT, METH_NAME, this, L"FocusManager::TryFocusAsync", SharedHelpers::IsAnimationsEnabled());
02086
02087             auto focusAsyncOperation = winrt::FocusManager::TryFocusAsync(nextElement, winrt::FocusState::Keyboard);
02088
02089             if (SharedHelpers::IsAnimationsEnabled()) // When system animations are turned off, the bring-into-view operations are not turned into animations.
02090             {
02091                 // By changing focus, we will trigger BringIntoView requests in ScrollPresenter. If we are not going to invoke a scroll below (i.e. shouldScroll = false)
02092                 // we should allow ScrollPresenter to animate any BringIntoView requests.
02093                 // If we ARE going to invoke a scroll below (i.e. shouldScroll = true) we want to prevent the case where both our scroll and the scroll triggered by the
02094                 // focus change are active at once. So in this case we want to cancel any BringIntoView operations, since we are already handling the scrolling.
02095                 bool cancelBringIntoView = shouldScroll;
02096                 focusAsyncOperation.Completed(winrt::AsyncOperationCompletedHandler<winrt::FocusMovementResult>(
02097                     [strongThis = get_strong(), targetElement = nextElement.try_as<winrt::UIElement>(), cancelBringIntoView](winrt::IAsyncOperation<winrt::FocusMovementResult> asyncOperation, winrt::AsyncStatus asyncStatus)
02098                 {
02099                     SCROLLVIEW_TRACE_VERBOSE(*strongThis, TRACE_MSG_METH_INT, METH_NAME, strongThis, static_cast<int>(asyncStatus));
02100
02101                     if (asyncStatus == winrt::AsyncStatus::Completed && asyncOperation.GetResults())
02102                     {
02103                         // The focus change request was successful. One or a few ScrollPresenter::BringingIntoView notifications are likely to be raised in the coming ticks.
02104                         // For those, the BringIntoViewRequestedEventArgs::AnimationDesired property will be set to True in order to animate to the target element rather than jumping.
02105                         SCROLLVIEW_TRACE_VERBOSE(*strongThis, TRACE_MSG_METH_PTR, METH_NAME, strongThis, targetElement);
02106
02107                         auto bringIntoViewOperation(std::make_shared<ScrollViewBringIntoViewOperation>(targetElement, cancelBringIntoView));
02108
02109                         strongThis->m_bringIntoViewOperations.push_back(bringIntoViewOperation);
02110                         strongThis->HookCompositionTargetRendering();
02111                     }
02112                 }));
02113             }
02114
02115             isHandled = true;
02116         }
02117
02118         if (shouldScroll)
02119         {
02120             if (navigationDirection == winrt::FocusNavigationDirection::None)
02121             {
02122                 isHandled = DoScrollForKey(args.Key(), scrollAmountProportion);
02123             }
02124             else
02125             {
02126                 if (navigationDirection == winrt::FocusNavigationDirection::Down && CanScrollDown())
02127                 {
02128                     isHandled = true;
02129                     DoScroll(scrollPresenter.ActualHeight() * scrollAmountProportion, winrt::Orientation::Vertical);
02130                 }
02131                 else if (navigationDirection == winrt::FocusNavigationDirection::Up && CanScrollUp())
02132                 {
02133                     isHandled = true;
02134                     DoScroll(-scrollPresenter.ActualHeight() * scrollAmountProportion, winrt::Orientation::Vertical);
02135                 }
02136                 else if (navigationDirection == winrt::FocusNavigationDirection::Right && CanScrollRight())
02137                 {
02138                     isHandled = true;
02139                     DoScroll(scrollPresenter.ActualWidth() * scrollAmountProportion * (FlowDirection() == winrt::FlowDirection::RightToLeft ? -1 : 1), winrt::Orientation::Horizontal);
02140                 }
02141                 else if (navigationDirection == winrt::FocusNavigationDirection::Left && CanScrollLeft())
02142                 {
02143                     isHandled = true;
02144                     DoScroll(-scrollPresenter.ActualWidth() * scrollAmountProportion * (FlowDirection() == winrt::FlowDirection::RightToLeft ? -1 : 1), winrt::Orientation::Horizontal);
02145                 }
02146             }
02147         }
02148     }
02149
02150     args.Handled(isHandled);
02151 }
02152
02153 void ScrollView::HandleScrollControllerPointerEntered(
02154     bool isForHorizontalScrollController)
02155 {
02156     if (isForHorizontalScrollController)
02157     {
02158         m_isPointerOverHorizontalScrollController = true;
02159     }
02160     else
02161     {
02162         m_isPointerOverVerticalScrollController = true;
02163     }
02164
02165     UpdateScrollControllersAutoHiding();
02166     if (AreScrollControllersAutoHiding() && !SharedHelpers::IsAnimationsEnabled())
02167     {
02168         HideIndicatorsAfterDelay();
02169     }
02170 }
02171
02172 void ScrollView::HandleScrollControllerPointerExited(
02173     bool isForHorizontalScrollController)
02174 {
02175     if (isForHorizontalScrollController)
02176     {
02177         m_isPointerOverHorizontalScrollController = false;
02178     }
02179     else
02180     {
02181         m_isPointerOverVerticalScrollController = false;
02182     }
02183
02184     UpdateScrollControllersAutoHiding();
02185     if (AreScrollControllersAutoHiding())
02186     {
02187         HideIndicatorsAfterDelay();
02188     }
02189 }
02190
02191 winrt::DependencyObject ScrollView::GetNextFocusCandidate(winrt::FocusNavigationDirection navigationDirection, bool isPageNavigation)
02192 {
02193     MUX_ASSERT(m_scrollPresenter != nullptr);
02194     MUX_ASSERT(navigationDirection != winrt::FocusNavigationDirection::None);
02195     auto scrollPresenter = m_scrollPresenter.get().as<winrt::ScrollPresenter>();
02196
02197     winrt::FocusNavigationDirection focusDirection = navigationDirection;
02198
02199     winrt::FindNextElementOptions findNextElementOptions;
02200     findNextElementOptions.SearchRoot(scrollPresenter.Content());
02201
02202     if (isPageNavigation)
02203     {
02204         const auto localBounds = winrt::Rect{ 0, 0, static_cast<float>(scrollPresenter.ActualWidth()), static_cast<float>(scrollPresenter.ActualHeight()) };
02205         const auto globalBounds = scrollPresenter.TransformToVisual(nullptr).TransformBounds(localBounds);
02206         const int numPagesLookAhead = 2;
02207
02208         auto hintRect = globalBounds;
02209         switch (navigationDirection)
02210         {
02211         case winrt::FocusNavigationDirection::Down:
02212             hintRect.Y += globalBounds.Height * numPagesLookAhead;
02213             break;
02214         case winrt::FocusNavigationDirection::Up:
02215             hintRect.Y -= globalBounds.Height * numPagesLookAhead;
02216             break;
02217         case winrt::FocusNavigationDirection::Left:
02218             hintRect.X -= globalBounds.Width * numPagesLookAhead;
02219             break;
02220         case winrt::FocusNavigationDirection::Right:
02221             hintRect.X += globalBounds.Width * numPagesLookAhead;
02222             break;
02223         default:
02224             MUX_ASSERT(false);
02225             break;
02226         }
02227
02228         findNextElementOptions.HintRect(hintRect);
02229         findNextElementOptions.ExclusionRect(hintRect);
02230         focusDirection = FocusHelper::GetOppositeDirection(navigationDirection);
02231     }
02232
02233     return winrt::FocusManager::FindNextElement(focusDirection, findNextElementOptions);
02234 }
02235
02236 bool ScrollView::DoScrollForKey(winrt::VirtualKey key, double scrollProportion)
02237 {
02238     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL_INT, METH_NAME, this, scrollProportion, static_cast<int>(key));
02239
02240     MUX_ASSERT(m_scrollPresenter != nullptr);
02241
02242     constexpr double offsetEpsilon = 0.001;
02243     bool isScrollTriggered = false;
02244     auto scrollPresenter = m_scrollPresenter.get().as<winrt::ScrollPresenter>();
02245
02246     if ((key == winrt::VirtualKey::PageDown || key == winrt::VirtualKey::Down) && CanScrollDown())
02247     {
02248         MUX_ASSERT(scrollPresenter.VerticalOffset() < ScrollableHeight());
02249
02250         // When getting close to the maximum vertical offset:
02251         //  - make sure the maximum is actually reached thanks for the epsilon addition.
02252         const auto maxScrollAmount = ScrollableHeight() + offsetEpsilon - scrollPresenter.VerticalOffset();
02253         //  - do not automatically overbounce by limiting the offset change to the remaining scrollable height.
02254         const auto scrollAmount = std::min(maxScrollAmount, scrollPresenter.ActualHeight() * (key == winrt::VirtualKey::PageDown ? 1.0 : scrollProportion));
02255
02256         isScrollTriggered = true;
02257         DoScroll(scrollAmount, winrt::Orientation::Vertical);
02258     }
02259     else if ((key == winrt::VirtualKey::PageUp || key == winrt::VirtualKey::Up) && CanScrollUp())
02260     {
02261         MUX_ASSERT(scrollPresenter.VerticalOffset() > 0);
02262
02263         // When getting close to the minimum vertical offset 0.0:
02264         //  - make sure 0.0 is actually reached thanks for the epsilon addition.
02265         const auto maxScrollAmount = scrollPresenter.VerticalOffset() + offsetEpsilon;
02266         //  - do not automatically overbounce by limiting the offset change to the remaining offset.
02267         const auto scrollAmount = std::max(-maxScrollAmount, scrollPresenter.ActualHeight() * (key == winrt::VirtualKey::PageUp ? -1.0 : -scrollProportion));
02268
02269         isScrollTriggered = true;
02270         DoScroll(scrollAmount, winrt::Orientation::Vertical);
02271     }
02272     else if (key == winrt::VirtualKey::Left || key == winrt::VirtualKey::Right)
02273     {
02274         double scrollAmount = scrollPresenter.ActualWidth() * scrollProportion;
02275         const bool isRTL = FlowDirection() == winrt::FlowDirection::RightToLeft;
02276
02277         if (isRTL)
02278         {
02279             scrollAmount *= -1;
02280         }
02281
02282         if (key == winrt::VirtualKey::Right && CanScrollRight())
02283         {
02284             // When getting close to the maximum horizontal offset:
02285             //  - make sure the maximum is actually reached thanks for the epsilon addition.
02286             const auto maxScrollAmount = isRTL ?
02287                 - scrollPresenter.HorizontalOffset() - offsetEpsilon :
02288                 ScrollableWidth() + offsetEpsilon - scrollPresenter.HorizontalOffset();
02289             //  - do not automatically overbounce by limiting the offset change to the remaining scrollable width.
02290             scrollAmount = isRTL ?
02291                 std::max(maxScrollAmount, scrollAmount) :
02292                 std::min(maxScrollAmount, scrollAmount);
02293
02294             MUX_ASSERT(scrollAmount != 0.0);
02295
02296             isScrollTriggered = true;
02297             DoScroll(scrollAmount, winrt::Orientation::Horizontal);
02298         }
02299         else if (key == winrt::VirtualKey::Left && CanScrollLeft())
02300         {
02301             // When getting close to the minimum horizontal offset 0.0:
02302             //  - make sure 0.0 is actually reached thanks for the epsilon addition.
02303             const auto maxScrollAmount = isRTL ?
02304                 - ScrollableWidth() - offsetEpsilon + scrollPresenter.HorizontalOffset() :
02305                 scrollPresenter.HorizontalOffset() + offsetEpsilon;
02306             //  - do not automatically overbounce by limiting the offset change to the remaining offset.
02307             scrollAmount =
02308                 isRTL ?
02309                 std::min(-maxScrollAmount, -scrollAmount) :
02310                 std::max(-maxScrollAmount, -scrollAmount);
02311
02312             MUX_ASSERT(scrollAmount != 0.0);
02313
02314             isScrollTriggered = true;
02315             DoScroll(scrollAmount, winrt::Orientation::Horizontal);
02316         }
02317     }
02318     else if (key == winrt::VirtualKey::Home)
02319     {
02320         const bool canScrollUp = CanScrollUp();
02321         const auto verticalScrollMode = ComputedVerticalScrollMode();
02322
02323         if (canScrollUp || (verticalScrollMode == winrt::ScrollingScrollMode::Disabled && CanScrollLeft()))
02324         {
02325             isScrollTriggered = true;
02326             auto horizontalOffset = canScrollUp ? scrollPresenter.HorizontalOffset() : 0.0;
02327             const auto verticalOffset = canScrollUp ? 0.0 : scrollPresenter.VerticalOffset();
02328
02329             if (!canScrollUp && FlowDirection() == winrt::FlowDirection::RightToLeft)
02330             {
02331                 horizontalOffset = scrollPresenter.ExtentWidth() * scrollPresenter.ZoomFactor() - scrollPresenter.ActualWidth();
02332             }
02333
02334             scrollPresenter.ScrollTo(horizontalOffset, verticalOffset);
02335         }
02336     }
02337     else if (key == winrt::VirtualKey::End)
02338     {
02339         const bool canScrollDown = CanScrollDown();
02340         const auto verticalScrollMode = ComputedVerticalScrollMode();
02341
02342         if (canScrollDown || (verticalScrollMode == winrt::ScrollingScrollMode::Disabled && CanScrollRight()))
02343         {
02344             isScrollTriggered = true;
02345             const auto zoomedExtent = (canScrollDown ? scrollPresenter.ExtentHeight() : scrollPresenter.ExtentWidth()) * scrollPresenter.ZoomFactor();
02346             auto horizontalOffset = canScrollDown ? scrollPresenter.HorizontalOffset() : zoomedExtent - scrollPresenter.ActualWidth();
02347             const auto verticalOffset = canScrollDown ? zoomedExtent - scrollPresenter.ActualHeight() : scrollPresenter.VerticalOffset();
02348
02349             if (!canScrollDown && FlowDirection() == winrt::FlowDirection::RightToLeft)
02350             {
02351                 horizontalOffset = 0.0;
02352             }
02353
02354             scrollPresenter.ScrollTo(horizontalOffset, verticalOffset);
02355         }
02356     }
02357
02358     return isScrollTriggered;
02359 }
02360
02361 void ScrollView::DoScroll(double offset, winrt::Orientation orientation)
02362 {
02363     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL_INT, METH_NAME, this, offset, static_cast<int>(orientation));
02364
02365     const bool isVertical = orientation == winrt::Orientation::Vertical;
02366
02367     if (auto scrollPresenter = m_scrollPresenter.get().as<winrt::ScrollPresenter>())
02368     {
02369         if (SharedHelpers::IsAnimationsEnabled())
02370         {
02371             static const winrt::float2 inertiaDecayRate(0.9995f, 0.9995f);
02372
02373             // A velocity less than or equal to this value has no effect.
02374             static const double minVelocity = 30.0;
02375
02376             // We need to add this much velocity over minVelocity per pixel we want to move:
02377             static constexpr double s_velocityNeededPerPixel{ 7.600855902349023 };
02378
02379             const auto scrollDir = offset > 0 ? 1 : -1;
02380
02381             // The minimum velocity required to move in the given direction.
02382             double baselineVelocity = minVelocity * scrollDir;
02383
02384             // If there is already a scroll animation running for a previous key press, we want to take that into account
02385             // for calculating the baseline velocity.
02386             const auto previousScrollViewChangeCorrelationId = isVertical ? m_verticalAddScrollVelocityOffsetChangeCorrelationId : m_horizontalAddScrollVelocityOffsetChangeCorrelationId;
02387             if (previousScrollViewChangeCorrelationId != s_noOpCorrelationId)
02388             {
02389                 const auto directionOfPreviousScrollOperation = isVertical ? m_verticalAddScrollVelocityDirection : m_horizontalAddScrollVelocityDirection;
02390                 if (directionOfPreviousScrollOperation == 1)
02391                 {
02392                     baselineVelocity -= minVelocity;
02393                 }
02394                 else if (directionOfPreviousScrollOperation == -1)
02395                 {
02396                     baselineVelocity += minVelocity;
02397                 }
02398             }
02399
02400             const auto velocity = static_cast<float>(baselineVelocity + (offset * s_velocityNeededPerPixel));
02401
02402             if (isVertical)
02403             {
02404                 const winrt::float2 offsetsVelocity(0.0f, velocity);
02405                 m_verticalAddScrollVelocityOffsetChangeCorrelationId = scrollPresenter.AddScrollVelocity(offsetsVelocity, inertiaDecayRate);
02406                 m_verticalAddScrollVelocityDirection = scrollDir;
02407             }
02408             else
02409             {
02410                 const winrt::float2 offsetsVelocity(velocity, 0.0f);
02411                 m_horizontalAddScrollVelocityOffsetChangeCorrelationId = scrollPresenter.AddScrollVelocity(offsetsVelocity, inertiaDecayRate);
02412                 m_horizontalAddScrollVelocityDirection = scrollDir;
02413             }
02414         }
02415         else
02416         {
02417             if (isVertical)
02418             {
02419                 // Any horizontal AddScrollVelocity animation recently launched should be ignored by a potential subsequent AddScrollVelocity call.
02420                 m_verticalAddScrollVelocityOffsetChangeCorrelationId = s_noOpCorrelationId;
02421
02422                 scrollPresenter.ScrollBy(0.0 /*horizontalOffsetDelta*/, offset /*verticalOffsetDelta*/);
02423             }
02424             else
02425             {
02426                 // Any vertical AddScrollVelocity animation recently launched should be ignored by a potential subsequent AddScrollVelocity call.
02427                 m_horizontalAddScrollVelocityOffsetChangeCorrelationId = s_noOpCorrelationId;
02428
02429                 scrollPresenter.ScrollBy(offset /*horizontalOffsetDelta*/, 0.0 /*verticalOffsetDelta*/);
02430             }
02431         }
02432     }
02433 }
02434
02435 bool ScrollView::CanScrollInDirection(winrt::FocusNavigationDirection direction)
02436 {
02437     bool result = false;
02438     switch (direction)
02439     {
02440     case winrt::FocusNavigationDirection::Down:
02441         result = CanScrollDown();
02442         break;
02443     case winrt::FocusNavigationDirection::Up:
02444         result = CanScrollUp();
02445         break;
02446     case winrt::FocusNavigationDirection::Left:
02447         result = CanScrollLeft();
02448         break;
02449     case winrt::FocusNavigationDirection::Right:
02450         result = CanScrollRight();
02451         break;
02452     }
02453
02454     return result;
02455 }
02456
02457 bool ScrollView::CanScrollDown()
02458 {
02459     return CanScrollVerticallyInDirection(true /*inPositiveDirection*/);
02460 }
02461
02462 bool ScrollView::CanScrollUp()
02463 {
02464     return CanScrollVerticallyInDirection(false /*inPositiveDirection*/);
02465 }
02466
02467 bool ScrollView::CanScrollRight()
02468 {
02469     return CanScrollHorizontallyInDirection(true /*inPositiveDirection*/);
02470 }
02471
02472 bool ScrollView::CanScrollLeft()
02473 {
02474     return CanScrollHorizontallyInDirection(false /*inPositiveDirection*/);
02475 }
02476
02477 bool ScrollView::CanScrollVerticallyInDirection(bool inPositiveDirection)
02478 {
02479     bool canScrollInDirection = false;
02480     if (m_scrollPresenter)
02481     {
02482         auto scrollPresenter = m_scrollPresenter.get().as<winrt::ScrollPresenter>();
02483         const auto verticalScrollMode = ComputedVerticalScrollMode();
02484
02485         if (verticalScrollMode == winrt::ScrollingScrollMode::Enabled)
02486         {
02487             const auto zoomedExtentHeight = scrollPresenter.ExtentHeight() * scrollPresenter.ZoomFactor();
02488             const auto viewportHeight = scrollPresenter.ActualHeight();
02489             if (zoomedExtentHeight > viewportHeight)
02490             {
02491                 // Ignore distance to an edge smaller than 1/1000th of a pixel to account for rounding approximations.
02492                 // Otherwise an Up/Down arrow key may be processed and have no effect.
02493                 constexpr double offsetEpsilon = 0.001;
02494
02495                 if (inPositiveDirection)
02496                 {
02497                     const auto maxVerticalOffset = zoomedExtentHeight - viewportHeight;
02498                     if (scrollPresenter.VerticalOffset() < maxVerticalOffset - offsetEpsilon)
02499                     {
02500                         canScrollInDirection = true;
02501                     }
02502                 }
02503                 else
02504                 {
02505                     if (scrollPresenter.VerticalOffset() > offsetEpsilon)
02506                     {
02507                         canScrollInDirection = true;
02508                     }
02509                 }
02510             }
02511         }
02512     }
02513
02514     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, inPositiveDirection, canScrollInDirection);
02515
02516     return canScrollInDirection;
02517 }
02518
02519 bool ScrollView::CanScrollHorizontallyInDirection(bool inPositiveDirection)
02520 {
02521     bool canScrollInDirection = false;
02522
02523     if (FlowDirection() == winrt::FlowDirection::RightToLeft)
02524     {
02525         inPositiveDirection = !inPositiveDirection;
02526     }
02527
02528     if (m_scrollPresenter)
02529     {
02530         auto scrollPresenter = m_scrollPresenter.get().as<winrt::ScrollPresenter>();
02531         const auto horizontalScrollMode = ComputedHorizontalScrollMode();
02532
02533         if (horizontalScrollMode == winrt::ScrollingScrollMode::Enabled)
02534         {
02535             const auto zoomedExtentWidth = scrollPresenter.ExtentWidth() * scrollPresenter.ZoomFactor();
02536             const auto viewportWidth = scrollPresenter.ActualWidth();
02537             if (zoomedExtentWidth > viewportWidth)
02538             {
02539                 // Ignore distance to an edge smaller than 1/1000th of a pixel to account for rounding approximations.
02540                 // Otherwise a Left/Right arrow key may be processed and have no effect.
02541                 constexpr double offsetEpsilon = 0.001;
02542
02543                 if (inPositiveDirection)
02544                 {
02545                     const auto maxHorizontalOffset = zoomedExtentWidth - viewportWidth;
02546                     if (scrollPresenter.HorizontalOffset() < maxHorizontalOffset - offsetEpsilon)
02547                     {
02548                         canScrollInDirection = true;
02549                     }
02550                 }
02551                 else
02552                 {
02553                     if (scrollPresenter.HorizontalOffset() > offsetEpsilon)
02554                     {
02555                         canScrollInDirection = true;
02556                     }
02557                 }
02558             }
02559         }
02560     }
02561
02562     SCROLLVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, inPositiveDirection, canScrollInDirection);
02563
02564     return canScrollInDirection;
02565 }
02566
02567 #ifdef DBG
02568
02569 winrt::hstring ScrollView::DependencyPropertyToString(const winrt::IDependencyProperty& dependencyProperty)
02570 {
02571     if (dependencyProperty == s_ContentProperty)
02572     {
02573         return L"Content";
02574     }
02575     else if (dependencyProperty == s_ScrollPresenterProperty)
02576     {
02577         return L"ScrollPresenter";
02578     }
02579     else if (dependencyProperty == s_HorizontalScrollBarVisibilityProperty)
02580     {
02581         return L"HorizontalScrollBarVisibility";
02582     }
02583     else if (dependencyProperty == s_VerticalScrollBarVisibilityProperty)
02584     {
02585         return L"VerticalScrollBarVisibility";
02586     }
02587     else if (dependencyProperty == s_ContentOrientationProperty)
02588     {
02589         return L"ContentOrientation";
02590     }
02591     else if (dependencyProperty == s_VerticalScrollChainModeProperty)
02592     {
02593         return L"VerticalScrollChainMode";
02594     }
02595     else if (dependencyProperty == s_ZoomChainModeProperty)
02596     {
02597         return L"ZoomChainMode";
02598     }
02599     else if (dependencyProperty == s_HorizontalScrollRailModeProperty)
02600     {
02601         return L"HorizontalScrollRailMode";
02602     }
02603     else if (dependencyProperty == s_VerticalScrollRailModeProperty)
02604     {
02605         return L"VerticalScrollRailMode";
02606     }
02607     else if (dependencyProperty == s_HorizontalScrollModeProperty)
02608     {
02609         return L"HorizontalScrollMode";
02610     }
02611     else if (dependencyProperty == s_VerticalScrollModeProperty)
02612     {
02613         return L"VerticalScrollMode";
02614     }
02615     else if (dependencyProperty == s_ComputedHorizontalScrollBarVisibilityProperty)
02616     {
02617         return L"ComputedHorizontalScrollBarVisibility";
02618     }
02619     else if (dependencyProperty == s_ComputedVerticalScrollBarVisibilityProperty)
02620     {
02621         return L"ComputedVerticalScrollBarVisibility";
02622     }
02623     else if (dependencyProperty == s_ComputedHorizontalScrollModeProperty)
02624     {
02625         return L"ComputedHorizontalScrollMode";
02626     }
02627     else if (dependencyProperty == s_ComputedVerticalScrollModeProperty)
02628     {
02629         return L"ComputedVerticalScrollMode";
02630     }
02631     else if (dependencyProperty == s_ZoomModeProperty)
02632     {
02633         return L"ZoomMode";
02634     }
02635     else if (dependencyProperty == s_IgnoredInputKindsProperty)
02636     {
02637         return L"IgnoredInputKinds";
02638     }
02639     else if (dependencyProperty == s_MinZoomFactorProperty)
02640     {
02641         return L"MinZoomFactor";
02642     }
02643     else if (dependencyProperty == s_MaxZoomFactorProperty)
02644     {
02645         return L"MaxZoomFactor";
02646     }
02647     else if (dependencyProperty == s_HorizontalAnchorRatioProperty)
02648     {
02649         return L"HorizontalAnchorRatio";
02650     }
02651     else if (dependencyProperty == s_VerticalAnchorRatioProperty)
02652     {
02653         return L"VerticalAnchorRatio";
02654     }
02655     else
02656     {
02657         return L"UNKNOWN";
02658     }
02659 }
02660
02661 #endif
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Files
  • Directories
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Recipe Member List

This is the complete list of members for Recipe, including all inherited members.
_bitmapImage | Recipe | [private]
_description | Recipe | [private]
_id | Recipe | [private]
_imageUri | Recipe | [private]
AspectRatio | Recipe |
BitmapImage | Recipe |
Description | Recipe |
GetKnownAspectRatioFromImageName(string imageName) | Recipe | [inline, private, static]
GetKnownAspectRatioFromIndex(int index) | Recipe | [inline, static]
GetKnownAspectRatioFromLocalPath(string localPath) | Recipe | [inline, private, static]
Id | Recipe |
ImageUri | Recipe |
OnPropertyChanged(string propertyName) | Recipe | [inline, private]
PropertyChanged | Recipe |
ToString() | Recipe | [inline]
Generated on Sun Dec 1 2024 20:54:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewNode2 Member List

This is the complete list of members for TreeViewNode2, including all inherited members.
abi_enter() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
AddExpandedChanged(winrt::TypedEventHandler< winrt::TreeViewNode, winrt::DependencyPropertyChangedEventArgs > const &value) | TreeViewNode |
CheckThread() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
Children() | TreeViewNode |
ChildrenChanged(winrt::TypedEventHandler< winrt::TreeViewNode, winrt::IVectorChangedEventArgs > const &value) | TreeViewNode |
ChildrenChanged(winrt::event_token) | TreeViewNode |
ChildVectorChanged(winrt::IObservableVector< winrt::TreeViewNode > const &sender, winrt::IInspectable const &args) | TreeViewNode |
ClearProperties() | TreeViewNodeProperties | [static]
Content(winrt::IInspectable const &value) | TreeViewNodeProperties |
Content() | TreeViewNodeProperties |
ContentProperty() | TreeViewNodeProperties | [inline, static]
DeleteInstanceOnUIThread(std::unique_ptr< TreeViewNode > &&self) noexcept | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline, static]
Depth(int value) | TreeViewNodeProperties |
Depth() | TreeViewNodeProperties |
DepthProperty() | TreeViewNodeProperties | [inline, static]
EnsureProperties() | TreeViewNodeProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
final_release(std::unique_ptr< TreeViewNode > &&self) | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline, static]
get_ParentImpl() | TreeViewNode |
GetBase() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
GetCustomProperty(hstring const &name) | TreeViewNode |
GetIndexedProperty(hstring const &name, winrt::TypeName const &type) | TreeViewNode |
GetInner() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
GetStringRepresentation() | TreeViewNode |
HasChildren(bool value) | TreeViewNodeProperties |
HasChildren() | TreeViewNodeProperties |
HasChildrenProperty() | TreeViewNodeProperties | [inline, static]
HasUnrealizedChildren() | TreeViewNode |
HasUnrealizedChildren(bool value) | TreeViewNode |
IsContentMode() | TreeViewNode |
IsContentMode(bool value) | TreeViewNode |
IsExpanded(bool value) | TreeViewNodeProperties |
IsExpanded() | TreeViewNodeProperties |
IsExpandedProperty() | TreeViewNodeProperties | [inline, static]
IsOnThread() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
ItemsSource() | TreeViewNode |
ItemsSource(winrt::IInspectable const &value) | TreeViewNode |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
OnHasChildrenPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewNodeProperties | [static]
OnIsExpandedPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewNodeProperties | [static]
OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewNode |
Parent() | TreeViewNode |
PartialSelected enum value | TreeViewNode |
put_ParentImpl(winrt::TreeViewNode const &value) | TreeViewNode |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
RaiseChildrenChanged(winrt::CollectionChange CC, unsigned int index) | TreeViewNode |
ReferenceTracker(Args &&...args) | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
RemoveExpandedChanged(winrt::event_token) | TreeViewNode |
s_ContentProperty | TreeViewNodeProperties | [static]
s_DepthProperty | TreeViewNodeProperties | [static]
s_HasChildrenProperty | TreeViewNodeProperties | [static]
s_IsExpandedProperty | TreeViewNodeProperties | [static]
Selected enum value | TreeViewNode |
SelectionState() | TreeViewNode |
SelectionState(TreeNodeSelectionState const &state) | TreeViewNode |
ToString() | TreeViewNode |
TreeNodeSelectionState enum name | TreeViewNode |
TreeViewNode() | TreeViewNode |
TreeViewNodeProperties() | TreeViewNodeProperties |
Type() | TreeViewNode |
UnSelected enum value | TreeViewNode |
UpdateDepth(int depth) | TreeViewNode |
UpdateHasChildren() | TreeViewNode |
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TreeViewList.properties.cpp Source File

  • File List
  • File Members
  • Generated

TreeViewList.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "TreeViewList.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(TreeViewList)
00012 }
00013
00014 #include "TreeViewList.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarCustomPen.h Source File

  • File Members
  • InkToolBar

InkToolBarCustomPen.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarCustomPen.g.h"
00011
00012 class InkToolBarCustomPen :
00013     public ReferenceTracker<InkToolBarCustomPen, winrt::implementation::InkToolBarCustomPenT>
00014 {
00015 public:
00016
00017     winrt::InkDrawingAttributes CreateInkDrawingAttributes(winrt::Brush brush, double strokeWidth) { winrt::throw_hresult(E_NOTIMPL); }
00018     winrt::InkDrawingAttributes CreateInkDrawingAttributesCore(winrt::Brush brush, double strokeWidth) { winrt::throw_hresult(E_NOTIMPL); }
00019 };
00020
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RegUtil Member List

This is the complete list of members for RegUtil, including all inherited members.
UseDynamicScrollbars() noexcept RegUtil [static]
Generated on Sun Dec 1 2024 20:53:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TopNavigationViewDataProvider Member List

This is the complete list of members for TopNavigationViewDataProvider, including all inherited members.
CalculateWidthForItems(std::vector< int > &items) | TopNavigationViewDataProvider |
ChangeDataSource(winrt::ItemsSourceView dataSource) | TopNavigationViewDataProvider | [private]
ConvertOriginalIndexToIndex(int originalIndex) | TopNavigationViewDataProvider |
ConvertPrimaryIndexToIndex(std::vector< int > const &indexesInPrimary) | TopNavigationViewDataProvider |
DefaultAttachedData() override | TopNavigationViewDataProvider |
DefaultVectorIDOnInsert() override | TopNavigationViewDataProvider |
GetAt(int index) override | TopNavigationViewDataProvider |
GetNavigationViewItemCountInPrimaryList() | TopNavigationViewDataProvider |
GetNavigationViewItemCountInTopNav() | TopNavigationViewDataProvider |
GetOverflowItems() | TopNavigationViewDataProvider |
GetPrimaryItems() | TopNavigationViewDataProvider |
GetPrimaryListSize() | TopNavigationViewDataProvider |
GetWidthForItem(int index) | TopNavigationViewDataProvider |
HasInvalidWidth(std::vector< int > &items) | TopNavigationViewDataProvider |
IndexOf(const winrt::IInspectable &value) override | TopNavigationViewDataProvider |
IndexOf(const winrt::IInspectable &value, NavigationViewSplitVectorID vectorID) | TopNavigationViewDataProvider |
InvalidWidthCache() | TopNavigationViewDataProvider |
IsContainerNavigationViewHeader(int index) | TopNavigationViewDataProvider | [private]
IsContainerNavigationViewItem(int index) | TopNavigationViewDataProvider | [private]
IsItemInPrimaryList(int index) | TopNavigationViewDataProvider |
IsItemSelectableInPrimaryList(const winrt::IInspectable &value) | TopNavigationViewDataProvider |
IsValidWidth(float width) | TopNavigationViewDataProvider | [private]
IsValidWidthForItem(int index) | TopNavigationViewDataProvider |
m_dataChangeCallback | TopNavigationViewDataProvider | [private]
m_dataSource | TopNavigationViewDataProvider | [private]
m_rawDataSource | TopNavigationViewDataProvider | [private]
MoveAllItemsToPrimaryList() | TopNavigationViewDataProvider |
MoveItemsOutOfPrimaryList(std::vector< int > const &indexes) | TopNavigationViewDataProvider |
MoveItemsToList(std::vector< int > const &indexes, NavigationViewSplitVectorID vectorID) | TopNavigationViewDataProvider |
MoveItemsToPrimaryList(std::vector< int > const &indexes) | TopNavigationViewDataProvider |
OnDataSourceChanged(const winrt::IInspectable &sender, const winrt::NotifyCollectionChangedEventArgs &args) | TopNavigationViewDataProvider | [protected]
OnRawDataChanged(std::function< void(winrt::NotifyCollectionChangedEventArgs const &args)> const &dataChangeCallback) | TopNavigationViewDataProvider |
OverflowButtonWidth() | TopNavigationViewDataProvider |
OverflowButtonWidth(float width) | TopNavigationViewDataProvider |
SetDataSource(const winrt::IInspectable &rawData) | TopNavigationViewDataProvider |
SetWidthForItem(int index, float width) | TopNavigationViewDataProvider | [private]
ShouldChangeDataSource(winrt::IInspectable const &rawData) | TopNavigationViewDataProvider |
Size() override | TopNavigationViewDataProvider |
TopNavigationViewDataProvider(const ITrackerHandleManager *m_owner) | TopNavigationViewDataProvider |
UpdateWidthForPrimaryItem(int indexInPrimary, float width) | TopNavigationViewDataProvider |
WidthRequiredToRecoveryAllItemsToPrimary() | TopNavigationViewDataProvider |
Generated on Sun Dec 1 2024 20:53:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: DropDownButton/DropDownButton.idl Source File

  • DropDownButton

DropDownButton.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 unsealed runtimeclass DropDownButton : Microsoft.UI.Xaml.Controls.Button
00007 {
00008     DropDownButton();
00009 }
00010
00011 }
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnimatedVisualPlayer::final Member List

This is the complete list of members for AnimatedVisualPlayer::final, including all inherited members.
AnimationPlay(AnimatedVisualPlayer &owner, float fromProgress, float toProgress, bool looped) | AnimatedVisualPlayer::final |
await_ready() const noexcept | Awaitable | [inline]
await_resume() const noexcept | Awaitable | [inline]
await_suspend(std::experimental::coroutine_handle<> resume) | Awaitable | [inline]
Awaitable() | Awaitable | [inline]
Complete() | AnimatedVisualPlayer::final |
CompleteAwaits() const noexcept | Awaitable | [inline, protected]
FromProgress() | AnimatedVisualPlayer::final |
IsCurrentPlay() | AnimatedVisualPlayer::final |
m_owner | AnimatedVisualPlayer::final | [private]
OnHiding() | AnimatedVisualPlayer::final |
OnUnhiding() | AnimatedVisualPlayer::final |
Pause() | AnimatedVisualPlayer::final |
ResetOwner() | AnimatedVisualPlayer::final |
Resume() | AnimatedVisualPlayer::final |
SetPlaybackRate(float value) | AnimatedVisualPlayer::final |
Start() | AnimatedVisualPlayer::final |
Generated on Sun Dec 1 2024 20:52:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/UniqueIdElementPool.cpp Source File

  • Repeater

UniqueIdElementPool.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "UniqueIdElementPool.h"
00008 #include "ItemsRepeater.h"
00009
00010 UniqueIdElementPool::UniqueIdElementPool(ItemsRepeater* owner) :
00011     m_owner(owner)
00012 {
00013     // ItemsRepeater is not fully constructed yet. Don't interact with it.
00014 }
00015
00016 void UniqueIdElementPool::Add(const winrt::UIElement& element)
00017 {
00018     MUX_ASSERT(m_owner->ItemsSourceView().HasKeyIndexMapping());
00019
00020     auto virtInfo = ItemsRepeater::GetVirtualizationInfo(element);
00021     auto key = std::wstring(virtInfo->UniqueId().data());
00022
00023     if (m_elementMap.find(key) != m_elementMap.end())
00024     {
00025         std::wstring message = L"The unique id provided (" + std::wstring(virtInfo->UniqueId().data()) + L") is not unique.";
00026         throw winrt::hresult_error(E_FAIL, message.c_str());
00027     }
00028
00029     m_elementMap.insert(std::make_pair(std::move(key), tracker_ref<winrt::UIElement>(m_owner, element)));
00030 }
00031
00032 winrt::UIElement UniqueIdElementPool::Remove(int index)
00033 {
00034     MUX_ASSERT(m_owner->ItemsSourceView().HasKeyIndexMapping());
00035
00036     // Check if there is already a element in the mapping and if so, use it.
00037     winrt::UIElement element = nullptr;
00038     std::wstring key = std::wstring(m_owner->ItemsSourceView().KeyFromIndex(index));
00039     const auto it = m_elementMap.find(key);
00040     if (it != m_elementMap.end())
00041     {
00042         element = it->second.get();
00043         m_elementMap.erase(it);
00044     }
00045
00046     return element;
00047 }
00048
00049 void UniqueIdElementPool::Clear()
00050 {
00051     MUX_ASSERT(m_owner->ItemsSourceView().HasKeyIndexMapping());
00052     m_elementMap.clear();
00053 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemsFactory.h Source File

  • NavigationView

NavigationViewItemsFactory.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007 #include "ElementFactory.h"
00008
00009 class NavigationViewItemsFactory :
00010     public winrt::implements<NavigationViewItemsFactory, ElementFactory>
00011 {
00012 public:
00013     void UserElementFactory(winrt::IInspectable const& newValue);
00014     void SettingsItem(winrt::NavigationViewItemBase const& settingsItem);
00015
00016 #pragma region IElementFactoryOverrides
00017     winrt::UIElement GetElementCore(winrt::ElementFactoryGetArgs const& args);
00018     void RecycleElementCore(winrt::ElementFactoryRecycleArgs const& args);
00019 #pragma endregion
00020
00021 private:
00022     winrt::IElementFactory m_itemTemplateWrapper{ nullptr };
00023     winrt::NavigationViewItemBase m_settingsItem{ nullptr };
00024     std::vector<winrt::NavigationViewItem> navigationViewItemPool;
00025
00026     void UnlinkElementFromParent(winrt::ElementFactoryRecycleArgs const& args);
00027 };
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedVisuals/AnimatedSettingsVisualSource.cpp Source File

  • AnimatedIcon
  • AnimatedVisuals

AnimatedSettingsVisualSource.cpp

Go to the documentation of this file.
00001 ﻿//------------------------------------------------------------------------------
00002 // <auto-generated>
00003 //     This code was generated by a tool.
00004 //
00005 //       LottieGen version:
00006 //           7.1.0+ge1fa92580f
00007 //
00008 //       Command:
00009 //           LottieGen -Language Cppwinrt -WinUIVersion 2.4 -InputFile AnimatedSettingsVisualSource.json
00010 //
00011 //       Input file:
00012 //           AnimatedSettingsVisualSource.json (28705 bytes created 23:37-07:00 Oct 5 2021)
00013 //
00014 //       LottieGen source:
00015 //           http://aka.ms/Lottie
00016 //
00017 //     Changes to this file may cause incorrect behavior and will be lost if
00018 //     the code is regenerated.
00019 // </auto-generated>
00020 //------------------------------------------------------------------------------
00021 // ____________________________________
00022 // |       Object stats       | Count |
00023 // |__________________________|_______|
00024 // | All CompositionObjects   |    63 |
00025 // |--------------------------+-------|
00026 // | Expression animators     |     7 |
00027 // | KeyFrame animators       |     6 |
00028 // | Reference parameters     |     7 |
00029 // | Expression operations    |     4 |
00030 // |--------------------------+-------|
00031 // | Animated brushes         |     1 |
00032 // | Animated gradient stops  |     - |
00033 // | ExpressionAnimations     |     2 |
00034 // | PathKeyFrameAnimations   |     - |
00035 // |--------------------------+-------|
00036 // | ContainerVisuals         |     4 |
00037 // | ShapeVisuals             |     3 |
00038 // |--------------------------+-------|
00039 // | ContainerShapes          |     - |
00040 // | CompositionSpriteShapes  |     3 |
00041 // |--------------------------+-------|
00042 // | Brushes                  |     1 |
00043 // | Gradient stops           |     - |
00044 // | CompositionVisualSurface |     - |
00045 // ------------------------------------
00046 #include "pch.h"
00047 #include "AnimatedVisuals\AnimatedSettingsVisualSource.h"
00048 #include <winrt/Windows.Foundation.Metadata.h>
00049 #include <winrt/Windows.Foundation.Collections.h>
00050 #include <winrt/Microsoft.UI.Composition.h>
00051 #include "d2d1.h"
00052 #include <d2d1_1.h>
00053 #include <d2d1helper.h>
00054 #include <Windows.Graphics.Interop.h>
00055 #include <Windows.Graphics.Effects.Interop.h>
00056 #include <winrt/Windows.Graphics.Effects.h>
00057
00058 using namespace winrt::Microsoft::UI::Xaml::Controls;
00059 using namespace winrt::Windows::Foundation;
00060 using namespace winrt::Windows::Foundation::Numerics;
00061 using namespace winrt::Windows::Graphics;
00062 using namespace winrt::Windows::UI;
00063 using namespace winrt::Microsoft::UI::Composition;
00064 using TimeSpan = winrt::Windows::Foundation::TimeSpan;
00065
00066 namespace winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals
00067 {
00068     CppWinRTActivatableClassWithBasicFactory(AnimatedSettingsVisualSource)
00069 }
00070 #include "AnimatedVisuals\AnimatedSettingsVisualSource.g.cpp"
00071
00072 class CanvasGeometry : public winrt::implements<CanvasGeometry,
00073     IGeometrySource2D,
00074     ::ABI::Windows::Graphics::IGeometrySource2DInterop>
00075 {
00076     winrt::com_ptr<ID2D1Geometry> _geometry{ nullptr };
00077
00078 public:
00079     CanvasGeometry(winrt::com_ptr<ID2D1Geometry> geometry)
00080         : _geometry{ geometry }
00081     { }
00082
00083     // IGeometrySource2D.
00084     winrt::com_ptr<ID2D1Geometry> Geometry() { return _geometry; }
00085
00086     // IGeometrySource2DInterop.
00087     IFACEMETHODIMP GetGeometry(ID2D1Geometry** value) override
00088     {
00089         _geometry.copy_to(value);
00090         return S_OK;
00091     }
00092
00093     // IGeometrySource2DInterop.
00094     IFACEMETHODIMP TryGetGeometryUsingFactory(ID2D1Factory*, ID2D1Geometry**) override
00095     {
00096         return E_NOTIMPL;
00097     }
00098 };
00099 class AnimatedSettingsVisualSource_AnimatedVisual : public winrt::implements<AnimatedSettingsVisualSource_AnimatedVisual,
00100         winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual,
00101         IClosable>
00102 {
00103     winrt::com_ptr<ID2D1Factory> _d2dFactory{ nullptr };
00104     static constexpr int64_t c_durationTicks{ 20000000L };
00105     Compositor const _c{ nullptr };
00106     ExpressionAnimation const _reusableExpressionAnimation{ nullptr };
00107     CompositionPropertySet const _themeProperties{ nullptr };
00108     CompositionColorBrush _themeColor_Foreground{ nullptr };
00109     CompositionPathGeometry _pathGeometry{ nullptr };
00110     ContainerVisual _root{ nullptr };
00111     CubicBezierEasingFunction _cubicBezierEasingFunction_0{ nullptr };
00112     CubicBezierEasingFunction _cubicBezierEasingFunction_1{ nullptr };
00113     ExpressionAnimation _rootProgress{ nullptr };
00114     InsetClip _insetClip_0{ nullptr };
00115     StepEasingFunction _holdThenStepEasingFunction{ nullptr };
00116     StepEasingFunction _stepThenHoldEasingFunction{ nullptr };
00117
00118     static void StartProgressBoundAnimation(
00119         CompositionObject target,
00120         winrt::hstring animatedPropertyName,
00121         CompositionAnimation animation,
00122         ExpressionAnimation controllerProgressExpression)
00123     {
00124         target.StartAnimation(animatedPropertyName, animation);
00125         const auto controller = target.TryGetAnimationController(animatedPropertyName);
00126         controller.Pause();
00127         controller.StartAnimation(L"Progress", controllerProgressExpression);
00128     }
00129
00130     void BindProperty(
00131         CompositionObject target,
00132         winrt::hstring animatedPropertyName,
00133         winrt::hstring expression,
00134         winrt::hstring referenceParameterName,
00135         CompositionObject referencedObject)
00136     {
00137         _reusableExpressionAnimation.ClearAllParameters();
00138         _reusableExpressionAnimation.Expression(expression);
00139         _reusableExpressionAnimation.SetReferenceParameter(referenceParameterName, referencedObject);
00140         target.StartAnimation(animatedPropertyName, _reusableExpressionAnimation);
00141     }
00142
00143     BooleanKeyFrameAnimation CreateBooleanKeyFrameAnimation(float initialProgress, bool initialValue)
00144     {
00145         const auto result = _c.CreateBooleanKeyFrameAnimation();
00146         result.Duration(TimeSpan{ c_durationTicks });
00147         result.InsertKeyFrame(initialProgress, initialValue);
00148         return result;
00149     }
00150
00151     ScalarKeyFrameAnimation CreateScalarKeyFrameAnimation(float initialProgress, float initialValue, CompositionEasingFunction initialEasingFunction)
00152     {
00153         const auto result = _c.CreateScalarKeyFrameAnimation();
00154         result.Duration(TimeSpan{ c_durationTicks });
00155         result.InsertKeyFrame(initialProgress, initialValue, initialEasingFunction);
00156         return result;
00157     }
00158
00159     // PreComp layer: Controls - 04 - Settings - 06 - PressedToPointerOver
00160     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_0()
00161     {
00162         // Frame 80.
00163         const auto result = CreateBooleanKeyFrameAnimation(0.666666687F, true);
00164         return result;
00165     }
00166
00167     // PreComp layer: Controls - 04 - Settings - 05 - PressedToNormal
00168     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_1()
00169     {
00170         // Frame 40.
00171         const auto result = CreateBooleanKeyFrameAnimation(0.333333343F, true);
00172         // Frame 80.
00173         result.InsertKeyFrame(0.666666687F, false);
00174         return result;
00175     }
00176
00177     // PreComp layer: Controls - 04 - Settings - 01 - NormalToPointerOver Controls - 04 -
00178     // Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 - PointerOverToNormal
00179     // Controls - 04 - Settings - 04 - PointerOverToPressed
00180     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_2()
00181     {
00182         // Frame 40.
00183         const auto result = CreateBooleanKeyFrameAnimation(0.333333343F, false);
00184         return result;
00185     }
00186
00187     // - Path 4+Path 3+Path 2+Path 1.PathGeometry
00188     winrt::com_ptr<CanvasGeometry> Geometry_0()
00189     {
00190         winrt::com_ptr<ID2D1Geometry> geometries[4]
00191         {
00192             Geometry_1().get()->Geometry(),
00193             Geometry_2().get()->Geometry(),
00194             Geometry_3().get()->Geometry(),
00195             Geometry_4().get()->Geometry(),
00196         };
00197         winrt::com_ptr<ID2D1GeometryGroup> group{ nullptr };
00198         winrt::check_hresult(_d2dFactory->CreateGeometryGroup(
00199             D2D1_FILL_MODE_WINDING,
00200             (ID2D1Geometry**)(&geometries),
00201             4,
00202             group.put()));
00203         auto result = winrt::make_self<CanvasGeometry>(group);
00204         return result;
00205     }
00206
00207     // - - Path 4+Path 3+Path 2+Path 1.PathGeometry
00208     winrt::com_ptr<CanvasGeometry> Geometry_1()
00209     {
00210         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00211         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00212         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00213         winrt::check_hresult(path->Open(sink.put()));
00214         sink->SetFillMode(D2D1_FILL_MODE_WINDING);
00215         sink->BeginFigure({ 48.8800011F, 30.9810009F }, D2D1_FIGURE_BEGIN_FILLED);
00216         sink->AddBezier({ { 49.1990013F, 29.9960003F }, { 49.7229996F, 29.0919991F }, { 50.4160004F, 28.3250008F } });
00217         sink->AddBezier({ { 50.5330009F, 28.1949997F }, { 50.7169991F, 28.1490002F }, { 50.8810005F, 28.2080002F } });
00218         sink->AddLine({ 52.5359993F, 28.7989998F });
00219         sink->AddBezier({ { 52.9850006F, 28.9589996F }, { 53.4790001F, 28.7259998F }, { 53.6389999F, 28.2770004F } });
00220         sink->AddBezier({ { 53.6549988F, 28.2329998F }, { 53.6669998F, 28.1879997F }, { 53.6749992F, 28.1420002F } });
00221         sink->AddLine({ 53.9900017F, 26.4109993F });
00222         sink->AddBezier({ { 54.0209999F, 26.2390003F }, { 54.1539993F, 26.1019993F }, { 54.3250008F, 26.066F } });
00223         sink->AddBezier({ { 54.8260002F, 25.9589996F }, { 55.3390007F, 25.9060001F }, { 55.8590012F, 25.9060001F } });
00224         sink->AddBezier({ { 56.3790016F, 25.9060001F }, { 56.8919983F, 25.9599991F }, { 57.3919983F, 26.066F } });
00225         sink->AddBezier({ { 57.5629997F, 26.1019993F }, { 57.6949997F, 26.2390003F }, { 57.7260017F, 26.4109993F } });
00226         sink->AddLine({ 58.0419998F, 28.1420002F });
00227         sink->AddBezier({ { 58.1279984F, 28.6110001F }, { 58.5769997F, 28.9209995F }, { 59.0460014F, 28.8360004F } });
00228         sink->AddBezier({ { 59.0919991F, 28.8279991F }, { 59.137001F, 28.8150005F }, { 59.1809998F, 28.7989998F } });
00229         sink->AddLine({ 60.8359985F, 28.2080002F });
00230         sink->AddBezier({ { 61.0F, 28.1490002F }, { 61.1850014F, 28.1949997F }, { 61.3019981F, 28.3250008F } });
00231         sink->AddBezier({ { 61.9949989F, 29.0919991F }, { 62.519001F, 29.9960003F }, { 62.8380013F, 30.9810009F } });
00232         sink->AddBezier({ { 62.8919983F, 31.1469994F }, { 62.8390007F, 31.3299999F }, { 62.7060013F, 31.4430008F } });
00233         sink->AddLine({ 61.3650017F, 32.5810013F });
00234         sink->AddBezier({ { 61.0019989F, 32.8889999F }, { 60.9580002F, 33.4350014F }, { 61.2659988F, 33.7980003F } });
00235         sink->AddBezier({ { 61.2960014F, 33.8339996F }, { 61.3289986F, 33.8670006F }, { 61.3650017F, 33.8969994F } });
00236         sink->AddLine({ 62.7060013F, 35.0359993F });
00237         sink->AddBezier({ { 62.8390007F, 35.1489983F }, { 62.8919983F, 35.3310013F }, { 62.8380013F, 35.4970016F } });
00238         sink->AddBezier({ { 62.519001F, 36.4819984F }, { 61.9949989F, 37.387001F }, { 61.3019981F, 38.1539993F } });
00239         sink->AddBezier({ { 61.1850014F, 38.2840004F }, { 61.0F, 38.3300018F }, { 60.8359985F, 38.2709999F } });
00240         sink->AddLine({ 59.1809998F, 37.6790009F });
00241         sink->AddBezier({ { 58.7319984F, 37.519001F }, { 58.2389984F, 37.7519989F }, { 58.0789986F, 38.2010002F } });
00242         sink->AddBezier({ { 58.0629997F, 38.2449989F }, { 58.0499992F, 38.2910004F }, { 58.0419998F, 38.3370018F } });
00243         sink->AddLine({ 57.7260017F, 40.0680008F });
00244         sink->AddBezier({ { 57.6949997F, 40.2400017F }, { 57.5629997F, 40.3759995F }, { 57.3919983F, 40.4119987F } });
00245         sink->AddBezier({ { 56.8919983F, 40.5180016F }, { 56.3790016F, 40.5730019F }, { 55.8590012F, 40.5730019F } });
00246         sink->AddBezier({ { 55.3390007F, 40.5730019F }, { 54.8260002F, 40.519001F }, { 54.3250008F, 40.4119987F } });
00247         sink->AddBezier({ { 54.1539993F, 40.3759995F }, { 54.0209999F, 40.2389984F }, { 53.9900017F, 40.0670013F } });
00248         sink->AddLine({ 53.6749992F, 38.3370018F });
00249         sink->AddBezier({ { 53.5900002F, 37.868F }, { 53.1409988F, 37.5569992F }, { 52.6720009F, 37.6430016F } });
00250         sink->AddBezier({ { 52.6259995F, 37.651001F }, { 52.5800018F, 37.6629982F }, { 52.5359993F, 37.6790009F } });
00251         sink->AddLine({ 50.8810005F, 38.2709999F });
00252         sink->AddBezier({ { 50.7169991F, 38.3300018F }, { 50.5330009F, 38.2840004F }, { 50.4160004F, 38.1539993F } });
00253         sink->AddBezier({ { 49.7229996F, 37.387001F }, { 49.1990013F, 36.4819984F }, { 48.8800011F, 35.4970016F } });
00254         sink->AddBezier({ { 48.8260002F, 35.3310013F }, { 48.8779984F, 35.1489983F }, { 49.0110016F, 35.0359993F } });
00255         sink->AddLine({ 50.3520012F, 33.8969994F });
00256         sink->AddBezier({ { 50.7150002F, 33.5890007F }, { 50.7599983F, 33.0439987F }, { 50.4519997F, 32.6809998F } });
00257         sink->AddBezier({ { 50.4220009F, 32.6450005F }, { 50.3880005F, 32.6110001F }, { 50.3520012F, 32.5810013F } });
00258         sink->AddLine({ 49.0110016F, 31.4430008F });
00259         sink->AddBezier({ { 48.8779984F, 31.3299999F }, { 48.8260002F, 31.1469994F }, { 48.8800011F, 30.9810009F } });
00260         sink->EndFigure(D2D1_FIGURE_END_CLOSED);
00261         winrt::check_hresult(sink->Close());
00262         auto result = winrt::make_self<CanvasGeometry>(path);
00263         return result;
00264     }
00265
00266     // - - Path 4+Path 3+Path 2+Path 1.PathGeometry
00267     winrt::com_ptr<CanvasGeometry> Geometry_2()
00268     {
00269         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00270         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00271         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00272         winrt::check_hresult(path->Open(sink.put()));
00273         sink->SetFillMode(D2D1_FILL_MODE_WINDING);
00274         sink->BeginFigure({ 49.7949982F, 30.9759998F }, D2D1_FIGURE_BEGIN_FILLED);
00275         sink->AddLine({ 50.9109993F, 31.9239998F });
00276         sink->AddBezier({ { 50.9819984F, 31.9850006F }, { 51.0480003F, 32.0509987F }, { 51.1090012F, 32.1220016F } });
00277         sink->AddBezier({ { 51.7260017F, 32.8479996F }, { 51.637001F, 33.9370003F }, { 50.9109993F, 34.5540009F } });
00278         sink->AddLine({ 49.7949982F, 35.5019989F });
00279         sink->AddBezier({ { 50.0470009F, 36.1769981F }, { 50.4099998F, 36.8040009F }, { 50.8689995F, 37.3590012F } });
00280         sink->AddLine({ 52.2459984F, 36.8670006F });
00281         sink->AddBezier({ { 52.3339996F, 36.8349991F }, { 52.4249992F, 36.8110008F }, { 52.5169983F, 36.7939987F } });
00282         sink->AddBezier({ { 53.4550018F, 36.6230011F }, { 54.3530006F, 37.2439995F }, { 54.5239983F, 38.1819992F } });
00283         sink->AddLine({ 54.7859993F, 39.6209984F });
00284         sink->AddBezier({ { 55.1380005F, 39.6800003F }, { 55.4970016F, 39.7099991F }, { 55.8590012F, 39.7099991F } });
00285         sink->AddBezier({ { 56.2210007F, 39.7099991F }, { 56.5789986F, 39.6800003F }, { 56.9309998F, 39.6209984F } });
00286         sink->AddLine({ 57.1940002F, 38.1819992F });
00287         sink->AddBezier({ { 57.2109985F, 38.0900002F }, { 57.2340012F, 37.9990005F }, { 57.2659988F, 37.9109993F } });
00288         sink->AddBezier({ { 57.5870018F, 37.0139999F }, { 58.5740013F, 36.5460014F }, { 59.4720001F, 36.8670006F } });
00289         sink->AddLine({ 60.848999F, 37.3590012F });
00290         sink->AddBezier({ { 61.3069992F, 36.8040009F }, { 61.6710014F, 36.1769981F }, { 61.9230003F, 35.5019989F } });
00291         sink->AddLine({ 60.8069992F, 34.5540009F });
00292         sink->AddBezier({ { 60.7360001F, 34.493F }, { 60.6689987F, 34.4269981F }, { 60.6080017F, 34.355999F } });
00293         sink->AddBezier({ { 59.9910011F, 33.6300011F }, { 60.0810013F, 32.5410004F }, { 60.8069992F, 31.9239998F } });
00294         sink->AddLine({ 61.9230003F, 30.9759998F });
00295         sink->AddBezier({ { 61.6710014F, 30.3010006F }, { 61.3069992F, 29.6739998F }, { 60.848999F, 29.1189995F } });
00296         sink->AddLine({ 59.4720001F, 29.6119995F });
00297         sink->AddBezier({ { 59.3839989F, 29.6439991F }, { 59.2929993F, 29.6669998F }, { 59.2010002F, 29.684F } });
00298         sink->AddBezier({ { 58.2639999F, 29.8549995F }, { 57.3650017F, 29.2339993F }, { 57.1940002F, 28.2970009F } });
00299         sink->AddLine({ 56.9309998F, 26.8570004F });
00300         sink->AddBezier({ { 56.5789986F, 26.7980003F }, { 56.2210007F, 26.7679996F }, { 55.8590012F, 26.7679996F } });
00301         sink->AddBezier({ { 55.4970016F, 26.7679996F }, { 55.1380005F, 26.7980003F }, { 54.7859993F, 26.8570004F } });
00302         sink->AddLine({ 54.5239983F, 28.2959995F });
00303         sink->AddBezier({ { 54.507F, 28.3880005F }, { 54.4830017F, 28.4799995F }, { 54.4510002F, 28.5680008F } });
00304         sink->AddBezier({ { 54.1300011F, 29.4650002F }, { 53.1430016F, 29.9330006F }, { 52.2459984F, 29.6119995F } });
00305         sink->AddLine({ 50.8689995F, 29.1189995F });
00306         sink->AddBezier({ { 50.4099998F, 29.6739998F }, { 50.0470009F, 30.3010006F }, { 49.7949982F, 30.9759998F } });
00307         sink->EndFigure(D2D1_FIGURE_END_CLOSED);
00308         winrt::check_hresult(sink->Close());
00309         auto result = winrt::make_self<CanvasGeometry>(path);
00310         return result;
00311     }
00312
00313     // - - Path 4+Path 3+Path 2+Path 1.PathGeometry
00314     winrt::com_ptr<CanvasGeometry> Geometry_3()
00315     {
00316         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00317         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00318         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00319         winrt::check_hresult(path->Open(sink.put()));
00320         sink->SetFillMode(D2D1_FILL_MODE_WINDING);
00321         sink->BeginFigure({ 53.7019997F, 33.2389984F }, D2D1_FIGURE_BEGIN_FILLED);
00322         sink->AddBezier({ { 53.7019997F, 32.0480003F }, { 54.6679993F, 31.0820007F }, { 55.8590012F, 31.0820007F } });
00323         sink->AddBezier({ { 57.0499992F, 31.0820007F }, { 58.0159988F, 32.0480003F }, { 58.0159988F, 33.2389984F } });
00324         sink->AddBezier({ { 58.0159988F, 34.4300003F }, { 57.0499992F, 35.3959999F }, { 55.8590012F, 35.3959999F } });
00325         sink->AddBezier({ { 54.6679993F, 35.3959999F }, { 53.7019997F, 34.4300003F }, { 53.7019997F, 33.2389984F } });
00326         sink->EndFigure(D2D1_FIGURE_END_CLOSED);
00327         winrt::check_hresult(sink->Close());
00328         auto result = winrt::make_self<CanvasGeometry>(path);
00329         return result;
00330     }
00331
00332     // - - Path 4+Path 3+Path 2+Path 1.PathGeometry
00333     winrt::com_ptr<CanvasGeometry> Geometry_4()
00334     {
00335         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00336         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00337         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00338         winrt::check_hresult(path->Open(sink.put()));
00339         sink->SetFillMode(D2D1_FILL_MODE_WINDING);
00340         sink->BeginFigure({ 54.5649986F, 33.2389984F }, D2D1_FIGURE_BEGIN_FILLED);
00341         sink->AddBezier({ { 54.5649986F, 33.9539986F }, { 55.144001F, 34.5330009F }, { 55.8590012F, 34.5330009F } });
00342         sink->AddBezier({ { 56.5740013F, 34.5330009F }, { 57.1529999F, 33.9539986F }, { 57.1529999F, 33.2389984F } });
00343         sink->AddBezier({ { 57.1529999F, 32.5239983F }, { 56.5740013F, 31.9449997F }, { 55.8590012F, 31.9449997F } });
00344         sink->AddBezier({ { 55.144001F, 31.9449997F }, { 54.5649986F, 32.5239983F }, { 54.5649986F, 33.2389984F } });
00345         sink->EndFigure(D2D1_FIGURE_END_CLOSED);
00346         winrt::check_hresult(sink->Close());
00347         auto result = winrt::make_self<CanvasGeometry>(path);
00348         return result;
00349     }
00350
00351     // Color bound to theme property value: Foreground
00352     CompositionColorBrush ThemeColor_Foreground()
00353     {
00354         const auto result = _themeColor_Foreground = _c.CreateColorBrush();
00355         BindProperty(result, L"Color", L"ColorRGB(_theme.Foreground.W,_theme.Foreground.X,_theme.Foreground.Y,_theme.Foreground.Z)", L"_theme", _themeProperties);
00356         return result;
00357     }
00358
00359     // Path 4+Path 3+Path 2+Path 1.PathGeometry
00360     CompositionPathGeometry PathGeometry()
00361     {
00362         return _pathGeometry = _c.CreatePathGeometry(CompositionPath(CanvasGeometryToIGeometrySource2D(Geometry_0())));
00363     }
00364
00365     // - PreComp layer: Controls - 04 - Settings - 06 - PressedToPointerOver
00366     // Transforms for Controls - 04 - Settings - 06 - PressedToPointerOver Scale(1,1,0)
00367     // Path 4+Path 3+Path 2+Path 1
00368     CompositionSpriteShape SpriteShape_0()
00369     {
00370         const auto result = _c.CreateSpriteShape(PathGeometry());
00371         result.CenterPoint({ 55.8590012F, 33.2389984F });
00372         result.Offset({ -31.8590012F, -9.23899841F });
00373         result.Scale({ 3.0F, 3.0F });
00374         result.FillBrush(ThemeColor_Foreground());
00375         StartProgressBoundAnimation(result, L"RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_0_to_360_0(), RootProgress());
00376         return result;
00377     }
00378
00379     // - PreComp layer: Controls - 04 - Settings - 05 - PressedToNormal
00380     // Transforms for Controls - 04 - Settings - 05 - PressedToNormal Scale(1,1,0)
00381     // Path 4+Path 3+Path 2+Path 1
00382     CompositionSpriteShape SpriteShape_1()
00383     {
00384         const auto result = _c.CreateSpriteShape(_pathGeometry);
00385         result.CenterPoint({ 55.8590012F, 33.2389984F });
00386         result.Offset({ -31.8590012F, -9.23899841F });
00387         result.Scale({ 3.0F, 3.0F });
00388         result.FillBrush(_themeColor_Foreground);
00389         StartProgressBoundAnimation(result, L"RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_0_to_360_1(), _rootProgress);
00390         return result;
00391     }
00392
00393     // - PreComp layer: Controls - 04 - Settings - 01 - NormalToPointerOver Controls - 04
00394     // - Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 -
00395     // PointerOverToNormal Controls - 04 - Settings - 04 - PointerOverToPressed
00396     // Transforms for Controls - 04 - Settings - 01 - NormalToPointerOver Controls - 04 -
00397     // Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 - PointerOverToNormal
00398     // Controls - 04 - Settings - 04 - PointerOverToPressed Scale(1,1,0)
00399     // Path 4 Path 4 Path 4 Path 4+Path 3 Path 3 Path 3 Path 3+Path 2 Path 2 Path 2 Path
00400     // 2+Path 1 Path 1 Path 1 Path 1
00401     CompositionSpriteShape SpriteShape_2()
00402     {
00403         const auto result = _c.CreateSpriteShape(_pathGeometry);
00404         result.CenterPoint({ 55.8590012F, 33.2389984F });
00405         result.Offset({ -31.8590012F, -9.23899841F });
00406         result.Scale({ 3.0F, 3.0F });
00407         result.FillBrush(_themeColor_Foreground);
00408         StartProgressBoundAnimation(result, L"RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_0_to_m20(), _rootProgress);
00409         return result;
00410     }
00411
00412     // PreComp layer: Controls - 04 - Settings - 06 - PressedToPointerOver
00413     ContainerVisual ContainerVisual_0()
00414     {
00415         const auto result = _c.CreateContainerVisual();
00416         result.Clip(InsetClip_0());
00417         result.IsVisible(false);
00418         result.Size({ 48.0F, 48.0F });
00419         // Scale:<1, 1>
00420         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F });
00421         // Transforms for Controls - 04 - Settings - 06 - PressedToPointerOver Scale(1,1,0)
00422         result.Children().InsertAtTop(ShapeVisual_0());
00423         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_0(), _rootProgress);
00424         return result;
00425     }
00426
00427     // PreComp layer: Controls - 04 - Settings - 05 - PressedToNormal
00428     ContainerVisual ContainerVisual_1()
00429     {
00430         const auto result = _c.CreateContainerVisual();
00431         result.Clip(_insetClip_0);
00432         result.IsVisible(false);
00433         result.Size({ 48.0F, 48.0F });
00434         // Scale:<1, 1>
00435         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F });
00436         // Transforms for Controls - 04 - Settings - 05 - PressedToNormal Scale(1,1,0)
00437         result.Children().InsertAtTop(ShapeVisual_1());
00438         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_1(), _rootProgress);
00439         return result;
00440     }
00441
00442     // PreComp layer: Controls - 04 - Settings - 01 - NormalToPointerOver Controls - 04 -
00443     // Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 - PointerOverToNormal
00444     // Controls - 04 - Settings - 04 - PointerOverToPressed
00445     ContainerVisual ContainerVisual_2()
00446     {
00447         const auto result = _c.CreateContainerVisual();
00448         result.Clip(_insetClip_0);
00449         result.Size({ 48.0F, 48.0F });
00450         // Scale:<1, 1>
00451         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F });
00452         // Transforms for Controls - 04 - Settings - 01 - NormalToPointerOver Controls - 04 -
00453         // Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 - PointerOverToNormal
00454         // Controls - 04 - Settings - 04 - PointerOverToPressed Scale(1,1,0)
00455         result.Children().InsertAtTop(ShapeVisual_2());
00456         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_2(), _rootProgress);
00457         return result;
00458     }
00459
00460     // The root of the composition.
00461     ContainerVisual Root()
00462     {
00463         const auto result = _root = _c.CreateContainerVisual();
00464         const auto propertySet = result.Properties();
00465         propertySet.InsertScalar(L"Progress", 0.0F);
00466         const auto children = result.Children();
00467         // PreComp layer: Controls - 04 - Settings - 06 - PressedToPointerOver
00468         children.InsertAtTop(ContainerVisual_0());
00469         // PreComp layer: Controls - 04 - Settings - 05 - PressedToNormal
00470         children.InsertAtTop(ContainerVisual_1());
00471         // PreComp layer: Controls - 04 - Settings - 01 - NormalToPointerOver Controls - 04 -
00472         // Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 - PointerOverToNormal
00473         // Controls - 04 - Settings - 04 - PointerOverToPressed
00474         children.InsertAtTop(ContainerVisual_2());
00475         return result;
00476     }
00477
00478     CubicBezierEasingFunction CubicBezierEasingFunction_0()
00479     {
00480         return _cubicBezierEasingFunction_0 = _c.CreateCubicBezierEasingFunction({ 0.166999996F, 0.166999996F }, { 1.0F, 1.0F });
00481     }
00482
00483     CubicBezierEasingFunction CubicBezierEasingFunction_1()
00484     {
00485         return _cubicBezierEasingFunction_1 = _c.CreateCubicBezierEasingFunction({ 0.0F, 0.0F }, { 0.0F, 1.0F });
00486     }
00487
00488     ExpressionAnimation RootProgress()
00489     {
00490         const auto result = _rootProgress = _c.CreateExpressionAnimation(L"_.Progress");
00491         result.SetReferenceParameter(L"_", _root);
00492         return result;
00493     }
00494
00495     InsetClip InsetClip_0()
00496     {
00497         const auto result = _insetClip_0 = _c.CreateInsetClip();
00498         return result;
00499     }
00500
00501     // - - PreComp layer: Controls - 04 - Settings - 06 - PressedToPointerOver
00502     // - Transforms for Controls - 04 - Settings - 06 - PressedToPointerOver Scale(1,1,0)
00503     // ShapeGroup: Group 1
00504     // Rotation
00505     ScalarKeyFrameAnimation RotationAngleInDegreesScalarAnimation_0_to_360_0()
00506     {
00507         // Frame 0.
00508         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, StepThenHoldEasingFunction());
00509         // Frame 70.
00510         result.InsertKeyFrame(0.583333313F, 0.0F, HoldThenStepEasingFunction());
00511         // Frame 80.
00512         result.InsertKeyFrame(0.666666687F, -20.0F, CubicBezierEasingFunction_0());
00513         // Frame 119.
00514         result.InsertKeyFrame(0.991666675F, 360.0F, CubicBezierEasingFunction_1());
00515         return result;
00516     }
00517
00518     // - - PreComp layer: Controls - 04 - Settings - 05 - PressedToNormal
00519     // - Transforms for Controls - 04 - Settings - 05 - PressedToNormal Scale(1,1,0)
00520     // ShapeGroup: Group 1
00521     // Rotation
00522     ScalarKeyFrameAnimation RotationAngleInDegreesScalarAnimation_0_to_360_1()
00523     {
00524         // Frame 0.
00525         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
00526         // Frame 30.
00527         result.InsertKeyFrame(0.25F, 0.0F, _holdThenStepEasingFunction);
00528         // Frame 40.
00529         result.InsertKeyFrame(0.333333343F, -20.0F, _cubicBezierEasingFunction_0);
00530         // Frame 79.
00531         result.InsertKeyFrame(0.658333361F, 360.0F, _cubicBezierEasingFunction_1);
00532         return result;
00533     }
00534
00535     // - - PreComp layer: Controls - 04 - Settings - 01 - NormalToPointerOver Controls -
00536     // 04 - Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 -
00537     // PointerOverToNormal Controls - 04 - Settings - 04 - PointerOverToPressed
00538     // - Transforms for Controls - 04 - Settings - 01 - NormalToPointerOver Controls - 04
00539     // - Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 -
00540     // PointerOverToNormal Controls - 04 - Settings - 04 - PointerOverToPressed
00541     // Scale(1,1,0)
00542     // ShapeGroup: Group 1 Group 1 Group 1 Group 1
00543     // Rotation
00544     ScalarKeyFrameAnimation RotationAngleInDegreesScalarAnimation_0_to_m20()
00545     {
00546         // Frame 0.
00547         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _holdThenStepEasingFunction);
00548         // Frame 10.
00549         result.InsertKeyFrame(0.0833333358F, 0.0F, _holdThenStepEasingFunction);
00550         // Frame 19.
00551         result.InsertKeyFrame(0.158333331F, -20.0F, _cubicBezierEasingFunction_0);
00552         // Frame 20.
00553         result.InsertKeyFrame(0.166666672F, 0.0F, _holdThenStepEasingFunction);
00554         // Frame 30.
00555         result.InsertKeyFrame(0.25F, 0.0F, _holdThenStepEasingFunction);
00556         // Frame 39.
00557         result.InsertKeyFrame(0.324999988F, -20.0F, _cubicBezierEasingFunction_0);
00558         return result;
00559     }
00560
00561     // PreComp layer: Controls - 04 - Settings - 06 - PressedToPointerOver
00562     // Shape tree root for layer: Layer 2
00563     ShapeVisual ShapeVisual_0()
00564     {
00565         const auto result = _c.CreateShapeVisual();
00566         result.Size({ 48.0F, 48.0F });
00567         // ShapeGroup: Group 1
00568         result.Shapes().Append(SpriteShape_0());
00569         return result;
00570     }
00571
00572     // PreComp layer: Controls - 04 - Settings - 05 - PressedToNormal
00573     // Shape tree root for layer: Layer 2
00574     ShapeVisual ShapeVisual_1()
00575     {
00576         const auto result = _c.CreateShapeVisual();
00577         result.Size({ 48.0F, 48.0F });
00578         // ShapeGroup: Group 1
00579         result.Shapes().Append(SpriteShape_1());
00580         return result;
00581     }
00582
00583     // PreComp layer: Controls - 04 - Settings - 01 - NormalToPointerOver Controls - 04 -
00584     // Settings - 02 - NormalToPressed Controls - 04 - Settings - 03 - PointerOverToNormal
00585     // Controls - 04 - Settings - 04 - PointerOverToPressed
00586     // Shape tree root for layer: Layer 2 Layer 2 Layer 2 Layer 2
00587     ShapeVisual ShapeVisual_2()
00588     {
00589         const auto result = _c.CreateShapeVisual();
00590         result.Size({ 48.0F, 48.0F });
00591         // ShapeGroup: Group 1 Group 1 Group 1 Group 1
00592         result.Shapes().Append(SpriteShape_2());
00593         return result;
00594     }
00595
00596     StepEasingFunction HoldThenStepEasingFunction()
00597     {
00598         const auto result = _holdThenStepEasingFunction = _c.CreateStepEasingFunction();
00599         result.IsFinalStepSingleFrame(true);
00600         return result;
00601     }
00602
00603     StepEasingFunction StepThenHoldEasingFunction()
00604     {
00605         const auto result = _stepThenHoldEasingFunction = _c.CreateStepEasingFunction();
00606         result.IsInitialStepSingleFrame(true);
00607         return result;
00608     }
00609
00610     static IGeometrySource2D CanvasGeometryToIGeometrySource2D(winrt::com_ptr<CanvasGeometry> geo)
00611     {
00612         return geo.as<IGeometrySource2D>();
00613     }
00614
00615 public:
00616     AnimatedSettingsVisualSource_AnimatedVisual(
00617         Compositor compositor,
00618         CompositionPropertySet themeProperties)
00619         : _c{compositor}
00620         , _themeProperties{themeProperties}
00621         , _reusableExpressionAnimation(compositor.CreateExpressionAnimation())
00622     {
00623         winrt::check_hresult(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, _d2dFactory.put()));
00624         const auto _ = Root();
00625     }
00626
00627     void Close()
00628     {
00629         if (_root)
00630         {
00631             _root.Close();
00632         }
00633     }
00634
00635     TimeSpan Duration() const
00636     {
00637         return TimeSpan{ c_durationTicks };
00638     }
00639
00640     Visual RootVisual() const
00641     {
00642         return _root;
00643     }
00644
00645     winrt::float2 Size() const
00646     {
00647         return { 48.0F, 48.0F };
00648     }
00649
00650     static bool IsRuntimeCompatible()
00651     {
00652         return winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7);
00653     }
00654 };
00655
00656 winrt::float4 AnimatedSettingsVisualSource::ColorAsVector4(Color color)
00657 {
00658     return { static_cast<float>(color.R), static_cast<float>(color.G), static_cast<float>(color.B), static_cast<float>(color.A) };
00659 }
00660
00661 CompositionPropertySet AnimatedSettingsVisualSource::EnsureThemeProperties(Compositor compositor)
00662 {
00663     if (_themeProperties == nullptr)
00664     {
00665         _themeProperties = compositor.CreatePropertySet();
00666         _themeProperties.InsertVector4(L"Foreground", ColorAsVector4((Color)_themeForeground));
00667     }
00668
00669     return _themeProperties;
00670 }
00671
00672 Color AnimatedSettingsVisualSource::Foreground()
00673 {
00674     return _themeForeground;
00675 }
00676
00677 void AnimatedSettingsVisualSource::Foreground(Color value)
00678 {
00679     _themeForeground = value;
00680     if (_themeProperties != nullptr)
00681     {
00682         _themeProperties.InsertVector4(L"Foreground", ColorAsVector4((Color)_themeForeground));
00683     }
00684 }
00685
00686 winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual AnimatedSettingsVisualSource::TryCreateAnimatedVisual(
00687     Compositor const& compositor)
00688 {
00689     IInspectable diagnostics = nullptr;
00690     return TryCreateAnimatedVisual(compositor, diagnostics);
00691 }
00692
00693 winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual AnimatedSettingsVisualSource::TryCreateAnimatedVisual(
00694     Compositor const& compositor,
00695     IInspectable& diagnostics)
00696 {
00697     const auto _ = EnsureThemeProperties(compositor);
00698     diagnostics = nullptr;
00699
00700     if (AnimatedSettingsVisualSource_AnimatedVisual::IsRuntimeCompatible())
00701     {
00702         return winrt::make<AnimatedSettingsVisualSource_AnimatedVisual>(
00703             compositor,
00704             _themeProperties);
00705     }
00706
00707     return nullptr;
00708 }
00709
00710 double AnimatedSettingsVisualSource::FrameCount()
00711 {
00712     return 120.0;
00713 }
00714
00715 double AnimatedSettingsVisualSource::Framerate()
00716 {
00717     return 60.0;
00718 }
00719
00720 TimeSpan AnimatedSettingsVisualSource::Duration()
00721 {
00722     return TimeSpan{ 20000000L };
00723 }
00724
00725 double AnimatedSettingsVisualSource::FrameToProgress(double frameNumber)
00726 {
00727     return frameNumber / 120.0;
00728 }
00729
00730 winrt::Windows::Foundation::Collections::IMapView<hstring, double> AnimatedSettingsVisualSource::Markers()
00731 {
00732     return winrt::single_threaded_map<winrt::hstring, double>(
00733         std::map<winrt::hstring, double>
00734         {
00735             { L"NormalToPointerOver_Start", 0.0 },
00736             { L"NormalToPointerOver_End", 0.0754166666666667 },
00737             { L"NormalToPressed_Start", 0.08375 },
00738             { L"NormalToPressed_End", 0.15875 },
00739             { L"PointerOverToNormal_Start", 0.167083333333333 },
00740             { L"PointerOverToNormal_End", 0.242083333333333 },
00741             { L"PointerOverToPressed_Start", 0.250416666666667 },
00742             { L"PointerOverToPressed_End", 0.325416666666667 },
00743             { L"PressedToNormal_Start", 0.33375 },
00744             { L"PressedToNormal_End", 0.65875 },
00745             { L"PressedToPointerOver_Start", 0.667083333333333 },
00746             { L"PressedToPointerOver_End", 0.992083333333333 },
00747         }
00748     ).GetView();
00749 }
00750
00751 void AnimatedSettingsVisualSource::SetColorProperty(hstring const& propertyName, Color value)
00752 {
00753     if (propertyName == L"Foreground")
00754     {
00755         _themeForeground = value;
00756     }
00757     else
00758     {
00759         return;
00760     }
00761
00762     if (_themeProperties != nullptr)
00763     {
00764         _themeProperties.InsertVector4(propertyName, ColorAsVector4(value));
00765     }
00766 }
00767
00768 void AnimatedSettingsVisualSource::SetScalarProperty(hstring const&, double)
00769 {
00770 }
Generated on Sun Dec 1 2024 20:51:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ChildHandlers Member List

This is the complete list of members for ChildHandlers, including all inherited members.
checkedRevoker | ChildHandlers
uncheckedRevoker | ChildHandlers
Generated on Sun Dec 1 2024 20:52:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CornerRadiusToThicknessConverter Member List

This is the complete list of members for CornerRadiusToThicknessConverter, including all inherited members.
ClearProperties() | CornerRadiusToThicknessConverterProperties | [static]
ConversionKind(winrt::CornerRadiusToThicknessConverterKind const &value) | CornerRadiusToThicknessConverterProperties |
ConversionKind() | CornerRadiusToThicknessConverterProperties |
ConversionKindProperty() | CornerRadiusToThicknessConverterProperties | [inline, static]
Convert(winrt::CornerRadius const &radius, winrt::CornerRadiusToThicknessConverterKind const &filterKind, double multiplier) | CornerRadiusToThicknessConverter |
Convert(winrt::IInspectable const &value, winrt::TypeName const &targetType, winrt::IInspectable const &parameter, winrt::hstring const &language) | CornerRadiusToThicknessConverter |
ConvertBack(winrt::IInspectable const &value, winrt::TypeName const &targetType, winrt::IInspectable const &parameter, winrt::hstring const &language) | CornerRadiusToThicknessConverter |
CornerRadiusToThicknessConverterProperties() | CornerRadiusToThicknessConverterProperties |
EnsureProperties() | CornerRadiusToThicknessConverterProperties | [static]
Multiplier(double value) | CornerRadiusToThicknessConverterProperties |
Multiplier() | CornerRadiusToThicknessConverterProperties |
MultiplierProperty() | CornerRadiusToThicknessConverterProperties | [inline, static]
s_ConversionKindProperty | CornerRadiusToThicknessConverterProperties | [static]
s_MultiplierProperty | CornerRadiusToThicknessConverterProperties | [static]
Generated on Sun Dec 1 2024 20:52:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MapControl/MapElementClickEventArgs.h Source File

  • MapControl

MapElementClickEventArgs.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008 #include "MapElement.h"
00009 #include "MapElementClickEventArgs.g.h"
00010 #include <winrt/Windows.Devices.Geolocation.h>
00011
00012
00013 class MapElementClickEventArgs :
00014     public winrt::implementation::MapElementClickEventArgsT<MapElementClickEventArgs>
00015 {
00016 public:
00017
00018     MapElementClickEventArgs(winrt::Geopoint location, winrt::MapElement element) :
00019         m_location(location), m_element(element) {};
00020
00021     winrt::Geopoint Location() { return m_location; };
00022     winrt::MapElement Element() { return m_element; };
00023
00024 private:
00025     winrt::Geopoint m_location;
00026     winrt::MapElement m_element;
00027 };
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MapControl/MapLayer.cpp Source File

  • MapControl

MapLayer.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MapLayer.h"
00007 #include "RuntimeProfiler.h"
00008 #include "ResourceAccessor.h"
00009
00010 MapLayer::MapLayer()
00011 {
00012 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeView Member List

This is the complete list of members for TreeView, including all inherited members.
abi_enter() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
CanDragItems(bool value) | TreeViewProperties |
CanDragItems() | TreeViewProperties |
CanDragItemsProperty() | TreeViewProperties | [inline, static]
CanReorderItems(bool value) | TreeViewProperties |
CanReorderItems() | TreeViewProperties |
CanReorderItemsProperty() | TreeViewProperties | [inline, static]
CheckThread() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
ClearProperties() | TreeViewProperties | [static]
Collapse(winrt::TreeViewNode const &value) | TreeView |
Collapsed(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewCollapsedEventArgs > const &value) | TreeViewProperties |
Collapsed(winrt::event_token const &token) | TreeViewProperties |
ContainerFromItem(winrt::IInspectable const &item) | TreeView |
ContainerFromNode(winrt::TreeViewNode const &node) const | TreeView |
DeleteInstanceOnUIThread(std::unique_ptr< TreeView > &&self) noexcept | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline, static]
DragItemsCompleted(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewDragItemsCompletedEventArgs > const &value) | TreeViewProperties |
DragItemsCompleted(winrt::event_token const &token) | TreeViewProperties |
DragItemsStarting(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewDragItemsStartingEventArgs > const &value) | TreeViewProperties |
DragItemsStarting(winrt::event_token const &token) | TreeViewProperties |
EnsureProperties() | TreeViewProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
Expand(winrt::TreeViewNode const &value) | TreeView |
Expanding(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewExpandingEventArgs > const &value) | TreeViewProperties |
Expanding(winrt::event_token const &token) | TreeViewProperties |
final_release(std::unique_ptr< TreeView > &&self) | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline, static]
GetAssociatedNode(winrt::IInspectable item) | TreeView |
GetAssociatedNodeImpl(winrt::IInspectable const &item, winrt::TreeViewNode const &node) | TreeView | [private]
GetBase() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
GetInner() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
IsOnThread() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
ItemContainerStyle(winrt::Style const &value) | TreeViewProperties |
ItemContainerStyle() | TreeViewProperties |
ItemContainerStyleProperty() | TreeViewProperties | [inline, static]
ItemContainerStyleSelector(winrt::StyleSelector const &value) | TreeViewProperties |
ItemContainerStyleSelector() | TreeViewProperties |
ItemContainerStyleSelectorProperty() | TreeViewProperties | [inline, static]
ItemContainerTransitions(winrt::TransitionCollection const &value) | TreeViewProperties |
ItemContainerTransitions() | TreeViewProperties |
ItemContainerTransitionsProperty() | TreeViewProperties | [inline, static]
ItemFromContainer(winrt::DependencyObject const &container) | TreeView |
ItemInvoked(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewItemInvokedEventArgs > const &value) | TreeViewProperties |
ItemInvoked(winrt::event_token const &token) | TreeViewProperties |
ItemsSource(winrt::IInspectable const &value) | TreeViewProperties |
ItemsSource() | TreeViewProperties |
ItemsSourceProperty() | TreeViewProperties | [inline, static]
ItemTemplate(winrt::DataTemplate const &value) | TreeViewProperties |
ItemTemplate() | TreeViewProperties |
ItemTemplateProperty() | TreeViewProperties | [inline, static]
ItemTemplateSelector(winrt::DataTemplateSelector const &value) | TreeViewProperties |
ItemTemplateSelector() | TreeViewProperties |
ItemTemplateSelectorProperty() | TreeViewProperties | [inline, static]
ListControl() const | TreeView |
m_collapsedEventSource | TreeViewProperties |
m_dragItemsCompletedEventSource | TreeViewProperties |
m_dragItemsStartingEventSource | TreeViewProperties |
m_expandingEventSource | TreeViewProperties |
m_itemInvokedEventSource | TreeViewProperties |
m_selectionChangedEventSource | TreeViewProperties |
MutableListControl() | TreeView |
NodeFromContainer(winrt::DependencyObject const &container) const | TreeView |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
OnApplyTemplate() | TreeView |
OnContainerContentChanging(const winrt::IInspectable &sender, const winrt::ContainerContentChangingEventArgs &args) | TreeView |
OnItemClick(const winrt::IInspectable &sender, const winrt::ItemClickEventArgs &args) | TreeView |
OnItemsAdded(int index, int count) | TreeView | [private]
OnItemsRemoved(int index, int count) | TreeView | [private]
OnItemsSourceChanged(const winrt::IInspectable &sender, const winrt::NotifyCollectionChangedEventArgs &args) | TreeView | [private]
OnItemsSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
OnListControlDragItemsCompleted(const winrt::IInspectable &sender, const winrt::DragItemsCompletedEventArgs &args) | TreeView |
OnListControlDragItemsStarting(const winrt::IInspectable &sender, const winrt::DragItemsStartingEventArgs &args) | TreeView |
OnListControlSelectionChanged(const winrt::IInspectable &sender, const winrt::SelectionChangedEventArgs &args) | TreeView |
OnNodeCollapsed(const winrt::TreeViewNode &sender, const winrt::IInspectable &) | TreeView |
OnNodeExpanding(const winrt::TreeViewNode &sender, const winrt::IInspectable &) | TreeView |
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | TreeView |
OnPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyPropertyChangedEventArgs &args) | TreeView | [private, static]
OnSelectedItemPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
OnSelectionModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
RaiseSelectionChanged(const winrt::IVector< winrt::IInspectable > addedItems, const winrt::IVector< winrt::IInspectable > removedItems) | TreeView |
ReferenceTracker(Args &&...args) | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
RootNodes() | TreeView |
s_CanDragItemsProperty | TreeViewProperties | [static]
s_CanReorderItemsProperty | TreeViewProperties | [static]
s_ItemContainerStyleProperty | TreeViewProperties | [static]
s_ItemContainerStyleSelectorProperty | TreeViewProperties | [static]
s_ItemContainerTransitionsProperty | TreeViewProperties | [static]
s_ItemsSourceProperty | TreeViewProperties | [static]
s_ItemTemplateProperty | TreeViewProperties | [static]
s_ItemTemplateSelectorProperty | TreeViewProperties | [static]
s_SelectedItemProperty | TreeViewProperties | [static]
s_SelectionModeProperty | TreeViewProperties | [static]
SelectAll() | TreeView |
SelectedItem(winrt::IInspectable const &value) | TreeViewProperties |
SelectedItem() | TreeViewProperties |
SelectedItemProperty() | TreeViewProperties | [inline, static]
SelectedItems() | TreeView |
SelectedNode(winrt::TreeViewNode const &node) | TreeView |
SelectedNode() | TreeView |
SelectedNodes() | TreeView |
SelectionChanged(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewSelectionChangedEventArgs > const &value) | TreeViewProperties |
SelectionChanged(winrt::event_token const &token) | TreeViewProperties |
SelectionMode(winrt::TreeViewSelectionMode const &value) | TreeViewProperties |
SelectionMode() | TreeViewProperties |
SelectionModeProperty() | TreeViewProperties | [inline, static]
SyncRootNodesWithItemsSource() | TreeView | [private]
TreeView() | TreeView |
TreeViewProperties() | TreeViewProperties |
UpdateItemsSelectionMode(bool isMultiSelect) | TreeView |
UpdateSelection(winrt::TreeViewNode const &node, bool isSelected) | TreeView |
Generated on Sun Dec 1 2024 20:53:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

GammaTransferEffect Member List

This is the complete list of members for GammaTransferEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1GammaTransfer) | GammaTransferEffect
DECLARE_NAMED_PROPERTY_MAPPING({L"RedAmplitude", D2D1_GAMMATRANSFER_PROP_RED_AMPLITUDE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"RedExponent", D2D1_GAMMATRANSFER_PROP_RED_EXPONENT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"RedOffset", D2D1_GAMMATRANSFER_PROP_RED_OFFSET, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"RedDisable", D2D1_GAMMATRANSFER_PROP_RED_DISABLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"GreenAmplitude", D2D1_GAMMATRANSFER_PROP_GREEN_AMPLITUDE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"GreenExponent", D2D1_GAMMATRANSFER_PROP_GREEN_EXPONENT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"GreenOffset", D2D1_GAMMATRANSFER_PROP_GREEN_OFFSET, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"GreenDisable", D2D1_GAMMATRANSFER_PROP_GREEN_DISABLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"BlueAmplitude", D2D1_GAMMATRANSFER_PROP_BLUE_AMPLITUDE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"BlueExponent", D2D1_GAMMATRANSFER_PROP_BLUE_EXPONENT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"BlueOffset", D2D1_GAMMATRANSFER_PROP_BLUE_OFFSET, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"BlueDisable", D2D1_GAMMATRANSFER_PROP_BLUE_DISABLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"AlphaAmplitude", D2D1_GAMMATRANSFER_PROP_ALPHA_AMPLITUDE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"AlphaExponent", D2D1_GAMMATRANSFER_PROP_ALPHA_EXPONENT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"AlphaOffset", D2D1_GAMMATRANSFER_PROP_ALPHA_OFFSET, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"AlphaDisable", D2D1_GAMMATRANSFER_PROP_ALPHA_DISABLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"ClampOutput", D2D1_GAMMATRANSFER_PROP_CLAMP_OUTPUT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT}) | GammaTransferEffect
DECLARE_POD_PROPERTY(RedAmplitude, float, 1.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(RedExponent, float, 1.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(RedOffset, float, 0.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(RedDisable, bool, false, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(GreenAmplitude, float, 1.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(GreenExponent, float, 1.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(GreenOffset, float, 0.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(GreenDisable, bool, false, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(BlueAmplitude, float, 1.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(BlueExponent, float, 1.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(BlueOffset, float, 0.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(BlueDisable, bool, false, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(AlphaAmplitude, float, 1.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(AlphaExponent, float, 1.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(AlphaOffset, float, 0.0f, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(AlphaDisable, bool, false, true) | GammaTransferEffect
DECLARE_POD_PROPERTY(ClampOutput, bool, false, true) | GammaTransferEffect
DECLARE_SINGLE_SOURCE(Source) | GammaTransferEffect
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | GammaTransferEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | GammaTransferEffect | [inline]
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IExposureEffect Member List

This is the complete list of members for IExposureEffect, including all inherited members.
Exposure([out, retval] float *value) | IExposureEffect
Exposure([in] float value) | IExposureEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | IExposureEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | IExposureEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PersonDataSource Member List

This is the complete list of members for PersonDataSource, including all inherited members.
_data | PersonDataSource | [private]
Add(object value) | CustomItemsSourceView | [inline]
Clear() | CustomItemsSourceView | [inline]
CollectionChanged | CustomItemsSourceView |
Contains(object value) | CustomItemsSourceView | [inline]
CopyTo(Array array, int index) | CustomItemsSourceView | [inline]
Count | CustomItemsSourceView |
GetAtCore(int index) | PersonDataSource | [inline, protected, virtual]
GetEnumerator() | CustomItemsSourceView | [inline]
GetSizeCore() | PersonDataSource | [inline, protected, virtual]
IndexFromKey(string id) | CustomItemsSourceViewWithUniqueIdMapping | [inline]
IndexFromKeyCore(string id) | CustomItemsSourceViewWithUniqueIdMapping | [inline, protected, virtual]
IndexOf(object value) | CustomItemsSourceView | [inline]
Insert(int index, object value) | CustomItemsSourceView | [inline]
IsFixedSize | CustomItemsSourceView |
IsReadOnly | CustomItemsSourceView |
IsSynchronized | CustomItemsSourceView |
KeyFromIndex(int index) | CustomItemsSourceViewWithUniqueIdMapping | [inline]
KeyFromIndexCore(int index) | PersonDataSource | [inline, protected, virtual]
OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) | PersonDataSource | [inline, private]
OnItemsSourceChanged(NotifyCollectionChangedEventArgs args) | CustomItemsSourceView | [inline, protected]
PersonDataSource(ObservableCollection< Person > data) | PersonDataSource | [inline]
Remove(object value) | CustomItemsSourceView | [inline]
RemoveAt(int index) | CustomItemsSourceView | [inline]
SyncRoot | CustomItemsSourceView |
this | CustomItemsSourceView |
Generated on Sun Dec 1 2024 20:54:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

WebView2BasicPage Member List

This is the complete list of members for WebView2BasicPage, including all inherited members.
_areWebviewElementsCleanedUp | WebView2BasicPage | [private]
_customUserDataFolder | WebView2BasicPage | [private]
_helpers | WebView2BasicPage | [private]
_isApplicationLanguageOverrideSet | WebView2BasicPage | [private]
_isRedirected | WebView2BasicPage | [private]
_isUserInitiated | WebView2BasicPage | [private]
_originalHeight | WebView2BasicPage | [private]
_originalWidth | WebView2BasicPage | [private]
AddWebViewControl(string webviewName) | WebView2BasicPage | [inline, private]
AddWebViewEventHandlers(WebView2 webview) | WebView2BasicPage | [inline, private]
AppendMessage(string message) | WebView2BasicPage | [inline, private]
AreEqualIgnoringSpace(string string1, string string2) | WebView2BasicPage | [inline, private, static]
CleanupCurrentTest(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
CleanupWebViewElements() | WebView2BasicPage | [inline, private]
ClearStatus() | WebView2BasicPage | [inline]
CompleteCurrentTest(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
DraggableText_DragStarting(UIElement sender, DragStartingEventArgs args) | WebView2BasicPage | [inline, private]
GetDocumentTitle(WebView2 wv2) | WebView2BasicPage | [inline]
HandleWebError(CoreWebView2NavigationCompletedEventArgs args) | WebView2BasicPage | [inline, private]
IsFocusMessage(string webMessageAsString) | WebView2BasicPage | [inline, private, static]
IsTransientTapTest(TestList selectedTest) | WebView2BasicPage | [inline, private, static]
IsTransientWebMessage(string webMessageAsString) | WebView2BasicPage | [inline, private]
IsVisiblityTest(TestList selectedTest) | WebView2BasicPage | [inline, private, static]
IsW2CenterPointMessage(string webMessageAsString) | WebView2BasicPage | [inline, private, static]
LogFailure(ResultsLogger logger, string testName, string message) | WebView2BasicPage | [inline, private]
LogFailure_Exception(ResultsLogger logger, string testName, Exception e) | WebView2BasicPage | [inline, private]
LogHeader(string testName, string header) | WebView2BasicPage | [inline, private]
LogSuccess(string testName) | WebView2BasicPage | [inline, private]
MoveWebViewControl(string webviewName, WebView2 webView2) | WebView2BasicPage | [inline, private]
NavigateToVideo(WebView2 webview) | WebView2BasicPage | [inline, static]
OnAddWebviewButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnCoreProcessFailed(WebView2 sender, CoreWebView2ProcessFailedEventArgs args) | WebView2BasicPage | [inline, private]
OnCoreWebView2Initialized(WebView2 sender, CoreWebView2InitializedEventArgs args) | WebView2BasicPage | [inline, private]
OnEnsureCWV2ButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnGetDocumentTitleButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnGoBackButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnGoForwardButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnNavigateToStringButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnNavigatingFrom(NavigatingCancelEventArgs e) | WebView2BasicPage | [inline, protected]
OnNavigationCompleted(WebView2 sender, CoreWebView2NavigationCompletedEventArgs args) | WebView2BasicPage | [inline, private]
OnNavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args) | WebView2BasicPage | [inline, private]
OnResizeWebViewVisualButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnSetSourceButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnToggleWebViewVisibilityButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnVideoButtonClicked(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
OnWebMessageReceived(WebView2 sender, CoreWebView2WebMessageReceivedEventArgs args) | WebView2BasicPage | [inline, private]
RemoveExistingWebViewControl(WebView2 webview) | WebView2BasicPage | [inline, private]
RemoveWebViewControls(bool keepDefault=false) | WebView2BasicPage | [inline, private]
RemoveWebViewEventHandlers(WebView2 webview) | WebView2BasicPage | [inline, private]
ResetTransformWebView(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
ResetWebViewVisibility(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
ResetWebViewVisual(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
TestInfoDictionary | WebView2BasicPage | [private]
TestList enum name | WebView2BasicPage | [private]
TestNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | WebView2BasicPage | [inline, private]
TestPageNames | WebView2BasicPage | [private]
TransformWebView(object sender, RoutedEventArgs args) | WebView2BasicPage | [inline]
UpdateSourceOnEnter(object sender, KeyRoutedEventArgs args) | WebView2BasicPage | [inline, private]
VerifyWebMessageBasedTest(string stringResult, string jsonResult) | WebView2BasicPage | [inline]
WebView2BasicPage() | WebView2BasicPage | [inline]
Generated on Sun Dec 1 2024 20:54:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/StackLayout.properties.cpp Source File

  • Generated

StackLayout.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "StackLayout.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(StackLayout)
00012 }
00013
00014 #include "StackLayout.g.cpp"
00015
00016 GlobalDependencyProperty StackLayoutProperties::s_IsVirtualizationEnabledProperty{ nullptr };
00017 GlobalDependencyProperty StackLayoutProperties::s_OrientationProperty{ nullptr };
00018 GlobalDependencyProperty StackLayoutProperties::s_SpacingProperty{ nullptr };
00019
00020 StackLayoutProperties::StackLayoutProperties()
00021 {
00022     EnsureProperties();
00023 }
00024
00025 void StackLayoutProperties::EnsureProperties()
00026 {
00027     if (!s_IsVirtualizationEnabledProperty)
00028     {
00029         s_IsVirtualizationEnabledProperty =
00030             InitializeDependencyProperty(
00031                 L"IsVirtualizationEnabled",
00032                 winrt::name_of<bool>(),
00033                 winrt::name_of<winrt::StackLayout>(),
00034                 false /* isAttached */,
00035                 ValueHelper<bool>::BoxValueIfNecessary(true),
00036                 winrt::PropertyChangedCallback(&OnIsVirtualizationEnabledPropertyChanged));
00037     }
00038     if (!s_OrientationProperty)
00039     {
00040         s_OrientationProperty =
00041             InitializeDependencyProperty(
00042                 L"Orientation",
00043                 winrt::name_of<winrt::Orientation>(),
00044                 winrt::name_of<winrt::StackLayout>(),
00045                 false /* isAttached */,
00046                 ValueHelper<winrt::Orientation>::BoxValueIfNecessary(winrt::Orientation::Vertical),
00047                 winrt::PropertyChangedCallback(&OnOrientationPropertyChanged));
00048     }
00049     if (!s_SpacingProperty)
00050     {
00051         s_SpacingProperty =
00052             InitializeDependencyProperty(
00053                 L"Spacing",
00054                 winrt::name_of<double>(),
00055                 winrt::name_of<winrt::StackLayout>(),
00056                 false /* isAttached */,
00057                 ValueHelper<double>::BoxValueIfNecessary(0.0),
00058                 winrt::PropertyChangedCallback(&OnSpacingPropertyChanged));
00059     }
00060 }
00061
00062 void StackLayoutProperties::ClearProperties()
00063 {
00064     s_IsVirtualizationEnabledProperty = nullptr;
00065     s_OrientationProperty = nullptr;
00066     s_SpacingProperty = nullptr;
00067 }
00068
00069 void StackLayoutProperties::OnIsVirtualizationEnabledPropertyChanged(
00070     winrt::DependencyObject const& sender,
00071     winrt::DependencyPropertyChangedEventArgs const& args)
00072 {
00073     auto owner = sender.as<winrt::StackLayout>();
00074     winrt::get_self<StackLayout>(owner)->OnPropertyChanged(args);
00075 }
00076
00077 void StackLayoutProperties::OnOrientationPropertyChanged(
00078     winrt::DependencyObject const& sender,
00079     winrt::DependencyPropertyChangedEventArgs const& args)
00080 {
00081     auto owner = sender.as<winrt::StackLayout>();
00082     winrt::get_self<StackLayout>(owner)->OnPropertyChanged(args);
00083 }
00084
00085 void StackLayoutProperties::OnSpacingPropertyChanged(
00086     winrt::DependencyObject const& sender,
00087     winrt::DependencyPropertyChangedEventArgs const& args)
00088 {
00089     auto owner = sender.as<winrt::StackLayout>();
00090     winrt::get_self<StackLayout>(owner)->OnPropertyChanged(args);
00091 }
00092
00093 void StackLayoutProperties::IsVirtualizationEnabled(bool value)
00094 {
00095     [[gsl::suppress(con)]]
00096     {
00097     static_cast<StackLayout*>(this)->SetValue(s_IsVirtualizationEnabledProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00098     }
00099 }
00100
00101 bool StackLayoutProperties::IsVirtualizationEnabled()
00102 {
00103     return ValueHelper<bool>::CastOrUnbox(static_cast<StackLayout*>(this)->GetValue(s_IsVirtualizationEnabledProperty));
00104 }
00105
00106 void StackLayoutProperties::Orientation(winrt::Orientation const& value)
00107 {
00108     [[gsl::suppress(con)]]
00109     {
00110     static_cast<StackLayout*>(this)->SetValue(s_OrientationProperty, ValueHelper<winrt::Orientation>::BoxValueIfNecessary(value));
00111     }
00112 }
00113
00114 winrt::Orientation StackLayoutProperties::Orientation()
00115 {
00116     return ValueHelper<winrt::Orientation>::CastOrUnbox(static_cast<StackLayout*>(this)->GetValue(s_OrientationProperty));
00117 }
00118
00119 void StackLayoutProperties::Spacing(double value)
00120 {
00121     [[gsl::suppress(con)]]
00122     {
00123     static_cast<StackLayout*>(this)->SetValue(s_SpacingProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00124     }
00125 }
00126
00127 double StackLayoutProperties::Spacing()
00128 {
00129     return ValueHelper<double>::CastOrUnbox(static_cast<StackLayout*>(this)->GetValue(s_SpacingProperty));
00130 }
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/TestUI/CustomResources/CustomNavigationViewItem.xaml.cs Source File

  • NavigationView
  • TestUI
  • CustomResources

CustomNavigationViewItem.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007
00008 namespace MUXControlsTestApp
00009 {
00010     public sealed partial class CustomNavigationViewItem : NavigationViewItem
00011     {
00012         public string Text { get => TextBlock_CustomNavigationViewItem.Text; set => TextBlock_CustomNavigationViewItem.Text = value; }
00013         public CustomNavigationViewItem()
00014         {
00015             this.InitializeComponent();
00016         }
00017     }
00018 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SelectorBar/SelectorBarTestHooks.cpp Source File

  • SelectorBar

SelectorBarTestHooks.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SelectorBarTestHooksFactory.h"
00007
00008 winrt::ItemsView SelectorBarTestHooks::GetItemsViewPart(const winrt::SelectorBar& selectorBar)
00009 {
00010     if (selectorBar)
00011     {
00012         return winrt::get_self<SelectorBar>(selectorBar)->GetItemsViewPart();
00013     }
00014
00015     return nullptr;
00016 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SplitButton/SplitButton.idl Source File

  • SplitButton

SplitButton.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004
00005 [MUX_PUBLIC]
00006 [webhosthidden]
00007 [default_interface]
00008 runtimeclass SplitButtonClickEventArgs
00009 {
00010 }
00011
00012 [MUX_PUBLIC]
00013 [webhosthidden]
00014 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00015 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00016 unsealed runtimeclass SplitButton : Microsoft.UI.Xaml.Controls.ContentControl
00017 {
00018     SplitButton();
00019
00020     Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase Flyout { get; set; };
00021     Microsoft.UI.Xaml.Input.ICommand Command { get; set; };
00022     Object CommandParameter { get; set; };
00023
00024     event Windows.Foundation.TypedEventHandler<SplitButton, SplitButtonClickEventArgs> Click;
00025
00026     static Microsoft.UI.Xaml.DependencyProperty FlyoutProperty { get; };
00027     static Microsoft.UI.Xaml.DependencyProperty CommandProperty { get; };
00028     static Microsoft.UI.Xaml.DependencyProperty CommandParameterProperty { get; };
00029 }
00030
00031 [MUX_PUBLIC]
00032 [webhosthidden]
00033 [marshaling_behavior(agile)]
00034 [default_interface]
00035 runtimeclass ToggleSplitButtonIsCheckedChangedEventArgs
00036 {
00037 }
00038
00039 [MUX_PUBLIC]
00040 [webhosthidden]
00041 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00042 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00043 unsealed runtimeclass ToggleSplitButton : SplitButton
00044 {
00045     ToggleSplitButton();
00046
00047     Boolean IsChecked{ get; set; };
00048
00049     event Windows.Foundation.TypedEventHandler<ToggleSplitButton, ToggleSplitButtonIsCheckedChangedEventArgs> IsCheckedChanged;
00050
00051     static Microsoft.UI.Xaml.DependencyProperty IsCheckedProperty{ get; };
00052 }
00053
00054 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Microsoft.UI.Xaml.Design/Properties/AssemblyInfo.cs Source File

  • Microsoft.UI.Xaml.Design
  • Properties

AssemblyInfo.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Design;
00005 using Microsoft.Windows.Design.Metadata;
00006 using System.Reflection;
00007 using System.Runtime.CompilerServices;
00008 using System.Runtime.InteropServices;
00009
00010 // General Information about an assembly is controlled through the following
00011 // set of attributes. Change these attribute values to modify the information
00012 // associated with an assembly.
00013 [assembly: AssemblyTitle("Microsoft.UI.Xaml.Design")]
00014 [assembly: AssemblyDescription("")]
00015 [assembly: AssemblyConfiguration("")]
00016 [assembly: AssemblyCompany("")]
00017 [assembly: AssemblyProduct("Microsoft.UI.Xaml.Design")]
00018 [assembly: AssemblyCopyright("Copyright ©  2018")]
00019 [assembly: AssemblyTrademark("")]
00020 [assembly: AssemblyCulture("")]
00021 [assembly: ProvideMetadata(typeof(RegisterMetadata))]
00022
00023 // Setting ComVisible to false makes the types in this assembly not visible
00024 // to COM components.  If you need to access a type in this assembly from
00025 // COM, set the ComVisible attribute to true on that type.
00026 [assembly: ComVisible(false)]
00027
00028 // The following GUID is for the ID of the typelib if this project is exposed to COM
00029 [assembly: Guid("1ceec8e3-419a-4304-841c-08a334b9e4ff")]
00030
00031 // Version information for an assembly consists of the following four values:
00032 //
00033 //      Major Version
00034 //      Minor Version
00035 //      Build Number
00036 //      Revision
00037 //
00038 // You can specify all the values or you can default the Build and Revision Numbers
00039 // by using the '*' as shown below:
00040 // [assembly: AssemblyVersion("1.0.*")]
00041 [assembly: AssemblyVersion("1.0.0.0")]
00042 [assembly: AssemblyFileVersion("1.0.0.0")]
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommandBarFlyout/TestUI/ExtraCommandBarFlyoutPage.xaml.cs Source File

  • CommandBarFlyout
  • TestUI

ExtraCommandBarFlyoutPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.IO;
00007 using System.Linq;
00008 using System.Runtime.InteropServices.WindowsRuntime;
00009 using Windows.ApplicationModel.DataTransfer;
00010 using Windows.Foundation;
00011 using Windows.Foundation.Collections;
00012 using Windows.Foundation.Metadata;
00013 using Microsoft.UI.Xaml;
00014 using Microsoft.UI.Xaml.Controls;
00015 using Microsoft.UI.Xaml.Controls.Primitives;
00016 using Microsoft.UI.Xaml.Data;
00017 using Microsoft.UI.Xaml.Input;
00018 using Microsoft.UI.Xaml.Media;
00019 using Microsoft.UI.Xaml.Navigation;
00020
00021 namespace MUXControlsTestApp
00022 {
00023     public sealed partial class ExtraCommandBarFlyoutPage : TestPage
00024     {
00025         private int customButtonsFlyoutOpenCount = 0;
00026
00027         public ExtraCommandBarFlyoutPage()
00028         {
00029             this.InitializeComponent();
00030
00031             TextCommandBarContextFlyout.Placement = FlyoutPlacementMode.BottomEdgeAlignedLeft;
00032             TextCommandBarSelectionFlyout.Placement = FlyoutPlacementMode.TopEdgeAlignedLeft;
00033             TextBox1.ContextFlyout = TextCommandBarContextFlyout;
00034             RichTextBlock1.ContextFlyout = TextCommandBarContextFlyout;
00035             TextBox1.SelectionFlyout = TextCommandBarSelectionFlyout;
00036             RichTextBlock1.SelectionFlyout = TextCommandBarSelectionFlyout;
00037         }
00038
00039         private void OnClearClipboardContentsClicked(object sender, object args)
00040         {
00041             Clipboard.Clear();
00042         }
00043
00044         private void OnCountPopupsClicked(object sender, object args)
00045         {
00046             PopupCountTextBox.Text = VisualTreeHelper.GetOpenPopupsForXamlRoot(XamlRoot).Count.ToString();
00047             CustomButtonsOpenCount.Text = customButtonsFlyoutOpenCount.ToString();
00048         }
00049
00050         private void tbloaded(object sender, RoutedEventArgs e)
00051         {
00052             tb.ContextFlyout = new Microsoft.UI.Xaml.Controls.TextCommandBarFlyout();
00053             tb.ContextFlyout.Opening += ContextFlyout_Opening;
00054             tb.ContextFlyout.Closed += ContextFlyout_Closed;
00055         }
00056
00057         private void tbunloaded(object sender, RoutedEventArgs e)
00058         {
00059             tb.ContextFlyout.Opening -= ContextFlyout_Opening;
00060         }
00061
00062         private void ContextFlyout_Opening(object sender, object e)
00063         {
00064             customButtonsFlyoutOpenCount++;
00065             var flyout = (sender as Microsoft.UI.Xaml.Controls.TextCommandBarFlyout);
00066             flyout.PrimaryCommands.Add(new AppBarButton() {
00067                 Content = new TextBlock() { Text = "Test" }
00068             });
00069         }
00070
00071         private void ContextFlyout_Closed(object sender, object e)
00072         {
00073             customButtonsFlyoutOpenCount--;
00074         }
00075     }
00076 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ParallaxView/TestUI/SimpleRectanglePage.xaml.cs Source File

  • ParallaxView
  • TestUI

SimpleRectanglePage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Windows.Foundation;
00005 using Microsoft.UI.Composition;
00006 using Windows.UI;
00007 using Microsoft.UI.Xaml;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Xaml.Controls.Primitives;
00010 using Microsoft.UI.Xaml.Hosting;
00011 using Microsoft.UI.Xaml.Media;
00012 using Microsoft.UI.Xaml.Shapes;
00013 using Common;
00014
00015 namespace MUXControlsTestApp
00016 {
00017     public sealed partial class SimpleRectanglePage : TestPage
00018     {
00019         public SimpleRectanglePage()
00020         {
00021             this.InitializeComponent();
00022             this.AnimatedValuesSpy = null;
00023             this.HorizontalOffsetAnimation1 = null;
00024             this.HorizontalOffsetAnimation2 = null;
00025             this.HasDirectManipulation = false;
00026             this.UIThreadTicksForValuesSpy = 0;
00027             this.IsRenderingHooked = false;
00028
00029             this.sv.ViewChanged += ScrollViewer_ViewChanged;
00030             this.sv.DirectManipulationStarted += ScrollViewer_DirectManipulationStarted;
00031             this.sv.DirectManipulationCompleted += ScrollViewer_DirectManipulationCompleted;
00032
00033             this.VerticalOffsetAnimation1 = null;
00034             this.VerticalOffsetAnimation2 = null;
00035             SetupScrollPresenter();
00036
00037             SetupAnimatedValuesSpy();
00038             TickForValuesSpy();
00039         }
00040
00041         private CompositionPropertySet AnimatedValuesSpy
00042         {
00043             get;
00044             set;
00045         }
00046
00047         private ExpressionAnimation HorizontalOffsetAnimation1
00048         {
00049             get;
00050             set;
00051         }
00052
00053         private ExpressionAnimation HorizontalOffsetAnimation2
00054         {
00055             get;
00056             set;
00057         }
00058
00059         private ExpressionAnimation VerticalOffsetAnimation1
00060         {
00061             get;
00062             set;
00063         }
00064
00065         private ExpressionAnimation VerticalOffsetAnimation2
00066         {
00067             get;
00068             set;
00069         }
00070
00071         private bool HasDirectManipulation
00072         {
00073             get;
00074             set;
00075         }
00076
00077         private bool IsRenderingHooked
00078         {
00079             get;
00080             set;
00081         }
00082
00083         private uint UIThreadTicksForValuesSpy
00084         {
00085             get;
00086             set;
00087         }
00088
00089         private void SetupAnimatedValuesSpy()
00090         {
00091             string visualHorizontalTargetedPropertyName = "visual.Translation.X";
00092
00093             if (this.parallaxView1 != null && this.parallaxView1.Child is UIElement)
00094             {
00095                 UIElement ppChild = this.parallaxView1.Child as UIElement;
00096                 Visual visualPPChild = ElementCompositionPreview.GetElementVisual(ppChild);
00097                 Compositor compositor = visualPPChild.Compositor;
00098
00099                 if (this.AnimatedValuesSpy == null)
00100                 {
00101                     this.AnimatedValuesSpy = compositor.CreatePropertySet();
00102                 }
00103
00104                 this.AnimatedValuesSpy.InsertScalar("HorizontalOffset1", 0.0f);
00105
00106                 this.HorizontalOffsetAnimation1 = compositor.CreateExpressionAnimation(visualHorizontalTargetedPropertyName);
00107                 this.HorizontalOffsetAnimation1.SetReferenceParameter("visual", visualPPChild);
00108             }
00109
00110             if (this.parallaxView2 != null && this.parallaxView2.Child is UIElement)
00111             {
00112                 UIElement ppChild = this.parallaxView2.Child as UIElement;
00113                 Visual visualPPChild = ElementCompositionPreview.GetElementVisual(ppChild);
00114                 Compositor compositor = visualPPChild.Compositor;
00115
00116                 if (this.AnimatedValuesSpy == null)
00117                 {
00118                     this.AnimatedValuesSpy = compositor.CreatePropertySet();
00119                 }
00120
00121                 this.AnimatedValuesSpy.InsertScalar("HorizontalOffset2", 0.0f);
00122
00123                 this.HorizontalOffsetAnimation2 = compositor.CreateExpressionAnimation(visualHorizontalTargetedPropertyName);
00124                 this.HorizontalOffsetAnimation2.SetReferenceParameter("visual", visualPPChild);
00125             }
00126
00127             string visualVerticalTargetedPropertyName = "visual.Translation.Y";
00128
00129             if (this.parallaxView3 != null && this.parallaxView3.Child is UIElement)
00130             {
00131                 UIElement ppChild = this.parallaxView3.Child as UIElement;
00132                 Visual visualPPChild = ElementCompositionPreview.GetElementVisual(ppChild);
00133                 Compositor compositor = visualPPChild.Compositor;
00134
00135                 if (this.AnimatedValuesSpy == null)
00136                 {
00137                     this.AnimatedValuesSpy = compositor.CreatePropertySet();
00138                 }
00139
00140                 this.AnimatedValuesSpy.InsertScalar("VerticalOffset1", 0.0f);
00141
00142                 this.VerticalOffsetAnimation1 = compositor.CreateExpressionAnimation(visualVerticalTargetedPropertyName);
00143                 this.VerticalOffsetAnimation1.SetReferenceParameter("visual", visualPPChild);
00144             }
00145
00146             if (this.parallaxView4 != null && this.parallaxView4.Child is UIElement)
00147             {
00148                 UIElement ppChild = this.parallaxView4.Child as UIElement;
00149                 Visual visualPPChild = ElementCompositionPreview.GetElementVisual(ppChild);
00150                 Compositor compositor = visualPPChild.Compositor;
00151
00152                 if (this.AnimatedValuesSpy == null)
00153                 {
00154                     this.AnimatedValuesSpy = compositor.CreatePropertySet();
00155                 }
00156
00157                 this.AnimatedValuesSpy.InsertScalar("VerticalOffset2", 0.0f);
00158
00159                 this.VerticalOffsetAnimation2 = compositor.CreateExpressionAnimation(visualVerticalTargetedPropertyName);
00160                 this.VerticalOffsetAnimation2.SetReferenceParameter("visual", visualPPChild);
00161             }
00162
00163             CheckSpyingTicksRequirement();
00164         }
00165
00166         private void StartAnimatedValuesSpy()
00167         {
00168             if (this.AnimatedValuesSpy != null)
00169             {
00170                 this.AnimatedValuesSpy.StartAnimation("HorizontalOffset1", this.HorizontalOffsetAnimation1);
00171                 this.AnimatedValuesSpy.StartAnimation("HorizontalOffset2", this.HorizontalOffsetAnimation2);
00172                 this.AnimatedValuesSpy.StartAnimation("VerticalOffset1", this.VerticalOffsetAnimation1);
00173                 this.AnimatedValuesSpy.StartAnimation("VerticalOffset2", this.VerticalOffsetAnimation2);
00174             }
00175         }
00176
00177         private void StopAnimatedValuesSpy()
00178         {
00179             if (this.AnimatedValuesSpy != null)
00180             {
00181                 this.AnimatedValuesSpy.StopAnimation("HorizontalOffset1");
00182                 this.AnimatedValuesSpy.StopAnimation("HorizontalOffset2");
00183                 this.AnimatedValuesSpy.StopAnimation("VerticalOffset1");
00184                 this.AnimatedValuesSpy.StopAnimation("VerticalOffset2");
00185             }
00186         }
00187
00188         private void CheckSpyingTicksRequirement()
00189         {
00190             if (this.sv != null &&
00191                 this.AnimatedValuesSpy != null &&
00192                 (this.HasDirectManipulation || this.UIThreadTicksForValuesSpy > 0) &&
00193                 (this.sv.HorizontalOffset == 0 || this.sv.HorizontalOffset == this.sv.ScrollableWidth))
00194             {
00195                 if (!this.IsRenderingHooked)
00196                 {
00197                     this.IsRenderingHooked = true;
00198                     Microsoft.UI.Xaml.Media.CompositionTarget.Rendering += CompositionTarget_Rendering;
00199                 }
00200             }
00201             else
00202             {
00203                 if (this.IsRenderingHooked)
00204                 {
00205                     Microsoft.UI.Xaml.Media.CompositionTarget.Rendering -= CompositionTarget_Rendering;
00206                     this.IsRenderingHooked = false;
00207                 }
00208             }
00209         }
00210
00211         private void CompositionTarget_Rendering(object sender, object e)
00212         {
00213             if (this.UIThreadTicksForValuesSpy > 0)
00214             {
00215                 this.UIThreadTicksForValuesSpy--;
00216             }
00217             CheckSpyingTicksRequirement();
00218             SpyAnimatedValues();
00219         }
00220
00221         private void TickForValuesSpy()
00222         {
00223             this.UIThreadTicksForValuesSpy = 8;
00224             CheckSpyingTicksRequirement();
00225         }
00226
00227         private void SpyAnimatedValues()
00228         {
00229             if (this.AnimatedValuesSpy != null)
00230             {
00231                 StopAnimatedValuesSpy();
00232
00233                 float offset;
00234                 CompositionGetValueStatus status;
00235
00236                 status = this.AnimatedValuesSpy.TryGetScalar("HorizontalOffset1", out offset);
00237                 if (CompositionGetValueStatus.Succeeded == status)
00238                 {
00239                     this.tbHorizontalOutput1.Text = offset.ToString();
00240                 }
00241                 else
00242                 {
00243                     this.tbHorizontalOutput1.Text = "status=" + status.ToString();
00244                 }
00245                 System.Diagnostics.Debug.WriteLine("Spied value 1: " + this.tbHorizontalOutput1.Text);
00246
00247                 status = this.AnimatedValuesSpy.TryGetScalar("HorizontalOffset2", out offset);
00248                 if (CompositionGetValueStatus.Succeeded == status)
00249                 {
00250                     this.tbHorizontalOutput2.Text = offset.ToString();
00251                 }
00252                 else
00253                 {
00254                     this.tbHorizontalOutput2.Text = "status=" + status.ToString();
00255                 }
00256                 System.Diagnostics.Debug.WriteLine("Spied value 2: " + this.tbHorizontalOutput2.Text);
00257
00258                 status = this.AnimatedValuesSpy.TryGetScalar("VerticalOffset1", out offset);
00259                 if (CompositionGetValueStatus.Succeeded == status)
00260                 {
00261                     this.tbVerticalOutput1.Text = offset.ToString();
00262                 }
00263                 else
00264                 {
00265                     this.tbVerticalOutput1.Text = "status=" + status.ToString();
00266                 }
00267                 System.Diagnostics.Debug.WriteLine("Spied value 3: " + this.tbVerticalOutput1.Text);
00268
00269                 status = this.AnimatedValuesSpy.TryGetScalar("VerticalOffset2", out offset);
00270                 if (CompositionGetValueStatus.Succeeded == status)
00271                 {
00272                     this.tbVerticalOutput2.Text = offset.ToString();
00273                 }
00274                 else
00275                 {
00276                     this.tbVerticalOutput2.Text = "status=" + status.ToString();
00277                 }
00278                 System.Diagnostics.Debug.WriteLine("Spied value 4: " + this.tbVerticalOutput2.Text);
00279
00280                 StartAnimatedValuesSpy();
00281             }
00282         }
00283
00284         private void ScrollViewer_DirectManipulationCompleted(object sender, object e)
00285         {
00286             TickForValuesSpy();
00287             this.HasDirectManipulation = false;
00288         }
00289
00290         private void ScrollViewer_DirectManipulationStarted(object sender, object e)
00291         {
00292             this.HasDirectManipulation = true;
00293             CheckSpyingTicksRequirement();
00294         }
00295
00296         private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
00297         {
00298             CheckSpyingTicksRequirement();
00299             SpyAnimatedValues();
00300         }
00301
00302         private void SetupScrollPresenter()
00303         {
00304             LinearGradientBrush threeColorsLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
00305
00306             GradientStop blueGS = new GradientStop() { Color = Microsoft.UI.Colors.Blue, Offset = 0.0 };
00307             threeColorsLGB.GradientStops.Add(blueGS);
00308
00309             GradientStop yellowGS = new GradientStop() { Color = Microsoft.UI.Colors.Yellow, Offset = 0.5 };
00310             threeColorsLGB.GradientStops.Add(yellowGS);
00311
00312             GradientStop redGS = new GradientStop() { Color = Microsoft.UI.Colors.Red, Offset = 1.0 };
00313             threeColorsLGB.GradientStops.Add(redGS);
00314
00315             Rectangle rectSC = new Rectangle();
00316             rectSC.Width = 1000;
00317             rectSC.Height = 900;
00318             rectSC.Fill = threeColorsLGB;
00319
00320             ScrollPresenter s = new ScrollPresenter();
00321             s.Name = "s";
00322             s.Width = 500;
00323             s.Height = 300;
00324             s.Background = new SolidColorBrush(Microsoft.UI.Colors.LightBlue);
00325             s.Margin = new Thickness(4);
00326             s.HorizontalScrollMode = ScrollingScrollMode.Enabled;
00327             s.VerticalScrollMode = ScrollingScrollMode.Enabled;
00328             s.Content = rectSC;
00329             s.ViewChanged += ScrollPresenter_ViewChanged;
00330
00331             sp.Children.Insert(0, s);
00332
00333             parallaxView3.Source = s;
00334             parallaxView4.Source = s;
00335         }
00336
00337         private void ScrollPresenter_ViewChanged(ScrollPresenter sender, object args)
00338         {
00339             SpyAnimatedValues();
00340         }
00341     }
00342 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedVisuals/AnimatedAcceptVisualSource.h Source File

  • AnimatedIcon
  • AnimatedVisuals

AnimatedAcceptVisualSource.h

Go to the documentation of this file.
00001 ﻿#pragma once
00002 //------------------------------------------------------------------------------
00003 // <auto-generated>
00004 //     This code was generated by a tool.
00005 //
00006 //       LottieGen version:
00007 //           7.0.2+gebbbdfc697
00008 //
00009 //       Command:
00010 //           LottieGen -Language Cppwinrt -WinUIVersion 2.4 -InputFile AnimatedAcceptVisualSource.json
00011 //
00012 //       Input file:
00013 //           AnimatedAcceptVisualSource.json (27378 bytes created 11:16-08:00 Mar 5 2021)
00014 //
00015 //       LottieGen source:
00016 //           http://aka.ms/Lottie
00017 //
00018 //     Changes to this file may cause incorrect behavior and will be lost if
00019 //     the code is regenerated.
00020 // </auto-generated>
00021 //------------------------------------------------------------------------------
00022 #include "common.h"
00023 #include "AnimatedVisuals\AnimatedAcceptVisualSource.g.h"
00024
00025 // Name:        Controls_01_Checkmark
00026 // Frame rate:  60 fps
00027 // Frame count: 160
00028 // Duration:    2666.7 mS
00029 // ________________________________________________________________________________________________________________
00030 // |               Marker                |               Constant                | Frame |   mS   |   Progress    |
00031 // |_____________________________________|_______________________________________|_______|________|_______________|
00032 // | NormalOnToNormalOff_Start           | M_NormalOnToNormalOff_Start           |     0 |    0.0 | 0.0F          |
00033 // | NormalOnToNormalOff_End             | M_NormalOnToNormalOff_End             |     4 |   66.7 | 0.0253125001F |
00034 // | NormalOnToPointerOverOn_Start       | M_NormalOnToPointerOverOn_Start       |     5 |   83.3 | 0.0315624997F |
00035 // | NormalOnToPointerOverOn_End         | M_NormalOnToPointerOverOn_End         |     9 |  150.0 | 0.0565624982F |
00036 // | NormalOnToPressedOn_Start           | M_NormalOnToPressedOn_Start           |    10 |  166.7 | 0.0628124997F |
00037 // | NormalOnToPressedOn_End             | M_NormalOnToPressedOn_End             |    14 |  233.3 | 0.0878124982F |
00038 // | NormalOffToNormalOn_Start           | M_NormalOffToNormalOn_Start           |    15 |  250.0 | 0.0940624997F |
00039 // | NormalOffToNormalOn_End             | M_NormalOffToNormalOn_End             |    34 |  566.7 | 0.212812498F  |
00040 // | NormalOffToPointerOverOff_Start     | M_NormalOffToPointerOverOff_Start     |    35 |  583.3 | 0.219062507F  |
00041 // | NormalOffToPointerOverOff_End       | M_NormalOffToPointerOverOff_End       |    39 |  650.0 | 0.244062498F  |
00042 // | NormalOffToPressedOff_Start         | M_NormalOffToPressedOff_Start         |    40 |  666.7 | 0.250312507F  |
00043 // | NormalOffToPressedOff_End           | M_NormalOffToPressedOff_End           |    44 |  733.3 | 0.275312513F  |
00044 // | PointerOverOnToPointerOverOff_Start | M_PointerOverOnToPointerOverOff_Start |    45 |  750.0 | 0.281562507F  |
00045 // | PointerOverOnToPointerOverOff_End   | M_PointerOverOnToPointerOverOff_End   |    49 |  816.7 | 0.306562513F  |
00046 // | PointerOverOnToNormalOn_Start       | M_PointerOverOnToNormalOn_Start       |    50 |  833.3 | 0.312812507F  |
00047 // | PointerOverOnToNormalOn_End         | M_PointerOverOnToNormalOn_End         |    54 |  900.0 | 0.337812513F  |
00048 // | PointerOverOnToPressedOn_Start      | M_PointerOverOnToPressedOn_Start      |    55 |  916.7 | 0.344062507F  |
00049 // | PointerOverOnToPressedOn_End        | M_PointerOverOnToPressedOn_End        |    59 |  983.3 | 0.369062513F  |
00050 // | PointerOverOffToPointerOverOn_Start | M_PointerOverOffToPointerOverOn_Start |    60 | 1000.0 | 0.375312507F  |
00051 // | PointerOverOffToPointerOverOn_End   | M_PointerOverOffToPointerOverOn_End   |    79 | 1316.7 | 0.494062513F  |
00052 // | PointerOverOffToNormalOff_Start     | M_PointerOverOffToNormalOff_Start     |    80 | 1333.3 | 0.500312507F  |
00053 // | PointerOverOffToNormalOff_End       | M_PointerOverOffToNormalOff_End       |    84 | 1400.0 | 0.525312483F  |
00054 // | PointerOverOffToPressedOff_Start    | M_PointerOverOffToPressedOff_Start    |    85 | 1416.7 | 0.531562507F  |
00055 // | PointerOverOffToPressedOff_End      | M_PointerOverOffToPressedOff_End      |    89 | 1483.3 | 0.556562483F  |
00056 // | PressedOnToPressedOff_Start         | M_PressedOnToPressedOff_Start         |    90 | 1500.0 | 0.562812507F  |
00057 // | PressedOnToPressedOff_End           | M_PressedOnToPressedOff_End           |    94 | 1566.7 | 0.587812483F  |
00058 // | PressedOnToPointerOverOff_Start     | M_PressedOnToPointerOverOff_Start     |    95 | 1583.3 | 0.594062507F  |
00059 // | PressedOnToPointerOverOff_End       | M_PressedOnToPointerOverOff_End       |    99 | 1650.0 | 0.619062483F  |
00060 // | PressedOnToNormalOff_Start          | M_PressedOnToNormalOff_Start          |   100 | 1666.7 | 0.625312507F  |
00061 // | PressedOnToNormalOff_End            | M_PressedOnToNormalOff_End            |   104 | 1733.3 | 0.650312483F  |
00062 // | PressedOffToPressedOn_Start         | M_PressedOffToPressedOn_Start         |   105 | 1750.0 | 0.656562507F  |
00063 // | PressedOffToPressedOn_End           | M_PressedOffToPressedOn_End           |   114 | 1900.0 | 0.712812483F  |
00064 // | PressedOffToPointerOverOn_Start     | M_PressedOffToPointerOverOn_Start     |   115 | 1916.7 | 0.719062507F  |
00065 // | PressedOffToPointerOverOn_End       | M_PressedOffToPointerOverOn_End       |   134 | 2233.3 | 0.837812483F  |
00066 // | PressedOffToNormalOn_Start          | M_PressedOffToNormalOn_Start          |   135 | 2250.0 | 0.844062507F  |
00067 // | PressedOffToNormalOn_End            | M_PressedOffToNormalOn_End            |   154 | 2566.7 | 0.962812483F  |
00068 // | NormalIndeterminate                 | M_NormalIndeterminate                 |   155 | 2583.3 | 0.969062507F  |
00069 // | PointerOverIndeterminate            | M_PointerOverIndeterminate            |   157 | 2616.7 | 0.981562495F  |
00070 // | PressedIndeterminate                | M_PressedIndeterminate                |   159 | 2650.0 | 0.994062483F  |
00071 // ----------------------------------------------------------------------------------------------------------------
00072 // _________________________________________________________
00073 // | Theme property |  Accessor  | Type  |  Default value  |
00074 // |________________|____________|_______|_________________|
00075 // | Foreground     | Foreground | Color | #FF000000 Black |
00076 // ---------------------------------------------------------
00077 class AnimatedAcceptVisualSource
00078     : public winrt::implementation::AnimatedAcceptVisualSourceT<AnimatedAcceptVisualSource>
00079 {
00080     winrt::Microsoft::UI::Composition::CompositionPropertySet _themeProperties{ nullptr };
00081     winrt::Windows::UI::Color _themeForeground{ 0xFF, 0x00, 0x00, 0x00 };
00082     winrt::Microsoft::UI::Composition::CompositionPropertySet EnsureThemeProperties(winrt::Microsoft::UI::Composition::Compositor compositor);
00083
00084     static winrt::Windows::Foundation::Numerics::float4 ColorAsVector4(winrt::Windows::UI::Color color);
00085 public:
00086     // Animation duration: 2.667 seconds.
00087     static constexpr int64_t c_durationTicks{ 26666666L };
00088
00089     // Marker: NormalOnToNormalOff_Start.
00090     static constexpr float M_NormalOnToNormalOff_Start{ 0.0F };
00091
00092     // Marker: NormalOnToNormalOff_End.
00093     static constexpr float M_NormalOnToNormalOff_End{ 0.0253125001F };
00094
00095     // Marker: NormalOnToPointerOverOn_Start.
00096     static constexpr float M_NormalOnToPointerOverOn_Start{ 0.0315624997F };
00097
00098     // Marker: NormalOnToPointerOverOn_End.
00099     static constexpr float M_NormalOnToPointerOverOn_End{ 0.0565624982F };
00100
00101     // Marker: NormalOnToPressedOn_Start.
00102     static constexpr float M_NormalOnToPressedOn_Start{ 0.0628124997F };
00103
00104     // Marker: NormalOnToPressedOn_End.
00105     static constexpr float M_NormalOnToPressedOn_End{ 0.0878124982F };
00106
00107     // Marker: NormalOffToNormalOn_Start.
00108     static constexpr float M_NormalOffToNormalOn_Start{ 0.0940624997F };
00109
00110     // Marker: NormalOffToNormalOn_End.
00111     static constexpr float M_NormalOffToNormalOn_End{ 0.212812498F };
00112
00113     // Marker: NormalOffToPointerOverOff_Start.
00114     static constexpr float M_NormalOffToPointerOverOff_Start{ 0.219062507F };
00115
00116     // Marker: NormalOffToPointerOverOff_End.
00117     static constexpr float M_NormalOffToPointerOverOff_End{ 0.244062498F };
00118
00119     // Marker: NormalOffToPressedOff_Start.
00120     static constexpr float M_NormalOffToPressedOff_Start{ 0.250312507F };
00121
00122     // Marker: NormalOffToPressedOff_End.
00123     static constexpr float M_NormalOffToPressedOff_End{ 0.275312513F };
00124
00125     // Marker: PointerOverOnToPointerOverOff_Start.
00126     static constexpr float M_PointerOverOnToPointerOverOff_Start{ 0.281562507F };
00127
00128     // Marker: PointerOverOnToPointerOverOff_End.
00129     static constexpr float M_PointerOverOnToPointerOverOff_End{ 0.306562513F };
00130
00131     // Marker: PointerOverOnToNormalOn_Start.
00132     static constexpr float M_PointerOverOnToNormalOn_Start{ 0.312812507F };
00133
00134     // Marker: PointerOverOnToNormalOn_End.
00135     static constexpr float M_PointerOverOnToNormalOn_End{ 0.337812513F };
00136
00137     // Marker: PointerOverOnToPressedOn_Start.
00138     static constexpr float M_PointerOverOnToPressedOn_Start{ 0.344062507F };
00139
00140     // Marker: PointerOverOnToPressedOn_End.
00141     static constexpr float M_PointerOverOnToPressedOn_End{ 0.369062513F };
00142
00143     // Marker: PointerOverOffToPointerOverOn_Start.
00144     static constexpr float M_PointerOverOffToPointerOverOn_Start{ 0.375312507F };
00145
00146     // Marker: PointerOverOffToPointerOverOn_End.
00147     static constexpr float M_PointerOverOffToPointerOverOn_End{ 0.494062513F };
00148
00149     // Marker: PointerOverOffToNormalOff_Start.
00150     static constexpr float M_PointerOverOffToNormalOff_Start{ 0.500312507F };
00151
00152     // Marker: PointerOverOffToNormalOff_End.
00153     static constexpr float M_PointerOverOffToNormalOff_End{ 0.525312483F };
00154
00155     // Marker: PointerOverOffToPressedOff_Start.
00156     static constexpr float M_PointerOverOffToPressedOff_Start{ 0.531562507F };
00157
00158     // Marker: PointerOverOffToPressedOff_End.
00159     static constexpr float M_PointerOverOffToPressedOff_End{ 0.556562483F };
00160
00161     // Marker: PressedOnToPressedOff_Start.
00162     static constexpr float M_PressedOnToPressedOff_Start{ 0.562812507F };
00163
00164     // Marker: PressedOnToPressedOff_End.
00165     static constexpr float M_PressedOnToPressedOff_End{ 0.587812483F };
00166
00167     // Marker: PressedOnToPointerOverOff_Start.
00168     static constexpr float M_PressedOnToPointerOverOff_Start{ 0.594062507F };
00169
00170     // Marker: PressedOnToPointerOverOff_End.
00171     static constexpr float M_PressedOnToPointerOverOff_End{ 0.619062483F };
00172
00173     // Marker: PressedOnToNormalOff_Start.
00174     static constexpr float M_PressedOnToNormalOff_Start{ 0.625312507F };
00175
00176     // Marker: PressedOnToNormalOff_End.
00177     static constexpr float M_PressedOnToNormalOff_End{ 0.650312483F };
00178
00179     // Marker: PressedOffToPressedOn_Start.
00180     static constexpr float M_PressedOffToPressedOn_Start{ 0.656562507F };
00181
00182     // Marker: PressedOffToPressedOn_End.
00183     static constexpr float M_PressedOffToPressedOn_End{ 0.712812483F };
00184
00185     // Marker: PressedOffToPointerOverOn_Start.
00186     static constexpr float M_PressedOffToPointerOverOn_Start{ 0.719062507F };
00187
00188     // Marker: PressedOffToPointerOverOn_End.
00189     static constexpr float M_PressedOffToPointerOverOn_End{ 0.837812483F };
00190
00191     // Marker: PressedOffToNormalOn_Start.
00192     static constexpr float M_PressedOffToNormalOn_Start{ 0.844062507F };
00193
00194     // Marker: PressedOffToNormalOn_End.
00195     static constexpr float M_PressedOffToNormalOn_End{ 0.962812483F };
00196
00197     // Marker: NormalIndeterminate.
00198     static constexpr float M_NormalIndeterminate{ 0.969062507F };
00199
00200     // Marker: PointerOverIndeterminate.
00201     static constexpr float M_PointerOverIndeterminate{ 0.981562495F };
00202
00203     // Marker: PressedIndeterminate.
00204     static constexpr float M_PressedIndeterminate{ 0.994062483F };
00205
00206     // Theme property: Foreground.
00207     static inline const winrt::Windows::UI::Color c_themeForeground{ 0xFF, 0x00, 0x00, 0x00 };
00208
00209
00210     winrt::Windows::UI::Color Foreground();
00211     void Foreground(winrt::Windows::UI::Color value);
00212
00213     winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual(
00214         winrt::Microsoft::UI::Composition::Compositor const& compositor);
00215
00216     winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual(
00217         winrt::Microsoft::UI::Composition::Compositor const& compositor,
00218         winrt::Windows::Foundation::IInspectable& diagnostics);
00219
00220     // Gets the number of frames in the animation.
00221     double FrameCount();
00222
00223     // Gets the framerate of the animation.
00224     double Framerate();
00225
00226     // Gets the duration of the animation.
00227     winrt::Windows::Foundation::TimeSpan Duration();
00228
00229     // Converts a zero-based frame number to the corresponding progress value denoting the
00230     // start of the frame.
00231     double FrameToProgress(double frameNumber);
00232
00233     // Returns a map from marker names to corresponding progress values.
00234     winrt::Windows::Foundation::Collections::IMapView<hstring, double> Markers();
00235
00236     // Sets the color property with the given name, or does nothing if no such property
00237     // exists.
00238     void SetColorProperty(hstring const& propertyName, winrt::Windows::UI::Color value);
00239
00240     // Sets the scalar property with the given name, or does nothing if no such property
00241     // exists.
00242     void SetScalarProperty(hstring const& propertyName, double value);
00243 };
Generated on Sun Dec 1 2024 20:51:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SingleSelector Member List

This is the complete list of members for SingleSelector, including all inherited members.
CanSelect(winrt::IndexPath const &index) | SelectorBase | [protected, virtual]
Clear() | SelectorBase | [virtual]
DeselectWithAnchorPreservation(int index) | SelectorBase |
FollowFocus(bool followFocus) | SingleSelector |
GetSelectionModel() | SelectorBase | [inline, protected]
IsSelected(winrt::IndexPath const &index) | SelectorBase | [protected]
OnFocusedAction(winrt::IndexPath const &index, bool ctrl, bool shift) override | SingleSelector | [virtual]
OnInteractedAction(winrt::IndexPath const &index, bool ctrl, bool shift) override | SingleSelector | [virtual]
SelectAll() | SelectorBase | [virtual]
SelectorBase() | SelectorBase |
SetSelectionModel(winrt::SelectionModel const &selectionModel) | SelectorBase |
SingleSelector() | SingleSelector |
~SelectorBase() | SelectorBase |
~SingleSelector() | SingleSelector |
Generated on Sun Dec 1 2024 20:53:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ColorPickerSlider.properties.h Source File

  • Generated

ColorPickerSlider.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class ColorPickerSliderProperties
00008 {
00009 public:
00010     ColorPickerSliderProperties();
00011
00012     void ColorChannel(winrt::ColorPickerHsvChannel const& value);
00013     winrt::ColorPickerHsvChannel ColorChannel();
00014
00015     static winrt::DependencyProperty ColorChannelProperty() { return s_ColorChannelProperty; }
00016
00017     static GlobalDependencyProperty s_ColorChannelProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021 };
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollingScrollOptions.cpp Source File

  • ScrollPresenter

ScrollingScrollOptions.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "ScrollingScrollOptions.h"
00009
00010 #include "ScrollingScrollOptions.properties.cpp"
00011
00012 ScrollingScrollOptions::ScrollingScrollOptions(
00013     winrt::ScrollingAnimationMode const& animationMode)
00014 {
00015     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this,
00016         TypeLogging::AnimationModeToString(animationMode).c_str());
00017
00018     m_animationMode = animationMode;
00019 }
00020
00021 ScrollingScrollOptions::ScrollingScrollOptions(
00022     winrt::ScrollingAnimationMode const& animationMode,
00023     winrt::ScrollingSnapPointsMode const& snapPointsMode)
00024 {
00025     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR_STR, METH_NAME, this,
00026         TypeLogging::AnimationModeToString(animationMode).c_str(),
00027         TypeLogging::SnapPointsModeToString(snapPointsMode).c_str());
00028
00029     m_animationMode = animationMode;
00030     m_snapPointsMode = snapPointsMode;
00031 }
00032
00033 winrt::ScrollingAnimationMode ScrollingScrollOptions::AnimationMode() const
00034 {
00035     return m_animationMode;
00036 }
00037
00038 void ScrollingScrollOptions::AnimationMode(winrt::ScrollingAnimationMode const& animationMode)
00039 {
00040     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this,
00041         TypeLogging::AnimationModeToString(animationMode).c_str());
00042
00043     m_animationMode = animationMode;
00044 }
00045
00046 winrt::ScrollingSnapPointsMode ScrollingScrollOptions::SnapPointsMode() const
00047 {
00048     return m_snapPointsMode;
00049 }
00050
00051 void ScrollingScrollOptions::SnapPointsMode(winrt::ScrollingSnapPointsMode const& snapPointsMode)
00052 {
00053     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this,
00054         TypeLogging::SnapPointsModeToString(snapPointsMode).c_str());
00055
00056     m_snapPointsMode = snapPointsMode;
00057 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SplitButton/SplitButtonEventArgs.h Source File

  • SplitButton

SplitButtonEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SplitButtonClickEventArgs.g.h"
00007 #include "ToggleSplitButtonIsCheckedChangedEventArgs.g.h"
00008
00009 class SplitButtonClickEventArgs :
00010     public winrt::implementation::SplitButtonClickEventArgsT<SplitButtonClickEventArgs>
00011 {};
00012
00013 class ToggleSplitButtonIsCheckedChangedEventArgs :
00014     public winrt::implementation::ToggleSplitButtonIsCheckedChangedEventArgsT<ToggleSplitButtonIsCheckedChangedEventArgs>
00015 {};
00016
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RefreshInfoProviderImpl Member List

This is the complete list of members for RefreshInfoProviderImpl, including all inherited members.
compositionProperties | RefreshInfoProviderImpl | [private]
CompositionProperties | RefreshInfoProviderImpl |
executionRatio | RefreshInfoProviderImpl | [private]
ExecutionRatio | RefreshInfoProviderImpl |
InteractionRatioChanged | RefreshInfoProviderImpl |
InteractionRatioCompositionProperty | RefreshInfoProviderImpl |
IsInteractingForRefresh | RefreshInfoProviderImpl |
isInteractingForRefresh | RefreshInfoProviderImpl | [private]
IsInteractingForRefreshChanged | RefreshInfoProviderImpl |
OnRefreshCompleted() | RefreshInfoProviderImpl | [inline]
OnRefreshCompletedCalls | RefreshInfoProviderImpl |
OnRefreshStarted() | RefreshInfoProviderImpl | [inline]
OnRefreshStartedCalls | RefreshInfoProviderImpl |
RaiseInteractionRatioChangedEvent(float interactionRatio) | RefreshInfoProviderImpl | [inline]
RaiseIsInteractionForRefreshChangedEvent() | RefreshInfoProviderImpl | [inline]
RefreshCompleted | RefreshInfoProviderImpl |
RefreshInfoProviderImpl(Compositor compositor) | RefreshInfoProviderImpl | [inline]
RefreshStarted | RefreshInfoProviderImpl |
SetCustomInteractionRatio(float value) | RefreshInfoProviderImpl | [inline]
SetCustomIsInteractingForRefresh(bool value) | RefreshInfoProviderImpl | [inline]
Generated on Sun Dec 1 2024 20:53:35 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedVisuals/AnimatedChevronRightDownSmallVisualSource.idl Source File

  • AnimatedIcon
  • AnimatedVisuals

AnimatedChevronRightDownSmallVisualSource.idl

Go to the documentation of this file.
00001 ﻿//------------------------------------------------------------------------------
00002 // <auto-generated>
00003 //     This code was generated by a tool.
00004 //
00005 //       LottieGen version:
00006 //           7.1.0+ge1fa92580f
00007 //
00008 //       Command:
00009 //           LottieGen -Language Cppwinrt -WinUIVersion 2.4 -InputFile AnimatedChevronRightDownSmallVisualSource.json
00010 //
00011 //       Input file:
00012 //           AnimatedChevronRightDownSmallVisualSource.json (27906 bytes created 23:37-07:00 Oct 5 2021)
00013 //
00014 //       LottieGen source:
00015 //           http://aka.ms/Lottie
00016 //
00017 //     Changes to this file may cause incorrect behavior and will be lost if
00018 //     the code is regenerated.
00019 // </auto-generated>
00020 //------------------------------------------------------------------------------
00021 namespace MU_XCAV_NAMESPACE
00022 {
00023     [MUX_PUBLIC]
00024     [webhosthidden]
00025     runtimeclass AnimatedChevronRightDownSmallVisualSource
00026         : [default] Microsoft.UI.Xaml.Controls.IAnimatedVisualSource, Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2
00027     {
00028         AnimatedChevronRightDownSmallVisualSource();
00029     };
00030 }
Generated on Sun Dec 1 2024 20:51:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/Common/FlowLayoutDerived.cs Source File

  • Repeater
  • APITests
  • Common

FlowLayoutDerived.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Windows.Foundation;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Controls;
00008
00009 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common
00010 {
00011     public class FlowLayoutDerived : FlowLayout
00012     {
00013         public Func<Size, VirtualizingLayoutContext, Size, Size> MeasureLayoutFunc { get; set; }
00014         public Func<Size, VirtualizingLayoutContext, Size, Size> ArrangeLayoutFunc { get; set; }
00015         public Func<int, Size, VirtualizingLayoutContext, FlowLayoutAnchorInfo, FlowLayoutAnchorInfo> GetAnchorForTargetElementFunc { get; set; }
00016         public Func<Size, VirtualizingLayoutContext, FlowLayoutAnchorInfo, FlowLayoutAnchorInfo> GetAnchorForRealizationRectFunc { get; set; }
00017         public Func<Size, VirtualizingLayoutContext, UIElement, int, Rect, UIElement, int, Rect, Rect, Rect> GetExtentFunc { get; set; }
00018         public Func<int, Size, Size, Size> GetMeasureSizeFunc { get; set; }
00019         public Func<int, Size, Size, Size, Size> GetProvisionalArrangeSizeFunc { get; set; }
00020         public Action<VirtualizingLayoutContext> OnAttachedFunc { get; set; }
00021         public Action<VirtualizingLayoutContext> OnDetatchedFunc { get; set; }
00022         public Action<UIElement, int, Size, Size, Size, Size, VirtualizingLayoutContext> OnElementMeasuredFunc { get; set; }
00023         public Action<int, int, double, VirtualizingLayoutContext> OnLineArrangedFunc { get; set; }
00024         public Func<int, double, bool, bool> ShouldBreakLineFunc { get; set; }
00025
00026         protected override Size MeasureOverride(VirtualizingLayoutContext context, Size availableSize)
00027         {
00028             var extent = base.MeasureOverride(context, availableSize);
00029             return MeasureLayoutFunc != null ? MeasureLayoutFunc(availableSize, context, extent) : extent;
00030         }
00031
00032         protected override Size ArrangeOverride(VirtualizingLayoutContext context, Size finalSize)
00033         {
00034             var extent = base.ArrangeOverride(context, finalSize);
00035             return ArrangeLayoutFunc != null ? ArrangeLayoutFunc(finalSize, context, extent) : extent;
00036         }
00037
00038         protected override FlowLayoutAnchorInfo GetAnchorForTargetElement(int targetIndex, Size availableSize, VirtualizingLayoutContext context)
00039         {
00040             var anchorInfo = base.GetAnchorForTargetElement(targetIndex, availableSize, context);
00041             return GetAnchorForTargetElementFunc != null ? GetAnchorForTargetElementFunc(targetIndex, availableSize, context, anchorInfo) : anchorInfo;
00042         }
00043
00044         protected override FlowLayoutAnchorInfo GetAnchorForRealizationRect(Size availableSize, VirtualizingLayoutContext context)
00045         {
00046             var anchorInfo = base.GetAnchorForRealizationRect(availableSize, context);
00047             return GetAnchorForRealizationRectFunc != null ? GetAnchorForRealizationRectFunc(availableSize, context, anchorInfo) : anchorInfo;
00048         }
00049
00050         protected override Rect GetExtent(
00051             Size availableSize,
00052             VirtualizingLayoutContext context,
00053             UIElement firstRealized,
00054             int firstRealizedItemIndex,
00055             Rect firstRealizedLayoutBounds,
00056             UIElement lastRealized,
00057             int lastRealizedItemIndex,
00058             Rect lastRealizedLayoutBounds)
00059         {
00060             var extent = base.GetExtent(
00061                 availableSize,
00062                 context,
00063                 firstRealized,
00064                 firstRealizedItemIndex,
00065                 firstRealizedLayoutBounds,
00066                 lastRealized,
00067                 lastRealizedItemIndex,
00068                 lastRealizedLayoutBounds);
00069
00070             return GetExtentFunc != null ? GetExtentFunc(
00071                 availableSize,
00072                 context,
00073                 firstRealized,
00074                 firstRealizedItemIndex,
00075                 firstRealizedLayoutBounds,
00076                 lastRealized,
00077                 lastRealizedItemIndex,
00078                 lastRealizedLayoutBounds,
00079                 extent) : extent;
00080         }
00081
00082         protected override Size GetMeasureSize(int index, Size availableSize)
00083         {
00084             var measureSize = base.GetMeasureSize(index, availableSize);
00085             return GetMeasureSizeFunc != null ? GetMeasureSizeFunc(index, availableSize, measureSize) : measureSize;
00086         }
00087
00088         protected override Size GetProvisionalArrangeSize(int index, Size measureSize, Size desiredSize)
00089         {
00090             var arrangeSize = base.GetProvisionalArrangeSize(index, measureSize, desiredSize);
00091             return GetProvisionalArrangeSizeFunc != null ? GetProvisionalArrangeSizeFunc(index, measureSize, desiredSize, arrangeSize) : arrangeSize;
00092         }
00093
00094
00095         protected override void InitializeForContextCore(VirtualizingLayoutContext context)
00096         {
00097             base.InitializeForContextCore(context);
00098             if (OnAttachedFunc != null) { OnAttachedFunc(context); }
00099         }
00100
00101         protected override void UninitializeForContextCore(VirtualizingLayoutContext context)
00102         {
00103             base.UninitializeForContextCore(context);
00104             if (OnDetatchedFunc != null) { OnDetatchedFunc(context); }
00105         }
00106
00107         protected override void OnElementMeasured(UIElement element, int index, Size availableSize, Size measureSize, Size desiredSize, Size provisionalArrangeSize, VirtualizingLayoutContext context)
00108         {
00109             base.OnElementMeasured(element, index, availableSize, measureSize, desiredSize, provisionalArrangeSize, context);
00110             if (OnElementMeasuredFunc != null) { OnElementMeasuredFunc(element, index, availableSize, measureSize, desiredSize, provisionalArrangeSize, context); }
00111         }
00112
00113         protected override void OnLineArranged(int startIndex, int countInLine, double lineSize, VirtualizingLayoutContext context)
00114         {
00115             base.OnLineArranged(startIndex, countInLine, lineSize, context);
00116             if (OnLineArrangedFunc != null) { OnLineArrangedFunc(startIndex, countInLine, lineSize, context); }
00117         }
00118
00119         protected override bool ShouldBreakLine(int index, double remainingSpace)
00120         {
00121             var shouldBreak = base.ShouldBreakLine(index, remainingSpace);
00122             return ShouldBreakLineFunc != null ? ShouldBreakLineFunc(index, remainingSpace, shouldBreak) : shouldBreak;
00123         }
00124     }
00125 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LinedFlowLayoutDemo Member List

This is the complete list of members for LinedFlowLayoutDemo, including all inherited members.
_asyncEventReportingLock | LinedFlowLayoutDemo | [private]
_cornerRadiusFour | LinedFlowLayoutDemo | [private]
_grayBrush | LinedFlowLayoutDemo | [private]
_layout | LinedFlowLayoutDemo | [private]
_lstAsyncEventMessage | LinedFlowLayoutDemo | [private]
_lstLinedFlowLayoutLockedItemIndexes | LinedFlowLayoutDemo | [private]
_thicknessFour | LinedFlowLayoutDemo | [private]
_whiteBrush | LinedFlowLayoutDemo | [private]
AddChild() | LinedFlowLayoutDemo | [inline, private]
AppendAsyncEventMessage(string asyncEventMessage) | LinedFlowLayoutDemo | [inline, private]
AppendAsyncEventMessage() | LinedFlowLayoutDemo | [inline, private]
AppendEventMessage(string eventMessage) | LinedFlowLayoutDemo | [inline, private]
BtnAddChild_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnClearEvents_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnClearExceptionReport_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnCopyEvents_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetChildrenCount_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelBorderThickness_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelCornerRadius_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementActualHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementActualWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementCornerRadius_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementIsEnabled_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementMaxHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementMaxWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementMinHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementMinWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelElementWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelHorizontalAlignment_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelMargin_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelMaxHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelMaxWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelPadding_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelVerticalAlignment_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLayoutPanelWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutActualLineHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutAverageItemAspectRatioDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutForcedAverageItemAspectRatioDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutForcedAverageItemsPerLineDividerDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutForcedWrapMultiplierDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutFrozenItemIndexesDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutLineHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutLineSpacing_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutLogItemIndexDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutMinItemSpacing_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutRealizedItemIndexesDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetLinedFlowLayoutSnappedAverageItemsPerLineDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewBorderThickness_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewContentOrientation_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewCornerRadius_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewExtentHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewExtentWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewHorizontalAnchorRatio_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewHorizontalOffset_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewHorizontalScrollBarVisibility_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewHorizontalScrollMode_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewMargin_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewMaxHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewMaxWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewPadding_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewVerticalAnchorRatio_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewVerticalOffset_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewVerticalScrollBarVisibility_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewVerticalScrollMode_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnGetScrollViewZoomMode_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnInsertChild_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnLayoutInvalidateItemsInfo_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnLayoutInvalidateMeasure_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnLayoutPanelResetLayout_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnLayoutPanelSetLayout_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnLinedFlowLayoutLockItemToLine_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnLinedFlowLayoutUnlockItems_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnRemoveAllChildren_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnRemoveChild_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnReplaceChild_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetChildrenCount_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelBorderThickness_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelCornerRadius_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelElementCornerRadius_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelElementHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelElementIsEnabled_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelElementMaxHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelElementMaxWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelElementMinHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelElementMinWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelElementWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelHorizontalAlignment_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelMargin_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelMaxHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelMaxWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelPadding_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelVerticalAlignment_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLayoutPanelWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLinedFlowLayoutForcedAverageItemAspectRatioDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLinedFlowLayoutForcedAverageItemsPerLineDividerDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLinedFlowLayoutForcedWrapMultiplierDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLinedFlowLayoutLineHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLinedFlowLayoutLineSpacing_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLinedFlowLayoutLogItemIndexDbg_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetLinedFlowLayoutMinItemSpacing_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewBorderThickness_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewContentOrientation_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewCornerRadius_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewHorizontalAnchorRatio_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewHorizontalOffset_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewHorizontalScrollBarVisibility_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewHorizontalScrollMode_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewMargin_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewMaxHeight_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewMaxWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewPadding_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewVerticalAnchorRatio_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewVerticalConstantVelocity_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewVerticalOffset_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewVerticalScrollBarVisibility_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewVerticalScrollMode_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewWidth_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
BtnSetScrollViewZoomMode_Click(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkEvents_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkEvents_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLayoutPanel_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLayoutPanel_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLinedFlowLayout_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLinedFlowLayout_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLinedFlowLayoutHandleItemsInfoRequested_IsCheckedChanged(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLinedFlowLayoutIsFastPathSupportedDbg_IsCheckedChanged(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLinedFlowLayoutShowLockedItems_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLinedFlowLayoutShowLockedItems_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLogLinedFlowLayoutMessages_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLogLinedFlowLayoutMessages_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLogScrollViewEvents_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLogScrollViewEvents_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLogScrollViewMessages_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkLogScrollViewMessages_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkScrollView_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkScrollView_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkScrollViewIsEnabled_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkScrollViewIsEnabled_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkScrollViewIsTabStop_Checked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ChkScrollViewIsTabStop_Unchecked(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
CmbLayoutPanelBackground_SelectionChanged(object sender, SelectionChangedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
CmbLayoutPanelBorderBrush_SelectionChanged(object sender, SelectionChangedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
CmbLinedFlowLayoutItemsJustification_SelectionChanged(object sender, SelectionChangedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
CmbLinedFlowLayoutItemsStretch_SelectionChanged(object sender, SelectionChangedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
CmbScrollViewBackground_SelectionChanged(object sender, SelectionChangedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
CmbScrollViewBorderBrush_SelectionChanged(object sender, SelectionChangedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
CreateChild(int id) | LinedFlowLayoutDemo | [inline, private]
GetCornerRadiusFromString(string cornerRadius) | LinedFlowLayoutDemo | [inline, private]
GetLayoutPanelElement() | LinedFlowLayoutDemo | [inline, private]
GetThicknessFromString(string thickness) | LinedFlowLayoutDemo | [inline, private]
HookLinedFlowLayoutEvents() | LinedFlowLayoutDemo | [inline, private]
HookScrollViewEvents() | LinedFlowLayoutDemo | [inline, private]
InsertChild(int newChildIndex) | LinedFlowLayoutDemo | [inline, private]
LayoutsTestHooks_LinedFlowLayoutInvalidated(object sender, LayoutsTestHooksLinedFlowLayoutInvalidatedEventArgs args) | LinedFlowLayoutDemo | [inline, private]
LayoutsTestHooks_LinedFlowLayoutItemLocked(object sender, LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs args) | LinedFlowLayoutDemo | [inline, private]
LayoutsTestHooks_LinedFlowLayoutItemLocked2(object sender, LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs args) | LinedFlowLayoutDemo | [inline, private]
LayoutsTestHooks_LinedFlowLayoutSnappedAverageItemsPerLineChanged(object sender, object args) | LinedFlowLayoutDemo | [inline, private]
LinedFlowLayout_ItemsInfoRequested(LinedFlowLayout sender, LinedFlowLayoutItemsInfoRequestedEventArgs args) | LinedFlowLayoutDemo | [inline, private]
LinedFlowLayout_ItemsUnlocked(LinedFlowLayout sender, object args) | LinedFlowLayoutDemo | [inline, private]
LinedFlowLayoutDemo() | LinedFlowLayoutDemo | [inline]
LinedFlowLayoutDemo_Loaded(object sender, RoutedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args) | LinedFlowLayoutDemo | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | LinedFlowLayoutDemo | [inline, protected]
RemoveAllChildren() | LinedFlowLayoutDemo | [inline, private]
RemoveChild(int oldChildIndex) | LinedFlowLayoutDemo | [inline, private]
ReplaceChild(int childIndex) | LinedFlowLayoutDemo | [inline, private]
ScrollView_ExtentChanged(ScrollView sender, object args) | LinedFlowLayoutDemo | [inline, private]
ScrollView_ScrollAnimationStarting(ScrollView sender, ScrollingScrollAnimationStartingEventArgs args) | LinedFlowLayoutDemo | [inline, private]
ScrollView_ScrollCompleted(ScrollView sender, ScrollingScrollCompletedEventArgs args) | LinedFlowLayoutDemo | [inline, private]
ScrollView_SizeChanged(object sender, SizeChangedEventArgs e) | LinedFlowLayoutDemo | [inline, private]
ScrollView_StateChanged(ScrollView sender, object args) | LinedFlowLayoutDemo | [inline, private]
ScrollView_ViewChanged(ScrollView sender, object args) | LinedFlowLayoutDemo | [inline, private]
ScrollView_ViewChangedForLockedItemsVisuals(ScrollView sender, object args) | LinedFlowLayoutDemo | [inline, private]
ScrollView_ZoomAnimationStarting(ScrollView sender, ScrollingZoomAnimationStartingEventArgs args) | LinedFlowLayoutDemo | [inline, private]
ScrollView_ZoomCompleted(ScrollView sender, ScrollingZoomCompletedEventArgs args) | LinedFlowLayoutDemo | [inline, private]
UnhookScrollViewEvents() | LinedFlowLayoutDemo | [inline, private]
UpdateChildrenCount() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelBackground() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelBorderBrush() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelBorderThickness() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelCornerRadius() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementActualHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementActualWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementCornerRadius() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementIsEnabled() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementMaxHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementMaxWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementMinHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementMinWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelElementWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelHorizontalAlignment() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelMargin() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelMaxHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelMaxWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelPadding() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelVerticalAlignment() | LinedFlowLayoutDemo | [inline, private]
UpdateLayoutPanelWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutActualLineHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutAverageItemAspectRatioDbg() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutForcedAverageItemAspectRatioDbg() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutForcedAverageItemsPerLineDividerDbg() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutForcedWrapMultiplierDbg() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutFrozenItemIndexes() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutItemsJustification() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutItemsStretch() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutLineHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutLineSpacing() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutLockedItemsVisuals() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutLogItemIndexDbg() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutMinItemSpacing() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutRealizedItemIndexes() | LinedFlowLayoutDemo | [inline, private]
UpdateLinedFlowLayoutSnappedAverageItemsPerLineDbg() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewBackground() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewBorderBrush() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewBorderThickness() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewContentOrientation() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewCornerRadius() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewExtentHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewExtentWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewHorizontalAnchorRatio() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewHorizontalOffset() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewHorizontalScrollBarVisibility() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewHorizontalScrollMode() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewIsEnabled() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewIsTabStop() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewMargin() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewMaxHeight() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewMaxWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewPadding() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewVerticalAnchorRatio() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewVerticalOffset() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewVerticalScrollBarVisibility() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewVerticalScrollMode() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewWidth() | LinedFlowLayoutDemo | [inline, private]
UpdateScrollViewZoomMode() | LinedFlowLayoutDemo | [inline, private]
~LinedFlowLayoutDemo() | LinedFlowLayoutDemo | [inline, private]
Generated on Sun Dec 1 2024 20:54:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/BuildTreeScheduler.h Source File

  • Repeater

BuildTreeScheduler.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 struct WorkInfo
00007 {
00008     WorkInfo(int priority, const std::function<void()>& workFunc) :
00009         m_priority(priority),
00010         m_workFunc(workFunc)
00011     {}
00012
00013     int Priority() const { return m_priority; }
00014     void InvokeWorkFunc() const { m_workFunc(); }
00015
00016 private:
00017     int m_priority;
00018     std::function<void()> m_workFunc;
00019 };
00020
00021 // High performance time management using QueryPerformanceCounter
00022 class BuildTreeScheduler final
00023 {
00024 public:
00025     static void RegisterWork(int priority, const std::function<void()>& workFunc);
00026     static bool ShouldYield();
00027
00028 private:
00029     static void OnRendering(const winrt::IInspectable& sender, const winrt::IInspectable& args);
00030     static void QueueTick();
00031
00032     static double m_budgetInMs;
00033
00034     static thread_local QPCTimer m_timer;
00035     static thread_local std::vector<WorkInfo> m_pendingWork;
00036     static thread_local winrt::event_token m_renderingToken;
00037 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Telemetry/TypeLogging.h Source File

  • Telemetry

TypeLogging.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 namespace TypeLogging
00007 {
00008     winrt::hstring KeyRoutedEventArgsToString(const winrt::KeyRoutedEventArgs& eventArgs);
00009     winrt::hstring PointerPointToString(const winrt::PointerPoint& pointerPoint, bool verbose = false);
00010     winrt::hstring PointerDeviceTypeToString(const winrt::PointerDeviceType& pointerDeviceKind);
00011     winrt::hstring PointerUpdateKindToString(const winrt::PointerUpdateKind& pointerUpdateKind);
00012     winrt::hstring RectToString(const winrt::Rect& rect);
00013     winrt::hstring SizeToString(const winrt::Size& size);
00014     winrt::hstring Float2ToString(const winrt::float2& v2);
00015     winrt::hstring NullableFloatToString(const winrt::IReference<float>& nf);
00016     winrt::hstring NullableFloat2ToString(const winrt::IReference<winrt::float2>& nv2);
00017     winrt::hstring OrientationToString(const winrt::Orientation& orientation);
00018     winrt::hstring ScrollEventTypeToString(const winrt::ScrollEventType& scrollEventType);
00019     winrt::hstring ScrollingIndicatorModeToString(const winrt::ScrollingIndicatorMode& indicatorMode);
00020     winrt::hstring FocusStateToString(const winrt::FocusState& focusState);
00021     winrt::hstring ItemContainerInteractionTriggerToString(const winrt::ItemContainerInteractionTrigger& interactionTrigger);
00022     winrt::hstring ItemContainerMultiSelectModeToString(const winrt::ItemContainerMultiSelectMode& multiSelectMode);
00023 }
00024
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedVisualPlayer/AnimatedVisualPlayer.cpp Source File

  • AnimatedVisualPlayer

AnimatedVisualPlayer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "AnimatedVisualPlayer.h"
00006 #include "AnimatedVisualPlayerAutomationPeer.h"
00007 #include "RuntimeProfiler.h"
00008 #include <synchapi.h>
00009 #include <winerror.h>
00010 #include <math.h>
00011
00012 AnimatedVisualPlayer::AnimationPlay::AnimationPlay(
00013     AnimatedVisualPlayer& owner,
00014     float fromProgress,
00015     float toProgress,
00016     bool looped)
00017     : m_owner{ &owner }
00018     , m_fromProgress(fromProgress)
00019     , m_toProgress(toProgress)
00020     , m_looped(looped)
00021 {
00022     // Save the play duration as time.
00023     // If toProgress is less than fromProgress the animation will wrap around,
00024     // so the time is calculated as fromProgress..end + start..toProgress.
00025     const auto durationAsProgress = fromProgress > toProgress ? ((1 - fromProgress) + toProgress) : (toProgress - fromProgress);
00026     // NOTE: this relies on the Duration() being set on the owner.
00027     m_playDuration = std::chrono::duration_cast<winrt::TimeSpan>(m_owner->Duration() * durationAsProgress);
00028 }
00029
00030 float AnimatedVisualPlayer::AnimationPlay::FromProgress()
00031 {
00032     return m_fromProgress;
00033 }
00034
00035 // REENTRANCE SIDE EFFECT: IsPlaying DP.
00036 void AnimatedVisualPlayer::AnimationPlay::Start()
00037 {
00038     // m_owner should be alive since we are calling Start() from owner only
00039     MUX_ASSERT(m_owner);
00040     MUX_ASSERT(IsCurrentPlay());
00041     MUX_ASSERT(!m_controller);
00042
00043     // If the duration is really short (< 20ms) don't bother trying to animate.
00044     if (m_playDuration < winrt::TimeSpan{ 20ms })
00045     {
00046         // Nothing to play. Jump to the from position.
00047         // This will have the side effect of completing this play immediately.
00048         m_owner->SetProgress(m_fromProgress);
00049         // Do not do anything after calling SetProgress()... the AnimationPlay is destructed already.
00050         return;
00051     }
00052     else
00053     {
00054         // Create an animation to drive the Progress property.
00055         auto compositor = m_owner->m_progressPropertySet.Compositor();
00056         auto animation = compositor.CreateScalarKeyFrameAnimation();
00057         animation.Duration(m_playDuration);
00058         auto linearEasing = compositor.CreateLinearEasingFunction();
00059
00060         // Play from fromProgress.
00061         animation.InsertKeyFrame(0, m_fromProgress);
00062
00063         // from > to is treated as playing from fromProgress to the end, then playing from
00064         // the beginning to toProgress. Insert extra keyframes to do that.
00065         if (m_fromProgress > m_toProgress)
00066         {
00067             // Play to the end.
00068             const auto timeToEnd = (1 - m_fromProgress) / ((1 - m_fromProgress) + m_toProgress);
00069             animation.InsertKeyFrame(timeToEnd, 1, linearEasing);
00070             // Jump to the beginning.
00071             animation.InsertKeyFrame(::nextafterf(timeToEnd, 1), 0, linearEasing);
00072         }
00073
00074         // Play to toProgress
00075         animation.InsertKeyFrame(1, m_toProgress, linearEasing);
00076
00077         if (m_looped)
00078         {
00079             animation.IterationBehavior(winrt::AnimationIterationBehavior::Forever);
00080         }
00081         else
00082         {
00083             animation.IterationBehavior(winrt::AnimationIterationBehavior::Count);
00084             animation.IterationCount(1);
00085         }
00086
00087         // Create a batch so that we can know when the animation finishes. This only
00088         // works for non-looping animations (the batch completes immediately
00089         // for looping animations).
00090         m_batch = m_looped
00091             ? nullptr
00092             : compositor.CreateScopedBatch(winrt::CompositionBatchTypes::Animation);
00093
00094         // Start the animation and get the controller.
00095         m_owner->m_progressPropertySet.StartAnimation(L"Progress", animation);
00096
00097         m_controller = m_owner->m_progressPropertySet.TryGetAnimationController(L"Progress");
00098
00099         if (m_isPaused || m_isPausedBecauseHidden)
00100         {
00101             // The play was paused before it was started.
00102             m_controller.Pause();
00103         }
00104
00105         // Set the playback rate.
00106         const auto playbackRate = static_cast<float>(m_owner->PlaybackRate());
00107         m_controller.PlaybackRate(playbackRate);
00108
00109         if (playbackRate < 0)
00110         {
00111             // Play from end to beginning if playing in reverse.
00112             m_controller.Progress(1);
00113         }
00114
00115         if (m_batch)
00116         {
00117             std::weak_ptr<AnimationPlay> me_weak = m_owner->m_nowPlaying;
00118             // Subscribe to the batch completed event.
00119             m_batchCompletedToken = m_batch.Completed([me_weak](winrt::IInspectable const&, winrt::CompositionBatchCompletedEventArgs const&)
00120                 {
00121                     auto me = me_weak.lock();
00122
00123                     if (!me)
00124                     {
00125                         return;
00126                     }
00127
00128                     if (me->m_owner)
00129                     {
00130                         // If optimization is set to Resources - destroy animations immediately after player stops.
00131                         if (me->m_owner->AnimationOptimization() == winrt::PlayerAnimationOptimization::Resources)
00132                         {
00133                             me->m_owner->DestroyAnimations();
00134                         }
00135                     }
00136
00137                     // Complete the play when the batch completes.
00138                     //
00139                     // The "this" pointer is guaranteed to be valid because:
00140                     // 1) The AnimationPlay (*this) is kept alive by a reference from m_owner.m_nowPlaying that
00141                     //    is only reset by a call to the AnimationPlay::Complete() method.
00142                     // 2) Before m_owner.m_nowPlaying is reset in AnimationPlay::Complete(),
00143                     //    the m_batch.Completed event is unsubscribed, guaranteeing that this lambda
00144                     //    will not run after AnimationPlay::Complete() has been called.
00145                     // 3) To handle AnimatedVisualPlayer shutdown, AnimationPlay::Complete() is called when
00146                     //    the AnimatedVisualPlayer is unloaded, so that the AnimationPlay cannot outlive
00147                     //    the AnimatedVisualPlayer.
00148                     //
00149                     // Do not do anything after calling Complete()... the object is destructed already.
00150                     me->Complete();
00151                 });
00152             // Indicate that nothing else is going into the batch.
00153             m_batch.End();
00154         }
00155
00156         // WARNING - this may cause reentrance.
00157         m_owner->IsPlaying(true);
00158     }
00159 }
00160
00161 bool AnimatedVisualPlayer::AnimationPlay::IsCurrentPlay()
00162 {
00163     return m_owner && m_owner->m_nowPlaying.get() == this;
00164 }
00165
00166 void AnimatedVisualPlayer::AnimationPlay::SetPlaybackRate(float value)
00167 {
00168     if (m_controller)
00169     {
00170         m_controller.PlaybackRate(value);
00171     }
00172 }
00173
00174 // Called when the animation is becoming hidden.
00175 void AnimatedVisualPlayer::AnimationPlay::OnHiding()
00176 {
00177     if (!m_isPausedBecauseHidden)
00178     {
00179         m_isPausedBecauseHidden = true;
00180
00181         // Pause the animation if it's not already paused.
00182         // This is necessary to ensure that the animation doesn't
00183         // keep running and causing DWM to wake up when the animation
00184         // cannot be seen.
00185         if (m_controller)
00186         {
00187             if (!m_isPaused)
00188             {
00189                 m_controller.Pause();
00190             }
00191         }
00192     }
00193 }
00194
00195 // Called when the animation was hidden but is now becoming visible.
00196 void AnimatedVisualPlayer::AnimationPlay::OnUnhiding()
00197 {
00198     if (m_isPausedBecauseHidden)
00199     {
00200         m_isPausedBecauseHidden = false;
00201
00202         // Resume the animation that was paused due to the app being suspended.
00203         if (m_controller)
00204         {
00205             if (!m_isPaused)
00206             {
00207                 m_controller.Resume();
00208             }
00209         }
00210     }
00211 }
00212
00213 void AnimatedVisualPlayer::AnimationPlay::Pause()
00214 {
00215     m_isPaused = true;
00216
00217     if (m_controller)
00218     {
00219         if (!m_isPausedBecauseHidden)
00220         {
00221             m_controller.Pause();
00222         }
00223     }
00224 }
00225
00226 void AnimatedVisualPlayer::AnimationPlay::Resume()
00227 {
00228     m_isPaused = false;
00229
00230     if (m_controller)
00231     {
00232         if (!m_isPausedBecauseHidden)
00233         {
00234             m_controller.Resume();
00235         }
00236     }
00237 }
00238
00239 // Completes the play, and unregisters it from the player.
00240 // Called on the UI thread from:
00241 //  * AnimatedVisualPlayer::SetProgress(...)
00242 //   - when any property is set that invalidates the current play, such as starting a new play or setting progress.
00243 //  * CompositionScopedBatch::BatchCompleted event
00244 //   - when a non-looping animation gets to it final keyframe.
00245 //  * ~AnimatedVisualPlayer - in owner's destructor
00246 // Do not do anything with this object after calling here... the object is destructed already.
00247 // REENTRANCE SIDE EFFECT: IsPlaying DP.
00248 void AnimatedVisualPlayer::AnimationPlay::Complete()
00249 {
00250     //
00251     // NOTEs about lifetime (i.e. why we can trust that m_owner is still valid)
00252     //  The AnimatedVisualPlayer will be alive as the time when Complete() is called. This
00253     //  is because:
00254     //  1. There is only ever one un-completed AnimationPlay. When a new play
00255     //     is started the current play is completed.
00256     //  2. An uncompleted AnimationPlay will be completed when the AnimatedVisualPlayer
00257     //     is unloaded or the AnimatedVisualPlayer destructor is run.
00258     //  3. If the call to here is from AnimatedVisualPlayer::SetProgress(...)
00259     //     then the AnimatedVisualPlayer is obviously still alive.
00260     //  4. If the batch completion event fires the AnimatedVisualPlayer must still be
00261     //     alive because if it had been unloaded or destroyedComplete() would have been
00262     //     called during the unload or from the destructor which would have unsubscribed
00263     //     from the batch completion event.
00264     //
00265
00266     // Grab a copy of the pointer so the object stays alive until the method returns.
00267     // We need to copy pointer only in case if owner is alive,
00268     // because we are resetting only owner's pointer in this method
00269     std::shared_ptr<AnimationPlay> me;
00270     if (m_owner)
00271     {
00272         me = m_owner->m_nowPlaying;
00273     }
00274
00275     // Unsubscribe from batch.Completed.
00276     if (m_batch)
00277     {
00278         m_batch.Completed(m_batchCompletedToken);
00279         m_batchCompletedToken = { 0 };
00280     }
00281
00282     // If this play is the one that is currently associated with the player,
00283     // disassociate it from the player and update the player's IsPlaying property.
00284     if (m_owner && IsCurrentPlay())
00285     {
00286         // Disconnect this AnimationPlay from the player.
00287         m_owner->m_nowPlaying.reset();
00288
00289         // Update the IsPlaying state. Note that this is done
00290         // after being disconnected so that this AnimationPlay won't be
00291         // reentered, however the AnimatedVisualPlayer may be reentered.
00292         // WARNING - this may cause reentrance.
00293         m_owner->IsPlaying(false);
00294     }
00295
00296     // Allow anything waiting on this awaitable to complete.
00297     // This will not cause reentrance because this signals an event and does not call out.
00298     CompleteAwaits();
00299 }
00300
00301 // This is called in AnimatedVisualPlayer destructor to prevent
00302 // AnimationPlay accessing owner in case if it lives longer
00303 void AnimatedVisualPlayer::AnimationPlay::ResetOwner()
00304 {
00305     m_owner = nullptr;
00306 }
00307
00308 AnimatedVisualPlayer::AnimatedVisualPlayer()
00309 {
00310     __RP_Marker_ClassById(RuntimeProfiler::ProfId_AnimatedVisualPlayer);
00311
00312     EnsureProperties();
00313
00314     auto compositor = winrt::ElementCompositionPreview::GetElementVisual(*this).Compositor();
00315     m_rootVisual = compositor.CreateSpriteVisual();
00316     m_progressPropertySet = m_rootVisual.Properties();
00317
00318     // Set an initial value for the Progress property.
00319     m_progressPropertySet.InsertScalar(L"Progress", 0);
00320
00321     // Ensure the content can't render outside the bounds of the element.
00322     m_rootVisual.Clip(compositor.CreateInsetClip());
00323
00324     // Subscribe to suspending, resuming, and visibility events so we can pause the animation if it's
00325     // definitely not visible.
00326     m_suspendingRevoker = winrt::Application::Current().Suspending(winrt::auto_revoke, [weakThis{ get_weak() }](
00327         auto const& /*sender*/,
00328         auto const& /*e*/)
00329     {
00330         if (auto strongThis = weakThis.get())
00331         {
00332             strongThis->OnHiding();
00333         }
00334     });
00335
00336     m_resumingRevoker = winrt::Application::Current().Resuming(winrt::auto_revoke, [weakThis{ get_weak() }](
00337         auto const& /*sender*/,
00338         auto const& /*e*/)
00339     {
00340         if (auto strongThis = weakThis.get())
00341         {
00342             if (winrt::CoreWindow::GetForCurrentThread().Visible())
00343             {
00344                 strongThis->OnUnhiding();
00345             }
00346         }
00347     });
00348
00349     // Subscribe to the Loaded/Unloaded events to ensure we unload the animated visual then reload
00350     // when it is next loaded.
00351     m_loadedRevoker = Loaded(winrt::auto_revoke, { this, &AnimatedVisualPlayer::OnLoaded });
00352     m_unloadedRevoker = Unloaded(winrt::auto_revoke, { this, &AnimatedVisualPlayer::OnUnloaded });
00353 }
00354
00355 AnimatedVisualPlayer::~AnimatedVisualPlayer()
00356 {
00357     // Ensure any outstanding play is stopped.
00358     if (m_nowPlaying)
00359     {
00360         // To stop and destroy m_nowPlaying we need to call Complete()
00361         // But we need to detach us (m_owner) from m_nowPlaying first so that AnimationPlay
00362         // will not try to call us (m_owner), since we are already in the destructor
00363         m_nowPlaying->ResetOwner();
00364         m_nowPlaying->Complete();
00365     }
00366 }
00367
00368 void AnimatedVisualPlayer::OnLoaded(winrt::IInspectable const& /*sender*/, winrt::RoutedEventArgs const& /*args*/)
00369 {
00370     //
00371     // Do initialization here rather than in the constructor because when the
00372     // constructor is called the outer object is not fully initialized.
00373     //
00374     // Any initialization that can call back into the outer object MUST be
00375     // done here rather than the constructor.
00376     //
00377     // Other initialization can be done here too, so rather than having to
00378     // guess whether an initialization call calls back into the outer, just
00379     // put most of the initialization here.
00380     //
00381
00382     // Calls back into the outer - must be done OnLoaded rather than in the constructor.
00383     winrt::ElementCompositionPreview::SetElementChildVisual(*this, m_rootVisual);
00384
00385     // Set the background for AnimatedVisualPlayer to ensure it will be visible to
00386     // hit-testing. XAML does not hit test anything that has a null background.
00387     // Set here rather than in the constructor so we don't have to worry about it
00388     // calling back into the outer.
00389     Background(winrt::SolidColorBrush(winrt::Colors::Transparent()));
00390
00391     if (m_isUnloaded)
00392     {
00393         // Reload the content.
00394         // Only do this if the element had been previously unloaded so that the
00395         // first Loaded event doesn't overwrite any state that was set before
00396         // the event was fired.
00397         UpdateContent();
00398         m_isUnloaded = false;
00399     }
00400
00401
00402     m_xamlRootChangedRevoker = this->XamlRoot().Changed(winrt::auto_revoke, [weakThis{ get_weak() }](
00403         auto const& /*sender*/,
00404         auto const& args)
00405     {
00406         if (auto strongThis = weakThis.get())
00407         {
00408             auto xamlRoot = strongThis->XamlRoot();
00409             bool hostVisibility = xamlRoot.IsHostVisible();
00410             if (hostVisibility != strongThis->m_isHostVisible)
00411             {
00412                 strongThis->m_isHostVisible = hostVisibility;
00413                 if (hostVisibility)
00414                 {
00415                     // Transition from invisible to visible.
00416                     strongThis->OnUnhiding();
00417                 }
00418                 else
00419                 {
00420                     // Transition from visible to invisible.
00421                     strongThis->OnHiding();
00422                 }
00423
00424             }
00425         }
00426     });
00427 }
00428
00429 void AnimatedVisualPlayer::OnUnloaded(winrt::IInspectable const& /*sender*/, winrt::RoutedEventArgs const& /*args*/)
00430 {
00431    // There is an anomaly in the Loading/Loaded/Unloaded events that can cause an Unloaded event to
00432    // fire when the element is in the tree. When this happens, we end up unlaoding our content
00433    // and not displaying it. Unfortunately, we can't fix this until at least version 2.0 so for
00434    // for now we will work around it (as we have suggested to customers to do), by checking to see
00435    // if we are actually unloaded before removing our content.
00436    if (!IsLoaded())
00437     {
00438         m_isUnloaded = true;
00439         // Remove any content. If we get reloaded the content will get reloaded.
00440         UnloadContent();
00441     }
00442 }
00443
00444 void AnimatedVisualPlayer::OnHiding()
00445 {
00446     if (m_nowPlaying)
00447     {
00448         m_nowPlaying->OnHiding();
00449     }
00450 }
00451
00452 void AnimatedVisualPlayer::OnUnhiding()
00453 {
00454     if (m_nowPlaying)
00455     {
00456         m_nowPlaying->OnUnhiding();
00457     }
00458 }
00459
00460 // Public API.
00461 // IUIElement / IUIElementOverridesHelper
00462 winrt::AutomationPeer AnimatedVisualPlayer::OnCreateAutomationPeer()
00463 {
00464     return winrt::make<AnimatedVisualPlayerAutomationPeer>(*this);
00465 }
00466
00467 // Public API.
00468 // Overrides FrameworkElement::MeasureOverride. Returns the size that is needed to display the
00469 // animated visual within the available size and respecting the Stretch property.
00470 winrt::Size AnimatedVisualPlayer::MeasureOverride(winrt::Size const& availableSize)
00471 {
00472     if (m_isFallenBack && Children().Size() > 0)
00473     {
00474         // We are showing the fallback content due to a failure to load an animated visual.
00475         // Tell the content to measure itself.
00476         Children().GetAt(0).Measure(availableSize);
00477         // Our size is whatever the fallback content desires.
00478         return Children().GetAt(0).DesiredSize();
00479     }
00480
00481     if ((!m_animatedVisualRoot) || (m_animatedVisualSize == winrt::float2::zero()))
00482     {
00483         return { 0, 0 };
00484     }
00485
00486     switch (Stretch())
00487     {
00488     case winrt::Stretch::None:
00489         // No scaling will be done. Measured size is the smallest of each dimension.
00490         return { std::min(m_animatedVisualSize.x, availableSize.Width), std::min(m_animatedVisualSize.y, availableSize.Height) };
00491     case winrt::Stretch::Fill:
00492         // Both height and width will be scaled to fill the available space.
00493         if (availableSize.Width != std::numeric_limits<double>::infinity() && availableSize.Height != std::numeric_limits<double>::infinity())
00494         {
00495             // We will scale both dimensions to fill all available space.
00496             return availableSize;
00497         }
00498         // One of the dimensions is infinite and we can't fill infinite dimensions, so
00499         // fall back to Uniform so at least the non-infinite dimension will be filled.
00500         break;
00501     case winrt::Stretch::UniformToFill:
00502         // Height and width will be scaled by the same amount such that there is no space
00503         // around the edges.
00504         if (availableSize.Width != std::numeric_limits<double>::infinity() && availableSize.Height != std::numeric_limits<double>::infinity())
00505         {
00506             // Scale so there is no space around the edge.
00507             const auto widthScale = availableSize.Width / m_animatedVisualSize.x;
00508             const auto heightScale = availableSize.Height / m_animatedVisualSize.y;
00509             auto measuredSize = (heightScale < widthScale)
00510                 ? winrt::Size{ availableSize.Width, m_animatedVisualSize.y * widthScale }
00511                 : winrt::Size{ m_animatedVisualSize.x * heightScale, availableSize.Height };
00512
00513             // Clip the size to the available size.
00514             measuredSize = winrt::Size{
00515                             std::min(measuredSize.Width, availableSize.Width),
00516                             std::min(measuredSize.Height, availableSize.Height)
00517             };
00518
00519             return measuredSize;
00520         }
00521         // One of the dimensions is infinite and we can't fill infinite dimensions, so
00522         // fall back to Uniform so at least the non-infinite dimension will be filled.
00523         break;
00524     } // end switch
00525
00526         // Uniform scaling.
00527         // Scale so that one dimension fits exactly and no dimension exceeds the boundary.
00528     const auto widthScale = ((availableSize.Width == std::numeric_limits<double>::infinity()) ? FLT_MAX : availableSize.Width) / m_animatedVisualSize.x;
00529     const auto heightScale = ((availableSize.Height == std::numeric_limits<double>::infinity()) ? FLT_MAX : availableSize.Height) / m_animatedVisualSize.y;
00530     return (heightScale > widthScale)
00531         ? winrt::Size{ availableSize.Width, m_animatedVisualSize.y * widthScale }
00532         : winrt::Size{ m_animatedVisualSize.x * heightScale, availableSize.Height };
00533 }
00534
00535 // Public API.
00536 // Overrides FrameworkElement::ArrangeOverride. Scales to fit the animated visual into finalSize
00537 // respecting the current Stretch and returns the size actually used.
00538 winrt::Size AnimatedVisualPlayer::ArrangeOverride(winrt::Size const& finalSize)
00539 {
00540     if (m_isFallenBack && Children().Size() > 0)
00541     {
00542         // We are showing the fallback content due to a failure to load an animated visual.
00543         // Tell the content to arrange itself.
00544         Children().GetAt(0).Arrange(winrt::Rect{ winrt::Point{0,0}, finalSize });
00545         return finalSize;
00546     }
00547
00548     winrt::float2 scale;
00549     winrt::float2 arrangedSize;
00550
00551     if (!m_animatedVisualRoot)
00552     {
00553         // No content. 0 size.
00554         scale = { 1, 1 };
00555         arrangedSize = { 0,0 };
00556     }
00557     else
00558     {
00559         const auto stretch = Stretch();
00560         if (stretch == winrt::Stretch::None)
00561         {
00562             // Do not scale, do not center.
00563             scale = { 1, 1 };
00564             arrangedSize = {
00565                 std::min(finalSize.Width, m_animatedVisualSize.x),
00566                 std::min(finalSize.Height, m_animatedVisualSize.y)
00567             };
00568         }
00569         else
00570         {
00571             scale = static_cast<winrt::float2>(finalSize) / m_animatedVisualSize;
00572
00573             switch (stretch)
00574             {
00575             case winrt::Stretch::Uniform:
00576                 // Scale both dimensions by the same amount.
00577                 if (scale.x < scale.y)
00578                 {
00579                     scale.y = scale.x;
00580                 }
00581                 else
00582                 {
00583                     scale.x = scale.y;
00584                 }
00585                 break;
00586             case winrt::Stretch::UniformToFill:
00587                 // Scale both dimensions by the same amount and leave no gaps around the edges.
00588                 if (scale.x > scale.y)
00589                 {
00590                     scale.y = scale.x;
00591                 }
00592                 else
00593                 {
00594                     scale.x = scale.y;
00595                 }
00596                 break;
00597             }
00598
00599             // A size needs to be set because there's an InsetClip applied, and without a
00600             // size the clip will prevent anything from being visible.
00601             arrangedSize = {
00602                 std::min(finalSize.Width / scale.x, m_animatedVisualSize.x),
00603                 std::min(finalSize.Height / scale.y, m_animatedVisualSize.y)
00604             };
00605
00606             // Center the animation within the available space.
00607             const auto offset = (finalSize - (m_animatedVisualSize * scale)) / 2;
00608             const auto z = 0.0F;
00609             m_rootVisual.Offset({ offset, z });
00610
00611             // Adjust the position of the clip.
00612             m_rootVisual.Clip().Offset(
00613                 (stretch == winrt::Stretch::UniformToFill)
00614                 ? -(offset / scale)
00615                 : winrt::float2::zero()
00616             );
00617         }
00618     }
00619
00620     m_rootVisual.Size(arrangedSize);
00621     const auto z = 1.0F;
00622     m_rootVisual.Scale({ scale, z });
00623
00624     return finalSize;
00625 }
00626
00627 // Public API.
00628 // Accessor for ProgressObject property.
00629 // NOTE: This is not a dependency property because it never changes and is not useful for binding.
00630 winrt::CompositionObject AnimatedVisualPlayer::ProgressObject()
00631 {
00632     return m_progressPropertySet;
00633 }
00634
00635 // Public API.
00636 // Pauses the currently playing animated visual, or does nothing if no play is underway.
00637 void AnimatedVisualPlayer::Pause()
00638 {
00639     if (m_nowPlaying)
00640     {
00641         m_nowPlaying->Pause();
00642     }
00643 }
00644
00645 // Public API.
00646 winrt::IAsyncAction AnimatedVisualPlayer::PlayAsync(double fromProgress, double toProgress, bool looped)
00647 {
00648     // Make sure that animations are created.
00649     CreateAnimations();
00650
00651     // Used to detect reentrance.
00652     const auto version = ++m_playAsyncVersion;
00653
00654     // Complete m_nowPlaying if it is still running.
00655     // Identical to Stop() call but without destroying the animations.
00656     // WARNING - this call may cause reentrance via the IsPlaying DP.
00657     if (m_nowPlaying)
00658     {
00659         m_progressPropertySet.InsertScalar(L"Progress", static_cast<float>(m_currentPlayFromProgress));
00660         m_nowPlaying->Complete();
00661     }
00662
00663     if (version != m_playAsyncVersion)
00664     {
00665         // The call was overtaken by another call due to reentrance.
00666         co_return;
00667     }
00668
00669     MUX_ASSERT(!m_nowPlaying);
00670
00671     // Adjust for the case where there is a segment that
00672     // goes from [fromProgress..0] where m_fromProgress > 0.
00673     // This is equivalent to [fromProgress..1], and by setting
00674     // toProgress to 1 it saves us from generating extra key frames.
00675     if (toProgress == 0 && fromProgress > 0)
00676     {
00677         toProgress = 1;
00678     }
00679
00680     // Adjust for the case where there is a segment that
00681     // goes from [1..toProgress] where toProgress > 0.
00682     // This is equivalent to [0..toProgress], and by setting
00683     // fromProgress to 0 it saves us from generating extra key frames.
00684     if (toProgress > 0 && fromProgress == 1)
00685     {
00686         fromProgress = 0;
00687     }
00688
00689     // Create an AnimationPlay to hold the play information.
00690     // Keep a copy of the pointer because reentrance may cause the m_nowPlaying
00691     // value to change.
00692     auto thisPlay = m_nowPlaying = std::make_shared<AnimationPlay>(
00693         *this,
00694         std::clamp(static_cast<float>(fromProgress), 0.0F, 1.0F),
00695         std::clamp(static_cast<float>(toProgress), 0.0F, 1.0F),
00696         looped);
00697
00698     if (IsAnimatedVisualLoaded())
00699     {
00700         // There is an animated visual loaded, so start it playing.
00701         // WARNING - this may cause reentrance via IsPlaying DP.
00702         thisPlay->Start();
00703     }
00704
00705     // Capture the context so we can finish in the calling thread.
00706     winrt::apartment_context calling_thread;
00707
00708     // Await the current play. The await will complete when the animation completes
00709     // or Stop() is called. It can complete on any thread.
00710     co_await *thisPlay;
00711
00712     // Get back to the calling thread.
00713     // This is necessary to destruct the AnimationPlay, and because callers
00714     // from the dispatcher thread will expect to continue on the dispatcher thread.
00715     co_await calling_thread;
00716 }
00717
00718 // Public API.
00719 void AnimatedVisualPlayer::Resume()
00720 {
00721     if (m_nowPlaying)
00722     {
00723         m_nowPlaying->Resume();
00724     }
00725 }
00726
00727 // Public API.
00728 // REENTRANCE SIDE EFFECT: IsPlaying DP via m_nowPlaying->Complete() or InsertScalar iff m_nowPlaying.
00729 void AnimatedVisualPlayer::SetProgress(double progress)
00730 {
00731     // Make sure that animations are created.
00732     CreateAnimations();
00733
00734     auto clampedProgress = std::clamp(static_cast<float>(progress), 0.0F, 1.0F);
00735
00736     // WARNING: Reentrance via IsPlaying DP may occur from this point down to the end of the method
00737     //          iff m_nowPlaying.
00738
00739     // Setting the Progress value will stop the current play.
00740     m_progressPropertySet.InsertScalar(L"Progress", static_cast<float>(clampedProgress));
00741
00742     // Ensure the current PlayAsync task is completed.
00743     // Note that this explicit call is necessary, even though InsertScalar
00744     // will stop the current animation, because the BatchCompleted event for
00745     // the animation only gets hooked up if the animation is not looped.
00746     // If there was a BatchCompleted event and it already fired from setting the Progress
00747     // value then Complete() is a no-op.
00748     if (m_nowPlaying)
00749     {
00750         m_nowPlaying->Complete();
00751     }
00752
00753     // If optimization is set to Resources - destroy annimations immediately.
00754     if (AnimationOptimization() == winrt::PlayerAnimationOptimization::Resources) {
00755         DestroyAnimations();
00756     }
00757 }
00758
00759 // Public API.
00760 // REENTRANCE SIDE EFFECT: IsPlaying DP via SetProgress(...) or InsertScalar iff m_nowPlaying.
00761 void AnimatedVisualPlayer::Stop()
00762 {
00763     if (m_nowPlaying)
00764     {
00765         // Stop the animation by setting the Progress value to the fromProgress of the
00766         // most recent play.
00767         // This may cause reentrance via the IsPlaying DP.
00768         SetProgress(m_currentPlayFromProgress);
00769     }
00770 }
00771
00772 void AnimatedVisualPlayer::OnAutoPlayPropertyChanged(
00773     winrt::DependencyPropertyChangedEventArgs const& args)
00774 {
00775     auto newValue = unbox_value<bool>(args.NewValue());
00776
00777     if (newValue && IsAnimatedVisualLoaded() && !m_nowPlaying)
00778     {
00779         // Start playing immediately.
00780         const auto from = 0;
00781         const auto to = 1;
00782         const auto looped = true;
00783         auto ignore = PlayAsync(from, to, looped);
00784     }
00785 }
00786
00787 void AnimatedVisualPlayer::OnAnimationOptimizationPropertyChanged(
00788     winrt::DependencyPropertyChangedEventArgs const& args)
00789 {
00790     auto optimization = unbox_value<winrt::PlayerAnimationOptimization>(args.NewValue());
00791
00792     if (m_nowPlaying)
00793     {
00794         // If there is something in play right now we should not create/destroy animations.
00795         return;
00796     }
00797
00798     if (optimization == winrt::PlayerAnimationOptimization::Resources)
00799     {
00800         DestroyAnimations();
00801     }
00802     else if (optimization == winrt::PlayerAnimationOptimization::Latency)
00803     {
00804         CreateAnimations();
00805     }
00806 }
00807
00808 void AnimatedVisualPlayer::CreateAnimations() {
00809     m_createAnimationsCounter++;
00810
00811     if (m_isAnimationsCreated || m_animatedVisual == nullptr)
00812     {
00813         return;
00814     }
00815
00816     // Check if current animated visual supports creating animations and create them.
00817     if (const auto& animatedVisual = m_animatedVisual.get())
00818     {
00819         if (const auto& animatedVisual2 = animatedVisual.try_as<winrt::IAnimatedVisual2>())
00820         {
00821             animatedVisual2.CreateAnimations();
00822             m_isAnimationsCreated = true;
00823         }
00824     }
00825 }
00826
00827 void AnimatedVisualPlayer::DestroyAnimations() {
00828     if (!m_isAnimationsCreated || m_animatedVisual == nullptr)
00829     {
00830         return;
00831     }
00832
00833     // Call RequestCommit to make sure that previous compositor calls complete before destroying animations.
00834     // RequestCommitAsync is available only for RS4+
00835     m_rootVisual.Compositor().RequestCommitAsync().Completed(
00836         [me_weak = get_weak(), createAnimationsCounter = m_createAnimationsCounter](auto, auto) {
00837             auto me = me_weak.get();
00838
00839             if (!me)
00840             {
00841                 return;
00842             }
00843
00844             // Check if there was any CreateAnimations call after DestroyAnimations.
00845             // We should not destroy animations in this case,
00846             // they will be destroyed by the following DestroyAnimations call.
00847             if (createAnimationsCounter != me->m_createAnimationsCounter) {
00848                 return;
00849             }
00850
00851             // Check if current animated visual supports destroyig animations.
00852             if (const auto& animatedVisual = me->m_animatedVisual.get())
00853             {
00854                 if (const auto& animatedVisual2 = animatedVisual.try_as<winrt::IAnimatedVisual2>())
00855                 {
00856                     animatedVisual2.DestroyAnimations();
00857                     me->m_isAnimationsCreated = false;
00858                 }
00859             }
00860         }
00861     );
00862 }
00863
00864 void AnimatedVisualPlayer::OnFallbackContentPropertyChanged(
00865     winrt::DependencyPropertyChangedEventArgs const& args)
00866 {
00867     if (m_isFallenBack)
00868     {
00869         LoadFallbackContent();
00870     }
00871 }
00872
00873 void AnimatedVisualPlayer::OnSourcePropertyChanged(
00874     winrt::DependencyPropertyChangedEventArgs const& args)
00875 {
00876     auto newSource = args.NewValue().as<winrt::IAnimatedVisualSource>();
00877
00878     // WARNING - this may cause reentrance via the IsPlaying DP iff m_nowPlaying.
00879     Stop();
00880
00881     // Disconnect from the update notifications of the old source.
00882     m_dynamicAnimatedVisualInvalidatedRevoker.revoke();
00883
00884     if (auto newDynamicSource = newSource.try_as<winrt::IDynamicAnimatedVisualSource>())
00885     {
00886         // Connect to the update notifications of the new source.
00887         m_dynamicAnimatedVisualInvalidatedRevoker
00888             = newDynamicSource.AnimatedVisualInvalidated(winrt::auto_revoke, [weakThis{ get_weak() }](
00889                 auto const& /*sender*/,
00890                 auto const& /*e*/)
00891         {
00892             if (auto strongThis = weakThis.get())
00893             {
00894                 strongThis->UpdateContent();
00895             }
00896         });
00897     }
00898
00899     UpdateContent();
00900 }
00901
00902 // Unload the current animated visual (if any).
00903 void AnimatedVisualPlayer::UnloadContent()
00904 {
00905     if (m_animatedVisualRoot)
00906     {
00907         // This will complete any current play.
00908         // WARNING - this may cause reentrance via IsPlaying DP iff m_nowPlaying.
00909         Stop();
00910
00911         // Remove the old animated visual (if any).
00912         auto animatedVisual = m_animatedVisual.get();
00913         if (animatedVisual)
00914         {
00915             m_rootVisual.Children().RemoveAll();
00916             m_animatedVisualRoot = nullptr;
00917             // Notify the animated visual that it will no longer be used.
00918             animatedVisual.as<winrt::IClosable>().Close();
00919             m_animatedVisual.set(nullptr);
00920         }
00921
00922         // Size has changed. Tell XAML to re-measure.
00923         InvalidateMeasure();
00924
00925         // WARNING - these may cause reentrance.
00926         Duration(winrt::TimeSpan{ 0 });
00927         Diagnostics(nullptr);
00928         // Set IsAnimatedVisualLoaded last as it is the property that is most likely
00929         // to have user code react to its state change.
00930         IsAnimatedVisualLoaded(false);
00931     }
00932 }
00933
00934 void AnimatedVisualPlayer::UpdateContent()
00935 {
00936     // Unload the existing content, if any.
00937     UnloadContent();
00938
00939     // Try to create a new animated visual.
00940     auto source = Source();
00941     if (!source)
00942     {
00943         // No source set. Nothing to do.
00944         return;
00945     }
00946
00947     winrt::IInspectable diagnostics{};
00948     winrt::IAnimatedVisual animatedVisual;
00949
00950     const bool createAnimations = AnimationOptimization() == winrt::PlayerAnimationOptimization::Latency;
00951
00952     if (auto source3 = source.try_as<winrt::IAnimatedVisualSource3>())
00953     {
00954         animatedVisual = source3.TryCreateAnimatedVisual(m_rootVisual.Compositor(), diagnostics, createAnimations);
00955         m_isAnimationsCreated = createAnimations;
00956         m_animatedVisual.set(animatedVisual);
00957     }
00958     else
00959     {
00960         animatedVisual = source.TryCreateAnimatedVisual(m_rootVisual.Compositor(), diagnostics);
00961         m_isAnimationsCreated = true;
00962
00963         // m_animatedVisual should be updated before DestroyAnimations call
00964         m_animatedVisual.set(animatedVisual);
00965
00966         // Destroy animations if we don't need them.
00967         // Old IAnimatedVisualSource interface always creates them.
00968         if (!createAnimations) {
00969             DestroyAnimations();
00970         }
00971     }
00972
00973     if (!animatedVisual)
00974     {
00975         // Create failed.
00976
00977         if (!m_isFallenBack)
00978         {
00979             // Show the fallback content, if any.
00980             m_isFallenBack = true;
00981             LoadFallbackContent();
00982         }
00983
00984         // Complete any play that was started during loading.
00985         // WARNING - this may cause reentrance via IsPlaying DP iff m_nowPlaying.
00986         Stop();
00987
00988         // WARNING - this may cause reentrance.
00989         Diagnostics(diagnostics);
00990
00991         return;
00992     }
00993
00994     // If the content is empty, do nothing. If we are in fallback from a previous
00995     // failure to load, stay fallen back.
00996     // Empty content means the source has nothing to show yet.
00997     if (!animatedVisual.RootVisual() || animatedVisual.Size() == winrt::float2::zero())
00998     {
00999         // WARNING - this may cause reentrance.
01000         Diagnostics(diagnostics);
01001
01002         return;
01003     }
01004
01005     // We have non-empty content to show.
01006     // If we were in fallback, clear that fallback content.
01007     if (m_isFallenBack)
01008     {
01009         // Get out of the fallback state.
01010         m_isFallenBack = false;
01011         UnloadFallbackContent();
01012     }
01013
01014     // Hook up the new animated visual.
01015     m_animatedVisualRoot = animatedVisual.RootVisual();
01016     m_animatedVisualSize = animatedVisual.Size();
01017     m_rootVisual.Children().InsertAtTop(m_animatedVisualRoot);
01018
01019     // Size has changed. Tell XAML to re-measure.
01020     InvalidateMeasure();
01021
01022     // Ensure the animated visual has a Progress property. This guarantees that a composition without
01023     // a Progress property won't blow up when we create an expression that references it below.
01024     // Normally the animated visual  would have a Progress property that all its expressions reference,
01025     // but just in case, insert it here.
01026     m_animatedVisualRoot.Properties().InsertScalar(L"Progress", 0.0F);
01027
01028     // Tie the animated visual's Progress property to the player Progress with an ExpressionAnimation.
01029     auto compositor = m_rootVisual.Compositor();
01030     auto progressAnimation = compositor.CreateExpressionAnimation(L"_.Progress");
01031     progressAnimation.SetReferenceParameter(L"_", m_progressPropertySet);
01032     m_animatedVisualRoot.Properties().StartAnimation(L"Progress", progressAnimation);
01033
01034     // WARNING - these may cause reentrance.
01035     // Set these properties before the if (AutoPlay()) branch calls PlayAsync(...)
01036     // so that the properties are updated before playing starts.
01037     Duration(animatedVisual.Duration());
01038     Diagnostics(diagnostics);
01039     // Set IsAnimatedVisualLoaded last as it is the property that is most likely
01040     // to have user code react to its state change.
01041     IsAnimatedVisualLoaded(true);
01042
01043     // Check whether playing has been started already via reentrance from a DP handler.
01044     if (m_nowPlaying)
01045     {
01046         m_nowPlaying->Start();
01047     }
01048     else if (AutoPlay())
01049     {
01050         // Start playing immediately.
01051         const auto from = 0;
01052         const auto to = 1;
01053         const auto looped = true;
01054         // NOTE: If !IsAnimatedVisualLoaded() then this is a no-op.
01055         auto ignore = PlayAsync(from, to, looped);
01056     }
01057 }
01058
01059 void AnimatedVisualPlayer::LoadFallbackContent()
01060 {
01061     MUX_ASSERT(m_isFallenBack);
01062
01063     winrt::UIElement fallbackContentElement{ nullptr };
01064     auto fallbackContentTemplate = FallbackContent();
01065     if (fallbackContentTemplate)
01066     {
01067         // Load the content from the DataTemplate. It should be a UIElement tree root.
01068         winrt::DependencyObject fallbackContentObject = fallbackContentTemplate.LoadContent();
01069         // Get the content.
01070         fallbackContentElement = fallbackContentObject.as<winrt::UIElement>();
01071     }
01072
01073     // Set the (possibly null) content. We allow null content so as to handle the
01074     // case where the fallback content got removed - in which case we want to
01075     // clear out the existing content if any.
01076     SetFallbackContent(fallbackContentElement);
01077 }
01078
01079 void AnimatedVisualPlayer::UnloadFallbackContent()
01080 {
01081     MUX_ASSERT(!m_isFallenBack);
01082     SetFallbackContent(nullptr);
01083 }
01084
01085 void AnimatedVisualPlayer::SetFallbackContent(winrt::UIElement const& uiElement)
01086 {
01087     // Clear out the existing content.
01088     Children().Clear();
01089
01090     // Place the content in the tree.
01091     if (uiElement)
01092     {
01093         Children().Append(uiElement);
01094     }
01095
01096     // Size has probably changed. Tell XAML to re-measure.
01097     InvalidateMeasure();
01098 }
01099
01100 void AnimatedVisualPlayer::OnPlaybackRatePropertyChanged(
01101     winrt::DependencyPropertyChangedEventArgs const& args)
01102 {
01103     if (m_nowPlaying)
01104     {
01105         m_nowPlaying->SetPlaybackRate(static_cast<float>(unbox_value<double>(args.NewValue())));
01106     }
01107 }
01108
01109 void AnimatedVisualPlayer::OnStretchPropertyChanged(
01110     winrt::DependencyPropertyChangedEventArgs const&)
01111 {
01112     InvalidateMeasure();
01113 }
Generated on Sun Dec 1 2024 20:51:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/ColorChangedEventArgs.h Source File

  • ColorPicker

ColorChangedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ColorChangedEventArgs.g.h"
00007
00008 class ColorChangedEventArgs :
00009     public winrt::implementation::ColorChangedEventArgsT<ColorChangedEventArgs>
00010 {
00011 public:
00012     // IColorChangedEventArgs overrides
00013     winrt::Color OldColor();
00014     winrt::Color NewColor();
00015
00016     void OldColor(winrt::Color const& value);
00017     void NewColor(winrt::Color const& value);
00018
00019 private:
00020     winrt::Color m_oldColor{};
00021     winrt::Color m_newColor{};
00022 };
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NonVirtualStackLayoutSamplePage Member List

This is the complete list of members for NonVirtualStackLayoutSamplePage, including all inherited members.
_numbers | NonVirtualStackLayoutSamplePage | [private]
_solidColorBrushGreen | NonVirtualStackLayoutSamplePage | [private]
_solidColorBrushRed | NonVirtualStackLayoutSamplePage | [private]
_uiElements | NonVirtualStackLayoutSamplePage | [private]
BtnClear1_Click(object sender, RoutedEventArgs e) | NonVirtualStackLayoutSamplePage | [inline, private]
BtnClear2_Click(object sender, RoutedEventArgs e) | NonVirtualStackLayoutSamplePage | [inline, private]
BtnInsert1_Click(object sender, RoutedEventArgs e) | NonVirtualStackLayoutSamplePage | [inline, private]
BtnInsert2_Click(object sender, RoutedEventArgs e) | NonVirtualStackLayoutSamplePage | [inline, private]
BtnRemoveAt1_Click(object sender, RoutedEventArgs e) | NonVirtualStackLayoutSamplePage | [inline, private]
BtnRemoveAt2_Click(object sender, RoutedEventArgs e) | NonVirtualStackLayoutSamplePage | [inline, private]
BtnReplace1_Click(object sender, RoutedEventArgs e) | NonVirtualStackLayoutSamplePage | [inline, private]
BtnReplace2_Click(object sender, RoutedEventArgs e) | NonVirtualStackLayoutSamplePage | [inline, private]
NonVirtualStackLayoutSamplePage() | NonVirtualStackLayoutSamplePage | [inline]
NonVirtualStackLayoutSamplePage() | NonVirtualStackLayoutSamplePage | [inline]
Generated on Sun Dec 1 2024 20:54:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedVisualPlayer/AnimatedVisualPlayerAutomationPeer.idl Source File

  • AnimatedVisualPlayer

AnimatedVisualPlayerAutomationPeer.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XAP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 unsealed runtimeclass AnimatedVisualPlayerAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer
00007 {
00008     AnimatedVisualPlayerAutomationPeer(MU_XC_NAMESPACE.AnimatedVisualPlayer owner);
00009 }
00010
00011 }
Generated on Sun Dec 1 2024 20:51:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/ScrollViewTestHooks.idl Source File

  • ScrollView

ScrollViewTestHooks.idl

Go to the documentation of this file.
00001 ﻿namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [default_interface]
00006 [webhosthidden]
00007 runtimeclass ScrollViewTestHooks
00008 {
00009     static Windows.Foundation.IReference<Boolean> GetAutoHideScrollControllers(MU_XC_NAMESPACE.ScrollView scrollView);
00010     static void SetAutoHideScrollControllers(MU_XC_NAMESPACE.ScrollView scrollView, Windows.Foundation.IReference<Boolean> value);
00011 }
00012
00013 }
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TeachingTip/InteractionTests/TeachingTipTests.cs Source File

  • TeachingTip
  • InteractionTests

TeachingTipTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00006 using System;
00007 using System.Numerics;
00008 using Common;
00009 using System.Threading.Tasks;
00010
00011 using WEX.TestExecution;
00012 using WEX.TestExecution.Markup;
00013 using WEX.Logging.Interop;
00014
00015 using Microsoft.Windows.Apps.Test.Automation;
00016 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00017 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00018 using Microsoft.Windows.Apps.Test.Foundation;
00019
00020 using static Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.TeachingTipTestPageElements;
00021 using System.Drawing;
00022 using System.Threading;
00023 using System.Diagnostics;
00024
00025 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00026 {
00027     [TestClass]
00028     public class TeachingTipTests
00029     {
00030         // The longest observed animated view change took 5.4 seconds, so 9 seconds is picked
00031         // as the default timeout so there is a reasonable margin for reliability.
00032         const double defaultAnimatedViewChangeTimeout = 9000;
00033
00034         TeachingTipTestPageElements elements;
00035
00036         [ClassInitialize]
00037         [TestProperty("RunAs", "User")]
00038         [TestProperty("Classification", "Integration")]
00039         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00040         [TestProperty("IsolationLevel", "Method")]
00041         public static void ClassInitialize(TestContext testContext)
00042         {
00043             TestEnvironment.Initialize(testContext);
00044         }
00045
00046         [TestCleanup]
00047         public void TestCleanup()
00048         {
00049             TestCleanupHelper.Cleanup();
00050         }
00051
00052         public TestContext TestContext { get; set; }
00053
00054         [TestMethod]
00055         [TestProperty("TestSuite", "A")]
00056         public void CloseReasonIsAccurate()
00057         {
00058             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00059             {
00060                 elements = new TeachingTipTestPageElements();
00061                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00062                 {
00063                     SetTeachingTipLocation(location);
00064
00065                     ScrollTargetIntoView();
00066                     OpenTeachingTip();
00067                     CloseTeachingTipProgrammatically();
00068                     var message0 = GetTeachingTipDebugMessage(0);
00069                     var message1 = GetTeachingTipDebugMessage(1);
00070                     Verify.IsTrue(message0.ToString().Contains("Closing"));
00071                     Verify.IsTrue(message0.ToString().Contains("Programmatic"));
00072                     Verify.IsTrue(message1.ToString().Contains("Closed"));
00073                     Verify.IsTrue(message1.ToString().Contains("Programmatic"));
00074
00075                     SetHeroContent(HeroContentOptions.NoContent);
00076                     OpenTeachingTip();
00077                     PressXCloseButton();
00078                     var message2 = GetTeachingTipDebugMessage(2);
00079                     var message3 = GetTeachingTipDebugMessage(3);
00080                     var message4 = GetTeachingTipDebugMessage(4);
00081                     Verify.IsTrue(message2.ToString().Contains("Close Button Clicked"));
00082                     Verify.IsTrue(message3.ToString().Contains("Closing"));
00083                     Verify.IsTrue(message3.ToString().Contains("CloseButton"));
00084                     Verify.IsTrue(message4.ToString().Contains("Closed"));
00085                     Verify.IsTrue(message4.ToString().Contains("CloseButton"));
00086
00087                     EnableLightDismiss(true);
00088                     OpenTeachingTip();
00089                     CloseTeachingTipProgrammatically();
00090                     var message5 = GetTeachingTipDebugMessage(5);
00091                     var message6 = GetTeachingTipDebugMessage(6);
00092                     Verify.IsTrue(message5.ToString().Contains("Closing"));
00093                     Verify.IsTrue(message5.ToString().Contains("Programmatic"));
00094                     Verify.IsTrue(message6.ToString().Contains("Closed"));
00095                     Verify.IsTrue(message6.ToString().Contains("Programmatic"));
00096
00097                     OpenTeachingTip();
00098                     CloseTeachingTipByLightDismiss(useEscKey: false);
00099                     var message7 = GetTeachingTipDebugMessage(7);
00100                     var message8 = GetTeachingTipDebugMessage(8);
00101                     Verify.IsTrue(message7.ToString().Contains("Closing"));
00102                     Verify.IsTrue(message7.ToString().Contains("LightDismiss"));
00103                     Verify.IsTrue(message8.ToString().Contains("Closed"));
00104                     Verify.IsTrue(message8.ToString().Contains("LightDismiss"));
00105
00106                     OpenTeachingTip();
00107                     CloseTeachingTipByLightDismiss(useEscKey: true);
00108                     var message9 = GetTeachingTipDebugMessage(9);
00109                     var message10 = GetTeachingTipDebugMessage(10);
00110                     Verify.IsTrue(message9.ToString().Contains("Closing"));
00111                     Verify.IsTrue(message9.ToString().Contains("LightDismiss"));
00112                     Verify.IsTrue(message10.ToString().Contains("Closed"));
00113                     Verify.IsTrue(message10.ToString().Contains("LightDismiss"));
00114
00115                     SetCloseButtonContent(CloseButtonContentOptions.ShortText);
00116                     OpenTeachingTip();
00117                     PressTipCloseButton();
00118                     var message11 = GetTeachingTipDebugMessage(11);
00119                     var message12 = GetTeachingTipDebugMessage(12);
00120                     var message13 = GetTeachingTipDebugMessage(13);
00121                     Verify.IsTrue(message11.ToString().Contains("Close Button Clicked"));
00122                     Verify.IsTrue(message12.ToString().Contains("Closing"));
00123                     Verify.IsTrue(message12.ToString().Contains("CloseButton"));
00124                     Verify.IsTrue(message13.ToString().Contains("Closed"));
00125                     Verify.IsTrue(message13.ToString().Contains("CloseButton"));
00126
00127                     ClearTeachingTipDebugMessages();
00128                 }
00129             }
00130         }
00131
00132         [TestMethod]
00133         [TestProperty("TestSuite", "A")]
00134         public void TargetUnloadingClosesTeachingTip()
00135         {
00136             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00137             {
00138                 elements = new TeachingTipTestPageElements();
00139                 elements.GetSetTargetButton().InvokeAndWait();
00140                 OpenTeachingTip();
00141
00142                 CheckBox unloadedCheckbox = elements.GetTeachingTipContentUnloadedCheck();
00143                 Verify.IsTrue(unloadedCheckbox.ToggleState == ToggleState.Off);
00144
00145                 // Removing target button from visual tree
00146                 Button remove = elements.GetRemoveOpenButtonFromVisualTreeButton();
00147                 remove.InvokeAndWait();
00148
00149                 // Target unloaded, TeachingTip must do the same
00150                 Verify.IsTrue(unloadedCheckbox.ToggleState == ToggleState.On);
00151             }
00152         }
00153
00154         [TestMethod]
00155         [TestProperty("TestSuite", "A")]
00156         public void PreviousTargetUnloadingLeavesTeachingTipOpen()
00157         {
00158             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00159             {
00160                 elements = new TeachingTipTestPageElements();
00161                 elements.GetSetTargetButton().InvokeAndWait();
00162                 elements.GetRemoveTargetButton().InvokeAndWait();
00163                 OpenTeachingTip();
00164
00165                 CheckBox unloadedCheckbox = elements.GetTeachingTipContentUnloadedCheck();
00166                 Verify.IsTrue(unloadedCheckbox.ToggleState == ToggleState.Off);
00167
00168
00169                 // Removing target button from visual tree
00170                 Button remove = elements.GetRemoveOpenButtonFromVisualTreeButton();
00171                 remove.InvokeAndWait();
00172
00173                 // We expect the teaching tip to still be upon since it has no target
00174                 Verify.IsTrue(unloadedCheckbox.ToggleState == ToggleState.Off);
00175             }
00176         }
00177
00178         [TestMethod]
00179         [TestProperty("TestSuite", "A")]
00180         public void TeachingTipRemovalClosesPopup()
00181         {
00182             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00183             {
00184                 elements = new TeachingTipTestPageElements();
00185                 ScrollTargetIntoView();
00186                 OpenTeachingTip();
00187
00188                 CheckBox unloadedCheckbox = elements.GetTeachingTipContentUnloadedCheck();
00189                 Verify.IsTrue(unloadedCheckbox.ToggleState == ToggleState.Off);
00190
00191                 // Finding the button to remove the teaching tip
00192                 Button removeButton = elements.GetRemoveTeachingTipButton();
00193
00194                 // Removing teaching tip
00195
00196                 removeButton.InvokeAndWait();
00197                 Verify.IsTrue(unloadedCheckbox.ToggleState == ToggleState.On);
00198                 Verify.IsTrue(elements.GetIsOpenCheckBox().ToggleState == ToggleState.Off);
00199             }
00200         }
00201
00202         [TestMethod]
00203         [TestProperty("TestSuite", "A")]
00204         public void TipCanFollowTarget()
00205         {
00206             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00207             {
00208                 elements = new TeachingTipTestPageElements();
00209                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00210                 {
00211                     SetTeachingTipLocation(location);
00212
00213                     ScrollTargetIntoView();
00214                     Wait.ForIdle();
00215                     OpenTeachingTip();
00216                     double initialTipVerticalOffset = GetTipVerticalOffset();
00217                     double initialScrollViewerVerticalOffset = GetScrollViewerVerticalOffset();
00218
00219                     ScrollBy(10);
00220                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset + 10);
00221                     Equals(GetTipVerticalOffset(), initialTipVerticalOffset);
00222                     ScrollBy(-20);
00223                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset - 10);
00224                     Wait.ForIdle();
00225                     Equals(GetTipVerticalOffset(), initialTipVerticalOffset);
00226                     ScrollBy(10);
00227                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset);
00228                     Equals(GetTipVerticalOffset(), initialTipVerticalOffset);
00229
00230                     SetTipFollowsTarget(true);
00231
00232                     ScrollBy(10);
00233                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset + 10);
00234                     Verify.IsLessThan(GetTipVerticalOffset(), initialTipVerticalOffset);
00235                     ScrollBy(-20);
00236                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset - 10);
00237                     Wait.ForIdle();
00238                     Verify.IsGreaterThan(GetTipVerticalOffset(), initialTipVerticalOffset);
00239                     ScrollBy(10);
00240                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset);
00241                     Equals(GetTipVerticalOffset(), initialTipVerticalOffset);
00242
00243                     SetTipFollowsTarget(false);
00244
00245                     ScrollBy(10);
00246                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset + 10);
00247                     Equals(GetTipVerticalOffset(), initialTipVerticalOffset);
00248                     ScrollBy(-20);
00249                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset - 10);
00250                     Wait.ForIdle();
00251                     Equals(GetTipVerticalOffset(), initialTipVerticalOffset);
00252                     ScrollBy(10);
00253                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset);
00254                     Equals(GetTipVerticalOffset(), initialTipVerticalOffset);
00255                 }
00256             }
00257         }
00258
00259         [TestMethod]
00260         [TestProperty("TestSuite", "A")]
00261         [TestProperty("Ignore", "True")] // #2219 Unreliable test: TeachingTipTests.TipFollowsTargetOnWindowResize
00262         public void TipFollowsTargetOnWindowResize()
00263         {
00264             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00265             {
00266                 elements = new TeachingTipTestPageElements();
00267                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00268                 {
00269                     SetTeachingTipLocation(location);
00270
00271                     ScrollTargetIntoView();
00272                     Wait.ForIdle();
00273                     OpenTeachingTip();
00274                     double initialTipVerticalOffset = GetTipVerticalOffset();
00275                     double initialScrollViewerVerticalOffset = GetScrollViewerVerticalOffset();
00276
00277                     ScrollBy(10);
00278                     WaitForOffsetUpdated(initialScrollViewerVerticalOffset + 10);
00279                     Equals(GetTipVerticalOffset(), initialTipVerticalOffset);
00280
00281                     //Unmaximize then maximize the window, to force a window size changed event.
00282                     KeyboardHelper.PressKey(Key.Down, ModifierKey.Windows);
00283                     Wait.ForIdle();
00284                     KeyboardHelper.PressKey(Key.Up, ModifierKey.Windows);
00285                     Wait.ForIdle();
00286
00287                     Verify.IsLessThan(GetTipVerticalOffset(), initialTipVerticalOffset);
00288                 }
00289
00290                 // Test for bug #1547
00291                 // Maximize window first.
00292                 var getOnEdgeOffsetButton = elements.GetTeachingTipOnEdgeOffsetButton();
00293                 KeyboardHelper.PressKey(Key.Up, ModifierKey.Windows);
00294                 Wait.ForIdle();
00295
00296                 // Open TeachingTip
00297                 elements.GetOpenTeachingTipOnEdgeButton().InvokeAndWait();
00298
00299                 // Get offset values
00300                 getOnEdgeOffsetButton.InvokeAndWait();
00301                 double oldXOffset = elements.GetTeachingTipOnEdgeHorizontalOffset();
00302
00303                 // "Restore" window width (aka unminimize)
00304                 KeyboardHelper.PressKey(Key.Down, ModifierKey.Windows);
00305                 getOnEdgeOffsetButton.InvokeAndWait();
00306                 Verify.IsLessThan(elements.GetTeachingTipOnEdgeHorizontalOffset(), oldXOffset);
00307
00308                 // Update values
00309                 getOnEdgeOffsetButton.InvokeAndWait();
00310                 oldXOffset = elements.GetTeachingTipOnEdgeHorizontalOffset();
00311
00312                 // Maximize again
00313                 KeyboardHelper.PressKey(Key.Up, ModifierKey.Windows);
00314                 getOnEdgeOffsetButton.InvokeAndWait();
00315                 Verify.IsGreaterThan(elements.GetTeachingTipOnEdgeHorizontalOffset(), oldXOffset);
00316             }
00317         }
00318
00319         [TestMethod]
00320         [TestProperty("TestSuite", "B")]
00321         [TestProperty("Ignore", "True")] // Disabled as per tracking issue #3125
00322         public void AutoPlacement()
00323         {
00324             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00325             {
00326                 elements = new TeachingTipTestPageElements();
00327                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00328                 {
00329                     SetTeachingTipLocation(location);
00330
00331                     ScrollTargetIntoView();
00332                     ScrollBy(10);
00333                     var targetRect = GetTargetBounds();
00334                     TestAutoPlacementForWindowOrScreenBounds(targetRect, true);
00335
00336                     SetShouldConstrainToRootBounds(false);
00337                     TestAutoPlacementForWindowOrScreenBounds(targetRect, false, "Top");
00338
00339                     SetReturnTopForOutOfWindowPlacement(false);
00340                     TestAutoPlacementForWindowOrScreenBounds(targetRect, false);
00341
00342                     SetReturnTopForOutOfWindowPlacement(true);
00343                 }
00344             }
00345         }
00346
00347         [TestMethod]
00348         [TestProperty("TestSuite", "B")]
00349         [TestProperty("Ignore", "True")]
00350         [TestProperty("data:TipLocationOptions", "{ResourceDictionary, VisualTree}")]
00351         [TestProperty("data:TestCase", "{1, 2, 3, 4, 5}")]
00352         public void SpecifiedPlacement()
00353         {
00354             var tipLocationOptionsStr = this.TestContext.DataRow["TipLocationOptions"] as string;
00355             TipLocationOptions location = Enum.Parse<TipLocationOptions>(tipLocationOptionsStr);
00356
00357             var testCaseStr = this.TestContext.DataRow["TestCase"] as string;
00358
00359             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00360             {
00361                 elements = new TeachingTipTestPageElements();
00362
00363                 SetTeachingTipLocation(location);
00364
00365                 ScrollTargetIntoView();
00366                 ScrollBy(10);
00367
00368                 SetHeroContent(HeroContentOptions.NoContent);
00369
00370                 var targetRect = GetTargetBounds();
00371
00372                 // The following might not always work, so repeat.
00373                 UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true);
00374
00375                 switch(testCaseStr)
00376                 {
00377                     case "1":
00378                         {
00379                             // All positions are valid
00380                             UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true);
00381
00382                             SetPreferredPlacement(PlacementOptions.Top);
00383                             VerifyPlacement("Top");
00384                             SetPreferredPlacement(PlacementOptions.Bottom);
00385                             VerifyPlacement("Bottom");
00386                             SetPreferredPlacement(PlacementOptions.Left);
00387                             VerifyPlacement("Left");
00388                             SetPreferredPlacement(PlacementOptions.Right);
00389                             VerifyPlacement("Right");
00390                             SetPreferredPlacement(PlacementOptions.TopRight);
00391                             VerifyPlacement("TopRight");
00392                             SetPreferredPlacement(PlacementOptions.TopLeft);
00393                             VerifyPlacement("TopLeft");
00394                             SetPreferredPlacement(PlacementOptions.BottomRight);
00395                             VerifyPlacement("BottomRight");
00396                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00397                             VerifyPlacement("BottomLeft");
00398                             SetPreferredPlacement(PlacementOptions.LeftTop);
00399                             VerifyPlacement("LeftTop");
00400                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00401                             VerifyPlacement("LeftBottom");
00402                             SetPreferredPlacement(PlacementOptions.RightTop);
00403                             VerifyPlacement("RightTop");
00404                             SetPreferredPlacement(PlacementOptions.RightBottom);
00405                             VerifyPlacement("RightBottom");
00406                             SetPreferredPlacement(PlacementOptions.Center);
00407                             VerifyPlacement("Center");
00408                         }
00409                         break;
00410                     case "2":
00411                         {
00412                             // Eliminate left of the target
00413                             UseTestBounds(targetRect.W - 120, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true);
00414
00415                             SetPreferredPlacement(PlacementOptions.Top);
00416                             VerifyPlacement("Top");
00417                             SetPreferredPlacement(PlacementOptions.Bottom);
00418                             VerifyPlacement("Bottom");
00419                             SetPreferredPlacement(PlacementOptions.Left);
00420                             VerifyPlacement("Right");
00421                             SetPreferredPlacement(PlacementOptions.Right);
00422                             VerifyPlacement("Right");
00423                             SetPreferredPlacement(PlacementOptions.TopRight);
00424                             VerifyPlacement("TopRight");
00425                             SetPreferredPlacement(PlacementOptions.TopLeft);
00426                             VerifyPlacement("Top");
00427                             SetPreferredPlacement(PlacementOptions.BottomRight);
00428                             VerifyPlacement("BottomRight");
00429                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00430                             VerifyPlacement("Bottom");
00431                             SetPreferredPlacement(PlacementOptions.LeftTop);
00432                             VerifyPlacement("Right");
00433                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00434                             VerifyPlacement("Right");
00435                             SetPreferredPlacement(PlacementOptions.RightTop);
00436                             VerifyPlacement("RightTop");
00437                             SetPreferredPlacement(PlacementOptions.RightBottom);
00438                             VerifyPlacement("RightBottom");
00439                             SetPreferredPlacement(PlacementOptions.Center);
00440                             VerifyPlacement("Center");
00441                         }
00442                         break;
00443                     case "3":
00444                         {
00445                             // Eliminate top of the target
00446                             UseTestBounds(targetRect.W - 500, targetRect.X - 1, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true);
00447
00448                             SetPreferredPlacement(PlacementOptions.Top);
00449                             VerifyPlacement("Bottom");
00450                             SetPreferredPlacement(PlacementOptions.Bottom);
00451                             VerifyPlacement("Bottom");
00452                             SetPreferredPlacement(PlacementOptions.Left);
00453                             VerifyPlacement("Left");
00454                             SetPreferredPlacement(PlacementOptions.Right);
00455                             VerifyPlacement("Right");
00456                             SetPreferredPlacement(PlacementOptions.TopRight);
00457                             VerifyPlacement("Bottom");
00458                             SetPreferredPlacement(PlacementOptions.TopLeft);
00459                             VerifyPlacement("Bottom");
00460                             SetPreferredPlacement(PlacementOptions.BottomRight);
00461                             VerifyPlacement("BottomRight");
00462                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00463                             VerifyPlacement("BottomLeft");
00464                             SetPreferredPlacement(PlacementOptions.LeftTop);
00465                             VerifyPlacement("LeftTop");
00466                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00467                             VerifyPlacement("LeftBottom");
00468                             SetPreferredPlacement(PlacementOptions.RightTop);
00469                             VerifyPlacement("RightTop");
00470                             SetPreferredPlacement(PlacementOptions.RightBottom);
00471                             VerifyPlacement("RightBottom");
00472                             SetPreferredPlacement(PlacementOptions.Center);
00473                             VerifyPlacement("Center");
00474                         }
00475                         break;
00476                     case "4":
00477                         {
00478                             // Eliminate right of the target
00479                             UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 500, targetRect.Z + 1000, targetRect, true);
00480
00481                             SetPreferredPlacement(PlacementOptions.Top);
00482                             VerifyPlacement("Left");
00483                             SetPreferredPlacement(PlacementOptions.Bottom);
00484                             VerifyPlacement("Left");
00485                             SetPreferredPlacement(PlacementOptions.Left);
00486                             VerifyPlacement("Left");
00487                             SetPreferredPlacement(PlacementOptions.Right);
00488                             VerifyPlacement("Left");
00489                             SetPreferredPlacement(PlacementOptions.TopRight);
00490                             VerifyPlacement("Left");
00491                             SetPreferredPlacement(PlacementOptions.TopLeft);
00492                             VerifyPlacement("TopLeft");
00493                             SetPreferredPlacement(PlacementOptions.BottomRight);
00494                             VerifyPlacement("Left");
00495                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00496                             VerifyPlacement("BottomLeft");
00497                             SetPreferredPlacement(PlacementOptions.LeftTop);
00498                             VerifyPlacement("LeftTop");
00499                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00500                             VerifyPlacement("LeftBottom");
00501                             SetPreferredPlacement(PlacementOptions.RightTop);
00502                             VerifyPlacement("Left");
00503                             SetPreferredPlacement(PlacementOptions.RightBottom);
00504                             VerifyPlacement("Left");
00505                             SetPreferredPlacement(PlacementOptions.Center);
00506                             VerifyPlacement("Left");
00507                         }
00508                         break;
00509                     case "5":
00510                         {
00511                             // Eliminate bottom of target
00512                             UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 501, targetRect, true);
00513
00514                             SetPreferredPlacement(PlacementOptions.Top);
00515                             VerifyPlacement("Top");
00516                             SetPreferredPlacement(PlacementOptions.Bottom);
00517                             VerifyPlacement("Top");
00518                             SetPreferredPlacement(PlacementOptions.Left);
00519                             VerifyPlacement("Left");
00520                             SetPreferredPlacement(PlacementOptions.Right);
00521                             VerifyPlacement("Right");
00522                             SetPreferredPlacement(PlacementOptions.TopRight);
00523                             VerifyPlacement("TopRight");
00524                             SetPreferredPlacement(PlacementOptions.TopLeft);
00525                             VerifyPlacement("TopLeft");
00526                             SetPreferredPlacement(PlacementOptions.BottomRight);
00527                             VerifyPlacement("Top");
00528                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00529                             VerifyPlacement("Top");
00530                             SetPreferredPlacement(PlacementOptions.LeftTop);
00531                             VerifyPlacement("LeftTop");
00532                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00533                             VerifyPlacement("LeftBottom");
00534                             SetPreferredPlacement(PlacementOptions.RightTop);
00535                             VerifyPlacement("RightTop");
00536                             SetPreferredPlacement(PlacementOptions.RightBottom);
00537                             VerifyPlacement("RightBottom");
00538                             SetPreferredPlacement(PlacementOptions.Center);
00539                             VerifyPlacement("Center");
00540                         }
00541                         break;
00542                     default:
00543                         {
00544                             Verify.Fail($"Unknown TestCase {testCaseStr}");
00545                         }
00546                         break;
00547                 }
00548             }
00549         }
00550
00551         [TestMethod]
00552         [TestProperty("TestSuite", "B")]
00553         [TestProperty("Ignore", "True")]
00554         [TestProperty("data:TipLocationOptions", "{ResourceDictionary, VisualTree}")]
00555         [TestProperty("data:TestCase", "{1, 2, 3, 4, 5}")]
00556         public void SpecifiedPlacementRTL()
00557         {
00558             var tipLocationOptionsStr = this.TestContext.DataRow["TipLocationOptions"] as string;
00559             TipLocationOptions location = Enum.Parse<TipLocationOptions>(tipLocationOptionsStr);
00560
00561             var testCaseStr = this.TestContext.DataRow["TestCase"] as string;
00562
00563             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00564             {
00565                 elements = new TeachingTipTestPageElements();
00566
00567                 SetTeachingTipLocation(location);
00568
00569                 ScrollTargetIntoView();
00570                 ScrollBy(10);
00571
00572                 elements.GetPageRTLCheckbox().Check();
00573
00574                 SetHeroContent(HeroContentOptions.NoContent);
00575
00576                 var targetRect = GetTargetBounds();
00577
00578                 // The following might not always work, so repeat.
00579                 UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true);
00580
00581                 switch (testCaseStr)
00582                 {
00583                     case "1":
00584                         {
00585                             // All positions are valid
00586                             UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true);
00587
00588                             SetPreferredPlacement(PlacementOptions.Top);
00589                             VerifyPlacement("Top");
00590                             SetPreferredPlacement(PlacementOptions.Bottom);
00591                             VerifyPlacement("Bottom");
00592                             SetPreferredPlacement(PlacementOptions.Left);
00593                             VerifyPlacement("Right");
00594                             SetPreferredPlacement(PlacementOptions.Right);
00595                             VerifyPlacement("Left");
00596                             SetPreferredPlacement(PlacementOptions.TopRight);
00597                             VerifyPlacement("TopLeft");
00598                             SetPreferredPlacement(PlacementOptions.TopLeft);
00599                             VerifyPlacement("TopRight");
00600                             SetPreferredPlacement(PlacementOptions.BottomRight);
00601                             VerifyPlacement("BottomLeft");
00602                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00603                             VerifyPlacement("BottomRight");
00604                             SetPreferredPlacement(PlacementOptions.LeftTop);
00605                             VerifyPlacement("RightTop");
00606                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00607                             VerifyPlacement("RightBottom");
00608                             SetPreferredPlacement(PlacementOptions.RightTop);
00609                             VerifyPlacement("LeftTop");
00610                             SetPreferredPlacement(PlacementOptions.RightBottom);
00611                             VerifyPlacement("LeftBottom");
00612                             SetPreferredPlacement(PlacementOptions.Center);
00613                             VerifyPlacement("Center");
00614                         }
00615                         break;
00616                     case "2":
00617                         {
00618                             // Eliminate left of the target
00619                             UseTestBounds(targetRect.W - 120, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true);
00620
00621                             SetPreferredPlacement(PlacementOptions.Top);
00622                             VerifyPlacement("Top");
00623                             SetPreferredPlacement(PlacementOptions.Bottom);
00624                             VerifyPlacement("Bottom");
00625                             SetPreferredPlacement(PlacementOptions.Left);
00626                             VerifyPlacement("Right");
00627                             SetPreferredPlacement(PlacementOptions.Right);
00628                             VerifyPlacement("Right");
00629                             SetPreferredPlacement(PlacementOptions.TopRight);
00630                             VerifyPlacement("Top");
00631                             SetPreferredPlacement(PlacementOptions.TopLeft);
00632                             VerifyPlacement("TopRight");
00633                             SetPreferredPlacement(PlacementOptions.BottomRight);
00634                             VerifyPlacement("Bottom");
00635                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00636                             VerifyPlacement("BottomRight");
00637                             SetPreferredPlacement(PlacementOptions.LeftTop);
00638                             VerifyPlacement("RightTop");
00639                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00640                             VerifyPlacement("RightBottom");
00641                             SetPreferredPlacement(PlacementOptions.RightTop);
00642                             VerifyPlacement("Right");
00643                             SetPreferredPlacement(PlacementOptions.RightBottom);
00644                             VerifyPlacement("Right");
00645                             SetPreferredPlacement(PlacementOptions.Center);
00646                             VerifyPlacement("Center");
00647                         }
00648                         break;
00649                     case "3":
00650                         {
00651                             // Eliminate top of the target
00652                             UseTestBounds(targetRect.W - 500, targetRect.X - 1, targetRect.Y + 1000, targetRect.Z + 1000, targetRect, true);
00653
00654                             SetPreferredPlacement(PlacementOptions.Top);
00655                             VerifyPlacement("Bottom");
00656                             SetPreferredPlacement(PlacementOptions.Bottom);
00657                             VerifyPlacement("Bottom");
00658                             SetPreferredPlacement(PlacementOptions.Left);
00659                             VerifyPlacement("Right");
00660                             SetPreferredPlacement(PlacementOptions.Right);
00661                             VerifyPlacement("Left");
00662                             SetPreferredPlacement(PlacementOptions.TopRight);
00663                             VerifyPlacement("Bottom");
00664                             SetPreferredPlacement(PlacementOptions.TopLeft);
00665                             VerifyPlacement("Bottom");
00666                             SetPreferredPlacement(PlacementOptions.BottomRight);
00667                             VerifyPlacement("BottomLeft");
00668                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00669                             VerifyPlacement("BottomRight");
00670                             SetPreferredPlacement(PlacementOptions.LeftTop);
00671                             VerifyPlacement("RightTop");
00672                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00673                             VerifyPlacement("RightBottom");
00674                             SetPreferredPlacement(PlacementOptions.RightTop);
00675                             VerifyPlacement("LeftTop");
00676                             SetPreferredPlacement(PlacementOptions.RightBottom);
00677                             VerifyPlacement("LeftBottom");
00678                             SetPreferredPlacement(PlacementOptions.Center);
00679                             VerifyPlacement("Center");
00680                         }
00681                         break;
00682                     case "4":
00683                         {
00684                             // Eliminate right of the target
00685                             UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 500, targetRect.Z + 1000, targetRect, true);
00686
00687                             SetPreferredPlacement(PlacementOptions.Top);
00688                             VerifyPlacement("Left");
00689                             SetPreferredPlacement(PlacementOptions.Bottom);
00690                             VerifyPlacement("Left");
00691                             SetPreferredPlacement(PlacementOptions.Left);
00692                             VerifyPlacement("Left");
00693                             SetPreferredPlacement(PlacementOptions.Right);
00694                             VerifyPlacement("Left");
00695                             SetPreferredPlacement(PlacementOptions.TopRight);
00696                             VerifyPlacement("TopLeft");
00697                             SetPreferredPlacement(PlacementOptions.TopLeft);
00698                             VerifyPlacement("Left");
00699                             SetPreferredPlacement(PlacementOptions.BottomRight);
00700                             VerifyPlacement("BottomLeft");
00701                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00702                             VerifyPlacement("Left");
00703                             SetPreferredPlacement(PlacementOptions.LeftTop);
00704                             VerifyPlacement("Left");
00705                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00706                             VerifyPlacement("Left");
00707                             SetPreferredPlacement(PlacementOptions.RightTop);
00708                             VerifyPlacement("LeftTop");
00709                             SetPreferredPlacement(PlacementOptions.RightBottom);
00710                             VerifyPlacement("LeftBottom");
00711                             SetPreferredPlacement(PlacementOptions.Center);
00712                             VerifyPlacement("Left");
00713                         }
00714                         break;
00715                     case "5":
00716                         {
00717                             // Eliminate bottom of target
00718                             UseTestBounds(targetRect.W - 500, targetRect.X - 500, targetRect.Y + 1000, targetRect.Z + 501, targetRect, true);
00719
00720                             SetPreferredPlacement(PlacementOptions.Top);
00721                             VerifyPlacement("Top");
00722                             SetPreferredPlacement(PlacementOptions.Bottom);
00723                             VerifyPlacement("Top");
00724                             SetPreferredPlacement(PlacementOptions.Left);
00725                             VerifyPlacement("Right");
00726                             SetPreferredPlacement(PlacementOptions.Right);
00727                             VerifyPlacement("Left");
00728                             SetPreferredPlacement(PlacementOptions.TopRight);
00729                             VerifyPlacement("TopLeft");
00730                             SetPreferredPlacement(PlacementOptions.TopLeft);
00731                             VerifyPlacement("TopRight");
00732                             SetPreferredPlacement(PlacementOptions.BottomRight);
00733                             VerifyPlacement("Top");
00734                             SetPreferredPlacement(PlacementOptions.BottomLeft);
00735                             VerifyPlacement("Top");
00736                             SetPreferredPlacement(PlacementOptions.LeftTop);
00737                             VerifyPlacement("RightTop");
00738                             SetPreferredPlacement(PlacementOptions.LeftBottom);
00739                             VerifyPlacement("RightBottom");
00740                             SetPreferredPlacement(PlacementOptions.RightTop);
00741                             VerifyPlacement("LeftTop");
00742                             SetPreferredPlacement(PlacementOptions.RightBottom);
00743                             VerifyPlacement("LeftBottom");
00744                             SetPreferredPlacement(PlacementOptions.Center);
00745                             VerifyPlacement("Center");
00746                         }
00747                         break;
00748                     default:
00749                         {
00750                             Verify.Fail($"Unknown TestCase {testCaseStr}");
00751                         }
00752                         break;
00753                 }
00754
00755                 elements.GetPageRTLCheckbox().Uncheck();
00756             }
00757         }
00758
00759
00760         [TestMethod]
00761         [TestProperty("TestSuite", "B")]
00762         public void NoIconDoesNotCrash()
00763         {
00764             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00765             {
00766                 elements = new TeachingTipTestPageElements();
00767
00768                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00769                 {
00770                     SetTeachingTipLocation(location);
00771
00772                     ScrollTargetIntoView();
00773                     ScrollBy(10);
00774
00775                     SetIcon(IconOptions.NoIcon);
00776                     OpenTeachingTip();
00777                     CloseTeachingTipProgrammatically();
00778                     SetIcon(IconOptions.People);
00779                     OpenTeachingTip();
00780                     SetIcon(IconOptions.NoIcon);
00781                 }
00782             }
00783         }
00784
00785
00786         [TestMethod]
00787         [TestProperty("TestSuite", "B")]
00788         public void CanSwitchShouldConstrainToRootBounds()
00789         {
00790             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00791             {
00792                 elements = new TeachingTipTestPageElements();
00793
00794                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00795                 {
00796                     SetTeachingTipLocation(location);
00797
00798                     ScrollTargetIntoView();
00799                     ScrollBy(10);
00800                     OpenTeachingTip();
00801                     CloseTeachingTipProgrammatically();
00802                     SetShouldConstrainToRootBounds(false);
00803                     OpenTeachingTip();
00804                     CloseTeachingTipProgrammatically();
00805                     SetShouldConstrainToRootBounds(true);
00806                     OpenTeachingTip();
00807                     CloseTeachingTipProgrammatically();
00808                     OpenTeachingTip();
00809                     SetShouldConstrainToRootBounds(false);
00810                     CloseTeachingTipProgrammatically();
00811                     OpenTeachingTip();
00812                     SetShouldConstrainToRootBounds(true);
00813                     CloseTeachingTipProgrammatically();
00814                     OpenTeachingTip();
00815                     CloseTeachingTipProgrammatically();
00816                 }
00817             }
00818         }
00819
00820
00821         [TestMethod]
00822         [TestProperty("TestSuite", "B")]
00823         public void TipsWhichDoNotFitDoNotOpen()
00824         {
00825             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00826             {
00827                 elements = new TeachingTipTestPageElements();
00828
00829                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00830                 {
00831                     SetTeachingTipLocation(location);
00832
00833                     ScrollTargetIntoView();
00834                     ScrollBy(10);
00835                     UseTestWindowBounds(10, 10, 10, 10);
00836
00837
00838                     elements.GetShowButton().InvokeAndWait();
00839
00840                     var message1 = GetTeachingTipDebugMessage(1);
00841                     Verify.IsTrue(message1.ToString().Contains("Closed"));
00842                     Verify.IsTrue(message1.ToString().Contains("Programmatic"));
00843
00844                     UseTestScreenBounds(10, 10, 10, 10);
00845                     SetShouldConstrainToRootBounds(false);
00846
00847                     OpenTeachingTip();
00848
00849                     VerifyPlacement("Top");
00850
00851                     ClearTeachingTipDebugMessages();
00852                 }
00853             }
00854         }
00855
00856
00857         [TestMethod]
00858         [TestProperty("TestSuite", "B")]
00859         public void VerifyTheming()
00860         {
00861             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00862             {
00863                 elements = new TeachingTipTestPageElements();
00864                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00865                 {
00866                     SetTeachingTipLocation(location);
00867
00868                     SetActionButtonContentTo("Small text");
00869
00870                     ScrollTargetIntoView();
00871                     OpenTeachingTip();
00872
00873                     var themingComboBox = elements.GetThemingComboBox();
00874                     themingComboBox.SelectItemByName("Light");
00875
00876                     // Substring removes the opacity of the color, as that may vary
00877                     Verify.AreEqual("000000", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText().Substring(3), "Default button foreground should be black");
00878                     Verify.AreEqual("000000", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText().Substring(3), "Default content foreground should be black");
00879
00880                     // Change to Dark, make sure the font switches to light
00881                     themingComboBox.SelectItemByName("Dark");
00882
00883                     Verify.AreEqual("FFFFFF", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText().Substring(3), "Default button foreground should be white");
00884                     Verify.AreEqual("FFFFFF", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText().Substring(3), "Default content foreground should be white");
00885
00886                     // Change to Light, make sure the font switches to dark
00887                     themingComboBox.SelectItemByName("Light");
00888
00889                     Verify.AreEqual("000000", elements.GetEffectiveForegroundOfTeachingTipButtonTextBlock().GetText().Substring(3), "Default button foreground should be black");
00890                     Verify.AreEqual("000000", elements.GetEffectiveForegroundOfTeachingTipContentTextBlock().GetText().Substring(3), "Default content foreground should be black");
00891                 }
00892             }
00893         }
00894
00895         [TestMethod] //Disabled with issue #1769
00896         [TestProperty("TestSuite", "B")]
00897         [TestProperty("Ignore", "True")]
00898         public void SettingTitleOrSubtitleToEmptyStringCollapsesTextBox()
00899         {
00900             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00901             {
00902                 elements = new TeachingTipTestPageElements();
00903                 foreach (TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
00904                 {
00905                     SetTeachingTipLocation(location);
00906                     ScrollTargetIntoView();
00907                     OpenTeachingTip();
00908                     Verify.AreEqual("Visible", elements.GetTitleVisibilityTextBlock().GetText());
00909                     Verify.AreEqual("Visible", elements.GetSubtitleVisibilityTextBlock().GetText());
00910                     SetTitle(TitleContentOptions.No);
00911                     Verify.AreEqual("Collapsed", elements.GetTitleVisibilityTextBlock().GetText());
00912                     Verify.AreEqual("Visible", elements.GetSubtitleVisibilityTextBlock().GetText());
00913                     SetSubtitle(SubtitleContentOptions.No);
00914                     Verify.AreEqual("Collapsed", elements.GetTitleVisibilityTextBlock().GetText());
00915                     Verify.AreEqual("Collapsed", elements.GetSubtitleVisibilityTextBlock().GetText());
00916                 }
00917             }
00918         }
00919
00920         [TestMethod]
00921         [TestProperty("TestSuite", "C")]
00922         public void TestTeachingTipInXamlPage()
00923         {
00924             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTipInXamlPage Test" }))
00925             {
00926                 var elements = new TeachingTipTestPageElements();
00927                 Wait.ForIdle();
00928
00929                 Verify.AreEqual(ToggleState.On, elements.GetIsOpenCheckBox().ToggleState, "isOpenCheckBox.ToggleState");
00930
00931                 var teachingTipContent = FindElement.ByName<TextBlock>("TeachingTipContent");
00932                 Verify.IsNotNull(teachingTipContent, "teachingTipContent");
00933
00934                 var teachingTipCloseButton = FindElement.ByName<Button>("TeachingTipCloseButton");
00935                 Verify.IsNotNull(teachingTipCloseButton, "teachingTipCloseButton");
00936
00937                 teachingTipCloseButton.Invoke();
00938
00939                 WaitForUnchecked(elements.GetIsOpenCheckBox());
00940                 WaitForChecked(elements.GetIsIdleCheckBox());
00941                 Wait.ForIdle();
00942             }
00943         }
00944
00945         private void TestAutoPlacementForWindowOrScreenBounds(Vector4 targetRect, bool forWindowBounds)
00946         {
00947             TestAutoPlacementForWindowOrScreenBounds(targetRect, forWindowBounds, null);
00948         }
00949
00950         private void TestAutoPlacementForWindowOrScreenBounds(Vector4 targetRect, bool forWindowBounds, string valueOverride)
00951         {
00952             Log.Comment($"TestAutoPlacementForWindowOrScreenBounds {targetRect}, {forWindowBounds}, {valueOverride}");
00953             UseTestBounds(targetRect.W - 329, targetRect.X - 340, targetRect.Y + 656, targetRect.Z + 680, targetRect, forWindowBounds);
00954             VerifyPlacement(valueOverride ?? "Top");
00955             UseTestBounds(targetRect.W - 329, targetRect.X - 336, targetRect.Y + 656, targetRect.Z + 680, targetRect, forWindowBounds);
00956             VerifyPlacement(valueOverride ?? "Bottom");
00957             UseTestBounds(targetRect.W - 329, targetRect.X - 318, targetRect.Y + 659, targetRect.Z + 640, targetRect, forWindowBounds);
00958             VerifyPlacement(valueOverride ?? "LeftTop");
00959             UseTestBounds(targetRect.W - 329, targetRect.X - 100, targetRect.Y + 659, targetRect.Z + 403, targetRect, forWindowBounds);
00960             VerifyPlacement(valueOverride ?? "LeftBottom");
00961             UseTestBounds(targetRect.W - 327, targetRect.X - 100, targetRect.Y + 659, targetRect.Z + 403, targetRect, forWindowBounds);
00962             VerifyPlacement(valueOverride ?? "RightBottom");
00963             UseTestBounds(targetRect.W - 327, targetRect.X - 300, targetRect.Y + 659, targetRect.Z + 603, targetRect, forWindowBounds);
00964             VerifyPlacement(valueOverride ?? "RightTop");
00965             UseTestBounds(targetRect.W - 327, targetRect.X - 340, targetRect.Y + 349, targetRect.Z + 608, targetRect, forWindowBounds);
00966             VerifyPlacement(valueOverride ?? "TopLeft");
00967             UseTestBounds(targetRect.W - 20, targetRect.X - 340, targetRect.Y + 348, targetRect.Z + 608, targetRect, forWindowBounds);
00968             VerifyPlacement(valueOverride ?? "TopRight");
00969             UseTestBounds(targetRect.W - 327, targetRect.X - 100, targetRect.Y + 349, targetRect.Z + 444, targetRect, forWindowBounds);
00970             VerifyPlacement(valueOverride ?? "BottomLeft");
00971             UseTestBounds(targetRect.W - 20, targetRect.X - 100, targetRect.Y + 349, targetRect.Z + 444, targetRect, forWindowBounds);
00972             VerifyPlacement(valueOverride ?? "BottomRight");
00973             UseTestBounds(targetRect.W - 327, targetRect.X - 318, targetRect.Y + 650, targetRect.Z + 444, targetRect, forWindowBounds);
00974             VerifyPlacement(valueOverride ?? "Center");
00975
00976             // Remove the hero content;
00977             SetHeroContent(HeroContentOptions.NoContent);
00978
00979             UseTestBounds(targetRect.W - 329, targetRect.X - 100, targetRect.Y + 349, targetRect.Z + 20, targetRect, forWindowBounds);
00980             VerifyPlacement(valueOverride ?? "Left");
00981             UseTestBounds(targetRect.W - 19, targetRect.X - 100, targetRect.Y + 349, targetRect.Z + 20, targetRect, forWindowBounds);
00982             VerifyPlacement(valueOverride ?? "Right");
00983
00984             SetHeroContent(HeroContentOptions.RedSquare);
00985         }
00986
00987         private void VerifyPlacement(String placement)
00988         {
00989             OpenTeachingTip();
00990             Verify.AreEqual(placement, GetEffectivePlacement(), "VerifyPlacement");
00991             CloseTeachingTipProgrammatically();
00992         }
00993
00994         [TestMethod]
00995         [TestProperty("TestSuite", "C")]
00996         public void AutomationNameIsForwardedToPopup()
00997         {
00998             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
00999             {
01000                 elements = new TeachingTipTestPageElements();
01001                 foreach(TipLocationOptions location in Enum.GetValues(typeof(TipLocationOptions)))
01002                 {
01003                     SetTeachingTipLocation(location);
01004
01005                     ScrollTargetIntoView();
01006                     ScrollBy(10);
01007                     OpenTeachingTip();
01008                     Verify.IsNotNull(FindElement.ByNameAndClassName(location == TipLocationOptions.VisualTree ? "TeachingTipInVisualTree" : "TeachingTipInResources", "Popup"));
01009                     SetAutomationName(AutomationNameOptions.None);
01010                     Verify.IsNotNull(FindElement.ByNameAndClassName("We've Added Auto Saving!", "Popup"));
01011                     SetAutomationName(location == TipLocationOptions.VisualTree ? AutomationNameOptions.VisualTree : AutomationNameOptions.Resources);
01012                     CloseTeachingTipProgrammatically();
01013                 }
01014             }
01015         }
01016
01017         [TestMethod]
01018         [TestProperty("TestSuite", "C")]
01019         [TestProperty("Ignore", "True")]
01020         public void F6PutsFocusOnCloseButton()
01021         {
01022             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
01023             {
01024                 elements = new TeachingTipTestPageElements();
01025                 ScrollTargetIntoView();
01026                 ScrollBy(10);
01027                 OpenTeachingTip();
01028                 CloseOpenAndCloseWithJustKeyboardViaF6();
01029                 SetCloseButtonContent(CloseButtonContentOptions.ShortText);
01030                 OpenTeachingTip();
01031                 CloseOpenAndCloseWithJustKeyboardViaF6();
01032                 OpenTeachingTip();
01033                 UseF6ToReturnToTestPageToCloseTip();
01034                 SetCloseButtonContent(CloseButtonContentOptions.NoText);
01035             }
01036         }
01037
01038         [TestMethod]
01039         [TestProperty("TestSuite", "C")]
01040         public void VerifyTeachingTipNotIncludedInTabOrder()
01041         {
01042             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTipFocus Test" }))
01043             {
01044                 var elements = new TeachingTipFocusTestPageElements();
01045                 var openTeachingTipButton = elements.GetOpenButton();
01046
01047                 FocusHelper.SetFocus(openTeachingTipButton);
01048
01049                 Log.Comment("Verify open button has keyboard focus.");
01050                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01051
01052                 Log.Comment("Verify that a closed teaching tip does not appear in tab order.");
01053                 KeyboardHelper.PressKey(Key.Tab);
01054                 Wait.ForIdle();
01055                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01056
01057                 Log.Comment("Verify that an opened teaching tip does not appear in tab order.");
01058                 OpenTeachingTip();
01059                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01060                 KeyboardHelper.PressKey(Key.Tab);
01061                 Wait.ForIdle();
01062                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01063
01064                 Log.Comment("Switch to light-dismissable teaching tip.");
01065                 CloseTeachingTipProgrammatically();
01066                 EnableLightDismiss();
01067
01068                 Log.Comment("Verify that a closed light-dismissable teaching tip does not appear in tab order.");
01069
01070                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01071                 KeyboardHelper.PressKey(Key.Tab);
01072                 Wait.ForIdle();
01073                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01074
01075                 void OpenTeachingTip()
01076                 {
01077                     if (elements.GetIsOpenCheckBox().ToggleState != ToggleState.On)
01078                     {
01079                         openTeachingTipButton.InvokeAndWait();
01080                         WaitForChecked(elements.GetIsOpenCheckBox());
01081                         WaitForChecked(elements.GetIsIdleCheckBox());
01082                     }
01083                 }
01084
01085                 void CloseTeachingTipProgrammatically()
01086                 {
01087                     if (elements.GetIsOpenCheckBox().ToggleState != ToggleState.Off)
01088                     {
01089                         elements.GetCloseButton().InvokeAndWait();
01090                         WaitForUnchecked(elements.GetIsOpenCheckBox());
01091                         WaitForChecked(elements.GetIsIdleCheckBox());
01092                     }
01093                 }
01094
01095                 void EnableLightDismiss()
01096                 {
01097                     var isLightDismissEnabledCheckBox = elements.GetIsLightDismissEnabledCheckBox();
01098                     if (isLightDismissEnabledCheckBox.ToggleState != ToggleState.On)
01099                     {
01100                         isLightDismissEnabledCheckBox.Check();
01101                         WaitForChecked(isLightDismissEnabledCheckBox);
01102                     }
01103                 }
01104             }
01105         }
01106
01107         [TestMethod]
01108         [TestProperty("TestSuite", "C")]
01109         public void VerifyTeachingTipButtonsNameAutomationProperty()
01110         {
01111             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
01112             {
01113                 elements = new TeachingTipTestPageElements();
01114
01115                 SetActionButtonContentTo("Small text");
01116                 SetCloseButtonContent(CloseButtonContentOptions.ShortText);
01117
01118                 OpenTeachingTip();
01119
01120                 var actionButton = FindElement.ById("ActionButton");
01121                 var closeButton = FindElement.ById("CloseButton");
01122
01123                 Log.Comment("Verify that action and close buttons content presenter text will update the buttons name automation property");
01124                 Verify.AreEqual(actionButton.Name, "A:Short Text.");
01125                 Verify.AreEqual(closeButton.Name, "C:Short Text.");
01126             }
01127         }
01128
01129         [TestMethod]
01130         [TestProperty("TestSuite", "C")]
01131         public void VerifyTeachingTipGetsFocus()
01132         {
01133             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTipFocus Test" }))
01134             {
01135                 var elements = new TeachingTipFocusTestPageElements();
01136                 var openTeachingTipButton = elements.GetOpenButton();
01137
01138                 FocusHelper.SetFocus(openTeachingTipButton);
01139                 OpenTeachingTip();
01140
01141                 Log.Comment("Verify that an opened teaching tip get focus on F6");
01142                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01143                 KeyboardHelper.PressKey(Key.F6);
01144                 Wait.ForIdle();
01145                 var closeButton = elements.GetTeachingTipCloseButton();
01146                 Verify.IsTrue(closeButton.HasKeyboardFocus);
01147                 KeyboardHelper.PressKey(Key.F6);
01148                 Wait.ForIdle();
01149                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01150
01151                 Log.Comment("Switch to light-dismissable teaching tip.");
01152                 CloseTeachingTipProgrammatically();
01153                 EnableLightDismiss();
01154
01155                 Log.Comment("Verify that a light-dismissable teaching tip gets focus on opening");
01156                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01157                 OpenTeachingTip();
01158                 Wait.ForIdle();
01159                 closeButton = elements.GetTeachingTipCloseButton();
01160                 Verify.IsTrue(closeButton.HasKeyboardFocus);
01161                 KeyboardHelper.PressKey(Key.Escape);
01162                 Wait.ForIdle();
01163                 Verify.IsTrue(openTeachingTipButton.HasKeyboardFocus);
01164
01165                 void OpenTeachingTip()
01166                 {
01167                     if (elements.GetIsOpenCheckBox().ToggleState != ToggleState.On)
01168                     {
01169                         openTeachingTipButton.InvokeAndWait();
01170                         WaitForChecked(elements.GetIsOpenCheckBox());
01171                         WaitForChecked(elements.GetIsIdleCheckBox());
01172                     }
01173                 }
01174
01175                 void CloseTeachingTipProgrammatically()
01176                 {
01177                     if (elements.GetIsOpenCheckBox().ToggleState != ToggleState.Off)
01178                     {
01179                         elements.GetCloseButton().InvokeAndWait();
01180                         WaitForUnchecked(elements.GetIsOpenCheckBox());
01181                         WaitForChecked(elements.GetIsIdleCheckBox());
01182                     }
01183                 }
01184
01185                 void EnableLightDismiss()
01186                 {
01187                     var isLightDismissEnabledCheckBox = elements.GetIsLightDismissEnabledCheckBox();
01188                     if (isLightDismissEnabledCheckBox.ToggleState != ToggleState.On)
01189                     {
01190                         isLightDismissEnabledCheckBox.Check();
01191                         WaitForChecked(isLightDismissEnabledCheckBox);
01192                     }
01193                 }
01194             }
01195         }
01196
01197         [TestMethod]
01198         [TestProperty("TestSuite", "C")]
01199         public void VerifyTeachingTipTargetChange()
01200         {
01201             using (var setup = new TestSetupHelper(new[] { "TeachingTip Tests", "TeachingTip Test" }))
01202             {
01203                 elements = new TeachingTipTestPageElements();
01204
01205                 OpenTeachingTip();
01206
01207                 double oldYOffset = GetTipVerticalOffset();
01208
01209                 elements.GetSwitchTargetButton().InvokeAndWait();
01210
01211                 double newYOffset = GetTipVerticalOffset();
01212
01213                 Verify.IsFalse(oldYOffset == newYOffset);
01214             }
01215         }
01216
01217         private void CloseOpenAndCloseWithJustKeyboardViaF6()
01218         {
01219             KeyboardHelper.PressKey(Key.F6);
01220             KeyboardHelper.PressKey(Key.Enter);
01221             WaitForTipClosed();
01222             KeyboardHelper.PressKey(Key.Enter);
01223             WaitForTipOpened();
01224             KeyboardHelper.PressKey(Key.F6);
01225             KeyboardHelper.PressKey(Key.Enter);
01226             WaitForTipClosed();
01227         }
01228         private void UseF6ToReturnToTestPageToCloseTip()
01229         {
01230             KeyboardHelper.PressKey(Key.F6);
01231             KeyboardHelper.PressKey(Key.Tab);
01232             KeyboardHelper.PressKey(Key.F6);
01233             KeyboardHelper.PressKey(Key.Tab);
01234             KeyboardHelper.PressKey(Key.Enter);
01235             WaitForTipClosed();
01236         }
01237
01238         private void ScrollTargetIntoView()
01239         {
01240             elements.GetBringTargetIntoViewButton().Invoke();
01241             Wait.ForIdle();
01242         }
01243
01244         private void OpenTeachingTip()
01245         {
01246             if(elements.GetIsOpenCheckBox().ToggleState != ToggleState.On)
01247             {
01248                 elements.GetShowButton().InvokeAndWait();
01249                 WaitForChecked(elements.GetIsOpenCheckBox());
01250                 WaitForChecked(elements.GetIsIdleCheckBox());
01251             }
01252         }
01253
01254         private void CloseTeachingTipProgrammatically()
01255         {
01256             if (elements.GetIsOpenCheckBox().ToggleState != ToggleState.Off)
01257             {
01258                 elements.GetCloseButton().InvokeAndWait();
01259                 WaitForTipClosed();
01260             }
01261         }
01262
01263         private void CloseTeachingTipByLightDismiss(bool useEscKey)
01264         {
01265             if (elements.GetIsOpenCheckBox().ToggleState != ToggleState.Off)
01266             {
01267                 if (useEscKey)
01268                 {
01269                     KeyboardHelper.PressKey(Key.Escape);
01270                 }
01271                 else
01272                 {
01273                     InputHelper.LeftClick(elements.GetActionButtonContentComboBox());
01274                 }
01275
01276                 WaitForTipClosed();
01277             }
01278         }
01279
01280         private void PressXCloseButton()
01281         {
01282             if (elements.GetIsOpenCheckBox().ToggleState != ToggleState.Off)
01283             {
01284                 InputHelper.LeftClick(elements.GetTeachingTipAlternateCloseButton());
01285                 WaitForTipClosed();
01286             }
01287         }
01288
01289         private void PressTipCloseButton()
01290         {
01291             if (elements.GetIsOpenCheckBox().ToggleState != ToggleState.Off)
01292             {
01293                 InputHelper.LeftClick(elements.GetTeachingTipCloseButton());
01294                 WaitForTipClosed();
01295             }
01296         }
01297
01298         private void WaitForTipOpened()
01299         {
01300             WaitForChecked(elements.GetIsOpenCheckBox());
01301             WaitForChecked(elements.GetIsIdleCheckBox());
01302         }
01303
01304         private void WaitForTipClosed()
01305         {
01306             WaitForUnchecked(elements.GetIsOpenCheckBox());
01307             WaitForChecked(elements.GetIsIdleCheckBox());
01308         }
01309
01310         private void SetTeachingTipLocation(TipLocationOptions location)
01311         {
01312             switch(location)
01313             {
01314                 case TipLocationOptions.ResourceDictionary:
01315                     elements.GetTipLocationComboBox().SelectItemByName("Resources");
01316                     break;
01317                 default:
01318                     elements.GetTipLocationComboBox().SelectItemByName("VisualTree");
01319                     break;
01320             }
01321             elements.GetSetTipLocationButton().Invoke();
01322             //If a tip was open this action would cause that tip to close, so wait until that happens
01323             WaitForUnchecked(elements.GetIsOpenCheckBox());
01324             WaitForChecked(elements.GetIsIdleCheckBox());
01325
01326             SetTipIsTargeted(true);
01327         }
01328
01329         private void EnableLightDismiss(bool enable)
01330         {
01331             if(enable)
01332             {
01333                 elements.GetIsLightDismissEnabledComboBox().SelectItemByName("True");
01334             }
01335             else
01336             {
01337                 elements.GetIsLightDismissEnabledComboBox().SelectItemByName("False");
01338             }
01339             elements.GetIsLightDismissEnabledButton().InvokeAndWait();
01340         }
01341
01342         private void SetShouldConstrainToRootBounds(bool constrain)
01343         {
01344             if(constrain)
01345             {
01346                 elements.GetShouldConstrainToRootBoundsComboBox().SelectItemByName("True");
01347             }
01348             else
01349             {
01350                 elements.GetShouldConstrainToRootBoundsComboBox().SelectItemByName("False");
01351             }
01352             elements.GetShouldConstrainToRootBoundsButton().InvokeAndWait();
01353         }
01354
01355         private void SetCloseButtonContent(CloseButtonContentOptions closeButtonContent)
01356         {
01357             switch(closeButtonContent)
01358             {
01359                 case CloseButtonContentOptions.NoText:
01360                     elements.GetCloseButtonContentComboBox().SelectItemByName("No text");
01361                     break;
01362                 case CloseButtonContentOptions.ShortText:
01363                     elements.GetCloseButtonContentComboBox().SelectItemByName("Small text");
01364                     break;
01365                 case CloseButtonContentOptions.LongText:
01366                     elements.GetCloseButtonContentComboBox().SelectItemByName("Long text");
01367                     break;
01368             }
01369             elements.GetSetCloseButtonContentButton().InvokeAndWait();
01370         }
01371
01372         private void SetPreferredPlacement(PlacementOptions placement)
01373         {
01374             switch (placement)
01375             {
01376                 case PlacementOptions.Top:
01377                     elements.GetPreferredPlacementComboBox().SelectItemByName("Top");
01378                     break;
01379                 case PlacementOptions.Bottom:
01380                     elements.GetPreferredPlacementComboBox().SelectItemByName("Bottom");
01381                     break;
01382                 case PlacementOptions.Left:
01383                     elements.GetPreferredPlacementComboBox().SelectItemByName("Left");
01384                     break;
01385                 case PlacementOptions.Right:
01386                     elements.GetPreferredPlacementComboBox().SelectItemByName("Right");
01387                     break;
01388                 case PlacementOptions.TopRight:
01389                     elements.GetPreferredPlacementComboBox().SelectItemByName("TopRight");
01390                     break;
01391                 case PlacementOptions.TopLeft:
01392                     elements.GetPreferredPlacementComboBox().SelectItemByName("TopLeft");
01393                     break;
01394                 case PlacementOptions.BottomRight:
01395                     elements.GetPreferredPlacementComboBox().SelectItemByName("BottomRight");
01396                     break;
01397                 case PlacementOptions.BottomLeft:
01398                     elements.GetPreferredPlacementComboBox().SelectItemByName("BottomLeft");
01399                     break;
01400                 case PlacementOptions.LeftTop:
01401                     elements.GetPreferredPlacementComboBox().SelectItemByName("LeftTop");
01402                     break;
01403                 case PlacementOptions.LeftBottom:
01404                     elements.GetPreferredPlacementComboBox().SelectItemByName("LeftBottom");
01405                     break;
01406                 case PlacementOptions.RightTop:
01407                     elements.GetPreferredPlacementComboBox().SelectItemByName("RightTop");
01408                     break;
01409                 case PlacementOptions.RightBottom:
01410                     elements.GetPreferredPlacementComboBox().SelectItemByName("RightBottom");
01411                     break;
01412                 case PlacementOptions.Center:
01413                     elements.GetPreferredPlacementComboBox().SelectItemByName("Center");
01414                     break;
01415                 default:
01416                     elements.GetPreferredPlacementComboBox().SelectItemByName("Auto");
01417                     break;
01418             }
01419             elements.GetSetPreferredPlacementButton().InvokeAndWait();
01420         }
01421
01422         private void SetHeroContent(HeroContentOptions heroContent)
01423         {
01424             switch (heroContent)
01425             {
01426                 case HeroContentOptions.RedSquare:
01427                     elements.GetHeroContentComboBox().SelectItemByName("Red Square");
01428                     break;
01429                 case HeroContentOptions.BlueSquare:
01430                     elements.GetHeroContentComboBox().SelectItemByName("Blue Square");
01431                     break;
01432                 case HeroContentOptions.Image:
01433                     elements.GetHeroContentComboBox().SelectItemByName("Image");
01434                     break;
01435                 default:
01436                     elements.GetHeroContentComboBox().SelectItemByName("No Content");
01437                     break;
01438             }
01439             elements.GetSetHeroContentButton().InvokeAndWait();
01440         }
01441
01442         private void SetTitle(TitleContentOptions title)
01443         {
01444             switch(title)
01445             {
01446                 case TitleContentOptions.Long:
01447                     elements.GetTitleComboBox().SelectItemByName("Long text");
01448                     break;
01449                 case TitleContentOptions.Small:
01450                     elements.GetTitleComboBox().SelectItemByName("Samell text");
01451                     break;
01452                 case TitleContentOptions.No:
01453                     elements.GetTitleComboBox().SelectItemByName("No title");
01454                     break;
01455             }
01456             elements.GetSetTitleButton().InvokeAndWait();
01457         }
01458
01459         private void SetSubtitle(SubtitleContentOptions subtitle)
01460         {
01461             switch (subtitle)
01462             {
01463                 case SubtitleContentOptions.Long:
01464                     elements.GetSubtitleComboBox().SelectItemByName("Long text");
01465                     break;
01466                 case SubtitleContentOptions.Small:
01467                     elements.GetSubtitleComboBox().SelectItemByName("Small text");
01468                     break;
01469                 case SubtitleContentOptions.No:
01470                     elements.GetSubtitleComboBox().SelectItemByName("No subtitle");
01471                     break;
01472             }
01473             elements.GetSetSubtitleButton().InvokeAndWait();
01474         }
01475
01476         private void SetTipIsTargeted(bool targeted)
01477         {
01478             if(targeted)
01479             {
01480                 elements.GetSetTargetButton().InvokeAndWait();
01481             }
01482             else
01483             {
01484                 elements.GetRemoveTargetButton().InvokeAndWait();
01485             }
01486         }
01487
01488         private void SetIcon(IconOptions icon)
01489         {
01490             switch(icon)
01491             {
01492                 case IconOptions.People:
01493                     elements.GetIconComboBox().SelectItemByName("People Icon");
01494                     break;
01495                 default:
01496                     elements.GetIconComboBox().SelectItemByName("No Icon");
01497                     break;
01498             }
01499             elements.GetSetIconButton().InvokeAndWait();
01500         }
01501
01502         private double GetTipVerticalOffset()
01503         {
01504             return double.Parse(elements.GetPopupVerticalOffsetTextBlock().GetText());
01505         }
01506
01507         private double GetScrollViewerVerticalOffset()
01508         {
01509             return double.Parse(elements.GetScrollViewerOffsetTextBox().GetText());
01510         }
01511
01512         private void ScrollBy(double ammount)
01513         {
01514             double initialOffset = double.Parse(elements.GetScrollViewerOffsetTextBox().GetText());
01515             elements.GetScrollViewerOffsetTextBox().SetValue((initialOffset + ammount).ToString());
01516             elements.GetScrollViewerOffsetButton().InvokeAndWait();
01517         }
01518
01519         private void UseTestBounds(double x, double y, double width, double height, Vector4 targetRect, bool forWindowBounds)
01520         {
01521             if (forWindowBounds)
01522             {
01523                 UseTestWindowBounds(x, y, width, height);
01524             }
01525             else
01526             {
01527                 UseTestWindowBounds(targetRect.W - 1, targetRect.X - 1, targetRect.Y + 1, targetRect.Z + 1);
01528                 UseTestScreenBounds(x, y, width, height);
01529             }
01530         }
01531
01532         private void UseTestWindowBounds(double x, double y, double width, double height)
01533         {
01534             elements.GetTestWindowBoundsXTextBox().SetValue(x.ToString());
01535             elements.GetTestWindowBoundsYTextBox().SetValue(y.ToString());
01536             elements.GetTestWindowBoundsWidthTextBox().SetValue(width.ToString());
01537             elements.GetTestWindowBoundsHeightTextBox().SetValue(height.ToString());
01538
01539             elements.GetUseTestWindowBoundsCheckbox().Uncheck();
01540
01541             elements.GetUseTestWindowBoundsCheckbox().Check();
01542         }
01543
01544         private void UseTestScreenBounds(double x, double y, double width, double height)
01545         {
01546             elements.GetTestScreenBoundsXTextBox().SetValue(x.ToString());
01547             elements.GetTestScreenBoundsYTextBox().SetValue(y.ToString());
01548             elements.GetTestScreenBoundsWidthTextBox().SetValue(width.ToString());
01549             elements.GetTestScreenBoundsHeightTextBox().SetValue(height.ToString());
01550
01551             elements.GetUseTestWindowBoundsCheckbox().Uncheck();
01552             elements.GetUseTestScreenBoundsCheckbox().Uncheck();
01553             elements.GetUseTestScreenBoundsCheckbox().Check();
01554             elements.GetUseTestWindowBoundsCheckbox().Check();
01555         }
01556
01557         private void SetTipFollowsTarget(bool tipFollowsTarget)
01558         {
01559             if(tipFollowsTarget)
01560             {
01561                 elements.GetTipFollowsTargetCheckBox().Check();
01562             }
01563             else
01564             {
01565                 elements.GetTipFollowsTargetCheckBox().Uncheck();
01566             }
01567         }
01568
01569         private void SetReturnTopForOutOfWindowPlacement(bool returnTopForOutOfWindowPlacement)
01570         {
01571             if (returnTopForOutOfWindowPlacement)
01572             {
01573                 elements.GetReturnTopForOutOfWindowPlacementCheckBox().Check();
01574             }
01575             else
01576             {
01577                 elements.GetReturnTopForOutOfWindowPlacementCheckBox().Uncheck();
01578             }
01579         }
01580
01581         Vector4 GetTargetBounds()
01582         {
01583             elements.GetTargetBoundsButton().InvokeAndWait();
01584
01585             var retVal = new Vector4();
01586             retVal.W = (int)Math.Floor(double.Parse(elements.GetTargetXOffsetTextBlock().GetText()));
01587             retVal.X = (int)Math.Floor(double.Parse(elements.GetTargetYOffsetTextBlock().GetText()));
01588             retVal.Y = (int)Math.Floor(double.Parse(elements.GetTargetWidthTextBlock().GetText()));
01589             retVal.Z = (int)Math.Floor(double.Parse(elements.GetTargetHeightTextBlock().GetText()));
01590             return retVal;
01591         }
01592
01593         private string GetEffectivePlacement()
01594         {
01595             try
01596             {
01597                 // The first call to this can sometimes return a stale value or throw an exception (E_UNEXPECTED)
01598                 // on older OSes like RS3 and earlier. Call it once and ignore the value, then call it again seems
01599                 // to be all that's needed to work around. Presumably this is happening because the app is changing
01600                 // the TextBlock's value in quick succession and there's either a UIA caching bug or a XAML framework
01601                 // issue that has since been fixed.
01602                 elements.GetEffectivePlacementTextBlock().GetText();
01603             }
01604             catch { }
01605             return elements.GetEffectivePlacementTextBlock().GetText();
01606         }
01607
01608         private void SetAutomationName(AutomationNameOptions automationName)
01609         {
01610             switch(automationName)
01611             {
01612                 case AutomationNameOptions.VisualTree:
01613                     elements.GetAutomationNameComboBox().SelectItemByName("TeachingTipInVisualTree");
01614                     break;
01615                 case AutomationNameOptions.Resources:
01616                     elements.GetAutomationNameComboBox().SelectItemByName("TeachingTipInResources");
01617                     break;
01618                 default:
01619                     elements.GetAutomationNameComboBox().SelectItemByName("None");
01620                     break;
01621             }
01622             elements.GetSetAutomationNameButton().InvokeAndWait();
01623         }
01624
01625         private void SetActionButtonContentTo(string option)
01626         {
01627             var actionButtonComboBox = elements.GetActionButtonContentComboBox();
01628             actionButtonComboBox.SelectItemByName(option);
01629             elements.GetSetActionButtonContentButton().InvokeAndWait();
01630         }
01631
01632         // The test UI has a list box which the teaching tip populates with messages about which events have fired and other useful
01633         // Debugging info. This method returns the message at the provided index, which helps testing that events were received in
01634         // the expected order.
01635         private ListBoxItem GetTeachingTipDebugMessage(int index)
01636         {
01637             var count = elements.GetLstTeachingTipEvents().Items.Count;
01638             if (count <= index)
01639             {
01640                 Log.Comment($"TeachingTipEvents list only has {count} items, waiting a little bit longer to see if they show up");
01641                 Task.Delay(TimeSpan.FromMilliseconds(250)).Wait();
01642             }
01643             return elements.GetLstTeachingTipEvents().Items[index];
01644         }
01645
01646         private void ClearTeachingTipDebugMessages()
01647         {
01648             elements.GetBtnClearTeachingTipEvents().InvokeAndWait();
01649         }
01650
01651         private bool WaitForChecked(CheckBox checkBox, double millisecondsTimeout = 2000, bool throwOnError = true)
01652         {
01653             return WaitForCheckBoxUpdated(checkBox, ToggleState.On, millisecondsTimeout, throwOnError);
01654         }
01655
01656         private bool WaitForUnchecked(CheckBox checkBox, double millisecondsTimeout = 2000, bool throwOnError = true)
01657         {
01658             return WaitForCheckBoxUpdated(checkBox, ToggleState.Off, millisecondsTimeout, throwOnError);
01659         }
01660
01661         private bool WaitForCheckBoxUpdated(CheckBox checkBox, ToggleState state, double millisecondsTimeout, bool throwOnError)
01662         {
01663             using (UIEventWaiter waiter = checkBox.GetToggledWaiter())
01664             {
01665                 Log.Comment(checkBox.Name + " Checked: " + checkBox.ToggleState);
01666                 if (checkBox.ToggleState == state)
01667                 {
01668                     return true;
01669                 }
01670                 else
01671                 {
01672                     Log.Comment("Waiting for toggle state to change to {0} for {1}ms", state, millisecondsTimeout);
01673                     waiter.TryWait(TimeSpan.FromMilliseconds(millisecondsTimeout));
01674                 }
01675                 if (checkBox.ToggleState != state)
01676                 {
01677                     Log.Warning(checkBox.Name + " value never changed");
01678                     if (throwOnError)
01679                     {
01680                         throw new WaiterException();
01681                     }
01682                     else
01683                     {
01684                         return false;
01685                     }
01686                 }
01687                 return true;
01688             }
01689         }
01690
01691         private int WaitForOffsetUpdated(
01692             double expectedValue,
01693             double millisecondsTimeout = defaultAnimatedViewChangeTimeout,
01694             bool failOnError = true)
01695         {
01696             Log.Comment("WaitForOffsetUpdated with expectedValue: " + expectedValue);
01697
01698             int warningCount = 0;
01699             bool success = WaitForOffsetToSettle(elements.GetScrollViewerOffsetTextBox(), millisecondsTimeout, failOnError);
01700             double value = Convert.ToDouble(elements.GetScrollViewerOffsetTextBox().GetText());
01701             bool goodValue = value == expectedValue;
01702             Verify.IsTrue(goodValue);
01703             return warningCount;
01704         }
01705
01706         private bool WaitForOffsetToSettle(Edit text, double millisecondsTimeout, bool failOnError)
01707         {
01708             Wait.ForIdle();
01709
01710             const double millisecondsNormalStepTimeout = 100;
01711             const double millisecondsIdleStepTimeout = 600;
01712             ValueChangedEventWaiter waiter = new ValueChangedEventWaiter(text);
01713             int unsuccessfulWaits = 0;
01714             int maxUnsuccessfulWaits = (int)(millisecondsIdleStepTimeout / millisecondsNormalStepTimeout);
01715
01716             Log.Comment("Original State: " + elements.GetScrollViewerStateTextBox().GetText());
01717             Log.Comment("Original Offset: " + text.Value);
01718
01719             // When the initial State is still Idle, use a longer timeout to allow it to transition out of Idle.
01720             double millisecondsWait = (elements.GetScrollViewerStateTextBox().GetText() == "Idle") ? millisecondsIdleStepTimeout : millisecondsNormalStepTimeout;
01721             double millisecondsCumulatedWait = 0;
01722
01723             do
01724             {
01725                 Log.Comment("Waiting for Offset change.");
01726                 waiter.Reset();
01727                 if (waiter.TryWait(TimeSpan.FromMilliseconds(millisecondsWait)))
01728                 {
01729                     unsuccessfulWaits = 0;
01730                 }
01731                 else
01732                 {
01733                     unsuccessfulWaits++;
01734                 }
01735                 millisecondsCumulatedWait += millisecondsWait;
01736                 millisecondsWait = millisecondsNormalStepTimeout;
01737
01738                 Log.Comment("Current State: " + elements.GetScrollViewerStateTextBox().GetText());
01739                 Log.Comment("Current Offset: " + text.Value);
01740
01741                 Wait.ForIdle();
01742             }
01743             while (elements.GetScrollViewerStateTextBox().GetText() != "Idle" &&
01744                    millisecondsCumulatedWait < millisecondsTimeout &&
01745                    unsuccessfulWaits <= maxUnsuccessfulWaits);
01746
01747             if (elements.GetScrollViewerStateTextBox().GetText() == "Idle")
01748             {
01749                 Log.Comment("Idle State reached after " + millisecondsCumulatedWait + " out of " + millisecondsTimeout + " milliseconds. Final Offset: " + text.Value);
01750                 return true;
01751             }
01752             else
01753             {
01754                 string message = unsuccessfulWaits > maxUnsuccessfulWaits ?
01755                     "Offset has not changed within " + millisecondsIdleStepTimeout + " milliseconds outside of Idle State." :
01756                     "Idle State was not reached within " + millisecondsTimeout + " milliseconds.";
01757                 if (failOnError)
01758                 {
01759                     Log.Error(message);
01760                 }
01761                 else
01762                 {
01763                     Log.Warning(message);
01764                 }
01765
01766                 return false;
01767             }
01768         }
01769     }
01770 }
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

GroupedItemsControlViewModel Member List

This is the complete list of members for GroupedItemsControlViewModel, including all inherited members.
GroupedItemsControlViewModel() | GroupedItemsControlViewModel | [inline]
Items | GroupedItemsControlViewModel |
Generated on Sun Dec 1 2024 20:54:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioButtons/ColumnMajorUniformToLargestGridLayout.h Source File

  • RadioButtons

ColumnMajorUniformToLargestGridLayout.h

Go to the documentation of this file.
00001 ﻿#pragma once
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006 #include "common.h"
00007 #include "ColumnMajorUniformToLargestGridLayout.g.h"
00008 #include "ColumnMajorUniformToLargestGridLayout.properties.h"
00009 #include "Layout.h"
00010 #include "NonVirtualizingLayout.h"
00011
00012 class ColumnMajorUniformToLargestGridLayout :
00013     public ReferenceTracker<ColumnMajorUniformToLargestGridLayout, winrt::implementation::ColumnMajorUniformToLargestGridLayoutT, NonVirtualizingLayout>,
00014     public ColumnMajorUniformToLargestGridLayoutProperties
00015 {
00016 public:
00017     ColumnMajorUniformToLargestGridLayout() = default;
00018     winrt::Size MeasureOverride(
00019         winrt::NonVirtualizingLayoutContext const& context,
00020         winrt::Size const& availableSize);
00021     winrt::Size ArrangeOverride(
00022         winrt::NonVirtualizingLayoutContext const& context,
00023         winrt::Size const& finalSize);
00024
00025     void OnColumnSpacingPropertyChanged(const winrt::DependencyPropertyChangedEventArgs&);
00026     void OnRowSpacingPropertyChanged(const winrt::DependencyPropertyChangedEventArgs&);
00027     void OnMaxColumnsPropertyChanged(const winrt::DependencyPropertyChangedEventArgs&);
00028
00029     static void ValidateGreaterThanZero(int value);
00030
00031     //Testhooks helpers, only function while m_testHooksEnabled == true
00032     void SetTestHooksEnabled(bool enabled);
00033     int GetRows();
00034     int GetColumns();
00035     int GetLargerColumns();
00036     winrt::event_token LayoutChanged(winrt::TypedEventHandler<winrt::ColumnMajorUniformToLargestGridLayout, winrt::IInspectable> const& value);
00037     void LayoutChanged(winrt::event_token const& token);
00038
00039 private:
00040     int CalculateColumns(int childCount, float maxItemWidth, float availableWidth);
00041     int m_actualColumnCount{ 1 };
00042     winrt::Size m_largestChildSize{ 0,0 };
00043
00044     //Testhooks helpers, only function while m_testHooksEnabled == true
00045     bool m_testHooksEnabled{ false };
00046     winrt::event<winrt::TypedEventHandler<winrt::ColumnMajorUniformToLargestGridLayout, winrt::IInspectable>> m_layoutChangedEventSource;
00047
00048     int m_rows{ -1 };
00049     int m_columns{ -1 };
00050     int m_largerColumns{ -1 };
00051 };
00052
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/SelectTemplateEventArgs.cpp Source File

  • Repeater

SelectTemplateEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "SelectTemplateEventArgs.h"
00008
00009
00010 #pragma region ISelectTemplateEventArgs
00011
00012 winrt::hstring SelectTemplateEventArgs::TemplateKey()
00013 {
00014     return m_templateKey;
00015 }
00016
00017 void SelectTemplateEventArgs::TemplateKey(winrt::hstring const& value)
00018 {
00019     m_templateKey = value;
00020 }
00021
00022 winrt::IInspectable SelectTemplateEventArgs::DataContext()
00023 {
00024     return m_dataContext.get();
00025 }
00026
00027 winrt::UIElement SelectTemplateEventArgs::Owner()
00028 {
00029     return m_owner.get();
00030 }
00031
00032 #pragma endregion
00033
00034 void SelectTemplateEventArgs::DataContext(const winrt::IInspectable& value)
00035 {
00036     m_dataContext.set(value);
00037 }
00038
00039 void SelectTemplateEventArgs::Owner(const winrt::UIElement& value)
00040 {
00041     m_owner.set(value);
00042 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PlatformConfiguration Member List

This is the complete list of members for PlatformConfiguration, including all inherited members.
_currentAPIVersion | PlatformConfiguration | [private, static]
GetCurrentAPIVersion() | PlatformConfiguration | [inline, static]
InvalidAPIVersion | PlatformConfiguration | [private]
IsApiContractPresent(ushort version) | PlatformConfiguration | [inline, private, static]
IsDebugBuildConfiguration() | PlatformConfiguration | [inline, static]
IsDevice(DeviceType type) | PlatformConfiguration | [inline, static]
IsOsVersion(OSVersion version) | PlatformConfiguration | [inline, static]
IsOsVersionGreaterThan(OSVersion version) | PlatformConfiguration | [inline, static]
IsOsVersionGreaterThanOrEqual(OSVersion version) | PlatformConfiguration | [inline, static]
IsOSVersionLessThan(OSVersion version) | PlatformConfiguration | [inline, static]
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemsRepeaterScrollHost.h Source File

  • Repeater

ItemsRepeaterScrollHost.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ItemsRepeaterScrollHost.g.h"
00007
00008 // TODO: move to framework level element tracking.
00009 class ItemsRepeaterScrollHost :
00010     public ReferenceTracker<ItemsRepeaterScrollHost, DeriveFromPanelHelper_base, winrt::ItemsRepeaterScrollHost, winrt::cloaked<winrt::IRepeaterScrollingSurface>>
00011 {
00012 public:
00013     ItemsRepeaterScrollHost();
00014
00015 #pragma region IFrameworkElementOverrides
00016
00017     winrt::Size MeasureOverride(winrt::Size const& availableSize);
00018     winrt::Size ArrangeOverride(winrt::Size const& finalSize);
00019
00020 #pragma endregion
00021
00022 #pragma region IScrollAnchorProvider
00023
00024     double HorizontalAnchorRatio();
00025
00026     void HorizontalAnchorRatio(double value);
00027
00028     double VerticalAnchorRatio();
00029
00030     void VerticalAnchorRatio(double value);
00031
00032     winrt::UIElement CurrentAnchor();
00033
00034     winrt::FxScrollViewer ScrollViewer();
00035
00036     void ScrollViewer(winrt::FxScrollViewer const& value);
00037
00038 #pragma endregion
00039
00040 #pragma region IRepeaterScrollingSurface
00041
00042     bool IsHorizontallyScrollable();
00043
00044     bool IsVerticallyScrollable();
00045
00046     winrt::UIElement AnchorElement();
00047
00048     winrt::event_token ViewportChanged(winrt::ViewportChangedEventHandler const& value);
00049
00050     void ViewportChanged(winrt::event_token const& token);
00051
00052     winrt::event_token PostArrange(winrt::PostArrangeEventHandler const& value);
00053
00054     void PostArrange(winrt::event_token const& token);
00055
00056     winrt::event_token ConfigurationChanged(winrt::ConfigurationChangedEventHandler const& value);
00057
00058     void ConfigurationChanged(winrt::event_token const& token);
00059
00060     void RegisterAnchorCandidate(winrt::UIElement const& element);
00061
00062     void UnregisterAnchorCandidate(winrt::UIElement const& element);
00063
00064     winrt::Rect GetRelativeViewport(
00065         winrt::UIElement const& element);
00066
00067 #pragma endregion
00068
00069     void StartBringIntoView(
00070         winrt::UIElement const& element,
00071         double alignmentX,
00072         double alignmentY,
00073         double offsetX,
00074         double offsetY,
00075         bool animate);
00076
00077 private:
00078     void ApplyPendingChangeView(const winrt::FxScrollViewer& scrollViewer);
00079     double TrackElement(const winrt::UIElement& element, winrt::Rect previousBounds, const winrt::FxScrollViewer& scrollViewer);
00080     winrt::UIElement GetAnchorElement(_Out_opt_ winrt::Rect* relativeBounds = nullptr);
00081
00082     void OnScrollViewerViewChanging(const winrt::IInspectable& sender, const winrt::ScrollViewerViewChangingEventArgs& args);
00083     void OnScrollViewerViewChanged(winrt::IInspectable const& sender, winrt::ScrollViewerViewChangedEventArgs const& args);
00084     void OnScrollViewerSizeChanged(const winrt::IInspectable& sender, const winrt::SizeChangedEventArgs& args);
00085
00086     bool HasPendingBringIntoView() const { return !!m_pendingBringIntoView.TargetElement(); }
00087
00088     struct CandidateInfo
00089     {
00090         CandidateInfo(
00091             const ITrackerHandleManager* owner,
00092             winrt::UIElement element) :
00093             m_element(owner, element)
00094         { }
00095
00096         winrt::UIElement Element() const { return m_element.get(); }
00097         winrt::Rect RelativeBounds() const { return m_relativeBounds; }
00098         void RelativeBounds(winrt::Rect bounds) { m_relativeBounds = bounds; }
00099         bool IsRelativeBoundsSet() const { return m_relativeBounds != InvalidBounds; }
00100
00101         static constexpr winrt::Rect InvalidBounds{ -1.0f, -1.0f, -1.0f, -1.0f };
00102     private:
00103         tracker_ref<winrt::UIElement> m_element;
00104         winrt::Rect m_relativeBounds{ InvalidBounds };
00105     };
00106
00107     struct BringIntoViewState
00108     {
00109         BringIntoViewState(const ITrackerHandleManager* owner)
00110             : m_targetElement(owner)
00111         { }
00112         BringIntoViewState(
00113             const ITrackerHandleManager* owner,
00114             winrt::UIElement targetElement,
00115             double alignmentX,
00116             double alignmentY,
00117             double offsetX,
00118             double offsetY,
00119             bool animate) :
00120             m_targetElement(owner, targetElement),
00121             m_alignmentX(alignmentX),
00122             m_alignmentY(alignmentY),
00123             m_offsetX(offsetX),
00124             m_offsetY(offsetY),
00125             m_animate(animate)
00126         { }
00127
00128         winrt::UIElement TargetElement() const { return m_targetElement.get(); }
00129         double AlignmentX() const { return m_alignmentX; }
00130         double AlignmentY() const { return m_alignmentY; }
00131         double OffsetX() const { return m_offsetX; }
00132         double OffsetY() const { return m_offsetY; }
00133         bool Animate() const { return m_animate; }
00134         bool ChangeViewCalled() const { return m_changeViewCalled; }
00135         void ChangeViewCalled(bool value) { m_changeViewCalled = value; }
00136         winrt::Point ChangeViewOffset() const { return m_changeViewOffset; }
00137         void ChangeViewOffset(winrt::Point value) { m_changeViewOffset = value; }
00138
00139         void Reset()
00140         {
00141             m_targetElement.set(nullptr);
00142             m_alignmentX = m_alignmentY = m_offsetX = m_offsetY = 0.0;
00143             m_animate = m_changeViewCalled = false;
00144             m_changeViewOffset = {};
00145         }
00146
00147     private:
00148         tracker_ref<winrt::UIElement> m_targetElement;
00149         double m_alignmentX{};
00150         double m_alignmentY{};
00151         double m_offsetX{};
00152         double m_offsetY{};
00153         bool m_animate{};
00154         bool m_changeViewCalled{};
00155         winrt::Point m_changeViewOffset{};
00156     };
00157
00158     std::vector<CandidateInfo> m_candidates;
00159
00160     tracker_ref<winrt::UIElement> m_anchorElement{ this };
00161     winrt::Rect m_anchorElementRelativeBounds{};
00162     // Whenever the m_candidates list changes, we set this to true.
00163     bool m_isAnchorElementDirty{ true };
00164
00165     double m_horizontalEdge{};
00166     double m_verticalEdge{};    // Not used in this temporary implementation.
00167
00168     // We can only bring an element into view after it got arranged and
00169     // we know its bounds as well as the viewport (so that we can account
00170     // for alignment and offset).
00171     // The BringIntoView call can however be made at any point, even
00172     // in the constructor of a page (deserialization scenario) so we
00173     // need to hold on the parameter that are passed in BringIntoViewOperation.
00174     BringIntoViewState m_pendingBringIntoView{ this };
00175
00176     // A ScrollViewer.ChangeView operation, even if not animated, is not synchronous.
00177     // In other words, right after the call, ScrollViewer.[Vertical|Horizontal]Offset and
00178     // TransformToVisual are not going to reflect the new viewport. We need to keep
00179     // track of the pending viewport shift until the ChangeView operation completes
00180     // asynchronously.
00181     double m_pendingViewportShift{};
00182
00183     event_source<winrt::ViewportChangedEventHandler> m_viewportChanged{ this };
00184     event_source<winrt::PostArrangeEventHandler> m_postArrange{ this };
00185
00186     winrt::FxScrollViewer::ViewChanging_revoker m_scrollViewerViewChanging{};
00187     winrt::FxScrollViewer::ViewChanged_revoker m_scrollViewerViewChanged{};
00188     winrt::FxScrollViewer::SizeChanged_revoker m_scrollViewerSizeChanged{};
00189
00190 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewListView Member List

This is the complete list of members for TabViewListView, including all inherited members.
abi_enter() | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
CheckThread() | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< TabViewListView > &&self) noexcept | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
final_release(std::unique_ptr< TabViewListView > &&self) | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline, static]
GetBase() | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
GetContainerForItemOverride() | TabViewListView |
GetInner() | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
IsItemItsOwnContainerOverride(winrt::IInspectable const &item) | TabViewListView |
IsOnThread() | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
OnContainerContentChanging(const winrt::IInspectable &sender, const winrt::ContainerContentChangingEventArgs &args) | TabViewListView | [private]
OnItemsChanged(winrt::IInspectable const &item) | TabViewListView |
OnSelectedIndexPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | TabViewListView | [private]
PrepareContainerForItemOverride(const winrt::DependencyObject &element, const winrt::IInspectable &item) | TabViewListView |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< TabViewListView, winrt::implementation::TabViewListViewT > | [inline]
TabViewListView() | TabViewListView |
UpdateBottomBorderVisualState() | TabViewListView | [private]
Generated on Sun Dec 1 2024 20:53:14 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewViewModelItem Member List

This is the complete list of members for TreeViewViewModelItem, including all inherited members.
Items | TreeViewViewModelItem
Name | TreeViewViewModelItem
Generated on Sun Dec 1 2024 20:54:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SortingAndFilteringPage Member List

This is the complete list of members for SortingAndFilteringPage, including all inherited members.
AllTypes | SortingAndFilteringPage | [private]
filterText_TextChanged(object sender, TextChangedEventArgs e) | SortingAndFilteringPage | [inline, private]
IsSortDescending | SortingAndFilteringPage | [private]
OnSortAscClick(object sender, RoutedEventArgs e) | SortingAndFilteringPage | [inline, private]
OnSortDesClick(object sender, RoutedEventArgs e) | SortingAndFilteringPage | [inline, private]
SortingAndFilteringPage() | SortingAndFilteringPage | [inline]
SourceForRepeater | SortingAndFilteringPage | [private]
UpdateSortAndFilter() | SortingAndFilteringPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: WebView2/InvokableCallbackHelper.h Source File

  • WebView2

InvokableCallbackHelper.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 namespace details
00007 {
00008     // Used to produce a delegate with the Invoke() method signature that matches that of TDelegateInterface.
00009     template<typename TDelegateInterface> struct CallbackTraits; // to be specialized
00010
00011     template<typename TDelegateInterface, typename ...TArgs>
00012     struct CallbackTraits<HRESULT(STDMETHODCALLTYPE TDelegateInterface::*)(TArgs...)>
00013     {
00014
00015         template<typename TDelegateInterface>
00016         struct InvokeCallback : winrt::implements<InvokeCallback<TDelegateInterface>, TDelegateInterface>
00017         {
00018         private:
00019             std::function<HRESULT STDMETHODCALLTYPE(TArgs...)> m_invokeFunction;
00020
00021         public:
00022
00023             InvokeCallback() = delete;
00024
00025             InvokeCallback(std::function<HRESULT STDMETHODCALLTYPE(TArgs...)>&& func_obj) : m_invokeFunction(func_obj) {}
00026
00027             HRESULT STDMETHODCALLTYPE Invoke(TArgs... args) override
00028             {
00029                 return m_invokeFunction(args...);
00030             }
00031         };
00032     };
00033 }
00034
00035 // This callback type provides a winrt-style implementation of the COM delegate interface/ABI that is non-reliant on WRL,
00036 // but can be used as a direct replacement for 'WRL::Callback's.
00037 template<typename TDelegateInterface, typename TLambda>
00038 auto InvokableCallback(TLambda&& callback)
00039 {
00040     using InvokeSignature = decltype(&TDelegateInterface::Invoke);
00041     using CallbackType = typename details::CallbackTraits<InvokeSignature>::template InvokeCallback<TDelegateInterface>;
00042     return winrt::make<CallbackType>(std::forward<TLambda>(callback));
00043 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

VirtualLayoutContextAdapter::ChildrenCollection< T > Member List

This is the complete list of members for VirtualLayoutContextAdapter::ChildrenCollection< T >, including all inherited members.
abi_enter() | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
CheckThread() | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
ChildrenCollection(winrt::VirtualizingLayoutContext const &context) | VirtualLayoutContextAdapter::ChildrenCollection< T > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< ChildrenCollection< T > > &&self) noexcept | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
final_release(std::unique_ptr< ChildrenCollection< T > > &&self) | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline, static]
First() | VirtualLayoutContextAdapter::ChildrenCollection< T > | [inline]
GetAt(uint32_t index) | VirtualLayoutContextAdapter::ChildrenCollection< T > | [inline]
GetBase() | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
GetInner() | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
GetMany(uint32_t startIndex, winrt::array_view< T > const &values) noexcept | VirtualLayoutContextAdapter::ChildrenCollection< T > | [inline]
IndexOf(T const &value, uint32_t &index) noexcept | VirtualLayoutContextAdapter::ChildrenCollection< T > | [inline]
IsOnThread() | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
m_context | VirtualLayoutContextAdapter::ChildrenCollection< T > | [private]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ChildrenCollection< T >, reference_tracker_implements_t< winrt::IVectorView< T > >::type, winrt::IIterable< T > > | [inline]
Size() | VirtualLayoutContextAdapter::ChildrenCollection< T > | [inline]
Generated on Sun Dec 1 2024 20:53:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealGridTypeItem Member List

This is the complete list of members for RevealGridTypeItem, including all inherited members.
GetItems() | RevealGridTypeItem | [inline, static]
items | RevealGridTypeItem | [private, static]
Name | RevealGridTypeItem |
Template | RevealGridTypeItem |
Generated on Sun Dec 1 2024 20:54:25 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DropDownButtonTests Member List

This is the complete list of members for DropDownButtonTests, including all inherited members.
AccessibilityTest() | DropDownButtonTests | [inline]
ClassInitialize(TestContext testContext) | DropDownButtonTests | [inline, static]
TestCleanup() | DropDownButtonTests | [inline]
Generated on Sun Dec 1 2024 20:53:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedVisuals/AnimatedAcceptVisualSource.cpp Source File

  • AnimatedIcon
  • AnimatedVisuals

AnimatedAcceptVisualSource.cpp

Go to the documentation of this file.
00001 ﻿//------------------------------------------------------------------------------
00002 // <auto-generated>
00003 //     This code was generated by a tool.
00004 //
00005 //       LottieGen version:
00006 //           7.0.2+gebbbdfc697
00007 //
00008 //       Command:
00009 //           LottieGen -Language Cppwinrt -WinUIVersion 2.4 -InputFile AnimatedAcceptVisualSource.json
00010 //
00011 //       Input file:
00012 //           AnimatedAcceptVisualSource.json (22496 bytes created 11:36-07:00 May 14 2021)
00013 //
00014 //       LottieGen source:
00015 //           http://aka.ms/Lottie
00016 //
00017 //     Changes to this file may cause incorrect behavior and will be lost if
00018 //     the code is regenerated.
00019 // </auto-generated>
00020 //------------------------------------------------------------------------------
00021 // ____________________________________
00022 // |       Object stats       | Count |
00023 // |__________________________|_______|
00024 // | All CompositionObjects   |   305 |
00025 // |--------------------------+-------|
00026 // | Expression animators     |    30 |
00027 // | KeyFrame animators       |    29 |
00028 // | Reference parameters     |    30 |
00029 // | Expression operations    |     4 |
00030 // |--------------------------+-------|
00031 // | Animated brushes         |     1 |
00032 // | Animated gradient stops  |     - |
00033 // | ExpressionAnimations     |     2 |
00034 // | PathKeyFrameAnimations   |     - |
00035 // |--------------------------+-------|
00036 // | ContainerVisuals         |    43 |
00037 // | ShapeVisuals             |    15 |
00038 // |--------------------------+-------|
00039 // | ContainerShapes          |     - |
00040 // | CompositionSpriteShapes  |    15 |
00041 // |--------------------------+-------|
00042 // | Brushes                  |     1 |
00043 // | Gradient stops           |     - |
00044 // | CompositionVisualSurface |     - |
00045 // ------------------------------------
00046 #include "pch.h"
00047 #include "AnimatedVisuals\AnimatedAcceptVisualSource.h"
00048 #include <winrt/Windows.Foundation.Metadata.h>
00049 #include <winrt/Windows.Foundation.Collections.h>
00050 #include <winrt/Microsoft.UI.Composition.h>
00051 #include "d2d1.h"
00052 #include <d2d1_1.h>
00053 #include <d2d1helper.h>
00054 #include <Windows.Graphics.Interop.h>
00055 #include <Windows.Graphics.Effects.Interop.h>
00056 #include <winrt/Windows.Graphics.Effects.h>
00057
00058 using namespace winrt::Microsoft::UI::Xaml::Controls;
00059 using namespace winrt::Windows::Foundation;
00060 using namespace winrt::Windows::Foundation::Numerics;
00061 using namespace winrt::Windows::Graphics;
00062 using namespace winrt::Windows::UI;
00063 using namespace winrt::Microsoft::UI::Composition;
00064 using TimeSpan = winrt::Windows::Foundation::TimeSpan;
00065
00066 namespace winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals
00067 {
00068     CppWinRTActivatableClassWithBasicFactory(AnimatedAcceptVisualSource)
00069 }
00070 #include "AnimatedVisuals\AnimatedAcceptVisualSource.g.cpp"
00071
00072
00073 class CanvasGeometry : public winrt::implements<CanvasGeometry,
00074     IGeometrySource2D,
00075     ::ABI::Windows::Graphics::IGeometrySource2DInterop>
00076 {
00077     winrt::com_ptr<ID2D1Geometry> _geometry{ nullptr };
00078
00079 public:
00080     CanvasGeometry(winrt::com_ptr<ID2D1Geometry> geometry)
00081         : _geometry{ geometry }
00082     { }
00083
00084     // IGeometrySource2D.
00085     winrt::com_ptr<ID2D1Geometry> Geometry() { return _geometry; }
00086
00087     // IGeometrySource2DInterop.
00088     IFACEMETHODIMP GetGeometry(ID2D1Geometry** value) override
00089     {
00090         _geometry.copy_to(value);
00091         return S_OK;
00092     }
00093
00094     // IGeometrySource2DInterop.
00095     IFACEMETHODIMP TryGetGeometryUsingFactory(ID2D1Factory*, ID2D1Geometry**) override
00096     {
00097         return E_NOTIMPL;
00098     }
00099 };
00100 class AnimatedAcceptVisualSource_AnimatedVisual : public winrt::implements<AnimatedAcceptVisualSource_AnimatedVisual,
00101         winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual,
00102         IClosable>
00103 {
00104     winrt::com_ptr<ID2D1Factory> _d2dFactory{ nullptr };
00105     static constexpr int64_t c_durationTicks{ 26666666L };
00106     Compositor const _c{ nullptr };
00107     ExpressionAnimation const _reusableExpressionAnimation{ nullptr };
00108     CompositionPropertySet const _themeProperties{ nullptr };
00109     CompositionColorBrush _themeColor_Foreground{ nullptr };
00110     CompositionPath _path{ nullptr };
00111     CompositionPathGeometry _pathGeometry_09{ nullptr };
00112     ContainerVisual _root{ nullptr };
00113     CubicBezierEasingFunction _cubicBezierEasingFunction_0{ nullptr };
00114     CubicBezierEasingFunction _cubicBezierEasingFunction_1{ nullptr };
00115     ExpressionAnimation _rootProgress{ nullptr };
00116     InsetClip _insetClip_0{ nullptr };
00117     StepEasingFunction _holdThenStepEasingFunction{ nullptr };
00118     StepEasingFunction _stepThenHoldEasingFunction{ nullptr };
00119
00120     static void StartProgressBoundAnimation(
00121         CompositionObject target,
00122         winrt::hstring animatedPropertyName,
00123         CompositionAnimation animation,
00124         ExpressionAnimation controllerProgressExpression)
00125     {
00126         target.StartAnimation(animatedPropertyName, animation);
00127         const auto controller = target.TryGetAnimationController(animatedPropertyName);
00128         controller.Pause();
00129         controller.StartAnimation(L"Progress", controllerProgressExpression);
00130     }
00131
00132     void BindProperty(
00133         CompositionObject target,
00134         winrt::hstring animatedPropertyName,
00135         winrt::hstring expression,
00136         winrt::hstring referenceParameterName,
00137         CompositionObject referencedObject)
00138     {
00139         _reusableExpressionAnimation.ClearAllParameters();
00140         _reusableExpressionAnimation.Expression(expression);
00141         _reusableExpressionAnimation.SetReferenceParameter(referenceParameterName, referencedObject);
00142         target.StartAnimation(animatedPropertyName, _reusableExpressionAnimation);
00143     }
00144
00145     BooleanKeyFrameAnimation CreateBooleanKeyFrameAnimation(float initialProgress, bool initialValue)
00146     {
00147         const auto result = _c.CreateBooleanKeyFrameAnimation();
00148         result.Duration(TimeSpan{ c_durationTicks });
00149         result.InsertKeyFrame(initialProgress, initialValue);
00150         return result;
00151     }
00152
00153     ScalarKeyFrameAnimation CreateScalarKeyFrameAnimation(float initialProgress, float initialValue, CompositionEasingFunction initialEasingFunction)
00154     {
00155         const auto result = _c.CreateScalarKeyFrameAnimation();
00156         result.Duration(TimeSpan{ c_durationTicks });
00157         result.InsertKeyFrame(initialProgress, initialValue, initialEasingFunction);
00158         return result;
00159     }
00160
00161     CompositionSpriteShape CreateSpriteShape(CompositionGeometry geometry, winrt::float3x2 transformMatrix)
00162     {
00163         const auto result = _c.CreateSpriteShape(geometry);
00164         result.TransformMatrix(transformMatrix);
00165         return result;
00166     }
00167
00168     // PreComp layer: Indeterminate State
00169     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_00()
00170     {
00171         // Frame 155.
00172         const auto result = CreateBooleanKeyFrameAnimation(0.96875F, true);
00173         return result;
00174     }
00175
00176     // PreComp layer: Controls - 01 - Check - 18 - PressedOffToNormalOn
00177     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_01()
00178     {
00179         // Frame 135.
00180         const auto result = CreateBooleanKeyFrameAnimation(0.84375F, true);
00181         // Frame 155.
00182         result.InsertKeyFrame(0.96875F, false);
00183         return result;
00184     }
00185
00186     // PreComp layer: Controls - 01 - Check - 17 - PressedOffToPointerOverOn
00187     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_02()
00188     {
00189         // Frame 115.
00190         const auto result = CreateBooleanKeyFrameAnimation(0.71875F, true);
00191         // Frame 135.
00192         result.InsertKeyFrame(0.84375F, false);
00193         return result;
00194     }
00195
00196     // PreComp layer: Controls - 01 - Check - 16 - PressedOffToPressedOn
00197     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_03()
00198     {
00199         // Frame 105.
00200         const auto result = CreateBooleanKeyFrameAnimation(0.65625F, true);
00201         // Frame 115.
00202         result.InsertKeyFrame(0.71875F, false);
00203         return result;
00204     }
00205
00206     // PreComp layer: Controls - 01 - Check - 15 - PressedOnToNormalOff
00207     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_04()
00208     {
00209         // Frame 100.
00210         const auto result = CreateBooleanKeyFrameAnimation(0.625F, true);
00211         // Frame 105.
00212         result.InsertKeyFrame(0.65625F, false);
00213         return result;
00214     }
00215
00216     // PreComp layer: Controls - 01 - Check - 14 - PressedOnToPointerOverOff
00217     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_05()
00218     {
00219         // Frame 95.
00220         const auto result = CreateBooleanKeyFrameAnimation(0.59375F, true);
00221         // Frame 100.
00222         result.InsertKeyFrame(0.625F, false);
00223         return result;
00224     }
00225
00226     // PreComp layer: Controls - 01 - Check - 13 - PressedOnToPressedOff
00227     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_06()
00228     {
00229         // Frame 90.
00230         const auto result = CreateBooleanKeyFrameAnimation(0.5625F, true);
00231         // Frame 95.
00232         result.InsertKeyFrame(0.59375F, false);
00233         return result;
00234     }
00235
00236     // PreComp layer: Controls - 01 - Check - 12 - PointerOverOffToPressedOff
00237     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_07()
00238     {
00239         // Frame 85.
00240         const auto result = CreateBooleanKeyFrameAnimation(0.53125F, true);
00241         // Frame 90.
00242         result.InsertKeyFrame(0.5625F, false);
00243         return result;
00244     }
00245
00246     // PreComp layer: Controls - 01 - Check - 11 - PointerOverOffToNormalOff
00247     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_08()
00248     {
00249         // Frame 80.
00250         const auto result = CreateBooleanKeyFrameAnimation(0.5F, true);
00251         // Frame 85.
00252         result.InsertKeyFrame(0.53125F, false);
00253         return result;
00254     }
00255
00256     // PreComp layer: Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn
00257     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_09()
00258     {
00259         // Frame 60.
00260         const auto result = CreateBooleanKeyFrameAnimation(0.375F, true);
00261         // Frame 80.
00262         result.InsertKeyFrame(0.5F, false);
00263         return result;
00264     }
00265
00266     // PreComp layer: Controls - 01 - Check - 09 - PointerOverOnToPressedOn
00267     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_10()
00268     {
00269         // Frame 55.
00270         const auto result = CreateBooleanKeyFrameAnimation(0.34375F, true);
00271         // Frame 60.
00272         result.InsertKeyFrame(0.375F, false);
00273         return result;
00274     }
00275
00276     // PreComp layer: Controls - 01 - Check - 08 - PointerOverOnToNormalOn
00277     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_11()
00278     {
00279         // Frame 50.
00280         const auto result = CreateBooleanKeyFrameAnimation(0.3125F, true);
00281         // Frame 55.
00282         result.InsertKeyFrame(0.34375F, false);
00283         return result;
00284     }
00285
00286     // PreComp layer: Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff
00287     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_12()
00288     {
00289         // Frame 45.
00290         const auto result = CreateBooleanKeyFrameAnimation(0.28125F, true);
00291         // Frame 50.
00292         result.InsertKeyFrame(0.3125F, false);
00293         return result;
00294     }
00295
00296     // PreComp layer: Controls - 01 - Check - 06 - NormalOffToPressedOff
00297     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_13()
00298     {
00299         // Frame 40.
00300         const auto result = CreateBooleanKeyFrameAnimation(0.25F, true);
00301         // Frame 45.
00302         result.InsertKeyFrame(0.28125F, false);
00303         return result;
00304     }
00305
00306     // PreComp layer: Controls - 01 - Check - 05 - NormalOffToPointerOverOff
00307     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_14()
00308     {
00309         // Frame 35.
00310         const auto result = CreateBooleanKeyFrameAnimation(0.21875F, true);
00311         // Frame 40.
00312         result.InsertKeyFrame(0.25F, false);
00313         return result;
00314     }
00315
00316     // PreComp layer: Controls - 01 - Check - 04 - NormalOffToNormalOn
00317     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_15()
00318     {
00319         // Frame 15.
00320         const auto result = CreateBooleanKeyFrameAnimation(0.09375F, true);
00321         // Frame 35.
00322         result.InsertKeyFrame(0.21875F, false);
00323         return result;
00324     }
00325
00326     // PreComp layer: Controls - 01 - Check - 03 - NormalOnToPressedOn
00327     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_16()
00328     {
00329         // Frame 10.
00330         const auto result = CreateBooleanKeyFrameAnimation(0.0625F, true);
00331         // Frame 15.
00332         result.InsertKeyFrame(0.09375F, false);
00333         return result;
00334     }
00335
00336     // PreComp layer: Controls - 01 - Check - 02 - NormalOnToPointerOverOn
00337     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_17()
00338     {
00339         // Frame 5.
00340         const auto result = CreateBooleanKeyFrameAnimation(0.03125F, true);
00341         // Frame 10.
00342         result.InsertKeyFrame(0.0625F, false);
00343         return result;
00344     }
00345
00346     // PreComp layer: Controls - 01 - Check - 01 - NormalOnToNormalOff
00347     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_18()
00348     {
00349         // Frame 5.
00350         const auto result = CreateBooleanKeyFrameAnimation(0.03125F, false);
00351         return result;
00352     }
00353
00354     // - - - - - PreComp layer: Indeterminate State
00355     // - - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00356     // - - - Shape tree root for layer: Shape Layer 1
00357     // - -  Scale:0.7,0.7, Offset:<24, 24>
00358     winrt::com_ptr<CanvasGeometry> Geometry_0()
00359     {
00360         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00361         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00362         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00363         winrt::check_hresult(path->Open(sink.put()));
00364         sink->BeginFigure({ -11.75F, -0.125F }, D2D1_FIGURE_BEGIN_FILLED);
00365         sink->AddLine({ 11.875F, -0.125F });
00366         sink->EndFigure(D2D1_FIGURE_END_OPEN);
00367         winrt::check_hresult(sink->Close());
00368         auto result = winrt::make_self<CanvasGeometry>(path);
00369         return result;
00370     }
00371
00372     winrt::com_ptr<CanvasGeometry> Geometry_1()
00373     {
00374         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00375         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00376         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00377         winrt::check_hresult(path->Open(sink.put()));
00378         sink->BeginFigure({ -15.1719999F, 0.0160000008F }, D2D1_FIGURE_BEGIN_FILLED);
00379         sink->AddLine({ -5.0F, 10.1879997F });
00380         sink->AddLine({ 15.3369999F, -10.3369999F });
00381         sink->EndFigure(D2D1_FIGURE_END_OPEN);
00382         winrt::check_hresult(sink->Close());
00383         auto result = winrt::make_self<CanvasGeometry>(path);
00384         return result;
00385     }
00386
00387     // - - - - - PreComp layer: Controls - 01 - Check - 09 - PointerOverOnToPressedOn -
00388     // Tweak
00389     // - - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00390     // - - - Shape tree root for layer: Shape Layer 1
00391     // - -  Scale:0.7,0.7, Offset:<24, 23>
00392     winrt::com_ptr<CanvasGeometry> Geometry_2()
00393     {
00394         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00395         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00396         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00397         winrt::check_hresult(path->Open(sink.put()));
00398         sink->BeginFigure({ -15.1719999F, 0.0160000008F }, D2D1_FIGURE_BEGIN_FILLED);
00399         sink->AddLine({ -5.0F, 10.1879997F });
00400         sink->AddLine({ 15.3369999F, -10.2810001F });
00401         sink->EndFigure(D2D1_FIGURE_END_OPEN);
00402         winrt::check_hresult(sink->Close());
00403         auto result = winrt::make_self<CanvasGeometry>(path);
00404         return result;
00405     }
00406
00407     // Color bound to theme property value: Foreground
00408     CompositionColorBrush ThemeColor_Foreground()
00409     {
00410         const auto result = _themeColor_Foreground = _c.CreateColorBrush();
00411         BindProperty(result, L"Color", L"ColorRGB(_theme.Foreground.W,_theme.Foreground.X,_theme.Foreground.Y,_theme.Foreground.Z)", L"_theme", _themeProperties);
00412         return result;
00413     }
00414
00415     CompositionPath Path()
00416     {
00417         const auto result = _path = CompositionPath(CanvasGeometryToIGeometrySource2D(Geometry_1()));
00418         return result;
00419     }
00420
00421     // - - - PreComp layer: Indeterminate State
00422     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00423     // - Shape tree root for layer: Shape Layer 1
00424     // Scale:0.7,0.7, Offset:<24, 24>
00425     CompositionPathGeometry PathGeometry_00()
00426     {
00427         return _c.CreatePathGeometry(CompositionPath(CanvasGeometryToIGeometrySource2D(Geometry_0())));
00428     }
00429
00430     // - - - PreComp layer: Controls - 01 - Check - 18 - PressedOffToNormalOn
00431     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00432     // - Shape tree root for layer: Shape Layer 1
00433     // Scale:0.7,0.7, Offset:<24, 23>
00434     CompositionPathGeometry PathGeometry_01()
00435     {
00436         const auto result = _c.CreatePathGeometry(Path());
00437         StartProgressBoundAnimation(result, L"TrimEnd", TrimEndScalarAnimation_0_to_1_0(), _rootProgress);
00438         return result;
00439     }
00440
00441     // - - - PreComp layer: Controls - 01 - Check - 17 - PressedOffToPointerOverOn
00442     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00443     // - Shape tree root for layer: Shape Layer 1
00444     // Scale:0.7,0.7, Offset:<24, 23>
00445     CompositionPathGeometry PathGeometry_02()
00446     {
00447         const auto result = _c.CreatePathGeometry(_path);
00448         StartProgressBoundAnimation(result, L"TrimEnd", TrimEndScalarAnimation_0_to_1_1(), _rootProgress);
00449         return result;
00450     }
00451
00452     // - - - PreComp layer: Controls - 01 - Check - 16 - PressedOffToPressedOn
00453     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00454     // - Shape tree root for layer: Shape Layer 2
00455     // Scale:0.7,0.7, Offset:<24, 23>
00456     CompositionPathGeometry PathGeometry_03()
00457     {
00458         const auto result = _c.CreatePathGeometry(_path);
00459         StartProgressBoundAnimation(result, L"TrimEnd", TrimEndScalarAnimation_0_to_1_2(), _rootProgress);
00460         return result;
00461     }
00462
00463     // - - - PreComp layer: Controls - 01 - Check - 15 - PressedOnToNormalOff
00464     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00465     // - Shape tree root for layer: Shape Layer 1
00466     // Scale:0.7,0.7, Offset:<24, 23>
00467     CompositionPathGeometry PathGeometry_04()
00468     {
00469         const auto result = _c.CreatePathGeometry(_path);
00470         StartProgressBoundAnimation(result, L"TrimStart", TrimStartScalarAnimation_0_to_1_0(), _rootProgress);
00471         return result;
00472     }
00473
00474     // - - - PreComp layer: Controls - 01 - Check - 14 - PressedOnToPointerOverOff
00475     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00476     // - Shape tree root for layer: Shape Layer 1
00477     // Scale:0.7,0.7, Offset:<24, 23>
00478     CompositionPathGeometry PathGeometry_05()
00479     {
00480         const auto result = _c.CreatePathGeometry(_path);
00481         StartProgressBoundAnimation(result, L"TrimStart", TrimStartScalarAnimation_0_to_1_1(), _rootProgress);
00482         return result;
00483     }
00484
00485     // - - - PreComp layer: Controls - 01 - Check - 13 - PressedOnToPressedOff
00486     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00487     // - Shape tree root for layer: Shape Layer 1
00488     // Scale:0.7,0.7, Offset:<24, 23>
00489     CompositionPathGeometry PathGeometry_06()
00490     {
00491         const auto result = _c.CreatePathGeometry(_path);
00492         StartProgressBoundAnimation(result, L"TrimStart", TrimStartScalarAnimation_0_to_1_2(), _rootProgress);
00493         return result;
00494     }
00495
00496     // - - - PreComp layer: Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn -
00497     // Tweak
00498     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00499     // - Shape tree root for layer: Shape Layer 1
00500     // Scale:0.7,0.7, Offset:<24, 23>
00501     CompositionPathGeometry PathGeometry_07()
00502     {
00503         const auto result = _c.CreatePathGeometry(_path);
00504         StartProgressBoundAnimation(result, L"TrimEnd", TrimEndScalarAnimation_0_to_1_3(), _rootProgress);
00505         return result;
00506     }
00507
00508     // - - - PreComp layer: Controls - 01 - Check - 09 - PointerOverOnToPressedOn
00509     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00510     // - Shape tree root for layer: Shape Layer 1
00511     // Scale:0.7,0.7, Offset:<24, 23>
00512     CompositionPathGeometry PathGeometry_08()
00513     {
00514         return _c.CreatePathGeometry(CompositionPath(CanvasGeometryToIGeometrySource2D(Geometry_2())));
00515     }
00516
00517     CompositionPathGeometry PathGeometry_09()
00518     {
00519         return _pathGeometry_09 = _c.CreatePathGeometry(_path);
00520     }
00521
00522     // - - - PreComp layer: Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff -
00523     // Tweak
00524     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00525     // - Shape tree root for layer: Shape Layer 1
00526     // Scale:0.7,0.7, Offset:<24, 23>
00527     CompositionPathGeometry PathGeometry_10()
00528     {
00529         const auto result = _c.CreatePathGeometry(_path);
00530         StartProgressBoundAnimation(result, L"TrimStart", TrimStartScalarAnimation_0_to_1_3(), _rootProgress);
00531         return result;
00532     }
00533
00534     // - - - PreComp layer: Controls - 01 - Check - 04 - NormalOffToNormalOn
00535     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00536     // - Shape tree root for layer: Shape Layer 1
00537     // Scale:0.7,0.7, Offset:<24, 23>
00538     CompositionPathGeometry PathGeometry_11()
00539     {
00540         const auto result = _c.CreatePathGeometry(_path);
00541         StartProgressBoundAnimation(result, L"TrimEnd", TrimEndScalarAnimation_0_to_1_4(), _rootProgress);
00542         return result;
00543     }
00544
00545     // - - - PreComp layer: Controls - 01 - Check - 01 - NormalOnToNormalOff
00546     // - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00547     // - Shape tree root for layer: Shape Layer 1
00548     // Scale:0.7,0.7, Offset:<24, 23>
00549     CompositionPathGeometry PathGeometry_12()
00550     {
00551         const auto result = _c.CreatePathGeometry(_path);
00552         StartProgressBoundAnimation(result, L"TrimStart", TrimStartScalarAnimation_0_to_1_4(), _rootProgress);
00553         return result;
00554     }
00555
00556     // - - PreComp layer: Indeterminate State
00557     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00558     // Shape tree root for layer: Shape Layer 1
00559     // Path 1
00560     CompositionSpriteShape SpriteShape_00()
00561     {
00562         // Offset:<24, 24>, Scale:<0.7, 0.7>
00563         const auto result = CreateSpriteShape(PathGeometry_00(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 24.0F });
00564         result.StrokeBrush(ThemeColor_Foreground());
00565         result.StrokeDashCap(CompositionStrokeCap::Round);
00566         result.StrokeStartCap(CompositionStrokeCap::Round);
00567         result.StrokeEndCap(CompositionStrokeCap::Round);
00568         result.StrokeMiterLimit(2.0F);
00569         result.StrokeThickness(4.0F);
00570         return result;
00571     }
00572
00573     // - - PreComp layer: Controls - 01 - Check - 18 - PressedOffToNormalOn
00574     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00575     // Shape tree root for layer: Shape Layer 1
00576     // Path 1
00577     CompositionSpriteShape SpriteShape_01()
00578     {
00579         // Offset:<24, 23>, Scale:<0.7, 0.7>
00580         const auto result = CreateSpriteShape(PathGeometry_01(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00581         result.StrokeBrush(_themeColor_Foreground);
00582         result.StrokeDashCap(CompositionStrokeCap::Round);
00583         result.StrokeStartCap(CompositionStrokeCap::Round);
00584         result.StrokeEndCap(CompositionStrokeCap::Round);
00585         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00586         result.StrokeMiterLimit(2.0F);
00587         result.StrokeThickness(4.0F);
00588         return result;
00589     }
00590
00591     // - - PreComp layer: Controls - 01 - Check - 17 - PressedOffToPointerOverOn
00592     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00593     // Shape tree root for layer: Shape Layer 1
00594     // Path 1
00595     CompositionSpriteShape SpriteShape_02()
00596     {
00597         // Offset:<24, 23>, Scale:<0.7, 0.7>
00598         const auto result = CreateSpriteShape(PathGeometry_02(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00599         result.StrokeBrush(_themeColor_Foreground);
00600         result.StrokeDashCap(CompositionStrokeCap::Round);
00601         result.StrokeStartCap(CompositionStrokeCap::Round);
00602         result.StrokeEndCap(CompositionStrokeCap::Round);
00603         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00604         result.StrokeMiterLimit(2.0F);
00605         result.StrokeThickness(4.0F);
00606         return result;
00607     }
00608
00609     // - - PreComp layer: Controls - 01 - Check - 16 - PressedOffToPressedOn
00610     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00611     // Shape tree root for layer: Shape Layer 2
00612     // Path 1
00613     CompositionSpriteShape SpriteShape_03()
00614     {
00615         // Offset:<24, 23>, Scale:<0.7, 0.7>
00616         const auto result = CreateSpriteShape(PathGeometry_03(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00617         result.StrokeBrush(_themeColor_Foreground);
00618         result.StrokeDashCap(CompositionStrokeCap::Round);
00619         result.StrokeStartCap(CompositionStrokeCap::Round);
00620         result.StrokeEndCap(CompositionStrokeCap::Round);
00621         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00622         result.StrokeMiterLimit(2.0F);
00623         result.StrokeThickness(4.0F);
00624         return result;
00625     }
00626
00627     // - - PreComp layer: Controls - 01 - Check - 15 - PressedOnToNormalOff
00628     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00629     // Shape tree root for layer: Shape Layer 1
00630     // Path 1
00631     CompositionSpriteShape SpriteShape_04()
00632     {
00633         // Offset:<24, 23>, Scale:<0.7, 0.7>
00634         const auto result = CreateSpriteShape(PathGeometry_04(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00635         result.StrokeBrush(_themeColor_Foreground);
00636         result.StrokeDashCap(CompositionStrokeCap::Round);
00637         result.StrokeStartCap(CompositionStrokeCap::Round);
00638         result.StrokeEndCap(CompositionStrokeCap::Round);
00639         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00640         result.StrokeMiterLimit(2.0F);
00641         result.StrokeThickness(4.0F);
00642         return result;
00643     }
00644
00645     // - - PreComp layer: Controls - 01 - Check - 14 - PressedOnToPointerOverOff
00646     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00647     // Shape tree root for layer: Shape Layer 1
00648     // Path 1
00649     CompositionSpriteShape SpriteShape_05()
00650     {
00651         // Offset:<24, 23>, Scale:<0.7, 0.7>
00652         const auto result = CreateSpriteShape(PathGeometry_05(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00653         result.StrokeBrush(_themeColor_Foreground);
00654         result.StrokeDashCap(CompositionStrokeCap::Round);
00655         result.StrokeStartCap(CompositionStrokeCap::Round);
00656         result.StrokeEndCap(CompositionStrokeCap::Round);
00657         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00658         result.StrokeMiterLimit(2.0F);
00659         result.StrokeThickness(4.0F);
00660         return result;
00661     }
00662
00663     // - - PreComp layer: Controls - 01 - Check - 13 - PressedOnToPressedOff
00664     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00665     // Shape tree root for layer: Shape Layer 1
00666     // Path 1
00667     CompositionSpriteShape SpriteShape_06()
00668     {
00669         // Offset:<24, 23>, Scale:<0.7, 0.7>
00670         const auto result = CreateSpriteShape(PathGeometry_06(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00671         result.StrokeBrush(_themeColor_Foreground);
00672         result.StrokeDashCap(CompositionStrokeCap::Round);
00673         result.StrokeStartCap(CompositionStrokeCap::Round);
00674         result.StrokeEndCap(CompositionStrokeCap::Round);
00675         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00676         result.StrokeMiterLimit(2.0F);
00677         result.StrokeThickness(4.0F);
00678         return result;
00679     }
00680
00681     // - - PreComp layer: Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn -
00682     // Tweak
00683     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00684     // Shape tree root for layer: Shape Layer 1
00685     // Path 1
00686     CompositionSpriteShape SpriteShape_07()
00687     {
00688         // Offset:<24, 23>, Scale:<0.7, 0.7>
00689         const auto result = CreateSpriteShape(PathGeometry_07(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00690         result.StrokeBrush(_themeColor_Foreground);
00691         result.StrokeDashCap(CompositionStrokeCap::Round);
00692         result.StrokeStartCap(CompositionStrokeCap::Round);
00693         result.StrokeEndCap(CompositionStrokeCap::Round);
00694         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00695         result.StrokeMiterLimit(2.0F);
00696         result.StrokeThickness(4.0F);
00697         return result;
00698     }
00699
00700     // - - PreComp layer: Controls - 01 - Check - 09 - PointerOverOnToPressedOn
00701     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00702     // Shape tree root for layer: Shape Layer 1
00703     // Path 1
00704     CompositionSpriteShape SpriteShape_08()
00705     {
00706         // Offset:<24, 23>, Scale:<0.7, 0.7>
00707         const auto result = CreateSpriteShape(PathGeometry_08(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00708         result.StrokeBrush(_themeColor_Foreground);
00709         result.StrokeDashCap(CompositionStrokeCap::Round);
00710         result.StrokeStartCap(CompositionStrokeCap::Round);
00711         result.StrokeEndCap(CompositionStrokeCap::Round);
00712         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00713         result.StrokeMiterLimit(2.0F);
00714         result.StrokeThickness(4.0F);
00715         return result;
00716     }
00717
00718     // - - PreComp layer: Controls - 01 - Check - 08 - PointerOverOnToNormalOn
00719     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00720     // Shape tree root for layer: Shape Layer 1
00721     // Path 1
00722     CompositionSpriteShape SpriteShape_09()
00723     {
00724         // Offset:<24, 23>, Scale:<0.7, 0.7>
00725         const auto result = CreateSpriteShape(PathGeometry_09(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00726         result.StrokeBrush(_themeColor_Foreground);
00727         result.StrokeDashCap(CompositionStrokeCap::Round);
00728         result.StrokeStartCap(CompositionStrokeCap::Round);
00729         result.StrokeEndCap(CompositionStrokeCap::Round);
00730         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00731         result.StrokeMiterLimit(2.0F);
00732         result.StrokeThickness(4.0F);
00733         return result;
00734     }
00735
00736     // - - PreComp layer: Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff -
00737     // Tweak
00738     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00739     // Shape tree root for layer: Shape Layer 1
00740     // Path 1
00741     CompositionSpriteShape SpriteShape_10()
00742     {
00743         // Offset:<24, 23>, Scale:<0.7, 0.7>
00744         const auto result = CreateSpriteShape(PathGeometry_10(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00745         result.StrokeBrush(_themeColor_Foreground);
00746         result.StrokeDashCap(CompositionStrokeCap::Round);
00747         result.StrokeStartCap(CompositionStrokeCap::Round);
00748         result.StrokeEndCap(CompositionStrokeCap::Round);
00749         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00750         result.StrokeMiterLimit(2.0F);
00751         result.StrokeThickness(4.0F);
00752         return result;
00753     }
00754
00755     // - - PreComp layer: Controls - 01 - Check - 04 - NormalOffToNormalOn
00756     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00757     // Shape tree root for layer: Shape Layer 1
00758     // Path 1
00759     CompositionSpriteShape SpriteShape_11()
00760     {
00761         // Offset:<24, 23>, Scale:<0.7, 0.7>
00762         const auto result = CreateSpriteShape(PathGeometry_11(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00763         result.StrokeBrush(_themeColor_Foreground);
00764         result.StrokeDashCap(CompositionStrokeCap::Round);
00765         result.StrokeStartCap(CompositionStrokeCap::Round);
00766         result.StrokeEndCap(CompositionStrokeCap::Round);
00767         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00768         result.StrokeMiterLimit(2.0F);
00769         result.StrokeThickness(4.0F);
00770         return result;
00771     }
00772
00773     // - - PreComp layer: Controls - 01 - Check - 03 - NormalOnToPressedOn
00774     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00775     // Shape tree root for layer: Check
00776     // Path 1
00777     CompositionSpriteShape SpriteShape_12()
00778     {
00779         // Offset:<24, 23>, Scale:<0.7, 0.7>
00780         const auto result = CreateSpriteShape(_pathGeometry_09, { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00781         result.StrokeBrush(_themeColor_Foreground);
00782         result.StrokeDashCap(CompositionStrokeCap::Round);
00783         result.StrokeStartCap(CompositionStrokeCap::Round);
00784         result.StrokeEndCap(CompositionStrokeCap::Round);
00785         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00786         result.StrokeMiterLimit(2.0F);
00787         result.StrokeThickness(4.0F);
00788         return result;
00789     }
00790
00791     // - - PreComp layer: Controls - 01 - Check - 02 - NormalOnToPointerOverOn
00792     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00793     // Shape tree root for layer: Check
00794     // Path 1
00795     CompositionSpriteShape SpriteShape_13()
00796     {
00797         // Offset:<24, 23>, Scale:<0.7, 0.7>
00798         const auto result = CreateSpriteShape(_pathGeometry_09, { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00799         result.StrokeBrush(_themeColor_Foreground);
00800         result.StrokeDashCap(CompositionStrokeCap::Round);
00801         result.StrokeStartCap(CompositionStrokeCap::Round);
00802         result.StrokeEndCap(CompositionStrokeCap::Round);
00803         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00804         result.StrokeMiterLimit(2.0F);
00805         result.StrokeThickness(4.0F);
00806         return result;
00807     }
00808
00809     // - - PreComp layer: Controls - 01 - Check - 01 - NormalOnToNormalOff
00810     // - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00811     // Shape tree root for layer: Shape Layer 1
00812     // Path 1
00813     CompositionSpriteShape SpriteShape_14()
00814     {
00815         // Offset:<24, 23>, Scale:<0.7, 0.7>
00816         const auto result = CreateSpriteShape(PathGeometry_12(), { 0.699999988F, 0.0F, 0.0F, 0.699999988F, 24.0F, 23.0F });
00817         result.StrokeBrush(_themeColor_Foreground);
00818         result.StrokeDashCap(CompositionStrokeCap::Round);
00819         result.StrokeStartCap(CompositionStrokeCap::Round);
00820         result.StrokeEndCap(CompositionStrokeCap::Round);
00821         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00822         result.StrokeMiterLimit(2.0F);
00823         result.StrokeThickness(4.0F);
00824         return result;
00825     }
00826
00827     // PreComp layer: Indeterminate State
00828     ContainerVisual ContainerVisual_00()
00829     {
00830         const auto result = _c.CreateContainerVisual();
00831         result.IsVisible(false);
00832         // Offset:<24, 24>, Scale:<1.05, 1.05>
00833         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
00834         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00835         result.Children().InsertAtTop(ContainerVisual_01());
00836         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_00(), RootProgress());
00837         return result;
00838     }
00839
00840     // PreComp layer: Indeterminate State
00841     // Transforms for Indeterminate State Scale(1,1,0), Offset(-24,-24,0)
00842     ContainerVisual ContainerVisual_01()
00843     {
00844         const auto result = _c.CreateContainerVisual();
00845         result.Clip(InsetClip_0());
00846         result.Size({ 48.0F, 48.0F });
00847         // Offset:<-24, -24>, Scale:<1, 1>
00848         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
00849         // Shape tree root for layer: Shape Layer 1
00850         result.Children().InsertAtTop(ShapeVisual_00());
00851         return result;
00852     }
00853
00854     // PreComp layer: Controls - 01 - Check - 18 - PressedOffToNormalOn
00855     ContainerVisual ContainerVisual_02()
00856     {
00857         const auto result = _c.CreateContainerVisual();
00858         result.IsVisible(false);
00859         // Offset:<24, 24>, Scale:<1.05, 1.05>
00860         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
00861         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00862         result.Children().InsertAtTop(ContainerVisual_03());
00863         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_01(), _rootProgress);
00864         return result;
00865     }
00866
00867     // PreComp layer: Controls - 01 - Check - 18 - PressedOffToNormalOn
00868     // Transforms for Controls - 01 - Check - 18 - PressedOffToNormalOn
00869     // Scale(1,1,0), Offset(-24,-24,0)
00870     ContainerVisual ContainerVisual_03()
00871     {
00872         const auto result = _c.CreateContainerVisual();
00873         result.Clip(_insetClip_0);
00874         result.Size({ 48.0F, 48.0F });
00875         // Offset:<-24, -24>, Scale:<1, 1>
00876         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
00877         // Shape tree root for layer: Shape Layer 1
00878         result.Children().InsertAtTop(ShapeVisual_01());
00879         return result;
00880     }
00881
00882     // PreComp layer: Controls - 01 - Check - 17 - PressedOffToPointerOverOn
00883     ContainerVisual ContainerVisual_04()
00884     {
00885         const auto result = _c.CreateContainerVisual();
00886         result.IsVisible(false);
00887         // Offset:<24, 24>, Scale:<1.05, 1.05>
00888         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
00889         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00890         result.Children().InsertAtTop(ContainerVisual_05());
00891         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_02(), _rootProgress);
00892         return result;
00893     }
00894
00895     // PreComp layer: Controls - 01 - Check - 17 - PressedOffToPointerOverOn
00896     // Transforms for Controls - 01 - Check - 17 - PressedOffToPointerOverOn
00897     // Scale(1,1,0), Offset(-24,-24,0)
00898     ContainerVisual ContainerVisual_05()
00899     {
00900         const auto result = _c.CreateContainerVisual();
00901         result.Clip(_insetClip_0);
00902         result.Size({ 48.0F, 48.0F });
00903         // Offset:<-24, -24>, Scale:<1, 1>
00904         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
00905         // Shape tree root for layer: Shape Layer 1
00906         result.Children().InsertAtTop(ShapeVisual_02());
00907         return result;
00908     }
00909
00910     // PreComp layer: Controls - 01 - Check - 16 - PressedOffToPressedOn
00911     ContainerVisual ContainerVisual_06()
00912     {
00913         const auto result = _c.CreateContainerVisual();
00914         result.IsVisible(false);
00915         // Offset:<24, 24>, Scale:<1.05, 1.05>
00916         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
00917         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00918         result.Children().InsertAtTop(ContainerVisual_07());
00919         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_03(), _rootProgress);
00920         return result;
00921     }
00922
00923     // PreComp layer: Controls - 01 - Check - 16 - PressedOffToPressedOn
00924     // Transforms for Controls - 01 - Check - 16 - PressedOffToPressedOn
00925     // Scale(1,1,0), Offset(-24,-24,0)
00926     ContainerVisual ContainerVisual_07()
00927     {
00928         const auto result = _c.CreateContainerVisual();
00929         result.Clip(_insetClip_0);
00930         result.Size({ 48.0F, 48.0F });
00931         // Offset:<-24, -24>, Scale:<1, 1>
00932         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
00933         // Shape tree root for layer: Shape Layer 2
00934         result.Children().InsertAtTop(ShapeVisual_03());
00935         return result;
00936     }
00937
00938     // PreComp layer: Controls - 01 - Check - 15 - PressedOnToNormalOff
00939     ContainerVisual ContainerVisual_08()
00940     {
00941         const auto result = _c.CreateContainerVisual();
00942         result.IsVisible(false);
00943         // Offset:<24, 24>, Scale:<1.05, 1.05>
00944         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
00945         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00946         result.Children().InsertAtTop(ContainerVisual_09());
00947         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_04(), _rootProgress);
00948         return result;
00949     }
00950
00951     // PreComp layer: Controls - 01 - Check - 15 - PressedOnToNormalOff
00952     // Transforms for Controls - 01 - Check - 15 - PressedOnToNormalOff
00953     // Scale(1,1,0), Offset(-24,-24,0)
00954     ContainerVisual ContainerVisual_09()
00955     {
00956         const auto result = _c.CreateContainerVisual();
00957         result.Clip(_insetClip_0);
00958         result.Size({ 48.0F, 48.0F });
00959         // Offset:<-24, -24>, Scale:<1, 1>
00960         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
00961         // Shape tree root for layer: Shape Layer 1
00962         result.Children().InsertAtTop(ShapeVisual_04());
00963         return result;
00964     }
00965
00966     // PreComp layer: Controls - 01 - Check - 14 - PressedOnToPointerOverOff
00967     ContainerVisual ContainerVisual_10()
00968     {
00969         const auto result = _c.CreateContainerVisual();
00970         result.IsVisible(false);
00971         // Offset:<24, 24>, Scale:<1.05, 1.05>
00972         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
00973         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
00974         result.Children().InsertAtTop(ContainerVisual_11());
00975         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_05(), _rootProgress);
00976         return result;
00977     }
00978
00979     // PreComp layer: Controls - 01 - Check - 14 - PressedOnToPointerOverOff
00980     // Transforms for Controls - 01 - Check - 14 - PressedOnToPointerOverOff
00981     // Scale(1,1,0), Offset(-24,-24,0)
00982     ContainerVisual ContainerVisual_11()
00983     {
00984         const auto result = _c.CreateContainerVisual();
00985         result.Clip(_insetClip_0);
00986         result.Size({ 48.0F, 48.0F });
00987         // Offset:<-24, -24>, Scale:<1, 1>
00988         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
00989         // Shape tree root for layer: Shape Layer 1
00990         result.Children().InsertAtTop(ShapeVisual_05());
00991         return result;
00992     }
00993
00994     // PreComp layer: Controls - 01 - Check - 13 - PressedOnToPressedOff
00995     ContainerVisual ContainerVisual_12()
00996     {
00997         const auto result = _c.CreateContainerVisual();
00998         result.IsVisible(false);
00999         // Offset:<24, 24>, Scale:<1.05, 1.05>
01000         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01001         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01002         result.Children().InsertAtTop(ContainerVisual_13());
01003         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_06(), _rootProgress);
01004         return result;
01005     }
01006
01007     // PreComp layer: Controls - 01 - Check - 13 - PressedOnToPressedOff
01008     // Transforms for Controls - 01 - Check - 13 - PressedOnToPressedOff
01009     // Scale(1,1,0), Offset(-24,-24,0)
01010     ContainerVisual ContainerVisual_13()
01011     {
01012         const auto result = _c.CreateContainerVisual();
01013         result.Clip(_insetClip_0);
01014         result.Size({ 48.0F, 48.0F });
01015         // Offset:<-24, -24>, Scale:<1, 1>
01016         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01017         // Shape tree root for layer: Shape Layer 1
01018         result.Children().InsertAtTop(ShapeVisual_06());
01019         return result;
01020     }
01021
01022     // PreComp layer: Controls - 01 - Check - 12 - PointerOverOffToPressedOff
01023     ContainerVisual ContainerVisual_14()
01024     {
01025         const auto result = _c.CreateContainerVisual();
01026         result.IsVisible(false);
01027         // Offset:<24, 24>, Scale:<1.05, 1.05>
01028         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01029         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01030         result.Children().InsertAtTop(ContainerVisual_15());
01031         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_07(), _rootProgress);
01032         return result;
01033     }
01034
01035     // PreComp layer: Controls - 01 - Check - 12 - PointerOverOffToPressedOff
01036     // Transforms for Controls - 01 - Check - 12 - PointerOverOffToPressedOff
01037     // Scale(1,1,0), Offset(-24,-24,0)
01038     ContainerVisual ContainerVisual_15()
01039     {
01040         const auto result = _c.CreateContainerVisual();
01041         result.Clip(_insetClip_0);
01042         result.Size({ 48.0F, 48.0F });
01043         // Offset:<-24, -24>, Scale:<1, 1>
01044         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01045         result.Children().InsertAtTop(ContainerVisual_16());
01046         return result;
01047     }
01048
01049     // - PreComp layer: Controls - 01 - Check - 12 - PointerOverOffToPressedOff
01050     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01051     ContainerVisual ContainerVisual_16()
01052     {
01053         const auto result = _c.CreateContainerVisual();
01054         result.Clip(_insetClip_0);
01055         result.Size({ 48.0F, 48.0F });
01056         return result;
01057     }
01058
01059     // PreComp layer: Controls - 01 - Check - 11 - PointerOverOffToNormalOff
01060     ContainerVisual ContainerVisual_17()
01061     {
01062         const auto result = _c.CreateContainerVisual();
01063         result.IsVisible(false);
01064         // Offset:<24, 24>, Scale:<1.05, 1.05>
01065         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01066         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01067         result.Children().InsertAtTop(ContainerVisual_18());
01068         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_08(), _rootProgress);
01069         return result;
01070     }
01071
01072     // PreComp layer: Controls - 01 - Check - 11 - PointerOverOffToNormalOff
01073     // Transforms for Controls - 01 - Check - 11 - PointerOverOffToNormalOff
01074     // Scale(1,1,0), Offset(-24,-24,0)
01075     ContainerVisual ContainerVisual_18()
01076     {
01077         const auto result = _c.CreateContainerVisual();
01078         result.Clip(_insetClip_0);
01079         result.Size({ 48.0F, 48.0F });
01080         // Offset:<-24, -24>, Scale:<1, 1>
01081         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01082         result.Children().InsertAtTop(ContainerVisual_19());
01083         return result;
01084     }
01085
01086     // - PreComp layer: Controls - 01 - Check - 11 - PointerOverOffToNormalOff
01087     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01088     ContainerVisual ContainerVisual_19()
01089     {
01090         const auto result = _c.CreateContainerVisual();
01091         result.Clip(_insetClip_0);
01092         result.Size({ 48.0F, 48.0F });
01093         return result;
01094     }
01095
01096     // PreComp layer: Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn
01097     ContainerVisual ContainerVisual_20()
01098     {
01099         const auto result = _c.CreateContainerVisual();
01100         result.IsVisible(false);
01101         // Offset:<24, 24>, Scale:<1.05, 1.05>
01102         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01103         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01104         result.Children().InsertAtTop(ContainerVisual_21());
01105         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_09(), _rootProgress);
01106         return result;
01107     }
01108
01109     // PreComp layer: Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn
01110     // Transforms for Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn
01111     // Scale(1,1,0), Offset(-24,-24,0)
01112     ContainerVisual ContainerVisual_21()
01113     {
01114         const auto result = _c.CreateContainerVisual();
01115         result.Clip(_insetClip_0);
01116         result.Size({ 48.0F, 48.0F });
01117         // Offset:<-24, -24>, Scale:<1, 1>
01118         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01119         // Shape tree root for layer: Shape Layer 1
01120         result.Children().InsertAtTop(ShapeVisual_07());
01121         return result;
01122     }
01123
01124     // PreComp layer: Controls - 01 - Check - 09 - PointerOverOnToPressedOn
01125     ContainerVisual ContainerVisual_22()
01126     {
01127         const auto result = _c.CreateContainerVisual();
01128         result.IsVisible(false);
01129         // Offset:<24, 24>, Scale:<1.05, 1.05>
01130         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01131         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01132         result.Children().InsertAtTop(ContainerVisual_23());
01133         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_10(), _rootProgress);
01134         return result;
01135     }
01136
01137     // PreComp layer: Controls - 01 - Check - 09 - PointerOverOnToPressedOn
01138     // Transforms for Controls - 01 - Check - 09 - PointerOverOnToPressedOn
01139     // Scale(1,1,0), Offset(-24,-24,0)
01140     ContainerVisual ContainerVisual_23()
01141     {
01142         const auto result = _c.CreateContainerVisual();
01143         result.Clip(_insetClip_0);
01144         result.Size({ 48.0F, 48.0F });
01145         // Offset:<-24, -24>, Scale:<1, 1>
01146         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01147         // Shape tree root for layer: Shape Layer 1
01148         result.Children().InsertAtTop(ShapeVisual_08());
01149         return result;
01150     }
01151
01152     // PreComp layer: Controls - 01 - Check - 08 - PointerOverOnToNormalOn
01153     ContainerVisual ContainerVisual_24()
01154     {
01155         const auto result = _c.CreateContainerVisual();
01156         result.IsVisible(false);
01157         // Offset:<24, 24>, Scale:<1.05, 1.05>
01158         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01159         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01160         result.Children().InsertAtTop(ContainerVisual_25());
01161         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_11(), _rootProgress);
01162         return result;
01163     }
01164
01165     // PreComp layer: Controls - 01 - Check - 08 - PointerOverOnToNormalOn
01166     // Transforms for Controls - 01 - Check - 08 - PointerOverOnToNormalOn
01167     // Scale(1,1,0), Offset(-24,-24,0)
01168     ContainerVisual ContainerVisual_25()
01169     {
01170         const auto result = _c.CreateContainerVisual();
01171         result.Clip(_insetClip_0);
01172         result.Size({ 48.0F, 48.0F });
01173         // Offset:<-24, -24>, Scale:<1, 1>
01174         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01175         // Shape tree root for layer: Shape Layer 1
01176         result.Children().InsertAtTop(ShapeVisual_09());
01177         return result;
01178     }
01179
01180     // PreComp layer: Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff
01181     ContainerVisual ContainerVisual_26()
01182     {
01183         const auto result = _c.CreateContainerVisual();
01184         result.IsVisible(false);
01185         // Offset:<24, 24>, Scale:<1.05, 1.05>
01186         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01187         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01188         result.Children().InsertAtTop(ContainerVisual_27());
01189         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_12(), _rootProgress);
01190         return result;
01191     }
01192
01193     // PreComp layer: Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff
01194     // Transforms for Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff
01195     // Scale(1,1,0), Offset(-24,-24,0)
01196     ContainerVisual ContainerVisual_27()
01197     {
01198         const auto result = _c.CreateContainerVisual();
01199         result.Clip(_insetClip_0);
01200         result.Size({ 48.0F, 48.0F });
01201         // Offset:<-24, -24>, Scale:<1, 1>
01202         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01203         // Shape tree root for layer: Shape Layer 1
01204         result.Children().InsertAtTop(ShapeVisual_10());
01205         return result;
01206     }
01207
01208     // PreComp layer: Controls - 01 - Check - 06 - NormalOffToPressedOff
01209     ContainerVisual ContainerVisual_28()
01210     {
01211         const auto result = _c.CreateContainerVisual();
01212         result.IsVisible(false);
01213         // Offset:<24, 24>, Scale:<1.05, 1.05>
01214         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01215         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01216         result.Children().InsertAtTop(ContainerVisual_29());
01217         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_13(), _rootProgress);
01218         return result;
01219     }
01220
01221     // PreComp layer: Controls - 01 - Check - 06 - NormalOffToPressedOff
01222     // Transforms for Controls - 01 - Check - 06 - NormalOffToPressedOff
01223     // Scale(1,1,0), Offset(-24,-24,0)
01224     ContainerVisual ContainerVisual_29()
01225     {
01226         const auto result = _c.CreateContainerVisual();
01227         result.Clip(_insetClip_0);
01228         result.Size({ 48.0F, 48.0F });
01229         // Offset:<-24, -24>, Scale:<1, 1>
01230         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01231         result.Children().InsertAtTop(ContainerVisual_30());
01232         return result;
01233     }
01234
01235     // - PreComp layer: Controls - 01 - Check - 06 - NormalOffToPressedOff
01236     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01237     ContainerVisual ContainerVisual_30()
01238     {
01239         const auto result = _c.CreateContainerVisual();
01240         result.Clip(_insetClip_0);
01241         result.Size({ 48.0F, 48.0F });
01242         return result;
01243     }
01244
01245     // PreComp layer: Controls - 01 - Check - 05 - NormalOffToPointerOverOff
01246     ContainerVisual ContainerVisual_31()
01247     {
01248         const auto result = _c.CreateContainerVisual();
01249         result.IsVisible(false);
01250         // Offset:<24, 24>, Scale:<1.05, 1.05>
01251         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01252         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01253         result.Children().InsertAtTop(ContainerVisual_32());
01254         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_14(), _rootProgress);
01255         return result;
01256     }
01257
01258     // PreComp layer: Controls - 01 - Check - 05 - NormalOffToPointerOverOff
01259     // Transforms for Controls - 01 - Check - 05 - NormalOffToPointerOverOff Scale(1,1,0),
01260     // Offset(-24,-24,0)
01261     ContainerVisual ContainerVisual_32()
01262     {
01263         const auto result = _c.CreateContainerVisual();
01264         result.Clip(_insetClip_0);
01265         result.Size({ 48.0F, 48.0F });
01266         // Offset:<-24, -24>, Scale:<1, 1>
01267         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01268         result.Children().InsertAtTop(ContainerVisual_33());
01269         return result;
01270     }
01271
01272     // - PreComp layer: Controls - 01 - Check - 05 - NormalOffToPointerOverOff
01273     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01274     ContainerVisual ContainerVisual_33()
01275     {
01276         const auto result = _c.CreateContainerVisual();
01277         result.Clip(_insetClip_0);
01278         result.Size({ 48.0F, 48.0F });
01279         return result;
01280     }
01281
01282     // PreComp layer: Controls - 01 - Check - 04 - NormalOffToNormalOn
01283     ContainerVisual ContainerVisual_34()
01284     {
01285         const auto result = _c.CreateContainerVisual();
01286         result.IsVisible(false);
01287         // Offset:<24, 24>, Scale:<1.05, 1.05>
01288         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01289         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01290         result.Children().InsertAtTop(ContainerVisual_35());
01291         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_15(), _rootProgress);
01292         return result;
01293     }
01294
01295     // PreComp layer: Controls - 01 - Check - 04 - NormalOffToNormalOn
01296     // Transforms for Controls - 01 - Check - 04 - NormalOffToNormalOn
01297     // Scale(1,1,0), Offset(-24,-24,0)
01298     ContainerVisual ContainerVisual_35()
01299     {
01300         const auto result = _c.CreateContainerVisual();
01301         result.Clip(_insetClip_0);
01302         result.Size({ 48.0F, 48.0F });
01303         // Offset:<-24, -24>, Scale:<1, 1>
01304         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01305         // Shape tree root for layer: Shape Layer 1
01306         result.Children().InsertAtTop(ShapeVisual_11());
01307         return result;
01308     }
01309
01310     // PreComp layer: Controls - 01 - Check - 03 - NormalOnToPressedOn
01311     ContainerVisual ContainerVisual_36()
01312     {
01313         const auto result = _c.CreateContainerVisual();
01314         result.IsVisible(false);
01315         // Offset:<24, 24>, Scale:<1.05, 1.05>
01316         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01317         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01318         result.Children().InsertAtTop(ContainerVisual_37());
01319         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_16(), _rootProgress);
01320         return result;
01321     }
01322
01323     // PreComp layer: Controls - 01 - Check - 03 - NormalOnToPressedOn
01324     // Transforms for Controls - 01 - Check - 03 - NormalOnToPressedOn
01325     // Scale(1,1,0), Offset(-24,-24,0)
01326     ContainerVisual ContainerVisual_37()
01327     {
01328         const auto result = _c.CreateContainerVisual();
01329         result.Clip(_insetClip_0);
01330         result.Size({ 48.0F, 48.0F });
01331         // Offset:<-24, -24>, Scale:<1, 1>
01332         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01333         // Shape tree root for layer: Check
01334         result.Children().InsertAtTop(ShapeVisual_12());
01335         return result;
01336     }
01337
01338     // PreComp layer: Controls - 01 - Check - 02 - NormalOnToPointerOverOn
01339     ContainerVisual ContainerVisual_38()
01340     {
01341         const auto result = _c.CreateContainerVisual();
01342         result.IsVisible(false);
01343         // Offset:<24, 24>, Scale:<1.05, 1.05>
01344         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01345         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01346         result.Children().InsertAtTop(ContainerVisual_39());
01347         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_17(), _rootProgress);
01348         return result;
01349     }
01350
01351     // PreComp layer: Controls - 01 - Check - 02 - NormalOnToPointerOverOn
01352     // Transforms for Controls - 01 - Check - 02 - NormalOnToPointerOverOn
01353     // Scale(1,1,0), Offset(-24,-24,0)
01354     ContainerVisual ContainerVisual_39()
01355     {
01356         const auto result = _c.CreateContainerVisual();
01357         result.Clip(_insetClip_0);
01358         result.Size({ 48.0F, 48.0F });
01359         // Offset:<-24, -24>, Scale:<1, 1>
01360         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01361         // Shape tree root for layer: Check
01362         result.Children().InsertAtTop(ShapeVisual_13());
01363         return result;
01364     }
01365
01366     // PreComp layer: Controls - 01 - Check - 01 - NormalOnToNormalOff
01367     ContainerVisual ContainerVisual_40()
01368     {
01369         const auto result = _c.CreateContainerVisual();
01370         // Offset:<24, 24>, Scale:<1.05, 1.05>
01371         result.TransformMatrix({ 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 1.04999995F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 24.0F, 24.0F, 0.0F, 1.0F });
01372         // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01373         result.Children().InsertAtTop(ContainerVisual_41());
01374         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_18(), _rootProgress);
01375         return result;
01376     }
01377
01378     // PreComp layer: Controls - 01 - Check - 01 - NormalOnToNormalOff
01379     // Transforms for Controls - 01 - Check - 01 - NormalOnToNormalOff
01380     // Scale(1,1,0), Offset(-24,-24,0)
01381     ContainerVisual ContainerVisual_41()
01382     {
01383         const auto result = _c.CreateContainerVisual();
01384         result.Clip(_insetClip_0);
01385         result.Size({ 48.0F, 48.0F });
01386         // Offset:<-24, -24>, Scale:<1, 1>
01387         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -24.0F, -24.0F, 0.0F, 1.0F });
01388         // Shape tree root for layer: Shape Layer 1
01389         result.Children().InsertAtTop(ShapeVisual_14());
01390         return result;
01391     }
01392
01393     // The root of the composition.
01394     ContainerVisual Root()
01395     {
01396         const auto result = _root = _c.CreateContainerVisual();
01397         const auto propertySet = result.Properties();
01398         propertySet.InsertScalar(L"Progress", 0.0F);
01399         const auto children = result.Children();
01400         // PreComp layer: Indeterminate State
01401         children.InsertAtTop(ContainerVisual_00());
01402         // PreComp layer: Controls - 01 - Check - 18 - PressedOffToNormalOn
01403         children.InsertAtTop(ContainerVisual_02());
01404         // PreComp layer: Controls - 01 - Check - 17 - PressedOffToPointerOverOn
01405         children.InsertAtTop(ContainerVisual_04());
01406         // PreComp layer: Controls - 01 - Check - 16 - PressedOffToPressedOn
01407         children.InsertAtTop(ContainerVisual_06());
01408         // PreComp layer: Controls - 01 - Check - 15 - PressedOnToNormalOff
01409         children.InsertAtTop(ContainerVisual_08());
01410         // PreComp layer: Controls - 01 - Check - 14 - PressedOnToPointerOverOff
01411         children.InsertAtTop(ContainerVisual_10());
01412         // PreComp layer: Controls - 01 - Check - 13 - PressedOnToPressedOff
01413         children.InsertAtTop(ContainerVisual_12());
01414         // PreComp layer: Controls - 01 - Check - 12 - PointerOverOffToPressedOff
01415         children.InsertAtTop(ContainerVisual_14());
01416         // PreComp layer: Controls - 01 - Check - 11 - PointerOverOffToNormalOff
01417         children.InsertAtTop(ContainerVisual_17());
01418         // PreComp layer: Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn
01419         children.InsertAtTop(ContainerVisual_20());
01420         // PreComp layer: Controls - 01 - Check - 09 - PointerOverOnToPressedOn
01421         children.InsertAtTop(ContainerVisual_22());
01422         // PreComp layer: Controls - 01 - Check - 08 - PointerOverOnToNormalOn
01423         children.InsertAtTop(ContainerVisual_24());
01424         // PreComp layer: Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff
01425         children.InsertAtTop(ContainerVisual_26());
01426         // PreComp layer: Controls - 01 - Check - 06 - NormalOffToPressedOff
01427         children.InsertAtTop(ContainerVisual_28());
01428         // PreComp layer: Controls - 01 - Check - 05 - NormalOffToPointerOverOff
01429         children.InsertAtTop(ContainerVisual_31());
01430         // PreComp layer: Controls - 01 - Check - 04 - NormalOffToNormalOn
01431         children.InsertAtTop(ContainerVisual_34());
01432         // PreComp layer: Controls - 01 - Check - 03 - NormalOnToPressedOn
01433         children.InsertAtTop(ContainerVisual_36());
01434         // PreComp layer: Controls - 01 - Check - 02 - NormalOnToPointerOverOn
01435         children.InsertAtTop(ContainerVisual_38());
01436         // PreComp layer: Controls - 01 - Check - 01 - NormalOnToNormalOff
01437         children.InsertAtTop(ContainerVisual_40());
01438         return result;
01439     }
01440
01441     CubicBezierEasingFunction CubicBezierEasingFunction_0()
01442     {
01443         return _cubicBezierEasingFunction_0 = _c.CreateCubicBezierEasingFunction({ 0.550000012F, 0.0F }, { 0.0F, 1.0F });
01444     }
01445
01446     CubicBezierEasingFunction CubicBezierEasingFunction_1()
01447     {
01448         return _cubicBezierEasingFunction_1 = _c.CreateCubicBezierEasingFunction({ 0.166999996F, 0.166999996F }, { 0.833000004F, 0.833000004F });
01449     }
01450
01451     ExpressionAnimation RootProgress()
01452     {
01453         const auto result = _rootProgress = _c.CreateExpressionAnimation(L"_.Progress");
01454         result.SetReferenceParameter(L"_", _root);
01455         return result;
01456     }
01457
01458     InsetClip InsetClip_0()
01459     {
01460         const auto result = _insetClip_0 = _c.CreateInsetClip();
01461         return result;
01462     }
01463
01464     // - - - - PreComp layer: Controls - 01 - Check - 18 - PressedOffToNormalOn
01465     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01466     // - - Shape tree root for layer: Shape Layer 1
01467     // -  Scale:0.7,0.7, Offset:<24, 23>
01468     // TrimEnd
01469     ScalarKeyFrameAnimation TrimEndScalarAnimation_0_to_1_0()
01470     {
01471         // Frame 0.
01472         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, StepThenHoldEasingFunction());
01473         // Frame 135.
01474         result.InsertKeyFrame(0.84375F, 0.0F, HoldThenStepEasingFunction());
01475         // Frame 154.
01476         result.InsertKeyFrame(0.962499976F, 1.0F, CubicBezierEasingFunction_0());
01477         return result;
01478     }
01479
01480     // - - - - PreComp layer: Controls - 01 - Check - 17 - PressedOffToPointerOverOn -
01481     // Tweak
01482     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01483     // - - Shape tree root for layer: Shape Layer 1
01484     // -  Scale:0.7,0.7, Offset:<24, 23>
01485     // TrimEnd
01486     ScalarKeyFrameAnimation TrimEndScalarAnimation_0_to_1_1()
01487     {
01488         // Frame 0.
01489         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
01490         // Frame 115.
01491         result.InsertKeyFrame(0.71875F, 0.0F, _holdThenStepEasingFunction);
01492         // Frame 134.
01493         result.InsertKeyFrame(0.837499976F, 1.0F, _cubicBezierEasingFunction_0);
01494         return result;
01495     }
01496
01497     // - - - - PreComp layer: Controls - 01 - Check - 16 - PressedOffToPressedOn
01498     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01499     // - - Shape tree root for layer: Shape Layer 2
01500     // -  Scale:0.7,0.7, Offset:<24, 23>
01501     // TrimEnd
01502     ScalarKeyFrameAnimation TrimEndScalarAnimation_0_to_1_2()
01503     {
01504         // Frame 0.
01505         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
01506         // Frame 105.
01507         result.InsertKeyFrame(0.65625F, 0.0F, _holdThenStepEasingFunction);
01508         // Frame 114.
01509         result.InsertKeyFrame(0.712499976F, 1.0F, _cubicBezierEasingFunction_0);
01510         return result;
01511     }
01512
01513     // - - - - PreComp layer: Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn -
01514     // Tweak
01515     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01516     // - - Shape tree root for layer: Shape Layer 1
01517     // -  Scale:0.7,0.7, Offset:<24, 23>
01518     // TrimEnd
01519     ScalarKeyFrameAnimation TrimEndScalarAnimation_0_to_1_3()
01520     {
01521         // Frame 0.
01522         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
01523         // Frame 60.
01524         result.InsertKeyFrame(0.375F, 0.0F, _holdThenStepEasingFunction);
01525         // Frame 79.
01526         result.InsertKeyFrame(0.493750006F, 1.0F, _cubicBezierEasingFunction_0);
01527         return result;
01528     }
01529
01530     // - - - - PreComp layer: Controls - 01 - Check - 04 - NormalOffToNormalOn
01531     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01532     // - - Shape tree root for layer: Shape Layer 1
01533     // -  Scale:0.7,0.7, Offset:<24, 23>
01534     // TrimEnd
01535     ScalarKeyFrameAnimation TrimEndScalarAnimation_0_to_1_4()
01536     {
01537         // Frame 0.
01538         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
01539         // Frame 15.
01540         result.InsertKeyFrame(0.09375F, 0.0F, _holdThenStepEasingFunction);
01541         // Frame 34.
01542         result.InsertKeyFrame(0.212500006F, 1.0F, _cubicBezierEasingFunction_0);
01543         return result;
01544     }
01545
01546     // - - - - PreComp layer: Controls - 01 - Check - 15 - PressedOnToNormalOff
01547     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01548     // - - Shape tree root for layer: Shape Layer 1
01549     // -  Scale:0.7,0.7, Offset:<24, 23>
01550     // TrimStart
01551     ScalarKeyFrameAnimation TrimStartScalarAnimation_0_to_1_0()
01552     {
01553         // Frame 0.
01554         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
01555         // Frame 100.
01556         result.InsertKeyFrame(0.625F, 0.0F, _holdThenStepEasingFunction);
01557         // Frame 104.
01558         result.InsertKeyFrame(0.649999976F, 1.0F, CubicBezierEasingFunction_1());
01559         return result;
01560     }
01561
01562     // - - - - PreComp layer: Controls - 01 - Check - 14 - PressedOnToPointerOverOff -
01563     // Tweak
01564     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01565     // - - Shape tree root for layer: Shape Layer 1
01566     // -  Scale:0.7,0.7, Offset:<24, 23>
01567     // TrimStart
01568     ScalarKeyFrameAnimation TrimStartScalarAnimation_0_to_1_1()
01569     {
01570         // Frame 0.
01571         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
01572         // Frame 95.
01573         result.InsertKeyFrame(0.59375F, 0.0F, _holdThenStepEasingFunction);
01574         // Frame 99.
01575         result.InsertKeyFrame(0.618749976F, 1.0F, _cubicBezierEasingFunction_1);
01576         return result;
01577     }
01578
01579     // - - - - PreComp layer: Controls - 01 - Check - 13 - PressedOnToPressedOff
01580     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01581     // - - Shape tree root for layer: Shape Layer 1
01582     // -  Scale:0.7,0.7, Offset:<24, 23>
01583     // TrimStart
01584     ScalarKeyFrameAnimation TrimStartScalarAnimation_0_to_1_2()
01585     {
01586         // Frame 0.
01587         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
01588         // Frame 90.
01589         result.InsertKeyFrame(0.5625F, 0.0F, _holdThenStepEasingFunction);
01590         // Frame 94.
01591         result.InsertKeyFrame(0.587499976F, 1.0F, _cubicBezierEasingFunction_1);
01592         return result;
01593     }
01594
01595     // - - - - PreComp layer: Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff -
01596     // Tweak
01597     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01598     // - - Shape tree root for layer: Shape Layer 1
01599     // -  Scale:0.7,0.7, Offset:<24, 23>
01600     // TrimStart
01601     ScalarKeyFrameAnimation TrimStartScalarAnimation_0_to_1_3()
01602     {
01603         // Frame 0.
01604         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _stepThenHoldEasingFunction);
01605         // Frame 45.
01606         result.InsertKeyFrame(0.28125F, 0.0F, _holdThenStepEasingFunction);
01607         // Frame 49.
01608         result.InsertKeyFrame(0.306250006F, 1.0F, _cubicBezierEasingFunction_1);
01609         return result;
01610     }
01611
01612     // - - - - PreComp layer: Controls - 01 - Check - 01 - NormalOnToNormalOff
01613     // - - - Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01614     // - - Shape tree root for layer: Shape Layer 1
01615     // -  Scale:0.7,0.7, Offset:<24, 23>
01616     // TrimStart
01617     ScalarKeyFrameAnimation TrimStartScalarAnimation_0_to_1_4()
01618     {
01619         // Frame 0.
01620         const auto result = CreateScalarKeyFrameAnimation(0.0F, 0.0F, _holdThenStepEasingFunction);
01621         // Frame 4.
01622         result.InsertKeyFrame(0.0250000004F, 1.0F, _cubicBezierEasingFunction_1);
01623         return result;
01624     }
01625
01626     // - PreComp layer: Indeterminate State
01627     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01628     // Shape tree root for layer: Shape Layer 1
01629     ShapeVisual ShapeVisual_00()
01630     {
01631         const auto result = _c.CreateShapeVisual();
01632         result.Size({ 48.0F, 48.0F });
01633         // Scale:0.7,0.7, Offset:<24, 24>
01634         result.Shapes().Append(SpriteShape_00());
01635         return result;
01636     }
01637
01638     // - PreComp layer: Controls - 01 - Check - 18 - PressedOffToNormalOn
01639     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01640     // Shape tree root for layer: Shape Layer 1
01641     ShapeVisual ShapeVisual_01()
01642     {
01643         const auto result = _c.CreateShapeVisual();
01644         result.Size({ 48.0F, 48.0F });
01645         // Scale:0.7,0.7, Offset:<24, 23>
01646         result.Shapes().Append(SpriteShape_01());
01647         return result;
01648     }
01649
01650     // - PreComp layer: Controls - 01 - Check - 17 - PressedOffToPointerOverOn
01651     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01652     // Shape tree root for layer: Shape Layer 1
01653     ShapeVisual ShapeVisual_02()
01654     {
01655         const auto result = _c.CreateShapeVisual();
01656         result.Size({ 48.0F, 48.0F });
01657         // Scale:0.7,0.7, Offset:<24, 23>
01658         result.Shapes().Append(SpriteShape_02());
01659         return result;
01660     }
01661
01662     // - PreComp layer: Controls - 01 - Check - 16 - PressedOffToPressedOn
01663     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01664     // Shape tree root for layer: Shape Layer 2
01665     ShapeVisual ShapeVisual_03()
01666     {
01667         const auto result = _c.CreateShapeVisual();
01668         result.Size({ 48.0F, 48.0F });
01669         // Scale:0.7,0.7, Offset:<24, 23>
01670         result.Shapes().Append(SpriteShape_03());
01671         return result;
01672     }
01673
01674     // - PreComp layer: Controls - 01 - Check - 15 - PressedOnToNormalOff
01675     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01676     // Shape tree root for layer: Shape Layer 1
01677     ShapeVisual ShapeVisual_04()
01678     {
01679         const auto result = _c.CreateShapeVisual();
01680         result.Size({ 48.0F, 48.0F });
01681         // Scale:0.7,0.7, Offset:<24, 23>
01682         result.Shapes().Append(SpriteShape_04());
01683         return result;
01684     }
01685
01686     // - PreComp layer: Controls - 01 - Check - 14 - PressedOnToPointerOverOff
01687     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01688     // Shape tree root for layer: Shape Layer 1
01689     ShapeVisual ShapeVisual_05()
01690     {
01691         const auto result = _c.CreateShapeVisual();
01692         result.Size({ 48.0F, 48.0F });
01693         // Scale:0.7,0.7, Offset:<24, 23>
01694         result.Shapes().Append(SpriteShape_05());
01695         return result;
01696     }
01697
01698     // - PreComp layer: Controls - 01 - Check - 13 - PressedOnToPressedOff
01699     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01700     // Shape tree root for layer: Shape Layer 1
01701     ShapeVisual ShapeVisual_06()
01702     {
01703         const auto result = _c.CreateShapeVisual();
01704         result.Size({ 48.0F, 48.0F });
01705         // Scale:0.7,0.7, Offset:<24, 23>
01706         result.Shapes().Append(SpriteShape_06());
01707         return result;
01708     }
01709
01710     // - PreComp layer: Controls - 01 - Check - 10 - PointerOverOffToPointerOverOn
01711     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01712     // Shape tree root for layer: Shape Layer 1
01713     ShapeVisual ShapeVisual_07()
01714     {
01715         const auto result = _c.CreateShapeVisual();
01716         result.Size({ 48.0F, 48.0F });
01717         // Scale:0.7,0.7, Offset:<24, 23>
01718         result.Shapes().Append(SpriteShape_07());
01719         return result;
01720     }
01721
01722     // - PreComp layer: Controls - 01 - Check - 09 - PointerOverOnToPressedOn
01723     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01724     // Shape tree root for layer: Shape Layer 1
01725     ShapeVisual ShapeVisual_08()
01726     {
01727         const auto result = _c.CreateShapeVisual();
01728         result.Size({ 48.0F, 48.0F });
01729         // Scale:0.7,0.7, Offset:<24, 23>
01730         result.Shapes().Append(SpriteShape_08());
01731         return result;
01732     }
01733
01734     // - PreComp layer: Controls - 01 - Check - 08 - PointerOverOnToNormalOn
01735     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01736     // Shape tree root for layer: Shape Layer 1
01737     ShapeVisual ShapeVisual_09()
01738     {
01739         const auto result = _c.CreateShapeVisual();
01740         result.Size({ 48.0F, 48.0F });
01741         // Scale:0.7,0.7, Offset:<24, 23>
01742         result.Shapes().Append(SpriteShape_09());
01743         return result;
01744     }
01745
01746     // - PreComp layer: Controls - 01 - Check - 07 - PointerOverOnToPointerOverOff
01747     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01748     // Shape tree root for layer: Shape Layer 1
01749     ShapeVisual ShapeVisual_10()
01750     {
01751         const auto result = _c.CreateShapeVisual();
01752         result.Size({ 48.0F, 48.0F });
01753         // Scale:0.7,0.7, Offset:<24, 23>
01754         result.Shapes().Append(SpriteShape_10());
01755         return result;
01756     }
01757
01758     // - PreComp layer: Controls - 01 - Check - 04 - NormalOffToNormalOn
01759     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01760     // Shape tree root for layer: Shape Layer 1
01761     ShapeVisual ShapeVisual_11()
01762     {
01763         const auto result = _c.CreateShapeVisual();
01764         result.Size({ 48.0F, 48.0F });
01765         // Scale:0.7,0.7, Offset:<24, 23>
01766         result.Shapes().Append(SpriteShape_11());
01767         return result;
01768     }
01769
01770     // - PreComp layer: Controls - 01 - Check - 03 - NormalOnToPressedOn
01771     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01772     // Shape tree root for layer: Check
01773     ShapeVisual ShapeVisual_12()
01774     {
01775         const auto result = _c.CreateShapeVisual();
01776         result.Size({ 48.0F, 48.0F });
01777         // Scale:0.7,0.7, Offset:<24, 23>
01778         result.Shapes().Append(SpriteShape_12());
01779         return result;
01780     }
01781
01782     // - PreComp layer: Controls - 01 - Check - 02 - NormalOnToPointerOverOn
01783     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01784     // Shape tree root for layer: Check
01785     ShapeVisual ShapeVisual_13()
01786     {
01787         const auto result = _c.CreateShapeVisual();
01788         result.Size({ 48.0F, 48.0F });
01789         // Scale:0.7,0.7, Offset:<24, 23>
01790         result.Shapes().Append(SpriteShape_13());
01791         return result;
01792     }
01793
01794     // - PreComp layer: Controls - 01 - Check - 01 - NormalOnToNormalOff
01795     // Transforms for Null 230 Scale(1.05,1.05,0), Offset(24,24,0)
01796     // Shape tree root for layer: Shape Layer 1
01797     ShapeVisual ShapeVisual_14()
01798     {
01799         const auto result = _c.CreateShapeVisual();
01800         result.Size({ 48.0F, 48.0F });
01801         // Scale:0.7,0.7, Offset:<24, 23>
01802         result.Shapes().Append(SpriteShape_14());
01803         return result;
01804     }
01805
01806     StepEasingFunction HoldThenStepEasingFunction()
01807     {
01808         const auto result = _holdThenStepEasingFunction = _c.CreateStepEasingFunction();
01809         result.IsFinalStepSingleFrame(true);
01810         return result;
01811     }
01812
01813     StepEasingFunction StepThenHoldEasingFunction()
01814     {
01815         const auto result = _stepThenHoldEasingFunction = _c.CreateStepEasingFunction();
01816         result.IsInitialStepSingleFrame(true);
01817         return result;
01818     }
01819
01820     static IGeometrySource2D CanvasGeometryToIGeometrySource2D(winrt::com_ptr<CanvasGeometry> geo)
01821     {
01822         return geo.as<IGeometrySource2D>();
01823     }
01824
01825 public:
01826     AnimatedAcceptVisualSource_AnimatedVisual(
01827         Compositor compositor,
01828         CompositionPropertySet themeProperties)
01829         : _c{compositor}
01830         , _themeProperties{themeProperties}
01831         , _reusableExpressionAnimation(compositor.CreateExpressionAnimation())
01832     {
01833         winrt::check_hresult(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, _d2dFactory.put()));
01834         const auto _ = Root();
01835     }
01836
01837     void Close()
01838     {
01839         if (_root)
01840         {
01841             _root.Close();
01842         }
01843     }
01844
01845     TimeSpan Duration() const
01846     {
01847         return TimeSpan{ c_durationTicks };
01848     }
01849
01850     Visual RootVisual() const
01851     {
01852         return _root;
01853     }
01854
01855     winrt::float2 Size() const
01856     {
01857         return { 48.0F, 48.0F };
01858     }
01859
01860     static bool IsRuntimeCompatible()
01861     {
01862         return winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7);
01863     }
01864 };
01865
01866 winrt::float4 AnimatedAcceptVisualSource::ColorAsVector4(Color color)
01867 {
01868     return { static_cast<float>(color.R), static_cast<float>(color.G), static_cast<float>(color.B), static_cast<float>(color.A) };
01869 }
01870
01871 CompositionPropertySet AnimatedAcceptVisualSource::EnsureThemeProperties(Compositor compositor)
01872 {
01873     if (_themeProperties == nullptr)
01874     {
01875         _themeProperties = compositor.CreatePropertySet();
01876         _themeProperties.InsertVector4(L"Foreground", ColorAsVector4((Color)_themeForeground));
01877     }
01878
01879     return _themeProperties;
01880 }
01881
01882 Color AnimatedAcceptVisualSource::Foreground()
01883 {
01884     return _themeForeground;
01885 }
01886
01887 void AnimatedAcceptVisualSource::Foreground(Color value)
01888 {
01889     _themeForeground = value;
01890     if (_themeProperties != nullptr)
01891     {
01892         _themeProperties.InsertVector4(L"Foreground", ColorAsVector4((Color)_themeForeground));
01893     }
01894 }
01895
01896 winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual AnimatedAcceptVisualSource::TryCreateAnimatedVisual(
01897     Compositor const& compositor)
01898 {
01899     IInspectable diagnostics = nullptr;
01900     return TryCreateAnimatedVisual(compositor, diagnostics);
01901 }
01902
01903 winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual AnimatedAcceptVisualSource::TryCreateAnimatedVisual(
01904     Compositor const& compositor,
01905     IInspectable& diagnostics)
01906 {
01907     const auto _ = EnsureThemeProperties(compositor);
01908     diagnostics = nullptr;
01909
01910     if (AnimatedAcceptVisualSource_AnimatedVisual::IsRuntimeCompatible())
01911     {
01912         return winrt::make<AnimatedAcceptVisualSource_AnimatedVisual>(
01913             compositor,
01914             _themeProperties);
01915     }
01916
01917     return nullptr;
01918 }
01919
01920 double AnimatedAcceptVisualSource::FrameCount()
01921 {
01922     return 160.0;
01923 }
01924
01925 double AnimatedAcceptVisualSource::Framerate()
01926 {
01927     return 60.0;
01928 }
01929
01930 TimeSpan AnimatedAcceptVisualSource::Duration()
01931 {
01932     return TimeSpan{ 26666666L };
01933 }
01934
01935 double AnimatedAcceptVisualSource::FrameToProgress(double frameNumber)
01936 {
01937     return frameNumber / 160.0;
01938 }
01939
01940 winrt::Windows::Foundation::Collections::IMapView<hstring, double> AnimatedAcceptVisualSource::Markers()
01941 {
01942     return winrt::single_threaded_map<winrt::hstring, double>(
01943         std::map<winrt::hstring, double>
01944         {
01945             { L"NormalOnToNormalOff_Start", 0.0 },
01946             { L"NormalOnToNormalOff_End", 0.0253125 },
01947             { L"NormalOnToPointerOverOn_Start", 0.0315625 },
01948             { L"NormalOnToPointerOverOn_End", 0.0565625 },
01949             { L"NormalOnToPressedOn_Start", 0.0628125 },
01950             { L"NormalOnToPressedOn_End", 0.0878125 },
01951             { L"NormalOffToNormalOn_Start", 0.0940625 },
01952             { L"NormalOffToNormalOn_End", 0.2128125 },
01953             { L"NormalOffToPointerOverOff_Start", 0.2190625 },
01954             { L"NormalOffToPointerOverOff_End", 0.2440625 },
01955             { L"NormalOffToPressedOff_Start", 0.2503125 },
01956             { L"NormalOffToPressedOff_End", 0.2753125 },
01957             { L"PointerOverOnToPointerOverOff_Start", 0.2815625 },
01958             { L"PointerOverOnToPointerOverOff_End", 0.3065625 },
01959             { L"PointerOverOnToNormalOn_Start", 0.3128125 },
01960             { L"PointerOverOnToNormalOn_End", 0.3378125 },
01961             { L"PointerOverOnToPressedOn_Start", 0.3440625 },
01962             { L"PointerOverOnToPressedOn_End", 0.3690625 },
01963             { L"PointerOverOffToPointerOverOn_Start", 0.3753125 },
01964             { L"PointerOverOffToPointerOverOn_End", 0.4940625 },
01965             { L"PointerOverOffToNormalOff_Start", 0.5003125 },
01966             { L"PointerOverOffToNormalOff_End", 0.5253125 },
01967             { L"PointerOverOffToPressedOff_Start", 0.5315625 },
01968             { L"PointerOverOffToPressedOff_End", 0.5565625 },
01969             { L"PressedOnToPressedOff_Start", 0.5628125 },
01970             { L"PressedOnToPressedOff_End", 0.5878125 },
01971             { L"PressedOnToPointerOverOff_Start", 0.5940625 },
01972             { L"PressedOnToPointerOverOff_End", 0.6190625 },
01973             { L"PressedOnToNormalOff_Start", 0.6253125 },
01974             { L"PressedOnToNormalOff_End", 0.6503125 },
01975             { L"PressedOffToPressedOn_Start", 0.6565625 },
01976             { L"PressedOffToPressedOn_End", 0.7128125 },
01977             { L"PressedOffToPointerOverOn_Start", 0.7190625 },
01978             { L"PressedOffToPointerOverOn_End", 0.8378125 },
01979             { L"PressedOffToNormalOn_Start", 0.8440625 },
01980             { L"PressedOffToNormalOn_End", 0.9628125 },
01981             { L"NormalIndeterminate", 0.9690625 },
01982             { L"PointerOverIndeterminate", 0.9815625 },
01983             { L"PressedIndeterminate", 0.9940625 },
01984         }
01985     ).GetView();
01986 }
01987
01988 void AnimatedAcceptVisualSource::SetColorProperty(hstring const& propertyName, Color value)
01989 {
01990     if (propertyName == L"Foreground")
01991     {
01992         _themeForeground = value;
01993     }
01994     else
01995     {
01996         return;
01997     }
01998
01999     if (_themeProperties != nullptr)
02000     {
02001         _themeProperties.InsertVector4(propertyName, ColorAsVector4(value));
02002     }
02003 }
02004
02005 void AnimatedAcceptVisualSource::SetScalarProperty(hstring const&, double)
02006 {
02007 }
Generated on Sun Dec 1 2024 20:51:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ButtonInteractionTests Member List

This is the complete list of members for ButtonInteractionTests, including all inherited members.
DoesAdvertiseSupportedEvents() | ButtonInteractionTests | [inline]
ValidateDefaultValues() | ButtonInteractionTests | [inline]
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LinedFlowLayoutTests Member List

This is the complete list of members for LinedFlowLayoutTests, including all inherited members.
VerifyDefaultPropertyValues() LinedFlowLayoutTests [inline]
Generated on Sun Dec 1 2024 20:53:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/InteractionTrackerAsyncOperation.cpp Source File

  • ScrollPresenter

InteractionTrackerAsyncOperation.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "InteractionTrackerAsyncOperation.h"
00009
00010 InteractionTrackerAsyncOperation::InteractionTrackerAsyncOperation(
00011     InteractionTrackerAsyncOperationType operationType,
00012     InteractionTrackerAsyncOperationTrigger operationTrigger,
00013     bool isDelayed,
00014     std::shared_ptr<ViewChangeBase> viewChangeBase)
00015     : m_operationType(operationType)
00016     , m_operationTrigger(operationTrigger)
00017     , m_isDelayed(isDelayed)
00018     , m_viewChangeBase(viewChangeBase)
00019 {
00020     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, L"%s[0x%p](operationType: %s, operationTrigger: %s, isDelayed: %d, viewChange: 0x%p)\n",
00021         METH_NAME, this, TypeLogging::InteractionTrackerAsyncOperationTypeToString(operationType).c_str(),
00022         TypeLogging::InteractionTrackerAsyncOperationTriggerToString(operationTrigger).c_str(), isDelayed, viewChangeBase);
00023
00024     if (!IsAnimated())
00025     {
00026         m_postProcessingTicksCountdown = c_maxNonAnimatedOperationTicks;
00027     }
00028 }
00029
00030 InteractionTrackerAsyncOperation::~InteractionTrackerAsyncOperation()
00031 {
00032     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00033 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbBarElementFactory.cpp Source File

  • Breadcrumb

BreadcrumbBarElementFactory.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ItemTemplateWrapper.h"
00007 #include "BreadcrumbBarElementFactory.h"
00008 #include "BreadcrumbBarItem.h"
00009
00010 BreadcrumbElementFactory::BreadcrumbElementFactory()
00011 {
00012 }
00013
00014 void BreadcrumbElementFactory::UserElementFactory(const winrt::IInspectable& newValue)
00015 {
00016     if (auto dataTemplate = newValue.try_as<winrt::DataTemplate>())
00017     {
00018         m_itemTemplateWrapper = winrt::make<ItemTemplateWrapper>(dataTemplate);
00019     }
00020     else if (auto selector = newValue.try_as<winrt::DataTemplateSelector>())
00021     {
00022         m_itemTemplateWrapper = winrt::make<ItemTemplateWrapper>(selector);
00023     }
00024     else if (auto customElementFactory = newValue.try_as<winrt::IElementFactory>())
00025     {
00026         m_itemTemplateWrapper = customElementFactory;
00027     }
00028 }
00029
00030 winrt::UIElement BreadcrumbElementFactory::GetElementCore(const winrt::ElementFactoryGetArgs& args)
00031 {
00032     auto const newContent = [itemTemplateWrapper = m_itemTemplateWrapper, args]()
00033     {
00034         if (args.Data().try_as<winrt::BreadcrumbBarItem>())
00035         {
00036             return args.Data();
00037         }
00038
00039         if (itemTemplateWrapper)
00040         {
00041             return itemTemplateWrapper.GetElement(args).as<winrt::IInspectable>();
00042         }
00043         return args.Data();
00044     }();
00045
00046     // Element is already a BreadcrumbBarItem, so we just return it.
00047     if (auto const breadcrumbItem = newContent.try_as<winrt::BreadcrumbBarItem>())
00048     {
00049         // When the list has not changed the returned item is still a BreadcrumbBarItem but the
00050         // item is not reset, so we set the content here
00051         breadcrumbItem.Content(args.Data());
00052         return breadcrumbItem;
00053     }
00054
00055     auto const newBreadcrumbBarItem = winrt::BreadcrumbBarItem{};
00056     newBreadcrumbBarItem.Content(args.Data());
00057
00058     // If a user provided item template exists, we pass the template down
00059     // to the ContentPresenter of the BreadcrumbBarItem.
00060     if (auto const itemTemplateWrapper = m_itemTemplateWrapper.try_as<ItemTemplateWrapper>())
00061     {
00062         newBreadcrumbBarItem.ContentTemplate(itemTemplateWrapper->Template());
00063     }
00064
00065     return newBreadcrumbBarItem;
00066 }
00067
00068 void BreadcrumbElementFactory::RecycleElementCore(const winrt::ElementFactoryRecycleArgs& args)
00069 {
00070     if (auto element = args.Element())
00071     {
00072         bool isEllipsisDropDownItem = false; // Use of isEllipsisDropDownItem is workaround for
00073         // crashing bug when attempting to show ellipsis dropdown after clicking one of its items.
00074
00075         if (auto breadcrumbItem = element.try_as<winrt::BreadcrumbBarItem>())
00076         {
00077             auto breadcrumbItemImpl = winrt::get_self<BreadcrumbBarItem>(breadcrumbItem);
00078             breadcrumbItemImpl->ResetVisualProperties();
00079
00080             isEllipsisDropDownItem = breadcrumbItemImpl->IsEllipsisDropDownItem();
00081         }
00082
00083         if (m_itemTemplateWrapper && isEllipsisDropDownItem)
00084         {
00085             m_itemTemplateWrapper.RecycleElement(args);
00086         }
00087     }
00088 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RecyclePool.properties.h Source File

  • Generated

RecyclePool.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class RecyclePoolProperties
00008 {
00009 public:
00010     RecyclePoolProperties();
00011
00012     static void SetPoolInstance(winrt::DataTemplate const& target, winrt::RecyclePool const& value);
00013     static winrt::RecyclePool GetPoolInstance(winrt::DataTemplate const& target);
00014
00015     static winrt::DependencyProperty PoolInstanceProperty() { return s_PoolInstanceProperty; }
00016
00017     static GlobalDependencyProperty s_PoolInstanceProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021 };
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewProperties Member List

This is the complete list of members for TreeViewProperties, including all inherited members.
CanDragItems(bool value) | TreeViewProperties |
CanDragItems() | TreeViewProperties |
CanDragItemsProperty() | TreeViewProperties | [inline, static]
CanReorderItems(bool value) | TreeViewProperties |
CanReorderItems() | TreeViewProperties |
CanReorderItemsProperty() | TreeViewProperties | [inline, static]
ClearProperties() | TreeViewProperties | [static]
Collapsed(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewCollapsedEventArgs > const &value) | TreeViewProperties |
Collapsed(winrt::event_token const &token) | TreeViewProperties |
DragItemsCompleted(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewDragItemsCompletedEventArgs > const &value) | TreeViewProperties |
DragItemsCompleted(winrt::event_token const &token) | TreeViewProperties |
DragItemsStarting(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewDragItemsStartingEventArgs > const &value) | TreeViewProperties |
DragItemsStarting(winrt::event_token const &token) | TreeViewProperties |
EnsureProperties() | TreeViewProperties | [static]
Expanding(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewExpandingEventArgs > const &value) | TreeViewProperties |
Expanding(winrt::event_token const &token) | TreeViewProperties |
ItemContainerStyle(winrt::Style const &value) | TreeViewProperties |
ItemContainerStyle() | TreeViewProperties |
ItemContainerStyleProperty() | TreeViewProperties | [inline, static]
ItemContainerStyleSelector(winrt::StyleSelector const &value) | TreeViewProperties |
ItemContainerStyleSelector() | TreeViewProperties |
ItemContainerStyleSelectorProperty() | TreeViewProperties | [inline, static]
ItemContainerTransitions(winrt::TransitionCollection const &value) | TreeViewProperties |
ItemContainerTransitions() | TreeViewProperties |
ItemContainerTransitionsProperty() | TreeViewProperties | [inline, static]
ItemInvoked(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewItemInvokedEventArgs > const &value) | TreeViewProperties |
ItemInvoked(winrt::event_token const &token) | TreeViewProperties |
ItemsSource(winrt::IInspectable const &value) | TreeViewProperties |
ItemsSource() | TreeViewProperties |
ItemsSourceProperty() | TreeViewProperties | [inline, static]
ItemTemplate(winrt::DataTemplate const &value) | TreeViewProperties |
ItemTemplate() | TreeViewProperties |
ItemTemplateProperty() | TreeViewProperties | [inline, static]
ItemTemplateSelector(winrt::DataTemplateSelector const &value) | TreeViewProperties |
ItemTemplateSelector() | TreeViewProperties |
ItemTemplateSelectorProperty() | TreeViewProperties | [inline, static]
m_collapsedEventSource | TreeViewProperties |
m_dragItemsCompletedEventSource | TreeViewProperties |
m_dragItemsStartingEventSource | TreeViewProperties |
m_expandingEventSource | TreeViewProperties |
m_itemInvokedEventSource | TreeViewProperties |
m_selectionChangedEventSource | TreeViewProperties |
OnItemsSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
OnSelectedItemPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
OnSelectionModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
s_CanDragItemsProperty | TreeViewProperties | [static]
s_CanReorderItemsProperty | TreeViewProperties | [static]
s_ItemContainerStyleProperty | TreeViewProperties | [static]
s_ItemContainerStyleSelectorProperty | TreeViewProperties | [static]
s_ItemContainerTransitionsProperty | TreeViewProperties | [static]
s_ItemsSourceProperty | TreeViewProperties | [static]
s_ItemTemplateProperty | TreeViewProperties | [static]
s_ItemTemplateSelectorProperty | TreeViewProperties | [static]
s_SelectedItemProperty | TreeViewProperties | [static]
s_SelectionModeProperty | TreeViewProperties | [static]
SelectedItem(winrt::IInspectable const &value) | TreeViewProperties |
SelectedItem() | TreeViewProperties |
SelectedItemProperty() | TreeViewProperties | [inline, static]
SelectionChanged(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewSelectionChangedEventArgs > const &value) | TreeViewProperties |
SelectionChanged(winrt::event_token const &token) | TreeViewProperties |
SelectionMode(winrt::TreeViewSelectionMode const &value) | TreeViewProperties |
SelectionMode() | TreeViewProperties |
SelectionModeProperty() | TreeViewProperties | [inline, static]
TreeViewProperties() | TreeViewProperties |
Generated on Sun Dec 1 2024 20:53:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedVisualPlayer/AnimatedVisualPlayer.h Source File

  • AnimatedVisualPlayer

AnimatedVisualPlayer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "AnimatedVisualPlayer.g.h"
00010 #include "AnimatedVisualPlayer.properties.h"
00011
00012
00013 // Derive from DeriveFromPanelHelper_base so that we get access to Children collection
00014 // in Panel. The Children collection holds the fallback content.
00015 struct AnimatedVisualPlayer :
00016     public ReferenceTracker<AnimatedVisualPlayer, DeriveFromPanelHelper_base, winrt::AnimatedVisualPlayer, winrt::IAnimatedVisualPlayer2>,
00017     public AnimatedVisualPlayerProperties
00018 {
00019     using AnimatedVisualPlayerProperties::AnimationOptimization;
00020     friend class AnimatedVisualPlayerProperties;
00021
00022     AnimatedVisualPlayer();
00023     ~AnimatedVisualPlayer();
00024     winrt::CompositionObject ProgressObject();
00025     void Pause();
00026     winrt::IAsyncAction PlayAsync(double fromProgress, double toProgress, bool looped);
00027     void Resume();
00028     void SetProgress(double progress);
00029     void Stop();
00030
00031     // FrameworkElement overrides
00032     winrt::Size MeasureOverride(winrt::Size const& availableSize);
00033     winrt::Size ArrangeOverride(winrt::Size const& finalSize);
00034
00035     // IUIElement / IUIElementOverridesHelper
00036     winrt::AutomationPeer OnCreateAutomationPeer();
00037
00038 private:
00039     //
00040     // An awaitable object that is completed when an animation play is completed.
00041     //
00042     struct AnimationPlay final : public Awaitable
00043     {
00044         AnimationPlay(
00045             AnimatedVisualPlayer& owner,
00046             float fromProgress,
00047             float toProgress,
00048             bool looped);
00049
00050         float FromProgress();
00051
00052         bool IsCurrentPlay();
00053
00054         // Sets the playback rate of the animation.
00055         void SetPlaybackRate(float value);
00056
00057         void Start();
00058
00059         void Pause();
00060
00061         void Resume();
00062
00063         void OnHiding();
00064         void OnUnhiding();
00065
00066         // Called to indicate that the play has been completed. Unblocks awaiters.
00067         void Complete();
00068
00069         void ResetOwner();
00070
00071     private:
00072         AnimatedVisualPlayer* m_owner;
00073         const float m_fromProgress{};
00074         const float m_toProgress{};
00075         const bool m_looped{};
00076         winrt::TimeSpan m_playDuration{};
00077
00078         winrt::AnimationController m_controller{ nullptr };
00079         bool m_isPaused{ false };
00080         bool m_isPausedBecauseHidden{ false };
00081         winrt::event_token m_batchCompletedToken{0};
00082         winrt::CompositionScopedBatch m_batch{ nullptr };
00083     };
00084
00085     void OnAutoPlayPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00086
00087     void OnAnimationOptimizationPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00088
00089     void OnFallbackContentPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00090
00091     void OnPlaybackRatePropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00092
00093     void OnSourcePropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00094
00095     void OnStretchPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00096
00097     void UpdateContent();
00098     void UnloadContent();
00099
00100     void LoadFallbackContent();
00101     void UnloadFallbackContent();
00102
00103     void SetFallbackContent(winrt::UIElement const& uiElement);
00104
00105     void OnLoaded(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00106     void OnUnloaded(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00107     void OnHiding();
00108     void OnUnhiding();
00109
00110     void CreateAnimations();
00111     void DestroyAnimations();
00112
00113     //
00114     // Initialized by the constructor.
00115     //
00116     // A Visual used for clipping and for parenting of m_animatedVisualRoot.
00117     winrt::SpriteVisual m_rootVisual{ nullptr };
00118     // The property set that contains the Progress property that will be used to
00119     // set the progress of the animated visual.
00120     winrt::CompositionPropertySet m_progressPropertySet{ nullptr };
00121     // Revokers for events that we are subscribed to.
00122     winrt::Application::Suspending_revoker m_suspendingRevoker{};
00123     winrt::Application::Resuming_revoker m_resumingRevoker{};
00124     winrt::XamlRoot::Changed_revoker m_xamlRootChangedRevoker{};
00125     winrt::FrameworkElement::Loaded_revoker m_loadedRevoker{};
00126     winrt::FrameworkElement::Unloaded_revoker m_unloadedRevoker{};
00127
00128     //
00129     // Player mutable state state.
00130     //
00131     tracker_ref<winrt::IAnimatedVisual> m_animatedVisual{ this };
00132     // The native size of the current animated visual. Only valid if m_animatedVisual is not nullptr.
00133     winrt::float2 m_animatedVisualSize{};
00134     winrt::Visual m_animatedVisualRoot{ nullptr };
00135     int m_playAsyncVersion{ 0 };
00136     double m_currentPlayFromProgress{ 0 };
00137     // The play that will be stopped when Stop() is called.
00138     std::shared_ptr<AnimationPlay> m_nowPlaying{ nullptr };
00139     winrt::IDynamicAnimatedVisualSource::AnimatedVisualInvalidated_revoker  m_dynamicAnimatedVisualInvalidatedRevoker{};
00140
00141     // Set true if an animated visual has failed to load and set false the next time an animated
00142     // visual loads with non-null content. When this is true the fallback content (if any) will
00143     // be displayed.
00144     bool m_isFallenBack{ false };
00145
00146     // Set true when FrameworkElement::Unloaded is fired, then set false when FrameworkElement::Loaded is fired.
00147     // This is used to differentiate the first Loaded event (when the element has never been
00148     // unloaded) from later Loaded events.
00149     bool m_isUnloaded{ false };
00150
00151     bool m_isAnimationsCreated{ false };
00152     uint32_t m_createAnimationsCounter = 0;
00153
00154     bool m_isHostVisible{ false };
00155 };
Generated on Sun Dec 1 2024 20:51:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ScrollPresenterAutomationPeer.properties.cpp Source File

  • Generated

ScrollPresenterAutomationPeer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "ScrollPresenterAutomationPeer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Automation::Peers
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(ScrollPresenterAutomationPeer)
00012 }
00013
00014 #include "ScrollPresenterAutomationPeer.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TestUI/TreeViewItemTemplateSelectorTestPage.xaml.cs Source File

  • TreeView
  • TestUI

TreeViewItemTemplateSelectorTestPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Controls;
00006
00007 namespace MUXControlsTestApp
00008 {
00009     public sealed partial class TreeViewItemTemplateSelectorTestPage : TestPage
00010     {
00011         public TreeViewItemTemplateSelectorTestPage()
00012         {
00013             this.InitializeComponent();
00014             TestTreeView.RootNodes.Add(new TreeViewNode() { Content = 1 });
00015             TestTreeView.RootNodes.Add(new TreeViewNode() { Content = 2 });
00016         }
00017     }
00018
00019     public class TreeViewItemTemplateSelector : DataTemplateSelector
00020     {
00021         public DataTemplate Template1 { get; set; }
00022         public DataTemplate Template2 { get; set; }
00023
00024         protected override DataTemplate SelectTemplateCore(object item)
00025         {
00026             var node = (TreeViewNode)item;
00027             int content = (int)node.Content;
00028             if (content % 2 == 0) return Template2;
00029             return Template1;
00030         }
00031     }
00032
00033     public class TreeViewItemStyleSelector : StyleSelector
00034     {
00035         public Style Style1 { get; set; }
00036         public Style Style2 { get; set; }
00037
00038         protected override Style SelectStyleCore(object item, DependencyObject container)
00039         {
00040             var node = (TreeViewNode)item;
00041             int content = (int)node.Content;
00042             if (content % 2 == 0) return Style2;
00043             return Style1;
00044         }
00045     }
00046 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TeachingTip/TestUI/TeachingTipCaseBundle.xaml.cs Source File

  • TeachingTip
  • TestUI

TeachingTipCaseBundle.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     [TopLevelTestPage(Name = "TeachingTip", Icon = "TeachingTip.png")]
00007     public sealed partial class TeachingTipCaseBundle : TestPage
00008     {
00009         public TeachingTipCaseBundle()
00010         {
00011             InitializeComponent();
00012
00013             TeachingTipPageButton.Click += delegate { Frame.NavigateWithoutAnimation(typeof(TeachingTipPage), 0); };
00014             TeachingTipFocusPageButton.Click += delegate { Frame.NavigateWithoutAnimation(typeof(TeachingTipFocusPage), 0); };
00015             TeachingTipInXamlPageButton.Click += delegate { Frame.NavigateWithoutAnimation(typeof(TeachingTipInXamlPage), 0); };
00016         }
00017     }
00018 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LottieLogo::LottieLogo_AnimatedVisual Member List

This is the complete list of members for LottieLogo::LottieLogo_AnimatedVisual, including all inherited members.
_c | LottieLogo::LottieLogo_AnimatedVisual | [private]
_colorBrush_AlmostTeal_FF007A87 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_colorBrush_White | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_00 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_01 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_02 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_03 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_04 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_05 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_06 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_07 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_08 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_09 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_10 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_11 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_12 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_13 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_14 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_15 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_16 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_17 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_18 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_19 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_20 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_21 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_containerShape_22 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_0 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_1 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_2 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_3 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_4 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_5 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_6 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_7 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_cubicBezierEasingFunction_8 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_ellipse_0_0 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_ellipse_0_1 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_ellipse_4p7 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_holdThenStepEasingFunction | LottieLogo::LottieLogo_AnimatedVisual | [private]
_offsetVector2Animation_02 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_offsetVector2Animation_03 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_offsetVector2Animation_04 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_offsetVector2Animation_05 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_offsetVector2Animation_06 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_0 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_1 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_2 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_3 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_4 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_5 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_6 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_7 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_path_8 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_00 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_01 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_02 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_03 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_04 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_05 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_06 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_07 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_08 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_09 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_10 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_11 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_12 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_13 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_14 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_15 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_16 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_17 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_18 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_19 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_20 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_21 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_22 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_23 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_24 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_25 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_26 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_27 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_28 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_29 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_30 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_31 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_32 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_33 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_34 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_35 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_36 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_37 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_pathGeometry_38 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_radiusVector2Animation | LottieLogo::LottieLogo_AnimatedVisual | [private]
_reusableExpressionAnimation | LottieLogo::LottieLogo_AnimatedVisual | [private]
_root | LottieLogo::LottieLogo_AnimatedVisual | [private]
_rootProgress | LottieLogo::LottieLogo_AnimatedVisual | [private]
_shapeVisibilityAnimation_04 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_11 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_12 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_13 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_14 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_15 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_19 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_22 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_23 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_36 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_37 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_spriteShape_38 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_stepThenHoldEasingFunction | LottieLogo::LottieLogo_AnimatedVisual | [private]
_tEndScalarAnimation_1_to_0_02 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_tEndScalarAnimation_1_to_0_03 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_tEndScalarAnimation_1_to_0_06 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_tEndScalarAnimation_1_to_0_11 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_tEndScalarAnimation_1_to_0_13 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_tStartScalarAnimation_0_to_0p249 | LottieLogo::LottieLogo_AnimatedVisual | [private]
_tStartScalarAnimation_0p87_to_0_02 | LottieLogo::LottieLogo_AnimatedVisual | [private]
BindProperty(CompositionObject target, string animatedPropertyName, string expression, string referenceParameterName, CompositionObject referencedObject) | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
c_durationTicks | LottieLogo::LottieLogo_AnimatedVisual | [private]
ColorBrush_AlmostDarkTurquoise_FF00D1C1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ColorBrush_AlmostTeal_FF007A87() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ColorBrush_White() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_00() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_01() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_02() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_03() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_04() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_05() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_06() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_07() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_08() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_09() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_10() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_11() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_12() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_13() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_14() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_15() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_16() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_17() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_18() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_19() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_20() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_21() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ContainerShape_22() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CreateAnimations() | LottieLogo::LottieLogo_AnimatedVisual | [inline]
CreateScalarKeyFrameAnimation(float initialProgress, float initialValue, CompositionEasingFunction initialEasingFunction) | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CreateSpriteShape(CompositionGeometry geometry, Matrix3x2 transformMatrix) | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CreateSpriteShape(CompositionGeometry geometry, Matrix3x2 transformMatrix, CompositionBrush fillBrush) | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CreateVector2KeyFrameAnimation(float initialProgress, Vector2 initialValue, CompositionEasingFunction initialEasingFunction) | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_2() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_3() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_4() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_5() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_6() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_7() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_8() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
DestroyAnimations() | LottieLogo::LottieLogo_AnimatedVisual | [inline]
Dispose() | LottieLogo::LottieLogo_AnimatedVisual | [private]
Duration | LottieLogo::LottieLogo_AnimatedVisual |
Ellipse_0_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Ellipse_0_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Ellipse_4p6() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Ellipse_4p7() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_00() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_01() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_02() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_03() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_04() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_05() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_06() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_07() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_08() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_09() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_10() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_11() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_12() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_13() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_14() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_15() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_16() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_17() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_18() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_19() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_20() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_21() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_22() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_23() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_24() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_25() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_26() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_27() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Geometry_28() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
HoldThenStepEasingFunction() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
LottieLogo_AnimatedVisual(Compositor compositor) | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_00() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_01() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_02() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_03() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_04() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_05() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_06() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_07() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_08() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_09() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
OffsetVector2Animation_10() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_2() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_3() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_4() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_5() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_6() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_7() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Path_8() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_00() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_01() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_02() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_03() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_04() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_05() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_06() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_07() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_08() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_09() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_10() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_11() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_12() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_13() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_14() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_15() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_16() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_17() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_18() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_19() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_20() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_21() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_22() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_23() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_24() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_25() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_26() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_27() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_28() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_29() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_30() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_31() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_32() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_33() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_34() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_35() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_36() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_37() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
PathGeometry_38() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
RadiusVector2Animation() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Root() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
RootProgress() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
RootVisual | LottieLogo::LottieLogo_AnimatedVisual |
RoundedRectangle_375x667() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_00() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_01() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_02() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_03() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_04() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_05() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_06() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_07() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_08() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_09() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_10() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_11() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_12() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_13() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_14() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_15() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_16() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_17() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_18() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_19() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_20() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_21() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_22() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_23() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_24() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_25() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_26() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_27() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_28() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_29() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisibilityAnimation_30() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
ShapeVisual_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Size | LottieLogo::LottieLogo_AnimatedVisual |
SpriteShape_00() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_01() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_02() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_03() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_04() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_05() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_06() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_07() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_08() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_09() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_10() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_11() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_12() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_13() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_14() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_15() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_16() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_17() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_18() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_19() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_20() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_21() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_22() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_23() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_24() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_25() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_26() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_27() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_28() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_29() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_30() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_31() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_32() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_33() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_34() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_35() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_36() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_37() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_38() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_39() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_40() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_41() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_42() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_43() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
SpriteShape_44() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
StartProgressBoundAnimation(CompositionObject target, string animatedPropertyName, CompositionAnimation animation, ExpressionAnimation controllerProgressExpression) | LottieLogo::LottieLogo_AnimatedVisual | [inline, private, static]
StepThenHoldEasingFunction() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
t0ScalarAnimation_0_to_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_0_to_1_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_0_to_1_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_0p81_to_0p734_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_0p81_to_0p734_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_00() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_01() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_02() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_03() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_04() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_05() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_06() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_07() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_08() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_09() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_10() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_11() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_12() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_13() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TEndScalarAnimation_1_to_0_14() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_0p316_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_0p316_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_0p375_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_0p375_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_0p43_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_0p43_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_0p457_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_0p457_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0p117_to_1_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0p117_to_1_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0p249_to_0p891() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0p411_to_0p665_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0p411_to_0p665_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0p5_to_1_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0p5_to_1_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_1_to_0p88() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0_to_0p399() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0p29_to_0_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0p29_to_0_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0p5_to_0_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0p5_to_0_1() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0_to_0p249() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_00() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_01() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_02() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_03() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_04() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_05() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_06() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_07() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_08() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_09() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_10() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_11() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_12() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_13() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_14() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_15() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_16() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_17() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p87_to_0_18() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p8_to_0() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
TStartScalarAnimation_0p8_to_0p3() | LottieLogo::LottieLogo_AnimatedVisual | [inline, private]
Generated on Sun Dec 1 2024 20:53:30 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarFlyoutItemAutomationPeer Member List

This is the complete list of members for InkToolBarFlyoutItemAutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
CheckThread() | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< InkToolBarFlyoutItemAutomationPeer > &&self) noexcept | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
final_release(std::unique_ptr< InkToolBarFlyoutItemAutomationPeer > &&self) | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline, static]
GetBase() | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
GetInner() | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
InkToolBarFlyoutItemAutomationPeer(winrt::InkToolBarFlyoutItem owner) | InkToolBarFlyoutItemAutomationPeer | [inline]
IsOnThread() | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< InkToolBarFlyoutItemAutomationPeer, winrt::implementation::InkToolBarFlyoutItemAutomationPeerT > | [inline]
Generated on Sun Dec 1 2024 20:52:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshVisualizer/APITests/RefreshVisualizerTests.cs Source File

  • PullToRefresh
  • RefreshVisualizer
  • APITests

RefreshVisualizerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Threading;
00006 using System.Collections.Generic;
00007 using System.ComponentModel;
00008 using System.Linq;
00009 using System.Text;
00010 using System.Threading.Tasks;
00011
00012 using MUXControlsTestApp.Utilities;
00013
00014 using Microsoft.UI.Xaml;
00015 using Microsoft.UI.Xaml.Controls;
00016 using Microsoft.UI.Private.Controls;
00017 using Windows.Foundation;
00018 using Microsoft.UI.Composition;
00019 using Microsoft.UI.Xaml.Hosting;
00020 using Common;
00021
00022 using WEX.TestExecution;
00023 using WEX.TestExecution.Markup;
00024 using WEX.Logging.Interop;
00025
00026 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00027 {
00028     [TestClass]
00029     public class RefreshVisualizerTests : ApiTestBase
00030     {
00031         TimeSpan c_MaxWaitDuration = TimeSpan.FromMilliseconds(5000);
00032
00033         [TestMethod]
00034         public void CanInstantiate()
00035         {
00036             AutoResetEvent refreshVisualizerLoadedEvent = new AutoResetEvent(false);
00037             RunOnUIThread.Execute(() =>
00038             {
00039                 RefreshVisualizer refreshVisualizer = new RefreshVisualizer();
00040                 refreshVisualizer.Loaded += (object sender, RoutedEventArgs e) =>
00041                 {
00042                     Log.Comment("RefreshVisualizer.Loaded event handler");
00043                     refreshVisualizerLoadedEvent.Set();
00044                 };
00045                 Content = refreshVisualizer;
00046             });
00047
00048             Log.Comment("Waiting for Loaded event");
00049             refreshVisualizerLoadedEvent.WaitOne(c_MaxWaitDuration);
00050             Log.Comment("Default UI set up");
00051
00052             RunOnUIThread.Execute(() =>
00053             {
00054                 Verify.IsNotNull(Content as RefreshVisualizer);
00055             });
00056         }
00057
00058         [TestMethod]
00059         public void RefreshPropagatesToInfoProvider()
00060         {
00061             RunOnUIThread.Execute(() =>
00062             {
00063                 RefreshVisualizer refreshVisualizer = new RefreshVisualizer();
00064                 Compositor compositor = ElementCompositionPreview.GetElementVisual(refreshVisualizer).Compositor;
00065                 RefreshInfoProviderImpl refreshInfoProviderImpl = new RefreshInfoProviderImpl(compositor);
00066                 ((IRefreshVisualizerPrivate)refreshVisualizer).InfoProvider = refreshInfoProviderImpl;
00067                 Verify.AreEqual<int>(0, refreshInfoProviderImpl.OnRefreshStartedCalls);
00068                 Verify.AreEqual<int>(0, refreshInfoProviderImpl.OnRefreshCompletedCalls);
00069                 refreshVisualizer.RequestRefresh();
00070                 Verify.AreEqual<int>(1, refreshInfoProviderImpl.OnRefreshStartedCalls);
00071                 Verify.AreEqual<int>(1, refreshInfoProviderImpl.OnRefreshCompletedCalls);
00072             });
00073         }
00074
00075         [TestMethod]
00076         public void ContentIsUpdatable()
00077         {
00078             RunOnUIThread.Execute(() =>
00079             {
00080                 RefreshVisualizer refreshVisualizer = new RefreshVisualizer();
00081                 //The default Progress Indicator is consturcted in the OnApplyTemplate method, since that is not called in this test
00082                 //we expect the Content to be null.
00083                 Verify.IsNull(refreshVisualizer.Content);
00084                 Content = refreshVisualizer;
00085                 Content.UpdateLayout();
00086                 Verify.IsNotNull(refreshVisualizer.Content);
00087                 Verify.AreEqual<Symbol>(Symbol.Refresh, ((SymbolIcon)(refreshVisualizer.Content)).Symbol);
00088                 refreshVisualizer.Content = new SymbolIcon(Symbol.Cancel);
00089                 Verify.AreEqual<Symbol>(Symbol.Cancel, ((SymbolIcon)(refreshVisualizer.Content)).Symbol);
00090             });
00091         }
00092
00093         [TestMethod]
00094         public void NullContentDoesNotCrash()
00095         {
00096             RunOnUIThread.Execute(() =>
00097             {
00098                 RefreshVisualizer refreshVisualizer = new RefreshVisualizer();
00099                 refreshVisualizer.Content = null;
00100                 refreshVisualizer.RequestRefresh();
00101             });
00102         }
00103
00104         [TestMethod]
00105         public void NullInfoProviderDoesNotCrash()
00106         {
00107             RunOnUIThread.Execute(() =>
00108             {
00109                 RefreshVisualizer refreshVisualizer = new RefreshVisualizer();
00110                 Compositor compositor = ElementCompositionPreview.GetElementVisual(refreshVisualizer).Compositor;
00111                 RefreshInfoProviderImpl refreshInfoProviderImpl = new RefreshInfoProviderImpl(compositor);
00112                 ((IRefreshVisualizerPrivate)refreshVisualizer).InfoProvider = refreshInfoProviderImpl;
00113                 refreshVisualizer.RequestRefresh();
00114                 ((IRefreshVisualizerPrivate)refreshVisualizer).InfoProvider = null;
00115                 refreshVisualizer.RequestRefresh();
00116             });
00117         }
00118
00119         [TestMethod]
00120         public void RefreshRequestedEventFires()
00121         {
00122             int refreshRequestedCount = 0;
00123
00124             RunOnUIThread.Execute(() =>
00125             {
00126                 RefreshVisualizer refreshVisualizer = new RefreshVisualizer();
00127                 refreshVisualizer.RefreshRequested += (RefreshVisualizer sender, RefreshRequestedEventArgs args) => { refreshRequestedCount++; };
00128                 refreshVisualizer.RequestRefresh();
00129             });
00130
00131             IdleSynchronizer.Wait();
00132
00133             RunOnUIThread.Execute(() =>
00134             {
00135                 Verify.AreEqual<int>(1, refreshRequestedCount);
00136             });
00137         }
00138
00139         [TestMethod]
00140         public void RefreshCompletedDeferralCompletedOffUIThread()
00141         {
00142             RunOnUIThread.Execute(() =>
00143             {
00144                 RefreshVisualizer refreshVisualizer = new RefreshVisualizer();
00145                 Compositor compositor = ElementCompositionPreview.GetElementVisual(refreshVisualizer).Compositor;
00146                 RefreshInfoProviderImpl refreshInfoProviderImpl = new RefreshInfoProviderImpl(compositor);
00147                 ((IRefreshVisualizerPrivate)refreshVisualizer).InfoProvider = refreshInfoProviderImpl;
00148                 refreshVisualizer.RefreshRequested += (RefreshVisualizer sender, RefreshRequestedEventArgs args) =>
00149                 {
00150                     Deferral def = args.GetDeferral();
00151
00152                     global::Windows.System.Threading.ThreadPool.RunAsync(
00153                         (IAsyncAction action) =>
00154                         {
00155                             Log.Comment("RefreshVisualizer.RefreshRequested event handler");
00156                             def.Complete();
00157                         }).AsTask().Wait();
00158                 };
00159
00160                 Verify.AreEqual<int>(0, refreshInfoProviderImpl.OnRefreshStartedCalls);
00161                 Verify.AreEqual<int>(0, refreshInfoProviderImpl.OnRefreshCompletedCalls);
00162
00163                 Content = refreshVisualizer;
00164
00165                 refreshVisualizer.RequestRefresh();
00166             });
00167
00168             IdleSynchronizer.Wait();
00169
00170             RunOnUIThread.Execute(() =>
00171             {
00172                 RefreshVisualizer refreshVisualizer = (RefreshVisualizer)Content;
00173                 RefreshInfoProviderImpl refreshInfoProviderImpl = (RefreshInfoProviderImpl)((IRefreshVisualizerPrivate)refreshVisualizer).InfoProvider;
00174
00175                 Verify.AreEqual<int>(1, refreshInfoProviderImpl.OnRefreshStartedCalls);
00176                 //Since we are completing the deferral off the UI thread the refresh never completed.
00177                 Verify.AreEqual<int>(0, refreshInfoProviderImpl.OnRefreshCompletedCalls);
00178             });
00179
00180         }
00181
00182         [TestMethod]
00183         public void RefreshStateChangedEventFires()
00184         {
00185             int refreshStateChangedCount = 0;
00186
00187             RunOnUIThread.Execute(() =>
00188             {
00189                 RefreshVisualizer refreshVisualizer = new RefreshVisualizer();
00190                 refreshVisualizer.RefreshStateChanged += (RefreshVisualizer sender, RefreshStateChangedEventArgs args) => { refreshStateChangedCount++; };
00191                 refreshVisualizer.RequestRefresh();
00192             });
00193
00194             IdleSynchronizer.Wait();
00195
00196             RunOnUIThread.Execute(() =>
00197             {
00198                 Verify.AreEqual<int>(2, refreshStateChangedCount);
00199             });
00200         }
00201     }
00202
00203     class RefreshInfoProviderImpl : IRefreshInfoProvider
00204     {
00205         private double executionRatio;
00206         private CompositionPropertySet compositionProperties;
00207         private bool isInteractingForRefresh;
00208
00209         public int OnRefreshCompletedCalls;
00210         public int OnRefreshStartedCalls;
00211
00212         public RefreshInfoProviderImpl(Compositor compositor)
00213         {
00214             executionRatio = 0.8f;
00215             compositionProperties = compositor.CreatePropertySet();
00216             compositionProperties.InsertScalar(InteractionRatioCompositionProperty, 0.0f);
00217             isInteractingForRefresh = false;
00218             OnRefreshCompletedCalls = 0;
00219             OnRefreshStartedCalls = 0;
00220         }
00221
00222         public void SetCustomInteractionRatio(float value)
00223         {
00224             compositionProperties.InsertScalar(InteractionRatioCompositionProperty, value);
00225         }
00226
00227         public void SetCustomIsInteractingForRefresh(bool value)
00228         {
00229             isInteractingForRefresh = value;
00230         }
00231
00232         public void RaiseInteractionRatioChangedEvent(float interactionRatio)
00233         {
00234             if (this.InteractionRatioChanged != null)
00235             {
00236                 this.InteractionRatioChanged.Invoke(this, PullToRefreshHelperTestApi.CreateRefreshInteractionRatioChangedEventArgsInstance(interactionRatio));
00237             }
00238         }
00239
00240         public void RaiseIsInteractionForRefreshChangedEvent()
00241         {
00242             if (this.IsInteractingForRefreshChanged != null)
00243             {
00244                 this.IsInteractingForRefreshChanged.Invoke(this, new EventArgs());
00245             }
00246         }
00247
00248         public double ExecutionRatio
00249         {
00250             get
00251             {
00252                 return executionRatio;
00253             }
00254
00255             set
00256             {
00257                 executionRatio = value;
00258             }
00259         }
00260
00261         public CompositionPropertySet CompositionProperties
00262         {
00263             get
00264             {
00265                 return compositionProperties;
00266             }
00267         }
00268
00269         public string InteractionRatioCompositionProperty
00270         {
00271             get
00272             {
00273                 return "InteractionRatio";
00274             }
00275         }
00276
00277         public bool IsInteractingForRefresh
00278         {
00279             get
00280             {
00281                 return isInteractingForRefresh;
00282             }
00283         }
00284
00285         public event TypedEventHandler<IRefreshInfoProvider, RefreshInteractionRatioChangedEventArgs> InteractionRatioChanged;
00286         public event TypedEventHandler<IRefreshInfoProvider, object> IsInteractingForRefreshChanged;
00287         public event TypedEventHandler<IRefreshInfoProvider, object> RefreshCompleted;
00288         public event TypedEventHandler<IRefreshInfoProvider, object> RefreshStarted;
00289
00290         public void OnRefreshCompleted()
00291         {
00292             OnRefreshCompletedCalls++;
00293
00294             if (this.RefreshCompleted != null)
00295             {
00296                 RefreshCompleted.Invoke(this, new EventArgs());
00297             }
00298         }
00299
00300         public void OnRefreshStarted()
00301         {
00302             OnRefreshStartedCalls++;
00303             if (this.RefreshStarted != null)
00304             {
00305                 RefreshStarted.Invoke(this, new EventArgs());
00306             }
00307         }
00308     }
00309 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ElementFactoryRecycleArgsDownlevel.cpp Source File

  • Repeater

ElementFactoryRecycleArgsDownlevel.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ElementFactoryRecycleArgsDownLevel.h"
00007
00008 #pragma region IElementFactoryRecycleArgs
00009
00010 winrt::UIElement ElementFactoryRecycleArgsDownlevel::Element()
00011 {
00012     return m_element.get();
00013 }
00014
00015 void ElementFactoryRecycleArgsDownlevel::Element(winrt::UIElement const& value)
00016 {
00017     m_element.set(value);
00018 }
00019
00020 winrt::UIElement ElementFactoryRecycleArgsDownlevel::Parent()
00021 {
00022     return m_parent.get();
00023 }
00024
00025 void ElementFactoryRecycleArgsDownlevel::Parent(winrt::UIElement const& value)
00026 {
00027     m_parent.set(value);
00028 }
00029
00030 #pragma endregion
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsRepeaterScrollHost::BringIntoViewState Member List

This is the complete list of members for ItemsRepeaterScrollHost::BringIntoViewState, including all inherited members.
AlignmentX() const | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
AlignmentY() const | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
Animate() const | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
BringIntoViewState(const ITrackerHandleManager *owner) | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
BringIntoViewState(const ITrackerHandleManager *owner, winrt::UIElement targetElement, double alignmentX, double alignmentY, double offsetX, double offsetY, bool animate) | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
ChangeViewCalled() const | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
ChangeViewCalled(bool value) | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
ChangeViewOffset() const | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
ChangeViewOffset(winrt::Point value) | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
m_targetElement | ItemsRepeaterScrollHost::BringIntoViewState | [private]
OffsetX() const | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
OffsetY() const | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
Reset() | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
TargetElement() const | ItemsRepeaterScrollHost::BringIntoViewState | [inline]
Generated on Sun Dec 1 2024 20:52:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

FlowLayoutProperties Member List

This is the complete list of members for FlowLayoutProperties, including all inherited members.
ClearProperties() | FlowLayoutProperties | [static]
EnsureProperties() | FlowLayoutProperties | [static]
FlowLayoutProperties() | FlowLayoutProperties |
LineAlignment(winrt::FlowLayoutLineAlignment const &value) | FlowLayoutProperties |
LineAlignment() | FlowLayoutProperties |
LineAlignmentProperty() | FlowLayoutProperties | [inline, static]
MinColumnSpacing(double value) | FlowLayoutProperties |
MinColumnSpacing() | FlowLayoutProperties |
MinColumnSpacingProperty() | FlowLayoutProperties | [inline, static]
MinRowSpacing(double value) | FlowLayoutProperties |
MinRowSpacing() | FlowLayoutProperties |
MinRowSpacingProperty() | FlowLayoutProperties | [inline, static]
OnLineAlignmentPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | FlowLayoutProperties | [static]
OnMinColumnSpacingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | FlowLayoutProperties | [static]
OnMinRowSpacingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | FlowLayoutProperties | [static]
OnOrientationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | FlowLayoutProperties | [static]
Orientation(winrt::Orientation const &value) | FlowLayoutProperties |
Orientation() | FlowLayoutProperties |
OrientationProperty() | FlowLayoutProperties | [inline, static]
s_LineAlignmentProperty | FlowLayoutProperties | [static]
s_MinColumnSpacingProperty | FlowLayoutProperties | [static]
s_MinRowSpacingProperty | FlowLayoutProperties | [static]
s_OrientationProperty | FlowLayoutProperties | [static]
Generated on Sun Dec 1 2024 20:52:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedIcon.idl Source File

  • AnimatedIcon

AnimatedIcon.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 interface IAnimatedVisualSource2 requires IAnimatedVisualSource
00007 {
00008     Windows.Foundation.Collections.IMapView<String, Double> Markers { get; };
00009     void SetColorProperty(String propertyName, Windows.UI.Color value);
00010 };
00011
00012 [MUX_PUBLIC]
00013 [webhosthidden]
00014 [contentproperty("Source")]
00015 unsealed runtimeclass AnimatedIcon : Microsoft.UI.Xaml.Controls.IconElement
00016 {
00017     AnimatedIcon();
00018
00019     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00020     IAnimatedVisualSource2 Source{ get; set; };
00021
00022     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00023     IconSource FallbackIconSource{ get; set; };
00024
00025     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00026     Boolean MirroredWhenRightToLeft{ get; set; };
00027
00028     [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnAnimatedIconStatePropertyChanged")]
00029     static Microsoft.UI.Xaml.DependencyProperty StateProperty{ get; };
00030     static void SetState(Microsoft.UI.Xaml.DependencyObject object, String value);
00031     static String GetState(Microsoft.UI.Xaml.DependencyObject object);
00032
00033     static Microsoft.UI.Xaml.DependencyProperty SourceProperty{ get; };
00034     static Microsoft.UI.Xaml.DependencyProperty FallbackIconSourceProperty{ get; };
00035     static Microsoft.UI.Xaml.DependencyProperty MirroredWhenRightToLeftProperty{ get; };
00036 }
00037
00038 }
Generated on Sun Dec 1 2024 20:51:39 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/ItemsSourceSamples/RecipeViewGenerator.cs Source File

  • Repeater
  • TestUI
  • Samples
  • ItemsSourceSamples

RecipeViewGenerator.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using MUXControlsTestApp.Samples.Model;
00005 using System;
00006 using System.Diagnostics;
00007 using Microsoft.UI.Xaml;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Xaml.Media.Imaging;
00010 using Microsoft.UI.Private.Controls;
00011
00012 namespace MUXControlsTestApp.Samples
00013 {
00014     public class RecipeElementFactory : ElementFactory
00015     {
00016         private DataTemplate _itemTemplate;
00017         private DataTemplate _groupTemplate;
00018         private DataTemplate _yearTemplate;
00019         private RecyclePool _sharedRecyclePool = new RecyclePool();
00020         private PageInfo _pageInfo;
00021
00022         public const string RecipeContainerType = "RecipeContainer";
00023         public const string RecipeGroupType = "RecipeGroup";
00024         public const string YearType = "Year";
00025
00026         public RecyclePool RecyclePool { get; set; }
00027
00028         public RecipeElementFactory(
00029             DataTemplate itemTemplate,
00030             DataTemplate groupTemplate,
00031             DataTemplate yearTemplate,
00032             PageInfo pinfo)
00033         {
00034             _itemTemplate = itemTemplate;
00035             _groupTemplate = groupTemplate;
00036             _yearTemplate = yearTemplate;
00037             _pageInfo = pinfo;
00038         }
00039
00040         protected override UIElement GetElementCore(ElementFactoryGetArgs args)
00041         {
00042             var data = args.Data;
00043             string key = GetContainerType(data);
00044             var element = RecyclePool.TryGetElement(key, args.Parent);
00045             element = element ?? (FrameworkElement)CreateContainer(key);
00046
00047             if (element == null)
00048             {
00049                 throw new InvalidOperationException("Unable to create a container for key " + key);
00050             }
00051
00052             PrepareContainer(element, key, data);
00053
00054             (element as FrameworkElement).Tag = key;
00055
00056             return element;
00057         }
00058
00059         protected override void RecycleElementCore(ElementFactoryRecycleArgs args)
00060         {
00061             var element = args.Element;
00062             var owner = args.Parent;
00063             var key = (String)(element as FrameworkElement).Tag;
00064             Debug.Assert(key != null);
00065             RecyclePool.PutElement((FrameworkElement)element, key, owner);
00066
00067
00068 #if DEBUG
00069             var containerAsFE = (FrameworkElement)element;
00070
00071             switch (key)
00072             {
00073                 case RecipeGroupType:
00074                     {
00075                         var repeater = (ItemsRepeater)containerAsFE.FindName("groupLayout");
00076                         var id = RepeaterTestHooks.GetLayoutId(repeater.Layout);
00077                         RepeaterTestHooks.SetLayoutId(repeater.Layout, id + "*");
00078                         break;
00079                     }
00080                 case YearType:
00081                     {
00082                         var repeater = (ItemsRepeater)containerAsFE.FindName("yearLayout");
00083                         var id = RepeaterTestHooks.GetLayoutId(repeater.Layout);
00084                         RepeaterTestHooks.SetLayoutId(repeater.Layout, id + "*");
00085                         break;
00086                     }
00087             }
00088 #endif
00089         }
00090
00091         private string GetContainerType(object data)
00092         {
00093             return
00094                data is Year ? YearType :
00095                data is RecipeGroup ? RecipeGroupType : RecipeContainerType;
00096         }
00097
00098         private UIElement CreateContainer(string recycleKey)
00099         {
00100             return
00101                recycleKey == YearType ?
00102                    (FrameworkElement)_yearTemplate.LoadContent() :
00103                recycleKey == RecipeGroupType ?
00104                    (FrameworkElement)_groupTemplate.LoadContent() :
00105                    (FrameworkElement)_itemTemplate.LoadContent();
00106         }
00107
00108         private void PrepareContainer(UIElement container, string containerType, object data)
00109         {
00110             var containerFE = container as FrameworkElement;
00111             switch (containerType)
00112             {
00113                 case RecipeContainerType:
00114                     {
00115                         var recipe = (Recipe)data;
00116
00117                         var image = (Image)containerFE.FindName("recipeImage");
00118                         var description = (TextBlock)containerFE.FindName("recipeDescription");
00119
00120                         if (image.Source == null)
00121                         {
00122                             image.Source = new BitmapImage(recipe.ImageUri);
00123                         }
00124                         else
00125                         {
00126                             ((BitmapImage)image.Source).UriSource = recipe.ImageUri;
00127                         }
00128
00129                         description.Text = recipe.Description;
00130
00131                         break;
00132                     }
00133
00134                 case RecipeGroupType:
00135                     {
00136                         var group = (RecipeGroup)data;
00137
00138                         var groupName = (TextBlock)containerFE.FindName("groupName");
00139                         var repeater = (ItemsRepeater)containerFE.FindName("groupLayout");
00140
00141                         groupName.Text = group.Name;
00142
00143                         repeater.ItemsSource = group;
00144                         repeater.Layout = _pageInfo.NumLevels == 1 ? _pageInfo.Level1Layout : _pageInfo.Level2Layout;
00145 #if DEBUG
00146                         RepeaterTestHooks.SetLayoutId(repeater.Layout, group.Name);
00147 #endif
00148                         repeater.ItemTemplate = this;
00149                         break;
00150                     }
00151
00152                 case YearType:
00153                     {
00154                         var year = (Year)data;
00155
00156                         var yearName = (TextBlock)containerFE.FindName("yearName");
00157                         var repeater = (ItemsRepeater)containerFE.FindName("yearLayout");
00158
00159                         yearName.Text = year.Value.ToString();
00160
00161                         repeater.ItemsSource = year;
00162                         repeater.Layout = _pageInfo.Level0Layout;
00163 #if DEBUG
00164                         RepeaterTestHooks.SetLayoutId(repeater.Layout, string.Format("Year {0}", year.Value));
00165 #endif
00166                         repeater.ItemTemplate = this;
00167
00168                         break;
00169                     }
00170             }
00171         }
00172     }
00173 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TimePickerPage Member List

This is the complete list of members for TimePickerPage, including all inherited members.
TimePickerPage() TimePickerPage [inline]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ColorSpectrum.properties.h Source File

  • Generated

ColorSpectrum.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class ColorSpectrumProperties
00008 {
00009 public:
00010     ColorSpectrumProperties();
00011
00012     void Color(winrt::Color const& value);
00013     winrt::Color Color();
00014
00015     void Components(winrt::ColorSpectrumComponents const& value);
00016     winrt::ColorSpectrumComponents Components();
00017
00018     void HsvColor(winrt::float4 const& value);
00019     winrt::float4 HsvColor();
00020
00021     void MaxHue(int value);
00022     int MaxHue();
00023
00024     void MaxSaturation(int value);
00025     int MaxSaturation();
00026
00027     void MaxValue(int value);
00028     int MaxValue();
00029
00030     void MinHue(int value);
00031     int MinHue();
00032
00033     void MinSaturation(int value);
00034     int MinSaturation();
00035
00036     void MinValue(int value);
00037     int MinValue();
00038
00039     void Shape(winrt::ColorSpectrumShape const& value);
00040     winrt::ColorSpectrumShape Shape();
00041
00042     static winrt::DependencyProperty ColorProperty() { return s_ColorProperty; }
00043     static winrt::DependencyProperty ComponentsProperty() { return s_ComponentsProperty; }
00044     static winrt::DependencyProperty HsvColorProperty() { return s_HsvColorProperty; }
00045     static winrt::DependencyProperty MaxHueProperty() { return s_MaxHueProperty; }
00046     static winrt::DependencyProperty MaxSaturationProperty() { return s_MaxSaturationProperty; }
00047     static winrt::DependencyProperty MaxValueProperty() { return s_MaxValueProperty; }
00048     static winrt::DependencyProperty MinHueProperty() { return s_MinHueProperty; }
00049     static winrt::DependencyProperty MinSaturationProperty() { return s_MinSaturationProperty; }
00050     static winrt::DependencyProperty MinValueProperty() { return s_MinValueProperty; }
00051     static winrt::DependencyProperty ShapeProperty() { return s_ShapeProperty; }
00052
00053     static GlobalDependencyProperty s_ColorProperty;
00054     static GlobalDependencyProperty s_ComponentsProperty;
00055     static GlobalDependencyProperty s_HsvColorProperty;
00056     static GlobalDependencyProperty s_MaxHueProperty;
00057     static GlobalDependencyProperty s_MaxSaturationProperty;
00058     static GlobalDependencyProperty s_MaxValueProperty;
00059     static GlobalDependencyProperty s_MinHueProperty;
00060     static GlobalDependencyProperty s_MinSaturationProperty;
00061     static GlobalDependencyProperty s_MinValueProperty;
00062     static GlobalDependencyProperty s_ShapeProperty;
00063
00064     winrt::event_token ColorChanged(winrt::TypedEventHandler<winrt::ColorSpectrum, winrt::ColorChangedEventArgs> const& value);
00065     void ColorChanged(winrt::event_token const& token);
00066
00067     event_source<winrt::TypedEventHandler<winrt::ColorSpectrum, winrt::ColorChangedEventArgs>> m_colorChangedEventSource;
00068
00069     static void EnsureProperties();
00070     static void ClearProperties();
00071
00072     static void OnColorPropertyChanged(
00073         winrt::DependencyObject const& sender,
00074         winrt::DependencyPropertyChangedEventArgs const& args);
00075
00076     static void OnComponentsPropertyChanged(
00077         winrt::DependencyObject const& sender,
00078         winrt::DependencyPropertyChangedEventArgs const& args);
00079
00080     static void OnHsvColorPropertyChanged(
00081         winrt::DependencyObject const& sender,
00082         winrt::DependencyPropertyChangedEventArgs const& args);
00083
00084     static void OnMaxHuePropertyChanged(
00085         winrt::DependencyObject const& sender,
00086         winrt::DependencyPropertyChangedEventArgs const& args);
00087
00088     static void OnMaxSaturationPropertyChanged(
00089         winrt::DependencyObject const& sender,
00090         winrt::DependencyPropertyChangedEventArgs const& args);
00091
00092     static void OnMaxValuePropertyChanged(
00093         winrt::DependencyObject const& sender,
00094         winrt::DependencyPropertyChangedEventArgs const& args);
00095
00096     static void OnMinHuePropertyChanged(
00097         winrt::DependencyObject const& sender,
00098         winrt::DependencyPropertyChangedEventArgs const& args);
00099
00100     static void OnMinSaturationPropertyChanged(
00101         winrt::DependencyObject const& sender,
00102         winrt::DependencyPropertyChangedEventArgs const& args);
00103
00104     static void OnMinValuePropertyChanged(
00105         winrt::DependencyObject const& sender,
00106         winrt::DependencyPropertyChangedEventArgs const& args);
00107
00108     static void OnShapePropertyChanged(
00109         winrt::DependencyObject const& sender,
00110         winrt::DependencyPropertyChangedEventArgs const& args);
00111 };
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/TestUI/TopMode/NavigationViewTopNavOnlyPage.xaml.cs Source File

  • NavigationView
  • TestUI
  • TopMode

NavigationViewTopNavOnlyPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004
00005 using Microsoft.UI.Xaml.Controls;
00006 using Microsoft.UI.Xaml;
00007 using Windows.ApplicationModel.Core;
00008 using Windows.UI.ViewManagement;
00009 using Windows.UI;
00010 using System.Collections.ObjectModel;
00011 using Microsoft.UI.Xaml.Media;
00012 using Microsoft.UI.Xaml.Media.Animation;
00013 using System.Text;
00014 using System;
00015 using System.Runtime.InteropServices;
00016 using Windows.UI.Core;
00017
00018 namespace MUXControlsTestApp
00019 {
00020     public sealed partial class NavigationViewTopNavOnlyPage : TestPage
00021     {
00022         int m_numberOfItemAdded = 0;
00023         private TextBlock contentOverlay = null;
00024         bool m_expectNullSelectedItemInNextInvoke = false;
00025
00026         public NavigationViewTopNavOnlyPage()
00027         {
00028             this.InitializeComponent();
00029
00030             UpdateTestFrameVisibility(Visibility.Visible);
00031
00032             NavView.ItemInvoked += NavView_ItemInvoked;
00033             NavView.SelectionChanged += NavView_SelectionChanged;
00034
00035
00036             if (CoreWindow.GetForCurrentThread() != null)
00037             {
00038                 var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
00039                 coreTitleBar.LayoutMetricsChanged += (s, e) => UpdateAppTitle();
00040
00041                 //remove the solid-colored backgrounds behind the caption controls and system back button
00042                 var viewTitleBar = ApplicationView.GetForCurrentView().TitleBar;
00043                 viewTitleBar.ButtonBackgroundColor = Microsoft.UI.Colors.Transparent;
00044                 viewTitleBar.ButtonInactiveBackgroundColor = Microsoft.UI.Colors.Transparent;
00045                 viewTitleBar.ButtonForegroundColor = (Color)Resources["SystemBaseHighColor"];
00046             }
00047
00048             Loaded += (s, e) => XamlRoot.Changed += (s, e) => UpdateAppTitle();
00049         }
00050
00051         private void PaneDisplayModeCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00052         {
00053             var tag = Convert.ToString(((sender as ComboBox).SelectedItem as ComboBoxItem).Tag);
00054             var mode = (NavigationViewPaneDisplayMode)Enum.Parse(typeof(NavigationViewPaneDisplayMode), tag);
00055             NavView.PaneDisplayMode = mode;
00056         }
00057
00058         private void FlipOrientation_Click(object sender, RoutedEventArgs e)
00059         {
00060             NavView.PaneDisplayMode = NavView.PaneDisplayMode == NavigationViewPaneDisplayMode.Top ? NavigationViewPaneDisplayMode.Auto : NavigationViewPaneDisplayMode.Top;
00061         }
00062
00063         private void ResetResult_Click(object sender, RoutedEventArgs e)
00064         {
00065             ItemInvokedResult.Text = "";
00066             SelectionChangedResult.Text = "";
00067             SelectionChangeRecommendedTransition.Text = "";
00068             InvokeRecommendedTransition.Text = "";
00069         }
00070
00071         private void ChangeDataSource_Click(object sender, RoutedEventArgs e)
00072         {
00073             NavView.MenuItems.Clear();
00074             NavView.MenuItems.Add(new NavigationViewItem { Content = "First Item" });
00075             NavView.MenuItems.Add(new NavigationViewItem { Content = "Second Item" });
00076             NavView.MenuItems.Add(new NavigationViewItem { Content = "Happy birthday Item" });
00077             NavView.MenuItems.Add(new NavigationViewItem { Content = "Happy new year Item" });
00078             NavView.MenuItems.Add(new NavigationViewItem { Content = "OK Item" });
00079             NavView.SelectedItem = NavView.MenuItems[3];
00080         }
00081
00082         // Click and SelectionChange would have an container. This function verify that Content == container.Content
00083         // If content is null, Container.tag is returned.
00084         private string GetAndVerifyTheContainer(object content, NavigationViewItem container)
00085         {
00086             if (content == null)
00087             {
00088                 if (container.Content != null)
00089                 {
00090                     return "container's content should be null but it is " + container.Content.ToString();
00091                 }
00092
00093                 return container.Tag != null ? container.Tag.ToString(): "container should have tag property since content is null";
00094             }
00095
00096             var contentString = content.ToString();
00097             var containerString = container.Content.ToString();
00098
00099             if (contentString.Equals(containerString))
00100             {
00101                 return contentString;
00102             }
00103             else
00104             {
00105                 return string.Format("container's content:{0} doesn't match with content:{1}", containerString, contentString);
00106             }
00107         }
00108
00109         private string RecommendedNavigationTransitionInfoToString(NavigationTransitionInfo info)
00110         {
00111             if ((info as EntranceNavigationTransitionInfo) != null)
00112             {
00113                 return "Default";
00114             }
00115             var slideNav = (info as SlideNavigationTransitionInfo);
00116             if (slideNav != null)
00117             {
00118                 try
00119                 {
00120                     return slideNav.Effect.ToString();
00121                 }
00122                 catch (InvalidCastException)
00123                 {
00124                     return "You are running on old RS5 machine which doesn't support ISlideNavigationTransitionInfo2 yet";
00125                 }
00126             }
00127             else
00128             {
00129                 return "Error";
00130             }
00131         }
00132
00133         private void BackButtonVisibilityCheckbox_Checked(object sender, RoutedEventArgs e)
00134         {
00135             NavView.IsBackButtonVisible = NavigationViewBackButtonVisible.Visible;
00136         }
00137
00138         private void BackButtonVisibilityCheckbox_Unchecked(object sender, RoutedEventArgs e)
00139         {
00140             NavView.IsBackButtonVisible = NavigationViewBackButtonVisible.Collapsed;
00141         }
00142
00143         private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs e)
00144         {
00145             var container = (e.SelectedItemContainer as NavigationViewItem);
00146
00147             if (container != null && !e.IsSettingsSelected && !container.IsSelected)
00148             {
00149                 SelectionChangedResult.Text = "Error, NavigationViewItem.IsSelected should be true before raise SelectionChanged event";
00150             }
00151             else
00152             {
00153                 if (e.SelectedItem is NavigationViewItem item)
00154                 {
00155                     SelectionChangedResult.Text = GetAndVerifyTheContainer(item.Content, container);
00156                 }
00157                 else
00158                 {
00159                     SelectionChangedResult.Text = "Null";
00160                 }
00161             }
00162
00163             SelectionChangeRecommendedTransition.Text = RecommendedNavigationTransitionInfoToString(e.RecommendedNavigationTransitionInfo);
00164         }
00165
00166         private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs e)
00167         {
00168             var container = (e.InvokedItemContainer as NavigationViewItem);
00169             ItemInvokedResult.Text = GetAndVerifyTheContainer(e.InvokedItem, container);
00170             InvokeRecommendedTransition.Text = RecommendedNavigationTransitionInfoToString(e.RecommendedNavigationTransitionInfo);
00171
00172             if (m_expectNullSelectedItemInNextInvoke)
00173             {
00174                 NavView.SelectedItem = null;
00175                 m_expectNullSelectedItemInNextInvoke = false;
00176             }
00177         }
00178
00179         private void ChangeGamesContent_Click(object sender, RoutedEventArgs e)
00180         {
00181             GamesItem.Content = "Games AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
00182         }
00183
00184         private void NavInvalidateMeasure_Click(object sender, RoutedEventArgs e)
00185         {
00186             NavView.InvalidateMeasure();
00187         }
00188
00189         private void ClearNavItemContent_Click(object sender, RoutedEventArgs e)
00190         {
00191             for (int i= NavView.MenuItems.Count-1; i>=0; i--)
00192             {
00193                 var item = NavView.MenuItems[i];
00194                 var container = item  as NavigationViewItem;
00195                 if (container != null)
00196                 {
00197                     container.Content = null;
00198                 }
00199
00200                 var navHeader = item as NavigationViewItemHeader;
00201                 if (navHeader != null)
00202                 {
00203                     navHeader.Content = null;
00204                 }
00205             }
00206         }
00207
00208         private void AddLongNavItem_Click(object sender, RoutedEventArgs e)
00209         {
00210             var content = "Bill".PadRight(100, '.') + "Gates";
00211             NavView.MenuItems.Add(new NavigationViewItem(){ Content = content });
00212         }
00213
00214         private void AddTenItems_Click(object sender, RoutedEventArgs e)
00215         {
00216             var menuItems = NavView.MenuItems;
00217             for (int i = 0; i < 10; i++)
00218             {
00219                 m_numberOfItemAdded++;
00220                 var item = new NavigationViewItem() { Content = "Added Item " + m_numberOfItemAdded };
00221                 menuItems.Add(item);
00222             }
00223         }
00224         private void ExpectNullSelectedItemInItemInvoke_Click(object sender, RoutedEventArgs e)
00225         {
00226             m_expectNullSelectedItemInNextInvoke = true;
00227         }
00228
00229         private void FlipExtendViewIntoTitleBar_Click(object sender, RoutedEventArgs e)
00230         {
00231             if (CoreWindow.GetForCurrentThread() != null)
00232             {
00233                 var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
00234                 coreTitleBar.ExtendViewIntoTitleBar = !coreTitleBar.ExtendViewIntoTitleBar;
00235             }
00236         }
00237
00238         private void UpdateAppTitle()
00239         {
00240             var full = false;
00241
00242             if (CoreWindow.GetForCurrentThread() != null)
00243             {
00244                 full = ApplicationView.GetForCurrentView().IsFullScreenMode;
00245                 var left = 12 + (full ? 0 : CoreApplication.GetCurrentView().TitleBar.SystemOverlayLeftInset);
00246                 AppTitle.Margin = new Thickness(left, 8, 0, 0);
00247             }
00248             else
00249             {
00250                 AppTitle.Margin = new Thickness(12, 8, 0, 0);
00251             }
00252         }
00253
00254         private void TestFrameCheckbox_Checked(object sender, RoutedEventArgs e)
00255         {
00256             UpdateTestFrameVisibility(Visibility.Visible);
00257         }
00258
00259         private void TestFrameCheckbox_Unchecked(object sender, RoutedEventArgs e)
00260         {
00261             UpdateTestFrameVisibility(Visibility.Collapsed);
00262         }
00263         private void ChangeOverflowLabelVisibility_Checked(object sender, RoutedEventArgs e)
00264         {
00265             NavView.OverflowLabelMode = NavigationViewOverflowLabelMode.MoreLabel;
00266         }
00267
00268         private void ChangeOverflowLabelVisibility_Unchecked(object sender, RoutedEventArgs e)
00269         {
00270             NavView.OverflowLabelMode = NavigationViewOverflowLabelMode.NoLabel;
00271         }
00272         private void GetActiveVisualState_Click(object sender, RoutedEventArgs e)
00273         {
00274             TestResult.Text = Utilities.VisualStateHelper.GetCurrentVisualStateNameString(NavView);
00275         }
00276
00277         private void AddRemoveContentOverlay_Click(object sender, RoutedEventArgs e)
00278         {
00279             contentOverlay = (contentOverlay == null ? new TextBlock() { Text = "CONTENT OVERLAY" } : null);
00280             NavView.ContentOverlay = contentOverlay;
00281         }
00282
00283         private void ChangeTopNavVisibility_Click(object sender, RoutedEventArgs e)
00284         {
00285             NavView.IsPaneVisible = !NavView.IsPaneVisible;
00286         }
00287
00288         private void SetInvalidSelectedItem_Click(object sender, RoutedEventArgs e)
00289         {
00290             NavView.SelectedItem = new CheckBox();
00291         }
00292
00293         private void ShoulderNavigationEnabledSetter_SelectionChanged(object sender, SelectionChangedEventArgs e)
00294         {
00295             string selectedItem = (e.AddedItems[0] as ComboBoxItem).Content as string;
00296
00297             switch (selectedItem)
00298             {
00299                 case "Always":
00300                     NavView.ShoulderNavigationEnabled = Microsoft.UI.Xaml.Controls.NavigationViewShoulderNavigationEnabled.Always;
00301                     break;
00302                 case "WhenSelectionFollowsFocus":
00303                     NavView.ShoulderNavigationEnabled = Microsoft.UI.Xaml.Controls.NavigationViewShoulderNavigationEnabled.WhenSelectionFollowsFocus;
00304                     break;
00305                 case "Never":
00306                     NavView.ShoulderNavigationEnabled = Microsoft.UI.Xaml.Controls.NavigationViewShoulderNavigationEnabled.Never;
00307                     break;
00308             }
00309         }
00310         private void SelectionFollowsFocusSetter_SelectionChanged(object sender, SelectionChangedEventArgs e)
00311         {
00312             string selectedItem = (e.AddedItems[0] as ComboBoxItem).Content as string;
00313
00314             if(selectedItem == "Enabled")
00315             {
00316                 NavView.SelectionFollowsFocus = Microsoft.UI.Xaml.Controls.NavigationViewSelectionFollowsFocus.Enabled;
00317             }
00318             else
00319             {
00320                 NavView.SelectionFollowsFocus = Microsoft.UI.Xaml.Controls.NavigationViewSelectionFollowsFocus.Disabled;
00321
00322             }
00323         }
00324     }
00325 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SwipeControl/SwipeControlInteractionTrackerOwner.cpp Source File

  • SwipeControl

SwipeControlInteractionTrackerOwner.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SwipeControlInteractionTrackerOwner.h"
00007 #include "SwipeControl.h"
00008
00009 SwipeControlInteractionTrackerOwner::SwipeControlInteractionTrackerOwner(const winrt::SwipeControl& swipeControl)
00010 {
00011     SWIPECONTROL_TRACE_VERBOSE(swipeControl, TRACE_MSG_METH_PTR, METH_NAME, this, swipeControl);
00012
00013     m_owner = swipeControl;
00014 }
00015
00016 SwipeControlInteractionTrackerOwner::~SwipeControlInteractionTrackerOwner()
00017 {
00018     SWIPECONTROL_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00019
00020     m_owner = nullptr;
00021 }
00022
00023 #pragma region IInteractionTrackerOwner
00024 void SwipeControlInteractionTrackerOwner::ValuesChanged(
00025     const winrt::InteractionTracker& /*sender*/, const winrt::InteractionTrackerValuesChangedArgs& args)
00026 {
00027     if (!m_owner)
00028     {
00029         return;
00030     }
00031
00032     if (auto rawOwner = m_owner.get())
00033     {
00034         auto swipeControl = winrt::get_self<SwipeControl>(rawOwner);
00035         if (swipeControl)
00036         {
00037             swipeControl->ValuesChanged(args);
00038         }
00039     }
00040 }
00041
00042 void SwipeControlInteractionTrackerOwner::RequestIgnored(
00043     const winrt::InteractionTracker& /*sender*/, const winrt::InteractionTrackerRequestIgnoredArgs& args)
00044 {
00045     if (!m_owner)
00046     {
00047         return;
00048     }
00049
00050     if (auto rawOwner = m_owner.get())
00051     {
00052         auto swipeControl = winrt::get_self<SwipeControl>(rawOwner);
00053         if (swipeControl)
00054         {
00055             swipeControl->RequestIgnored(args);
00056         }
00057     }
00058 }
00059
00060 void SwipeControlInteractionTrackerOwner::InteractingStateEntered(
00061     const winrt::InteractionTracker& /*sender*/, const winrt::InteractionTrackerInteractingStateEnteredArgs& args)
00062 {
00063     if (!m_owner)
00064     {
00065         return;
00066     }
00067
00068     if (auto rawOwner = m_owner.get())
00069     {
00070         auto swipeControl = winrt::get_self<SwipeControl>(rawOwner);
00071         if (swipeControl)
00072         {
00073             swipeControl->InteractingStateEntered(args);
00074         }
00075     }
00076 }
00077
00078 void SwipeControlInteractionTrackerOwner::InertiaStateEntered(
00079     const winrt::InteractionTracker& /*sender*/, const winrt::InteractionTrackerInertiaStateEnteredArgs& args)
00080 {
00081     if (!m_owner)
00082     {
00083         return;
00084     }
00085
00086     if (auto rawOwner = m_owner.get())
00087     {
00088         auto swipeControl = winrt::get_self<SwipeControl>(rawOwner);
00089         if (swipeControl)
00090         {
00091             swipeControl->InertiaStateEntered(args);
00092         }
00093     }
00094 }
00095
00096 void SwipeControlInteractionTrackerOwner::IdleStateEntered(
00097     const winrt::InteractionTracker& /*sender*/, const winrt::InteractionTrackerIdleStateEnteredArgs& args)
00098 {
00099     if (!m_owner)
00100     {
00101         return;
00102     }
00103
00104     if (auto rawOwner = m_owner.get())
00105     {
00106         auto swipeControl = winrt::get_self<SwipeControl>(rawOwner);
00107         if (swipeControl)
00108         {
00109             swipeControl->IdleStateEntered(args);
00110         }
00111     }
00112 }
00113
00114 void SwipeControlInteractionTrackerOwner::CustomAnimationStateEntered(
00115     const winrt::InteractionTracker& /*sender*/, const winrt::InteractionTrackerCustomAnimationStateEnteredArgs& args)
00116 {
00117     if (!m_owner)
00118     {
00119         return;
00120     }
00121
00122     if (auto rawOwner = m_owner.get())
00123     {
00124         auto swipeControl = winrt::get_self<SwipeControl>(rawOwner);
00125         if (swipeControl)
00126         {
00127             swipeControl->CustomAnimationStateEntered(args);
00128         }
00129     }
00130 }
00131 #pragma endregion
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PipsPager/InteractionTests/PipsPagerTestBase.cs Source File

  • PipsPager
  • InteractionTests

PipsPagerTestBase.cs

Go to the documentation of this file.
00001 ﻿using Common;
00002 using Microsoft.Windows.Apps.Test.Automation;
00003 using WEX.TestExecution;
00004 using WEX.TestExecution.Markup;
00005 using WEX.Logging.Interop;
00006 using System;
00007 using System.Linq;
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00009
00010
00011 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00012 {
00013     public class PipsPagerTestBase
00014     {
00015         protected PipsPagerElements elements;
00016         protected delegate void SetButtonVisibilityModeFunction(ButtonVisibilityMode mode);
00017         protected delegate bool GetButtonIsHiddenOnEdgeFunction();
00018
00019         protected void SelectPageInPager(int index)
00020         {
00021             InputHelper.LeftClick(elements.GetPipWithPageNumber("Page " + index.ToString()));
00022             Wait.ForIdle();
00023         }
00024
00025         protected void VerifyPageButtonWithVisibilityModeSet(ButtonType btnType, ButtonVisibilityMode modeSet, bool isPagerInFocus = false)
00026         {
00027             ToggleState isVisibleState;
00028             ToggleState isEnabledState;
00029             bool isHiddenOnEdge;
00030
00031             if (btnType == ButtonType.Previous)
00032             {
00033                 isVisibleState = elements.GetPreviousPageButtonIsVisibleCheckBox().ToggleState;
00034                 isEnabledState = elements.GetPreviousPageButtonIsEnabledCheckBox().ToggleState;
00035                 isHiddenOnEdge = GetCurrentPageAsInt32() == 0;
00036             }
00037             else
00038             {
00039                 isVisibleState = elements.GetNextPageButtonIsVisibleCheckBox().ToggleState;
00040                 isEnabledState = elements.GetNextPageButtonIsEnabledCheckBox().ToggleState;
00041                 isHiddenOnEdge = !(GetCurrentPage() == "Infinite") && GetCurrentPageAsInt32() == GetSelectedNumberOfPagesAsInt32() - 1;
00042             }
00043             switch (modeSet)
00044             {
00045                 case ButtonVisibilityMode.Collapsed:
00046                     Verify.AreEqual(isVisibleState, ToggleState.Off);
00047                     Verify.AreEqual(isEnabledState, ToggleState.Off);
00048                     break;
00049
00050                 case ButtonVisibilityMode.Visible:
00051                     if (isHiddenOnEdge)
00052                     {
00053                         Verify.AreEqual(isVisibleState, ToggleState.Off);
00054                         Verify.AreEqual(isEnabledState, ToggleState.Off);
00055                     }
00056                     else
00057                     {
00058                         Verify.AreEqual(isVisibleState, ToggleState.On);
00059                         Verify.AreEqual(isEnabledState, ToggleState.On);
00060                     }
00061                     break;
00062
00063                 case ButtonVisibilityMode.VisibleOnPointerOver:
00064                     if (isHiddenOnEdge)
00065                     {
00066                         Verify.AreEqual(isVisibleState, ToggleState.Off);
00067                         Verify.AreEqual(isEnabledState, ToggleState.Off);
00068                     }
00069                     else
00070                     {
00071                         if (isPagerInFocus)
00072                         {
00073                             Verify.AreEqual(isVisibleState, ToggleState.On);
00074                         }
00075                         else
00076                         {
00077                             Verify.AreEqual(isVisibleState, ToggleState.Off);
00078                         }
00079                         Verify.AreEqual(isEnabledState, ToggleState.On);
00080                     }
00081                     break;
00082             }
00083         }
00084
00085         protected void VerifyNextPageButtonVisibility(Visibility expected)
00086         {
00087             Verify.AreEqual(expected == Visibility.Visible, elements.GetNextPageButtonIsVisibleCheckBox().ToggleState == ToggleState.On);
00088         }
00089
00090         protected void SetNextPageButtonVisibilityMode(ButtonVisibilityMode mode)
00091         {
00092             elements.GetNextPageButtonVisibilityComboBox().SelectItemByName($"{mode}NextButton");
00093         }
00094
00095         protected void SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode mode)
00096         {
00097             elements.GetPreviousPageButtonVisibilityComboBox().SelectItemByName($"{mode}PreviousButton");
00098         }
00099
00100         protected void SetOrientation(OrientationType orientation)
00101         {
00102             elements.GetOrientationComboBox().SelectItemByName($"{orientation}Orientation");
00103         }
00104
00105         protected void SetWrapMode(WrapMode wrapMode)
00106         {
00107             elements.GetWrapModeComboBox().SelectItemByName($"{wrapMode}");
00108         }
00109
00110         protected void VerifyOrientationChanged(OrientationType orientation)
00111         {
00112             Verify.AreEqual($"{orientation}", GetCurrentOrientation());
00113         }
00114
00115         protected void VerifySelectedPageIndex(int expectedPage)
00116         {
00117             Verify.AreEqual(expectedPage, GetCurrentPageAsInt32());
00118         }
00119
00120         protected void VerifyFocusedPageIndex(int index)
00121         {
00122             Verify.AreEqual(index, GetFocusedPageAsInt32());
00123         }
00124
00125         protected void VerifySelectedFocusedIndex(int index)
00126         {
00127             VerifySelectedPageIndex(index);
00128             VerifyFocusedPageIndex(index);
00129         }
00130
00131         protected string GetCurrentOrientation()
00132         {
00133             return elements.GetCurrentOrientationTextBlock().GetText().Split(' ').Last();
00134         }
00135
00136         protected int GetFocusedPageAsInt32()
00137         {
00138             return Convert.ToInt32(GetFocusedPage());
00139         }
00140
00141         protected int GetCurrentPageAsInt32()
00142         {
00143             return Convert.ToInt32(GetCurrentPage());
00144         }
00145
00146         protected string GetFocusedPage()
00147         {
00148             string focusedPageTextBlockContent = elements.GetFocusedPageIndexTextBlock().GetText();
00149             return new string(focusedPageTextBlockContent.Where(char.IsDigit).ToArray());
00150         }
00151
00152         protected string GetCurrentPage()
00153         {
00154             string currentPageTextBlockContent = elements.GetCurrentPageTextBlock().GetText();
00155             return new string(currentPageTextBlockContent.Where(char.IsDigit).ToArray());
00156         }
00157
00158         protected void ChangeNumberOfPages(NumberOfPagesOptions numberOfPages)
00159         {
00160             elements.GetNumberOfPagesComboBox().SelectItemByName($"{numberOfPages}NumberOfPages");
00161         }
00162
00163         protected string GetSelectedNumberOfPages()
00164         {
00165             string selectedNumberOfPages = ExtractNumberFromString(elements.GetCurrentNumberOfPagesTextBlock().GetText());
00166             if (string.IsNullOrEmpty(selectedNumberOfPages))
00167             {
00168                 selectedNumberOfPages = "Infinite";
00169             }
00170             return selectedNumberOfPages;
00171         }
00172
00173         protected int GetSelectedNumberOfPagesAsInt32()
00174         {
00175             var selectedNumberOfPages = GetSelectedNumberOfPages();
00176             if (selectedNumberOfPages == "Infinite")
00177             {
00178                 return -1;
00179             }
00180             return Convert.ToInt32(GetSelectedNumberOfPages());
00181         }
00182         protected void VerifyNumberOfPages(string numberOfPages)
00183         {
00184             Verify.AreEqual(numberOfPages, GetSelectedNumberOfPages());
00185
00186         }
00187
00188         private string ExtractNumberFromString(string text)
00189         {
00190             return new string(text.Where(char.IsDigit).ToArray());
00191         }
00192
00193         public enum ButtonType
00194         {
00195             Previous,
00196             Next
00197         }
00198
00199         public enum ButtonVisibilityMode
00200         {
00201             Visible,
00202             VisibleOnPointerOver,
00203             Collapsed
00204         }
00205
00206         public enum NumberOfPagesOptions
00207         {
00208             Zero,
00209             One,
00210             Five,
00211             Ten,
00212             Twenty,
00213             Infinite
00214         }
00215
00216         public enum WrapMode
00217         {
00218             None,
00219             Wrap
00220         }
00221     }
00222 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadialGradientBrush/TestUI/RadialGradientBrushPage.xaml.cs Source File

  • RadialGradientBrush
  • TestUI

RadialGradientBrushPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Runtime.InteropServices.WindowsRuntime;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Controls;
00008 using Microsoft.UI.Xaml.Controls.Primitives;
00009 using Microsoft.UI.Xaml.Media;
00010 using Microsoft.UI.Xaml.Markup;
00011 using Windows.UI;
00012 using System.Windows.Input;
00013 using System.Numerics;
00014 using Microsoft.UI.Xaml.Media.Imaging;
00015 using Windows.Foundation;
00016 using Windows.Foundation.Metadata;
00017 using Microsoft.UI.Composition;
00018 using Microsoft.UI.Xaml.Data;
00019 using Microsoft.UI;
00020
00021 namespace MUXControlsTestApp
00022 {
00023     [TopLevelTestPage(Name = "RadialGradientBrush")]
00024     public sealed partial class RadialGradientBrushPage : TestPage
00025     {
00026         public RadialGradientBrush DynamicGradientBrush;
00027         private Random _random;
00028
00029         public RadialGradientBrushPage()
00030         {
00031             InitializeComponent();
00032             _random = new Random();
00033         }
00034
00035         public string[] GetColorSpaceValueNames()
00036         {
00037             return Enum.GetNames(typeof(CompositionColorSpace));
00038         }
00039
00040         public string DynamicGradientBrushInterpolationSpace
00041         {
00042             get
00043             {
00044                 if (DynamicGradientBrush != null)
00045                 {
00046                     return DynamicGradientBrush.InterpolationSpace.ToString();
00047                 }
00048                 else
00049                 {
00050                     return null;
00051                 }
00052             }
00053             set
00054             {
00055                 if (DynamicGradientBrush != null && value != null)
00056                 {
00057                     DynamicGradientBrush.InterpolationSpace = (CompositionColorSpace)Enum.Parse(typeof(CompositionColorSpace), value);
00058                 }
00059             }
00060         }
00061
00062         public string[] GetSpreadMethodValueNames()
00063         {
00064             return Enum.GetNames(typeof(GradientSpreadMethod));
00065         }
00066
00067         public string DynamicGradientBrushSpreadMethod
00068         {
00069             get
00070             {
00071                 if (DynamicGradientBrush != null)
00072                 {
00073                     return DynamicGradientBrush.SpreadMethod.ToString();
00074                 }
00075                 else
00076                 {
00077                     return null;
00078                 }
00079             }
00080             set
00081             {
00082                 if (DynamicGradientBrush != null && value != null)
00083                 {
00084                     DynamicGradientBrush.SpreadMethod = (GradientSpreadMethod)Enum.Parse(typeof(GradientSpreadMethod), value);
00085                 }
00086             }
00087         }
00088
00089         private void ReplaceGradientButton_Click(object sender, RoutedEventArgs e)
00090         {
00091             DynamicGradientBrush = new RadialGradientBrush();
00092             DynamicGradientBrush.FallbackColor = Color.FromArgb(Byte.MaxValue, (byte)_random.Next(256), (byte)_random.Next(256), (byte)_random.Next(256));
00093
00094             // Set brush before adding stops
00095             RectangleWithDynamicGradient.Fill = DynamicGradientBrush;
00096
00097             DynamicGradientBrush.GradientStops.Clear();
00098             for (int i = 0; i < _random.Next(2, 5); i++)
00099             {
00100                 AddRandomGradientStop(DynamicGradientBrush);
00101             }
00102
00103             // Set brush after adding stops
00104             TextBlockWithDynamicGradient.Foreground = DynamicGradientBrush;
00105
00106             Bindings.Update();
00107         }
00108
00109         private void AddGradientStopButton_Click(object sender, RoutedEventArgs e)
00110         {
00111             AddRandomGradientStop(DynamicGradientBrush);
00112         }
00113
00114         private void RemoveGradientStopButton_Click(object sender, RoutedEventArgs e)
00115         {
00116             RemoveRandomGradientStop(DynamicGradientBrush);
00117         }
00118
00119         private void RandomizeGradientOriginButton_Click(object sender, RoutedEventArgs e)
00120         {
00121             RandomizeGradientOrigin(DynamicGradientBrush);
00122         }
00123
00124         private void RandomizeCenterButton_Click(object sender, RoutedEventArgs e)
00125         {
00126             RandomizeCenter(DynamicGradientBrush);
00127         }
00128
00129         private void RandomizeRadiusButton_Click(object sender, RoutedEventArgs e)
00130         {
00131             RandomizeRadius(DynamicGradientBrush);
00132         }
00133
00134         private void ToggleMappingModeButton_Click(object sender, RoutedEventArgs e)
00135         {
00136             ToggleMappingMode(DynamicGradientBrush);
00137         }
00138
00139         private async void GenerateRenderTargetBitmapButton_Click(object sender, RoutedEventArgs e)
00140         {
00141             var rtb = new RenderTargetBitmap();
00142             await rtb.RenderAsync(GradientRectangle);
00143
00144             RenderTargetBitmapResultRectangle.Fill = new ImageBrush() { ImageSource = rtb };
00145
00146             var pixelBuffer = await rtb.GetPixelsAsync();
00147             byte[] pixelArray = pixelBuffer.ToArray();
00148
00149             // Sample top left and center pixels to verify rendering is correct.
00150             var centerColor = GetPixelAtPoint(new Point(rtb.PixelWidth / 2, rtb.PixelHeight / 2), rtb, pixelArray);
00151             var outerColor = GetPixelAtPoint(new Point(0, 0), rtb, pixelArray);
00152
00153             if (centerColor == Colors.Orange && outerColor == Colors.Green)
00154             {
00155                 ColorMatchTestResult.Text = "Passed";
00156             }
00157             else
00158             {
00159                 ColorMatchTestResult.Text = "Failed";
00160             }
00161         }
00162
00163         private void AddRandomGradientStop(RadialGradientBrush gradientBrush)
00164         {
00165             if (gradientBrush != null)
00166             {
00167                 var stop = new GradientStop();
00168                 stop.Color = Color.FromArgb(Byte.MaxValue, (byte)_random.Next(256), (byte)_random.Next(256), (byte)_random.Next(256));
00169                 stop.Offset = _random.NextDouble();
00170
00171                 gradientBrush.GradientStops.Add(stop);
00172             }
00173         }
00174
00175         private void RemoveRandomGradientStop(RadialGradientBrush gradientBrush)
00176         {
00177             if (gradientBrush != null && gradientBrush.GradientStops.Count > 0)
00178             {
00179                 gradientBrush.GradientStops.RemoveAt(_random.Next(0, gradientBrush.GradientStops.Count - 1));
00180             }
00181         }
00182
00183         private void RandomizeGradientOrigin(RadialGradientBrush gradientBrush)
00184         {
00185             if (gradientBrush != null)
00186             {
00187                 if (gradientBrush.MappingMode == BrushMappingMode.Absolute)
00188                 {
00189                     gradientBrush.GradientOrigin = new Point(_random.Next(0, 100), _random.Next(0, 100));
00190                 }
00191                 else
00192                 {
00193                     gradientBrush.GradientOrigin = new Point(_random.Next(-100, 100) / 100f, _random.Next(-100, 100) / 100f);
00194                 }
00195             }
00196         }
00197
00198         private void RandomizeCenter(RadialGradientBrush gradientBrush)
00199         {
00200             if (gradientBrush != null)
00201             {
00202                 if (gradientBrush.MappingMode == BrushMappingMode.Absolute)
00203                 {
00204                     gradientBrush.Center = new Point(_random.Next(0, 100), _random.Next(0, 100));
00205                 }
00206                 else
00207                 {
00208                     gradientBrush.Center = new Point(_random.NextDouble(), _random.NextDouble());
00209                 }
00210             }
00211         }
00212
00213         private void RandomizeRadius(RadialGradientBrush gradientBrush)
00214         {
00215             if (gradientBrush != null)
00216             {
00217                 if (gradientBrush.MappingMode == BrushMappingMode.Absolute)
00218                 {
00219                     gradientBrush.RadiusX = _random.Next(10, 200);
00220                     gradientBrush.RadiusY = _random.Next(10, 200);
00221                 }
00222                 else
00223                 {
00224                     gradientBrush.RadiusX = _random.NextDouble();
00225                     gradientBrush.RadiusY = _random.NextDouble();
00226                 }
00227             }
00228         }
00229
00230         private void ToggleMappingMode(RadialGradientBrush gradientBrush)
00231         {
00232             if (gradientBrush != null)
00233             {
00234                 gradientBrush.MappingMode = ((gradientBrush.MappingMode == BrushMappingMode.RelativeToBoundingBox) ? BrushMappingMode.Absolute : BrushMappingMode.RelativeToBoundingBox);
00235
00236                 RandomizeCenter(gradientBrush);
00237                 RandomizeRadius(gradientBrush);
00238                 RandomizeGradientOrigin(gradientBrush);
00239             }
00240         }
00241
00242         private Color GetPixelAtPoint(Point p, RenderTargetBitmap rtb, byte[] pixelArray)
00243         {
00244             Color pixelColor = new Color();
00245             int x = (int)(p.X);
00246             int y = (int)(p.Y);
00247             int pointPosition = 4 * (rtb.PixelWidth * y + x);
00248
00249             pixelColor.B = pixelArray[pointPosition];
00250             pixelColor.G = pixelArray[pointPosition + 1];
00251             pixelColor.R = pixelArray[pointPosition + 2];
00252             pixelColor.A = pixelArray[pointPosition + 3];
00253
00254             return pixelColor;
00255         }
00256     }
00257 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TreeViewItemTemplateSettings.properties.cpp Source File

  • Generated

TreeViewItemTemplateSettings.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "TreeViewItemTemplateSettings.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(TreeViewItemTemplateSettings)
00012 }
00013
00014 #include "TreeViewItemTemplateSettings.g.cpp"
00015
00016 GlobalDependencyProperty TreeViewItemTemplateSettingsProperties::s_CollapsedGlyphVisibilityProperty{ nullptr };
00017 GlobalDependencyProperty TreeViewItemTemplateSettingsProperties::s_DragItemsCountProperty{ nullptr };
00018 GlobalDependencyProperty TreeViewItemTemplateSettingsProperties::s_ExpandedGlyphVisibilityProperty{ nullptr };
00019 GlobalDependencyProperty TreeViewItemTemplateSettingsProperties::s_IndentationProperty{ nullptr };
00020
00021 TreeViewItemTemplateSettingsProperties::TreeViewItemTemplateSettingsProperties()
00022 {
00023     EnsureProperties();
00024 }
00025
00026 void TreeViewItemTemplateSettingsProperties::EnsureProperties()
00027 {
00028     if (!s_CollapsedGlyphVisibilityProperty)
00029     {
00030         s_CollapsedGlyphVisibilityProperty =
00031             InitializeDependencyProperty(
00032                 L"CollapsedGlyphVisibility",
00033                 winrt::name_of<winrt::Visibility>(),
00034                 winrt::name_of<winrt::TreeViewItemTemplateSettings>(),
00035                 false /* isAttached */,
00036                 ValueHelper<winrt::Visibility>::BoxValueIfNecessary(winrt::Visibility::Collapsed),
00037                 nullptr);
00038     }
00039     if (!s_DragItemsCountProperty)
00040     {
00041         s_DragItemsCountProperty =
00042             InitializeDependencyProperty(
00043                 L"DragItemsCount",
00044                 winrt::name_of<int>(),
00045                 winrt::name_of<winrt::TreeViewItemTemplateSettings>(),
00046                 false /* isAttached */,
00047                 ValueHelper<int>::BoxedDefaultValue(),
00048                 nullptr);
00049     }
00050     if (!s_ExpandedGlyphVisibilityProperty)
00051     {
00052         s_ExpandedGlyphVisibilityProperty =
00053             InitializeDependencyProperty(
00054                 L"ExpandedGlyphVisibility",
00055                 winrt::name_of<winrt::Visibility>(),
00056                 winrt::name_of<winrt::TreeViewItemTemplateSettings>(),
00057                 false /* isAttached */,
00058                 ValueHelper<winrt::Visibility>::BoxValueIfNecessary(winrt::Visibility::Collapsed),
00059                 nullptr);
00060     }
00061     if (!s_IndentationProperty)
00062     {
00063         s_IndentationProperty =
00064             InitializeDependencyProperty(
00065                 L"Indentation",
00066                 winrt::name_of<winrt::Thickness>(),
00067                 winrt::name_of<winrt::TreeViewItemTemplateSettings>(),
00068                 false /* isAttached */,
00069                 ValueHelper<winrt::Thickness>::BoxedDefaultValue(),
00070                 nullptr);
00071     }
00072 }
00073
00074 void TreeViewItemTemplateSettingsProperties::ClearProperties()
00075 {
00076     s_CollapsedGlyphVisibilityProperty = nullptr;
00077     s_DragItemsCountProperty = nullptr;
00078     s_ExpandedGlyphVisibilityProperty = nullptr;
00079     s_IndentationProperty = nullptr;
00080 }
00081
00082 void TreeViewItemTemplateSettingsProperties::CollapsedGlyphVisibility(winrt::Visibility const& value)
00083 {
00084     [[gsl::suppress(con)]]
00085     {
00086     static_cast<TreeViewItemTemplateSettings*>(this)->SetValue(s_CollapsedGlyphVisibilityProperty, ValueHelper<winrt::Visibility>::BoxValueIfNecessary(value));
00087     }
00088 }
00089
00090 winrt::Visibility TreeViewItemTemplateSettingsProperties::CollapsedGlyphVisibility()
00091 {
00092     return ValueHelper<winrt::Visibility>::CastOrUnbox(static_cast<TreeViewItemTemplateSettings*>(this)->GetValue(s_CollapsedGlyphVisibilityProperty));
00093 }
00094
00095 void TreeViewItemTemplateSettingsProperties::DragItemsCount(int value)
00096 {
00097     [[gsl::suppress(con)]]
00098     {
00099     static_cast<TreeViewItemTemplateSettings*>(this)->SetValue(s_DragItemsCountProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00100     }
00101 }
00102
00103 int TreeViewItemTemplateSettingsProperties::DragItemsCount()
00104 {
00105     return ValueHelper<int>::CastOrUnbox(static_cast<TreeViewItemTemplateSettings*>(this)->GetValue(s_DragItemsCountProperty));
00106 }
00107
00108 void TreeViewItemTemplateSettingsProperties::ExpandedGlyphVisibility(winrt::Visibility const& value)
00109 {
00110     [[gsl::suppress(con)]]
00111     {
00112     static_cast<TreeViewItemTemplateSettings*>(this)->SetValue(s_ExpandedGlyphVisibilityProperty, ValueHelper<winrt::Visibility>::BoxValueIfNecessary(value));
00113     }
00114 }
00115
00116 winrt::Visibility TreeViewItemTemplateSettingsProperties::ExpandedGlyphVisibility()
00117 {
00118     return ValueHelper<winrt::Visibility>::CastOrUnbox(static_cast<TreeViewItemTemplateSettings*>(this)->GetValue(s_ExpandedGlyphVisibilityProperty));
00119 }
00120
00121 void TreeViewItemTemplateSettingsProperties::Indentation(winrt::Thickness const& value)
00122 {
00123     [[gsl::suppress(con)]]
00124     {
00125     static_cast<TreeViewItemTemplateSettings*>(this)->SetValue(s_IndentationProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
00126     }
00127 }
00128
00129 winrt::Thickness TreeViewItemTemplateSettingsProperties::Indentation()
00130 {
00131     return ValueHelper<winrt::Thickness>::CastOrUnbox(static_cast<TreeViewItemTemplateSettings*>(this)->GetValue(s_IndentationProperty));
00132 }
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MapElementsLayerProperties Member List

This is the complete list of members for MapElementsLayerProperties, including all inherited members.
ClearProperties() | MapElementsLayerProperties | [static]
EnsureProperties() | MapElementsLayerProperties | [static]
m_mapElementClickEventSource | MapElementsLayerProperties |
MapElementClick(winrt::TypedEventHandler< winrt::MapElementsLayer, winrt::MapElementClickEventArgs > const &value) | MapElementsLayerProperties |
MapElementClick(winrt::event_token const &token) | MapElementsLayerProperties |
MapElements(winrt::IVector< winrt::MapElement > const &value) | MapElementsLayerProperties |
MapElements() | MapElementsLayerProperties |
MapElementsLayerProperties() | MapElementsLayerProperties |
MapElementsProperty() | MapElementsLayerProperties | [inline, static]
OnMapElementsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | MapElementsLayerProperties | [static]
s_MapElementsProperty | MapElementsLayerProperties | [static]
Generated on Sun Dec 1 2024 20:52:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RecyclingElementFactoryProperties Member List

This is the complete list of members for RecyclingElementFactoryProperties, including all inherited members.
ClearProperties() | RecyclingElementFactoryProperties | [static]
EnsureProperties() | RecyclingElementFactoryProperties | [static]
m_selectTemplateKeyEventSource | RecyclingElementFactoryProperties |
RecyclingElementFactoryProperties() | RecyclingElementFactoryProperties |
SelectTemplateKey(winrt::TypedEventHandler< winrt::RecyclingElementFactory, winrt::SelectTemplateEventArgs > const &value) | RecyclingElementFactoryProperties |
SelectTemplateKey(winrt::event_token const &token) | RecyclingElementFactoryProperties |
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarPenConfigurationControl.h Source File

  • InkToolBar

InkToolBarPenConfigurationControl.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarPenConfigurationControl.g.h"
00011 #include "InkToolBarPenConfigurationControl.properties.h"
00012
00013 class InkToolBarPenConfigurationControl :
00014     public ReferenceTracker<InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT>,
00015     public InkToolBarPenConfigurationControlProperties
00016 {
00017 public:
00018
00019     winrt::InkToolBarPenButton PenButton() { winrt::throw_hresult(E_NOTIMPL); }
00020 };
00021
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectorBarProperties Member List

This is the complete list of members for SelectorBarProperties, including all inherited members.
ClearProperties() | SelectorBarProperties | [static]
EnsureProperties() | SelectorBarProperties | [static]
Items(winrt::IVector< winrt::SelectorBarItem > const &value) | SelectorBarProperties |
Items() | SelectorBarProperties |
ItemsProperty() | SelectorBarProperties | [inline, static]
m_selectionChangedEventSource | SelectorBarProperties |
OnItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SelectorBarProperties | [static]
OnSelectedItemPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SelectorBarProperties | [static]
s_ItemsProperty | SelectorBarProperties | [static]
s_SelectedItemProperty | SelectorBarProperties | [static]
SelectedItem(winrt::SelectorBarItem const &value) | SelectorBarProperties |
SelectedItem() | SelectorBarProperties |
SelectedItemProperty() | SelectorBarProperties | [inline, static]
SelectionChanged(winrt::TypedEventHandler< winrt::SelectorBar, winrt::SelectorBarSelectionChangedEventArgs > const &value) | SelectorBarProperties |
SelectionChanged(winrt::event_token const &token) | SelectorBarProperties |
SelectorBarProperties() | SelectorBarProperties |
Generated on Sun Dec 1 2024 20:53:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Year Member List

This is the complete list of members for Year, including all inherited members.
ToString() | Year | [inline]
Value | Year |
Year(IEnumerable< RecipeGroup > recipeGroups) | Year | [inline]
Generated on Sun Dec 1 2024 20:54:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemCollectionTransition Member List

This is the complete list of members for ItemCollectionTransition, including all inherited members.
abi_enter() | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
CheckThread() | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< ItemCollectionTransition > &&self) noexcept | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline, static]
Element() | ItemCollectionTransition | [inline]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
final_release(std::unique_ptr< ItemCollectionTransition > &&self) | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
GetInner() | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
HasStarted() | ItemCollectionTransition | [inline]
IsOnThread() | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
ItemCollectionTransition(winrt::ItemCollectionTransitionProvider const &owningProvider, winrt::UIElement const &element, winrt::ItemCollectionTransitionOperation const &operation, winrt::ItemCollectionTransitionTriggers const &triggers) | ItemCollectionTransition |
ItemCollectionTransition(winrt::ItemCollectionTransitionProvider const &owningProvider, winrt::UIElement const &element, winrt::ItemCollectionTransitionTriggers const &triggers, winrt::Rect const &oldBounds, winrt::Rect const &newBounds) | ItemCollectionTransition |
ItemCollectionTransition(winrt::ItemCollectionTransitionProvider const &owningProvider, winrt::UIElement const &element, winrt::ItemCollectionTransitionOperation const &operation, winrt::ItemCollectionTransitionTriggers const &triggers, winrt::Rect const &oldBounds, winrt::Rect const &newBounds) | ItemCollectionTransition | [private]
NewBounds() | ItemCollectionTransition | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
OldBounds() | ItemCollectionTransition | [inline]
Operation() | ItemCollectionTransition | [inline]
OwningProvider() | ItemCollectionTransition | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ItemCollectionTransition, winrt::implementation::ItemCollectionTransitionT, winrt::composing, winrt::composable > | [inline]
Start() | ItemCollectionTransition |
Triggers() | ItemCollectionTransition | [inline]
Generated on Sun Dec 1 2024 20:52:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/InteractionTests/ScrollPresenterTestsWithInputHelper.cs Source File

  • ScrollPresenter
  • InteractionTests

ScrollPresenterTestsWithInputHelper.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using System;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00008
00009 using WEX.TestExecution;
00010 using WEX.TestExecution.Markup;
00011 using WEX.Logging.Interop;
00012
00013 using Microsoft.Windows.Apps.Test.Automation;
00014 using Microsoft.Windows.Apps.Test.Foundation;
00015 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00016 using Point = System.Drawing.Point;
00017
00018 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00019 {
00020     [TestClass]
00021     public class ScrollPresenterTestsWithInputHelper : ScrollPresenterTestsBase
00022     {
00023         private enum ScrollSnapPointsAlignment
00024         {
00025             Near = 0,
00026             Center = 1,
00027             Far = 2
00028         }
00029
00030         // Mouse wheel delta amount required per initial velocity unit
00031         // 120 matches the built-in InteractionTracker zooming behavior introduced in RS5.
00032         const int mouseWheelDeltaForVelocityUnit = 120;
00033
00034         // The longest observed animated view change took 5.4 seconds, so 9 seconds is picked
00035         // as the default timeout so there is a reasonable margin for reliability.
00036         const double defaultAnimatedViewChangeTimeout = 9000;
00037
00038         [ClassInitialize]
00039         [TestProperty("RunAs", "User")]
00040         [TestProperty("Classification", "Integration")]
00041         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00042         public static void ClassInitialize(TestContext testContext)
00043         {
00044             TestEnvironment.Initialize(testContext);
00045         }
00046
00047         [TestCleanup]
00048         public void TestCleanup()
00049         {
00050             TestCleanupHelper.Cleanup();
00051         }
00052
00053         [TestMethod]
00054         [TestProperty("Description", "Pans a Rectangle in a ScrollPresenter, with railing.")]
00055         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00056         public void PanWithRailing()
00057         {
00058             const double minVerticalScrollPercent = 50.0;
00059
00060             Log.Comment("Selecting ScrollPresenter tests");
00061
00062             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00063             {
00064                 SetOutputDebugStringLevel("Verbose");
00065
00066                 GoToSimpleContentsPage();
00067
00068                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00069
00070                 Log.Comment("Retrieving cmbShowScrollPresenter");
00071                 ComboBox cmbShowScrollPresenter = new ComboBox(FindElement.ByName("cmbShowScrollPresenter"));
00072
00073                 Log.Comment("Changing ScrollPresenter selection to scrollPresenter11");
00074                 cmbShowScrollPresenter.SelectItemByName("scrollPresenter11");
00075                 Log.Comment("Selection is now {0}", cmbShowScrollPresenter.Selection[0].Name);
00076
00077                 Log.Comment("Retrieving ScrollPresenter");
00078                 UIObject scrollPresenter11UIObject = FindElement.ByName("ScrollPresenter11");
00079                 Verify.IsNotNull(scrollPresenter11UIObject, "Verifying that ScrollPresenter was found");
00080
00081                 WaitForScrollPresenterFinalSize(scrollPresenter11UIObject, expectedWidth: 300.0, expectedHeight: 400.0);
00082
00083                 // Tapping button before attempting pan operation to guarantee effective touch input
00084                 TapResetViewsButton();
00085                 Log.Comment("Panning ScrollPresenter almost vertically");
00086                 PrepareForScrollPresenterManipulationStart("scrollPresenter11");
00087
00088                 InputHelper.Pan(
00089                     scrollPresenter11UIObject,
00090                     new Point(scrollPresenter11UIObject.BoundingRectangle.Left + 100, scrollPresenter11UIObject.BoundingRectangle.Top + 150),
00091                     new Point(scrollPresenter11UIObject.BoundingRectangle.Left + 95, scrollPresenter11UIObject.BoundingRectangle.Top + 50));
00092
00093                 Log.Comment("Waiting for scrollPresenter11 pan completion");
00094                 bool success = WaitForManipulationEnd("scrollPresenter11", "txtScrollPresenterState", failOnError: true, logTraces: true);
00095
00096                 ScrollPresenter scrollPresenter11 = new ScrollPresenter(scrollPresenter11UIObject);
00097
00098                 Log.Comment("scrollPresenter11.HorizontalScrollPercent={0}", scrollPresenter11.HorizontalScrollPercent);
00099                 Log.Comment("scrollPresenter11.VerticalScrollPercent={0}", scrollPresenter11.VerticalScrollPercent);
00100
00101                 if (!success ||
00102                     scrollPresenter11.HorizontalScrollPercent != 0.0 ||
00103                     scrollPresenter11.VerticalScrollPercent <= minVerticalScrollPercent)
00104                 {
00105                     LogAndClearTraces(recordWarning: false);
00106                 }
00107
00108                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00109
00110                 Verify.AreEqual(scrollPresenter11.HorizontalScrollPercent, 0.0, "Verifying scrollPresenter11 HorizontalScrollPercent is 0%");
00111                 Verify.IsTrue(scrollPresenter11.VerticalScrollPercent > minVerticalScrollPercent, "Verifying scrollPresenter11 VerticalScrollPercent is greater than " + minVerticalScrollPercent + "%");
00112
00113                 // scrollPresenter11's Content height is 1000px.
00114                 double horizontalOffset;
00115                 double verticalOffset;
00116                 double minVerticalOffset = 1000.0 * (1.0 - scrollPresenter11.VerticalViewSize / 100.0) * minVerticalScrollPercent / 100.0;
00117                 float zoomFactor;
00118
00119                 GetScrollPresenterView(out horizontalOffset, out verticalOffset, out zoomFactor);
00120                 Log.Comment("horizontalOffset={0}", horizontalOffset);
00121                 Log.Comment("verticalOffset={0}", verticalOffset);
00122                 Log.Comment("zoomFactor={0}", zoomFactor);
00123
00124                 Verify.AreEqual(horizontalOffset, 0.0, "Verifying horizontalOffset is 0.0");
00125                 Verify.IsTrue(verticalOffset > minVerticalOffset, "Verifying verticalOffset is greater than " + minVerticalOffset);
00126                 Verify.AreEqual(zoomFactor, 1.0f, "Verifying zoomFactor is 1.0f");
00127
00128                 Log.Comment("Returning to the main ScrollPresenter test page");
00129                 TestSetupHelper.GoBack();
00130                 // Output-debug-string-level "None" is automatically restored when landing back on the ScrollPresenter test page.
00131             }
00132         }
00133
00134         [TestMethod]
00135         [TestProperty("Description", "Pans an Image in a ScrollPresenter, without railing.")]
00136         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00137         public void PanWithoutRailing()
00138         {
00139             const double minHorizontalScrollPercent = 35.0;
00140             const double minVerticalScrollPercent = 35.0;
00141
00142             Log.Comment("Selecting ScrollPresenter tests");
00143
00144             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00145             {
00146                 SetOutputDebugStringLevel("Verbose");
00147
00148                 GoToSimpleContentsPage();
00149
00150                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00151
00152                 Log.Comment("Retrieving cmbShowScrollPresenter");
00153                 ComboBox cmbShowScrollPresenter = new ComboBox(FindElement.ByName("cmbShowScrollPresenter"));
00154
00155                 Log.Comment("Changing ScrollPresenter selection to scrollPresenter51");
00156                 cmbShowScrollPresenter.SelectItemByName("scrollPresenter51");
00157                 Log.Comment("Selection is now {0}", cmbShowScrollPresenter.Selection[0].Name);
00158
00159                 Log.Comment("Retrieving ScrollPresenter");
00160                 UIObject scrollPresenter51UIObject = FindElement.ByName("ScrollPresenter51");
00161                 Verify.IsNotNull(scrollPresenter51UIObject, "Verifying that ScrollPresenter was found");
00162
00163                 WaitForScrollPresenterFinalSize(scrollPresenter51UIObject, expectedWidth: 300.0, expectedHeight: 400.0);
00164
00165                 // Tapping button before attempting pan operation to guarantee effective touch input
00166                 TapResetViewsButton();
00167
00168                 Log.Comment("Panning ScrollPresenter in diagonal");
00169                 PrepareForScrollPresenterManipulationStart("scrollPresenter51");
00170
00171                 InputHelper.Pan(
00172                     scrollPresenter51UIObject,
00173                     new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 25, scrollPresenter51UIObject.BoundingRectangle.Top + 25),
00174                     new Point(scrollPresenter51UIObject.BoundingRectangle.Left - 25, scrollPresenter51UIObject.BoundingRectangle.Top - 25));
00175
00176                 Log.Comment("Waiting for scrollPresenter51 pan completion");
00177                 bool success = WaitForManipulationEnd("scrollPresenter51", "txtScrollPresenterState", failOnError: true, logTraces: true);
00178
00179                 ScrollPresenter scrollPresenter51 = new ScrollPresenter(scrollPresenter51UIObject);
00180
00181                 Log.Comment("scrollPresenter51.HorizontalScrollPercent={0}", scrollPresenter51.HorizontalScrollPercent);
00182                 Log.Comment("scrollPresenter51.VerticalScrollPercent={0}", scrollPresenter51.VerticalScrollPercent);
00183
00184                 if (!success ||
00185                     scrollPresenter51.HorizontalScrollPercent <= minHorizontalScrollPercent ||
00186                     scrollPresenter51.VerticalScrollPercent <= minVerticalScrollPercent)
00187                 {
00188                     LogAndClearTraces(recordWarning: false);
00189                 }
00190
00191                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00192
00193                 Verify.IsTrue(scrollPresenter51.HorizontalScrollPercent > minHorizontalScrollPercent, "Verifying scrollPresenter51 HorizontalScrollPercent is greater than " + minHorizontalScrollPercent + "%");
00194                 Verify.IsTrue(scrollPresenter51.VerticalScrollPercent > minVerticalScrollPercent, "Verifying scrollPresenter51 VerticalScrollPercent is greater than " + minVerticalScrollPercent + "%");
00195
00196                 // scrollPresenter51's Content size is 800x800px.
00197                 double horizontalOffset;
00198                 double verticalOffset;
00199                 double minHorizontalOffset = 800.0 * (1.0 - scrollPresenter51.HorizontalViewSize / 100.0) * minHorizontalScrollPercent / 100.0;
00200                 double minVerticalOffset = 800.0 * (1.0 - scrollPresenter51.VerticalViewSize / 100.0) * minVerticalScrollPercent / 100.0;
00201                 float zoomFactor;
00202
00203                 GetScrollPresenterView(out horizontalOffset, out verticalOffset, out zoomFactor);
00204                 Log.Comment("horizontalOffset={0}", horizontalOffset);
00205                 Log.Comment("verticalOffset={0}", verticalOffset);
00206                 Log.Comment("zoomFactor={0}", zoomFactor);
00207
00208                 Verify.IsTrue(horizontalOffset > minHorizontalOffset, "Verifying horizontalOffset is greater than " + minHorizontalOffset);
00209                 Verify.IsTrue(verticalOffset > minVerticalOffset, "Verifying verticalOffset is greater than " + minVerticalOffset);
00210                 Verify.AreEqual(zoomFactor, 1.0f, "Verifying zoomFactor is 1.0f");
00211
00212                 Log.Comment("Returning to the main ScrollPresenter test page");
00213                 TestSetupHelper.GoBack();
00214                 // Output-debug-string-level "None" is automatically restored when landing back on the ScrollPresenter test page.
00215             }
00216         }
00217
00218         [TestMethod]
00219         [TestProperty("Description", "Scrolls a Rectangle in a ScrollPresenter, with the mouse wheel.")]
00220         public void ScrollWithMouseWheel()
00221         {
00222             double minVerticalScrollPercent = 5.0;
00223
00224             Log.Comment("Selecting ScrollPresenter tests");
00225
00226             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00227             {
00228                 SetOutputDebugStringLevel("Verbose");
00229
00230                 GoToSimpleContentsPage();
00231
00232                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00233
00234                 Log.Comment("Retrieving cmbShowScrollPresenter");
00235                 ComboBox cmbShowScrollPresenter = new ComboBox(FindElement.ByName("cmbShowScrollPresenter"));
00236
00237                 Log.Comment("Changing ScrollPresenter selection to scrollPresenter11");
00238                 cmbShowScrollPresenter.SelectItemByName("scrollPresenter11");
00239                 Log.Comment("Selection is now {0}", cmbShowScrollPresenter.Selection[0].Name);
00240
00241                 Log.Comment("Retrieving ScrollPresenter");
00242                 UIObject scrollPresenter11UIObject = FindElement.ByName("ScrollPresenter11");
00243                 Verify.IsNotNull(scrollPresenter11UIObject, "Verifying that ScrollPresenter was found");
00244
00245                 WaitForScrollPresenterFinalSize(scrollPresenter11UIObject, expectedWidth: 300.0, expectedHeight: 400.0);
00246
00247                 Log.Comment("Scrolling ScrollPresenter with mouse wheel");
00248                 PrepareForScrollPresenterManipulationStart("scrollPresenter11");
00249
00250                 InputHelper.RotateWheel(scrollPresenter11UIObject, -mouseWheelDeltaForVelocityUnit);
00251
00252                 Log.Comment("Waiting for scrollPresenter11 scroll completion");
00253                 WaitForScrollPresenterManipulationEnd("scrollPresenter11");
00254
00255                 ScrollPresenter scrollPresenter11 = new ScrollPresenter(scrollPresenter11UIObject);
00256
00257                 Log.Comment("scrollPresenter11.HorizontalScrollPercent={0}", scrollPresenter11.HorizontalScrollPercent);
00258                 Log.Comment("scrollPresenter11.VerticalScrollPercent={0}", scrollPresenter11.VerticalScrollPercent);
00259
00260                 if (scrollPresenter11.HorizontalScrollPercent != 0.0 || scrollPresenter11.VerticalScrollPercent <= minVerticalScrollPercent)
00261                 {
00262                     LogAndClearTraces();
00263                 }
00264
00265                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00266
00267                 Verify.AreEqual(scrollPresenter11.HorizontalScrollPercent, 0.0, "Verifying scrollPresenter11 HorizontalScrollPercent is 0%");
00268                 Verify.IsTrue(scrollPresenter11.VerticalScrollPercent > minVerticalScrollPercent, "Verifying scrollPresenter11 VerticalScrollPercent is greater than " + minVerticalScrollPercent + "%");
00269
00270                 // scrollPresenter11's Content height is 1000px.
00271                 double horizontalOffset;
00272                 double verticalOffset;
00273                 double minVerticalOffset = 1000.0 * (1.0 - scrollPresenter11.VerticalViewSize / 100.0) * minVerticalScrollPercent / 100.0;
00274                 float zoomFactor;
00275
00276                 GetScrollPresenterView(out horizontalOffset, out verticalOffset, out zoomFactor);
00277                 Log.Comment("horizontalOffset={0}", horizontalOffset);
00278                 Log.Comment("verticalOffset={0}", verticalOffset);
00279                 Log.Comment("zoomFactor={0}", zoomFactor);
00280                 Verify.AreEqual(horizontalOffset, 0.0, "Verifying horizontalOffset is 0.0");
00281                 Verify.IsTrue(verticalOffset > minVerticalOffset, "Verifying verticalOffset is greater than " + minVerticalOffset);
00282                 Verify.AreEqual(zoomFactor, 1.0f, "Verifying zoomFactor is 1.0f");
00283
00284                 Log.Comment("Returning to the main ScrollPresenter test page");
00285                 TestSetupHelper.GoBack();
00286                 // Output-debug-string-level "None" is automatically restored when landing back on the ScrollPresenter test page.
00287             }
00288         }
00289
00290         [TestMethod]
00291         [TestProperty("Description", "Pinch a Rectangle in a ScrollPresenter.")]
00292         [TestProperty("Ignore", "True")] // Disabled due to: ScrollPresenterTestsWithInputHelper Pinch/Stretch tests fail on RS5 in Helix #132
00293         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00294         public void PinchRectangle()
00295         {
00296             Log.Comment("Selecting ScrollPresenter tests");
00297
00298             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00299             {
00300                 SetOutputDebugStringLevel("Verbose");
00301
00302                 GoToSimpleContentsPage();
00303
00304                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00305
00306                 Log.Comment("Retrieving cmbShowScrollPresenter");
00307                 ComboBox cmbShowScrollPresenter = new ComboBox(FindElement.ByName("cmbShowScrollPresenter"));
00308
00309                 Log.Comment("Changing ScrollPresenter selection to scrollPresenter12");
00310                 cmbShowScrollPresenter.SelectItemByName("scrollPresenter12");
00311                 Log.Comment("Selection is now {0}", cmbShowScrollPresenter.Selection[0].Name);
00312
00313                 Log.Comment("Retrieving ScrollPresenter");
00314                 UIObject scrollPresenter12UIObject = FindElement.ByName("ScrollPresenter12");
00315                 Verify.IsNotNull(scrollPresenter12UIObject, "Verifying that ScrollPresenter was found");
00316
00317                 WaitForScrollPresenterFinalSize(scrollPresenter12UIObject, expectedWidth: 300.0, expectedHeight: 400.0);
00318
00319                 Log.Comment("Zooming out the ScrollPresenter");
00320                 PrepareForScrollPresenterManipulationStart("scrollPresenter12");
00321
00322                 InputHelper.Pinch(scrollPresenter12UIObject);
00323
00324                 Log.Comment("Waiting for scrollPresenter12 pinch completion");
00325                 bool success = WaitForManipulationEnd("scrollPresenter12", "txtScrollPresenterState", failOnError: true, logTraces: true);
00326
00327                 WaitForEditValue(editName: "txtScrollPresenterHorizontalOffset", editValue: "0");
00328                 WaitForEditValue(editName: "txtScrollPresenterVerticalOffset", editValue: "0");
00329
00330                 ScrollPresenter scrollPresenter12 = new ScrollPresenter(scrollPresenter12UIObject);
00331                 // scrollPresenter12's MinZoomFactor is 0.5.
00332                 double horizontalOffset;
00333                 double verticalOffset;
00334                 float zoomFactor;
00335
00336                 GetScrollPresenterView(out horizontalOffset, out verticalOffset, out zoomFactor);
00337
00338                 Log.Comment("horizontalOffset={0}", horizontalOffset);
00339                 Log.Comment("verticalOffset={0}", verticalOffset);
00340                 Log.Comment("zoomFactor={0}", zoomFactor);
00341
00342                 // New automation offsets are expected to be -1 because the content is now smaller than the viewport.
00343                 Log.Comment("scrollPresenter12.HorizontalScrollPercent={0}", scrollPresenter12.HorizontalScrollPercent);
00344                 Log.Comment("scrollPresenter12.VerticalScrollPercent={0}", scrollPresenter12.VerticalScrollPercent);
00345
00346                 if (!success ||
00347                     scrollPresenter12.HorizontalScrollPercent != -1 ||
00348                     scrollPresenter12.VerticalScrollPercent != -1 ||
00349                     zoomFactor == 1.0f)
00350                 {
00351                     LogAndClearTraces(recordWarning: false);
00352                 }
00353
00354                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00355
00356                 Verify.AreEqual(scrollPresenter12.HorizontalScrollPercent, -1, "Verifying scrollPresenter12 HorizontalScrollPercent is -1");
00357                 Verify.AreEqual(scrollPresenter12.VerticalScrollPercent, -1, "Verifying scrollPresenter12 VerticalScrollPercent is -1");
00358                 Verify.AreEqual(horizontalOffset, 0.0, "Verifying horizontalOffset is 0.0");
00359                 Verify.AreEqual(verticalOffset, 0.0, "Verifying verticalOffset is 0.0");
00360                 Verify.AreEqual(zoomFactor, 0.5f, "Verifying zoomFactor is 0.5f");
00361
00362                 Log.Comment("Returning to the main ScrollPresenter test page");
00363                 TestSetupHelper.GoBack();
00364                 // Output-debug-string-level "None" is automatically restored when landing back on the ScrollPresenter test page.
00365             }
00366         }
00367
00368         [TestMethod]
00369         [TestProperty("Description", "Stretch an Image in a ScrollPresenter.")]
00370         [TestProperty("Ignore", "True")] // Disabled due to: ScrollPresenterTestsWithInputHelper Pinch/Stretch tests fail on RS5 in Helix #132
00371         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00372         public void StretchImage()
00373         {
00374             Log.Comment("Selecting ScrollPresenter tests");
00375
00376             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00377             {
00378                 SetOutputDebugStringLevel("Verbose");
00379
00380                 GoToSimpleContentsPage();
00381
00382                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00383
00384                 Log.Comment("Retrieving cmbShowScrollPresenter");
00385                 ComboBox cmbShowScrollPresenter = new ComboBox(FindElement.ByName("cmbShowScrollPresenter"));
00386
00387                 Log.Comment("Changing ScrollPresenter selection to scrollPresenter52");
00388                 cmbShowScrollPresenter.SelectItemByName("scrollPresenter52");
00389                 Log.Comment("Selection is now {0}", cmbShowScrollPresenter.Selection[0].Name);
00390
00391                 Log.Comment("Retrieving ScrollPresenter");
00392                 UIObject scrollPresenter52UIObject = FindElement.ByName("ScrollPresenter52");
00393                 Verify.IsNotNull(scrollPresenter52UIObject, "Verifying that ScrollPresenter was found");
00394
00395                 WaitForScrollPresenterFinalSize(scrollPresenter52UIObject, expectedWidth: 300.0, expectedHeight: 400.0);
00396
00397                 Log.Comment("Zooming in the ScrollPresenter");
00398                 PrepareForScrollPresenterManipulationStart("scrollPresenter52");
00399
00400                 InputHelper.Stretch(scrollPresenter52UIObject);
00401
00402                 Log.Comment("Waiting for scrollPresenter52 stretch completion");
00403                 bool success = WaitForManipulationEnd("scrollPresenter52", "txtScrollPresenterState", failOnError: true, logTraces: true);
00404
00405                 ScrollPresenter scrollPresenter52 = new ScrollPresenter(scrollPresenter52UIObject);
00406                 double horizontalOffset;
00407                 double verticalOffset;
00408                 float zoomFactor;
00409
00410                 GetScrollPresenterView(out horizontalOffset, out verticalOffset, out zoomFactor);
00411
00412                 Log.Comment("scrollPresenter52.HorizontalScrollPercent={0}", scrollPresenter52.HorizontalScrollPercent);
00413                 Log.Comment("scrollPresenter52.VerticalScrollPercent={0}", scrollPresenter52.VerticalScrollPercent);
00414                 Log.Comment("horizontalOffset={0}", horizontalOffset);
00415                 Log.Comment("verticalOffset={0}", verticalOffset);
00416                 Log.Comment("zoomFactor={0}", zoomFactor);
00417
00418                 if (!success ||
00419                     scrollPresenter52.HorizontalScrollPercent <= 0.0 ||
00420                     scrollPresenter52.VerticalScrollPercent <= 0.0 ||
00421                     zoomFactor <= 1.0f)
00422                 {
00423                     LogAndClearTraces(recordWarning: false);
00424                 }
00425
00426                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00427
00428                 Verify.IsTrue(scrollPresenter52.HorizontalScrollPercent > 0.0, "Verifying scrollPresenter52 HorizontalScrollPercent is greater than 0%");
00429                 Verify.IsTrue(scrollPresenter52.VerticalScrollPercent > 0.0, "Verifying scrollPresenter52 VerticalScrollPercent is greater than 0%");
00430                 Verify.IsTrue(horizontalOffset > 0.0, "Verifying horizontalOffset is greater than 0.0");
00431                 Verify.IsTrue(verticalOffset > 0.0, "Verifying verticalOffset is greater than 0.0");
00432                 Verify.IsTrue(zoomFactor > 1.0f, "Verifying zoomFactor is greater than 1.0f");
00433
00434                 Log.Comment("Returning to the main ScrollPresenter test page");
00435                 TestSetupHelper.GoBack();
00436             }
00437         }
00438
00439         //[TestMethod]
00440         //[TestProperty("Description", "Pinch a Rectangle in a ScrollPresenter with the mouse wheel.")]
00441         // Disabled due to: ScrollPresenterTestsWithInputHelper Pinch/Stretch tests fail on RS5 in Helix #132
00442         public void PinchRectangleWithMouseWheel()
00443         {
00444             Log.Comment("Selecting ScrollPresenter tests");
00445
00446             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00447             {
00448                 SetOutputDebugStringLevel("Verbose");
00449
00450                 GoToSimpleContentsPage();
00451
00452                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00453
00454                 Log.Comment("Retrieving cmbShowScrollPresenter");
00455                 ComboBox cmbShowScrollPresenter = new ComboBox(FindElement.ByName("cmbShowScrollPresenter"));
00456
00457                 Log.Comment("Changing ScrollPresenter selection to scrollPresenter12");
00458                 cmbShowScrollPresenter.SelectItemByName("scrollPresenter12");
00459                 Log.Comment("Selection is now {0}", cmbShowScrollPresenter.Selection[0].Name);
00460
00461                 Log.Comment("Retrieving ScrollPresenter");
00462                 UIObject scrollPresenter12UIObject = FindElement.ByName("ScrollPresenter12");
00463                 Verify.IsNotNull(scrollPresenter12UIObject, "Verifying that ScrollPresenter was found");
00464
00465                 WaitForScrollPresenterFinalSize(scrollPresenter12UIObject, expectedWidth: 300.0, expectedHeight: 400.0);
00466
00467                 Log.Comment("Zooming out the ScrollPresenter");
00468                 PrepareForScrollPresenterManipulationStart("scrollPresenter12");
00469
00470                 KeyboardHelper.PressDownModifierKey(ModifierKey.Control);
00471                 // The InteractionTracker changes the scale by a factor of 1.1 for each 60 mouse wheel delta.
00472                 InputHelper.RotateWheel(scrollPresenter12UIObject, (int) (-mouseWheelDeltaForVelocityUnit / 2));
00473                 KeyboardHelper.ReleaseModifierKey(ModifierKey.Control);
00474
00475                 Log.Comment("Waiting for scrollPresenter12 pinch completion");
00476                 WaitForScrollPresenterManipulationEnd("scrollPresenter12");
00477
00478                 WaitForEditValue(editName: "txtScrollPresenterHorizontalOffset", editValue: "0");
00479                 WaitForEditValue(editName: "txtScrollPresenterVerticalOffset", editValue: "0");
00480
00481                 ScrollPresenter scrollPresenter12 = new ScrollPresenter(scrollPresenter12UIObject);
00482                 // scrollPresenter12's MinZoomFactor is 0.5.
00483                 double horizontalOffset;
00484                 double verticalOffset;
00485                 float zoomFactor;
00486
00487                 GetScrollPresenterView(out horizontalOffset, out verticalOffset, out zoomFactor);
00488
00489                 Log.Comment("horizontalOffset={0}", horizontalOffset);
00490                 Log.Comment("verticalOffset={0}", verticalOffset);
00491                 Log.Comment("zoomFactor={0}", zoomFactor);
00492
00493                 Log.Comment("scrollPresenter12.HorizontalScrollPercent={0}", scrollPresenter12.HorizontalScrollPercent);
00494                 Log.Comment("scrollPresenter12.VerticalScrollPercent={0}", scrollPresenter12.VerticalScrollPercent);
00495
00496                 if (scrollPresenter12.HorizontalScrollPercent != 0.0 || scrollPresenter12.VerticalScrollPercent != 0.0 || zoomFactor == 1.0f)
00497                 {
00498                     LogAndClearTraces();
00499                 }
00500
00501                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00502
00503                 Verify.AreEqual(scrollPresenter12.HorizontalScrollPercent, 0.0, "Verifying scrollPresenter12 HorizontalScrollPercent is 0");
00504                 Verify.AreEqual(scrollPresenter12.VerticalScrollPercent, 0.0, "Verifying scrollPresenter12 VerticalScrollPercent is 0");
00505                 Verify.AreEqual(horizontalOffset, 0.0, "Verifying horizontalOffset is 0.0");
00506                 Verify.AreEqual(verticalOffset, 0.0, "Verifying verticalOffset is 0.0");
00507                 Verify.IsGreaterThan(zoomFactor, 0.89f, "Verifying zoomFactor is about 0.1 smaller than the original 1.0");
00508                 Verify.IsLessThan(zoomFactor, 0.91f, "Verifying zoomFactor is about 0.1 smaller than the original 1.0");
00509
00510                 Log.Comment("Returning to the main ScrollPresenter test page");
00511                 TestSetupHelper.GoBack();
00512             }
00513         }
00514
00515         //Test failures with keyboard/gamepad/mousewheel input #269
00516         //[TestMethod]
00517         //[TestProperty("Description", "Stretch an Image in a ScrollPresenter with the mouse wheel.")]
00518         public void StretchImageWithMouseWheel()
00519         {
00520             Log.Comment("Selecting ScrollPresenter tests");
00521
00522             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00523             {
00524                 SetOutputDebugStringLevel("Verbose");
00525
00526                 GoToSimpleContentsPage();
00527
00528                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00529
00530                 Log.Comment("Retrieving cmbShowScrollPresenter");
00531                 ComboBox cmbShowScrollPresenter = new ComboBox(FindElement.ByName("cmbShowScrollPresenter"));
00532
00533                 Log.Comment("Changing ScrollPresenter selection to scrollPresenter52");
00534                 cmbShowScrollPresenter.SelectItemByName("scrollPresenter52");
00535                 Log.Comment("Selection is now {0}", cmbShowScrollPresenter.Selection[0].Name);
00536
00537                 Log.Comment("Retrieving ScrollPresenter");
00538                 UIObject scrollPresenter52UIObject = FindElement.ByName("ScrollPresenter52");
00539                 Verify.IsNotNull(scrollPresenter52UIObject, "Verifying that ScrollPresenter was found");
00540
00541                 WaitForScrollPresenterFinalSize(scrollPresenter52UIObject, expectedWidth: 300.0, expectedHeight: 400.0);
00542
00543                 Log.Comment("Zooming in the ScrollPresenter");
00544                 PrepareForScrollPresenterManipulationStart("scrollPresenter52");
00545
00546                 KeyboardHelper.PressDownModifierKey(ModifierKey.Control);
00547                 // The InteractionTracker changes the scale by a factor of 1.1 for each 60 mouse wheel delta.
00548                 InputHelper.RotateWheel(scrollPresenter52UIObject, mouseWheelDeltaForVelocityUnit / 2);
00549                 KeyboardHelper.ReleaseModifierKey(ModifierKey.Control);
00550
00551                 Log.Comment("Waiting for scrollPresenter52 stretch completion");
00552                 WaitForScrollPresenterManipulationEnd("scrollPresenter52");
00553
00554                 ScrollPresenter scrollPresenter52 = new ScrollPresenter(scrollPresenter52UIObject);
00555                 double horizontalOffset;
00556                 double verticalOffset;
00557                 float zoomFactor;
00558
00559                 GetScrollPresenterView(out horizontalOffset, out verticalOffset, out zoomFactor);
00560
00561                 Log.Comment("scrollPresenter52.HorizontalScrollPercent={0}", scrollPresenter52.HorizontalScrollPercent);
00562                 Log.Comment("scrollPresenter52.VerticalScrollPercent={0}", scrollPresenter52.VerticalScrollPercent);
00563                 Log.Comment("horizontalOffset={0}", horizontalOffset);
00564                 Log.Comment("verticalOffset={0}", verticalOffset);
00565                 Log.Comment("zoomFactor={0}", zoomFactor);
00566
00567                 if (scrollPresenter52.HorizontalScrollPercent <= 0.0 || scrollPresenter52.VerticalScrollPercent <= 0.0 || zoomFactor <= 1.0f)
00568                 {
00569                     LogAndClearTraces();
00570                 }
00571
00572                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00573
00574                 Verify.IsTrue(scrollPresenter52.HorizontalScrollPercent > 0.0, "Verifying scrollPresenter52 HorizontalScrollPercent is greater than 0%");
00575                 Verify.IsTrue(scrollPresenter52.VerticalScrollPercent > 0.0, "Verifying scrollPresenter52 VerticalScrollPercent is greater than 0%");
00576                 Verify.IsTrue(horizontalOffset > 0.0, "Verifying horizontalOffset is greater than 0.0");
00577                 Verify.IsTrue(verticalOffset > 0.0, "Verifying verticalOffset is greater than 0.0");
00578                 Verify.IsGreaterThan(zoomFactor, 1.09f, "Verifying zoomFactor is about 0.1 greater than the original 1.0");
00579                 Verify.IsLessThan(zoomFactor, 1.11f, "Verifying zoomFactor is about 0.1 greater than the original 1.0");
00580
00581                 Log.Comment("Returning to the main ScrollPresenter test page");
00582                 TestSetupHelper.GoBack();
00583             }
00584         }
00585
00586         [TestMethod]
00587         [TestProperty("Description", "Reduce the Content size while it is far-anchored and overpanned.")]
00588         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00589         public void OverpanWithAnchoredSkrinkingContent()
00590         {
00591             OverpanWithAnchoredSkrinkingContent(isForHorizontalDirection: true);
00592         }
00593
00594         [TestMethod]
00595         [TestProperty("Description", "Reduce the Content size while it is far-anchored and overpanned.")]
00596         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00597         public void OverpanWithAnchoredSkrinkingContentVert()
00598         {
00599             OverpanWithAnchoredSkrinkingContent(isForHorizontalDirection: false);
00600         }
00601
00602         private void OverpanWithAnchoredSkrinkingContent(bool isForHorizontalDirection)
00603         {
00604             Log.Comment("Selecting ScrollPresenter tests");
00605
00606             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00607             {
00608                 SetOutputDebugStringLevel("Verbose");
00609
00610                 GoToSimpleContentsPage();
00611
00612                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00613
00614                 Log.Comment("Retrieving cmbShowScrollPresenter");
00615                 ComboBox cmbShowScrollPresenter = new ComboBox(FindElement.ByName("cmbShowScrollPresenter"));
00616
00617                 Log.Comment("Changing ScrollPresenter selection to scrollPresenter51");
00618                 cmbShowScrollPresenter.SelectItemByName("scrollPresenter51");
00619                 Log.Comment("Selection is now {0}", cmbShowScrollPresenter.Selection[0].Name);
00620
00621                 Log.Comment("Retrieving ScrollPresenter");
00622                 UIObject scrollPresenter51UIObject = FindElement.ByName("ScrollPresenter51");
00623                 Verify.IsNotNull(scrollPresenter51UIObject, "Verifying that ScrollPresenter was found");
00624
00625                 WaitForScrollPresenterFinalSize(scrollPresenter51UIObject, expectedWidth: 300.0, expectedHeight: 400.0);
00626
00627                 // Tapping button before attempting pan operation to guarantee effective touch input
00628                 TapResetViewsButton();
00629
00630                 Log.Comment("Panning ScrollPresenter close to the Content's end");
00631                 PrepareForScrollPresenterManipulationStart("scrollPresenter51");
00632
00633                 Point startPoint = isForHorizontalDirection ?
00634                         new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 105, scrollPresenter51UIObject.BoundingRectangle.Top + 100) :
00635                         new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 100, scrollPresenter51UIObject.BoundingRectangle.Top + 100);
00636                 Point endPoint = isForHorizontalDirection ?
00637                         new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 50, scrollPresenter51UIObject.BoundingRectangle.Top + 100) :
00638                         new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 100, scrollPresenter51UIObject.BoundingRectangle.Top + 50);
00639
00640                 InputHelper.Pan(obj: scrollPresenter51UIObject, start: startPoint, end: endPoint);
00641
00642                 Log.Comment("Waiting for scrollPresenter51 pan completion");
00643                 bool success = WaitForManipulationEnd("scrollPresenter51", "txtScrollPresenterState");
00644
00645                 ScrollPresenter scrollPresenter51 = new ScrollPresenter(scrollPresenter51UIObject);
00646
00647                 Log.Comment("scrollPresenter51.HorizontalScrollPercent={0}", scrollPresenter51.HorizontalScrollPercent);
00648                 Log.Comment("scrollPresenter51.VerticalScrollPercent={0}", scrollPresenter51.VerticalScrollPercent);
00649
00650                 // No layout offset is expected
00651                 double contentLayoutOffsetX = 0.0;
00652                 double contentLayoutOffsetY = 0.0;
00653
00654                 GetScrollPresenterContentLayoutOffset(out contentLayoutOffsetX, out contentLayoutOffsetY);
00655
00656                 if (!success ||
00657                     (isForHorizontalDirection && (scrollPresenter51.HorizontalScrollPercent == 0.0 || scrollPresenter51.HorizontalScrollPercent == 100.0)) ||
00658                     (isForHorizontalDirection && scrollPresenter51.VerticalScrollPercent != 0.0) ||
00659                     (!isForHorizontalDirection && scrollPresenter51.HorizontalScrollPercent != 0.0) ||
00660                     (!isForHorizontalDirection && (scrollPresenter51.VerticalScrollPercent == 0.0 || scrollPresenter51.VerticalScrollPercent == 100.0)) ||
00661                     contentLayoutOffsetX != 0.0 ||
00662                     contentLayoutOffsetY != 0.0)
00663                 {
00664                     LogAndClearTraces(recordWarning: false);
00665                 }
00666
00667                 Log.Comment("Overpan ScrollPresenter to trigger content shrinkage");
00668                 PrepareForScrollPresenterManipulationStart("scrollPresenter51");
00669
00670                 startPoint = isForHorizontalDirection ?
00671                         new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 240, scrollPresenter51UIObject.BoundingRectangle.Top + 100) :
00672                         new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 100, scrollPresenter51UIObject.BoundingRectangle.Top + 240);
00673                 endPoint = isForHorizontalDirection ?
00674                         new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 10, scrollPresenter51UIObject.BoundingRectangle.Top + 100) :
00675                         new Point(scrollPresenter51UIObject.BoundingRectangle.Left + 100, scrollPresenter51UIObject.BoundingRectangle.Top + 10);
00676
00677                 InputHelper.Pan(obj: scrollPresenter51UIObject, start: startPoint, end: endPoint);
00678
00679                 Log.Comment("Waiting for scrollPresenter51 pan completion");
00680                 success = WaitForManipulationEnd("scrollPresenter51", "txtScrollPresenterState");
00681
00682                 Log.Comment("scrollPresenter51.HorizontalScrollPercent={0}", scrollPresenter51.HorizontalScrollPercent);
00683                 Log.Comment("scrollPresenter51.VerticalScrollPercent={0}", scrollPresenter51.VerticalScrollPercent);
00684
00685                 // Layout offset is expected
00686                 GetScrollPresenterContentLayoutOffset(out contentLayoutOffsetX, out contentLayoutOffsetY);
00687
00688                 if (!success ||
00689                     (isForHorizontalDirection && scrollPresenter51.HorizontalScrollPercent != 100.0) ||
00690                     (isForHorizontalDirection && scrollPresenter51.VerticalScrollPercent != 0.0) ||
00691                     (!isForHorizontalDirection && scrollPresenter51.HorizontalScrollPercent != 0.0) ||
00692                     (!isForHorizontalDirection && scrollPresenter51.VerticalScrollPercent != 100.0) ||
00693                     (isForHorizontalDirection && contentLayoutOffsetX != 30.0) ||
00694                     (isForHorizontalDirection && contentLayoutOffsetY != 0.0) ||
00695                     (!isForHorizontalDirection && contentLayoutOffsetX != 0.0) ||
00696                     (!isForHorizontalDirection && contentLayoutOffsetY != 40.0))
00697                 {
00698                     LogAndClearTraces(recordWarning: false);
00699                 }
00700
00701                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00702
00703                 Verify.AreEqual(scrollPresenter51.HorizontalScrollPercent, isForHorizontalDirection ? 100.0 : 0.0, "Verifying scrollPresenter51 HorizontalScrollPercent");
00704                 Verify.AreEqual(scrollPresenter51.VerticalScrollPercent, isForHorizontalDirection ? 0.0 : 100.0, "Verifying scrollPresenter51 VerticalScrollPercent");
00705
00706                 double horizontalOffset;
00707                 double verticalOffset;
00708                 float zoomFactor;
00709
00710                 GetScrollPresenterView(out horizontalOffset, out verticalOffset, out zoomFactor);
00711                 Log.Comment("horizontalOffset={0}", horizontalOffset);
00712                 Log.Comment("verticalOffset={0}", verticalOffset);
00713                 Log.Comment("zoomFactor={0}", zoomFactor);
00714
00715                 if (isForHorizontalDirection)
00716                 {
00717                     Verify.AreEqual(contentLayoutOffsetX, 30.0, "Verifying contentLayoutOffsetX is 30.0");
00718                     Verify.AreEqual(contentLayoutOffsetY, 0.0, "Verifying contentLayoutOffsetY is 0.0");
00719                     Verify.AreEqual(horizontalOffset, 470.0, "Verifying horizontalOffset is 470.0");
00720                     Verify.AreEqual(verticalOffset, 0.0, "Verifying verticalOffset is 0.0");
00721                 }
00722                 else
00723                 {
00724                     Verify.AreEqual(contentLayoutOffsetX, 0.0, "Verifying contentLayoutOffsetX is 0.0");
00725                     Verify.AreEqual(contentLayoutOffsetY, 40.0, "Verifying contentLayoutOffsetY is 40.0");
00726                     Verify.AreEqual(horizontalOffset, 0.0, "Verifying horizontalOffset is 0.0");
00727                     Verify.AreEqual(verticalOffset, 360.0, "Verifying verticalOffset is 360.0");
00728                 }
00729
00730                 Verify.AreEqual(zoomFactor, 1.0f, "Verifying zoomFactor is 1.0f");
00731
00732                 Log.Comment("Returning to the main ScrollPresenter test page");
00733                 TestSetupHelper.GoBack();
00734                 // Output-debug-string-level "None" is automatically restored when landing back on the ScrollPresenter test page.
00735             }
00736         }
00737
00738         //[TestMethod]
00739         //[TestProperty("Description", "Pans an inner ScrollViewer and chains to an outer ScrollPresenter.")]
00740         //[TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00741         // Bug 51897603: ScrollPresenter: Fix and re-enable interaction tests
00742         public void PanWithChainingFromScrollViewerToScrollPresenter()
00743         {
00744             Log.Comment("Selecting ScrollPresenter tests");
00745
00746             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00747             {
00748                 SetOutputDebugStringLevel("Verbose");
00749
00750                 GoToChainingAndRailingPage();
00751
00752                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00753
00754                 Log.Comment("Retrieving scrollPresenter3");
00755                 ScrollPresenter scrollPresenter3UIObject = new ScrollPresenter(FindElement.ByName("scrollPresenter3"));
00756
00757                 Log.Comment("Retrieving scrollViewer2");
00758                 ScrollPresenter scrollViewer2UIObject = new ScrollPresenter(FindElement.ByName("scrollViewer2"));
00759
00760                 // Tapping button before attempting pan operation to guarantee effective touch input
00761                 TapResetViewsButton();
00762
00763                 Log.Comment("Scrolling scrollPresenter3 horizontally");
00764                 ScrollHelper.SetHorizontalScrollPercent(scrollPresenter3UIObject, 50.0);
00765                 Log.Comment("Final scrollPresenter3 HorizontalScrollPercent={0}", scrollPresenter3UIObject.HorizontalScrollPercent);
00766
00767                 Log.Comment("Scrolling scrollPresenter3 vertically");
00768                 ScrollHelper.ScrollVertically(scrollPresenter3UIObject, ScrollAmount.SmallIncrement);
00769                 ScrollHelper.ScrollVertically(scrollPresenter3UIObject, ScrollAmount.SmallIncrement);
00770                 Log.Comment("Final scrollPresenter3 VerticalScrollPercent={0}", scrollPresenter3UIObject.VerticalScrollPercent);
00771
00772                 Log.Comment("Scrolling scrollViewer2 vertically");
00773                 ScrollHelper.ScrollVertically(scrollViewer2UIObject, ScrollAmount.SmallIncrement);
00774                 ScrollHelper.ScrollVertically(scrollViewer2UIObject, ScrollAmount.SmallIncrement);
00775                 Log.Comment("Final scrollViewer2 VerticalScrollPercent={0}", scrollViewer2UIObject.VerticalScrollPercent);
00776
00777                 Log.Comment("Panning scrollViewer2 vertically");
00778                 PrepareForScrollViewerManipulationStart("txtScrollViewer2State");
00779
00780                 InputHelper.Pan(
00781                     scrollViewer2UIObject,
00782                     new Point(scrollViewer2UIObject.BoundingRectangle.Left + 10, scrollViewer2UIObject.BoundingRectangle.Top + 10),
00783                     new Point(scrollViewer2UIObject.BoundingRectangle.Left + 10, scrollViewer2UIObject.BoundingRectangle.Top + 150),
00784                     InputHelper.DefaultPanHoldDuration,
00785                     0.0025f);
00786
00787                 Log.Comment("Waiting for scrollViewer2 pan completion");
00788                 bool success = WaitForManipulationEnd("scrollViewer2", "txtScrollViewer2State", failOnError: true, logTraces: true);
00789
00790                 Log.Comment("Final scrollViewer2 VerticalScrollPercent={0}", scrollViewer2UIObject.VerticalScrollPercent);
00791                 Log.Comment("Final scrollPresenter3 VerticalScrollPercent={0}", scrollPresenter3UIObject.VerticalScrollPercent);
00792
00793                 if (!success ||
00794                     scrollViewer2UIObject.VerticalScrollPercent >= 2.0 ||
00795                     scrollPresenter3UIObject.VerticalScrollPercent >= 2.0)
00796                 {
00797                     LogAndClearTraces(recordWarning: false);
00798                 }
00799
00800                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00801
00802                 Verify.IsLessThan(scrollViewer2UIObject.VerticalScrollPercent, 2.0, "Verifying scrollViewer2 VerticalScrollPercent is less than 2.0%");
00803                 Verify.IsLessThan(scrollPresenter3UIObject.VerticalScrollPercent, 2.0, "Verifying scrollPresenter3 VerticalScrollPercent is less than 2.0%");
00804
00805                 Log.Comment("Returning to the main ScrollPresenter test page");
00806                 TestSetupHelper.GoBack();
00807             }
00808         }
00809
00810         //[TestMethod]
00811         //[TestProperty("Description", "Pans an inner ScrollPresenter and chains to an outer ScrollViewer.")]
00812         //[TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00813         // Bug 51897603: ScrollPresenter: Fix and re-enable interaction tests
00814         public void PanWithChainingFromScrollPresenterToScrollViewer()
00815         {
00816             // Inner ScrollPresenter uses ChainingMode.Always
00817             PanWithChainingFromScrollPresenterToScrollViewerWithChainingMode(useChainingModeAlways: true);
00818         }
00819
00820         //[TestMethod]
00821         //[TestProperty("Description", "Pans an inner ScrollPresenter and chains to an outer ScrollViewer.")]
00822         //[TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00823         // Bug 51897603: ScrollPresenter: Fix and re-enable interaction tests
00824         public void PanWithChainingFromScrollPresenterToScrollViewer_Auto()
00825         {
00826             // Inner ScrollPresenter uses ChainingMode.Auto
00827             PanWithChainingFromScrollPresenterToScrollViewerWithChainingMode(useChainingModeAlways: false);
00828         }
00829
00830         public void PanWithChainingFromScrollPresenterToScrollViewerWithChainingMode(bool useChainingModeAlways)
00831         {
00832             Log.Comment("Selecting ScrollPresenter tests");
00833
00834             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00835             {
00836                 SetOutputDebugStringLevel("Verbose");
00837
00838                 GoToChainingAndRailingPage();
00839
00840                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00841
00842                 Log.Comment("Retrieving scrollPresenter3");
00843                 ScrollPresenter scrollPresenter3UIObject = new ScrollPresenter(FindElement.ByName("scrollPresenter3"));
00844
00845                 Log.Comment("Retrieving scrollViewer2");
00846                 ScrollPresenter scrollViewer2UIObject = new ScrollPresenter(FindElement.ByName("scrollViewer2"));
00847
00848                 Log.Comment("Retrieving scrollPresenter1");
00849                 ScrollPresenter scrollPresenter1UIObject = new ScrollPresenter(FindElement.ByName("scrollPresenter1"));
00850
00851                 Log.Comment("Retrieving cmbHorizontalScrollChainingMode1");
00852                 ComboBox cmbHorizontalScrollChainingMode1 = new ComboBox(FindElement.ByName("cmbHorizontalScrollChainingMode1"));
00853
00854                 Log.Comment("Retrieving cmbVerticalScrollChainingMode1");
00855                 ComboBox cmbVerticalScrollChainingMode1 = new ComboBox(FindElement.ByName("cmbVerticalScrollChainingMode1"));
00856
00857                 // Tapping button before attempting pan operation to guarantee effective touch input
00858                 TapResetViewsButton();
00859
00860                 Log.Comment("Scrolling scrollPresenter3 horizontally");
00861                 ScrollHelper.SetHorizontalScrollPercent(scrollPresenter3UIObject, 60.0);
00862                 Log.Comment("Final scrollPresenter3 HorizontalScrollPercent={0}", scrollPresenter3UIObject.HorizontalScrollPercent);
00863
00864                 Log.Comment("Scrolling scrollViewer2 horizontally");
00865                 ScrollHelper.SetHorizontalScrollPercent(scrollViewer2UIObject, 50.0);
00866                 Log.Comment("Final scrollViewer2 HorizontalScrollPercent={0}", scrollViewer2UIObject.HorizontalScrollPercent);
00867
00868                 Log.Comment("Scrolling scrollPresenter1 horizontally");
00869                 ScrollHelper.SetHorizontalScrollPercent(scrollPresenter1UIObject, 10.0);
00870                 Log.Comment("Final scrollPresenter1 HorizontalScrollPercent={0}", scrollPresenter1UIObject.HorizontalScrollPercent);
00871
00872                 Wait.ForIdle();
00873
00874                 if (useChainingModeAlways)
00875                 {
00876                     Log.Comment("Changing horizontal chaining to Always");
00877                     cmbHorizontalScrollChainingMode1.SelectItemByName("Always");
00878                     Log.Comment("Selection is now {0}", cmbHorizontalScrollChainingMode1.Selection[0].Name);
00879
00880                     Log.Comment("Changing vertical chaining to Always");
00881                     cmbVerticalScrollChainingMode1.SelectItemByName("Always");
00882                     Log.Comment("Selection is now {0}", cmbVerticalScrollChainingMode1.Selection[0].Name);
00883                 }
00884
00885                 Log.Comment("Panning scrollPresenter1 horizontally");
00886                 PrepareForScrollPresenterManipulationStart("scrollPresenter1", "txtScrollPresenter1State");
00887
00888                 InputHelper.Pan(
00889                     scrollPresenter1UIObject,
00890                     new Point(scrollPresenter1UIObject.BoundingRectangle.Left + 20, scrollPresenter1UIObject.BoundingRectangle.Top + 10),
00891                     new Point(scrollPresenter1UIObject.BoundingRectangle.Left + 300, scrollPresenter1UIObject.BoundingRectangle.Top + 10),
00892                     InputHelper.DefaultPanHoldDuration,
00893                     0.0025f);
00894
00895                 Log.Comment("Waiting for scrollPresenter1 pan completion");
00896                 bool success = WaitForManipulationEnd("scrollPresenter1", "txtScrollPresenter1State", failOnError: true, logTraces: true);
00897
00898                 Log.Comment("Final scrollPresenter1 HorizontalScrollPercent={0}", scrollPresenter1UIObject.HorizontalScrollPercent);
00899                 Log.Comment("Final scrollViewer2 HorizontalScrollPercent={0}", scrollViewer2UIObject.HorizontalScrollPercent);
00900
00901                 if (!success ||
00902                      scrollPresenter1UIObject.HorizontalScrollPercent >= 2.0 ||
00903                      scrollViewer2UIObject.HorizontalScrollPercent >= 2.0)
00904                 {
00905                     LogAndClearTraces(recordWarning: false);
00906                 }
00907
00908                 SetLoggingLevel(isPrivateLoggingEnabled: false);
00909
00910                 Verify.IsLessThan(scrollPresenter1UIObject.HorizontalScrollPercent, 2.0, "Verifying scrollPresenter1 HorizontalScrollPercent is less than 2.0%");
00911                 Verify.IsLessThan(scrollViewer2UIObject.HorizontalScrollPercent, 2.0, "Verifying scrollViewer2 HorizontalScrollPercent is less than 2.0%");
00912
00913                 Log.Comment("Returning to the main ScrollPresenter test page");
00914                 TestSetupHelper.GoBack();
00915             }
00916         }
00917
00918         //[TestMethod]
00919         //[TestProperty("Description", "Attempts to scroll when ManipulationMode is not System.")]
00920         //[TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00921         // Bug 51897603: ScrollPresenter: Fix and re-enable interaction tests
00922         public void ScrollWithNonSystemManipulationMode()
00923         {
00924             Log.Comment("Selecting ScrollPresenter tests");
00925
00926             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
00927             {
00928                 SetOutputDebugStringLevel("Verbose");
00929
00930                 GoToManipulationModePage();
00931
00932                 SetLoggingLevel(isPrivateLoggingEnabled: true);
00933
00934                 Log.Comment("Retrieving scrollPresenter0");
00935                 ScrollPresenter scrollPresenter0UIObject = new ScrollPresenter(FindElement.ByName("scrollPresenter0"));
00936
00937                 Log.Comment("Retrieving scrollPresenter1");
00938                 ScrollPresenter scrollPresenter1UIObject = new ScrollPresenter(FindElement.ByName("scrollPresenter1"));
00939
00940                 Log.Comment("Retrieving stackPanel0");
00941                 UIObject stackPanel0UIObject = FindElement.ByName("stackPanel0");
00942                 Verify.IsNotNull(stackPanel0UIObject, "Verifying that stackPanel0 StackPanel was found");
00943
00944                 Log.Comment("Retrieving cmbManipulationModeS0");
00945                 ComboBox cmbManipulationModeS0 = new ComboBox(FindElement.ByName("cmbManipulationModeS0"));
00946
00947                 Log.Comment("Retrieving cmbManipulationModeSP0");
00948                 ComboBox cmbManipulationModeSP0 = new ComboBox(FindElement.ByName("cmbManipulationModeSP0"));
00949
00950                 Log.Comment("Retrieving txtScrollPresenter0State");
00951                 Edit scrollPresenter0StateTextBox = new Edit(FindElement.ById("txtScrollPresenter0State"));
00952
00953                 Log.Comment("Retrieving txtScrollPresenter1State");
00954                 Edit scrollPresenter1StateTextBox = new Edit(FindElement.ById("txtScrollPresenter1State"));
00955
00956                 Wait.ForIdle();
00957
00958                 Log.Comment("Changing stackPanel0.ManipulationMode to None");
00959                 cmbManipulationModeSP0.SelectItemByName("None");
00960                 Log.Comment("Selection is now {0}", cmbManipulationModeSP0.Selection[0].Name);
00961
00962                 Log.Comment("Attempt to pan scrollPresenter0 vertically");
00963                 InputHelper.Pan(
00964                     stackPanel0UIObject,
00965                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 70),
00966                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 30));
00967
00968                 Wait.ForIdle();
00969
00970                 Log.Comment("Current scrollPresenter0.State: " + scrollPresenter0StateTextBox.Value);
00971                 Verify.AreEqual(scrollPresenter0StateTextBox.Value, string.Empty);
00972
00973                 Log.Comment("Current scrollPresenter1.State: " + scrollPresenter1StateTextBox.Value);
00974                 Verify.AreEqual(scrollPresenter1StateTextBox.Value, string.Empty);
00975
00976                 Log.Comment("Changing stackPanel0.ManipulationMode back to System");
00977                 cmbManipulationModeSP0.SelectItemByName("System");
00978                 Log.Comment("Selection is now {0}", cmbManipulationModeSP0.Selection[0].Name);
00979
00980                 Log.Comment("Pan scrollPresenter0 vertically");
00981                 PrepareForScrollPresenterManipulationStart("scrollPresenter0", "txtScrollPresenter0State");
00982
00983                 InputHelper.Pan(
00984                     stackPanel0UIObject,
00985                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 70),
00986                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 30));
00987
00988                 Log.Comment("Waiting for scrollPresenter0 pan completion");
00989                 bool success = WaitForManipulationEnd("scrollPresenter0", "txtScrollPresenter0State", failOnError: true, logTraces: true);
00990
00991                 Log.Comment("Pan scrollPresenter0 vertically to restore original offset");
00992                 PrepareForScrollPresenterManipulationStart("scrollPresenter0", "txtScrollPresenter0State");
00993
00994                 InputHelper.Pan(
00995                     stackPanel0UIObject,
00996                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 30),
00997                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 70));
00998
00999                 Log.Comment("Waiting for scrollPresenter0 pan completion");
01000                 success &= WaitForManipulationEnd("scrollPresenter0", "txtScrollPresenter0State", failOnError: true, logTraces: true);
01001
01002                 Log.Comment("Resetting scrollPresenter0StateTextBox/scrollPresenter1StateTextBox values");
01003                 scrollPresenter0StateTextBox.SetValueAndWait(string.Empty);
01004                 scrollPresenter1StateTextBox.SetValueAndWait(string.Empty);
01005
01006                 Log.Comment("Changing scrollPresenter0.ManipulationMode to None");
01007                 cmbManipulationModeS0.SelectItemByName("None");
01008                 Log.Comment("Selection is now {0}", cmbManipulationModeS0.Selection[0].Name);
01009
01010                 Log.Comment("Attempt to pan scrollPresenter0 vertically");
01011                 InputHelper.Pan(
01012                     stackPanel0UIObject,
01013                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 70),
01014                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 30));
01015
01016                 Wait.ForIdle();
01017
01018                 Log.Comment("Current scrollPresenter0.State: " + scrollPresenter0StateTextBox.Value);
01019                 if (success)
01020                 {
01021                     Verify.AreEqual(scrollPresenter0StateTextBox.Value, string.Empty);
01022                 }
01023
01024                 Log.Comment("Current scrollPresenter1.State: " + scrollPresenter1StateTextBox.Value);
01025                 if (success)
01026                 {
01027                     Verify.AreEqual(scrollPresenter1StateTextBox.Value, string.Empty);
01028                 }
01029
01030                 Log.Comment("Changing scrollPresenter0.ManipulationMode back to System");
01031                 cmbManipulationModeS0.SelectItemByName("System");
01032                 Log.Comment("Selection is now {0}", cmbManipulationModeS0.Selection[0].Name);
01033
01034                 Log.Comment("Pan scrollPresenter0 vertically");
01035                 PrepareForScrollPresenterManipulationStart("scrollPresenter0", "txtScrollPresenter0State");
01036
01037                 InputHelper.Pan(
01038                     stackPanel0UIObject,
01039                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 70),
01040                     new Point(stackPanel0UIObject.BoundingRectangle.Left + 30, stackPanel0UIObject.BoundingRectangle.Top + 30));
01041
01042                 Log.Comment("Waiting for scrollPresenter0 pan completion");
01043                 success &= WaitForManipulationEnd("scrollPresenter0", "txtScrollPresenter0State", failOnError: true, logTraces: true);
01044
01045                 if (!success)
01046                 {
01047                     LogAndClearTraces(recordWarning: false);
01048                 }
01049
01050                 SetLoggingLevel(isPrivateLoggingEnabled: false);
01051
01052                 Log.Comment("Returning to the main ScrollPresenter test page");
01053                 TestSetupHelper.GoBack();
01054             }
01055         }
01056
01057         [TestMethod]
01058         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01059         [TestProperty("Description", "Apply two mandatory irregular snap points to the scrollPresenter and pan to the 4 interesting zones around them.")]
01060         public void PanTowardsTwoManditoryIrregularSnapPoint_Near()
01061         {
01062             MoveTowardsTwoManditoryIrregularSnapPoint(alignment: ScrollSnapPointsAlignment.Near, withTouch: true);
01063         }
01064
01065         [TestMethod]
01066         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01067         public void PanTowardsTwoManditoryIrregularSnapPoint_Center()
01068         {
01069             MoveTowardsTwoManditoryIrregularSnapPoint(alignment: ScrollSnapPointsAlignment.Center, withTouch: true);
01070         }
01071
01072         [TestMethod]
01073         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01074         public void PanTowardsTwoManditoryIrregularSnapPoint_Far()
01075         {
01076             MoveTowardsTwoManditoryIrregularSnapPoint(alignment: ScrollSnapPointsAlignment.Far, withTouch: true);
01077         }
01078
01079         [TestMethod]
01080         [TestProperty("Description", "Apply two mandatory irregular snap points to the scrollPresenter and snap to them using mouse-wheel input.")]
01081         public void ScrollTowardsTwoManditoryIrregularSnapPoint_Near()
01082         {
01083             MoveTowardsTwoManditoryIrregularSnapPoint(alignment: ScrollSnapPointsAlignment.Near, withTouch: false);
01084         }
01085
01086         [TestMethod]
01087         public void ScrollTowardsTwoManditoryIrregularSnapPoint_Center()
01088         {
01089             MoveTowardsTwoManditoryIrregularSnapPoint(alignment: ScrollSnapPointsAlignment.Center, withTouch: false);
01090         }
01091
01092         [TestMethod]
01093         [TestProperty("Description", "Apply two mandatory irregular snap points to the scrollPresenter and snap to them using mouse-wheel input.")]
01094         public void ScrollTowardsTwoManditoryIrregularSnapPoint_Far()
01095         {
01096             MoveTowardsTwoManditoryIrregularSnapPoint(alignment: ScrollSnapPointsAlignment.Far, withTouch: false);
01097         }
01098
01099         // withTouch==True, InputHelper.Pan is used to simulate touch input.
01100         // withTouch==False, InputHelper.RotateWheel is used to simulate mouse-wheel input.
01101         private void MoveTowardsTwoManditoryIrregularSnapPoint(ScrollSnapPointsAlignment alignment, bool withTouch)
01102         {
01103             Log.Comment("Selecting ScrollPresenter tests");
01104
01105             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01106             {
01107                 SetOutputDebugStringLevel("Verbose");
01108
01109                 var elements = GoToScrollSnapPointsPage();
01110
01111                 int warningCount = 0;
01112                 const double viewportHeight = 500.0;
01113                 const double firstSnapPointOffset = 0.0;
01114                 double secondSnapPointOffset = withTouch ? 600.0 : 150.0;
01115                 double thirdSnapPointOffset = withTouch ? 1200.0 : 300.0;
01116                 double firstSnapPointValue = firstSnapPointOffset;
01117                 double secondSnapPointValue = secondSnapPointOffset;
01118                 double thirdSnapPointValue = thirdSnapPointOffset;
01119
01120                 if (withTouch)
01121                 {
01122                     Verify.IsTrue(PanUntilInputWorks(elements.scrollPresenterOffset, elements.scrollPresenterUIObject), "Pan inputs are moving the scrollPresenter!");
01123                 }
01124
01125                 if (alignment == ScrollSnapPointsAlignment.Center)
01126                 {
01127                     // Center alignment
01128                     firstSnapPointValue += viewportHeight / 2.0;
01129                     secondSnapPointValue += viewportHeight / 2.0;
01130                     thirdSnapPointValue += viewportHeight / 2.0;
01131
01132                     Log.Comment("Changing alignment to Center");
01133                     elements.cmbMISnapPointAlignment.SelectItemByName("Center");
01134                     Log.Comment("Selection is now {0}", elements.cmbMISnapPointAlignment.Selection[0].Name);
01135                 }
01136                 else if (alignment == ScrollSnapPointsAlignment.Far)
01137                 {
01138                     // Far alignment
01139                     firstSnapPointValue += viewportHeight;
01140                     secondSnapPointValue += viewportHeight;
01141                     thirdSnapPointValue += viewportHeight;
01142
01143                     Log.Comment("Changing alignment to Far");
01144                     elements.cmbMISnapPointAlignment.SelectItemByName("Far");
01145                     Log.Comment("Selection is now {0}", elements.cmbMISnapPointAlignment.Selection[0].Name);
01146                 }
01147
01148                 Log.Comment("Adding irregular snap point at value " + firstSnapPointValue.ToString());
01149                 elements.txtMISnapPointValueUIObject.SetValue(firstSnapPointValue.ToString());
01150                 elements.btnAddMISnapPointUIObject.Invoke();
01151
01152                 Log.Comment("Adding irregular snap point at value " + secondSnapPointValue.ToString());
01153                 elements.txtMISnapPointValueUIObject.SetValue(secondSnapPointValue.ToString());
01154                 elements.btnAddMISnapPointUIObject.Invoke();
01155
01156                 Log.Comment("Adding irregular snap point at value " + thirdSnapPointValue.ToString());
01157                 elements.txtMISnapPointValueUIObject.SetValue(thirdSnapPointValue.ToString());
01158                 elements.btnAddMISnapPointUIObject.Invoke();
01159
01160                 if (withTouch)
01161                 {
01162                     InputHelper.Tap(elements.scrollPresenterUIObject);
01163
01164                     InputHelper.Pan(elements.scrollPresenterUIObject, 75, Direction.North);
01165                     warningCount += WaitForOffsetUpdated(elements.scrollPresenterOffset, secondSnapPointOffset, double.PositiveInfinity, thirdSnapPointOffset, thirdSnapPointOffset);
01166                     PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
01167                     InputHelper.Pan(elements.scrollPresenterUIObject, 95, Direction.North);
01168                     warningCount += WaitForOffsetUpdated(elements.scrollPresenterOffset, secondSnapPointOffset, double.PositiveInfinity, thirdSnapPointOffset, thirdSnapPointOffset);
01169                     PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
01170
01171                     InputHelper.Pan(elements.scrollPresenterUIObject, 150, Direction.North);
01172                     warningCount += WaitForOffsetUpdated(elements.scrollPresenterOffset, thirdSnapPointOffset, double.PositiveInfinity, secondSnapPointOffset, secondSnapPointOffset);
01173                     PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
01174                     InputHelper.Pan(elements.scrollPresenterUIObject, 200, Direction.North);
01175                     warningCount += WaitForOffsetUpdated(elements.scrollPresenterOffset, thirdSnapPointOffset, double.PositiveInfinity, secondSnapPointOffset, secondSnapPointOffset);
01176                 }
01177                 else
01178                 {
01179                     InputHelper.RotateWheel(elements.scrollPresenterUIObject, -mouseWheelDeltaForVelocityUnit);
01180                     warningCount += WaitForOffsetUpdated(elements.scrollPresenterOffset, secondSnapPointOffset);
01181                     SnapPointsPageChangeOffset(elements, "-" + secondSnapPointOffset, 0);
01182
01183                     InputHelper.RotateWheel(elements.scrollPresenterUIObject, -15 * mouseWheelDeltaForVelocityUnit);
01184                     warningCount += WaitForOffsetUpdated(elements.scrollPresenterOffset, thirdSnapPointOffset);
01185                 }
01186
01187                 Verify.IsLessThan(warningCount, 4);
01188
01189                 Log.Comment("Returning to the main ScrollPresenter test page");
01190                 TestSetupHelper.GoBack();
01191             }
01192         }
01193
01194         [TestMethod]
01195         [TestProperty("Description", "Apply a single mandatory repeated snap point across the extent, with Offset equal to Start, and pan within it.")]
01196         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01197         public void PanWithinARepeatedMandatorySnapPoint_Near()
01198         {
01199             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: true, alignment: ScrollSnapPointsAlignment.Near, withTouch: true);
01200         }
01201
01202         [TestMethod]
01203         [TestProperty("Description", "Apply a single mandatory repeated snap point across the extent, with Offset equal to Start, and pan within it.")]
01204         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01205         public void PanWithinARepeatedMandatorySnapPoint_Center()
01206         {
01207             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: true, alignment: ScrollSnapPointsAlignment.Center, withTouch: true);
01208         }
01209
01210         [TestMethod]
01211         [TestProperty("Description", "Apply a single mandatory repeated snap point across the extent, with Offset equal to Start, and pan within it.")]
01212         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01213         public void PanWithinARepeatedMandatorySnapPoint_Far()
01214         {
01215             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: true, alignment: ScrollSnapPointsAlignment.Far, withTouch: true);
01216         }
01217
01218         [TestMethod]
01219         [TestProperty("Description", "Apply a single mandatory repeated snap point across the extent, with Offset different from Start, and pan within it.")]
01220         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01221         public void PanWithinARepeatedMandatorySnapPointWithDifferentOffset_Near()
01222         {
01223             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: false, alignment: ScrollSnapPointsAlignment.Near, withTouch: true);
01224         }
01225
01226         [TestMethod]
01227         [TestProperty("Description", "Apply a single mandatory repeated snap point across the extent, with Offset different from Start, and pan within it.")]
01228         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01229         public void PanWithinARepeatedMandatorySnapPointWithDifferentOffset_Center()
01230         {
01231             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: false, alignment: ScrollSnapPointsAlignment.Center, withTouch: true);
01232         }
01233
01234         [TestMethod]
01235         [TestProperty("Description", "Apply a single mandatory repeated snap point across the extent, with Offset different from Start, and pan within it.")]
01236         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01237         public void PanWithinARepeatedMandatorySnapPointWithDifferentOffset_Far()
01238         {
01239             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: false, alignment: ScrollSnapPointsAlignment.Far, withTouch: true);
01240         }
01241
01242         [TestMethod]
01243         [TestProperty("Description", "Apply a single mandatory repeated snap point across the scrollPresenter extent and snap to it using mouse-wheel input.")]
01244         public void ScrollWithinARepeatedMandatorySnapPoint_Near()
01245         {
01246             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: false, alignment: ScrollSnapPointsAlignment.Near, withTouch: false);
01247         }
01248
01249         [TestMethod]
01250         [TestProperty("Description", "Apply a single mandatory repeated snap point across the scrollPresenter extent and snap to it using mouse-wheel input.")]
01251         public void ScrollWithinARepeatedMandatorySnapPoint_Center()
01252         {
01253             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: false, alignment: ScrollSnapPointsAlignment.Center, withTouch: false);
01254         }
01255
01256         [TestMethod]
01257         [TestProperty("Description", "Apply a single mandatory repeated snap point across the scrollPresenter extent and snap to it using mouse-wheel input.")]
01258         public void ScrollWithinARepeatedMandatorySnapPoint_Far()
01259         {
01260             MoveWithinARepeatedMandatorySnapPoint(withOffsetEqualToStart: false, alignment: ScrollSnapPointsAlignment.Far, withTouch: false);
01261         }
01262
01263         // withTouch==True, InputHelper.Pan is used to simulate touch input.
01264         // withTouch==False, InputHelper.RotateWheel is used to simulate mouse-wheel input.
01265         private void MoveWithinARepeatedMandatorySnapPoint(bool withOffsetEqualToStart, ScrollSnapPointsAlignment alignment, bool withTouch)
01266         {
01267             Log.Comment("Selecting ScrollPresenter tests");
01268
01269             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01270             {
01271                 SetOutputDebugStringLevel("Verbose");
01272
01273                 var elements = GoToScrollSnapPointsPage();
01274
01275                 if (withTouch)
01276                 {
01277                     Verify.IsTrue(PanUntilInputWorks(elements.scrollPresenterOffset, elements.scrollPresenterUIObject), "Pan inputs aren't moving the scrollPresenter...");
01278                 }
01279
01280                 const double viewportHeight = 500.0;
01281                 const double start = 0.0;
01282                 const double end = 9000.0;
01283                 double interval = withTouch ? 50.0 : 400.0;
01284                 double offset = withOffsetEqualToStart ? 0.0 : (withTouch ? 25.0 : 100.0);
01285                 double adjustedStart = start;
01286                 double adjustedEnd = end;
01287                 double adjustedOffset = offset;
01288
01289                 if (alignment == ScrollSnapPointsAlignment.Center)
01290                 {
01291                     // Center alignment
01292                     adjustedStart += viewportHeight / 2.0;
01293                     adjustedEnd += viewportHeight / 2.0;
01294                     adjustedOffset += viewportHeight / 2.0;
01295
01296                     Log.Comment("Changing alignment to Center");
01297                     elements.cmbMRSnapPointAlignment.SelectItemByName("Center");
01298                     Log.Comment("Selection is now {0}", elements.cmbMRSnapPointAlignment.Selection[0].Name);
01299                 }
01300                 else if (alignment == ScrollSnapPointsAlignment.Far)
01301                 {
01302                     // Far alignment
01303                     adjustedStart += viewportHeight;
01304                     adjustedEnd += viewportHeight;
01305                     adjustedOffset += viewportHeight;
01306
01307                     Log.Comment("Changing alignment to Far");
01308                     elements.cmbMRSnapPointAlignment.SelectItemByName("Far");
01309                     Log.Comment("Selection is now {0}", elements.cmbMRSnapPointAlignment.Selection[0].Name);
01310                 }
01311
01312                 Log.Comment($"Adding repeated snap point with start={adjustedStart.ToString()}, end={adjustedEnd.ToString()}, offset={adjustedOffset.ToString()}, interval={interval.ToString()}.");
01313                 elements.txtMRSnapPointOffsetUIObject.SetValue(adjustedOffset.ToString());
01314                 elements.txtMRSnapPointIntervalUIObject.SetValue(interval.ToString());
01315                 elements.txtMRSnapPointStartUIObject.SetValue(adjustedStart.ToString());
01316                 elements.txtMRSnapPointEndUIObject.SetValue(adjustedEnd.ToString());
01317                 elements.btnAddMRSnapPointUIObject.Invoke();
01318
01319                 if (withTouch)
01320                 {
01321                     InputHelper.Tap(elements.scrollPresenterUIObject);
01322
01323                     InputHelper.Pan(elements.scrollPresenterUIObject, withOffsetEqualToStart ? 25 : 60, Direction.North);
01324                     WaitForOffsetUpdated(elements.scrollPresenterOffset, offset, 50.0);
01325                     PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
01326
01327                     InputHelper.Pan(elements.scrollPresenterUIObject, 50, Direction.North);
01328                     WaitForOffsetUpdated(elements.scrollPresenterOffset, offset, 50.0);
01329                     PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
01330
01331                     InputHelper.Pan(elements.scrollPresenterUIObject, 150, Direction.North);
01332                     WaitForOffsetUpdated(elements.scrollPresenterOffset, offset, 50.0);
01333                     PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
01334
01335                     InputHelper.Pan(elements.scrollPresenterUIObject, 200, Direction.North);
01336                     WaitForOffsetUpdated(elements.scrollPresenterOffset, offset, 50.0);
01337                 }
01338                 else
01339                 {
01340                     InputHelper.RotateWheel(elements.scrollPresenterUIObject, -mouseWheelDeltaForVelocityUnit);
01341                     WaitForOffsetUpdated(elements.scrollPresenterOffset, offset);
01342
01343                     InputHelper.RotateWheel(elements.scrollPresenterUIObject, -mouseWheelDeltaForVelocityUnit);
01344                     WaitForOffsetUpdated(elements.scrollPresenterOffset, offset + interval);
01345
01346                     InputHelper.RotateWheel(elements.scrollPresenterUIObject, mouseWheelDeltaForVelocityUnit);
01347                     WaitForOffsetUpdated(elements.scrollPresenterOffset, offset);
01348                 }
01349
01350                 Log.Comment("Returning to the main ScrollPresenter test page");
01351                 TestSetupHelper.GoBack();
01352             }
01353         }
01354
01355 #if ApplicableRangeType
01356         [TestMethod]
01357         [TestProperty("Description", "Apply a single optional irregular snap point to the scrollPresenter and pan the scrollPresenter towards and away from the snap point.")]
01358         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01359         public void PanOverAnOptionalIrregularSnapPoint()
01360         {
01361             Log.Comment("Selecting ScrollPresenter tests");
01362
01363             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01364             {
01365                 SetOutputDebugStringLevel("Verbose");
01366
01367                 var elements = GoToSnapPointsPage();
01368                 Verify.IsTrue(PanUntilInputWorks(elements.scrollPresenterOffset, elements.scrollPresenterUIObject), "Pan inputs aren't moving the scrollPresenter...");
01369
01370                 elements.txtOISnapPointValueUIObject.SetValue("100");
01371                 elements.txtOISnapPointRangeUIObject.SetValue("50");
01372                 elements.btnAddOISnapPointUIObject.Invoke();
01373
01374                 InputHelper.Tap(elements.scrollPresenterUIObject);
01375
01376                 InputHelper.Pan(elements.scrollPresenterUIObject, 75, Direction.North);
01377                 WaitForOffsetUpdated(150.0, 10000.0, elements.scrollPresenterOffset);
01378
01379                 Log.Comment("Returning to the main ScrollPresenter test page");
01380                 TestSetupHelper.GoBack();
01381             }
01382         }
01383
01384         [TestMethod]
01385         [TestProperty("Description", "Apply a single optional irregular snap point to the scrollPresenter and pan the scrollPresenter towards and away from the snap point.")]
01386         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
01387         public void PanTowardsASingleOptionalIrregularSnapPoint()
01388         {
01389             Log.Comment("Selecting ScrollPresenter tests");
01390
01391             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01392             {
01393                 SetOutputDebugStringLevel("Verbose");
01394
01395                 var elements = GoToSnapPointsPage();
01396
01397                 int warningCount = 0;
01398                 Verify.IsTrue(PanUntilInputWorks(elements.scrollPresenterOffset, elements.scrollPresenterUIObject), "Pan inputs aren't moving the scrollPresenter...");
01399
01400                 elements.txtOISnapPointValueUIObject.SetValue("600");
01401                 elements.txtOISnapPointRangeUIObject.SetValue("500");
01402                 elements.btnAddOISnapPointUIObject.Invoke();
01403
01404                 InputHelper.Tap(elements.scrollPresenterUIObject);
01405
01406                 elements.scrollPresenterOffset.SetValue("0");
01407                 SnapPointsPageChangeOffset(elements, "20", 0.0, 200.0);
01408                 PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
01409
01410                 InputHelper.Pan(elements.scrollPresenterUIObject, 75, Direction.North);
01411                 warningCount += WaitForOffsetUpdated(elements.scrollPresenterOffset, 600.0, double.PositiveInfinity, 1100.01);
01412                 PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
01413
01414                 InputHelper.Pan(elements.scrollPresenterUIObject, 125, Direction.North);
01415                 warningCount += WaitForOffsetUpdated(elements.scrollPresenterOffset, 600.0, double.PositiveInfinity, 1100.01);
01416
01417                 InputHelper.Pan(elements.scrollPresenterUIObject, 200, Direction.North);
01418                 warningCount += WaitForOffsetUpdated(1100.0, 10000.0, elements.scrollPresenterOffset, 600.0, 600.0);
01419
01420                 Verify.IsLessThan(warningCount, 3);
01421                 Log.Comment("Returning to the main ScrollPresenter test page");
01422                 TestSetupHelper.GoBack();
01423             }
01424         }
01425
01426         private void SetUpOptionalIrregularSnapPoints(
01427             ScrollSnapPointsTestPageElements elements,
01428             string previousValue,
01429             string previousRange,
01430             string snap1Value,
01431             string snap1Range,
01432             string snap2Value,
01433             string snap2Range,
01434             string nextValue,
01435             string nextRange)
01436         {
01437             Log.Comment("SetUpOptionalIrregularSnapPoints setting up snap points with:");
01438             Log.Comment("previousValue: " + previousValue + ", previousRange: " + previousRange + ", nextValue: " + nextValue + ", nextRange: " + nextRange);
01439             Log.Comment("snap1Value: " + snap1Value + ", snap1Range: " + snap1Range + ", snap2Value: " + snap2Value + ", snap2Range: " + snap2Range);
01440
01441             if (previousValue != "" && previousRange != "")
01442             {
01443                 elements.txtOISnapPointValueUIObject.SetValue(previousValue);
01444                 elements.txtOISnapPointRangeUIObject.SetValue(previousRange);
01445                 elements.btnAddOISnapPointUIObject.Invoke();
01446             }
01447
01448             elements.txtOISnapPointValueUIObject.SetValue(snap1Value);
01449             elements.txtOISnapPointRangeUIObject.SetValue(snap1Range);
01450             elements.btnAddOISnapPointUIObject.Invoke();
01451
01452             elements.txtOISnapPointValueUIObject.SetValue(snap2Value);
01453             elements.txtOISnapPointRangeUIObject.SetValue(snap2Range);
01454             elements.btnAddOISnapPointUIObject.Invoke();
01455
01456             if (nextValue != "" && nextRange != "")
01457             {
01458                 elements.txtOISnapPointValueUIObject.SetValue(nextValue);
01459                 elements.txtOISnapPointRangeUIObject.SetValue(nextRange);
01460                 elements.btnAddOISnapPointUIObject.Invoke();
01461             }
01462         }
01463
01464         [TestMethod]
01465         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration: (--|--)(--|--).")]
01466         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint1()
01467         {
01468             Log.Comment("Selecting ScrollPresenter tests");
01469
01470             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01471             {
01472                 SetOutputDebugStringLevel("Verbose");
01473
01474                 var elements = GoToSnapPointsPage();
01475
01476                 //  (--|--)(--|--)
01477                 SetUpOptionalIrregularSnapPoints(elements, "", "", "100", "50", "200", "50", "400", "100");
01478
01479                 SnapPointsPageChangeOffset(elements, "20", 0.0, 50.0);
01480                 SnapPointsPageChangeOffset(elements, "50", 100.0);
01481                 SnapPointsPageChangeOffset(elements, "48", 100.0);
01482                 SnapPointsPageChangeOffset(elements, "60", 200.0);
01483                 SnapPointsPageChangeOffset(elements, "30", 200.0);
01484                 SnapPointsPageChangeOffset(elements, "70", 250.0, 300.0);
01485                 SnapPointsPageChangeOffset(elements, "50", 400.0);
01486
01487                 Log.Comment("Returning to the main ScrollPresenter test page");
01488                 TestSetupHelper.GoBack();
01489             }
01490         }
01491
01492         [TestMethod]
01493         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration: (--|--(-)--|--).")]
01494         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint2()
01495         {
01496             Log.Comment("Selecting ScrollPresenter tests");
01497
01498             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01499             {
01500                 SetOutputDebugStringLevel("Verbose");
01501
01502                 var elements = GoToSnapPointsPage();
01503
01504                 //  (--|--)(--|--)
01505                 SetUpOptionalIrregularSnapPoints(elements, "200", "50", "400", "100", "550", "100", "800", "100");
01506
01507                 SnapPointsPageChangeOffset(elements, "270", 250.0, 300.0);
01508                 SnapPointsPageChangeOffset(elements, "50", 400.0);
01509                 SnapPointsPageChangeOffset(elements, "20", 400.0);
01510                 SnapPointsPageChangeOffset(elements, "60", 400.0);
01511                 SnapPointsPageChangeOffset(elements, "90", 550.0);
01512                 SnapPointsPageChangeOffset(elements, "80", 550.0);
01513                 SnapPointsPageChangeOffset(elements, "120", 650.0, 700.0);
01514                 SnapPointsPageChangeOffset(elements, "40", 800.0);
01515
01516                 Log.Comment("Returning to the main ScrollPresenter test page");
01517                 TestSetupHelper.GoBack();
01518             }
01519         }
01520
01521         [TestMethod]
01522         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration: (-(-|--)-|----).")]
01523         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint3()
01524         {
01525             Log.Comment("Selecting ScrollPresenter tests");
01526
01527             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01528             {
01529                 SetOutputDebugStringLevel("Verbose");
01530
01531                 var elements = GoToSnapPointsPage();
01532
01533                 //  (--|--)(--|--)
01534                 SetUpOptionalIrregularSnapPoints(elements, "550", "100", "800", "100", "950", "200", "1300", "100");
01535
01536                 SnapPointsPageChangeOffset(elements, "670", 650.0, 700.0);
01537                 SnapPointsPageChangeOffset(elements, "40", 800.0);
01538                 SnapPointsPageChangeOffset(elements, "60", 800.0);
01539                 SnapPointsPageChangeOffset(elements, "90", 950.0);
01540                 SnapPointsPageChangeOffset(elements, "130", 950.0);
01541                 SnapPointsPageChangeOffset(elements, "230", 1150.0, 1200.0);
01542                 SnapPointsPageChangeOffset(elements, "100", 1300.0);
01543
01544                 Log.Comment("Returning to the main ScrollPresenter test page");
01545                 TestSetupHelper.GoBack();
01546             }
01547         }
01548
01549         [TestMethod]
01550         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration: (-(-|-|-)-).")]
01551         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint4()
01552         {
01553             Log.Comment("Selecting ScrollPresenter tests");
01554
01555             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01556             {
01557                 SetOutputDebugStringLevel("Verbose");
01558
01559                 var elements = GoToSnapPointsPage();
01560
01561                 //  (--|--)(--|--)
01562                 SetUpOptionalIrregularSnapPoints(elements, "950", "200", "1300", "100", "1350", "100", "1800", "200");
01563
01564                 SnapPointsPageChangeOffset(elements, "1170", 1150.0, 1200.0);
01565                 SnapPointsPageChangeOffset(elements, "100", 1300.0);
01566                 SnapPointsPageChangeOffset(elements, "20", 1300.0);
01567                 SnapPointsPageChangeOffset(elements, "40", 1350.0);
01568                 SnapPointsPageChangeOffset(elements, "40", 1350.0);
01569                 SnapPointsPageChangeOffset(elements, "80", 1350.0);
01570                 SnapPointsPageChangeOffset(elements, "120", 1450.0, 1600.0);
01571                 SnapPointsPageChangeOffset(elements, "150", 1800.0);
01572
01573                 Log.Comment("Returning to the main ScrollPresenter test page");
01574                 TestSetupHelper.GoBack();
01575             }
01576         }
01577
01578         [TestMethod]
01579         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration: (----|-(--|-)-).")]
01580         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint5()
01581         {
01582             Log.Comment("Selecting ScrollPresenter tests");
01583
01584             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01585             {
01586                 SetOutputDebugStringLevel("Verbose");
01587
01588                 var elements = GoToSnapPointsPage();
01589
01590                 //  (----|-(--|-)-)
01591                 SetUpOptionalIrregularSnapPoints(elements, "350", "100", "800", "200", "950", "100", "1300", "200");
01592
01593                 SnapPointsPageChangeOffset(elements, "520", 450.0, 600.0);
01594                 SnapPointsPageChangeOffset(elements, "150", 800.0);
01595                 SnapPointsPageChangeOffset(elements, "60", 800.0);
01596                 SnapPointsPageChangeOffset(elements, "90", 950.0);
01597                 SnapPointsPageChangeOffset(elements, "20", 950.0);
01598                 SnapPointsPageChangeOffset(elements, "120", 1050.0, 1100.0);
01599                 SnapPointsPageChangeOffset(elements, "60", 1300.0);
01600
01601                 Log.Comment("Returning to the main ScrollPresenter test page");
01602                 TestSetupHelper.GoBack();
01603             }
01604         }
01605
01606         [TestMethod]
01607         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration: (----|-(-|-)-).")]
01608         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint6()
01609         {
01610             Log.Comment("Selecting ScrollPresenter tests");
01611
01612             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01613             {
01614                 SetOutputDebugStringLevel("Verbose");
01615
01616                 var elements = GoToSnapPointsPage();
01617
01618                 //  (----|-(-|-)-)
01619                 SetUpOptionalIrregularSnapPoints(elements, "950", "100", "1300", "200", "1400", "50", "1800", "200");
01620
01621                 SnapPointsPageChangeOffset(elements, "1070", 1050.0, 1100.0);
01622                 SnapPointsPageChangeOffset(elements, "60", 1300.0);
01623                 SnapPointsPageChangeOffset(elements, "20", 1300.0);
01624                 SnapPointsPageChangeOffset(elements, "60", 1400.0);
01625                 SnapPointsPageChangeOffset(elements, "20", 1400.0);
01626                 SnapPointsPageChangeOffset(elements, "80", 1450.0, 1600.0);
01627                 SnapPointsPageChangeOffset(elements, "300", 1800.0);
01628
01629                 Log.Comment("Returning to the main ScrollPresenter test page");
01630                 TestSetupHelper.GoBack();
01631             }
01632         }
01633
01634         [TestMethod]
01635         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration: (---(-|-|--)-).")]
01636         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint7()
01637         {
01638             Log.Comment("Selecting ScrollPresenter tests");
01639
01640             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01641             {
01642                 SetOutputDebugStringLevel("Verbose");
01643
01644                 var elements = GoToSnapPointsPage();
01645
01646                 //  (---(-|-|--)-)
01647                 SetUpOptionalIrregularSnapPoints(elements, "400", "50", "800", "200", "850", "100", "1250", "100");
01648
01649                 SnapPointsPageChangeOffset(elements, "500", 450.0, 600.0);
01650                 SnapPointsPageChangeOffset(elements, "300", 800.0);
01651                 SnapPointsPageChangeOffset(elements, "20", 800.0);
01652                 SnapPointsPageChangeOffset(elements, "40", 850.0);
01653                 SnapPointsPageChangeOffset(elements, "70", 850.0);
01654                 SnapPointsPageChangeOffset(elements, "140", 950.0, 1100.0);
01655                 SnapPointsPageChangeOffset(elements, "130", 1100.0, 1150.0);
01656
01657                 Log.Comment("Returning to the main ScrollPresenter test page");
01658                 TestSetupHelper.GoBack();
01659             }
01660         }
01661
01662         [TestMethod]
01663         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration: (-(--|-|-)---).")]
01664         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint8()
01665         {
01666             Log.Comment("Selecting ScrollPresenter tests");
01667
01668             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01669             {
01670                 SetOutputDebugStringLevel("Verbose");
01671
01672                 var elements = GoToSnapPointsPage();
01673
01674                 //  (-(--|-|-)---)
01675                 SetUpOptionalIrregularSnapPoints(elements, "850", "100", "1300", "200", "1250", "100", "1800", "200");
01676
01677                 SnapPointsPageChangeOffset(elements, "1000", 950.0, 1100.0);
01678                 SnapPointsPageChangeOffset(elements, "130", 1100.0, 1150.0);
01679                 SnapPointsPageChangeOffset(elements, "50", 1250.0);
01680                 SnapPointsPageChangeOffset(elements, "20", 1250.0);
01681                 SnapPointsPageChangeOffset(elements, "40", 1300.0);
01682                 SnapPointsPageChangeOffset(elements, "20", 1300.0);
01683                 SnapPointsPageChangeOffset(elements, "250", 1500.0, 1600.0);
01684                 SnapPointsPageChangeOffset(elements, "70", 1800.0);
01685
01686                 Log.Comment("Returning to the main ScrollPresenter test page");
01687                 TestSetupHelper.GoBack();
01688             }
01689         }
01690
01691         [TestMethod]
01692         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (-(-|-)-|----).")]
01693         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint9()
01694         {
01695             Log.Comment("Selecting ScrollPresenter tests");
01696
01697             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01698             {
01699                 SetOutputDebugStringLevel("Verbose");
01700
01701                 var elements = GoToSnapPointsPage();
01702
01703                 //  (-(-|-)-|----)
01704                 SetUpOptionalIrregularSnapPoints(elements, "300", "200", "800", "200", "700", "50", "1200", "100");
01705
01706                 SnapPointsPageChangeOffset(elements, "550", 500.0, 600.0);
01707                 SnapPointsPageChangeOffset(elements, "70", 600.0, 650.0);
01708                 SnapPointsPageChangeOffset(elements, "50", 700.0);
01709                 SnapPointsPageChangeOffset(elements, "30", 700.0);
01710                 SnapPointsPageChangeOffset(elements, "70", 800.0);
01711                 SnapPointsPageChangeOffset(elements, "150", 800.0);
01712                 SnapPointsPageChangeOffset(elements, "230", 1000.0, 1100.0);
01713                 SnapPointsPageChangeOffset(elements, "100", 1200.0);
01714
01715                 Log.Comment("Returning to the main ScrollPresenter test page");
01716                 TestSetupHelper.GoBack();
01717             }
01718         }
01719
01720         [TestMethod]
01721         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (-|-)-(-|-).")]
01722         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint10()
01723         {
01724             Log.Comment("Selecting ScrollPresenter tests");
01725
01726             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01727             {
01728                 SetOutputDebugStringLevel("Verbose");
01729
01730                 var elements = GoToSnapPointsPage();
01731
01732                 //  (-|-)-(-|-)
01733                 SetUpOptionalIrregularSnapPoints(elements, "700", "50", "1200", "100", "1500", "100", "1900", "200");
01734
01735                 SnapPointsPageChangeOffset(elements, "1050", 1000.0, 1100.0);
01736                 SnapPointsPageChangeOffset(elements, "100", 1200.0);
01737                 SnapPointsPageChangeOffset(elements, "70", 1200.0);
01738                 SnapPointsPageChangeOffset(elements, "120", 1300.0, 1400.0);
01739                 SnapPointsPageChangeOffset(elements, "100", 1500.0);
01740                 SnapPointsPageChangeOffset(elements, "70", 1500.0);
01741                 SnapPointsPageChangeOffset(elements, "120", 1600.0, 1700.0);
01742                 SnapPointsPageChangeOffset(elements, "100", 1900.0);
01743
01744                 Log.Comment("Returning to the main ScrollPresenter test page");
01745                 TestSetupHelper.GoBack();
01746             }
01747         }
01748
01749         [TestMethod]
01750         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (--|-(-)|-).")]
01751         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint11()
01752         {
01753             Log.Comment("Selecting ScrollPresenter tests");
01754
01755             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01756             {
01757                 SetOutputDebugStringLevel("Verbose");
01758
01759                 var elements = GoToSnapPointsPage();
01760
01761                 //  (--|-(-)|-)
01762                 SetUpOptionalIrregularSnapPoints(elements, "500", "100", "900", "200", "1100", "100", "1400", "100");
01763
01764                 SnapPointsPageChangeOffset(elements, "650", 600.0, 700.0);
01765                 SnapPointsPageChangeOffset(elements, "100", 900.0);
01766                 SnapPointsPageChangeOffset(elements, "80", 900.0);
01767                 SnapPointsPageChangeOffset(elements, "120", 1100.0);
01768                 SnapPointsPageChangeOffset(elements, "70", 1100.0);
01769                 SnapPointsPageChangeOffset(elements, "150", 1200.0, 1300.0);
01770                 SnapPointsPageChangeOffset(elements, "100", 1400.0);
01771
01772                 Log.Comment("Returning to the main ScrollPresenter test page");
01773                 TestSetupHelper.GoBack();
01774             }
01775         }
01776
01777         [TestMethod]
01778         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (--|(-)|-).")]
01779         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint12()
01780         {
01781             Log.Comment("Selecting ScrollPresenter tests");
01782
01783             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01784             {
01785                 SetOutputDebugStringLevel("Verbose");
01786
01787                 var elements = GoToSnapPointsPage();
01788
01789                 //  (--|(-)|-)
01790                 SetUpOptionalIrregularSnapPoints(elements, "100", "100", "400", "100", "500", "100", "900", "200");
01791
01792                 SnapPointsPageChangeOffset(elements, "250", 200.0, 300.0);
01793                 SnapPointsPageChangeOffset(elements, "100", 400.0);
01794                 SnapPointsPageChangeOffset(elements, "30", 400.0);
01795                 SnapPointsPageChangeOffset(elements, "80", 500.0);
01796                 SnapPointsPageChangeOffset(elements, "70", 500.0);
01797                 SnapPointsPageChangeOffset(elements, "150", 600.0, 700.0);
01798                 SnapPointsPageChangeOffset(elements, "200", 900.0);
01799
01800                 Log.Comment("Returning to the main ScrollPresenter test page");
01801                 TestSetupHelper.GoBack();
01802             }
01803         }
01804
01805         [TestMethod]
01806         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (-(-|--)|---).")]
01807         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint13()
01808         {
01809             Log.Comment("Selecting ScrollPresenter tests");
01810
01811             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01812             {
01813                 SetOutputDebugStringLevel("Verbose");
01814
01815                 var elements = GoToSnapPointsPage();
01816
01817                 //   (-(-|--)|---)
01818                 SetUpOptionalIrregularSnapPoints(elements, "500", "100", "900", "200", "1100", "300", "1600", "100");
01819
01820                 SnapPointsPageChangeOffset(elements, "650", 600.0, 700.0);
01821                 SnapPointsPageChangeOffset(elements, "200", 900.0);
01822                 SnapPointsPageChangeOffset(elements, "80", 900.0);
01823                 SnapPointsPageChangeOffset(elements, "120", 1100.0);
01824                 SnapPointsPageChangeOffset(elements, "270", 1100.0);
01825                 SnapPointsPageChangeOffset(elements, "350", 1400.0, 1500.0);
01826                 SnapPointsPageChangeOffset(elements, "100", 1600.0);
01827
01828                 Log.Comment("Returning to the main ScrollPresenter test page");
01829                 TestSetupHelper.GoBack();
01830             }
01831         }
01832
01833         [TestMethod]
01834         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  ((-|-)|--).")]
01835         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint14()
01836         {
01837             Log.Comment("Selecting ScrollPresenter tests");
01838
01839             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01840             {
01841                 SetOutputDebugStringLevel("Verbose");
01842
01843                 var elements = GoToSnapPointsPage();
01844
01845                 //  ((-|-)|--)
01846                 SetUpOptionalIrregularSnapPoints(elements, "100", "300", "600", "100", "700", "200", "100", "50");
01847
01848                 SnapPointsPageChangeOffset(elements, "450", 400.0, 500.0);
01849                 SnapPointsPageChangeOffset(elements, "100", 600.0);
01850                 SnapPointsPageChangeOffset(elements, "30", 600.0);
01851                 SnapPointsPageChangeOffset(elements, "80", 700.0);
01852                 SnapPointsPageChangeOffset(elements, "180", 700.0);
01853                 SnapPointsPageChangeOffset(elements, "250", 900.0, 1000.0);
01854                 SnapPointsPageChangeOffset(elements, "80", 1000.0, 1050.0);
01855
01856                 Log.Comment("Returning to the main ScrollPresenter test page");
01857                 TestSetupHelper.GoBack();
01858             }
01859         }
01860
01861         [TestMethod]
01862         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (-(-|-)|---).")]
01863         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint15()
01864         {
01865             Log.Comment("Selecting ScrollPresenter tests");
01866
01867             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01868             {
01869                 SetOutputDebugStringLevel("Verbose");
01870
01871                 var elements = GoToSnapPointsPage();
01872
01873                 //  (-(-|-)|---)
01874                 SetUpOptionalIrregularSnapPoints(elements, "700", "200", "1100", "50", "1150", "150", "1500", "100");
01875
01876                 SnapPointsPageChangeOffset(elements, "950", 900.0, 1000.0);
01877                 SnapPointsPageChangeOffset(elements, "80", 1000.0, 1050.0);
01878                 SnapPointsPageChangeOffset(elements, "50", 1100.0);
01879                 SnapPointsPageChangeOffset(elements, "20", 1100.0);
01880                 SnapPointsPageChangeOffset(elements, "40", 1150.0);
01881                 SnapPointsPageChangeOffset(elements, "100", 1150.0);
01882                 SnapPointsPageChangeOffset(elements, "200", 1300.0, 1400.0);
01883                 SnapPointsPageChangeOffset(elements, "100", 1500.0);
01884
01885                 Log.Comment("Returning to the main ScrollPresenter test page");
01886                 TestSetupHelper.GoBack();
01887             }
01888         }
01889
01890         [TestMethod]
01891         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (-|(-)-|--).")]
01892         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint16()
01893         {
01894             Log.Comment("Selecting ScrollPresenter tests");
01895
01896             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01897             {
01898                 SetOutputDebugStringLevel("Verbose");
01899
01900                 var elements = GoToSnapPointsPage();
01901
01902                 //  (-|(-)-|--)
01903                 SetUpOptionalIrregularSnapPoints(elements, "100", "50", "700", "200", "500", "100", "1150", "100");
01904
01905                 SnapPointsPageChangeOffset(elements, "350", 300.0, 400.0);
01906                 SnapPointsPageChangeOffset(elements, "100", 500.0);
01907                 SnapPointsPageChangeOffset(elements, "80", 500.0);
01908                 SnapPointsPageChangeOffset(elements, "120", 700.0);
01909                 SnapPointsPageChangeOffset(elements, "180", 700.0);
01910                 SnapPointsPageChangeOffset(elements, "250", 900.0, 1000.0);
01911                 SnapPointsPageChangeOffset(elements, "100", 1150.0);
01912
01913                 Log.Comment("Returning to the main ScrollPresenter test page");
01914                 TestSetupHelper.GoBack();
01915             }
01916         }
01917
01918         [TestMethod]
01919         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (---|(--|-)-).")]
01920         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint17()
01921         {
01922             Log.Comment("Selecting ScrollPresenter tests");
01923
01924             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01925             {
01926                 SetOutputDebugStringLevel("Verbose");
01927
01928                 var elements = GoToSnapPointsPage();
01929
01930                 //  (---|(--|-)-)
01931                 SetUpOptionalIrregularSnapPoints(elements, "200", "200", "750", "100", "650", "150", "1050", "50");
01932
01933                 SnapPointsPageChangeOffset(elements, "450", 400.0, 500.0);
01934                 SnapPointsPageChangeOffset(elements, "100", 650.0);
01935                 SnapPointsPageChangeOffset(elements, "30", 650.0);
01936                 SnapPointsPageChangeOffset(elements, "80", 750.0);
01937                 SnapPointsPageChangeOffset(elements, "30", 750.0);
01938                 SnapPointsPageChangeOffset(elements, "80", 750.0);
01939                 SnapPointsPageChangeOffset(elements, "120", 850.0, 1000.0);
01940                 SnapPointsPageChangeOffset(elements, "150", 1050.0);
01941
01942                 Log.Comment("Returning to the main ScrollPresenter test page");
01943                 TestSetupHelper.GoBack();
01944             }
01945         }
01946
01947         [TestMethod]
01948         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (--|(-|-)).")]
01949         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint18()
01950         {
01951             Log.Comment("Selecting ScrollPresenter tests");
01952
01953             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01954             {
01955                 SetOutputDebugStringLevel("Verbose");
01956
01957                 var elements = GoToSnapPointsPage();
01958
01959                 //  (--|(-|-))
01960                 SetUpOptionalIrregularSnapPoints(elements, "250", "100", "550", "50", "500", "100", "900", "200");
01961
01962                 SnapPointsPageChangeOffset(elements, "375", 350.0, 400.0);
01963                 SnapPointsPageChangeOffset(elements, "50", 500.0);
01964                 SnapPointsPageChangeOffset(elements, "20", 500.0);
01965                 SnapPointsPageChangeOffset(elements, "40", 550.0);
01966                 SnapPointsPageChangeOffset(elements, "49", 550.0);
01967                 SnapPointsPageChangeOffset(elements, "100", 600.0, 700.0);
01968                 SnapPointsPageChangeOffset(elements, "100", 900.0);
01969
01970                 Log.Comment("Returning to the main ScrollPresenter test page");
01971                 TestSetupHelper.GoBack();
01972             }
01973         }
01974
01975         [TestMethod]
01976         [TestProperty("Description", "Change Offsets around option irregular snap points in this configuration:  (---|(-|-)-).")]
01977         public void ChangeOffsetsBetweenInterwovenOptionalIrregularSnapPoint19()
01978         {
01979             Log.Comment("Selecting ScrollPresenter tests");
01980
01981             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
01982             {
01983                 SetOutputDebugStringLevel("Verbose");
01984
01985                 var elements = GoToSnapPointsPage();
01986
01987                 //  (---|(-|-)-)
01988                 SetUpOptionalIrregularSnapPoints(elements, "550", "50", "900", "200", "950", "50", "", "");
01989
01990                 SnapPointsPageChangeOffset(elements, "650", 600.0, 700.0);
01991                 SnapPointsPageChangeOffset(elements, "100", 900.0);
01992                 SnapPointsPageChangeOffset(elements, "20", 900.0);
01993                 SnapPointsPageChangeOffset(elements, "40", 950.0);
01994                 SnapPointsPageChangeOffset(elements, "30", 950.0);
01995                 SnapPointsPageChangeOffset(elements, "100", 1000.0, 1100.0);
01996
01997                 Log.Comment("Returning to the main ScrollPresenter test page");
01998                 TestSetupHelper.GoBack();
01999             }
02000         }
02001
02002         [TestMethod]
02003         [TestProperty("Description", "Apply a mix of mandatory and optional snap points and scroll precisely between them.")]
02004         public void ChangeOffsetBetweenMixOfMandatoryAndOptionalSnapPoints1()
02005         {
02006             Log.Comment("Selecting ScrollPresenter tests");
02007
02008             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02009             {
02010                 SetOutputDebugStringLevel("Verbose");
02011
02012                 var elements = GoToSnapPointsPage();
02013
02014                 elements.txtMISnapPointValueUIObject.SetValue("100");
02015                 elements.btnAddMISnapPointUIObject.Invoke();
02016                 elements.txtMISnapPointValueUIObject.SetValue("200");
02017                 elements.btnAddMISnapPointUIObject.Invoke();
02018
02019                 elements.txtOISnapPointValueUIObject.SetValue("300");
02020                 elements.txtOISnapPointRangeUIObject.SetValue("50");
02021                 elements.btnAddOISnapPointUIObject.Invoke();
02022                 elements.txtOISnapPointValueUIObject.SetValue("400");
02023                 elements.txtOISnapPointRangeUIObject.SetValue("25");
02024                 elements.btnAddOISnapPointUIObject.Invoke();
02025                 elements.txtOISnapPointValueUIObject.SetValue("450");
02026                 elements.txtOISnapPointRangeUIObject.SetValue("25");
02027                 elements.btnAddOISnapPointUIObject.Invoke();
02028
02029                 SnapPointsPageChangeOffset(elements, "10", 100.0);
02030                 SnapPointsPageChangeOffset(elements, "45", 100.0);
02031                 SnapPointsPageChangeOffset(elements, "55", 200.0);
02032                 SnapPointsPageChangeOffset(elements, "45", 200.0);
02033                 SnapPointsPageChangeOffset(elements, "55", 300.0);
02034                 SnapPointsPageChangeOffset(elements, "25", 300.0);
02035                 SnapPointsPageChangeOffset(elements, "55", 350.0, 375.0);
02036                 SnapPointsPageChangeOffset(elements, "25", 400.0);
02037                 SnapPointsPageChangeOffset(elements, "20", 400.0);
02038                 SnapPointsPageChangeOffset(elements, "30", 450.0);
02039                 SnapPointsPageChangeOffset(elements, "20", 450.0);
02040                 SnapPointsPageChangeOffset(elements, "30", 480.0, 500.0);
02041
02042                 Log.Comment("Returning to the main ScrollPresenter test page");
02043                 TestSetupHelper.GoBack();
02044             }
02045         }
02046
02047         [TestMethod]
02048         [TestProperty("Description", "Apply a mix of mandatory and optional snap points and scroll precisely between them.")]
02049         public void ChangeOffsetBetweenMixOfMandatoryAndOptionalSnapPoints2()
02050         {
02051             Log.Comment("Selecting ScrollPresenter tests");
02052
02053             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02054             {
02055                 SetOutputDebugStringLevel("Verbose");
02056
02057                 var elements = GoToSnapPointsPage();
02058
02059                 elements.txtMISnapPointValueUIObject.SetValue("500");
02060                 elements.btnAddMISnapPointUIObject.Invoke();
02061                 elements.txtOISnapPointValueUIObject.SetValue("525");
02062                 elements.txtOISnapPointRangeUIObject.SetValue("25");
02063                 elements.btnAddOISnapPointUIObject.Invoke();
02064                 elements.txtMISnapPointValueUIObject.SetValue("550");
02065                 elements.btnAddMISnapPointUIObject.Invoke();
02066                 elements.txtOISnapPointValueUIObject.SetValue("575");
02067                 elements.txtOISnapPointRangeUIObject.SetValue("25");
02068                 elements.btnAddOISnapPointUIObject.Invoke();
02069                 elements.txtMISnapPointValueUIObject.SetValue("600");
02070                 elements.btnAddMISnapPointUIObject.Invoke();
02071
02072                 SnapPointsPageChangeOffset(elements, "10", 500.0);
02073                 SnapPointsPageChangeOffset(elements, "15", 525.0);
02074                 SnapPointsPageChangeOffset(elements, "10", 525.0);
02075                 SnapPointsPageChangeOffset(elements, "15", 550.0);
02076                 SnapPointsPageChangeOffset(elements, "10", 550.0);
02077                 SnapPointsPageChangeOffset(elements, "15", 575.0);
02078                 SnapPointsPageChangeOffset(elements, "10", 575.0);
02079                 SnapPointsPageChangeOffset(elements, "15", 600.0);
02080                 SnapPointsPageChangeOffset(elements, "30", 600.0);
02081
02082                 Log.Comment("Returning to the main ScrollPresenter test page");
02083                 TestSetupHelper.GoBack();
02084             }
02085         }
02086
02087         [TestMethod]
02088         [TestProperty("Description", "Apply a mix of mandatory and optional snap points and scroll precisely between them.")]
02089         public void ChangeOffsetBetweenMixOfMandatoryAndOptionalSnapPoints3()
02090         {
02091             Log.Comment("Selecting ScrollPresenter tests");
02092
02093             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02094             {
02095                 SetOutputDebugStringLevel("Verbose");
02096
02097                 var elements = GoToSnapPointsPage();
02098
02099                 elements.txtOISnapPointValueUIObject.SetValue("700");
02100                 elements.txtOISnapPointRangeUIObject.SetValue("50");
02101                 elements.btnAddOISnapPointUIObject.Invoke();
02102                 elements.txtMISnapPointValueUIObject.SetValue("675");
02103                 elements.btnAddMISnapPointUIObject.Invoke();
02104                 elements.txtMISnapPointValueUIObject.SetValue("725");
02105                 elements.btnAddMISnapPointUIObject.Invoke();
02106
02107                 SnapPointsPageChangeOffset(elements, "55", 675.0);
02108                 SnapPointsPageChangeOffset(elements, "10", 675.0);
02109                 SnapPointsPageChangeOffset(elements, "15", 700.0);
02110                 SnapPointsPageChangeOffset(elements, "10", 700.0);
02111                 SnapPointsPageChangeOffset(elements, "15", 725.0);
02112                 SnapPointsPageChangeOffset(elements, "80", 725.0);
02113
02114                 Log.Comment("Returning to the main ScrollPresenter test page");
02115                 TestSetupHelper.GoBack();
02116             }
02117         }
02118
02119         [TestMethod]
02120         [TestProperty("Description", "Apply a mix of mandatory and optional snap points and scroll precisely between them.")]
02121         public void ChangeOffsetBetweenMixOfMandatoryAndOptionalSnapPoints4()
02122         {
02123             Log.Comment("Selecting ScrollPresenter tests");
02124
02125             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02126             {
02127                 SetOutputDebugStringLevel("Verbose");
02128
02129                 var elements = GoToSnapPointsPage();
02130
02131                 elements.txtORSnapPointOffsetUIObject.SetValue("800");
02132                 elements.txtORSnapPointIntervalUIObject.SetValue("100");
02133                 elements.txtORSnapPointStartUIObject.SetValue("800");
02134                 elements.txtORSnapPointEndUIObject.SetValue("1000");
02135                 elements.txtORSnapPointRangeUIObject.SetValue("30");
02136                 elements.btnAddORSnapPointUIObject.Invoke();
02137
02138                 elements.txtOISnapPointValueUIObject.SetValue("1050");
02139                 elements.txtOISnapPointRangeUIObject.SetValue("100");
02140                 elements.btnAddOISnapPointUIObject.Invoke();
02141
02142                 elements.txtORSnapPointOffsetUIObject.SetValue("1100");
02143                 elements.txtORSnapPointIntervalUIObject.SetValue("100");
02144                 elements.txtORSnapPointStartUIObject.SetValue("1100");
02145                 elements.txtORSnapPointEndUIObject.SetValue("1290");
02146                 elements.txtORSnapPointRangeUIObject.SetValue("30");
02147                 elements.btnAddORSnapPointUIObject.Invoke();
02148
02149                 SnapPointsPageChangeOffset(elements, "750", 700.0, 800.0);
02150                 SnapPointsPageChangeOffset(elements, "75", 800.0);
02151                 SnapPointsPageChangeOffset(elements, "25", 800.0);
02152                 SnapPointsPageChangeOffset(elements, "50", 830.0, 870.0);
02153                 SnapPointsPageChangeOffset(elements, "25", 900.0);
02154                 SnapPointsPageChangeOffset(elements, "25", 900.0);
02155                 SnapPointsPageChangeOffset(elements, "50", 930.0, 970.0);
02156                 SnapPointsPageChangeOffset(elements, "25", 1000.0);
02157                 SnapPointsPageChangeOffset(elements, "10", 1050.0);
02158                 SnapPointsPageChangeOffset(elements, "40", 1050.0);
02159                 SnapPointsPageChangeOffset(elements, "60", 1100.0);
02160                 SnapPointsPageChangeOffset(elements, "25", 1100.0);
02161                 SnapPointsPageChangeOffset(elements, "50", 1130.0, 1170.0);
02162
02163                 Log.Comment("Returning to the main ScrollPresenter test page");
02164                 TestSetupHelper.GoBack();
02165             }
02166         }
02167
02168         [TestMethod]
02169         [TestProperty("Description", "Apply a mix of mandatory and optional snap points and scroll precisely between them.")]
02170         public void ChangeOffsetBetweenMixOfMandatoryAndOptionalSnapPoints5()
02171         {
02172             Log.Comment("Selecting ScrollPresenter tests");
02173
02174             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02175             {
02176                 SetOutputDebugStringLevel("Verbose");
02177
02178                 var elements = GoToSnapPointsPage();
02179
02180                 elements.txtORSnapPointOffsetUIObject.SetValue("100");
02181                 elements.txtORSnapPointIntervalUIObject.SetValue("100");
02182                 elements.txtORSnapPointStartUIObject.SetValue("100");
02183                 elements.txtORSnapPointEndUIObject.SetValue("290");
02184                 elements.txtORSnapPointRangeUIObject.SetValue("30");
02185                 elements.btnAddORSnapPointUIObject.Invoke();
02186
02187                 elements.txtMISnapPointValueUIObject.SetValue("350");
02188                 elements.btnAddMISnapPointUIObject.Invoke();
02189
02190                 elements.txtORSnapPointOffsetUIObject.SetValue("400");
02191                 elements.txtORSnapPointIntervalUIObject.SetValue("100");
02192                 elements.txtORSnapPointStartUIObject.SetValue("400");
02193                 elements.txtORSnapPointEndUIObject.SetValue("615");
02194                 elements.txtORSnapPointRangeUIObject.SetValue("30");
02195                 elements.btnAddORSnapPointUIObject.Invoke();
02196
02197                 SnapPointsPageChangeOffset(elements, "60", 0.0, 100.0);
02198                 SnapPointsPageChangeOffset(elements, "45", 100.0);
02199                 SnapPointsPageChangeOffset(elements, "25", 100.0);
02200                 SnapPointsPageChangeOffset(elements, "50", 130.0, 170.0);
02201                 SnapPointsPageChangeOffset(elements, "25", 200.0);
02202                 SnapPointsPageChangeOffset(elements, "50", 230.0, 270.0);
02203                 SnapPointsPageChangeOffset(elements, "30", 270.0, 290.0);
02204                 SnapPointsPageChangeOffset(elements, "12", 350.0);
02205                 SnapPointsPageChangeOffset(elements, "45", 350.0);
02206                 SnapPointsPageChangeOffset(elements, "60", 400.0);
02207                 SnapPointsPageChangeOffset(elements, "25", 400.0);
02208                 SnapPointsPageChangeOffset(elements, "50", 430.0, 470.0);
02209                 SnapPointsPageChangeOffset(elements, "25", 500.0);
02210                 SnapPointsPageChangeOffset(elements, "25", 500.0);
02211                 SnapPointsPageChangeOffset(elements, "50", 530.0, 570.0);
02212                 SnapPointsPageChangeOffset(elements, "25", 600.0);
02213                 SnapPointsPageChangeOffset(elements, "10", 600.0);
02214                 SnapPointsPageChangeOffset(elements, "25", 600.0, 700.0);
02215
02216                 Log.Comment("Returning to the main ScrollPresenter test page");
02217                 TestSetupHelper.GoBack();
02218             }
02219         }
02220
02221         [TestMethod]
02222         [TestProperty("Description", "Apply a mix of mandatory and optional snap points which are defined to have the same value and scroll precisely between them.")]
02223         public void ChangeOffsetBetweenRepeatedSnapPointsStackedOnTopOfEachOther1()
02224         {
02225             Log.Comment("Selecting ScrollPresenter tests");
02226
02227             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02228             {
02229                 SetOutputDebugStringLevel("Verbose");
02230
02231                 var elements = GoToSnapPointsPage();
02232
02233                 elements.txtMRSnapPointOffsetUIObject.SetValue("600");
02234                 elements.txtMRSnapPointIntervalUIObject.SetValue("30");
02235                 elements.txtMRSnapPointStartUIObject.SetValue("600");
02236                 elements.txtMRSnapPointEndUIObject.SetValue("700");
02237                 elements.btnAddMRSnapPointUIObject.Invoke();
02238
02239                 elements.txtMRSnapPointOffsetUIObject.SetValue("700");
02240                 elements.txtMRSnapPointIntervalUIObject.SetValue("30");
02241                 elements.txtMRSnapPointStartUIObject.SetValue("700");
02242                 elements.txtMRSnapPointEndUIObject.SetValue("780");
02243                 elements.btnAddMRSnapPointUIObject.Invoke();
02244
02245                 elements.txtOISnapPointValueUIObject.SetValue("780");
02246                 elements.txtOISnapPointRangeUIObject.SetValue("20");
02247                 elements.btnAddOISnapPointUIObject.Invoke();
02248
02249                 SnapPointsPageChangeOffset(elements, "575", 550.0, 600.0);
02250                 SnapPointsPageChangeOffset(elements, "30", 600.0);
02251                 SnapPointsPageChangeOffset(elements, "10", 600.0);
02252                 SnapPointsPageChangeOffset(elements, "20", 630.0);
02253                 SnapPointsPageChangeOffset(elements, "10", 630.0);
02254                 SnapPointsPageChangeOffset(elements, "20", 660.0);
02255                 SnapPointsPageChangeOffset(elements, "10", 660.0);
02256                 SnapPointsPageChangeOffset(elements, "20", 690.0);
02257                 SnapPointsPageChangeOffset(elements, "8", 690.0);
02258                 SnapPointsPageChangeOffset(elements, "12", 700.0);
02259                 SnapPointsPageChangeOffset(elements, "10", 700.0);
02260                 SnapPointsPageChangeOffset(elements, "20", 730.0);
02261                 SnapPointsPageChangeOffset(elements, "10", 730.0);
02262                 SnapPointsPageChangeOffset(elements, "20", 760.0);
02263                 SnapPointsPageChangeOffset(elements, "18", 760.0);
02264                 SnapPointsPageChangeOffset(elements, "22", 780.0);
02265                 SnapPointsPageChangeOffset(elements, "10", 780.0);
02266                 SnapPointsPageChangeOffset(elements, "22", 800.0, 810.0);
02267
02268                 Log.Comment("Returning to the main ScrollPresenter test page");
02269                 TestSetupHelper.GoBack();
02270             }
02271         }
02272
02273         [TestMethod]
02274         [TestProperty("Description", "Apply a mix of mandatory and optional snap points which are defined to have the same value and scroll precisely between them.")]
02275         public void ChangeOffsetBetweenRepeatedSnapPointsStackedOnTopOfEachOther2()
02276         {
02277             Log.Comment("Selecting ScrollPresenter tests");
02278
02279             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02280             {
02281                 SetOutputDebugStringLevel("Verbose");
02282
02283                 var elements = GoToSnapPointsPage();
02284
02285                 elements.txtOISnapPointValueUIObject.SetValue("780");
02286                 elements.txtOISnapPointRangeUIObject.SetValue("20");
02287                 elements.btnAddOISnapPointUIObject.Invoke();
02288
02289                 elements.txtMRSnapPointOffsetUIObject.SetValue("780");
02290                 elements.txtMRSnapPointIntervalUIObject.SetValue("30");
02291                 elements.txtMRSnapPointStartUIObject.SetValue("780");
02292                 elements.txtMRSnapPointEndUIObject.SetValue("900");
02293                 elements.btnAddMRSnapPointUIObject.Invoke();
02294
02295                 elements.txtMISnapPointValueUIObject.SetValue("900");
02296                 elements.btnAddMISnapPointUIObject.Invoke();
02297
02298                 elements.txtMRSnapPointOffsetUIObject.SetValue("900");
02299                 elements.txtMRSnapPointIntervalUIObject.SetValue("30");
02300                 elements.txtMRSnapPointStartUIObject.SetValue("900");
02301                 elements.txtMRSnapPointEndUIObject.SetValue("1000");
02302                 elements.btnAddMRSnapPointUIObject.Invoke();
02303
02304                 elements.txtMISnapPointValueUIObject.SetValue("1100");
02305                 elements.btnAddMISnapPointUIObject.Invoke();
02306
02307                 SnapPointsPageChangeOffset(elements, "762", 780.0);
02308                 SnapPointsPageChangeOffset(elements, "10", 780.0);
02309                 SnapPointsPageChangeOffset(elements, "20", 810.0);
02310                 SnapPointsPageChangeOffset(elements, "10", 810.0);
02311                 SnapPointsPageChangeOffset(elements, "20", 840.0);
02312                 SnapPointsPageChangeOffset(elements, "10", 840.0);
02313                 SnapPointsPageChangeOffset(elements, "20", 870.0);
02314                 SnapPointsPageChangeOffset(elements, "10", 870.0);
02315                 SnapPointsPageChangeOffset(elements, "20", 900.0);
02316                 SnapPointsPageChangeOffset(elements, "10", 900.0);
02317                 SnapPointsPageChangeOffset(elements, "20", 930.0);
02318                 SnapPointsPageChangeOffset(elements, "65", 990.0);
02319                 SnapPointsPageChangeOffset(elements, "12", 1100.0);
02320                 SnapPointsPageChangeOffset(elements, "10", 1100.0);
02321
02322                 Log.Comment("Returning to the main ScrollPresenter test page");
02323                 TestSetupHelper.GoBack();
02324             }
02325         }
02326
02327         [TestMethod]
02328         [TestProperty("Description", "Apply a mix of mandatory and optional snap points which are defined to have the same value and scroll precisely between them.")]
02329         public void ChangeOffsetBetweenRepeatedSnapPointsStackedOnTopOfEachOther3()
02330         {
02331             Log.Comment("Selecting ScrollPresenter tests");
02332
02333             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02334             {
02335                 SetOutputDebugStringLevel("Verbose");
02336
02337                 var elements = GoToSnapPointsPage();
02338
02339                 elements.txtMISnapPointValueUIObject.SetValue("1100");
02340                 elements.btnAddMISnapPointUIObject.Invoke();
02341
02342                 elements.txtMRSnapPointOffsetUIObject.SetValue("1100");
02343                 elements.txtMRSnapPointIntervalUIObject.SetValue("30");
02344                 elements.txtMRSnapPointStartUIObject.SetValue("1100");
02345                 elements.txtMRSnapPointEndUIObject.SetValue("1200");
02346                 elements.btnAddMRSnapPointUIObject.Invoke();
02347
02348                 elements.txtOISnapPointValueUIObject.SetValue("1200");
02349                 elements.txtOISnapPointRangeUIObject.SetValue("50");
02350                 elements.btnAddOISnapPointUIObject.Invoke();
02351
02352                 SnapPointsPageChangeOffset(elements, "12", 1100.0);
02353                 SnapPointsPageChangeOffset(elements, "10", 1100.0);
02354                 SnapPointsPageChangeOffset(elements, "20", 1130.0);
02355                 SnapPointsPageChangeOffset(elements, "10", 1130.0);
02356                 SnapPointsPageChangeOffset(elements, "20", 1160.0);
02357                 SnapPointsPageChangeOffset(elements, "10", 1160.0);
02358                 SnapPointsPageChangeOffset(elements, "20", 1190.0);
02359                 SnapPointsPageChangeOffset(elements, "8", 1190.0);
02360                 SnapPointsPageChangeOffset(elements, "15", 1200.0);
02361                 SnapPointsPageChangeOffset(elements, "45", 1200.0);
02362                 SnapPointsPageChangeOffset(elements, "60", 1250.0, 1300.0);
02363
02364                 Log.Comment("Returning to the main ScrollPresenter test page");
02365                 TestSetupHelper.GoBack();
02366             }
02367         }
02368
02369         [TestMethod]
02370         [TestProperty("Description", "Apply a mix of mandatory and optional snap points which are defined to have the same value and scroll precisely between them.")]
02371         public void ChangeOffsetBetweenSnapPointsStackedOnTopOfEachOther()
02372         {
02373             Log.Comment("Selecting ScrollPresenter tests");
02374
02375             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02376             {
02377                 SetOutputDebugStringLevel("Verbose");
02378
02379                 var elements = GoToSnapPointsPage();
02380
02381                 elements.txtMISnapPointValueUIObject.SetValue("100");
02382                 elements.btnAddMISnapPointUIObject.Invoke();
02383                 elements.txtOISnapPointValueUIObject.SetValue("100");
02384                 elements.txtOISnapPointRangeUIObject.SetValue("20");
02385                 elements.btnAddOISnapPointUIObject.Invoke();
02386
02387                 elements.txtMISnapPointValueUIObject.SetValue("200");
02388                 elements.btnAddMISnapPointUIObject.Invoke();
02389                 elements.txtMISnapPointValueUIObject.SetValue("200");
02390                 elements.btnAddMISnapPointUIObject.Invoke();
02391
02392                 elements.txtOISnapPointValueUIObject.SetValue("300");
02393                 elements.txtOISnapPointRangeUIObject.SetValue("20");
02394                 elements.btnAddOISnapPointUIObject.Invoke();
02395                 elements.txtOISnapPointValueUIObject.SetValue("300");
02396                 elements.txtOISnapPointRangeUIObject.SetValue("30");
02397                 elements.btnAddOISnapPointUIObject.Invoke();
02398
02399                 elements.txtOISnapPointValueUIObject.SetValue("400");
02400                 elements.txtOISnapPointRangeUIObject.SetValue("30");
02401                 elements.btnAddOISnapPointUIObject.Invoke();
02402                 elements.txtOISnapPointValueUIObject.SetValue("400");
02403                 elements.txtOISnapPointRangeUIObject.SetValue("20");
02404                 elements.btnAddOISnapPointUIObject.Invoke();
02405
02406                 elements.txtOISnapPointValueUIObject.SetValue("500");
02407                 elements.txtOISnapPointRangeUIObject.SetValue("50");
02408                 elements.btnAddOISnapPointUIObject.Invoke();
02409                 elements.txtOISnapPointValueUIObject.SetValue("500");
02410                 elements.txtOISnapPointRangeUIObject.SetValue("50");
02411                 elements.btnAddOISnapPointUIObject.Invoke();
02412
02413                 SnapPointsPageChangeOffset(elements, "10", 100.0);
02414                 SnapPointsPageChangeOffset(elements, "10", 100.0);
02415                 SnapPointsPageChangeOffset(elements, "45", 100.0);
02416                 SnapPointsPageChangeOffset(elements, "55", 200.0);
02417                 SnapPointsPageChangeOffset(elements, "45", 200.0);
02418                 SnapPointsPageChangeOffset(elements, "75", 300.0);
02419                 SnapPointsPageChangeOffset(elements, "10", 300.0);
02420                 SnapPointsPageChangeOffset(elements, "25", 300.0);
02421                 SnapPointsPageChangeOffset(elements, "50", 330.0, 370.0);
02422                 SnapPointsPageChangeOffset(elements, "25", 400.0);
02423                 SnapPointsPageChangeOffset(elements, "10", 400.0);
02424                 SnapPointsPageChangeOffset(elements, "25", 400.0);
02425                 SnapPointsPageChangeOffset(elements, "35", 430.0, 450.0);
02426                 SnapPointsPageChangeOffset(elements, "25", 500.0);
02427                 SnapPointsPageChangeOffset(elements, "25", 500.0);
02428                 SnapPointsPageChangeOffset(elements, "60", 550.0, 600.0);
02429
02430                 Log.Comment("Returning to the main ScrollPresenter test page");
02431                 TestSetupHelper.GoBack();
02432             }
02433         }
02434
02435         [TestMethod]
02436         [TestProperty("Description", "Apply a single optional repeated snap point across the extent and pan within it.")]
02437         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
02438         public void PanWithinARepeatedOptionalSnapPoint()
02439         {
02440             Log.Comment("Selecting ScrollPresenter tests");
02441
02442             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02443             {
02444                 SetOutputDebugStringLevel("Verbose");
02445
02446                 var elements = GoToSnapPointsPage();
02447
02448                 Verify.IsTrue(PanUntilInputWorks(elements.scrollPresenterOffset, elements.scrollPresenterUIObject), "Pan inputs aren't moving the scrollPresenter...");
02449
02450                 elements.txtORSnapPointOffsetUIObject.SetValue("0");
02451                 elements.txtORSnapPointIntervalUIObject.SetValue("100");
02452                 elements.txtORSnapPointStartUIObject.SetValue("0");
02453                 elements.txtORSnapPointEndUIObject.SetValue("9000");
02454                 elements.txtORSnapPointRangeUIObject.SetValue("25");
02455                 elements.btnAddORSnapPointUIObject.Invoke();
02456
02457                 InputHelper.Tap(elements.scrollPresenterUIObject);
02458
02459                 InputHelper.Pan(elements.scrollPresenterUIObject, 25, Direction.North);
02460                 WaitForOptionalRepeatedOffsetUpdated(elements.scrollPresenterOffset, 25, 100);
02461                 PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
02462
02463                 InputHelper.Pan(elements.scrollPresenterUIObject, 75, Direction.North);
02464                 WaitForOptionalRepeatedOffsetUpdated(elements.scrollPresenterOffset, 25, 100);
02465                 PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
02466
02467                 InputHelper.Pan(elements.scrollPresenterUIObject, 150, Direction.North);
02468                 WaitForOptionalRepeatedOffsetUpdated(elements.scrollPresenterOffset, 25, 100);
02469                 PanToZero(elements.scrollPresenterUIObject, elements.scrollPresenterOffset);
02470
02471                 InputHelper.Pan(elements.scrollPresenterUIObject, 200, Direction.North);
02472                 WaitForOptionalRepeatedOffsetUpdated(elements.scrollPresenterOffset, 25, 100);
02473
02474                 Log.Comment("Returning to the main ScrollPresenter test page");
02475                 TestSetupHelper.GoBack();
02476             }
02477         }
02478
02479         [TestMethod]
02480         [TestProperty("Description", "Apply a mix of mandatory and optional snap points and scroll precisely between them.")]
02481         public void ChangeOffsetWithSnapPoints()
02482         {
02483             Log.Comment("Selecting ScrollPresenter tests");
02484
02485             using (var setup = new TestSetupHelper("ScrollPresenter Tests"))
02486             {
02487                 SetOutputDebugStringLevel("Verbose");
02488
02489                 var elements = GoToSnapPointsPage();
02490
02491                 Log.Comment("Retrieving btnOffsetPlus10With");
02492                 Button btnOffsetPlus10WithUIObject = new Button(FindElement.ByName("btnOffsetPlus10With"));
02493
02494                 Log.Comment("Retrieving btnOffsetPlus10Without");
02495                 Button btnOffsetPlus10WithoutUIObject = new Button(FindElement.ByName("btnOffsetPlus10Without"));
02496
02497                 elements.txtOISnapPointValueUIObject.SetValue("50");
02498                 elements.txtOISnapPointRangeUIObject.SetValue("45");
02499                 elements.btnAddOISnapPointUIObject.Invoke();
02500
02501                 elements.txtOISnapPointValueUIObject.SetValue("100");
02502                 elements.txtOISnapPointRangeUIObject.SetValue("50");
02503                 elements.btnAddOISnapPointUIObject.Invoke();
02504
02505                 elements.txtOISnapPointValueUIObject.SetValue("101");
02506                 elements.txtOISnapPointRangeUIObject.SetValue("8");
02507                 elements.btnAddOISnapPointUIObject.Invoke();
02508
02509                 Wait.ForIdle();
02510                 btnOffsetPlus10WithoutUIObject.Invoke();
02511                 WaitForOffsetUpdated(elements.scrollPresenterOffset, 10.0);
02512
02513                 Wait.ForIdle();
02514                 btnOffsetPlus10WithUIObject.Invoke();
02515                 WaitForOffsetUpdated(elements.scrollPresenterOffset, 50.0);
02516
02517                 Wait.ForIdle();
02518                 btnOffsetPlus10WithUIObject.Invoke();
02519                 WaitForOffsetUpdated(elements.scrollPresenterOffset, 50.0);
02520
02521                 Wait.ForIdle();
02522                 btnOffsetPlus10WithoutUIObject.Invoke();
02523                 WaitForOffsetUpdated(elements.scrollPresenterOffset, 60.0);
02524
02525                 Wait.ForIdle();
02526                 btnOffsetPlus10WithoutUIObject.Invoke();
02527                 WaitForOffsetUpdated(elements.scrollPresenterOffset, 70.0);
02528
02529                 Wait.ForIdle();
02530                 btnOffsetPlus10WithUIObject.Invoke();
02531                 WaitForOffsetUpdated(elements.scrollPresenterOffset, 100.0);
02532
02533                 Wait.ForIdle();
02534                 btnOffsetPlus10WithUIObject.Invoke();
02535                 WaitForOffsetUpdated(elements.scrollPresenterOffset, 110.0);
02536
02537                 SetLoggingLevel(isPrivateLoggingEnabled: false);
02538
02539                 Log.Comment("Returning to the main ScrollPresenter test page");
02540                 TestSetupHelper.GoBack();
02541             }
02542         }
02543
02544         private void SnapPointsPageChangeOffset(ScrollSnapPointsTestPageElements elements, String amount, double minValue, double maxValue)
02545         {
02546             Log.Comment("SnapPointsPageChangeOffset with amount: " + amount + ", minValue: " + minValue + ", maxValue: " + maxValue);
02547
02548             elements.scrollPresenterOffsetChangeAmount.SetValue(amount);
02549             elements.changeScrollPresenterOffset.Invoke();
02550             WaitForOffsetUpdated(minValue, maxValue, elements.scrollPresenterOffset);
02551         }
02552 #endif
02553
02554         private void SnapPointsPageChangeOffset(ScrollSnapPointsTestPageElements elements, String amount, double value)
02555         {
02556             Log.Comment("SnapPointsPageChangeOffset with amount: " + amount + ", value: " + value);
02557
02558             elements.scrollPresenterOffsetChangeAmount.SetValue(amount);
02559             elements.changeScrollPresenterOffset.Invoke();
02560             WaitForOffsetUpdated(elements.scrollPresenterOffset, value);
02561         }
02562
02563         private void GoToSimpleContentsPage()
02564         {
02565             Log.Comment("Navigating to ScrollPresentersWithSimpleContentsPage");
02566             UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
02567             Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
02568
02569             Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
02570             navigateToSimpleContentsButton.Invoke();
02571             Wait.ForIdle();
02572         }
02573
02574         private void GoToChainingAndRailingPage()
02575         {
02576             Log.Comment("Navigating to ScrollPresenterChainingAndRailingPage");
02577             UIObject navigateToChainingAndRailingUIObject = FindElement.ByName("navigateToChainingAndRailing");
02578             Verify.IsNotNull(navigateToChainingAndRailingUIObject, "Verifying that navigateToChainingAndRailing Button was found");
02579
02580             Button navigateToChainingAndRailingButton = new Button(navigateToChainingAndRailingUIObject);
02581             navigateToChainingAndRailingButton.Invoke();
02582             Wait.ForIdle();
02583         }
02584
02585         private void GoToManipulationModePage()
02586         {
02587             Log.Comment("Navigating to ScrollPresenterManipulationModePage");
02588             UIObject navigateToManipulationModeUIObject = FindElement.ByName("navigateToManipulationMode");
02589             Verify.IsNotNull(navigateToManipulationModeUIObject, "Verifying that navigateToManipulationMode Button was found");
02590
02591             Button navigateToManipulationModeButton = new Button(navigateToManipulationModeUIObject);
02592             navigateToManipulationModeButton.Invoke();
02593             Wait.ForIdle();
02594         }
02595
02596         private ScrollSnapPointsTestPageElements GoToScrollSnapPointsPage()
02597         {
02598             Log.Comment("Navigating to ScrollSnapPointsPage");
02599             UIObject navigateToScrollSnapPointsUIObject = FindElement.ByName("navigateToScrollSnapPoints");
02600             Verify.IsNotNull(navigateToScrollSnapPointsUIObject, "Verifying that navigateToScrollSnapPoints Button was found");
02601
02602             Button navigateToScrollSnapPointsButton = new Button(navigateToScrollSnapPointsUIObject);
02603             navigateToScrollSnapPointsButton.Invoke();
02604             Wait.ForIdle();
02605
02606             return GatherScrollSnapPointsTestPageElements();
02607         }
02608
02609         private int WaitForOffsetUpdated(
02610             Edit text,
02611             double expected,
02612             double modulo = double.PositiveInfinity,
02613             double alternateMin = double.PositiveInfinity,
02614             double alternateMax = double.PositiveInfinity,
02615             double millisecondsTimeout = defaultAnimatedViewChangeTimeout,
02616             bool failOnError = true)
02617         {
02618             return WaitForOffsetUpdated(
02619                 expected,
02620                 expected,
02621                 text,
02622                 alternateMin,
02623                 alternateMax,
02624                 modulo,
02625                 millisecondsTimeout,
02626                 failOnError);
02627         }
02628
02629         private int WaitForOffsetUpdated(
02630             double expectedMin,
02631             double expectedMax,
02632             Edit text,
02633             double alternateMin = double.PositiveInfinity,
02634             double alternateMax = double.PositiveInfinity,
02635             double modulo = double.PositiveInfinity,
02636             double millisecondsTimeout = defaultAnimatedViewChangeTimeout,
02637             bool failOnError = true)
02638         {
02639             Log.Comment("WaitForOffsetUpdated with expectedMin: " + expectedMin + ", expectedMax: " + expectedMax);
02640
02641             int warningCount = 0;
02642             bool success = WaitForOffsetToSettle(text, millisecondsTimeout, failOnError);
02643             double value = Convert.ToDouble(text.Value) % modulo;
02644             bool goodValue = false;
02645             if (value >= expectedMin && value <= expectedMax)
02646             {
02647                 goodValue = true;
02648             }
02649             else if (value >= alternateMin && value <= alternateMax)
02650             {
02651                 Log.Warning("Passing based on alternate value, this should be relatively rare.");
02652                 warningCount++;
02653                 goodValue = true;
02654             }
02655             Verify.IsTrue(goodValue);
02656             return warningCount;
02657         }
02658
02659 #if ApplicableRangeType
02660         private void WaitForOptionalRepeatedOffsetUpdated(
02661             Edit text,
02662             double range,
02663             double interval,
02664             double millisecondsTimeout = defaultAnimatedViewChangeTimeout,
02665             bool failOnError = true)
02666         {
02667             bool success = WaitForOffsetToSettle(text, millisecondsTimeout, failOnError);
02668             Log.Comment("Final Offset value: " + text.Value);
02669             double valueModuloInterval = Convert.ToDouble(text.Value) % interval;
02670             Log.Comment("Final Offset value modulo interval " + interval + ": " + valueModuloInterval);
02671             Verify.IsTrue((valueModuloInterval > range && valueModuloInterval < interval - range) || valueModuloInterval == 0.0);
02672         }
02673 #endif
02674
02675         private bool WaitForOffsetToSettle(Edit text, double millisecondsTimeout, bool failOnError)
02676         {
02677             Wait.ForIdle();
02678
02679             const double millisecondsNormalStepTimeout = 100;
02680             const double millisecondsIdleStepTimeout = 600;
02681             Edit elementStateTextBox = new Edit(FindElement.ById("txtScrollPresenterState"));
02682             ValueChangedEventWaiter waiter = new ValueChangedEventWaiter(text);
02683             int unsuccessfulWaits = 0;
02684             int maxUnsuccessfulWaits = (int)(millisecondsIdleStepTimeout / millisecondsNormalStepTimeout);
02685
02686             Log.Comment("Original State: " + elementStateTextBox.Value);
02687             Log.Comment("Original Offset: " + text.Value);
02688
02689             // When the initial State is still Idle, use a longer timeout to allow it to transition out of Idle.
02690             double millisecondsWait = (elementStateTextBox.Value == "Idle") ? millisecondsIdleStepTimeout : millisecondsNormalStepTimeout;
02691             double millisecondsCumulatedWait = 0;
02692
02693             do
02694             {
02695                 Log.Comment("Waiting for Offset change.");
02696                 waiter.Reset();
02697                 if (waiter.TryWait(TimeSpan.FromMilliseconds(millisecondsWait)))
02698                 {
02699                     unsuccessfulWaits = 0;
02700                 }
02701                 else
02702                 {
02703                     unsuccessfulWaits++;
02704                 }
02705                 millisecondsCumulatedWait += millisecondsWait;
02706                 millisecondsWait = millisecondsNormalStepTimeout;
02707
02708                 Log.Comment("Current State: " + elementStateTextBox.Value);
02709                 Log.Comment("Current Offset: " + text.Value);
02710
02711                 Wait.ForIdle();
02712             }
02713             while (elementStateTextBox.Value != "Idle" &&
02714                    millisecondsCumulatedWait < millisecondsTimeout &&
02715                    unsuccessfulWaits <= maxUnsuccessfulWaits);
02716
02717             if (elementStateTextBox.Value == "Idle")
02718             {
02719                 Log.Comment("Idle State reached after " + millisecondsCumulatedWait + " out of " + millisecondsTimeout + " milliseconds. Final Offset: " + text.Value);
02720                 return true;
02721             }
02722             else
02723             {
02724                 LogAndClearTraces();
02725                 string message = unsuccessfulWaits > maxUnsuccessfulWaits ?
02726                     "Offset has not changed within " + millisecondsIdleStepTimeout + " milliseconds outside of Idle State." :
02727                     "Idle State was not reached within " + millisecondsTimeout + " milliseconds.";
02728                 if (failOnError)
02729                 {
02730                     Log.Error(message);
02731                 }
02732                 else
02733                 {
02734                     Log.Warning(message);
02735                 }
02736
02737                 return false;
02738             }
02739         }
02740
02741         private bool PanUntilInputWorks(Edit text, UIObject scrollPresenterUIObject)
02742         {
02743             int tries = 0;
02744             do
02745             {
02746                 InputHelper.Pan(scrollPresenterUIObject, 25, Direction.North);
02747                 WaitForOffsetToSettle(text, millisecondsTimeout: 6000, failOnError: true);
02748                 double value = Convert.ToDouble(text.Value);
02749                 if (value != 0)
02750                 {
02751                     PanToZero(scrollPresenterUIObject, text);
02752                     return true;
02753                 }
02754                 tries++;
02755             }
02756             while (tries < 10);
02757             return false;
02758         }
02759
02760         private void TapResetViewsButton()
02761         {
02762             Log.Comment("Retrieving btnResetViews");
02763             UIObject resetViewsUIObject = FindElement.ByName("btnResetViews");
02764             Verify.IsNotNull(resetViewsUIObject, "Verifying that btnResetViews Button was found");
02765
02766             Button resetViewsButton = new Button(resetViewsUIObject);
02767             InputHelper.Tap(resetViewsButton);
02768             if (!WaitForEditValue(editName: "txtResetStatus", editValue: "Views reset", secondsTimeout: 2.0, throwOnError: false))
02769             {
02770                 InputHelper.Tap(resetViewsButton);
02771                 WaitForEditValue(editName: "txtResetStatus", editValue: "Views reset");
02772             }
02773         }
02774
02775         private void GetScrollPresenterContentLayoutOffset(out double contentLayoutOffsetX, out double contentLayoutOffsetY)
02776         {
02777             contentLayoutOffsetX = 0.0;
02778             contentLayoutOffsetY = 0.0;
02779
02780             UIObject viewUIObject = FindElement.ById("txtScrollPresenterContentLayoutOffsetX");
02781             Edit viewTextBox = new Edit(viewUIObject);
02782             Log.Comment($"Current ContentLayoutOffsetX: {viewTextBox.Value}");
02783             contentLayoutOffsetX = String.IsNullOrWhiteSpace(viewTextBox.Value) ? double.NaN : Convert.ToDouble(viewTextBox.Value);
02784
02785             viewUIObject = FindElement.ById("txtScrollPresenterContentLayoutOffsetY");
02786             viewTextBox = new Edit(viewUIObject);
02787             Log.Comment($"Current ContentLayoutOffsetY: {viewTextBox.Value}");
02788             contentLayoutOffsetY = String.IsNullOrWhiteSpace(viewTextBox.Value) ? double.NaN : Convert.ToDouble(viewTextBox.Value);
02789         }
02790
02791         private void GetScrollPresenterView(out double horizontalOffset, out double verticalOffset, out float zoomFactor)
02792         {
02793             horizontalOffset = 0.0;
02794             verticalOffset = 0.0;
02795             zoomFactor = 1.0f;
02796
02797             UIObject viewUIObject = FindElement.ById("txtScrollPresenterHorizontalOffset");
02798             Edit viewTextBox = new Edit(viewUIObject);
02799             Log.Comment("Current HorizontalOffset: " + viewTextBox.Value);
02800             horizontalOffset = String.IsNullOrWhiteSpace(viewTextBox.Value) ? double.NaN : Convert.ToDouble(viewTextBox.Value);
02801
02802             viewUIObject = FindElement.ById("txtScrollPresenterVerticalOffset");
02803             viewTextBox = new Edit(viewUIObject);
02804             Log.Comment("Current VerticalOffset: " + viewTextBox.Value);
02805             verticalOffset = String.IsNullOrWhiteSpace(viewTextBox.Value) ? double.NaN : Convert.ToDouble(viewTextBox.Value);
02806
02807             viewUIObject = FindElement.ById("txtScrollPresenterZoomFactor");
02808             viewTextBox = new Edit(viewUIObject);
02809             Log.Comment("Current ZoomFactor: " + viewTextBox.Value);
02810             zoomFactor = String.IsNullOrWhiteSpace(viewTextBox.Value) ? float.NaN : Convert.ToSingle(viewTextBox.Value);
02811         }
02812
02813         private void PrepareForScrollPresenterManipulationStart(string scrollPresenterName, string stateTextBoxName = "txtScrollPresenterState")
02814         {
02815             UIObject scrollPresenterStateUIObject = FindElement.ById(stateTextBoxName);
02816             Edit scrollPresenterStateTextBox = new Edit(scrollPresenterStateUIObject);
02817             Log.Comment("Pre-manipulation ScrollPresenterState: " + scrollPresenterStateTextBox.Value);
02818             Wait.ForIdle();
02819         }
02820
02821         private void WaitForScrollPresenterManipulationEnd(string scrollPresenterName, string stateTextBoxName = "txtScrollPresenterState")
02822         {
02823             WaitForManipulationEnd(scrollPresenterName, stateTextBoxName);
02824         }
02825
02826         private bool TryWaitForScrollPresenterManipulationEnd(string scrollPresenterName, string stateTextBoxName = "txtScrollPresenterState")
02827         {
02828             return WaitForManipulationEnd(scrollPresenterName, stateTextBoxName, failOnError: false);
02829         }
02830
02831         private void PrepareForScrollViewerManipulationStart(string stateTextBoxName = "txtScrollViewerState")
02832         {
02833             UIObject scrollViewerStateUIObject = FindElement.ById(stateTextBoxName);
02834             Edit scrollViewerStateTextBox = new Edit(scrollViewerStateUIObject);
02835             Log.Comment("Pre-manipulation ScrollViewerState: " + scrollViewerStateTextBox.Value);
02836             Wait.ForIdle();
02837         }
02838
02839         private void WaitForScrollViewerManipulationEnd(string scrollViewerName, string stateTextBoxName = "txtScrollViewerState")
02840         {
02841             WaitForManipulationEnd(scrollViewerName, stateTextBoxName);
02842         }
02843
02844         private bool WaitForManipulationEnd(string elementName, string stateTextBoxName, bool failOnError = true, bool logTraces = true)
02845         {
02846             UIObject elementStateUIObject = FindElement.ById(stateTextBoxName);
02847             Edit elementStateTextBox = new Edit(elementStateUIObject);
02848             Log.Comment("Current State: " + elementStateTextBox.Value);
02849             if (elementStateTextBox.Value != elementName + " Idle")
02850             {
02851                 using (var waiter = new ValueChangedEventWaiter(elementStateTextBox, elementName + " Idle"))
02852                 {
02853                     int loops = 0;
02854
02855                     Log.Comment("Waiting for " + elementName + "'s manipulation end.");
02856                     while (true)
02857                     {
02858                         bool success = waiter.TryWait(TimeSpan.FromMilliseconds(250));
02859
02860                         Log.Comment("Current State: " + elementStateTextBox.Value);
02861
02862                         if (success)
02863                         {
02864                             Log.Comment("Wait succeeded");
02865                             break;
02866                         }
02867                         else
02868                         {
02869                             if (elementStateTextBox.Value == elementName + " Idle")
02870                             {
02871                                 Log.Warning("Wait failed but TextBox contains expected text");
02872                                 if (logTraces)
02873                                 {
02874                                     LogAndClearTraces();
02875                                 }
02876                                 break;
02877                             }
02878                             else if (loops < 20)
02879                             {
02880                                 loops++;
02881                                 waiter.Reset();
02882                             }
02883                             else
02884                             {
02885                                 if (logTraces)
02886                                 {
02887                                     LogAndClearTraces();
02888                                 }
02889                                 string message = "Wait for manipulation end failed";
02890                                 if (failOnError)
02891                                 {
02892                                     Log.Error(message);
02893                                 }
02894                                 else
02895                                 {
02896                                     Log.Warning(message);
02897                                 }
02898                                 return false;
02899                             }
02900                         }
02901                     }
02902                 }
02903             }
02904             return true;
02905         }
02906
02907         private void WaitForScrollPresenterFinalSize(UIObject scrollPresenterUIObject, double expectedWidth, double expectedHeight)
02908         {
02909             int pauses = 0;
02910             int widthDelta = Math.Abs(scrollPresenterUIObject.BoundingRectangle.Width - (int)expectedWidth);
02911             int heightDelta = Math.Abs(scrollPresenterUIObject.BoundingRectangle.Height - (int)expectedHeight);
02912
02913             Log.Comment("scrollPresenterUIObject.BoundingRectangle={0}", scrollPresenterUIObject.BoundingRectangle);
02914
02915             while ((widthDelta > 1 || heightDelta > 1) && pauses < 5)
02916             {
02917                 Wait.ForMilliseconds(60);
02918                 pauses++;
02919                 Log.Comment("scrollPresenterUIObject.BoundingRectangle={0}", scrollPresenterUIObject.BoundingRectangle);
02920                 widthDelta = Math.Abs(scrollPresenterUIObject.BoundingRectangle.Width - (int)expectedWidth);
02921                 heightDelta = Math.Abs(scrollPresenterUIObject.BoundingRectangle.Height - (int)expectedHeight);
02922             };
02923
02924             Verify.IsLessThanOrEqual(widthDelta, 1);
02925             Verify.IsLessThanOrEqual(heightDelta, 1);
02926         }
02927
02928         private void PanToZero(UIObject scrollPresenterUIObject, Edit text, int maxTries = 10)
02929         {
02930             Log.Comment("Panning ScrollPresenter to reset its offset.");
02931             int tries = 0;
02932             do
02933             {
02934                 InputHelper.Pan(scrollPresenterUIObject, Math.Max((int) Convert.ToDouble(text.Value) / 2, 25), Direction.South);
02935                 WaitForOffsetToSettle(text, millisecondsTimeout: defaultAnimatedViewChangeTimeout, failOnError: false);
02936                 tries++;
02937             }
02938             while (Convert.ToDouble(text.Value) != 0.0 && tries < maxTries);
02939             Verify.AreEqual(0.0, Convert.ToDouble(text.Value));
02940         }
02941
02942         private ScrollSnapPointsTestPageElements GatherScrollSnapPointsTestPageElements()
02943         {
02944             Log.Comment("GatherScrollSnapPointsTestPageElements - entry");
02945             var elements = new ScrollSnapPointsTestPageElements();
02946
02947             elements.btnAddMISnapPointUIObject = new Button(FindElement.ByName("btnMIAddSnapPoint"));
02948             elements.txtMISnapPointValueUIObject = new Edit(FindElement.ByName("txtMISnapPointValue"));
02949             elements.cmbMISnapPointAlignment = new ComboBox(FindElement.ByName("cmbMISnapPointAlignment"));
02950
02951 #if ApplicableRangeType
02952             elements.btnAddOISnapPointUIObject = new Button(FindElement.ByName("btnOIAddSnapPoint"));
02953             elements.txtOISnapPointValueUIObject = new Edit(FindElement.ByName("txtOISnapPointValue"));
02954             elements.txtOISnapPointRangeUIObject = new Edit(FindElement.ByName("txtOIApplicableRange"));
02955 #endif
02956
02957             elements.btnAddMRSnapPointUIObject = new Button(FindElement.ByName("btnMRAddSnapPoint"));
02958             elements.txtMRSnapPointOffsetUIObject = new Edit(FindElement.ByName("txtMRSnapPointOffset"));
02959             elements.txtMRSnapPointIntervalUIObject = new Edit(FindElement.ByName("txtMRSnapPointInterval"));
02960             elements.txtMRSnapPointStartUIObject = new Edit(FindElement.ByName("txtMRSnapPointStart"));
02961             elements.txtMRSnapPointEndUIObject = new Edit(FindElement.ByName("txtMRSnapPointEnd"));
02962             elements.cmbMRSnapPointAlignment = new ComboBox(FindElement.ByName("cmbMRSnapPointAlignment"));
02963
02964 #if ApplicableRangeType
02965             elements.btnAddORSnapPointUIObject = new Button(FindElement.ByName("btnORAddSnapPoint"));
02966             elements.txtORSnapPointOffsetUIObject = new Edit(FindElement.ByName("txtORSnapPointOffset"));
02967             elements.txtORSnapPointIntervalUIObject = new Edit(FindElement.ByName("txtORSnapPointInterval"));
02968             elements.txtORSnapPointStartUIObject = new Edit(FindElement.ByName("txtORSnapPointStart"));
02969             elements.txtORSnapPointEndUIObject = new Edit(FindElement.ByName("txtORSnapPointEnd"));
02970             elements.txtORSnapPointRangeUIObject = new Edit(FindElement.ByName("txtORApplicableRange"));
02971 #endif
02972
02973             elements.scrollPresenterUIObject = FindElement.ByName("markupScrollPresenter");
02974             Verify.IsNotNull(elements.scrollPresenterUIObject, "Verifying that markupScrollPresenter was found");
02975
02976             elements.scrollPresenterOffset = new Edit(FindElement.ById("txtScrollPresenterOffset"));
02977             elements.scrollPresenterOffsetChangeAmount = new Edit(FindElement.ById("txtScrollPresenterOffsetChange"));
02978             elements.changeScrollPresenterOffset = new Button(FindElement.ById("btnScrollPresenterOffsetChange"));
02979
02980             elements.scrollPresenterOffset.SetValue("0");
02981
02982             Log.Comment("GatherScrollSnapPointsTestPageElements - exit");
02983             return elements;
02984         }
02985
02986         private struct ScrollSnapPointsTestPageElements
02987         {
02988             public Button btnAddMISnapPointUIObject;
02989             public Edit txtMISnapPointValueUIObject;
02990             public ComboBox cmbMISnapPointAlignment;
02991
02992 #if ApplicableRangeType
02993             public Button btnAddOISnapPointUIObject;
02994             public Edit txtOISnapPointValueUIObject;
02995             public Edit txtOISnapPointRangeUIObject;
02996 #endif
02997
02998             public Button btnAddMRSnapPointUIObject;
02999             public Edit txtMRSnapPointOffsetUIObject;
03000             public Edit txtMRSnapPointIntervalUIObject;
03001             public Edit txtMRSnapPointStartUIObject;
03002             public Edit txtMRSnapPointEndUIObject;
03003             public ComboBox cmbMRSnapPointAlignment;
03004
03005 #if ApplicableRangeType
03006             public Button btnAddORSnapPointUIObject;
03007             public Edit txtORSnapPointOffsetUIObject;
03008             public Edit txtORSnapPointIntervalUIObject;
03009             public Edit txtORSnapPointStartUIObject;
03010             public Edit txtORSnapPointEndUIObject;
03011             public Edit txtORSnapPointRangeUIObject;
03012 #endif
03013
03014             public UIObject scrollPresenterUIObject;
03015
03016             public Edit scrollPresenterOffset;
03017             public Edit scrollPresenterOffsetChangeAmount;
03018             public Button changeScrollPresenterOffset;
03019         }
03020     }
03021 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/Common/WinRTCollection.cs Source File

  • Repeater
  • APITests
  • Common

WinRTCollection.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections;
00005 using System.Collections.Generic;
00006 using Windows.Foundation.Collections;
00007
00008 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common
00009 {
00010     public class WinRTCollection : IObservableVector<object>
00011     {
00012         private IList<object> m_data;
00013
00014         public WinRTCollection(IEnumerable<object> collection)
00015         {
00016             m_data = new List<object>(collection);
00017         }
00018
00019         public object this[int index]
00020         {
00021             get { return m_data[index]; }
00022             set
00023             {
00024                 m_data[index] = value;
00025                 if (VectorChanged != null) { VectorChanged(this, new VectorChangedEventArgs(CollectionChange.ItemChanged, (uint)index)); }
00026             }
00027         }
00028
00029         public int Count { get { return m_data.Count; } }
00030         public bool IsReadOnly { get { return false; } }
00031
00032         public event VectorChangedEventHandler<object> VectorChanged;
00033
00034         public void Add(object item)
00035         {
00036             m_data.Add(item);
00037             if (VectorChanged != null) { VectorChanged(this, new VectorChangedEventArgs(CollectionChange.ItemInserted, (uint)m_data.Count - 1u)); }
00038         }
00039
00040         public void Clear()
00041         {
00042             m_data.Clear();
00043             if (VectorChanged != null) { VectorChanged(this, new VectorChangedEventArgs(CollectionChange.Reset, 0u)); }
00044         }
00045
00046         public bool Contains(object item)
00047         {
00048             return m_data.Contains(item);
00049         }
00050
00051         public void CopyTo(object[] array, int arrayIndex)
00052         {
00053             m_data.CopyTo(array, arrayIndex);
00054         }
00055
00056         public IEnumerator<object> GetEnumerator()
00057         {
00058             return m_data.GetEnumerator();
00059         }
00060
00061         public int IndexOf(object item)
00062         {
00063             return m_data.IndexOf(item);
00064         }
00065
00066         public void Insert(int index, object item)
00067         {
00068             m_data.Insert(index, item);
00069             if (VectorChanged != null) { VectorChanged(this, new VectorChangedEventArgs(CollectionChange.ItemInserted, (uint)index)); }
00070         }
00071
00072         public bool Remove(object item)
00073         {
00074             var index = (uint)m_data.IndexOf(item);
00075             if (m_data.Remove(item))
00076             {
00077                 if (VectorChanged != null) { VectorChanged(this, new VectorChangedEventArgs(CollectionChange.ItemRemoved, index)); }
00078                 return true;
00079             }
00080
00081             return false;
00082         }
00083
00084         public void RemoveAt(int index)
00085         {
00086             m_data.RemoveAt(index);
00087             if (VectorChanged != null) { VectorChanged(this, new VectorChangedEventArgs(CollectionChange.ItemRemoved, (uint)index)); }
00088         }
00089
00090         IEnumerator IEnumerable.GetEnumerator()
00091         {
00092             return m_data.GetEnumerator();
00093         }
00094
00095         public void Reset()
00096         {
00097             if (VectorChanged != null) { VectorChanged(this, new VectorChangedEventArgs(CollectionChange.Reset, 0)); }
00098         }
00099
00100         public void ResetWith(IEnumerable<object> enumerable)
00101         {
00102             m_data = new List<object>(enumerable);
00103             Reset();
00104         }
00105
00106         private class VectorChangedEventArgs : IVectorChangedEventArgs
00107         {
00108             public CollectionChange CollectionChange { get; private set; }
00109             public uint Index { get; private set; }
00110
00111             public VectorChangedEventArgs(CollectionChange change, uint index)
00112             {
00113                 CollectionChange = change;
00114                 Index = index;
00115             }
00116         }
00117     }
00118 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TintEffect Member List

This is the complete list of members for TintEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1Tint) | TintEffect |
DECLARE_NAMED_PROPERTY_MAPPING({L"Color", D2D1_TINT_PROP_COLOR, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4},{L"ClampOutput", D2D1_TINT_PROP_CLAMP_OUTPUT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT}) | TintEffect |
DECLARE_POD_PROPERTY(Color, UIColor,(UIColor{255, 255, 255, 255}), true) | TintEffect |
DECLARE_POD_PROPERTY(ClampOutput, bool, false, true) | TintEffect |
DECLARE_SINGLE_SOURCE(Source) | TintEffect |
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | TintEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | TintEffect | [inline]
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MyItem Member List

This is the complete list of members for MyItem, including all inherited members.
Height | MyItem
Label | MyItem
Generated on Sun Dec 1 2024 20:54:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

XamlType Member List

This is the complete list of members for XamlType, including all inherited members.
ActivateInstance() | XamlTypeBase |
AddDPMember(wstring_view const &name, wstring_view const &memberTypeName, winrt::DependencyProperty const &dp, bool isContent) | XamlTypeBase |
AddMember(wstring_view const &name, wstring_view const &memberTypeName, std::function< winrt::IInspectable(const winrt::IInspectable &)> getter, std::function< void(const winrt::IInspectable &, const winrt::IInspectable &)> setter, bool isContent, bool isDependencyProperty, bool isAttachable) | XamlTypeBase |
AddToMap(winrt::IInspectable const &instance, winrt::IInspectable const &key, winrt::IInspectable const &value) | XamlTypeBase |
AddToVector(winrt::IInspectable const &instance, winrt::IInspectable const &value) | XamlTypeBase |
BaseType() | XamlTypeBase |
BoxedType() | XamlTypeBase |
ContentProperty() | XamlTypeBase |
CreateFromString(winrt::hstring const &value) | XamlTypeBase |
FullName() | XamlTypeBase |
GetMember(winrt::hstring const &name) | XamlTypeBase |
IsArray() | XamlTypeBase |
IsBindable() | XamlTypeBase |
IsCollection() | XamlTypeBase |
IsConstructible() | XamlTypeBase |
IsDictionary() | XamlTypeBase |
IsMarkupExtension() | XamlTypeBase |
ItemType() | XamlTypeBase |
KeyType() | XamlTypeBase |
m_activator | XamlTypeBase | [protected]
m_addToMap | XamlTypeBase | [protected]
m_collectionAdd | XamlTypeBase | [protected]
m_contentProperty | XamlTypeBase | [protected]
m_createFromString | XamlTypeBase | [protected]
m_isBindable | XamlTypeBase | [protected]
m_isSystemType | XamlTypeBase | [protected]
m_members | XamlTypeBase | [protected]
m_typeName | XamlTypeBase | [protected]
RunInitializer() | XamlTypeBase |
SetAddToMapFunc(std::function< void(winrt::IInspectable const &, winrt::IInspectable const &, winrt::IInspectable const &)> addToMap) | XamlType |
SetCollectionAddFunc(std::function< void(winrt::IInspectable const &, winrt::IInspectable const &)> collectionAdd) | XamlType |
SetIsBindable(bool isBindable) | XamlType |
UnderlyingType() | XamlTypeBase |
XamlType(wstring_view const &typeName, wstring_view const &baseTypeName, std::function< winrt::IInspectable()> activator, std::function< void(XamlTypeBase &)> populatePropertiesFunc) | XamlType |
Generated on Sun Dec 1 2024 20:53:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TreeViewNode.properties.h Source File

  • Generated

TreeViewNode.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class TreeViewNodeProperties
00008 {
00009 public:
00010     TreeViewNodeProperties();
00011
00012     void Content(winrt::IInspectable const& value);
00013     winrt::IInspectable Content();
00014
00015     void Depth(int value);
00016     int Depth();
00017
00018     void HasChildren(bool value);
00019     bool HasChildren();
00020
00021     void IsExpanded(bool value);
00022     bool IsExpanded();
00023
00024     static winrt::DependencyProperty ContentProperty() { return s_ContentProperty; }
00025     static winrt::DependencyProperty DepthProperty() { return s_DepthProperty; }
00026     static winrt::DependencyProperty HasChildrenProperty() { return s_HasChildrenProperty; }
00027     static winrt::DependencyProperty IsExpandedProperty() { return s_IsExpandedProperty; }
00028
00029     static GlobalDependencyProperty s_ContentProperty;
00030     static GlobalDependencyProperty s_DepthProperty;
00031     static GlobalDependencyProperty s_HasChildrenProperty;
00032     static GlobalDependencyProperty s_IsExpandedProperty;
00033
00034     static void EnsureProperties();
00035     static void ClearProperties();
00036
00037     static void OnHasChildrenPropertyChanged(
00038         winrt::DependencyObject const& sender,
00039         winrt::DependencyPropertyChangedEventArgs const& args);
00040
00041     static void OnIsExpandedPropertyChanged(
00042         winrt::DependencyObject const& sender,
00043         winrt::DependencyPropertyChangedEventArgs const& args);
00044 };
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/NonvirtualizingLayoutContext.h Source File

  • Repeater

NonvirtualizingLayoutContext.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "LayoutContext.h"
00007 #include "NonVirtualizingLayoutContext.g.h"
00008
00009 class NonVirtualizingLayoutContext :
00010     public winrt::implementation::NonVirtualizingLayoutContextT<NonVirtualizingLayoutContext, LayoutContext>
00011 {
00012 public:
00013 #pragma region INonVirtualizingLayoutContext
00014     winrt::IVectorView<winrt::UIElement> Children();
00015 #pragma endregion
00016
00017 #pragma region INonVirtualizingLayoutContextOverrides
00018     virtual winrt::IVectorView<winrt::UIElement> ChildrenCore();
00019 #pragma endregion
00020
00021     winrt::VirtualizingLayoutContext GetVirtualizingContextAdapter();
00022
00023 private:
00024     winrt::VirtualizingLayoutContext m_contextAdapter{ nullptr };
00025 };
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MapIcon Member List

This is the complete list of members for MapIcon, including all inherited members.
abi_enter() | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
CheckThread() | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
ClearProperties() | MapIconProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< MapIcon > &&self) noexcept | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline, static]
EnsureProperties() | MapIconProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
final_release(std::unique_ptr< MapIcon > &&self) | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline, static]
GetBase() | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
GetInner() | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
IsOnThread() | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
Location(winrt::Geopoint const &value) | MapIconProperties |
Location() | MapIconProperties |
LocationProperty() | MapIconProperties | [inline, static]
MapIcon() | MapIcon |
MapIconProperties() | MapIconProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
OnLocationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | MapIconProperties | [static]
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | MapIcon |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< MapIcon, winrt::implementation::MapIconT, MapElement > | [inline]
s_LocationProperty | MapIconProperties | [static]
Generated on Sun Dec 1 2024 20:52:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarCustomPenButton.properties.h Source File

  • Generated

InkToolBarCustomPenButton.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InkToolBarCustomPenButtonProperties
00008 {
00009 public:
00010     InkToolBarCustomPenButtonProperties();
00011
00012     void ConfigurationContent(winrt::UIElement const& value);
00013     winrt::UIElement ConfigurationContent();
00014
00015     void CustomPen(winrt::InkToolBarCustomPen const& value);
00016     winrt::InkToolBarCustomPen CustomPen();
00017
00018     static winrt::DependencyProperty ConfigurationContentProperty() { return s_ConfigurationContentProperty; }
00019     static winrt::DependencyProperty CustomPenProperty() { return s_CustomPenProperty; }
00020
00021     static GlobalDependencyProperty s_ConfigurationContentProperty;
00022     static GlobalDependencyProperty s_CustomPenProperty;
00023
00024     static void EnsureProperties();
00025     static void ClearProperties();
00026 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/RevealTestApi.cpp Source File

  • Lights

RevealTestApi.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "RevealTestApi.h"
00007 #include "RevealHoverLight.h"
00008 #include "RevealBorderLight.h"
00009
00010 #include "RevealTestApi.properties.cpp"
00011
00012 RevealTestApi::RevealTestApi()
00013 {
00014     MUXControlsFactory::EnsureInitialized(); // Just in case we are called earlier than app initialization.
00015 }
00016
00017 winrt::XamlLight RevealTestApi::GetWindowLightAt(uint32_t i)
00018 {
00019     auto root = winrt::Window::Current() ? winrt::Window::Current().Content() : nullptr;
00020     if (root)
00021     {
00022         // Walk up to find the lights.
00023         auto current = root;
00024         auto parent = current;
00025         do
00026         {
00027             current = parent;
00028             parent = winrt::VisualTreeHelper::GetParent(current).as<winrt::UIElement>();
00029         } while (parent != nullptr);
00030
00031         winrt::XamlLight light = nullptr;
00032         if (auto lights = current.Lights())
00033         {
00034             light = lights.GetAt(i);
00035         }
00036
00037         return light;
00038     }
00039
00040     return nullptr;
00041 }
00042
00043
00044 winrt::SpotLight RevealTestApi::BackgroundLight()
00045 {
00046     return GetBackgroundSpotlightProxy(m_targetTheme);
00047 }
00048
00049 winrt::XamlLight RevealTestApi::BorderLight()
00050 {
00051     return GetWindowLightAt((m_targetTheme == winrt::ApplicationTheme::Light) ? 0 : 2);
00052 }
00053
00054 winrt::XamlLight RevealTestApi::BorderWideLight()
00055 {
00056     return GetWindowLightAt((m_targetTheme == winrt::ApplicationTheme::Light) ? 1 : 3);
00057 }
00058
00059 winrt::ApplicationTheme RevealTestApi::TargetTheme()
00060 {
00061     return m_targetTheme;
00062 }
00063
00064 void RevealTestApi::TargetTheme(winrt::ApplicationTheme const& value)
00065 {
00066     m_targetTheme = value;
00067 }
00068
00069 double RevealTestApi::BackgroundLightMinSize()
00070 {
00071 #if DBG
00072     return RevealHoverLight::s_lightMinSize;
00073 #else
00074     return 0;
00075 #endif
00076 }
00077
00078 void RevealTestApi::BackgroundLightMinSize(double value)
00079 {
00080 #if DBG
00081     RevealHoverLight::s_lightMinSize = (float)value;
00082 #endif
00083 }
00084
00085 double RevealTestApi::BackgroundLightMaxSize()
00086 {
00087 #if DBG
00088     return RevealHoverLight::s_lightMaxSize;
00089 #else
00090     return 0;
00091 #endif
00092 }
00093
00094 void RevealTestApi::BackgroundLightMaxSize(double value)
00095 {
00096 #if DBG
00097     RevealHoverLight::s_lightMaxSize = (float)value;
00098 #endif
00099 }
00100
00101 winrt::SpotLight RevealTestApi::GetSpotLight(winrt::XamlLight const& value)
00102 {
00103     return value.as<winrt::IXamlLightProtected>().CompositionLight().as<winrt::SpotLight>();
00104 }
00105
00106 winrt::ExpressionAnimation RevealTestApi::GetHoverLightOffsetExpression(winrt::RevealHoverLight const& value)
00107 {
00108     return winrt::get_self<RevealHoverLight>(value)->m_offsetAnimation;
00109 }
00110
00111 winrt::RevealBorderLight RevealTestApi::GetAsRevealBorderLight(winrt::XamlLight const& value)
00112 {
00113     return value.as<winrt::RevealBorderLight>();
00114 }
00115
00116 winrt::RevealHoverLight RevealTestApi::GetAsRevealHoverLight(winrt::XamlLight const& value)
00117 {
00118     return value.as<winrt::RevealHoverLight>();
00119 }
00120
00121 bool RevealTestApi::BorderLight_ShouldBeOn(winrt::RevealBorderLight const& value)
00122 {
00123     return winrt::get_self<RevealBorderLight>(value)->GetShouldLightBeOn();
00124 }
00125
00126 bool RevealTestApi::HoverLight_ShouldBeOn(winrt::RevealHoverLight const& value)
00127 {
00128     return winrt::get_self<RevealHoverLight>(value)->m_shouldLightBeOn;
00129 }
00130
00131 bool RevealTestApi::HoverLight_IsPressed(winrt::RevealHoverLight const& value)
00132 {
00133     return winrt::get_self<RevealHoverLight>(value)->m_isPressed;
00134 }
00135
00136 bool RevealTestApi::HoverLight_IsPointerOver(winrt::RevealHoverLight const& value)
00137 {
00138     return winrt::get_self<RevealHoverLight>(value)->m_isPointerOver;
00139 }
00140
00141 #if DBG
00142 winrt::ICoreWindow::PointerMoved_revoker RevealTestApi::s_pointerMovedRevoker{};
00143 winrt::SpotLight RevealTestApi::s_backgroundSpotlightProxy[2] = { nullptr, nullptr };
00144 #endif
00145
00146 winrt::SpotLight RevealTestApi::GetBackgroundSpotlightProxy(winrt::ApplicationTheme theme)
00147 {
00148 #if DBG
00149     int index = std::clamp((int)theme, 0, 1);
00150     if (!s_backgroundSpotlightProxy[index])
00151     {
00152         auto light = s_backgroundSpotlightProxy[index] = winrt::CompositionTarget::GetCompositorForCurrentThread().CreateSpotLight();
00153
00154         light.InnerConeAngleInDegrees(RevealHoverLight::s_innerConeAngleInDegrees);
00155         light.OuterConeAngleInDegrees(RevealHoverLight::s_outerConeAngleInDegrees);
00156         light.ConstantAttenuation(RevealHoverLight::s_constantAttenuation);
00157         light.InnerConeColor(RevealHoverLight::s_revealHoverSpotlightStates[RevealHoverSpotlightState_AnimToOff].InnerConeColor.Value);
00158         light.OuterConeColor(RevealHoverLight::s_revealHoverSpotlightStates[RevealHoverSpotlightState_AnimToOff].OuterConeColor.Value);
00159
00160         s_pointerMovedRevoker = winrt::CoreWindow::GetForCurrentThread().PointerMoved(winrt::auto_revoke,
00161             [=](const winrt::CoreWindow&, const ::winrt::Windows::UI::Core::PointerEventArgs&)
00162             {
00163                 RevealHoverLight::s_revealHoverSpotlightStates[RevealHoverSpotlightState_AnimToOff].InnerConeColor.Value = light.InnerConeColor();
00164                 RevealHoverLight::s_revealHoverSpotlightStates[RevealHoverSpotlightState_AnimToOff].OuterConeColor.Value = light.OuterConeColor();
00165             });
00166     }
00167
00168     return s_backgroundSpotlightProxy[index];
00169 #else
00170     return nullptr;
00171 #endif
00172 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemCollectionTransitionCompletedEventArgs Member List

This is the complete list of members for ItemCollectionTransitionCompletedEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
CheckThread() | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< ItemCollectionTransitionCompletedEventArgs > &&self) noexcept | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline, static]
Element() | ItemCollectionTransitionCompletedEventArgs |
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
final_release(std::unique_ptr< ItemCollectionTransitionCompletedEventArgs > &&self) | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
GetInner() | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
IsOnThread() | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
ItemCollectionTransitionCompletedEventArgs(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionCompletedEventArgs |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ItemCollectionTransitionCompletedEventArgs, winrt::implementation::ItemCollectionTransitionCompletedEventArgsT, winrt::composing, winrt::composable > | [inline]
Transition() | ItemCollectionTransitionCompletedEventArgs | [inline]
Generated on Sun Dec 1 2024 20:52:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealScenarioSecondaryView Member List

This is the complete list of members for RevealScenarioSecondaryView, including all inherited members.
CreateNewView(object sender, RoutedEventArgs e) | RevealScenarioSecondaryView | [inline, private]
RevealScenarioSecondaryView() | RevealScenarioSecondaryView | [inline]
Generated on Sun Dec 1 2024 20:54:26 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/ItemsViewTrace.h Source File

  • ItemsView

ItemsViewTrace.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007 #include "MuxcTraceLogging.h"
00008 #include "Utils.h"
00009 #include "MUXControlsTestHooks.h"
00010
00011 inline bool IsItemsViewTracingEnabled()
00012 {
00013     return g_IsLoggingProviderEnabled &&
00014         g_LoggingProviderLevel >= WINEVENT_LEVEL_INFO &&
00015         (g_LoggingProviderMatchAnyKeyword & KEYWORD_ITEMSVIEW || g_LoggingProviderMatchAnyKeyword == 0);
00016 }
00017
00018 inline bool IsItemsViewVerboseTracingEnabled()
00019 {
00020     return g_IsLoggingProviderEnabled &&
00021         g_LoggingProviderLevel >= WINEVENT_LEVEL_VERBOSE &&
00022         (g_LoggingProviderMatchAnyKeyword & KEYWORD_ITEMSVIEW || g_LoggingProviderMatchAnyKeyword == 0);
00023 }
00024
00025 inline bool IsItemsViewPerfTracingEnabled()
00026 {
00027     return g_IsPerfProviderEnabled &&
00028         g_PerfProviderLevel >= WINEVENT_LEVEL_INFO &&
00029         (g_PerfProviderMatchAnyKeyword & KEYWORD_ITEMSVIEW || g_PerfProviderMatchAnyKeyword == 0);
00030 }
00031
00032 #define ITEMSVIEW_TRACE_INFO_ENABLED(includeTraceLogging, sender, message, ...) \
00033 ItemsViewTrace::TraceInfo(includeTraceLogging, sender, message, __VA_ARGS__); \
00034
00035 #define ITEMSVIEW_TRACE_INFO(sender, message, ...) \
00036 if (IsItemsViewTracingEnabled()) \
00037 { \
00038     ITEMSVIEW_TRACE_INFO_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00039 } \
00040 else if (ItemsViewTrace::s_IsDebugOutputEnabled || ItemsViewTrace::s_IsVerboseDebugOutputEnabled) \
00041 { \
00042     ITEMSVIEW_TRACE_INFO_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00043 } \
00044
00045 #define ITEMSVIEW_TRACE_VERBOSE_ENABLED(includeTraceLogging, sender, message, ...) \
00046 ItemsViewTrace::TraceVerbose(includeTraceLogging, sender, message, __VA_ARGS__); \
00047
00048 #define ITEMSVIEW_TRACE_VERBOSE(sender, message, ...) \
00049 if (IsItemsViewVerboseTracingEnabled()) \
00050 { \
00051     ITEMSVIEW_TRACE_VERBOSE_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00052 } \
00053 else if (ItemsViewTrace::s_IsVerboseDebugOutputEnabled) \
00054 { \
00055     ITEMSVIEW_TRACE_VERBOSE_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00056 } \
00057
00058 #define ITEMSVIEW_TRACE_PERF(info) \
00059 if (IsItemsViewPerfTracingEnabled()) \
00060 { \
00061     ItemsViewTrace::TracePerfInfo(info); \
00062 } \
00063
00064 #ifdef DBG
00065 #define ITEMSVIEW_TRACE_INFO_DBG(sender, message, ...)    ITEMSVIEW_TRACE_INFO(sender, message, __VA_ARGS__)
00066 #define ITEMSVIEW_TRACE_VERBOSE_DBG(sender, message, ...) ITEMSVIEW_TRACE_VERBOSE(sender, message, __VA_ARGS__)
00067 #define ITEMSVIEW_TRACE_PERF_DBG(info)                    ITEMSVIEW_TRACE_PERF(info)
00068 #else
00069 #define ITEMSVIEW_TRACE_INFO_DBG(sender, message, ...)
00070 #define ITEMSVIEW_TRACE_VERBOSE_DBG(sender, message, ...)
00071 #define ITEMSVIEW_TRACE_PERF_DBG(info)
00072 #endif // DBG
00073
00074 class ItemsViewTrace
00075 {
00076 public:
00077     static bool s_IsDebugOutputEnabled;
00078     static bool s_IsVerboseDebugOutputEnabled;
00079
00080     static void TraceInfo(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept
00081     {
00082         va_list args;
00083         va_start(args, message);
00084         WCHAR buffer[256]{};
00085         if (SUCCEEDED(StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args)))
00086         {
00087             if (includeTraceLogging)
00088             {
00089                 // TraceViewers
00090                 // http://toolbox/pef
00091                 // http://fastetw/index.aspx
00092                 TraceLoggingWrite(
00093                     g_hLoggingProvider,
00094                     "ItemsViewInfo" /* eventName */,
00095                     TraceLoggingLevel(WINEVENT_LEVEL_INFO),
00096                     TraceLoggingKeyword(KEYWORD_ITEMSVIEW),
00097                     TraceLoggingWideString(buffer, "Message"));
00098             }
00099
00100             if (s_IsDebugOutputEnabled)
00101             {
00102                 OutputDebugStringW(buffer);
00103             }
00104
00105             com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks();
00106
00107             if (globalTestHooks &&
00108                 (globalTestHooks->GetLoggingLevelForType(L"ItemsView") >= WINEVENT_LEVEL_INFO || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_INFO))
00109             {
00110                 globalTestHooks->LogMessage(sender, buffer, false /*isVerboseLevel*/);
00111             }
00112         }
00113         va_end(args);
00114     }
00115
00116     static void TraceVerbose(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept
00117     {
00118         va_list args;
00119         va_start(args, message);
00120         WCHAR buffer[256]{};
00121         if (SUCCEEDED(StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args)))
00122         {
00123             if (includeTraceLogging)
00124             {
00125                 // TraceViewers
00126                 // http://toolbox/pef
00127                 // http://fastetw/index.aspx
00128                 TraceLoggingWrite(
00129                     g_hLoggingProvider,
00130                     "ItemsViewVerbose" /* eventName */,
00131                     TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
00132                     TraceLoggingKeyword(KEYWORD_ITEMSVIEW),
00133                     TraceLoggingWideString(buffer, "Message"));
00134             }
00135
00136             if (s_IsDebugOutputEnabled || s_IsVerboseDebugOutputEnabled)
00137             {
00138                 OutputDebugStringW(buffer);
00139             }
00140
00141             com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks();
00142
00143             if (globalTestHooks &&
00144                 (globalTestHooks->GetLoggingLevelForType(L"ItemsView") >= WINEVENT_LEVEL_VERBOSE || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_VERBOSE))
00145             {
00146                 globalTestHooks->LogMessage(sender, buffer, true /*isVerboseLevel*/);
00147             }
00148         }
00149         va_end(args);
00150     }
00151
00152     static void TracePerfInfo(PCWSTR info) noexcept
00153     {
00154         // TraceViewers
00155         // http://toolbox/pef
00156         // http://fastetw/index.aspx
00157         TraceLoggingWrite(
00158             g_hPerfProvider,
00159             "ItemsViewPerf" /* eventName */,
00160             TraceLoggingLevel(WINEVENT_LEVEL_INFO),
00161             TraceLoggingKeyword(KEYWORD_ITEMSVIEW),
00162             TraceLoggingWideString(info, "Info"));
00163     }
00164 };
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TitleBarTemplateSettings Member List

This is the complete list of members for TitleBarTemplateSettings, including all inherited members.
ClearProperties() | TitleBarTemplateSettingsProperties | [static]
EnsureProperties() | TitleBarTemplateSettingsProperties | [static]
IconElement(winrt::IconElement const &value) | TitleBarTemplateSettingsProperties |
IconElement() | TitleBarTemplateSettingsProperties |
IconElementProperty() | TitleBarTemplateSettingsProperties | [inline, static]
s_IconElementProperty | TitleBarTemplateSettingsProperties | [static]
TitleBarTemplateSettings() | TitleBarTemplateSettings |
TitleBarTemplateSettingsProperties() | TitleBarTemplateSettingsProperties |
Generated on Sun Dec 1 2024 20:53:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TreeView.properties.cpp Source File

  • Generated

TreeView.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "TreeView.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(TreeView)
00012 }
00013
00014 #include "TreeView.g.cpp"
00015
00016 GlobalDependencyProperty TreeViewProperties::s_CanDragItemsProperty{ nullptr };
00017 GlobalDependencyProperty TreeViewProperties::s_CanReorderItemsProperty{ nullptr };
00018 GlobalDependencyProperty TreeViewProperties::s_ItemContainerStyleProperty{ nullptr };
00019 GlobalDependencyProperty TreeViewProperties::s_ItemContainerStyleSelectorProperty{ nullptr };
00020 GlobalDependencyProperty TreeViewProperties::s_ItemContainerTransitionsProperty{ nullptr };
00021 GlobalDependencyProperty TreeViewProperties::s_ItemsSourceProperty{ nullptr };
00022 GlobalDependencyProperty TreeViewProperties::s_ItemTemplateProperty{ nullptr };
00023 GlobalDependencyProperty TreeViewProperties::s_ItemTemplateSelectorProperty{ nullptr };
00024 GlobalDependencyProperty TreeViewProperties::s_SelectedItemProperty{ nullptr };
00025 GlobalDependencyProperty TreeViewProperties::s_SelectionModeProperty{ nullptr };
00026
00027 TreeViewProperties::TreeViewProperties()
00028     : m_collapsedEventSource{static_cast<TreeView*>(this)}
00029     , m_dragItemsCompletedEventSource{static_cast<TreeView*>(this)}
00030     , m_dragItemsStartingEventSource{static_cast<TreeView*>(this)}
00031     , m_expandingEventSource{static_cast<TreeView*>(this)}
00032     , m_itemInvokedEventSource{static_cast<TreeView*>(this)}
00033     , m_selectionChangedEventSource{static_cast<TreeView*>(this)}
00034 {
00035     EnsureProperties();
00036 }
00037
00038 void TreeViewProperties::EnsureProperties()
00039 {
00040     if (!s_CanDragItemsProperty)
00041     {
00042         s_CanDragItemsProperty =
00043             InitializeDependencyProperty(
00044                 L"CanDragItems",
00045                 winrt::name_of<bool>(),
00046                 winrt::name_of<winrt::TreeView>(),
00047                 false /* isAttached */,
00048                 ValueHelper<bool>::BoxValueIfNecessary(true),
00049                 nullptr);
00050     }
00051     if (!s_CanReorderItemsProperty)
00052     {
00053         s_CanReorderItemsProperty =
00054             InitializeDependencyProperty(
00055                 L"CanReorderItems",
00056                 winrt::name_of<bool>(),
00057                 winrt::name_of<winrt::TreeView>(),
00058                 false /* isAttached */,
00059                 ValueHelper<bool>::BoxValueIfNecessary(true),
00060                 nullptr);
00061     }
00062     if (!s_ItemContainerStyleProperty)
00063     {
00064         s_ItemContainerStyleProperty =
00065             InitializeDependencyProperty(
00066                 L"ItemContainerStyle",
00067                 winrt::name_of<winrt::Style>(),
00068                 winrt::name_of<winrt::TreeView>(),
00069                 false /* isAttached */,
00070                 ValueHelper<winrt::Style>::BoxedDefaultValue(),
00071                 nullptr);
00072     }
00073     if (!s_ItemContainerStyleSelectorProperty)
00074     {
00075         s_ItemContainerStyleSelectorProperty =
00076             InitializeDependencyProperty(
00077                 L"ItemContainerStyleSelector",
00078                 winrt::name_of<winrt::StyleSelector>(),
00079                 winrt::name_of<winrt::TreeView>(),
00080                 false /* isAttached */,
00081                 ValueHelper<winrt::StyleSelector>::BoxedDefaultValue(),
00082                 nullptr);
00083     }
00084     if (!s_ItemContainerTransitionsProperty)
00085     {
00086         s_ItemContainerTransitionsProperty =
00087             InitializeDependencyProperty(
00088                 L"ItemContainerTransitions",
00089                 winrt::name_of<winrt::TransitionCollection>(),
00090                 winrt::name_of<winrt::TreeView>(),
00091                 false /* isAttached */,
00092                 ValueHelper<winrt::TransitionCollection>::BoxedDefaultValue(),
00093                 nullptr);
00094     }
00095     if (!s_ItemsSourceProperty)
00096     {
00097         s_ItemsSourceProperty =
00098             InitializeDependencyProperty(
00099                 L"ItemsSource",
00100                 winrt::name_of<winrt::IInspectable>(),
00101                 winrt::name_of<winrt::TreeView>(),
00102                 false /* isAttached */,
00103                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00104                 winrt::PropertyChangedCallback(&OnItemsSourcePropertyChanged));
00105     }
00106     if (!s_ItemTemplateProperty)
00107     {
00108         s_ItemTemplateProperty =
00109             InitializeDependencyProperty(
00110                 L"ItemTemplate",
00111                 winrt::name_of<winrt::DataTemplate>(),
00112                 winrt::name_of<winrt::TreeView>(),
00113                 false /* isAttached */,
00114                 ValueHelper<winrt::DataTemplate>::BoxedDefaultValue(),
00115                 nullptr);
00116     }
00117     if (!s_ItemTemplateSelectorProperty)
00118     {
00119         s_ItemTemplateSelectorProperty =
00120             InitializeDependencyProperty(
00121                 L"ItemTemplateSelector",
00122                 winrt::name_of<winrt::DataTemplateSelector>(),
00123                 winrt::name_of<winrt::TreeView>(),
00124                 false /* isAttached */,
00125                 ValueHelper<winrt::DataTemplateSelector>::BoxedDefaultValue(),
00126                 nullptr);
00127     }
00128     if (!s_SelectedItemProperty)
00129     {
00130         s_SelectedItemProperty =
00131             InitializeDependencyProperty(
00132                 L"SelectedItem",
00133                 winrt::name_of<winrt::IInspectable>(),
00134                 winrt::name_of<winrt::TreeView>(),
00135                 false /* isAttached */,
00136                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00137                 winrt::PropertyChangedCallback(&OnSelectedItemPropertyChanged));
00138     }
00139     if (!s_SelectionModeProperty)
00140     {
00141         s_SelectionModeProperty =
00142             InitializeDependencyProperty(
00143                 L"SelectionMode",
00144                 winrt::name_of<winrt::TreeViewSelectionMode>(),
00145                 winrt::name_of<winrt::TreeView>(),
00146                 false /* isAttached */,
00147                 ValueHelper<winrt::TreeViewSelectionMode>::BoxValueIfNecessary(winrt::TreeViewSelectionMode::Single),
00148                 winrt::PropertyChangedCallback(&OnSelectionModePropertyChanged));
00149     }
00150 }
00151
00152 void TreeViewProperties::ClearProperties()
00153 {
00154     s_CanDragItemsProperty = nullptr;
00155     s_CanReorderItemsProperty = nullptr;
00156     s_ItemContainerStyleProperty = nullptr;
00157     s_ItemContainerStyleSelectorProperty = nullptr;
00158     s_ItemContainerTransitionsProperty = nullptr;
00159     s_ItemsSourceProperty = nullptr;
00160     s_ItemTemplateProperty = nullptr;
00161     s_ItemTemplateSelectorProperty = nullptr;
00162     s_SelectedItemProperty = nullptr;
00163     s_SelectionModeProperty = nullptr;
00164 }
00165
00166 void TreeViewProperties::OnItemsSourcePropertyChanged(
00167     winrt::DependencyObject const& sender,
00168     winrt::DependencyPropertyChangedEventArgs const& args)
00169 {
00170     auto owner = sender.as<winrt::TreeView>();
00171     winrt::get_self<TreeView>(owner)->OnPropertyChanged(args);
00172 }
00173
00174 void TreeViewProperties::OnSelectedItemPropertyChanged(
00175     winrt::DependencyObject const& sender,
00176     winrt::DependencyPropertyChangedEventArgs const& args)
00177 {
00178     auto owner = sender.as<winrt::TreeView>();
00179     winrt::get_self<TreeView>(owner)->OnPropertyChanged(args);
00180 }
00181
00182 void TreeViewProperties::OnSelectionModePropertyChanged(
00183     winrt::DependencyObject const& sender,
00184     winrt::DependencyPropertyChangedEventArgs const& args)
00185 {
00186     auto owner = sender.as<winrt::TreeView>();
00187     winrt::get_self<TreeView>(owner)->OnPropertyChanged(args);
00188 }
00189
00190 void TreeViewProperties::CanDragItems(bool value)
00191 {
00192     [[gsl::suppress(con)]]
00193     {
00194     static_cast<TreeView*>(this)->SetValue(s_CanDragItemsProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00195     }
00196 }
00197
00198 bool TreeViewProperties::CanDragItems()
00199 {
00200     return ValueHelper<bool>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_CanDragItemsProperty));
00201 }
00202
00203 void TreeViewProperties::CanReorderItems(bool value)
00204 {
00205     [[gsl::suppress(con)]]
00206     {
00207     static_cast<TreeView*>(this)->SetValue(s_CanReorderItemsProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00208     }
00209 }
00210
00211 bool TreeViewProperties::CanReorderItems()
00212 {
00213     return ValueHelper<bool>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_CanReorderItemsProperty));
00214 }
00215
00216 void TreeViewProperties::ItemContainerStyle(winrt::Style const& value)
00217 {
00218     [[gsl::suppress(con)]]
00219     {
00220     static_cast<TreeView*>(this)->SetValue(s_ItemContainerStyleProperty, ValueHelper<winrt::Style>::BoxValueIfNecessary(value));
00221     }
00222 }
00223
00224 winrt::Style TreeViewProperties::ItemContainerStyle()
00225 {
00226     return ValueHelper<winrt::Style>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_ItemContainerStyleProperty));
00227 }
00228
00229 void TreeViewProperties::ItemContainerStyleSelector(winrt::StyleSelector const& value)
00230 {
00231     [[gsl::suppress(con)]]
00232     {
00233     static_cast<TreeView*>(this)->SetValue(s_ItemContainerStyleSelectorProperty, ValueHelper<winrt::StyleSelector>::BoxValueIfNecessary(value));
00234     }
00235 }
00236
00237 winrt::StyleSelector TreeViewProperties::ItemContainerStyleSelector()
00238 {
00239     return ValueHelper<winrt::StyleSelector>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_ItemContainerStyleSelectorProperty));
00240 }
00241
00242 void TreeViewProperties::ItemContainerTransitions(winrt::TransitionCollection const& value)
00243 {
00244     [[gsl::suppress(con)]]
00245     {
00246     static_cast<TreeView*>(this)->SetValue(s_ItemContainerTransitionsProperty, ValueHelper<winrt::TransitionCollection>::BoxValueIfNecessary(value));
00247     }
00248 }
00249
00250 winrt::TransitionCollection TreeViewProperties::ItemContainerTransitions()
00251 {
00252     return ValueHelper<winrt::TransitionCollection>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_ItemContainerTransitionsProperty));
00253 }
00254
00255 void TreeViewProperties::ItemsSource(winrt::IInspectable const& value)
00256 {
00257     [[gsl::suppress(con)]]
00258     {
00259     static_cast<TreeView*>(this)->SetValue(s_ItemsSourceProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00260     }
00261 }
00262
00263 winrt::IInspectable TreeViewProperties::ItemsSource()
00264 {
00265     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_ItemsSourceProperty));
00266 }
00267
00268 void TreeViewProperties::ItemTemplate(winrt::DataTemplate const& value)
00269 {
00270     [[gsl::suppress(con)]]
00271     {
00272     static_cast<TreeView*>(this)->SetValue(s_ItemTemplateProperty, ValueHelper<winrt::DataTemplate>::BoxValueIfNecessary(value));
00273     }
00274 }
00275
00276 winrt::DataTemplate TreeViewProperties::ItemTemplate()
00277 {
00278     return ValueHelper<winrt::DataTemplate>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_ItemTemplateProperty));
00279 }
00280
00281 void TreeViewProperties::ItemTemplateSelector(winrt::DataTemplateSelector const& value)
00282 {
00283     [[gsl::suppress(con)]]
00284     {
00285     static_cast<TreeView*>(this)->SetValue(s_ItemTemplateSelectorProperty, ValueHelper<winrt::DataTemplateSelector>::BoxValueIfNecessary(value));
00286     }
00287 }
00288
00289 winrt::DataTemplateSelector TreeViewProperties::ItemTemplateSelector()
00290 {
00291     return ValueHelper<winrt::DataTemplateSelector>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_ItemTemplateSelectorProperty));
00292 }
00293
00294 void TreeViewProperties::SelectedItem(winrt::IInspectable const& value)
00295 {
00296     [[gsl::suppress(con)]]
00297     {
00298     static_cast<TreeView*>(this)->SetValue(s_SelectedItemProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00299     }
00300 }
00301
00302 winrt::IInspectable TreeViewProperties::SelectedItem()
00303 {
00304     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_SelectedItemProperty));
00305 }
00306
00307 void TreeViewProperties::SelectionMode(winrt::TreeViewSelectionMode const& value)
00308 {
00309     [[gsl::suppress(con)]]
00310     {
00311     static_cast<TreeView*>(this)->SetValue(s_SelectionModeProperty, ValueHelper<winrt::TreeViewSelectionMode>::BoxValueIfNecessary(value));
00312     }
00313 }
00314
00315 winrt::TreeViewSelectionMode TreeViewProperties::SelectionMode()
00316 {
00317     return ValueHelper<winrt::TreeViewSelectionMode>::CastOrUnbox(static_cast<TreeView*>(this)->GetValue(s_SelectionModeProperty));
00318 }
00319
00320 winrt::event_token TreeViewProperties::Collapsed(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewCollapsedEventArgs> const& value)
00321 {
00322     return m_collapsedEventSource.add(value);
00323 }
00324
00325 void TreeViewProperties::Collapsed(winrt::event_token const& token)
00326 {
00327     m_collapsedEventSource.remove(token);
00328 }
00329
00330 winrt::event_token TreeViewProperties::DragItemsCompleted(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewDragItemsCompletedEventArgs> const& value)
00331 {
00332     return m_dragItemsCompletedEventSource.add(value);
00333 }
00334
00335 void TreeViewProperties::DragItemsCompleted(winrt::event_token const& token)
00336 {
00337     m_dragItemsCompletedEventSource.remove(token);
00338 }
00339
00340 winrt::event_token TreeViewProperties::DragItemsStarting(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewDragItemsStartingEventArgs> const& value)
00341 {
00342     return m_dragItemsStartingEventSource.add(value);
00343 }
00344
00345 void TreeViewProperties::DragItemsStarting(winrt::event_token const& token)
00346 {
00347     m_dragItemsStartingEventSource.remove(token);
00348 }
00349
00350 winrt::event_token TreeViewProperties::Expanding(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewExpandingEventArgs> const& value)
00351 {
00352     return m_expandingEventSource.add(value);
00353 }
00354
00355 void TreeViewProperties::Expanding(winrt::event_token const& token)
00356 {
00357     m_expandingEventSource.remove(token);
00358 }
00359
00360 winrt::event_token TreeViewProperties::ItemInvoked(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewItemInvokedEventArgs> const& value)
00361 {
00362     return m_itemInvokedEventSource.add(value);
00363 }
00364
00365 void TreeViewProperties::ItemInvoked(winrt::event_token const& token)
00366 {
00367     m_itemInvokedEventSource.remove(token);
00368 }
00369
00370 winrt::event_token TreeViewProperties::SelectionChanged(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewSelectionChangedEventArgs> const& value)
00371 {
00372     return m_selectionChangedEventSource.add(value);
00373 }
00374
00375 void TreeViewProperties::SelectionChanged(winrt::event_token const& token)
00376 {
00377     m_selectionChangedEventSource.remove(token);
00378 }
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressRing/TestUI/ProgressRingStoryboardAnimationPage.xaml.cs Source File

  • ProgressRing
  • TestUI

ProgressRingStoryboardAnimationPage.xaml.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using Microsoft.UI.Xaml;
00003 using Microsoft.UI.Xaml.Controls;
00004 using Microsoft.UI.Xaml.Media;
00005
00006 namespace MUXControlsTestApp
00007 {
00008     public sealed partial class ProgressRingStoryboardAnimationPage : TestPage
00009     {
00010         public ProgressRingStoryboardAnimationPage()
00011         {
00012             this.InitializeComponent();
00013             Loaded += ProgressRingStoryboardAnimationPage_Loaded;
00014
00015             NavigateToMainPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ProgressRingPage), 0); };
00016         }
00017
00018         private void ProgressRingStoryboardAnimationPage_Loaded(object sender, RoutedEventArgs e)
00019         {
00020             var layoutRoot = (Grid)VisualTreeHelper.GetChild(TestStoryboardAnimationProgressRing, 0);
00021
00022             var commonStatesGroup = VisualStateManager.GetVisualStateGroups(layoutRoot)[0];
00023             commonStatesGroup.CurrentStateChanged += this.ProgressRingStoryboardAnimationPage_CurrentStateChanged;
00024             VisualStateText.Text = commonStatesGroup.CurrentState.Name;
00025
00026             Loaded -= ProgressRingStoryboardAnimationPage_Loaded;
00027         }
00028
00029         private void ProgressRingStoryboardAnimationPage_CurrentStateChanged(object sender, VisualStateChangedEventArgs e)
00030         {
00031             VisualStateText.Text = e.NewState.Name;
00032         }
00033
00034         public void UpdateWidth_Click(object sender, RoutedEventArgs e)
00035         {
00036             TestStoryboardAnimationProgressRing.Width = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00037             TestStoryboardAnimationProgressRing.Height = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00038         }
00039     }
00040 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewItemAutomationPeer.h Source File

  • TreeView

TreeViewItemAutomationPeer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "TreeViewItemAutomationPeer.g.h"
00007
00008 class TreeViewItemAutomationPeer :
00009     public ReferenceTracker<TreeViewItemAutomationPeer,
00010         winrt::implementation::TreeViewItemAutomationPeerT,
00011         winrt::ISelectionItemProvider>
00012 {
00013 public:
00014     TreeViewItemAutomationPeer(winrt::TreeViewItem const& owner);
00015
00016     // IExpandCollapseProvider
00017     winrt::ExpandCollapseState ExpandCollapseState();
00018     void Collapse();
00019     void Expand();
00020
00021     // IAutomationPeerOverrides
00022     winrt::AutomationControlType GetAutomationControlTypeCore();
00023     winrt::hstring GetNameCore();
00024     winrt::IInspectable GetPatternCore(winrt::PatternInterface const& patternInterface);
00025     winrt::hstring GetClassNameCore();
00026
00027     // IAutomationPeerOverrides3
00028     int32_t GetPositionInSetCore();
00029     int32_t GetSizeOfSetCore();
00030     int32_t GetLevelCore();
00031
00032     void RaiseExpandCollapseAutomationEvent(winrt::ExpandCollapseState newState);
00033
00034     // ISelectionItemProvider
00035     bool IsSelected();
00036     winrt::IRawElementProviderSimple SelectionContainer();
00037     void AddToSelection();
00038     void RemoveFromSelection();
00039     void Select();
00040
00041 private:
00042     winrt::ListView GetParentListView();
00043     winrt::TreeView GetParentTreeView();
00044     winrt::TreeViewNode GetTreeViewNode();
00045     void UpdateSelection(bool select);
00046 };
00047
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemTemplateWrapper.h Source File

  • Repeater

ItemTemplateWrapper.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007
00008 class ItemTemplateWrapper :
00009     public winrt::implements<ItemTemplateWrapper, winrt::IElementFactory>
00010 {
00011 public:
00012     ItemTemplateWrapper(winrt::DataTemplate const& dataTemplate);
00013     ItemTemplateWrapper(winrt::DataTemplateSelector const& dataTemplateSelector);
00014
00015     winrt::DataTemplate Template();
00016     void Template(winrt::DataTemplate const& value);
00017
00018     winrt::DataTemplateSelector TemplateSelector();
00019     void TemplateSelector(winrt::DataTemplateSelector const& value);
00020
00021 #pragma region IElementFactory
00022     winrt::UIElement GetElement(winrt::ElementFactoryGetArgs const& args);
00023     void RecycleElement(winrt::ElementFactoryRecycleArgs const& args);
00024 #pragma endregion
00025
00026 private:
00027     winrt::DataTemplate m_dataTemplate{ nullptr };
00028     winrt::DataTemplateSelector m_dataTemplateSelector{ nullptr };
00029 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollingZoomCompletedEventArgs Member List

This is the complete list of members for ScrollingZoomCompletedEventArgs, including all inherited members.
CorrelationId() | ScrollingZoomCompletedEventArgs |
Result() | ScrollingZoomCompletedEventArgs |
Result(ScrollPresenterViewChangeResult result) | ScrollingZoomCompletedEventArgs |
ScrollingZoomCompletedEventArgs() | ScrollingZoomCompletedEventArgs | [inline]
ZoomFactorChangeCorrelationId(int32_t zoomFactorChangeCorrelationId) | ScrollingZoomCompletedEventArgs |
~ScrollingZoomCompletedEventArgs() | ScrollingZoomCompletedEventArgs | [inline]
Generated on Sun Dec 1 2024 20:53:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PipsPager/PipsPagerTemplateSettings.h Source File

  • PipsPager

PipsPagerTemplateSettings.h

Go to the documentation of this file.
00001 ﻿#pragma once
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "PipsPagerTemplateSettings.g.h"
00008 #include "PipsPagerTemplateSettings.properties.h"
00009
00010 class PipsPagerTemplateSettings :
00011     public winrt::implementation::PipsPagerTemplateSettingsT<PipsPagerTemplateSettings>,
00012     public PipsPagerTemplateSettingsProperties
00013 {
00014 };
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/TestUI/CoreWindowEventsPage.xaml.cs Source File

  • Materials
  • Reveal
  • TestUI

CoreWindowEventsPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Windows.Foundation.Metadata;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Automation;
00007 using Microsoft.UI.Xaml.Controls;
00008 using Microsoft.UI.Xaml.Navigation;
00009 using Microsoft.UI.Xaml.Markup;
00010 using Microsoft.UI.Xaml.Media;
00011 using Microsoft.UI.Private.Media;
00012 using Windows.UI.Core;
00013 using System;
00014
00015 namespace MUXControlsTestApp
00016 {
00017     public sealed partial class CoreWindowEventsPage : TestPage
00018     {
00019         ListViewItem _listViewIem1 = null;
00020         UInt32 _revealAddedCount = 0;
00021
00022         public CoreWindowEventsPage()
00023         {
00024             this.InitializeComponent();
00025
00026             AutomationProperties.SetName(this, "CoreWindowEventsPage");
00027             AutomationProperties.SetAutomationId(this, "CoreWindowEventsPage");
00028
00029             MaterialHelperTestApi.IgnoreAreEffectsFast = true;
00030             MaterialHelperTestApi.SimulateDisabledByPolicy = false;
00031         }
00032
00033         protected override void OnNavigatedFrom(NavigationEventArgs e)
00034         {
00035             // Unset all override flags to avoid impacting subsequent tests
00036             MaterialHelperTestApi.IgnoreAreEffectsFast = false;
00037             MaterialHelperTestApi.SimulateDisabledByPolicy = false;
00038             base.OnNavigatedFrom(e);
00039         }
00040
00041         protected override void OnNavigatedTo(NavigationEventArgs e)
00042         {
00043             base.OnNavigatedTo(e);
00044
00045             // Make sure Page registers for PointerExited here, before the RevealBorderLight (via AddReveal_Click)
00046             CoreWindow coreWindow = CoreWindow.GetForCurrentThread();
00047             coreWindow.PointerExited += CoreWindow_PointerExited;
00048         }
00049
00050         private void CoreWindow_PointerExited(CoreWindow sender, PointerEventArgs args)
00051         {
00052             if (_listViewIem1 != null)
00053             {
00054                 RevealContainer.Children.Remove(_listViewIem1);
00055                 _listViewIem1 = null;
00056             }
00057         }
00058
00059         private void AddReveal_Click(object sender, RoutedEventArgs e)
00060         {
00061             _revealAddedCount++;
00062
00063             if (_listViewIem1 == null)
00064             {
00065                 _listViewIem1 = new ListViewItem();
00066                 _listViewIem1.Height = 100;
00067                 _listViewIem1.Width = 300;
00068                 _listViewIem1.Content = "Test ListViewItem";
00069                 RevealContainer.Children.Add(_listViewIem1);
00070             }
00071
00072             if (_revealAddedCount == 2)
00073             {
00074                 // Log success once we got this far.
00075                 using (var logger = new ResultsLogger("CoreWindowEventsTests", TestResult)) { }
00076             }
00077         }
00078     }
00079 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IRefreshVisualizerPrivate Member List

This is the complete list of members for IRefreshVisualizerPrivate, including all inherited members.
SetInternalPullDirection(MU_XC_NAMESPACE.RefreshPullDirection value) IRefreshVisualizerPrivate
Generated on Sun Dec 1 2024 20:53:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PipsPager/InteractionTests/PipsPagerTests.cs Source File

  • PipsPager
  • InteractionTests

PipsPagerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00006 using Common;
00007 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00008 using Microsoft.Windows.Apps.Test.Foundation;
00009 using WEX.TestExecution;
00010 using WEX.TestExecution.Markup;
00011 using WEX.Logging.Interop;
00012 using MUXTestInfra.Shared.Infra;
00013
00014 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00015 {
00016     [TestClass]
00017     public class PipsPagerTests : PipsPagerTestBase
00018     {
00019         [ClassInitialize]
00020         [TestProperty("RunAs", "User")]
00021         [TestProperty("Classification", "Integration")]
00022         [TestProperty("Platform", "Any")]
00023         [TestProperty("MUXControlsTestSuite", "SuiteB")]
00024         public static void ClassInitialize(TestContext testContext)
00025         {
00026             TestEnvironment.Initialize(testContext);
00027         }
00028
00029         public void TestCleanup()
00030         {
00031             TestCleanupHelper.Cleanup();
00032         }
00033
00034         [TestMethod]
00035         [TestProperty("TestSuite", "A")]
00036         public void VerifyAxeScanPasses()
00037         {
00038             using (var setup = new TestSetupHelper("PipsPager-Axe"))
00039             {
00040                 AxeTestHelper.TestForAxeIssues();
00041             }
00042         }
00043
00044         [TestMethod]
00045         [TestProperty("TestSuite", "A")]
00046         public void PipsPagerChangingPageTest()
00047         {
00048             using (var setup = new TestSetupHelper("PipsPager Tests"))
00049             {
00050                 elements = new PipsPagerElements();
00051                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00052                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00053
00054                 VerifySelectedPageIndex(0);
00055
00056                 InputHelper.LeftClick(elements.GetNextPageButton());
00057                 VerifySelectedPageIndex(1);
00058
00059                 InputHelper.LeftClick(elements.GetNextPageButton());
00060                 VerifySelectedPageIndex(2);
00061
00062                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00063                 VerifySelectedPageIndex(1);
00064
00065                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00066                 VerifySelectedPageIndex(0);
00067
00068                 ChangeNumberOfPages(NumberOfPagesOptions.Five);
00069                 VerifyNumberOfPages("5");
00070
00071                 InputHelper.LeftClick(elements.GetNextPageButton());
00072                 VerifySelectedPageIndex(1);
00073
00074                 InputHelper.LeftClick(elements.GetNextPageButton());
00075                 VerifySelectedPageIndex(2);
00076
00077                 InputHelper.LeftClick(elements.GetNextPageButton());
00078                 VerifySelectedPageIndex(3);
00079
00080                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00081                 VerifySelectedPageIndex(2);
00082             }
00083         }
00084
00085         [TestMethod]
00086         [TestProperty("TestSuite", "B")]
00087         public void PreviousPageButtonChangingPageTest()
00088         {
00089             using (var setup = new TestSetupHelper("PipsPager Tests"))
00090             {
00091                 elements = new PipsPagerElements();
00092                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00093                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00094
00095                 VerifySelectedPageIndex(0);
00096                 InputHelper.LeftClick(elements.GetNextPageButton());
00097
00098                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00099                 VerifySelectedPageIndex(0);
00100
00101                 InputHelper.LeftClick(elements.GetNextPageButton());
00102                 InputHelper.LeftClick(elements.GetNextPageButton());
00103
00104                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00105                 VerifySelectedPageIndex(1);
00106             }
00107         }
00108
00109         [TestMethod]
00110         [TestProperty("TestSuite", "B")]
00111         public void NextPageButtonChangingPageTest()
00112         {
00113             using (var setup = new TestSetupHelper("PipsPager Tests"))
00114             {
00115                 elements = new PipsPagerElements();
00116                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00117                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00118
00119                 VerifySelectedPageIndex(0);
00120                 InputHelper.LeftClick(elements.GetNextPageButton());
00121                 VerifySelectedPageIndex(1);
00122
00123                 InputHelper.LeftClick(elements.GetNextPageButton());
00124                 VerifySelectedPageIndex(2);
00125
00126                 InputHelper.LeftClick(elements.GetNextPageButton());
00127                 VerifySelectedPageIndex(3);
00128
00129                 InputHelper.LeftClick(elements.GetNextPageButton());
00130                 VerifySelectedPageIndex(4);
00131             }
00132         }
00133
00134         [TestMethod]
00135         [TestProperty("TestSuite", "C")]
00136         public void PipsPagerInfinitePagesTest()
00137         {
00138             using (var setup = new TestSetupHelper("PipsPager Tests"))
00139             {
00140                 elements = new PipsPagerElements();
00141                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00142                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00143
00144                 VerifySelectedPageIndex(0);
00145
00146                 ChangeNumberOfPages(NumberOfPagesOptions.Infinite);
00147                 VerifyNumberOfPages("Infinite");
00148
00149                 InputHelper.LeftClick(elements.GetNextPageButton());
00150                 VerifySelectedPageIndex(1);
00151
00152                 InputHelper.LeftClick(elements.GetNextPageButton());
00153                 VerifySelectedPageIndex(2);
00154
00155                 InputHelper.LeftClick(elements.GetNextPageButton());
00156                 VerifySelectedPageIndex(3);
00157
00158                 InputHelper.LeftClick(elements.GetNextPageButton());
00159                 VerifySelectedPageIndex(4);
00160
00161                 InputHelper.LeftClick(elements.GetNextPageButton());
00162                 VerifySelectedPageIndex(5);
00163
00164                 InputHelper.LeftClick(elements.GetNextPageButton());
00165                 VerifySelectedPageIndex(6);
00166
00167                 InputHelper.LeftClick(elements.GetNextPageButton());
00168                 VerifySelectedPageIndex(7);
00169             }
00170         }
00171
00172         [TestMethod]
00173         [TestProperty("TestSuite", "D")]
00174         public void PreviousPageButtonVisibilityOptionsTest()
00175         {
00176             using (var setup = new TestSetupHelper("PipsPager Tests"))
00177             {
00178                 elements = new PipsPagerElements();
00179                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00180
00181                 /* Test for Collapsed */
00182                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Collapsed);
00183                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.Collapsed);
00184                 InputHelper.LeftClick(elements.GetNextPageButton());
00185                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.Collapsed);
00186
00187                 /* Test for Visible */
00188                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00189                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.Visible);
00190                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00191                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.Collapsed);
00192
00193                 /* Test for VisibleOnPointerOver */
00194                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.VisibleOnPointerOver);
00195                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.Collapsed);
00196
00197                 InputHelper.LeftClick(elements.GetNextPageButton());
00198                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.VisibleOnPointerOver, true);
00199
00200                 InputHelper.LeftClick(elements.GetCurrentNumberOfPagesTextBlock());
00201                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.VisibleOnPointerOver);
00202             }
00203         }
00204
00205         [TestMethod]
00206         [TestProperty("TestSuite", "D")]
00207         public void NextPageButtonVisibilityOptionsTest()
00208         {
00209             using (var setup = new TestSetupHelper("PipsPager Tests"))
00210             {
00211                 elements = new PipsPagerElements();
00212                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.VisibleOnPointerOver);
00213
00214                 ChangeNumberOfPages(NumberOfPagesOptions.Five);
00215                 VerifyNumberOfPages("5");
00216
00217                 /* Test for Collapsed */
00218                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Collapsed);
00219                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Next, ButtonVisibilityMode.Collapsed);
00220
00221                 /* Test for Visible */
00222                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00223                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Next, ButtonVisibilityMode.Visible);
00224                 /* We step until the end of the list (4 times, since we have 5 pages) */
00225                 InputHelper.LeftClick(elements.GetNextPageButton());
00226                 InputHelper.LeftClick(elements.GetNextPageButton());
00227                 InputHelper.LeftClick(elements.GetNextPageButton());
00228                 InputHelper.LeftClick(elements.GetNextPageButton());
00229                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Next, ButtonVisibilityMode.Collapsed);
00230
00231                 /* Test for VisibleOnPointerOver */
00232                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.VisibleOnPointerOver);
00233                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Next, ButtonVisibilityMode.Collapsed);
00234
00235                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00236                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Next, ButtonVisibilityMode.VisibleOnPointerOver, true);
00237
00238                 InputHelper.LeftClick(elements.GetCurrentNumberOfPagesTextBlock());
00239                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Next, ButtonVisibilityMode.VisibleOnPointerOver);
00240             }
00241         }
00242
00243         [TestMethod]
00244         [TestProperty("TestSuite", "E")]
00245         public void OrientationChangeTest()
00246         {
00247             using (var setup = new TestSetupHelper("PipsPager Tests"))
00248             {
00249                 elements = new PipsPagerElements();
00250                 SetOrientation(Microsoft.Windows.Apps.Test.Automation.OrientationType.Horizontal);
00251                 VerifyOrientationChanged(Microsoft.Windows.Apps.Test.Automation.OrientationType.Horizontal);
00252
00253                 SetOrientation(Microsoft.Windows.Apps.Test.Automation.OrientationType.Vertical);
00254                 VerifyOrientationChanged(Microsoft.Windows.Apps.Test.Automation.OrientationType.Vertical);
00255
00256             }
00257         }
00258
00259         [TestMethod]
00260         [TestProperty("TestSuite", "E")]
00261         public void FirstFocusedPageTest()
00262         {
00263             using (var setup = new TestSetupHelper("PipsPager Tests"))
00264             {
00265                 if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone4))
00266                 {
00267                     Log.Warning("This test is only designed to run on RS4 + machines due to difference in focus behaviour.");
00268                     return;
00269                 }
00270
00271                 elements = new PipsPagerElements();
00272                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00273                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00274
00275                 InputHelper.LeftClick(elements.GetNextPageButton());
00276                 KeyboardHelper.PressDownModifierKey(ModifierKey.Shift);
00277                 KeyboardHelper.PressKey(Key.Tab);
00278                 KeyboardHelper.ReleaseModifierKey(ModifierKey.Shift);
00279                 VerifySelectedFocusedIndex(1);
00280
00281                 InputHelper.LeftClick(elements.GetNextPageButton());
00282                 KeyboardHelper.PressDownModifierKey(ModifierKey.Shift);
00283                 KeyboardHelper.PressKey(Key.Tab);
00284                 KeyboardHelper.ReleaseModifierKey(ModifierKey.Shift);
00285                 VerifySelectedFocusedIndex(2);
00286
00287                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00288                 KeyboardHelper.PressKey(Key.Tab);
00289                 VerifySelectedFocusedIndex(1);
00290             }
00291         }
00292
00293         [TestMethod]
00294         [TestProperty("TestSuite", "E")]
00295         public void KeyboardPageSelectTest()
00296         {
00297             using (var setup = new TestSetupHelper("PipsPager Tests"))
00298             {
00299                 if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone4))
00300                 {
00301                     Log.Warning("This test is only designed to run on RS4+ machines due to difference in focus behaviour.");
00302                     return;
00303                 }
00304
00305                 elements = new PipsPagerElements();
00306                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00307                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00308
00309                 InputHelper.LeftClick(elements.GetNextPageButton());
00310                 KeyboardHelper.PressDownModifierKey(ModifierKey.Shift);
00311                 KeyboardHelper.PressKey(Key.Tab);
00312                 KeyboardHelper.ReleaseModifierKey(ModifierKey.Shift);
00313
00314                 KeyboardHelper.PressKey(Key.Right);
00315                 KeyboardHelper.PressKey(Key.Space);
00316                 VerifySelectedPageIndex(2);
00317
00318                 KeyboardHelper.PressKey(Key.Right);
00319                 KeyboardHelper.PressKey(Key.Space);
00320                 VerifySelectedPageIndex(3);
00321
00322                 KeyboardHelper.PressKey(Key.Left);
00323                 KeyboardHelper.PressKey(Key.Space);
00324                 VerifySelectedPageIndex(2);
00325             }
00326         }
00327         [TestMethod]
00328         [TestProperty("TestSuite", "F")]
00329         public void PipSizeWithDifferentOrientationsTest()
00330         {
00331             using (var setup = new TestSetupHelper("PipsPager Tests"))
00332             {
00333                 elements = new PipsPagerElements();
00334                 Button getButtonSizesButton = elements.GetPipsPagerButtonSizesButton();
00335                 getButtonSizesButton.InvokeAndWait();
00336
00337                 TextBlock horizontalOrientationPipsPagerButtonWidth = elements.GetHorizontalOrientationPipsPagerButtonWidthTextBlock();
00338                 TextBlock horizontalOrientationPipsPagerButtonHeight = elements.GetHorizontalOrientationPipsPagerButtonHeightTextBlock();
00339
00340                 TextBlock verticalOrientationPipsPagerButtonWidth = elements.GetVerticalOrientationPipsPagerButtonWidthTextBlock();
00341                 TextBlock verticalOrientationPipsPagerButtonHeight = elements.GetVerticalOrientationPipsPagerButtonHeightTextBlock();
00342
00343                 Verify.AreEqual("12", horizontalOrientationPipsPagerButtonWidth.DocumentText);
00344                 Verify.AreEqual("20", horizontalOrientationPipsPagerButtonHeight.DocumentText);
00345                 Verify.AreEqual("20", verticalOrientationPipsPagerButtonWidth.DocumentText);
00346                 Verify.AreEqual("12", verticalOrientationPipsPagerButtonHeight.DocumentText);
00347             }
00348         }
00349
00350         [TestMethod]
00351         [TestProperty("TestSuite", "F")]
00352         public void PipSizeAfterOrientationChangeTest()
00353         {
00354             using (var setup = new TestSetupHelper("PipsPager Tests"))
00355             {
00356                 elements = new PipsPagerElements();
00357                 Button getButtonSizesButton = elements.GetPipsPagerButtonSizesButton();
00358                 getButtonSizesButton.InvokeAndWait();
00359
00360                 TextBlock horizontalOrientationPipsPagerButtonWidth = elements.GetHorizontalOrientationPipsPagerButtonWidthTextBlock();
00361                 TextBlock horizontalOrientationPipsPagerButtonHeight = elements.GetHorizontalOrientationPipsPagerButtonHeightTextBlock();
00362                 Verify.AreEqual("12", horizontalOrientationPipsPagerButtonWidth.DocumentText);
00363                 Verify.AreEqual("20", horizontalOrientationPipsPagerButtonHeight.DocumentText);
00364
00365                 SetOrientation(Microsoft.Windows.Apps.Test.Automation.OrientationType.Vertical);
00366                 VerifyOrientationChanged(Microsoft.Windows.Apps.Test.Automation.OrientationType.Vertical);
00367
00368                 getButtonSizesButton.InvokeAndWait();
00369
00370                 Verify.AreEqual("20", horizontalOrientationPipsPagerButtonWidth.DocumentText);
00371                 Verify.AreEqual("12", horizontalOrientationPipsPagerButtonHeight.DocumentText);
00372             }
00373         }
00374
00375
00376         [TestMethod]
00377         [TestProperty("TestSuite", "F")]
00378         public void PipsPagerRTLDoesNotCrash()
00379         {
00380             using (var setup = new TestSetupHelper("PipsPager Tests"))
00381             {
00382                 elements = new PipsPagerElements();
00383                 TestSetupHelper.SetInnerFrameFlowDirection(FlowDirection.RightToLeft);
00384                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00385                 InputHelper.LeftClick(elements.GetNextPageButton());
00386             }
00387         }
00388
00389         [TestMethod]
00390         [TestProperty("TestSuite", "F")]
00391         public void PipsPagerWrapModeNavigation()
00392         {
00393             using (var setup = new TestSetupHelper("PipsPager Tests"))
00394             {
00395                 elements = new PipsPagerElements();
00396                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00397                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00398
00399                 ChangeNumberOfPages(NumberOfPagesOptions.Twenty);
00400                 VerifyNumberOfPages("20");
00401
00402                 SetWrapMode(WrapMode.Wrap);
00403
00404                 VerifySelectedPageIndex(0);
00405
00406                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00407
00408                 VerifySelectedPageIndex(19);
00409
00410                 InputHelper.LeftClick(elements.GetNextPageButton());
00411
00412                 VerifySelectedPageIndex(0);
00413             }
00414         }
00415
00416         [TestMethod]
00417         [TestProperty("TestSuite", "F")]
00418         public void PipsPagerWrapModeNavigationInfinitePages()
00419         {
00420             using (var setup = new TestSetupHelper("PipsPager Tests"))
00421             {
00422                 elements = new PipsPagerElements();
00423                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00424                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00425
00426                 SetWrapMode(WrapMode.Wrap);
00427
00428                 ChangeNumberOfPages(NumberOfPagesOptions.Infinite);
00429                 VerifyNumberOfPages("Infinite");
00430
00431                 InputHelper.LeftClick(elements.GetNextPageButton());
00432                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00433
00434                 VerifySelectedPageIndex(0);
00435
00436                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.Collapsed);
00437                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Next, ButtonVisibilityMode.Visible);
00438             }
00439         }
00440
00441         [TestMethod]
00442         [TestProperty("TestSuite", "F")]
00443         public void PipsPagerWrapModeNavigationButtonsHiddenInOnePageScenario()
00444         {
00445             using (var setup = new TestSetupHelper("PipsPager Tests"))
00446             {
00447                 elements = new PipsPagerElements();
00448
00449                 SetWrapMode(WrapMode.Wrap);
00450
00451                 ChangeNumberOfPages(NumberOfPagesOptions.One);
00452                 VerifyNumberOfPages("1");
00453
00454                 SetPreviousPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00455                 SetNextPageButtonVisibilityMode(ButtonVisibilityMode.Visible);
00456
00457                 VerifySelectedPageIndex(0);
00458
00459                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Previous, ButtonVisibilityMode.Collapsed);
00460                 VerifyPageButtonWithVisibilityModeSet(ButtonType.Next, ButtonVisibilityMode.Collapsed);
00461             }
00462         }
00463     }
00464 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TabView/TabViewItem.cpp Source File

  • TabView

TabViewItem.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TabView.h"
00007 #include "TabViewItem.h"
00008 #include "RuntimeProfiler.h"
00009 #include "ResourceAccessor.h"
00010 #include "XamlControlsResources.h"
00011 #include "SharedHelpers.h"
00012
00013 TabViewItem::TabViewItem()
00014 {
00015     __RP_Marker_ClassById(RuntimeProfiler::ProfId_TabViewItem);
00016
00017     SetDefaultStyleKey(this);
00018
00019     SetValue(s_TabViewTemplateSettingsProperty, winrt::make<TabViewItemTemplateSettings>());
00020
00021     Loaded({ this, &TabViewItem::OnLoaded });
00022     SizeChanged({ this, &TabViewItem::OnSizeChanged });
00023
00024     RegisterPropertyChangedCallback(winrt::SelectorItem::IsSelectedProperty(), { this, &TabViewItem::OnIsSelectedPropertyChanged });
00025     RegisterPropertyChangedCallback(winrt::Control::ForegroundProperty(), { this, &TabViewItem::OnForegroundPropertyChanged });
00026 }
00027
00028 void TabViewItem::OnApplyTemplate()
00029 {
00030     __super::OnApplyTemplate();
00031
00032     winrt::IControlProtected controlProtected{ *this };
00033
00034     m_selectedBackgroundPathSizeChangedRevoker.revoke();
00035     m_closeButtonClickRevoker.revoke();
00036     m_tabDragStartingRevoker.revoke();
00037     m_tabDragCompletedRevoker.revoke();
00038
00039     m_selectedBackgroundPath.set(GetTemplateChildT<winrt::Path>(s_selectedBackgroundPathName, controlProtected));
00040
00041     if (const auto selectedBackgroundPath = m_selectedBackgroundPath.get())
00042     {
00043         m_selectedBackgroundPathSizeChangedRevoker = selectedBackgroundPath.SizeChanged(winrt::auto_revoke,
00044         {
00045             [this](auto const&, auto const&)
00046             {
00047                 UpdateSelectedBackgroundPathTranslateTransform();
00048             }
00049         });
00050     }
00051
00052     m_headerContentPresenter.set(GetTemplateChildT<winrt::ContentPresenter>(s_contentPresenterName, controlProtected));
00053
00054     auto tabView = SharedHelpers::GetAncestorOfType<winrt::TabView>(winrt::VisualTreeHelper::GetParent(*this));
00055     auto internalTabView = tabView
00056         ? winrt::get_self<TabView>(tabView)
00057         : nullptr;
00058
00059     m_closeButton.set([this, controlProtected, internalTabView]() {
00060         auto closeButton = GetTemplateChildT<winrt::Button>(s_closeButtonName, controlProtected);
00061         if (closeButton)
00062         {
00063             // Do localization for the close button automation name
00064             if (winrt::AutomationProperties::GetName(closeButton).empty())
00065             {
00066                 auto const closeButtonName = ResourceAccessor::GetLocalizedStringResource(SR_TabViewCloseButtonName);
00067                 winrt::AutomationProperties::SetName(closeButton, closeButtonName);
00068             }
00069
00070             if (internalTabView)
00071             {
00072                 // Setup the tooltip for the close button
00073                 auto tooltip = winrt::ToolTip();
00074                 tooltip.Content(box_value(internalTabView->GetTabCloseButtonTooltipText()));
00075                 winrt::ToolTipService::SetToolTip(closeButton, tooltip);
00076             }
00077
00078             m_closeButtonClickRevoker = closeButton.Click(winrt::auto_revoke, { this, &TabViewItem::OnCloseButtonClick });
00079         }
00080         return closeButton;
00081         }());
00082
00083     OnHeaderChanged();
00084     OnIconSourceChanged();
00085
00086     if (tabView)
00087     {
00088         m_tabDragStartingRevoker = tabView.TabDragStarting(winrt::auto_revoke, { this, &TabViewItem::OnTabDragStarting });
00089         m_tabDragCompletedRevoker = tabView.TabDragCompleted(winrt::auto_revoke, { this, &TabViewItem::OnTabDragCompleted });
00090     }
00091
00092     UpdateCloseButton();
00093     UpdateForeground();
00094     UpdateWidthModeVisualState();
00095     UpdateTabGeometry();
00096 }
00097
00098 void TabViewItem::UpdateTabGeometry()
00099 {
00100     auto const templateSettings = winrt::get_self<TabViewItemTemplateSettings>(TabViewTemplateSettings());
00101     auto const height = ActualHeight();
00102     auto const popupRadius = unbox_value<winrt::CornerRadius>(ResourceAccessor::ResourceLookup(*this, box_value(c_overlayCornerRadiusKey)));
00103     auto const leftCorner = popupRadius.TopLeft;
00104     auto const rightCorner = popupRadius.TopRight;
00105
00106     // Assumes 4px curving-out corners, which are hardcoded in the markup
00107     auto data = L"<Geometry xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>F1 M0,%f  a 4,4 0 0 0 4,-4  L 4,%f  a %f,%f 0 0 1 %f,-%f  l %f,0  a %f,%f 0 0 1 %f,%f  l 0,%f  a 4,4 0 0 0 4,4 Z</Geometry>";
00108
00109     WCHAR strOut[1024];
00110     StringCchPrintf(strOut, ARRAYSIZE(strOut), data,
00111         height,
00112         leftCorner, leftCorner, leftCorner, leftCorner, leftCorner,
00113         ActualWidth() - (leftCorner + rightCorner),
00114         rightCorner, rightCorner, rightCorner, rightCorner,
00115         height - (4.0f + rightCorner));
00116
00117     const auto geometry = winrt::XamlReader::Load(strOut).try_as<winrt::Geometry>();
00118
00119     templateSettings->TabGeometry(geometry);
00120 }
00121
00122 void TabViewItem::OnLoaded(const winrt::IInspectable& sender, const winrt::RoutedEventArgs& args)
00123 {
00124     if (const auto tabView = GetParentTabView())
00125     {
00126         const auto internalTabView = winrt::get_self<TabView>(tabView);
00127         const auto index = internalTabView->IndexFromContainer(*this);
00128         internalTabView->SetTabSeparatorOpacity(index);
00129     }
00130 }
00131
00132 void TabViewItem::OnSizeChanged(const winrt::IInspectable&, const winrt::SizeChangedEventArgs& args)
00133 {
00134     m_dispatcherHelper.RunAsync([strongThis = get_strong()]()
00135     {
00136         strongThis->UpdateTabGeometry();
00137     });
00138 }
00139
00140 void TabViewItem::OnIsSelectedPropertyChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args)
00141 {
00142
00143     if (const auto peer = winrt::FrameworkElementAutomationPeer::CreatePeerForElement(*this))
00144     {
00145         peer.RaiseAutomationEvent(winrt::AutomationEvents::SelectionItemPatternOnElementSelected);
00146     }
00147
00148     if (IsSelected())
00149     {
00150         SetValue(winrt::Canvas::ZIndexProperty(), box_value(20));
00151         StartBringTabIntoView();
00152     }
00153     else
00154     {
00155         SetValue(winrt::Canvas::ZIndexProperty(), box_value(0));
00156     }
00157
00158     UpdateWidthModeVisualState();
00159     UpdateCloseButton();
00160     UpdateForeground();
00161 }
00162
00163 void TabViewItem::OnForegroundPropertyChanged(const winrt::DependencyObject&, const winrt::DependencyProperty&)
00164 {
00165     UpdateForeground();
00166 }
00167
00168 void TabViewItem::UpdateForeground()
00169 {
00170     // We only need to set the foreground state when the TabViewItem is in rest state and not selected.
00171     if (!IsSelected() && !m_isPointerOver)
00172     {
00173         // If Foreground is set, then change icon and header foreground to match.
00174         winrt::VisualStateManager::GoToState(
00175             *this,
00176             ReadLocalValue(winrt::Control::ForegroundProperty()) == winrt::DependencyProperty::UnsetValue() ? s_foregroundSetStateName : s_foregroundNotSetStateName,
00177             false /*useTransitions*/);
00178     }
00179 }
00180
00181 void TabViewItem::UpdateSelectedBackgroundPathTranslateTransform()
00182 {
00183     if (const auto selectedBackgroundPath = m_selectedBackgroundPath.get())
00184     {
00185         const auto selectedBackgroundPathActualOffset = selectedBackgroundPath.ActualOffset();
00186         const auto roundedSelectedBackgroundPathActualOffsetY = std::round(selectedBackgroundPathActualOffset.y);
00187
00188         if (roundedSelectedBackgroundPathActualOffsetY > selectedBackgroundPathActualOffset.y)
00189         {
00190             // Move the SelectedBackgroundPath element down by a fraction of a pixel to avoid a faint gap line
00191             // between the selected TabViewItem and its content.
00192             winrt::TranslateTransform translateTransform;
00193
00194             translateTransform.Y(static_cast<double>(roundedSelectedBackgroundPathActualOffsetY) - static_cast<double>(selectedBackgroundPathActualOffset.y));
00195
00196             selectedBackgroundPath.RenderTransform(translateTransform);
00197         }
00198         else if (selectedBackgroundPath.RenderTransform())
00199         {
00200             // Reset any TranslateTransform that may have been set above.
00201             selectedBackgroundPath.RenderTransform(nullptr);
00202         }
00203     }
00204 }
00205
00206
00207 void TabViewItem::OnTabDragStarting(const winrt::IInspectable& sender, const winrt::TabViewTabDragStartingEventArgs& args)
00208 {
00209     m_isBeingDragged = true;
00210 }
00211
00212 void TabViewItem::OnTabDragCompleted(const winrt::IInspectable& sender, const winrt::TabViewTabDragCompletedEventArgs& args)
00213 {
00214     m_isBeingDragged = false;
00215
00216     StopCheckingForDrag(m_dragPointerId);
00217     UpdateDragDropVisualState(false);
00218     UpdateForeground();
00219 }
00220
00221 winrt::AutomationPeer TabViewItem::OnCreateAutomationPeer()
00222 {
00223     return winrt::make<TabViewItemAutomationPeer>(*this);
00224 }
00225
00226 void TabViewItem::OnCloseButtonOverlayModeChanged(winrt::TabViewCloseButtonOverlayMode const& mode)
00227 {
00228     m_closeButtonOverlayMode = mode;
00229     UpdateCloseButton();
00230 }
00231
00232 winrt::TabView TabViewItem::GetParentTabView()
00233 {
00234     return m_parentTabView.get();
00235 }
00236
00237 void TabViewItem::SetParentTabView(winrt::TabView const& tabView)
00238 {
00239     m_parentTabView = winrt::make_weak(tabView);
00240 }
00241
00242 void TabViewItem::OnTabViewWidthModeChanged(winrt::TabViewWidthMode const& mode)
00243 {
00244     m_tabViewWidthMode = mode;
00245     UpdateWidthModeVisualState();
00246 }
00247
00248 void TabViewItem::UpdateCloseButton()
00249 {
00250     if (!IsClosable())
00251     {
00252         winrt::VisualStateManager::GoToState(*this, s_closeButtonCollapsedStateName, false);
00253     }
00254     else
00255     {
00256         switch (m_closeButtonOverlayMode)
00257         {
00258         case winrt::TabViewCloseButtonOverlayMode::OnPointerOver:
00259         {
00260             // If we only want to show the button on hover, we also show it when we are selected, otherwise hide it
00261             if (IsSelected() || m_isPointerOver)
00262             {
00263                 winrt::VisualStateManager::GoToState(*this, s_closeButtonVisibleStateName, false);
00264             }
00265             else
00266             {
00267                 winrt::VisualStateManager::GoToState(*this, s_closeButtonCollapsedStateName, false);
00268             }
00269             break;
00270         }
00271         default:
00272         {
00273             // Default, use "Auto"
00274             winrt::VisualStateManager::GoToState(*this, s_closeButtonVisibleStateName, false);
00275             break;
00276         }
00277         }
00278     }
00279 }
00280
00281 void TabViewItem::UpdateWidthModeVisualState()
00282 {
00283     // Handling compact/non compact width mode
00284     if (!IsSelected() && m_tabViewWidthMode == winrt::TabViewWidthMode::Compact)
00285     {
00286         winrt::VisualStateManager::GoToState(*this, s_compactStateName, false);
00287     }
00288     else
00289     {
00290         winrt::VisualStateManager::GoToState(*this, s_standardWidthStateName, false);
00291     }
00292 }
00293
00294 void TabViewItem::UpdateDragDropVisualState(bool isVisible)
00295 {
00296     if (isVisible)
00297     {
00298         winrt::VisualStateManager::GoToState(*this, s_dragDropVisualVisibleStateName, false);
00299     }
00300     else
00301     {
00302         winrt::VisualStateManager::GoToState(*this, s_dragDropVisualNotVisibleStateName, false);
00303     }
00304 }
00305
00306 void TabViewItem::RequestClose()
00307 {
00308     if (auto tabView = SharedHelpers::GetAncestorOfType<winrt::TabView>(winrt::VisualTreeHelper::GetParent(*this)))
00309     {
00310         if (auto internalTabView = winrt::get_self<TabView>(tabView))
00311         {
00312             internalTabView->RequestCloseTab(*this, false);
00313         }
00314     }
00315 }
00316
00317 void TabViewItem::RaiseRequestClose(TabViewTabCloseRequestedEventArgs const& args)
00318 {
00319     // This should only be called from TabView, to ensure that both this event and the TabView TabRequestedClose event are raised
00320     m_closeRequestedEventSource(*this, args);
00321 }
00322
00323 void TabViewItem::OnCloseButtonClick(const winrt::IInspectable&, const winrt::RoutedEventArgs&)
00324 {
00325     RequestClose();
00326 }
00327
00328 void TabViewItem::OnIsClosablePropertyChanged(const winrt::DependencyPropertyChangedEventArgs&)
00329 {
00330     UpdateCloseButton();
00331 }
00332
00333 void TabViewItem::OnHeaderPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00334 {
00335     OnHeaderChanged();
00336 }
00337
00338 void TabViewItem::OnHeaderChanged()
00339 {
00340     if (const auto headerContentPresenter = m_headerContentPresenter.get())
00341     {
00342         headerContentPresenter.Content(Header());
00343     }
00344
00345     if (m_firstTimeSettingToolTip)
00346     {
00347         m_firstTimeSettingToolTip = false;
00348
00349         if (!winrt::ToolTipService::GetToolTip(*this))
00350         {
00351             // App author has not specified a tooltip; use our own
00352             m_toolTip.set([this]() {
00353                 auto toolTip = winrt::ToolTip();
00354                 toolTip.Placement(winrt::Controls::Primitives::PlacementMode::Mouse);
00355                 winrt::ToolTipService::SetToolTip(*this, toolTip);
00356                 return toolTip;
00357                 }());
00358         }
00359     }
00360
00361     if (auto&& toolTip = m_toolTip.get())
00362     {
00363         // Update tooltip text to new header text
00364         auto headerContent = Header();
00365         auto potentialString = headerContent.try_as<winrt::IPropertyValue>();
00366
00367         // Only show tooltip if header is a non-empty string.
00368         if (potentialString && potentialString.Type() == winrt::PropertyType::String && !potentialString.GetString().empty())
00369         {
00370             toolTip.Content(headerContent);
00371             toolTip.IsEnabled(true);
00372         }
00373         else
00374         {
00375             toolTip.Content(nullptr);
00376             toolTip.IsEnabled(false);
00377         }
00378     }
00379 }
00380
00381 void TabViewItem::OnPointerPressed(winrt::PointerRoutedEventArgs const& args)
00382 {
00383     const auto pointer = args.Pointer();
00384     const auto pointerDeviceType = pointer.PointerDeviceType();
00385     const auto pointerPoint = args.GetCurrentPoint(*this);
00386
00387     if (pointerDeviceType == winrt::PointerDeviceType::Mouse || pointerDeviceType == winrt::PointerDeviceType::Pen)
00388     {
00389         if (pointerPoint.Properties().IsLeftButtonPressed())
00390         {
00391             m_lastPointerPressedPosition = pointerPoint.Position();
00392
00393             BeginCheckingForDrag(pointer.PointerId());
00394
00395             bool ctrlDown = (args.KeyModifiers() & winrt::VirtualKeyModifiers::Control) == winrt::VirtualKeyModifiers::Control;
00396
00397             if (ctrlDown)
00398             {
00399                 this->IsSelected(true);
00400
00401                 // Return here so the base class will not pick it up, but let it remain unhandled so someone else could handle it.
00402                 return;
00403             }
00404         }
00405     }
00406     else if (pointerDeviceType == winrt::PointerDeviceType::Touch)
00407     {
00408         m_lastPointerPressedPosition = pointerPoint.Position();
00409
00410         BeginCheckingForDrag(pointer.PointerId());
00411     }
00412
00413     __super::OnPointerPressed(args);
00414
00415     if (args.GetCurrentPoint(nullptr).Properties().PointerUpdateKind() == winrt::PointerUpdateKind::MiddleButtonPressed)
00416     {
00417         if (CapturePointer(pointer))
00418         {
00419             m_hasPointerCapture = true;
00420             m_isMiddlePointerButtonPressed = true;
00421         }
00422     }
00423 }
00424
00425 void TabViewItem::OnPointerMoved(winrt::PointerRoutedEventArgs const& args)
00426 {
00427     __super::OnPointerMoved(args);
00428
00429     if (ShouldStartDrag(args))
00430     {
00431         UpdateDragDropVisualState(true);
00432     }
00433 }
00434
00435 void TabViewItem::OnPointerReleased(winrt::PointerRoutedEventArgs const& args)
00436 {
00437     __super::OnPointerReleased(args);
00438
00439     const auto pointer = args.Pointer();
00440
00441     StopCheckingForDrag(pointer.PointerId());
00442     UpdateDragDropVisualState(false);
00443
00444     if (m_hasPointerCapture)
00445     {
00446         if (args.GetCurrentPoint(nullptr).Properties().PointerUpdateKind() == winrt::PointerUpdateKind::MiddleButtonReleased)
00447         {
00448             const bool wasPressed = m_isMiddlePointerButtonPressed;
00449             m_isMiddlePointerButtonPressed = false;
00450             ReleasePointerCapture(pointer);
00451
00452             if (wasPressed)
00453             {
00454                 if (IsClosable())
00455                 {
00456                     RequestClose();
00457                 }
00458             }
00459         }
00460     }
00461 }
00462
00463 bool TabViewItem::IsOutsideDragRectangle(winrt::Point const& testPoint, winrt::Point const& dragRectangleCenter)
00464 {
00465     const double dx = abs(testPoint.X - dragRectangleCenter.X);
00466     const double dy = abs(testPoint.Y - dragRectangleCenter.Y);
00467
00468     double maxDx = GetSystemMetrics(SM_CXDRAG);
00469     double maxDy = GetSystemMetrics(SM_CYDRAG);
00470
00471     maxDx *= c_tabViewItemMouseDragThresholdMultiplier;
00472     maxDy *= c_tabViewItemMouseDragThresholdMultiplier;
00473
00474     return (dx > maxDx || dy > maxDy);
00475 }
00476
00477 bool TabViewItem::ShouldStartDrag(winrt::PointerRoutedEventArgs const& args)
00478 {
00479     return
00480         m_isCheckingforDrag &&
00481         IsOutsideDragRectangle(args.GetCurrentPoint(*this).Position(), m_lastPointerPressedPosition) &&
00482         m_dragPointerId == args.Pointer().PointerId();
00483 }
00484
00485 void TabViewItem::BeginCheckingForDrag(uint32_t const& pointerId)
00486 {
00487     m_dragPointerId = pointerId;
00488     m_isCheckingforDrag = true;
00489 }
00490
00491 void TabViewItem::StopCheckingForDrag(uint32_t const& pointerId)
00492 {
00493     if (m_isCheckingforDrag && m_dragPointerId == pointerId)
00494     {
00495         m_dragPointerId = 0;
00496         m_isCheckingforDrag = false;
00497     }
00498 }
00499
00500 void TabViewItem::HideLeftAdjacentTabSeparator()
00501 {
00502     if (const auto tabView = GetParentTabView())
00503     {
00504         const auto internalTabView = winrt::get_self<TabView>(tabView);
00505         const auto index = internalTabView->IndexFromContainer(*this);
00506         internalTabView->SetTabSeparatorOpacity(index - 1, 0);
00507     }
00508 }
00509
00510 void TabViewItem::RestoreLeftAdjacentTabSeparatorVisibility()
00511 {
00512     if (const auto tabView = GetParentTabView())
00513     {
00514         const auto internalTabView = winrt::get_self<TabView>(tabView);
00515         const auto index = internalTabView->IndexFromContainer(*this);
00516         internalTabView->SetTabSeparatorOpacity(index - 1);
00517     }
00518 }
00519
00520 void TabViewItem::OnPointerEntered(winrt::PointerRoutedEventArgs const& args)
00521 {
00522     __super::OnPointerEntered(args);
00523
00524     m_isPointerOver = true;
00525
00526     if (m_hasPointerCapture)
00527     {
00528         m_isMiddlePointerButtonPressed = true;
00529     }
00530
00531     UpdateCloseButton();
00532     HideLeftAdjacentTabSeparator();
00533 }
00534
00535 void TabViewItem::OnPointerExited(winrt::PointerRoutedEventArgs const& args)
00536 {
00537     __super::OnPointerExited(args);
00538
00539     m_isPointerOver = false;
00540     m_isMiddlePointerButtonPressed = false;
00541
00542     UpdateCloseButton();
00543     UpdateForeground();
00544     RestoreLeftAdjacentTabSeparatorVisibility();
00545 }
00546
00547 void TabViewItem::OnPointerCanceled(winrt::PointerRoutedEventArgs const& args)
00548 {
00549     __super::OnPointerCanceled(args);
00550
00551     const auto pointer = args.Pointer();
00552
00553     StopCheckingForDrag(pointer.PointerId());
00554
00555     if (m_hasPointerCapture)
00556     {
00557         ReleasePointerCapture(pointer);
00558         m_isMiddlePointerButtonPressed = false;
00559     }
00560
00561     RestoreLeftAdjacentTabSeparatorVisibility();
00562 }
00563
00564 void TabViewItem::OnPointerCaptureLost(winrt::PointerRoutedEventArgs const& args)
00565 {
00566     __super::OnPointerCaptureLost(args);
00567
00568     m_hasPointerCapture = false;
00569     m_isMiddlePointerButtonPressed = false;
00570     RestoreLeftAdjacentTabSeparatorVisibility();
00571 }
00572
00573 // Note that the ItemsView will handle the left and right arrow keys if we don't do so before it does,
00574 // so this needs to be handled below the items view. That's why we can't put this in TabView's OnKeyDown.
00575 void TabViewItem::OnKeyDown(winrt::KeyRoutedEventArgs const& args)
00576 {
00577     if (!args.Handled() && (args.Key() == winrt::VirtualKey::Left || args.Key() == winrt::VirtualKey::Right))
00578     {
00579         // Alt+Shift+Arrow reorders tabs, so we don't want to handle that combination.
00580         // ListView also handles Alt+Arrow  (no Shift) by just doing regular XY focus,
00581         // same as how it handles Arrow without any modifier keys, so in that case
00582         // we do want to handle things so we get the improved keyboarding experience.
00583         auto isAltDown = (winrt::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::VirtualKey::Menu) & winrt::CoreVirtualKeyStates::Down) == winrt::CoreVirtualKeyStates::Down;
00584         auto isShiftDown = (winrt::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::VirtualKey::Shift) & winrt::CoreVirtualKeyStates::Down) == winrt::CoreVirtualKeyStates::Down;
00585
00586         if (!isAltDown || !isShiftDown)
00587         {
00588             const bool moveForward =
00589                 (FlowDirection() == winrt::FlowDirection::LeftToRight && args.Key() == winrt::VirtualKey::Right) ||
00590                 (FlowDirection() == winrt::FlowDirection::RightToLeft && args.Key() == winrt::VirtualKey::Left);
00591
00592             args.Handled(winrt::get_self<TabView>(GetParentTabView())->MoveFocus(moveForward));
00593         }
00594     }
00595
00596     if (!args.Handled())
00597     {
00598         __super::OnKeyDown(args);
00599     }
00600 }
00601
00602 void TabViewItem::OnIconSourcePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00603 {
00604     OnIconSourceChanged();
00605 }
00606
00607 void TabViewItem::OnIconSourceChanged()
00608 {
00609     auto const templateSettings = winrt::get_self<TabViewItemTemplateSettings>(TabViewTemplateSettings());
00610     if (auto const source = IconSource())
00611     {
00612         templateSettings->IconElement(SharedHelpers::MakeIconElementFrom(source));
00613         winrt::VisualStateManager::GoToState(*this, s_iconStateName, false);
00614     }
00615     else
00616     {
00617         templateSettings->IconElement(nullptr);
00618         winrt::VisualStateManager::GoToState(*this, s_noIconStateName, false);
00619     }
00620 }
00621
00622 void TabViewItem::StartBringTabIntoView()
00623 {
00624     // we need to set the TargetRect to be slightly wider than the TabViewItem size in order to avoid cutting off the end of the Tab
00625     winrt::BringIntoViewOptions options;
00626     options.TargetRect(winrt::Rect{ 0, 0, DesiredSize().Width + c_targetRectWidthIncrement, DesiredSize().Height});
00627     StartBringIntoView(options);
00628 }
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TestHooks/MUXControlsTestHooks.cpp Source File

  • TestHooks

MUXControlsTestHooks.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MUXControlsTestHooksFactory.h"
00007
00008 #ifdef SELECTORBAR_INCLUDED
00009 #include "SelectorBarTrace.h"
00010 #endif
00011
00012 #ifdef ANNOTATEDSCROLLBAR_INCLUDED
00013 #include "AnnotatedScrollBarTrace.h"
00014 #endif
00015
00016 #ifdef ITEMCONTAINER_INCLUDED
00017 #include "ItemContainerTrace.h"
00018 #endif
00019
00020 #ifdef ITEMSVIEW_INCLUDED
00021 #include "ItemsViewTrace.h"
00022 #endif
00023
00024 #ifdef NAVIGATIONVIEW_INCLUDED
00025 #include "NavigationViewTrace.h"
00026 #endif
00027
00028 #ifdef SCROLLPRESENTER_INCLUDED
00029 #include "ScrollPresenterTrace.h"
00030 #endif
00031
00032 #ifdef SCROLLVIEW_INCLUDED
00033 #include "ScrollViewTrace.h"
00034 #endif
00035
00036 #ifdef SWIPECONTROL_INCLUDED
00037 #include "SwipeControlTrace.h"
00038 #endif
00039
00040 #ifdef COMMANDBARFLYOUT_INCLUDED
00041 #include "CommandBarFlyoutTrace.h"
00042 #endif
00043
00044 #ifdef REPEATER_INCLUDED
00045 #include "ItemsRepeaterTrace.h"
00046 #include "LinedFlowLayoutTrace.h"
00047 #endif
00048
00049 #include "TabViewTrace.h"
00050
00051 /*static*/
00052 UCHAR MUXControlsTestHooks::GetLoggingLevelForType(const wstring_view& type)
00053 {
00054     if (type.empty())
00055     {
00056         return m_globalLoggingLevel;
00057     }
00058     else
00059     {
00060         const auto iterator = m_typeLoggingLevels.find(type);
00061
00062         if (iterator != m_typeLoggingLevels.end())
00063         {
00064             return iterator->second;
00065         }
00066         else
00067         {
00068             return WINEVENT_LEVEL_NONE;
00069         }
00070     }
00071 }
00072
00073 UCHAR MUXControlsTestHooks::GetLoggingLevelForInstance(const winrt::IInspectable& sender)
00074 {
00075     if (sender)
00076     {
00077         const auto iterator = m_instanceLoggingLevels.find(sender);
00078
00079         if (iterator != m_instanceLoggingLevels.end())
00080         {
00081             return iterator->second;
00082         }
00083         else
00084         {
00085             return WINEVENT_LEVEL_NONE;
00086         }
00087     }
00088     else
00089     {
00090         return m_globalLoggingLevel;
00091     }
00092 }
00093
00094 void MUXControlsTestHooks::SetOutputDebugStringLevelForTypeImpl(const wstring_view& type, bool isLoggingInfoLevel, bool isLoggingVerboseLevel)
00095 {
00096 #ifdef SELECTORBAR_INCLUDED
00097     if (type == L"SelectorBar" || type.empty())
00098     {
00099         SelectorBarTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00100         SelectorBarTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00101     }
00102 #endif
00103 #ifdef ANNOTATEDSCROLLBAR_INCLUDED
00104 if (type == L"AnnotatedScrollBar" || type.empty())
00105 {
00106     AnnotatedScrollBarTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00107     AnnotatedScrollBarTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00108 }
00109 #endif
00110 #ifdef ITEMCONTAINER_INCLUDED
00111     if (type == L"ItemContainer" || type.empty())
00112     {
00113         ItemContainerTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00114         ItemContainerTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00115     }
00116 #endif
00117 #ifdef ITEMSVIEW_INCLUDED
00118     if (type == L"ItemsView" || type.empty())
00119     {
00120         ItemsViewTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00121         ItemsViewTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00122     }
00123 #endif
00124 #ifdef NAVIGATIONVIEW_INCLUDED
00125     if (type == L"NavigationView" || type.empty())
00126     {
00127         NavigationViewTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00128         NavigationViewTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00129     }
00130 #endif
00131 #ifdef SCROLLPRESENTER_INCLUDED
00132     if (type == L"ScrollPresenter" || type.empty())
00133     {
00134         ScrollPresenterTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00135         ScrollPresenterTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00136     }
00137 #endif
00138 #ifdef SCROLLVIEW_INCLUDED
00139     if (type == L"ScrollView" || type.empty())
00140     {
00141         ScrollViewTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00142         ScrollViewTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00143     }
00144 #endif
00145 #ifdef SWIPECONTROL_INCLUDED
00146     if (type == L"SwipeControl" || type.empty())
00147     {
00148         SwipeControlTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00149         SwipeControlTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00150     }
00151 #endif
00152 #ifdef COMMANDBARFLYOUT_INCLUDED
00153     if (type == L"CommandBarFlyout" || type.empty())
00154     {
00155         CommandBarFlyoutTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00156         CommandBarFlyoutTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00157     }
00158 #endif
00159 #ifdef REPEATER_INCLUDED
00160     if (type == L"ItemsRepeater" || type.empty())
00161     {
00162         ItemsRepeaterTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00163     }
00164     if (type == L"LinedFlowLayout" || type.empty())
00165     {
00166         LinedFlowLayoutTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00167         LinedFlowLayoutTrace::s_IsVerboseDebugOutputEnabled = isLoggingVerboseLevel;
00168     }
00169 #endif
00170     if (type == L"TabView" || type.empty())
00171     {
00172         TabViewTrace::s_IsDebugOutputEnabled = isLoggingInfoLevel || isLoggingVerboseLevel;
00173     }
00174 }
00175
00176 void MUXControlsTestHooks::SetLoggingLevelForTypeImpl(const wstring_view& type, bool isLoggingInfoLevel, bool isLoggingVerboseLevel)
00177 {
00178     UCHAR loggingProviderLevel = WINEVENT_LEVEL_NONE;
00179
00180     if (isLoggingVerboseLevel)
00181     {
00182         loggingProviderLevel = WINEVENT_LEVEL_VERBOSE;
00183     }
00184     else if (isLoggingInfoLevel)
00185     {
00186         loggingProviderLevel = WINEVENT_LEVEL_INFO;
00187     }
00188
00189     if (type.empty())
00190     {
00191         m_globalLoggingLevel = loggingProviderLevel;
00192     }
00193     else
00194     {
00195         const auto iterator = m_typeLoggingLevels.find(type);
00196
00197         if (iterator != m_typeLoggingLevels.end())
00198         {
00199             if (loggingProviderLevel == WINEVENT_LEVEL_NONE)
00200             {
00201                 m_typeLoggingLevels.erase(iterator);
00202             }
00203             else
00204             {
00205                 iterator->second = loggingProviderLevel;
00206             }
00207         }
00208         else if (loggingProviderLevel != WINEVENT_LEVEL_NONE)
00209         {
00210             m_typeLoggingLevels.emplace(type, loggingProviderLevel);
00211         }
00212     }
00213 }
00214
00215 void MUXControlsTestHooks::SetLoggingLevelForInstanceImpl(const winrt::IInspectable& sender, bool isLoggingInfoLevel, bool isLoggingVerboseLevel)
00216 {
00217     UCHAR loggingProviderLevel = WINEVENT_LEVEL_NONE;
00218
00219     if (isLoggingVerboseLevel)
00220     {
00221         loggingProviderLevel = WINEVENT_LEVEL_VERBOSE;
00222     }
00223     else if (isLoggingInfoLevel)
00224     {
00225         loggingProviderLevel = WINEVENT_LEVEL_INFO;
00226     }
00227
00228     if (sender)
00229     {
00230         const auto iterator = m_instanceLoggingLevels.find(sender);
00231
00232         if (iterator != m_instanceLoggingLevels.end())
00233         {
00234             if (loggingProviderLevel == WINEVENT_LEVEL_NONE)
00235             {
00236                 m_instanceLoggingLevels.erase(iterator);
00237             }
00238             else
00239             {
00240                 iterator->second = loggingProviderLevel;
00241             }
00242         }
00243         else if (loggingProviderLevel != WINEVENT_LEVEL_NONE)
00244         {
00245             m_instanceLoggingLevels.emplace(sender, loggingProviderLevel);
00246         }
00247     }
00248     else
00249     {
00250         m_globalLoggingLevel = loggingProviderLevel;
00251     }
00252 }
00253
00254 void MUXControlsTestHooks::LogMessage(const winrt::IInspectable& sender, const wstring_view& message, bool isVerboseLevel)
00255 {
00256     com_ptr<MUXControlsTestHooksLoggingMessageEventArgs> loggingMessageEventArgs = winrt::make_self<MUXControlsTestHooksLoggingMessageEventArgs>();
00257
00258     loggingMessageEventArgs->SetMessage(message);
00259     loggingMessageEventArgs->SetIsVerboseLevel(isVerboseLevel);
00260     m_loggingMessageEventSource(sender, *loggingMessageEventArgs);
00261 }
00262
00263 winrt::event_token MUXControlsTestHooks::LoggingMessageImpl(
00264     winrt::TypedEventHandler<winrt::IInspectable, winrt::MUXControlsTestHooksLoggingMessageEventArgs> const& value)
00265 {
00266     return m_loggingMessageEventSource.add(value);
00267 }
00268
00269 void MUXControlsTestHooks::LoggingMessageImpl(winrt::event_token const& token)
00270 {
00271     m_loggingMessageEventSource.remove(token);
00272 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/NavigationViewItemAutomationPeer.properties.cpp Source File

  • Generated

NavigationViewItemAutomationPeer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "NavigationViewItemAutomationPeer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Automation::Peers
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(NavigationViewItemAutomationPeer)
00012 }
00013
00014 #include "NavigationViewItemAutomationPeer.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommandBarFlyoutCommandBarAutomationProperties Member List

This is the complete list of members for CommandBarFlyoutCommandBarAutomationProperties, including all inherited members.
ClearProperties() | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
CommandBarFlyoutCommandBarAutomationPropertiesProperties() | CommandBarFlyoutCommandBarAutomationPropertiesProperties |
ControlTypeProperty() | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [inline, static]
EnsureProperties() | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
GetControlType(winrt::UIElement const &target) | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
OnControlTypePropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyPropertyChangedEventArgs &args) | CommandBarFlyoutCommandBarAutomationProperties | [static]
s_ControlTypeProperty | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
SetControlType(winrt::UIElement const &target, winrt::AutomationControlType const &value) | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
Generated on Sun Dec 1 2024 20:52:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Flex::LineInfo Member List

This is the complete list of members for Flex::LineInfo, including all inherited members.
CountInLine | Flex::LineInfo |
CrossPosition | Flex::LineInfo |
CrossSize | Flex::LineInfo |
MainSize | Flex::LineInfo |
StartIndex | Flex::LineInfo |
SumGrow | Flex::LineInfo |
SumShrink | Flex::LineInfo |
ToString() | Flex::LineInfo | [inline]
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: DropDownButton/DropDownButtonAutomationPeer.idl Source File

  • DropDownButton

DropDownButtonAutomationPeer.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XAP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 unsealed runtimeclass DropDownButtonAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.ButtonAutomationPeer,
00007 Microsoft.UI.Xaml.Automation.Provider.IExpandCollapseProvider
00008 {
00009     DropDownButtonAutomationPeer(MU_XC_NAMESPACE.DropDownButton owner);
00010 }
00011
00012 }
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InfoBarPanel.properties.h Source File

  • Generated

InfoBarPanel.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InfoBarPanelProperties
00008 {
00009 public:
00010     InfoBarPanelProperties();
00011
00012     static void SetHorizontalOrientationMargin(winrt::DependencyObject const& target, winrt::Thickness const& value);
00013     static winrt::Thickness GetHorizontalOrientationMargin(winrt::DependencyObject const& target);
00014
00015     void HorizontalOrientationPadding(winrt::Thickness const& value);
00016     winrt::Thickness HorizontalOrientationPadding();
00017
00018     static void SetVerticalOrientationMargin(winrt::DependencyObject const& target, winrt::Thickness const& value);
00019     static winrt::Thickness GetVerticalOrientationMargin(winrt::DependencyObject const& target);
00020
00021     void VerticalOrientationPadding(winrt::Thickness const& value);
00022     winrt::Thickness VerticalOrientationPadding();
00023
00024     static winrt::DependencyProperty HorizontalOrientationMarginProperty() { return s_HorizontalOrientationMarginProperty; }
00025     static winrt::DependencyProperty HorizontalOrientationPaddingProperty() { return s_HorizontalOrientationPaddingProperty; }
00026     static winrt::DependencyProperty VerticalOrientationMarginProperty() { return s_VerticalOrientationMarginProperty; }
00027     static winrt::DependencyProperty VerticalOrientationPaddingProperty() { return s_VerticalOrientationPaddingProperty; }
00028
00029     static GlobalDependencyProperty s_HorizontalOrientationMarginProperty;
00030     static GlobalDependencyProperty s_HorizontalOrientationPaddingProperty;
00031     static GlobalDependencyProperty s_VerticalOrientationMarginProperty;
00032     static GlobalDependencyProperty s_VerticalOrientationPaddingProperty;
00033
00034     static void EnsureProperties();
00035     static void ClearProperties();
00036 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TitleBar/TestUI/TitleBarPage.xaml.cs Source File

  • TitleBar
  • TestUI

TitleBarPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Markup;
00010 using Windows.UI;
00011 using System.Windows.Input;
00012
00013 using Windows.UI.ViewManagement;
00014 using Windows.Foundation;
00015 using MUXControlsTestApp.Utilities;
00016 using Microsoft.UI.Windowing;
00017
00018 namespace MUXControlsTestApp
00019 {
00020     [TopLevelTestPage(Name = "TitleBar", Icon = "DefaultIcon.png")]
00021     public sealed partial class TitleBarPage : TestPage
00022     {
00023         public TitleBarPage()
00024         {
00025             this.InitializeComponent();
00026         }
00027
00028         private void TitleBarWindowingButton_Click(object sender, RoutedEventArgs e)
00029         {
00030             var newWindow = new TitleBarPageWindow();
00031             newWindow.Activate();
00032         }
00033
00034     }
00035 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioButtons/APITests/RadioButtonsTests.cs Source File

  • RadioButtons
  • APITests

RadioButtonsTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using MUXControlsTestApp.Utilities;
00005
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls;
00008 using Common;
00009 using Microsoft.UI.Xaml.Markup;
00010 using System.Collections.Generic;
00011 using Microsoft.UI.Xaml.Media;
00012 using System.Linq;
00013
00014 using WEX.TestExecution;
00015 using WEX.TestExecution.Markup;
00016 using WEX.Logging.Interop;
00017
00018 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00019 {
00020     [TestClass]
00021     public class RadioButtonsTests : ApiTestBase
00022     {
00023         [TestMethod]
00024         public void VerifyCustomItemTemplate()
00025         {
00026             RadioButtons radioButtons = null;
00027             RadioButtons radioButtons2 = null;
00028             RunOnUIThread.Execute(() =>
00029             {
00030                 radioButtons = new RadioButtons();
00031                 radioButtons.ItemsSource = new List<string>() { "Option 1", "Option 2" };
00032
00033                 // Set a custom ItemTemplate to be wrapped in a RadioButton.
00034                 var itemTemplate = (DataTemplate)XamlReader.Load(
00035                         @"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00036                             <TextBlock Text = '{Binding}'/>
00037                         </DataTemplate>");
00038
00039                 radioButtons.ItemTemplate = itemTemplate;
00040
00041                 radioButtons2 = new RadioButtons();
00042                 radioButtons2.ItemsSource = new List<string>() { "Option 1", "Option 2" };
00043
00044                 // Set a custom ItemTemplate which is already a RadioButton. No wrapping should be performed.
00045                 var itemTemplate2 = (DataTemplate)XamlReader.Load(
00046                         @"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00047                             <RadioButton Foreground='Blue'>
00048                               <TextBlock Text = '{Binding}'/>
00049                             </RadioButton>
00050                         </DataTemplate>");
00051
00052                 radioButtons2.ItemTemplate = itemTemplate2;
00053
00054                 var stackPanel = new StackPanel();
00055                 stackPanel.Children.Add(radioButtons);
00056                 stackPanel.Children.Add(radioButtons2);
00057
00058                 Content = stackPanel;
00059                 Content.UpdateLayout();
00060             });
00061
00062             IdleSynchronizer.Wait();
00063
00064             RunOnUIThread.Execute(() =>
00065             {
00066                 var radioButton1 = radioButtons.ContainerFromIndex(0) as RadioButton;
00067                 var radioButton2 = radioButtons2.ContainerFromIndex(0) as RadioButton;
00068                 Verify.IsNotNull(radioButton1, "Our custom ItemTemplate should have been wrapped in a RadioButton.");
00069                 Verify.IsNotNull(radioButton2, "Our custom ItemTemplate should have been wrapped in a RadioButton.");
00070
00071                 bool testCondition = !(radioButton1.Foreground is SolidColorBrush brush && brush.Color == Colors.Blue);
00072                 Verify.IsTrue(testCondition, "Default foreground color of the RadioButton should not have been [blue].");
00073
00074                 testCondition = radioButton2.Foreground is SolidColorBrush brush2 && brush2.Color == Colors.Blue;
00075                 Verify.IsTrue(testCondition, "The foreground color of the RadioButton should have been [blue].");
00076             });
00077         }
00078
00079         [TestMethod]
00080         public void VerifyIsEnabledChangeUpdatesVisualState()
00081         {
00082             RadioButtons radioButtons = null; ;
00083             VisualStateGroup commonStatesGroup = null;
00084             RunOnUIThread.Execute(() =>
00085             {
00086                 radioButtons = new RadioButtons();
00087
00088                 // Check 1: Set IsEnabled to true.
00089                 radioButtons.IsEnabled = true;
00090
00091                 Content = radioButtons;
00092             });
00093             IdleSynchronizer.Wait();
00094
00095             RunOnUIThread.Execute(() =>
00096             {
00097                 Content.UpdateLayout();
00098             });
00099             IdleSynchronizer.Wait();
00100
00101             RunOnUIThread.Execute(() =>
00102             {
00103                 var radioButtonsLayoutRoot = (FrameworkElement)VisualTreeHelper.GetChild(radioButtons, 0);
00104                 commonStatesGroup = VisualStateManager.GetVisualStateGroups(radioButtonsLayoutRoot).First(vsg => vsg.Name.Equals("CommonStates"));
00105
00106                 Verify.AreEqual("Normal", commonStatesGroup.CurrentState.Name);
00107
00108                 // Check 2: Set IsEnabled to false.
00109                 radioButtons.IsEnabled = false;
00110             });
00111             IdleSynchronizer.Wait();
00112
00113             RunOnUIThread.Execute(() =>
00114             {
00115                 Content.UpdateLayout();
00116             });
00117             IdleSynchronizer.Wait();
00118
00119             RunOnUIThread.Execute(() =>
00120             {
00121                 Verify.AreEqual("Disabled", commonStatesGroup.CurrentState.Name);
00122
00123                 // Check 3: Set IsEnabled back to true.
00124                 radioButtons.IsEnabled = true;
00125             });
00126             IdleSynchronizer.Wait();
00127
00128             RunOnUIThread.Execute(() =>
00129             {
00130                 Content.UpdateLayout();
00131             });
00132             IdleSynchronizer.Wait();
00133
00134             RunOnUIThread.Execute(() =>
00135             {
00136                 Verify.AreEqual("Normal", commonStatesGroup.CurrentState.Name);
00137             });
00138         }
00139     }
00140 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/RecyclingElementFactory.h Source File

  • Repeater

RecyclingElementFactory.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ElementFactory.h"
00007 #include "RecyclingElementFactory.g.h"
00008 #include "RecyclingElementFactory.properties.h"
00009
00010 class RecyclingElementFactory :
00011     public ReferenceTracker<RecyclingElementFactory, winrt::implementation::RecyclingElementFactoryT, ElementFactory>,
00012     public RecyclingElementFactoryProperties
00013 {
00014 public:
00015     RecyclingElementFactory();
00016
00017 #pragma region IRecyclingElementFactory
00018     winrt::RecyclePool RecyclePool();
00019     void RecyclePool(winrt::RecyclePool const& value);
00020
00021     winrt::IMap<winrt::hstring, winrt::DataTemplate> Templates();
00022     void Templates(winrt::IMap<winrt::hstring, winrt::DataTemplate> const& value);
00023
00024 #pragma endregion
00025
00026 #pragma region IRecyclingElementFactoryOverrides
00027     winrt::hstring OnSelectTemplateKeyCore(winrt::IInspectable const& dataContext, winrt::UIElement const& owner);
00028 #pragma endregion
00029
00030 #pragma region IElementFactoryOverrides
00031     winrt::UIElement GetElementCore(winrt::ElementFactoryGetArgs const& args);
00032     void RecycleElementCore(winrt::ElementFactoryRecycleArgs const& args);
00033 #pragma endregion
00034
00035 private:
00036     tracker_ref<winrt::RecyclePool> m_recyclePool{ this };
00037     tracker_ref<winrt::IMap<winrt::hstring, winrt::DataTemplate>> m_templates{ this };
00038     tracker_ref<winrt::SelectTemplateEventArgs> m_args{ this };
00039 };
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnnotatedScrollBar/APITests/AnnotatedScrollBarTests.cs Source File

  • AnnotatedScrollBar
  • APITests

AnnotatedScrollBarTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using System.Collections.Generic;
00007 using Microsoft.UI.Xaml.Controls;
00008 using MUXControlsTestApp.Utilities;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00015 {
00016     [TestClass]
00017     public class AnnotatedScrollBarTests : ApiTestBase
00018     {
00019         [TestMethod]
00020         [TestProperty("Description", "Verifies the AnnotatedScrollBar default property values.")]
00021         public void VerifyDefaultPropertyValues()
00022         {
00023             RunOnUIThread.Execute(() =>
00024             {
00025                 AnnotatedScrollBar annotatedScrollBar = new AnnotatedScrollBar();
00026                 Verify.IsNotNull(annotatedScrollBar);
00027
00028                 Log.Comment("Logging AnnotatedScrollBar default property values");
00029                 LogAnnotatedScrollBarProperties(annotatedScrollBar);
00030
00031                 Log.Comment("Verifying AnnotatedScrollBar default property values");
00032                 Verify.IsNotNull(annotatedScrollBar.Labels);
00033                 Verify.IsNull(annotatedScrollBar.LabelTemplate);
00034                 Verify.IsNull(annotatedScrollBar.DetailLabelTemplate);
00035                 Verify.AreEqual(annotatedScrollBar.SmallChange, 0);
00036             });
00037         }
00038
00039         private void LogAnnotatedScrollBarProperties(AnnotatedScrollBar annotatedScrollBar)
00040         {
00041             Log.Comment(" - annotatedScrollBar.Labels.Count: " + annotatedScrollBar.Labels.Count);
00042             Log.Comment(" - annotatedScrollBar.LabelTemplate: " + (annotatedScrollBar.LabelTemplate == null ? "null" : "non-null"));
00043             Log.Comment(" - annotatedScrollBar.DetailLabelTemplate: " + (annotatedScrollBar.DetailLabelTemplate == null ? "null" : "non-null"));
00044             Log.Comment(" - annotatedScrollBar.SmallChange: " + annotatedScrollBar.SmallChange);
00045         }
00046     }
00047 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterPrivate.cpp Source File

  • ScrollPresenter

ScrollPresenterPrivate.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenter.h"
00008 #include "DoubleUtil.h"
00009
00010 bool ScrollPresenter::IsHorizontallyScrollable()
00011 {
00012     return m_contentOrientation != winrt::ScrollingContentOrientation::Vertical;
00013 }
00014
00015 bool ScrollPresenter::IsVerticallyScrollable()
00016 {
00017     return m_contentOrientation != winrt::ScrollingContentOrientation::Horizontal;
00018 }
00019
00020 winrt::event_token ScrollPresenter::ViewportChanged(winrt::ViewportChangedEventHandler const& value)
00021 {
00022     return m_viewportChanged.add(value);
00023 }
00024
00025 void ScrollPresenter::ViewportChanged(winrt::event_token const& token)
00026 {
00027     m_viewportChanged.remove(token);
00028 }
00029
00030 winrt::event_token ScrollPresenter::PostArrange(winrt::PostArrangeEventHandler const& value)
00031 {
00032     return m_postArrange.add(value);
00033 }
00034
00035 void ScrollPresenter::PostArrange(winrt::event_token const& token)
00036 {
00037     m_postArrange.remove(token);
00038 }
00039
00040 winrt::event_token ScrollPresenter::ConfigurationChanged(winrt::ConfigurationChangedEventHandler const& value)
00041 {
00042     return m_configurationChanged.add(value);
00043 }
00044
00045 void ScrollPresenter::ConfigurationChanged(winrt::event_token const& token)
00046 {
00047     m_configurationChanged.remove(token);
00048 }
00049
00050 winrt::Rect ScrollPresenter::GetRelativeViewport(
00051     winrt::UIElement const& child)
00052 {
00053     // The commented out code is expected to work but somehow the child.TransformToVisual(*this)
00054     // transform returns unexpected values shortly after a ScrollPresenter.Content layout offset change.
00055     // Bug 14999031 is tracking this issue. For now the m_contentLayoutOffsetX/Y, m_zoomedHorizontalOffset,
00056     // m_zoomedVerticalOffset usage below mitigates the problem.
00057
00058     //const winrt::GeneralTransform transform = child.TransformToVisual(*this);
00059     const winrt::GeneralTransform transform = child.TransformToVisual(Content());
00060     const winrt::Point elementOffset = transform.TransformPoint(winrt::Point{});
00061     const float viewportWidth = static_cast<float>(m_viewportWidth / m_zoomFactor);
00062     const float viewportHeight = static_cast<float>(m_viewportHeight / m_zoomFactor);
00063
00064     //winrt::Rect result = { -elementOffset.X / m_zoomFactor,
00065     //                       -elementOffset.Y / m_zoomFactor,
00066     //                       viewportWidth, viewportHeight };
00067
00068     winrt::float2 minPosition{};
00069
00070     ComputeMinMaxPositions(m_zoomFactor, &minPosition, nullptr);
00071
00072     const winrt::Rect result = { (minPosition.x - m_contentLayoutOffsetX + static_cast<float>(m_zoomedHorizontalOffset) - elementOffset.X) / m_zoomFactor,
00073         (minPosition.y - m_contentLayoutOffsetY + static_cast<float>(m_zoomedVerticalOffset) - elementOffset.Y) / m_zoomFactor,
00074         viewportWidth, viewportHeight };
00075
00076     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, child, TypeLogging::RectToString(result).c_str());
00077
00078     return result;
00079 }
00080
00081 winrt::UIElement ScrollPresenter::CurrentAnchor()
00082 {
00083     return AnchorElement();
00084 }
00085
00086 winrt::UIElement ScrollPresenter::AnchorElement()
00087 {
00088     bool isAnchoringElementHorizontally = false;
00089     bool isAnchoringElementVertically = false;
00090
00091     IsAnchoring(&isAnchoringElementHorizontally, &isAnchoringElementVertically);
00092
00093     if (isAnchoringElementHorizontally || isAnchoringElementVertically)
00094     {
00095         EnsureAnchorElementSelection();
00096     }
00097
00098     auto value = m_anchorElement.get();
00099     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, value);
00100
00101     return value;
00102 }
00103
00104 void ScrollPresenter::RegisterAnchorCandidate(winrt::UIElement const& element)
00105 {
00106 #ifdef DBG_VERBOSE
00107     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, element);
00108 #endif
00109
00110     if (!element)
00111     {
00112         throw winrt::hresult_error(E_INVALIDARG);
00113     }
00114
00115     if (!isnan(HorizontalAnchorRatio()) || !isnan(VerticalAnchorRatio()))
00116     {
00117 #ifdef DBG
00118         // We should not be registering the same element twice. Even through it is functionally ok,
00119         // we will end up spending more time during arrange than we must.
00120         // However checking if an element is already in the list every time a new element is registered is worse for perf.
00121         // So, I'm leaving an assert here to catch regression in our code but in release builds we run without the check.
00122         const winrt::UIElement anchorCandidate = element;
00123         const auto it = std::find_if(m_anchorCandidates.cbegin(), m_anchorCandidates.cend(), [&anchorCandidate](const tracker_ref<winrt::UIElement>& a) { return a.get() == anchorCandidate; });
00124         if (it != m_anchorCandidates.cend())
00125         {
00126             MUX_ASSERT(false);
00127         }
00128 #endif // DBG
00129
00130         m_anchorCandidates.push_back(tracker_ref<winrt::UIElement>{ this, element });
00131         m_isAnchorElementDirty = true;
00132     }
00133 }
00134
00135 void ScrollPresenter::UnregisterAnchorCandidate(winrt::UIElement const& element)
00136 {
00137 #ifdef DBG_VERBOSE
00138     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, element);
00139 #endif
00140
00141     if (!element)
00142     {
00143         throw winrt::hresult_error(E_INVALIDARG);
00144     }
00145
00146     const winrt::UIElement anchorCandidate = element;
00147     const auto it = std::find_if(m_anchorCandidates.cbegin(), m_anchorCandidates.cend(), [&anchorCandidate](const tracker_ref<winrt::UIElement>& a) { return a.get() == anchorCandidate; });
00148     if (it != m_anchorCandidates.cend())
00149     {
00150         m_anchorCandidates.erase(it);
00151         m_isAnchorElementDirty = true;
00152     }
00153 }
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/RecyclePoolTests.cs Source File

  • Repeater
  • APITests

RecyclePoolTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common.Mocks;
00006 using MUXControlsTestApp.Utilities;
00007 using System.Collections.ObjectModel;
00008 using System.Linq;
00009 using System.Runtime.InteropServices;
00010 using Microsoft.UI.Xaml;
00011 using Microsoft.UI.Xaml.Controls;
00012 using Microsoft.UI.Xaml.Markup;
00013 using Microsoft.UI.Xaml.Media;
00014 using Common;
00015
00016 using WEX.TestExecution;
00017 using WEX.TestExecution.Markup;
00018 using WEX.Logging.Interop;
00019
00020 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests
00021 {
00022     [TestClass]
00023     public class RecyclePoolTests : ApiTestBase
00024     {
00025
00026         public void ValidateElementsHaveCorrectKeys()
00027         {
00028             RunOnUIThread.Execute(() =>
00029             {
00030                 var element = new Button();
00031                 const string buttonKey = "ButtonKey";
00032                 const string textBlockKey = "TextBlockKey";
00033                 const string stackPanelKey = "StackPanelKey";
00034
00035                 RecyclePool pool = new RecyclePool();
00036                 pool.PutElement(new Button(), buttonKey);
00037                 pool.PutElement(new TextBlock(), textBlockKey);
00038                 pool.PutElement(new StackPanel(), stackPanelKey);
00039                 pool.PutElement(new Button(), buttonKey);
00040                 pool.PutElement(new TextBlock(), textBlockKey);
00041                 pool.PutElement(new StackPanel(), stackPanelKey);
00042                 pool.PutElement(new Button(), buttonKey);
00043                 pool.PutElement(new TextBlock(), textBlockKey);
00044                 pool.PutElement(new StackPanel(), stackPanelKey);
00045
00046                 Verify.IsNotNull((Button)pool.TryGetElement(buttonKey));
00047                 Verify.IsNotNull((Button)pool.TryGetElement(buttonKey));
00048                 Verify.IsNotNull((Button)pool.TryGetElement(buttonKey));
00049                 Verify.IsNull(pool.TryGetElement(buttonKey));
00050
00051                 Verify.IsNotNull((TextBlock)pool.TryGetElement(textBlockKey));
00052                 Verify.IsNotNull((TextBlock)pool.TryGetElement(textBlockKey));
00053                 Verify.IsNotNull((TextBlock)pool.TryGetElement(textBlockKey));
00054                 Verify.IsNull(pool.TryGetElement(textBlockKey));
00055
00056                 Verify.IsNotNull((StackPanel)pool.TryGetElement(stackPanelKey));
00057                 Verify.IsNotNull((StackPanel)pool.TryGetElement(stackPanelKey));
00058                 Verify.IsNotNull((StackPanel)pool.TryGetElement(stackPanelKey));
00059                 Verify.IsNull(pool.TryGetElement(stackPanelKey));
00060
00061
00062                 Verify.Throws<COMException>(delegate
00063                 {
00064                     pool.PutElement(new Button(), null, null);
00065                 });
00066
00067                 Verify.Throws<COMException>(delegate
00068                 {
00069                     pool.PutElement(new Button(), buttonKey, new Button() /* not a panel */);
00070                 });
00071
00072                 Verify.Throws<COMException>(delegate
00073                 {
00074                     pool.TryGetElement(null, null);
00075                 });
00076             });
00077         }
00078
00079         [TestMethod]
00080         public void ValidateOwnershipWithStackPanel()
00081         {
00082             RunOnUIThread.Execute(() =>
00083             {
00084                 RecyclePool pool = new RecyclePool();
00085                 var owner = new StackPanel();
00086                 var child = new Button();
00087                 owner.Children.Add(child);
00088                 pool.PutElement(child, "Key", owner);
00089                 var recycled = pool.TryGetElement("Key", owner);
00090                 Verify.AreSame(child, recycled);
00091                 Verify.AreEqual(0, owner.Children.IndexOf(child));
00092             });
00093         }
00094
00095         // Validate that if the pool has an element for the requested owner,
00096         // then that is given preference over other elements.
00097         [TestMethod]
00098         public void ValidateRecycledElementOwnerAffinity()
00099         {
00100             RunOnUIThread.Execute(() =>
00101             {
00102                 ItemsRepeater repeater1 = null;
00103                 ItemsRepeater repeater2 = null;
00104                 const int numItems = 10;
00105                 var dataCollection = new ObservableCollection<int>(Enumerable.Range(0, numItems));
00106                 const string recycleKey = "key";
00107
00108                 var dataSource = MockItemsSource.CreateDataSource<int>(dataCollection, true);
00109                 var layout = new StackLayout();
00110                 var recyclePool = new RecyclePool();
00111                 var itemTemplate = (DataTemplate)XamlReader.Load(
00112                     @"<DataTemplate  xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00113                          <TextBlock Text='{Binding}' />
00114                     </DataTemplate>");
00115
00116                 repeater1 = new ItemsRepeater()
00117                 {
00118                     ItemsSource = dataSource,
00119                     Layout = layout,
00120                     ItemTemplate = new RecyclingElementFactoryDerived()
00121                     {
00122                         Templates = { { "key", itemTemplate } },
00123                         RecyclePool = recyclePool,
00124                         SelectTemplateIdFunc = (object data, UIElement owner) => recycleKey
00125                     }
00126                 };
00127
00128                 repeater2 = new ItemsRepeater()
00129                 {
00130                     ItemsSource = dataSource,
00131                     Layout = layout,
00132                     ItemTemplate = new RecyclingElementFactoryDerived()
00133                     {
00134                         Templates = { { "key", itemTemplate } },
00135                         RecyclePool = recyclePool,
00136                         SelectTemplateIdFunc = (object data, UIElement owner) => recycleKey
00137                     }
00138                 };
00139
00140                 var root = new StackPanel();
00141                 root.Children.Add(repeater1);
00142                 root.Children.Add(repeater2);
00143
00144                 Content = new ItemsRepeaterScrollHost()
00145                 {
00146                     Width = 400,
00147                     Height = 400,
00148                     ScrollViewer = new ScrollViewer()
00149                     {
00150                         Content = root
00151                     }
00152                 };
00153
00154                 Content.UpdateLayout();
00155                 Verify.AreEqual(numItems, VisualTreeHelper.GetChildrenCount(repeater1));
00156                 Verify.AreEqual(numItems, VisualTreeHelper.GetChildrenCount(repeater2));
00157
00158                 // Throw all the elements into the recycle pool
00159                 dataCollection.Clear();
00160                 Content.UpdateLayout();
00161
00162                 for (int i = 0; i < numItems; i++)
00163                 {
00164                     var element1 = (FrameworkElement)recyclePool.TryGetElement(recycleKey, repeater1);
00165                     Verify.AreSame(repeater1, element1.Parent);
00166
00167                     var element2 = (FrameworkElement)recyclePool.TryGetElement(recycleKey, repeater2);
00168                     Verify.AreSame(repeater2, element2.Parent);
00169                 }
00170             });
00171         }
00172
00173         // When the owner is not the same, the element we get out of the recycle
00174         // pool should be disconnected from its previous parent.
00175         [TestMethod]
00176         public void ValidateChildRemovedFromParentWhenOwnerIsDifferent()
00177         {
00178             RunOnUIThread.Execute(() =>
00179             {
00180                 var element = new Button();
00181                 const string key1 = "Key1";
00182                 const string key2 = "Key2";
00183
00184                 RecyclePool pool = new RecyclePool();
00185                 var parent1 = new StackPanel();
00186                 var child1 = new Button();
00187                 var child2 = new Button();
00188                 parent1.Children.Add(child1);
00189                 parent1.Children.Add(child2);
00190
00191                 pool.PutElement(child1, key1);
00192                 pool.PutElement(child2, key2);
00193
00194                 var parent2 = new StackPanel();
00195                 // Recycle the second child for a different parent. It should be disconnected
00196                 var recycled1 = (FrameworkElement)pool.TryGetElement(key2, parent2);
00197                 Verify.IsNull(recycled1.Parent);
00198                 var recycled2 = (FrameworkElement)pool.TryGetElement(key1, parent2);
00199                 Verify.IsNull(recycled2.Parent);
00200             });
00201         }
00202     }
00203 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ComboBoxHelper.properties.cpp Source File

  • Generated

ComboBoxHelper.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "ComboBoxHelper.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::Primitives
00010 {
00011     CppWinRTActivatableClassWithDPFactory(ComboBoxHelper)
00012 }
00013
00014 #include "ComboBoxHelper.g.cpp"
00015
00016 GlobalDependencyProperty ComboBoxHelperProperties::s_KeepInteriorCornersSquareProperty{ nullptr };
00017
00018 ComboBoxHelperProperties::ComboBoxHelperProperties()
00019 {
00020     EnsureProperties();
00021 }
00022
00023 void ComboBoxHelperProperties::EnsureProperties()
00024 {
00025     if (!s_KeepInteriorCornersSquareProperty)
00026     {
00027         s_KeepInteriorCornersSquareProperty =
00028             InitializeDependencyProperty(
00029                 L"KeepInteriorCornersSquare",
00030                 winrt::name_of<bool>(),
00031                 winrt::name_of<winrt::ComboBoxHelper>(),
00032                 true /* isAttached */,
00033                 ValueHelper<bool>::BoxValueIfNecessary(false),
00034                 &ComboBoxHelper::OnKeepInteriorCornersSquarePropertyChanged);
00035     }
00036 }
00037
00038 void ComboBoxHelperProperties::ClearProperties()
00039 {
00040     s_KeepInteriorCornersSquareProperty = nullptr;
00041 }
00042
00043
00044 void ComboBoxHelperProperties::SetKeepInteriorCornersSquare(winrt::ComboBox const& target, bool value)
00045 {
00046     target.SetValue(s_KeepInteriorCornersSquareProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00047 }
00048
00049 bool ComboBoxHelperProperties::GetKeepInteriorCornersSquare(winrt::ComboBox const& target)
00050 {
00051     return ValueHelper<bool>::CastOrUnbox(target.GetValue(s_KeepInteriorCornersSquareProperty));
00052 }
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewDisplayModeChangedEventArgs.cpp Source File

  • NavigationView

NavigationViewDisplayModeChangedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "NavigationViewDisplayModeChangedEventArgs.h"
00007 #include "NavigationView.h"
00008
00009 #pragma region INavigationViewDisplayModeChangedEventArgs
00010 winrt::NavigationViewDisplayMode NavigationViewDisplayModeChangedEventArgs::DisplayMode()
00011 {
00012     return m_DisplayMode;
00013 }
00014 #pragma endregion
00015
00016 void NavigationViewDisplayModeChangedEventArgs::DisplayMode(
00017     winrt::NavigationViewDisplayMode value)
00018 {
00019     m_DisplayMode = value;
00020 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewExpandingEventArgs.h Source File

  • TreeView

TreeViewExpandingEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "TreeViewNode.h"
00006
00007 #include "TreeViewExpandingEventArgs.g.h"
00008
00009 class TreeViewExpandingEventArgs :
00010     public ReferenceTracker<
00011         TreeViewExpandingEventArgs,
00012         winrt::implementation::TreeViewExpandingEventArgsT,
00013         winrt::composing,
00014         winrt::composable>
00015 {
00016 public:
00017     winrt::TreeViewNode Node();
00018     void Node(const winrt::TreeViewNode& value);
00019     winrt::IInspectable Item();
00020
00021 private:
00022     tracker_ref<winrt::TreeViewNode> m_node{ this };
00023 };
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsRepeater Member List

This is the complete list of members for ItemsRepeater, including all inherited members.
abi_enter() | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
ArrangeOverride(winrt::Size const &finalSize) | ItemsRepeater |
Background(winrt::Brush const &value) | ItemsRepeaterProperties |
Background() | ItemsRepeaterProperties |
BackgroundProperty() | ItemsRepeaterProperties | [inline, static]
CheckThread() | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
ClearedElementsArrangePosition | ItemsRepeater | [static]
ClearElementImpl(const winrt::UIElement &element) | ItemsRepeater |
ClearProperties() | ItemsRepeaterProperties | [static]
CreateAndInitializeVirtualizationInfo(const winrt::UIElement &element) | ItemsRepeater | [static]
CreateChildrenInTabFocusOrderIterable() | ItemsRepeater | [private]
DeleteInstanceOnUIThread(std::unique_ptr< ItemsRepeater > &&self) noexcept | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline, static]
ElementClearing(winrt::TypedEventHandler< winrt::ItemsRepeater, winrt::ItemsRepeaterElementClearingEventArgs > const &value) | ItemsRepeaterProperties |
ElementClearing(winrt::event_token const &token) | ItemsRepeaterProperties |
ElementIndexChanged(winrt::TypedEventHandler< winrt::ItemsRepeater, winrt::ItemsRepeaterElementIndexChangedEventArgs > const &value) | ItemsRepeaterProperties |
ElementIndexChanged(winrt::event_token const &token) | ItemsRepeaterProperties |
ElementPrepared(winrt::TypedEventHandler< winrt::ItemsRepeater, winrt::ItemsRepeaterElementPreparedEventArgs > const &value) | ItemsRepeaterProperties |
ElementPrepared(winrt::event_token const &token) | ItemsRepeaterProperties |
EnsureDefaultLayoutState() | ItemsRepeater | [private]
EnsureProperties() | ItemsRepeaterProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
final_release(std::unique_ptr< ItemsRepeater > &&self) | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline, static]
GetBase() | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
GetChildrenInTabFocusOrder() | ItemsRepeater |
GetDefaultLayout() | ItemsRepeater | [private]
GetEffectiveLayout() | ItemsRepeater | [private]
GetElementFromIndexImpl(int index) | ItemsRepeater |
GetElementImpl(int index, bool forceCreate, bool suppressAutoRecycle) | ItemsRepeater |
GetElementIndex(winrt::UIElement const &element) | ItemsRepeater |
GetElementIndexImpl(const winrt::UIElement &element) | ItemsRepeater |
GetInner() | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
GetLayoutContext() | ItemsRepeater | [private]
GetLogItemIndex() | ItemsRepeater | [static]
GetOrCreateElement(int index) | ItemsRepeater |
GetOrCreateElementImpl(int index) | ItemsRepeater |
GetVirtualizationInfo(const winrt::UIElement &element) | ItemsRepeater | [static]
GetVirtualizationInfoProperty() | ItemsRepeater | [inline, static]
HorizontalCacheLength(double value) | ItemsRepeaterProperties |
HorizontalCacheLength() | ItemsRepeaterProperties |
HorizontalCacheLengthProperty() | ItemsRepeaterProperties | [inline, static]
Indent() | ItemsRepeater |
InvalidateArrangeForLayout(winrt::Layout const &sender, winrt::IInspectable const &args) | ItemsRepeater | [private]
InvalidateMeasureForLayout(winrt::Layout const &sender, winrt::IInspectable const &args) | ItemsRepeater | [private]
InvalidRect | ItemsRepeater | [static]
IsOnThread() | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
IsProcessingCollectionChange() const | ItemsRepeater | [inline, private]
ItemsRepeater() | ItemsRepeater |
ItemsRepeaterProperties() | ItemsRepeaterProperties |
ItemsSource(winrt::IInspectable const &value) | ItemsRepeaterProperties |
ItemsSource() | ItemsRepeaterProperties |
ItemsSourceProperty() | ItemsRepeaterProperties | [inline, static]
ItemsSourceView() | ItemsRepeater |
ItemTemplate(winrt::IInspectable const &value) | ItemsRepeaterProperties |
ItemTemplate() | ItemsRepeaterProperties |
ItemTemplateProperty() | ItemsRepeaterProperties | [inline, static]
ItemTemplateShim() | ItemsRepeater | [inline]
ItemTransitionProvider(winrt::ItemCollectionTransitionProvider const &value) | ItemsRepeaterProperties |
ItemTransitionProvider() | ItemsRepeaterProperties |
ItemTransitionProviderProperty() | ItemsRepeaterProperties | [inline, static]
Layout(winrt::Layout const &value) | ItemsRepeaterProperties |
Layout() | ItemsRepeaterProperties |
LayoutOrigin() const | ItemsRepeater | [inline]
LayoutOrigin(winrt::Point value) | ItemsRepeater | [inline]
LayoutProperty() | ItemsRepeaterProperties | [inline, static]
LayoutState() const | ItemsRepeater | [inline]
LayoutState(const winrt::IInspectable &value) | ItemsRepeater | [inline]
m_elementClearingEventSource | ItemsRepeaterProperties |
m_elementIndexChangedEventSource | ItemsRepeaterProperties |
m_elementPreparedEventSource | ItemsRepeaterProperties |
MadeAnchor() const | ItemsRepeater | [inline]
MeasureOverride(winrt::Size const &availableSize) | ItemsRepeater |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
OnBringIntoViewRequested(winrt::BringIntoViewRequestedEventArgs const &e) | ItemsRepeater |
OnCreateAutomationPeer() | ItemsRepeater |
OnDataSourcePropertyChanged(const winrt::ItemsSourceView &oldValue, const winrt::ItemsSourceView &newValue) | ItemsRepeater | [private]
OnElementClearing(const winrt::UIElement &element) | ItemsRepeater |
OnElementIndexChanged(const winrt::UIElement &element, int oldIndex, int newIndex) | ItemsRepeater |
OnElementPrepared(const winrt::UIElement &element, int index) | ItemsRepeater |
OnHorizontalCacheLengthPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemsRepeaterProperties | [static]
OnItemsSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemsRepeaterProperties | [static]
OnItemsSourceViewChanged(const winrt::IInspectable &sender, const winrt::NotifyCollectionChangedEventArgs &args) | ItemsRepeater | [private]
OnItemTemplateChanged(const winrt::IElementFactory &oldValue, const winrt::IElementFactory &newValue) | ItemsRepeater | [private]
OnItemTemplatePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemsRepeaterProperties | [static]
OnItemTransitionProviderPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemsRepeaterProperties | [static]
OnLayoutChanged(winrt::Layout oldValue, winrt::Layout newValue) | ItemsRepeater | [private]
OnLayoutPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemsRepeaterProperties | [static]
OnLayoutUpdated(const winrt::IInspectable &, const winrt::IInspectable &) | ItemsRepeater | [private]
OnLoaded(const winrt::IInspectable &, const winrt::RoutedEventArgs &) | ItemsRepeater | [private]
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | ItemsRepeater |
OnTransitionProviderChanged(const winrt::ItemCollectionTransitionProvider &oldValue, const winrt::ItemCollectionTransitionProvider &newValue) | ItemsRepeater | [private]
OnUnloaded(const winrt::IInspectable &, const winrt::RoutedEventArgs &) | ItemsRepeater | [private]
OnVerticalCacheLengthPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemsRepeaterProperties | [static]
PinElement(winrt::UIElement const &element) | ItemsRepeater |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
RealizationWindow() const | ItemsRepeater | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2 > | [inline]
s_BackgroundProperty | ItemsRepeaterProperties | [static]
s_HorizontalCacheLengthProperty | ItemsRepeaterProperties | [static]
s_ItemsSourceProperty | ItemsRepeaterProperties | [static]
s_ItemTemplateProperty | ItemsRepeaterProperties | [static]
s_ItemTransitionProviderProperty | ItemsRepeaterProperties | [static]
s_LayoutProperty | ItemsRepeaterProperties | [static]
s_maxStackLayoutIterations | ItemsRepeater | [static]
s_VerticalCacheLengthProperty | ItemsRepeaterProperties | [static]
SetLogItemIndex(int logItemIndex) | ItemsRepeater | [static]
SuggestedAnchor() const | ItemsRepeater | [inline]
TransitionManager() | ItemsRepeater | [inline]
TryGetElement(int index) | ItemsRepeater |
TryGetVirtualizationInfo(const winrt::UIElement &element) | ItemsRepeater | [static]
UnpinElement(winrt::UIElement const &element) | ItemsRepeater |
VerticalCacheLength(double value) | ItemsRepeaterProperties |
VerticalCacheLength() | ItemsRepeaterProperties |
VerticalCacheLengthProperty() | ItemsRepeaterProperties | [inline, static]
ViewManager() | ItemsRepeater | [inline]
VisibleWindow() const | ItemsRepeater | [inline]
Generated on Sun Dec 1 2024 20:52:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PersonInfo Member List

This is the complete list of members for PersonInfo, including all inherited members.
FullName | PersonInfo |
Initials | PersonInfo |
PersonInfo(string name, string surname) | PersonInfo | [inline]
Generated on Sun Dec 1 2024 20:54:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollingBringingIntoViewEventArgs Member List

This is the complete list of members for ScrollingBringingIntoViewEventArgs, including all inherited members.
Cancel() | ScrollingBringingIntoViewEventArgs |
Cancel(bool value) | ScrollingBringingIntoViewEventArgs |
CorrelationId() | ScrollingBringingIntoViewEventArgs |
GetCancel() const | ScrollingBringingIntoViewEventArgs | [inline]
GetTargetHorizontalOffset() const | ScrollingBringingIntoViewEventArgs | [inline]
GetTargetVerticalOffset() const | ScrollingBringingIntoViewEventArgs | [inline]
OffsetsChangeCorrelationId(int32_t offsetsChangeCorrelationId) | ScrollingBringingIntoViewEventArgs |
RequestEventArgs() | ScrollingBringingIntoViewEventArgs |
RequestEventArgs(const winrt::BringIntoViewRequestedEventArgs &requestEventArgs) | ScrollingBringingIntoViewEventArgs |
ScrollingBringingIntoViewEventArgs() | ScrollingBringingIntoViewEventArgs | [inline]
SnapPointsMode() | ScrollingBringingIntoViewEventArgs |
SnapPointsMode(winrt::ScrollingSnapPointsMode snapPointsMode) | ScrollingBringingIntoViewEventArgs |
TargetHorizontalOffset() | ScrollingBringingIntoViewEventArgs |
TargetOffsets(double targetHorizontalOffset, double targetVerticalOffset) | ScrollingBringingIntoViewEventArgs |
TargetVerticalOffset() | ScrollingBringingIntoViewEventArgs |
~ScrollingBringingIntoViewEventArgs() | ScrollingBringingIntoViewEventArgs | [inline]
Generated on Sun Dec 1 2024 20:53:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TeachingTipProperties Member List

This is the complete list of members for TeachingTipProperties, including all inherited members.
ActionButtonClick(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipProperties |
ActionButtonClick(winrt::event_token const &token) | TeachingTipProperties |
ActionButtonCommand(winrt::ICommand const &value) | TeachingTipProperties |
ActionButtonCommand() | TeachingTipProperties |
ActionButtonCommandParameter(winrt::IInspectable const &value) | TeachingTipProperties |
ActionButtonCommandParameter() | TeachingTipProperties |
ActionButtonCommandParameterProperty() | TeachingTipProperties | [inline, static]
ActionButtonCommandProperty() | TeachingTipProperties | [inline, static]
ActionButtonContent(winrt::IInspectable const &value) | TeachingTipProperties |
ActionButtonContent() | TeachingTipProperties |
ActionButtonContentProperty() | TeachingTipProperties | [inline, static]
ActionButtonStyle(winrt::Style const &value) | TeachingTipProperties |
ActionButtonStyle() | TeachingTipProperties |
ActionButtonStyleProperty() | TeachingTipProperties | [inline, static]
ClearProperties() | TeachingTipProperties | [static]
CloseButtonClick(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipProperties |
CloseButtonClick(winrt::event_token const &token) | TeachingTipProperties |
CloseButtonCommand(winrt::ICommand const &value) | TeachingTipProperties |
CloseButtonCommand() | TeachingTipProperties |
CloseButtonCommandParameter(winrt::IInspectable const &value) | TeachingTipProperties |
CloseButtonCommandParameter() | TeachingTipProperties |
CloseButtonCommandParameterProperty() | TeachingTipProperties | [inline, static]
CloseButtonCommandProperty() | TeachingTipProperties | [inline, static]
CloseButtonContent(winrt::IInspectable const &value) | TeachingTipProperties |
CloseButtonContent() | TeachingTipProperties |
CloseButtonContentProperty() | TeachingTipProperties | [inline, static]
CloseButtonStyle(winrt::Style const &value) | TeachingTipProperties |
CloseButtonStyle() | TeachingTipProperties |
CloseButtonStyleProperty() | TeachingTipProperties | [inline, static]
Closed(winrt::TypedEventHandler< winrt::TeachingTip, winrt::TeachingTipClosedEventArgs > const &value) | TeachingTipProperties |
Closed(winrt::event_token const &token) | TeachingTipProperties |
Closing(winrt::TypedEventHandler< winrt::TeachingTip, winrt::TeachingTipClosingEventArgs > const &value) | TeachingTipProperties |
Closing(winrt::event_token const &token) | TeachingTipProperties |
EnsureProperties() | TeachingTipProperties | [static]
HeroContent(winrt::UIElement const &value) | TeachingTipProperties |
HeroContent() | TeachingTipProperties |
HeroContentPlacement(winrt::TeachingTipHeroContentPlacementMode const &value) | TeachingTipProperties |
HeroContentPlacement() | TeachingTipProperties |
HeroContentPlacementProperty() | TeachingTipProperties | [inline, static]
HeroContentProperty() | TeachingTipProperties | [inline, static]
IconSource(winrt::IconSource const &value) | TeachingTipProperties |
IconSource() | TeachingTipProperties |
IconSourceProperty() | TeachingTipProperties | [inline, static]
IsLightDismissEnabled(bool value) | TeachingTipProperties |
IsLightDismissEnabled() | TeachingTipProperties |
IsLightDismissEnabledProperty() | TeachingTipProperties | [inline, static]
IsOpen(bool value) | TeachingTipProperties |
IsOpen() | TeachingTipProperties |
IsOpenProperty() | TeachingTipProperties | [inline, static]
m_actionButtonClickEventSource | TeachingTipProperties |
m_closeButtonClickEventSource | TeachingTipProperties |
m_closedEventSource | TeachingTipProperties |
m_closingEventSource | TeachingTipProperties |
OnActionButtonCommandParameterPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnActionButtonCommandPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnActionButtonContentPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnActionButtonStylePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnCloseButtonCommandParameterPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnCloseButtonCommandPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnCloseButtonContentPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnCloseButtonStylePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnHeroContentPlacementPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnHeroContentPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnIconSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnIsLightDismissEnabledPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnIsOpenPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnPlacementMarginPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnPreferredPlacementPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnShouldConstrainToRootBoundsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnSubtitlePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnTailVisibilityPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnTargetPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnTemplateSettingsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
OnTitlePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TeachingTipProperties | [static]
PlacementMargin(winrt::Thickness const &value) | TeachingTipProperties |
PlacementMargin() | TeachingTipProperties |
PlacementMarginProperty() | TeachingTipProperties | [inline, static]
PreferredPlacement(winrt::TeachingTipPlacementMode const &value) | TeachingTipProperties |
PreferredPlacement() | TeachingTipProperties |
PreferredPlacementProperty() | TeachingTipProperties | [inline, static]
s_ActionButtonCommandParameterProperty | TeachingTipProperties | [static]
s_ActionButtonCommandProperty | TeachingTipProperties | [static]
s_ActionButtonContentProperty | TeachingTipProperties | [static]
s_ActionButtonStyleProperty | TeachingTipProperties | [static]
s_CloseButtonCommandParameterProperty | TeachingTipProperties | [static]
s_CloseButtonCommandProperty | TeachingTipProperties | [static]
s_CloseButtonContentProperty | TeachingTipProperties | [static]
s_CloseButtonStyleProperty | TeachingTipProperties | [static]
s_HeroContentPlacementProperty | TeachingTipProperties | [static]
s_HeroContentProperty | TeachingTipProperties | [static]
s_IconSourceProperty | TeachingTipProperties | [static]
s_IsLightDismissEnabledProperty | TeachingTipProperties | [static]
s_IsOpenProperty | TeachingTipProperties | [static]
s_PlacementMarginProperty | TeachingTipProperties | [static]
s_PreferredPlacementProperty | TeachingTipProperties | [static]
s_ShouldConstrainToRootBoundsProperty | TeachingTipProperties | [static]
s_SubtitleProperty | TeachingTipProperties | [static]
s_TailVisibilityProperty | TeachingTipProperties | [static]
s_TargetProperty | TeachingTipProperties | [static]
s_TemplateSettingsProperty | TeachingTipProperties | [static]
s_TitleProperty | TeachingTipProperties | [static]
ShouldConstrainToRootBounds(bool value) | TeachingTipProperties |
ShouldConstrainToRootBounds() | TeachingTipProperties |
ShouldConstrainToRootBoundsProperty() | TeachingTipProperties | [inline, static]
Subtitle(winrt::hstring const &value) | TeachingTipProperties |
Subtitle() | TeachingTipProperties |
SubtitleProperty() | TeachingTipProperties | [inline, static]
TailVisibility(winrt::TeachingTipTailVisibility const &value) | TeachingTipProperties |
TailVisibility() | TeachingTipProperties |
TailVisibilityProperty() | TeachingTipProperties | [inline, static]
Target(winrt::FrameworkElement const &value) | TeachingTipProperties |
Target() | TeachingTipProperties |
TargetProperty() | TeachingTipProperties | [inline, static]
TeachingTipProperties() | TeachingTipProperties |
TemplateSettings(winrt::TeachingTipTemplateSettings const &value) | TeachingTipProperties |
TemplateSettings() | TeachingTipProperties |
TemplateSettingsProperty() | TeachingTipProperties | [inline, static]
Title(winrt::hstring const &value) | TeachingTipProperties |
Title() | TeachingTipProperties |
TitleProperty() | TeachingTipProperties | [inline, static]
Generated on Sun Dec 1 2024 20:53:16 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TeachingTip/TeachingTipClosedEventArgs.cpp Source File

  • TeachingTip

TeachingTipClosedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TeachingTipClosedEventArgs.h"
00007
00008 winrt::TeachingTipCloseReason TeachingTipClosedEventArgs::Reason()
00009 {
00010     return m_reason;
00011 }
00012
00013 void TeachingTipClosedEventArgs::Reason(const winrt::TeachingTipCloseReason& reason)
00014 {
00015     m_reason = reason;
00016 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/CalendarDatePickerPage.xaml.cs Source File

  • CommonStyles
  • TestUI

CalendarDatePickerPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     [TopLevelTestPage(Name = "CalendarDatePicker", Icon = "CalendarDatePicker.png")]
00007     public sealed partial class CalendarDatePickerPage : TestPage
00008     {
00009         public CalendarDatePickerPage()
00010         {
00011             this.InitializeComponent();
00012         }
00013     }
00014 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RatingItemImageInfo.properties.h Source File

  • Generated

RatingItemImageInfo.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class RatingItemImageInfoProperties
00008 {
00009 public:
00010     RatingItemImageInfoProperties();
00011
00012     void DisabledImage(winrt::ImageSource const& value);
00013     winrt::ImageSource DisabledImage();
00014
00015     void Image(winrt::ImageSource const& value);
00016     winrt::ImageSource Image();
00017
00018     void PlaceholderImage(winrt::ImageSource const& value);
00019     winrt::ImageSource PlaceholderImage();
00020
00021     void PointerOverImage(winrt::ImageSource const& value);
00022     winrt::ImageSource PointerOverImage();
00023
00024     void PointerOverPlaceholderImage(winrt::ImageSource const& value);
00025     winrt::ImageSource PointerOverPlaceholderImage();
00026
00027     void UnsetImage(winrt::ImageSource const& value);
00028     winrt::ImageSource UnsetImage();
00029
00030     static winrt::DependencyProperty DisabledImageProperty() { return s_DisabledImageProperty; }
00031     static winrt::DependencyProperty ImageProperty() { return s_ImageProperty; }
00032     static winrt::DependencyProperty PlaceholderImageProperty() { return s_PlaceholderImageProperty; }
00033     static winrt::DependencyProperty PointerOverImageProperty() { return s_PointerOverImageProperty; }
00034     static winrt::DependencyProperty PointerOverPlaceholderImageProperty() { return s_PointerOverPlaceholderImageProperty; }
00035     static winrt::DependencyProperty UnsetImageProperty() { return s_UnsetImageProperty; }
00036
00037     static GlobalDependencyProperty s_DisabledImageProperty;
00038     static GlobalDependencyProperty s_ImageProperty;
00039     static GlobalDependencyProperty s_PlaceholderImageProperty;
00040     static GlobalDependencyProperty s_PointerOverImageProperty;
00041     static GlobalDependencyProperty s_PointerOverPlaceholderImageProperty;
00042     static GlobalDependencyProperty s_UnsetImageProperty;
00043
00044     static void EnsureProperties();
00045     static void ClearProperties();
00046 };
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RefreshInteractionRatioChangedEventArgs Member List

This is the complete list of members for RefreshInteractionRatioChangedEventArgs, including all inherited members.
InteractionRatio() | RefreshInteractionRatioChangedEventArgs
RefreshInteractionRatioChangedEventArgs(double value) | RefreshInteractionRatioChangedEventArgs
Generated on Sun Dec 1 2024 20:53:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshContainer/RefreshContainer.idl Source File

  • PullToRefresh
  • RefreshContainer

RefreshContainer.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 enum RefreshPullDirection
00007 {
00008     LeftToRight = 0,
00009     TopToBottom = 1,
00010     RightToLeft = 2,
00011     BottomToTop = 3,
00012 };
00013
00014 [MUX_PUBLIC]
00015 [webhosthidden]
00016 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00017 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00018 unsealed runtimeclass RefreshContainer : Microsoft.UI.Xaml.Controls.ContentControl
00019 {
00020     RefreshContainer();
00021
00022     RefreshVisualizer Visualizer { get; set; };
00023     [MUX_DEFAULT_VALUE("winrt::RefreshPullDirection::TopToBottom")]
00024     RefreshPullDirection PullDirection { get; set; };
00025     event Windows.Foundation.TypedEventHandler<RefreshContainer, RefreshRequestedEventArgs> RefreshRequested;
00026     void RequestRefresh();
00027
00028     static Microsoft.UI.Xaml.DependencyProperty VisualizerProperty { get; };
00029     static Microsoft.UI.Xaml.DependencyProperty PullDirectionProperty { get; };
00030 }
00031
00032 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/CornerRadiusToThicknessConverter.properties.cpp Source File

  • Generated

CornerRadiusToThicknessConverter.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "CornerRadiusToThicknessConverter.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::Primitives
00010 {
00011     CppWinRTActivatableClassWithDPFactory(CornerRadiusToThicknessConverter)
00012 }
00013
00014 #include "CornerRadiusToThicknessConverter.g.cpp"
00015
00016 GlobalDependencyProperty CornerRadiusToThicknessConverterProperties::s_ConversionKindProperty{ nullptr };
00017 GlobalDependencyProperty CornerRadiusToThicknessConverterProperties::s_MultiplierProperty{ nullptr };
00018
00019 CornerRadiusToThicknessConverterProperties::CornerRadiusToThicknessConverterProperties()
00020 {
00021     EnsureProperties();
00022 }
00023
00024 void CornerRadiusToThicknessConverterProperties::EnsureProperties()
00025 {
00026     if (!s_ConversionKindProperty)
00027     {
00028         s_ConversionKindProperty =
00029             InitializeDependencyProperty(
00030                 L"ConversionKind",
00031                 winrt::name_of<winrt::CornerRadiusToThicknessConverterKind>(),
00032                 winrt::name_of<winrt::CornerRadiusToThicknessConverter>(),
00033                 false /* isAttached */,
00034                 ValueHelper<winrt::CornerRadiusToThicknessConverterKind>::BoxValueIfNecessary(winrt::CornerRadiusToThicknessConverterKind::FilterLeftAndRightFromTop),
00035                 nullptr);
00036     }
00037     if (!s_MultiplierProperty)
00038     {
00039         s_MultiplierProperty =
00040             InitializeDependencyProperty(
00041                 L"Multiplier",
00042                 winrt::name_of<double>(),
00043                 winrt::name_of<winrt::CornerRadiusToThicknessConverter>(),
00044                 false /* isAttached */,
00045                 ValueHelper<double>::BoxValueIfNecessary(1.0f),
00046                 nullptr);
00047     }
00048 }
00049
00050 void CornerRadiusToThicknessConverterProperties::ClearProperties()
00051 {
00052     s_ConversionKindProperty = nullptr;
00053     s_MultiplierProperty = nullptr;
00054 }
00055
00056 void CornerRadiusToThicknessConverterProperties::ConversionKind(winrt::CornerRadiusToThicknessConverterKind const& value)
00057 {
00058     [[gsl::suppress(con)]]
00059     {
00060     static_cast<CornerRadiusToThicknessConverter*>(this)->SetValue(s_ConversionKindProperty, ValueHelper<winrt::CornerRadiusToThicknessConverterKind>::BoxValueIfNecessary(value));
00061     }
00062 }
00063
00064 winrt::CornerRadiusToThicknessConverterKind CornerRadiusToThicknessConverterProperties::ConversionKind()
00065 {
00066     return ValueHelper<winrt::CornerRadiusToThicknessConverterKind>::CastOrUnbox(static_cast<CornerRadiusToThicknessConverter*>(this)->GetValue(s_ConversionKindProperty));
00067 }
00068
00069 void CornerRadiusToThicknessConverterProperties::Multiplier(double value)
00070 {
00071     [[gsl::suppress(con)]]
00072     {
00073     static_cast<CornerRadiusToThicknessConverter*>(this)->SetValue(s_MultiplierProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00074     }
00075 }
00076
00077 double CornerRadiusToThicknessConverterProperties::Multiplier()
00078 {
00079     return ValueHelper<double>::CastOrUnbox(static_cast<CornerRadiusToThicknessConverter*>(this)->GetValue(s_MultiplierProperty));
00080 }
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SwipeControl/SwipeControl_TestUI/SwipeControlPage2.xaml.cs Source File

  • SwipeControl
  • SwipeControl_TestUI

SwipeControlPage2.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.IO;
00007 using System.Linq;
00008 using System.Runtime.InteropServices.WindowsRuntime;
00009 using Windows.Foundation;
00010 using Windows.Foundation.Collections;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Controls;
00013 using Microsoft.UI.Xaml.Controls.Primitives;
00014 using Microsoft.UI.Xaml.Data;
00015 using Microsoft.UI.Xaml.Input;
00016 using Microsoft.UI.Xaml.Media;
00017 using Microsoft.UI.Xaml.Navigation;
00018 using Microsoft.UI.Xaml.Automation.Peers;
00019 using Windows.UI;
00020
00021 namespace MUXControlsTestApp
00022 {
00023     public sealed partial class SwipeControlPage2 : TestPage
00024     {
00025         SwipeItem pastSender;
00026         public SwipeControlPage2()
00027         {
00028             this.InitializeComponent();
00029         }
00030
00031         public void ChkSwipeControlProperties_Checked(object sender, RoutedEventArgs args)
00032         {
00033             if(svSwipeControlProperties != null)
00034             {
00035                 svSwipeControlProperties.Visibility = Visibility.Visible;
00036             }
00037         }
00038         public void ChkSwipeControlProperties_Unchecked(object sender, RoutedEventArgs args)
00039         {
00040             if (svSwipeControlProperties != null)
00041             {
00042                 svSwipeControlProperties.Visibility = Visibility.Collapsed;
00043             }
00044         }
00045
00046         public void ChkSwipeMethods_Checked(object sender, RoutedEventArgs args)
00047         {
00048             if (svSwipeControlMethods != null)
00049             {
00050                 svSwipeControlMethods.Visibility = Visibility.Visible;
00051             }
00052         }
00053
00054         public void ChkSwipeMethods_Unchecked(object sender, RoutedEventArgs args)
00055         {
00056             if (svSwipeControlMethods != null)
00057             {
00058                 svSwipeControlMethods.Visibility = Visibility.Collapsed;
00059             }
00060         }
00061         public void ChkSwipeItemProperties_Checked(object sender, RoutedEventArgs args)
00062         {
00063             if (svSwipeItemProperties != null)
00064             {
00065                 svSwipeItemProperties.Visibility = Visibility.Visible;
00066             }
00067         }
00068         public void ChkSwipeItemProperties_Unchecked(object sender, RoutedEventArgs args)
00069         {
00070             if (svSwipeItemProperties != null)
00071             {
00072                 svSwipeItemProperties.Visibility = Visibility.Collapsed;
00073             }
00074         }
00075
00076         public void ChkSwipeEvents_Checked(object sender, RoutedEventArgs args)
00077         {
00078         }
00079
00080         public void ChkSwipeEvents_Unchecked(object sender, RoutedEventArgs args)
00081         {
00082         }
00083
00084         public void ChkPageMethods_Checked(object sender, RoutedEventArgs args)
00085         {
00086         }
00087         public void ChkPageMethods_Unchecked(object sender, RoutedEventArgs args)
00088         {
00089         }
00090
00091         public void ChkSwipeTestHooks_Checked(object sender, RoutedEventArgs args)
00092         {
00093         }
00094
00095         public void ChkSwipeTestHooks_Unchecked(object sender, RoutedEventArgs args)
00096         {
00097         }
00098
00099
00100         public void BtnGetLeftItems_Click(object sender, RoutedEventArgs args)
00101         {
00102             if (markupSwipeControl.LeftItems != null)
00103             {
00104                 tblLeftItems.Text = markupSwipeControl.LeftItems.Count.ToString();
00105                 tblLeftItems.Text += " - ";
00106                 tblLeftItems.Text += markupSwipeControl.LeftItems.Mode.ToString();
00107             }
00108             else
00109             {
00110                 tblLeftItems.Text = "0";
00111             }
00112         }
00113         public void BtnGetRightItems_Click(object sender, RoutedEventArgs args)
00114         {
00115             if (markupSwipeControl.RightItems != null)
00116             {
00117                 tblRightItems.Text = markupSwipeControl.RightItems.Count.ToString();
00118                 tblRightItems.Text += " - ";
00119                 tblRightItems.Text += markupSwipeControl.RightItems.Mode.ToString();
00120             }
00121             else
00122             {
00123                 tblRightItems.Text = "0";
00124             }
00125         }
00126         public void BtnGetTopItems_Click(object sender, RoutedEventArgs args)
00127         {
00128             if (markupSwipeControl.TopItems != null)
00129             {
00130                 tblTopItems.Text = markupSwipeControl.TopItems.Count.ToString();
00131                 tblTopItems.Text += " - ";
00132                 tblTopItems.Text += markupSwipeControl.TopItems.Mode.ToString();
00133             }
00134             else
00135             {
00136                 tblTopItems.Text = "0";
00137             }
00138         }
00139         public void BtnGetBottomItems_Click(object sender, RoutedEventArgs args)
00140         {
00141             if (markupSwipeControl.BottomItems != null)
00142             {
00143                 tblBottomItems.Text = markupSwipeControl.BottomItems.Count.ToString();
00144                 tblBottomItems.Text += " - ";
00145                 tblBottomItems.Text += markupSwipeControl.BottomItems.Mode.ToString();
00146             }
00147             else
00148             {
00149                 tblBottomItems.Text = "0";
00150             }
00151         }
00152
00153         public void BtnClose_Click(object sender, RoutedEventArgs args)
00154         {
00155             markupSwipeControl.Close();
00156         }
00157
00158         public void BtnAddItem_Click(object sender, RoutedEventArgs args)
00159         {
00160             SwipeItem swipeItem = new SwipeItem();
00161             swipeItem.Text = txtText.Text;
00162             switch(cmbIcon.SelectedIndex)
00163             {
00164                 case (0):
00165                     swipeItem.IconSource = Resources["SymbolIcon"] as IconSource;
00166                     break;
00167                 case (1):
00168                     swipeItem.IconSource = Resources["FontIcon"] as IconSource;
00169                     break;
00170                 case (2):
00171                     swipeItem.IconSource = Resources["BitmapIcon"] as IconSource;
00172                     break;
00173                 case (3):
00174                     swipeItem.IconSource = Resources["PathIcon"] as IconSource;
00175                     break;
00176             }
00177             swipeItem.Background = new SolidColorBrush(cpBackground.Color);
00178             switch(cmbBehaviorOnInvoked.SelectedIndex)
00179             {
00180                 case (0):
00181                     swipeItem.BehaviorOnInvoked = SwipeBehaviorOnInvoked.Auto;
00182                     break;
00183                 case (1):
00184                     swipeItem.BehaviorOnInvoked = SwipeBehaviorOnInvoked.Close;
00185                     break;
00186                 case (2):
00187                     swipeItem.BehaviorOnInvoked = SwipeBehaviorOnInvoked.RemainOpen;
00188                     break;
00189             }
00190             SwipeItems swipeItems = null;
00191             switch (cmbCollection.SelectedIndex)
00192             {
00193                 case (0):
00194                     swipeItems = markupSwipeControl.LeftItems;
00195                     if (swipeItems == null)
00196                     {
00197                         swipeItems = new SwipeItems();
00198                         swipeItems.Add(swipeItem);
00199                         markupSwipeControl.LeftItems = swipeItems;
00200                     }
00201                     else
00202                     {
00203                         swipeItems.Add(swipeItem);
00204                     }
00205                     break;
00206                 case (1):
00207                     swipeItems = markupSwipeControl.RightItems;
00208                     if (swipeItems == null)
00209                     {
00210                         swipeItems = new SwipeItems();
00211                         swipeItems.Add(swipeItem);
00212                         markupSwipeControl.RightItems = swipeItems;
00213                     }
00214                     else
00215                     {
00216                         swipeItems.Add(swipeItem);
00217                     }
00218                     break;
00219                 case (2):
00220                     swipeItems = markupSwipeControl.TopItems;
00221                     if (swipeItems == null)
00222                     {
00223                         swipeItems = new SwipeItems();
00224                         swipeItems.Add(swipeItem);
00225                         markupSwipeControl.TopItems = swipeItems;
00226                     }
00227                     else
00228                     {
00229                         swipeItems.Add(swipeItem);
00230                     }
00231                     break;
00232                 case (3):
00233                     swipeItems = markupSwipeControl.BottomItems;
00234                     if (swipeItems == null)
00235                     {
00236                         swipeItems = new SwipeItems();
00237                         swipeItems.Add(swipeItem);
00238                         markupSwipeControl.BottomItems = swipeItems;
00239                     }
00240                     else
00241                     {
00242                         swipeItems.Add(swipeItem);
00243                     }
00244                     break;
00245             }
00246             switch (cmbMode.SelectedIndex)
00247             {
00248                 case (0):
00249                     swipeItems.Mode = SwipeMode.Reveal;
00250                     break;
00251                 case (1):
00252                     swipeItems.Mode = SwipeMode.Execute;
00253                     break;
00254             }
00255             resetSwipeItemChoices();
00256         }
00257         public void BtnCancel_Click(object sender, RoutedEventArgs args)
00258         {
00259             resetSwipeItemChoices();
00260         }
00261
00262         private void resetSwipeItemChoices()
00263         {
00264             cmbCollection.SelectedIndex = 0;
00265             cmbMode.SelectedIndex = 0;
00266             txtText.Text = "";
00267             cmbIcon.SelectedIndex = 0;
00268             cpBackground.Color = Microsoft.UI.Colors.White;
00269             cmbBehaviorOnInvoked.SelectedIndex = 0;
00270         }
00271
00272         private void SwipeItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
00273         {
00274             // ensures that this method is invoked twice for only one swipe action.
00275             if (pastSender == sender)
00276             {
00277                 textBlock.Text = "FailTest";
00278             }
00279             else
00280             {
00281                 textBlock.Text = sender.Text;
00282             }
00283             pastSender = sender;
00284
00285             var peer = FrameworkElementAutomationPeer.CreatePeerForElement(this);
00286             peer.RaiseAutomationEvent(AutomationEvents.MenuClosed);
00287         }
00288     }
00289 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IOpacityEffect Member List

This is the complete list of members for IOpacityEffect, including all inherited members.
Opacity([out, retval] float *value) | IOpacityEffect
Opacity([in] float value) | IOpacityEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | IOpacityEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | IOpacityEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TwoPaneView.properties.cpp Source File

  • Generated

TwoPaneView.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "TwoPaneView.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(TwoPaneView)
00012 }
00013
00014 #include "TwoPaneView.g.cpp"
00015
00016 GlobalDependencyProperty TwoPaneViewProperties::s_MinTallModeHeightProperty{ nullptr };
00017 GlobalDependencyProperty TwoPaneViewProperties::s_MinWideModeWidthProperty{ nullptr };
00018 GlobalDependencyProperty TwoPaneViewProperties::s_ModeProperty{ nullptr };
00019 GlobalDependencyProperty TwoPaneViewProperties::s_Pane1Property{ nullptr };
00020 GlobalDependencyProperty TwoPaneViewProperties::s_Pane1LengthProperty{ nullptr };
00021 GlobalDependencyProperty TwoPaneViewProperties::s_Pane2Property{ nullptr };
00022 GlobalDependencyProperty TwoPaneViewProperties::s_Pane2LengthProperty{ nullptr };
00023 GlobalDependencyProperty TwoPaneViewProperties::s_PanePriorityProperty{ nullptr };
00024 GlobalDependencyProperty TwoPaneViewProperties::s_TallModeConfigurationProperty{ nullptr };
00025 GlobalDependencyProperty TwoPaneViewProperties::s_WideModeConfigurationProperty{ nullptr };
00026
00027 TwoPaneViewProperties::TwoPaneViewProperties()
00028     : m_modeChangedEventSource{static_cast<TwoPaneView*>(this)}
00029 {
00030     EnsureProperties();
00031 }
00032
00033 void TwoPaneViewProperties::EnsureProperties()
00034 {
00035     if (!s_MinTallModeHeightProperty)
00036     {
00037         s_MinTallModeHeightProperty =
00038             InitializeDependencyProperty(
00039                 L"MinTallModeHeight",
00040                 winrt::name_of<double>(),
00041                 winrt::name_of<winrt::TwoPaneView>(),
00042                 false /* isAttached */,
00043                 ValueHelper<double>::BoxValueIfNecessary(c_defaultMinTallModeHeight),
00044                 winrt::PropertyChangedCallback(&OnMinTallModeHeightPropertyChanged));
00045     }
00046     if (!s_MinWideModeWidthProperty)
00047     {
00048         s_MinWideModeWidthProperty =
00049             InitializeDependencyProperty(
00050                 L"MinWideModeWidth",
00051                 winrt::name_of<double>(),
00052                 winrt::name_of<winrt::TwoPaneView>(),
00053                 false /* isAttached */,
00054                 ValueHelper<double>::BoxValueIfNecessary(c_defaultMinWideModeWidth),
00055                 winrt::PropertyChangedCallback(&OnMinWideModeWidthPropertyChanged));
00056     }
00057     if (!s_ModeProperty)
00058     {
00059         s_ModeProperty =
00060             InitializeDependencyProperty(
00061                 L"Mode",
00062                 winrt::name_of<winrt::TwoPaneViewMode>(),
00063                 winrt::name_of<winrt::TwoPaneView>(),
00064                 false /* isAttached */,
00065                 ValueHelper<winrt::TwoPaneViewMode>::BoxValueIfNecessary(winrt::TwoPaneViewMode::SinglePane),
00066                 nullptr);
00067     }
00068     if (!s_Pane1Property)
00069     {
00070         s_Pane1Property =
00071             InitializeDependencyProperty(
00072                 L"Pane1",
00073                 winrt::name_of<winrt::UIElement>(),
00074                 winrt::name_of<winrt::TwoPaneView>(),
00075                 false /* isAttached */,
00076                 ValueHelper<winrt::UIElement>::BoxedDefaultValue(),
00077                 winrt::PropertyChangedCallback(&OnPane1PropertyChanged));
00078     }
00079     if (!s_Pane1LengthProperty)
00080     {
00081         s_Pane1LengthProperty =
00082             InitializeDependencyProperty(
00083                 L"Pane1Length",
00084                 winrt::name_of<winrt::GridLength>(),
00085                 winrt::name_of<winrt::TwoPaneView>(),
00086                 false /* isAttached */,
00087                 ValueHelper<winrt::GridLength>::BoxValueIfNecessary(c_pane1LengthDefault),
00088                 winrt::PropertyChangedCallback(&OnPane1LengthPropertyChanged));
00089     }
00090     if (!s_Pane2Property)
00091     {
00092         s_Pane2Property =
00093             InitializeDependencyProperty(
00094                 L"Pane2",
00095                 winrt::name_of<winrt::UIElement>(),
00096                 winrt::name_of<winrt::TwoPaneView>(),
00097                 false /* isAttached */,
00098                 ValueHelper<winrt::UIElement>::BoxedDefaultValue(),
00099                 winrt::PropertyChangedCallback(&OnPane2PropertyChanged));
00100     }
00101     if (!s_Pane2LengthProperty)
00102     {
00103         s_Pane2LengthProperty =
00104             InitializeDependencyProperty(
00105                 L"Pane2Length",
00106                 winrt::name_of<winrt::GridLength>(),
00107                 winrt::name_of<winrt::TwoPaneView>(),
00108                 false /* isAttached */,
00109                 ValueHelper<winrt::GridLength>::BoxValueIfNecessary(c_pane2LengthDefault),
00110                 winrt::PropertyChangedCallback(&OnPane2LengthPropertyChanged));
00111     }
00112     if (!s_PanePriorityProperty)
00113     {
00114         s_PanePriorityProperty =
00115             InitializeDependencyProperty(
00116                 L"PanePriority",
00117                 winrt::name_of<winrt::TwoPaneViewPriority>(),
00118                 winrt::name_of<winrt::TwoPaneView>(),
00119                 false /* isAttached */,
00120                 ValueHelper<winrt::TwoPaneViewPriority>::BoxValueIfNecessary(winrt::TwoPaneViewPriority::Pane1),
00121                 winrt::PropertyChangedCallback(&OnPanePriorityPropertyChanged));
00122     }
00123     if (!s_TallModeConfigurationProperty)
00124     {
00125         s_TallModeConfigurationProperty =
00126             InitializeDependencyProperty(
00127                 L"TallModeConfiguration",
00128                 winrt::name_of<winrt::TwoPaneViewTallModeConfiguration>(),
00129                 winrt::name_of<winrt::TwoPaneView>(),
00130                 false /* isAttached */,
00131                 ValueHelper<winrt::TwoPaneViewTallModeConfiguration>::BoxValueIfNecessary(winrt::TwoPaneViewTallModeConfiguration::TopBottom),
00132                 winrt::PropertyChangedCallback(&OnTallModeConfigurationPropertyChanged));
00133     }
00134     if (!s_WideModeConfigurationProperty)
00135     {
00136         s_WideModeConfigurationProperty =
00137             InitializeDependencyProperty(
00138                 L"WideModeConfiguration",
00139                 winrt::name_of<winrt::TwoPaneViewWideModeConfiguration>(),
00140                 winrt::name_of<winrt::TwoPaneView>(),
00141                 false /* isAttached */,
00142                 ValueHelper<winrt::TwoPaneViewWideModeConfiguration>::BoxValueIfNecessary(winrt::TwoPaneViewWideModeConfiguration::LeftRight),
00143                 winrt::PropertyChangedCallback(&OnWideModeConfigurationPropertyChanged));
00144     }
00145 }
00146
00147 void TwoPaneViewProperties::ClearProperties()
00148 {
00149     s_MinTallModeHeightProperty = nullptr;
00150     s_MinWideModeWidthProperty = nullptr;
00151     s_ModeProperty = nullptr;
00152     s_Pane1Property = nullptr;
00153     s_Pane1LengthProperty = nullptr;
00154     s_Pane2Property = nullptr;
00155     s_Pane2LengthProperty = nullptr;
00156     s_PanePriorityProperty = nullptr;
00157     s_TallModeConfigurationProperty = nullptr;
00158     s_WideModeConfigurationProperty = nullptr;
00159 }
00160
00161 void TwoPaneViewProperties::OnMinTallModeHeightPropertyChanged(
00162     winrt::DependencyObject const& sender,
00163     winrt::DependencyPropertyChangedEventArgs const& args)
00164 {
00165     auto owner = sender.as<winrt::TwoPaneView>();
00166     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00167 }
00168
00169 void TwoPaneViewProperties::OnMinWideModeWidthPropertyChanged(
00170     winrt::DependencyObject const& sender,
00171     winrt::DependencyPropertyChangedEventArgs const& args)
00172 {
00173     auto owner = sender.as<winrt::TwoPaneView>();
00174     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00175 }
00176
00177 void TwoPaneViewProperties::OnPane1PropertyChanged(
00178     winrt::DependencyObject const& sender,
00179     winrt::DependencyPropertyChangedEventArgs const& args)
00180 {
00181     auto owner = sender.as<winrt::TwoPaneView>();
00182     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00183 }
00184
00185 void TwoPaneViewProperties::OnPane1LengthPropertyChanged(
00186     winrt::DependencyObject const& sender,
00187     winrt::DependencyPropertyChangedEventArgs const& args)
00188 {
00189     auto owner = sender.as<winrt::TwoPaneView>();
00190     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00191 }
00192
00193 void TwoPaneViewProperties::OnPane2PropertyChanged(
00194     winrt::DependencyObject const& sender,
00195     winrt::DependencyPropertyChangedEventArgs const& args)
00196 {
00197     auto owner = sender.as<winrt::TwoPaneView>();
00198     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00199 }
00200
00201 void TwoPaneViewProperties::OnPane2LengthPropertyChanged(
00202     winrt::DependencyObject const& sender,
00203     winrt::DependencyPropertyChangedEventArgs const& args)
00204 {
00205     auto owner = sender.as<winrt::TwoPaneView>();
00206     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00207 }
00208
00209 void TwoPaneViewProperties::OnPanePriorityPropertyChanged(
00210     winrt::DependencyObject const& sender,
00211     winrt::DependencyPropertyChangedEventArgs const& args)
00212 {
00213     auto owner = sender.as<winrt::TwoPaneView>();
00214     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00215 }
00216
00217 void TwoPaneViewProperties::OnTallModeConfigurationPropertyChanged(
00218     winrt::DependencyObject const& sender,
00219     winrt::DependencyPropertyChangedEventArgs const& args)
00220 {
00221     auto owner = sender.as<winrt::TwoPaneView>();
00222     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00223 }
00224
00225 void TwoPaneViewProperties::OnWideModeConfigurationPropertyChanged(
00226     winrt::DependencyObject const& sender,
00227     winrt::DependencyPropertyChangedEventArgs const& args)
00228 {
00229     auto owner = sender.as<winrt::TwoPaneView>();
00230     winrt::get_self<TwoPaneView>(owner)->OnPropertyChanged(args);
00231 }
00232
00233 void TwoPaneViewProperties::MinTallModeHeight(double value)
00234 {
00235     [[gsl::suppress(con)]]
00236     {
00237     static_cast<TwoPaneView*>(this)->SetValue(s_MinTallModeHeightProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00238     }
00239 }
00240
00241 double TwoPaneViewProperties::MinTallModeHeight()
00242 {
00243     return ValueHelper<double>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_MinTallModeHeightProperty));
00244 }
00245
00246 void TwoPaneViewProperties::MinWideModeWidth(double value)
00247 {
00248     [[gsl::suppress(con)]]
00249     {
00250     static_cast<TwoPaneView*>(this)->SetValue(s_MinWideModeWidthProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00251     }
00252 }
00253
00254 double TwoPaneViewProperties::MinWideModeWidth()
00255 {
00256     return ValueHelper<double>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_MinWideModeWidthProperty));
00257 }
00258
00259 void TwoPaneViewProperties::Mode(winrt::TwoPaneViewMode const& value)
00260 {
00261     [[gsl::suppress(con)]]
00262     {
00263     static_cast<TwoPaneView*>(this)->SetValue(s_ModeProperty, ValueHelper<winrt::TwoPaneViewMode>::BoxValueIfNecessary(value));
00264     }
00265 }
00266
00267 winrt::TwoPaneViewMode TwoPaneViewProperties::Mode()
00268 {
00269     return ValueHelper<winrt::TwoPaneViewMode>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_ModeProperty));
00270 }
00271
00272 void TwoPaneViewProperties::Pane1(winrt::UIElement const& value)
00273 {
00274     [[gsl::suppress(con)]]
00275     {
00276     static_cast<TwoPaneView*>(this)->SetValue(s_Pane1Property, ValueHelper<winrt::UIElement>::BoxValueIfNecessary(value));
00277     }
00278 }
00279
00280 winrt::UIElement TwoPaneViewProperties::Pane1()
00281 {
00282     return ValueHelper<winrt::UIElement>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_Pane1Property));
00283 }
00284
00285 void TwoPaneViewProperties::Pane1Length(winrt::GridLength const& value)
00286 {
00287     [[gsl::suppress(con)]]
00288     {
00289     static_cast<TwoPaneView*>(this)->SetValue(s_Pane1LengthProperty, ValueHelper<winrt::GridLength>::BoxValueIfNecessary(value));
00290     }
00291 }
00292
00293 winrt::GridLength TwoPaneViewProperties::Pane1Length()
00294 {
00295     return ValueHelper<winrt::GridLength>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_Pane1LengthProperty));
00296 }
00297
00298 void TwoPaneViewProperties::Pane2(winrt::UIElement const& value)
00299 {
00300     [[gsl::suppress(con)]]
00301     {
00302     static_cast<TwoPaneView*>(this)->SetValue(s_Pane2Property, ValueHelper<winrt::UIElement>::BoxValueIfNecessary(value));
00303     }
00304 }
00305
00306 winrt::UIElement TwoPaneViewProperties::Pane2()
00307 {
00308     return ValueHelper<winrt::UIElement>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_Pane2Property));
00309 }
00310
00311 void TwoPaneViewProperties::Pane2Length(winrt::GridLength const& value)
00312 {
00313     [[gsl::suppress(con)]]
00314     {
00315     static_cast<TwoPaneView*>(this)->SetValue(s_Pane2LengthProperty, ValueHelper<winrt::GridLength>::BoxValueIfNecessary(value));
00316     }
00317 }
00318
00319 winrt::GridLength TwoPaneViewProperties::Pane2Length()
00320 {
00321     return ValueHelper<winrt::GridLength>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_Pane2LengthProperty));
00322 }
00323
00324 void TwoPaneViewProperties::PanePriority(winrt::TwoPaneViewPriority const& value)
00325 {
00326     [[gsl::suppress(con)]]
00327     {
00328     static_cast<TwoPaneView*>(this)->SetValue(s_PanePriorityProperty, ValueHelper<winrt::TwoPaneViewPriority>::BoxValueIfNecessary(value));
00329     }
00330 }
00331
00332 winrt::TwoPaneViewPriority TwoPaneViewProperties::PanePriority()
00333 {
00334     return ValueHelper<winrt::TwoPaneViewPriority>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_PanePriorityProperty));
00335 }
00336
00337 void TwoPaneViewProperties::TallModeConfiguration(winrt::TwoPaneViewTallModeConfiguration const& value)
00338 {
00339     [[gsl::suppress(con)]]
00340     {
00341     static_cast<TwoPaneView*>(this)->SetValue(s_TallModeConfigurationProperty, ValueHelper<winrt::TwoPaneViewTallModeConfiguration>::BoxValueIfNecessary(value));
00342     }
00343 }
00344
00345 winrt::TwoPaneViewTallModeConfiguration TwoPaneViewProperties::TallModeConfiguration()
00346 {
00347     return ValueHelper<winrt::TwoPaneViewTallModeConfiguration>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_TallModeConfigurationProperty));
00348 }
00349
00350 void TwoPaneViewProperties::WideModeConfiguration(winrt::TwoPaneViewWideModeConfiguration const& value)
00351 {
00352     [[gsl::suppress(con)]]
00353     {
00354     static_cast<TwoPaneView*>(this)->SetValue(s_WideModeConfigurationProperty, ValueHelper<winrt::TwoPaneViewWideModeConfiguration>::BoxValueIfNecessary(value));
00355     }
00356 }
00357
00358 winrt::TwoPaneViewWideModeConfiguration TwoPaneViewProperties::WideModeConfiguration()
00359 {
00360     return ValueHelper<winrt::TwoPaneViewWideModeConfiguration>::CastOrUnbox(static_cast<TwoPaneView*>(this)->GetValue(s_WideModeConfigurationProperty));
00361 }
00362
00363 winrt::event_token TwoPaneViewProperties::ModeChanged(winrt::TypedEventHandler<winrt::TwoPaneView, winrt::IInspectable> const& value)
00364 {
00365     return m_modeChangedEventSource.add(value);
00366 }
00367
00368 void TwoPaneViewProperties::ModeChanged(winrt::event_token const& token)
00369 {
00370     m_modeChangedEventSource.remove(token);
00371 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/RepeatedScrollSnapPoint.h Source File

  • ScrollPresenter

RepeatedScrollSnapPoint.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SnapPoint.h"
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Interactions/ButtonInteraction/InteractionTests/ButtonInteractionTests.cs Source File

  • Interactions
  • ButtonInteraction
  • InteractionTests

ButtonInteractionTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Threading;
00007
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00009 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00010 using Windows.Foundation.Metadata;
00011 using Common;
00012
00013 using WEX.TestExecution;
00014 using WEX.TestExecution.Markup;
00015 using WEX.Logging.Interop;
00016
00017 using Microsoft.Windows.Apps.Test.Automation;
00018 using Microsoft.Windows.Apps.Test.Foundation;
00019 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00020 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00021 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00022
00023 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00024 {
00025     //[TestClass] This feature requires the Xaml2018 feature, which is currently disabled by Velocity
00026     public class ButtonInteractionTests
00027     {
00028         public const string TargetElementAutomationId = "TargetElement";
00029         public const string DummyControlAutomationId = "DummyControl";
00030         public const string InvokeCountTextBlockAutomationId = "InvokeCountTextBlock";
00031         public const string InvokeModeComboBoxAutomationId = "InvokeModeComboBox";
00032         public const string IsHoveringTextBlockAutomationId = "IsHoveringTextBlock";
00033         public const string IsPressingTextBlockAutomationId = "IsPressingTextBlock";
00034         public const string ReleaseModeAutomationId = "ReleaseMode";
00035         public const string PressModeAutomationId = "PressMode";
00036         public const string HoverModeAutomationId = "HoverMode";
00037
00038         [Flags]
00039         public enum TestOptions
00040         {
00041             None = 0,
00042             ReleaseInvokeMode = 1,
00043             PressInvokeMode = 2,
00044             HoverInvokeMode = 3,
00045         }
00046
00047         private TestSetupHelper ButtonInteractionTestSetup(TestOptions options = TestOptions.None)
00048         {
00049             var setupHelper = new TestSetupHelper("ButtonInteraction Tests");
00050
00051             switch (options)
00052             {
00053                 case TestOptions.ReleaseInvokeMode:
00054                     {
00055                         ComboBox invokeModeComboBox = new ComboBox(FindElement.ById(InvokeModeComboBoxAutomationId));
00056                         invokeModeComboBox.SelectItemById(ReleaseModeAutomationId);
00057                     }
00058                     break;
00059
00060                 case TestOptions.PressInvokeMode:
00061                     {
00062                         ComboBox invokeModeComboBox = new ComboBox(FindElement.ById(InvokeModeComboBoxAutomationId));
00063                         invokeModeComboBox.SelectItemById(PressModeAutomationId);
00064                     }
00065                     break;
00066
00067                 case TestOptions.HoverInvokeMode:
00068                     {
00069                         ComboBox invokeModeComboBox = new ComboBox(FindElement.ById(InvokeModeComboBoxAutomationId));
00070                         invokeModeComboBox.SelectItemById(HoverModeAutomationId);
00071                     }
00072                     break;
00073             }
00074
00075             return setupHelper;
00076         }
00077
00078         [ClassInitialize]
00079         [TestProperty("RunAs", "User")]
00080         [TestProperty("Classification", "Integration")]
00081         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00082         public static void ClassInitialize(TestContext testContext)
00083         {
00084             TestEnvironment.Initialize(testContext);
00085         }
00086
00087         [TestCleanup]
00088         public void TestCleanup()
00089         {
00090             TestCleanupHelper.Cleanup();
00091         }
00092
00093         [TestMethod]
00094         public void ValidateInvokeWithReleaseMode()
00095         {
00096             using (var setup = ButtonInteractionTestSetup(TestOptions.ReleaseInvokeMode))
00097             {
00098                 var targetElement = FindElement.ById(TargetElementAutomationId);
00099                 var invokeCountTextBlock = new TextBlock(FindElement.ById(InvokeCountTextBlockAutomationId));
00100                 var isPressingTextBlock = new TextBlock(FindElement.ById(IsPressingTextBlockAutomationId));
00101                 var isHoveringTextBlock = new TextBlock(FindElement.ById(IsHoveringTextBlockAutomationId));
00102
00103                 Log.Comment("Start with mouse not over the element.");
00104                 InputHelper.MoveMouse(targetElement, targetElement.BoundingRectangle.Width - 10, 0);
00105                 Verify.AreEqual("0", invokeCountTextBlock.DocumentText);
00106                 Verify.AreEqual("False", isHoveringTextBlock.DocumentText);
00107                 Verify.AreEqual("False", isPressingTextBlock.DocumentText);
00108
00109                 Log.Comment("Press the left mouse button on the element.");
00110                 InputHelper.LeftMouseButtonDown(targetElement);
00111                 Verify.AreEqual("0", invokeCountTextBlock.DocumentText);
00112                 Verify.AreEqual("True", isHoveringTextBlock.DocumentText);
00113                 Verify.AreEqual("True", isPressingTextBlock.DocumentText);
00114
00115                 Log.Comment("Release the left mouse button on the element.");
00116                 InputHelper.LeftMouseButtonUp(targetElement);
00117                 Verify.AreEqual("1", invokeCountTextBlock.DocumentText);
00118                 Verify.AreEqual("True", isHoveringTextBlock.DocumentText);
00119                 Verify.AreEqual("False", isPressingTextBlock.DocumentText);
00120
00121                 Log.Comment("Move the mouse off the element.");
00122                 InputHelper.MoveMouse(targetElement, targetElement.BoundingRectangle.Width + 10, 0);
00123                 Verify.AreEqual("1", invokeCountTextBlock.DocumentText);
00124                 Verify.AreEqual("False", isHoveringTextBlock.DocumentText);
00125                 Verify.AreEqual("False", isPressingTextBlock.DocumentText);
00126             }
00127         }
00128
00129         [TestMethod]
00130         public void ValidateInvokeWithPressMode()
00131         {
00132             using (var setup = ButtonInteractionTestSetup(TestOptions.PressInvokeMode))
00133             {
00134                 var targetElement = FindElement.ById(TargetElementAutomationId);
00135                 var invokeCountTextBlock = new TextBlock(FindElement.ById(InvokeCountTextBlockAutomationId));
00136                 var isPressingTextBlock = new TextBlock(FindElement.ById(IsPressingTextBlockAutomationId));
00137                 var isHoveringTextBlock = new TextBlock(FindElement.ById(IsHoveringTextBlockAutomationId));
00138
00139                 Log.Comment("Start with mouse not over the element.");
00140                 InputHelper.MoveMouse(targetElement, targetElement.BoundingRectangle.Width - 10, 0);
00141                 Verify.AreEqual("0", invokeCountTextBlock.DocumentText);
00142                 Verify.AreEqual("False", isHoveringTextBlock.DocumentText);
00143                 Verify.AreEqual("False", isPressingTextBlock.DocumentText);
00144
00145                 Log.Comment("Press the left mouse button on the element.");
00146                 InputHelper.LeftMouseButtonDown(targetElement);
00147                 Verify.AreEqual("1", invokeCountTextBlock.DocumentText);
00148                 Verify.AreEqual("True", isHoveringTextBlock.DocumentText);
00149                 Verify.AreEqual("True", isPressingTextBlock.DocumentText);
00150
00151                 Log.Comment("Release the left mouse button on the element.");
00152                 InputHelper.LeftMouseButtonUp(targetElement);
00153                 Verify.AreEqual("1", invokeCountTextBlock.DocumentText);
00154                 Verify.AreEqual("True", isHoveringTextBlock.DocumentText);
00155                 Verify.AreEqual("False", isPressingTextBlock.DocumentText);
00156
00157                 Log.Comment("Move the mouse off the element.");
00158                 InputHelper.MoveMouse(targetElement, targetElement.BoundingRectangle.Width + 10, 0);
00159                 Verify.AreEqual("1", invokeCountTextBlock.DocumentText);
00160                 Verify.AreEqual("False", isHoveringTextBlock.DocumentText);
00161                 Verify.AreEqual("False", isPressingTextBlock.DocumentText);
00162             }
00163         }
00164
00165         [TestMethod]
00166         public void ValidateInvokeWithHoverMode()
00167         {
00168             using (var setup = ButtonInteractionTestSetup(TestOptions.HoverInvokeMode))
00169             {
00170                 var targetElement = FindElement.ById(TargetElementAutomationId);
00171                 var invokeCountTextBlock = new TextBlock(FindElement.ById(InvokeCountTextBlockAutomationId));
00172                 var isPressingTextBlock = new TextBlock(FindElement.ById(IsPressingTextBlockAutomationId));
00173                 var isHoveringTextBlock = new TextBlock(FindElement.ById(IsHoveringTextBlockAutomationId));
00174
00175                 Log.Comment("Start with mouse not over the element.");
00176                 InputHelper.MoveMouse(targetElement, targetElement.BoundingRectangle.Width - 10, 0);
00177                 Verify.AreEqual("0", invokeCountTextBlock.DocumentText);
00178                 Verify.AreEqual("False", isHoveringTextBlock.DocumentText);
00179                 Verify.AreEqual("False", isPressingTextBlock.DocumentText);
00180
00181                 Log.Comment("Move the mouse onto the element.");
00182                 InputHelper.MoveMouse(targetElement, 0, 0);
00183                 Verify.AreEqual("1", invokeCountTextBlock.DocumentText);
00184                 Verify.AreEqual("True", isHoveringTextBlock.DocumentText);
00185                 Verify.AreEqual("True", isPressingTextBlock.DocumentText);
00186
00187                 Log.Comment("Move the mouse off the element.");
00188                 InputHelper.MoveMouse(targetElement, targetElement.BoundingRectangle.Width + 10, 0);
00189                 Verify.AreEqual("1", invokeCountTextBlock.DocumentText);
00190                 Verify.AreEqual("False", isHoveringTextBlock.DocumentText);
00191                 Verify.AreEqual("False", isPressingTextBlock.DocumentText);
00192             }
00193         }
00194
00195         [TestMethod]
00196         public void DoesNotInvokeWhenClickIsDraggedOffBeforeRelease()
00197         {
00198             using (var setup = ButtonInteractionTestSetup(TestOptions.ReleaseInvokeMode))
00199             {
00200                 var targetElement = FindElement.ById(TargetElementAutomationId);
00201                 var invokeCountTextBlock = new TextBlock(FindElement.ById(InvokeCountTextBlockAutomationId));
00202
00203                 Log.Comment("Press the left mouse button on the element.");
00204                 InputHelper.LeftMouseButtonDown(targetElement);
00205                 Verify.AreEqual("0", invokeCountTextBlock.DocumentText);
00206
00207                 Log.Comment("Move the mouse off the element.");
00208                 InputHelper.MoveMouse(targetElement, targetElement.BoundingRectangle.Width + 10, 0);
00209                 Verify.AreEqual("0", invokeCountTextBlock.DocumentText);
00210
00211                 Log.Comment("Release the left mouse button off the element.");
00212                 InputHelper.LeftMouseButtonUp(targetElement);
00213                 Verify.AreEqual("0", invokeCountTextBlock.DocumentText);
00214             }
00215         }
00216
00217         [TestMethod]
00218         public void DoesInvokeWithKeyboard()
00219         {
00220             using (var setup = ButtonInteractionTestSetup())
00221             {
00222                 var targetElement = FindElement.ById(TargetElementAutomationId);
00223                 var invokeCountTextBlock = new TextBlock(FindElement.ById(InvokeCountTextBlockAutomationId));
00224
00225                 Log.Comment("Focus the element.");
00226                 targetElement.SetFocus();
00227                 Wait.ForIdle();
00228
00229                 Log.Comment("Press the SPACE key to invoke the element.");
00230                 targetElement.SendKeys("{SPACE}");
00231                 Verify.AreEqual("1", invokeCountTextBlock.DocumentText);
00232
00233                 Log.Comment("Press the ENTER key to invoke the element.");
00234                 targetElement.SendKeys("{ENTER}");
00235                 Verify.AreEqual("2", invokeCountTextBlock.DocumentText);
00236             }
00237         }
00238     }
00239 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemContainer/TestUI/ItemContainerPage.xaml.cs Source File

  • ItemContainer
  • TestUI

ItemContainerPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using Microsoft.UI.Xaml.Controls;
00006 using Microsoft.UI.Private.Controls;
00007 using WEX.TestExecution;
00008 using WEX.TestExecution.Markup;
00009 using WEX.Logging.Interop;
00010
00011 namespace MUXControlsTestApp
00012 {
00013     [TopLevelTestPage(Name="ItemContainer", Icon="ItemContainer.png")]
00014     public sealed partial class ItemContainerPage : TestPage
00015     {
00016         public ItemContainerPage()
00017         {
00018             LogController.InitializeLogging();
00019             this.InitializeComponent();
00020
00021             navigateToSummary.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ItemContainerSummaryPage), 0); };
00022             navigateToLayout.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ItemContainerLayoutPage), 0); };
00023         }
00024
00025         private void CmbItemContainerOutputDebugStringLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
00026         {
00027             MUXControlsTestHooks.SetOutputDebugStringLevelForType(
00028                 "ItemContainer",
00029                 cmbItemContainerOutputDebugStringLevel.SelectedIndex == 1 || cmbItemContainerOutputDebugStringLevel.SelectedIndex == 2,
00030                 cmbItemContainerOutputDebugStringLevel.SelectedIndex == 2);
00031         }
00032     }
00033 }
00034
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealColorPage Member List

This is the complete list of members for RevealColorPage, including all inherited members.
_checkBrushResult | RevealColorPage | [private]
_revealState | RevealColorPage | [private]
BackgroundBrushNames | RevealColorPage | [static]
Blah | RevealColorPage |
BorderBrushNames | RevealColorPage | [static]
BrushCheckFailed(string message) | RevealColorPage | [inline, private]
BrushCheckFailed(string format, object arg0=null, object arg1=null) | RevealColorPage | [inline, private]
GetBrushName(string fullName) | RevealColorPage | [inline, static]
OnCheckBrushResourcesClicked(object sender, RoutedEventArgs args) | RevealColorPage | [inline, private]
RevealBackgroundBrushes | RevealColorPage |
RevealBorderBrushes | RevealColorPage |
RevealColorPage() | RevealColorPage | [inline]
RevealState | RevealColorPage |
Generated on Sun Dec 1 2024 20:54:25 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: LayoutPanel/LayoutPanel.h Source File

  • LayoutPanel

LayoutPanel.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "LayoutPanel.g.h"
00006 #include "LayoutPanel.properties.h"
00007
00008 class LayoutPanel :
00009     public ReferenceTracker<LayoutPanel, winrt::implementation::LayoutPanelT>,
00010     public LayoutPanelProperties
00011 {
00012 public:
00013
00014     winrt::IInspectable LayoutState() { return m_layoutState.get(); }
00015     void LayoutState(winrt::IInspectable const& value) { m_layoutState.set(value); }
00016
00017     void OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00018
00019     winrt::Size MeasureOverride(winrt::Size const& availableSize);
00020     winrt::Size ArrangeOverride(winrt::Size const& finalSize);
00021
00022 private:
00023     winrt::LayoutContext m_layoutContext{ nullptr };
00024
00025     tracker_ref<winrt::IInspectable> m_layoutState{ this };
00026     tracker_ref<winrt::Layout, TrackerRefFallback::FallbackToComPtrBeforeRS4> m_layout{ this };
00027
00028     winrt::Layout::MeasureInvalidated_revoker m_measureInvalidated{};
00029     winrt::Layout::ArrangeInvalidated_revoker m_arrangeInvalidated{};
00030
00031     void OnLayoutChanged(winrt::Layout const& oldValue, winrt::Layout const& newValue);
00032
00033     void InvalidateMeasureForLayout(winrt::Layout const& sender, winrt::IInspectable const& args);
00034     void InvalidateArrangeForLayout(winrt::Layout const& sender, winrt::IInspectable const& args);
00035 };
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TeachingTipAutomationPeer.properties.cpp Source File

  • Generated

TeachingTipAutomationPeer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "TeachingTipAutomationPeer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Automation::Peers
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(TeachingTipAutomationPeer)
00012 }
00013
00014 #include "TeachingTipAutomationPeer.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemContainer/APITests/ItemContainerTests.cs Source File

  • ItemContainer
  • APITests

ItemContainerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using System.Collections.Generic;
00007 using Microsoft.UI.Xaml.Controls;
00008 using MUXControlsTestApp.Utilities;
00009 using Microsoft.UI.Xaml.Automation.Peers;
00010 using Microsoft.UI.Xaml.Automation.Provider;
00011
00012 using WEX.TestExecution;
00013 using WEX.TestExecution.Markup;
00014 using WEX.Logging.Interop;
00015
00016
00017 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00018 {
00019     [TestClass]
00020     public class ItemContainerTests : ApiTestBase
00021     {
00022         [TestMethod]
00023         public void VerifyDefaultPropertyValues()
00024         {
00025             RunOnUIThread.Execute(() =>
00026             {
00027                 ItemContainer itemContainer = new ItemContainer();
00028                 Verify.IsNotNull(itemContainer);
00029                 Verify.IsNull(itemContainer.Child);
00030                 Verify.IsFalse(itemContainer.IsSelected);
00031
00032 #if MUX_PRERELEASE
00033                 Verify.AreEqual(itemContainer.MultiSelectMode, ItemContainerMultiSelectMode.Auto);
00034                 Log.Comment("ItemContainer MultiSelectMode is Auto by default");
00035                 Verify.AreEqual(itemContainer.CanUserSelect, ItemContainerUserSelectMode.Auto);
00036                 Log.Comment("ItemContainer CanUserSelect is Auto by default");
00037                 Verify.AreEqual(itemContainer.CanUserInvoke, ItemContainerUserInvokeMode.Auto);
00038                 Log.Comment("ItemContainer CanUserInvoke is Auto by default");
00039 #endif
00040             });
00041         }
00042
00043         [TestMethod]
00044         public void VerifySettableAPIValues()
00045         {
00046             RunOnUIThread.Execute(() =>
00047             {
00048                 Log.Comment("Instantiate and verify default ItemContainer values");
00049                 ItemContainer itemContainer = new ItemContainer();
00050                 Verify.IsNotNull(itemContainer);
00051                 Verify.IsNull(itemContainer.Child);
00052                 Verify.IsFalse(itemContainer.IsSelected);
00053
00054                 itemContainer.IsSelected = true;
00055                 Verify.IsTrue(itemContainer.IsSelected, "Can set ItemContainer IsSelected to true");
00056
00057                 itemContainer.Child = new Grid();
00058                 Verify.IsNotNull(itemContainer.Child, "Can set ItemContainer's Child");
00059
00060 #if MUX_PRERELEASE
00061                 Verify.AreEqual(itemContainer.MultiSelectMode, ItemContainerMultiSelectMode.Auto);
00062                 Log.Comment("ItemContainer MultiSelectMode is Auto by default");
00063                 itemContainer.MultiSelectMode = ItemContainerMultiSelectMode.Single;
00064                 Verify.AreEqual(itemContainer.MultiSelectMode, ItemContainerMultiSelectMode.Single);
00065                 Log.Comment("Can set ItemContainer MultiSelectMode to Single");
00066                 itemContainer.MultiSelectMode = ItemContainerMultiSelectMode.Multiple;
00067                 Verify.AreEqual(itemContainer.MultiSelectMode, ItemContainerMultiSelectMode.Multiple);
00068                 Log.Comment("Can set ItemContainer MultiSelectMode to Multiple");
00069
00070                 Verify.AreEqual(itemContainer.CanUserSelect, ItemContainerUserSelectMode.Auto);
00071                 Log.Comment("ItemContainer CanUserSelect is Auto by default");
00072                 itemContainer.CanUserSelect = ItemContainerUserSelectMode.UserCanSelect;
00073                 Verify.AreEqual(itemContainer.CanUserSelect, ItemContainerUserSelectMode.UserCanSelect);
00074                 Log.Comment("Can set ItemContainer CanUserSelect to UserCanSelect");
00075                 itemContainer.CanUserSelect = ItemContainerUserSelectMode.UserCannotSelect;
00076                 Verify.AreEqual(itemContainer.CanUserSelect, ItemContainerUserSelectMode.UserCannotSelect);
00077                 Log.Comment("Can set ItemContainer CanUserSelect to UserCannotSelect");
00078
00079                 Verify.AreEqual(itemContainer.CanUserInvoke, ItemContainerUserInvokeMode.Auto);
00080                 Log.Comment("ItemContainer CanUserInvoke is Auto by default");
00081                 itemContainer.CanUserInvoke = ItemContainerUserInvokeMode.UserCanInvoke;
00082                 Verify.AreEqual(itemContainer.CanUserInvoke, ItemContainerUserInvokeMode.UserCanInvoke);
00083                 Log.Comment("Can set ItemContainer CanUserInvoke to UserCanInvoke");
00084                 itemContainer.CanUserInvoke = ItemContainerUserInvokeMode.UserCannotInvoke;
00085                 Verify.AreEqual(itemContainer.CanUserInvoke, ItemContainerUserInvokeMode.UserCannotInvoke);
00086                 Log.Comment("Can set ItemContainer CanUserInvoke to UserCannotInvoke");
00087 #endif
00088
00089                 Verify.IsTrue(itemContainer.IsEnabled, "ItemContainer is enabled by default");
00090                 itemContainer.IsEnabled = false;
00091                 Verify.IsFalse(itemContainer.IsEnabled, "Can set ItemContainer IsEnabled to false");
00092             });
00093         }
00094
00095         [TestMethod]
00096         public void VerifyItemContainerUIASelectionBehavior()
00097         {
00098             ISelectionItemProvider selectionItemProvider = null;
00099             ItemContainer itemContainer = null;
00100
00101             RunOnUIThread.Execute(() =>
00102             {
00103                 itemContainer = new ItemContainer();
00104                 Content = itemContainer;
00105                 Content.UpdateLayout();
00106
00107                 var itemContainerPeer = FrameworkElementAutomationPeer.CreatePeerForElement(itemContainer);
00108                 Verify.IsNotNull(itemContainerPeer);
00109                 var itemContainerSelectionPattern = itemContainerPeer.GetPattern(PatternInterface.SelectionItem);
00110                 Verify.IsNotNull(itemContainerSelectionPattern);
00111                 selectionItemProvider = itemContainerSelectionPattern as ISelectionItemProvider;
00112
00113                 Verify.IsNull(selectionItemProvider.SelectionContainer);
00114                 Log.Comment("ItemContainer SelectionContainer is Null if not child of ItemsView");
00115
00116                 // ItemContainer IsSelected is false by default.
00117                 Verify.IsFalse(selectionItemProvider.IsSelected);
00118
00119 #if MUX_PRERELEASE
00120                 Verify.AreEqual(itemContainer.CanUserSelect, ItemContainerUserSelectMode.Auto);
00121                 Log.Comment("ItemContainer CanUserSelect is Auto by default");
00122                 Verify.AreEqual(itemContainer.CanUserInvoke, ItemContainerUserInvokeMode.Auto);
00123                 Log.Comment("ItemContainer CanUserInvoke is Auto by default");
00124 #endif
00125
00126                 // Change selection through automationPeer.
00127                 selectionItemProvider.Select();
00128                 Verify.IsTrue(selectionItemProvider.IsSelected, "ItemContainer should be selected");
00129
00130                 // Setting selection through itemContainer API.
00131                 itemContainer.IsSelected = false;
00132                 Verify.IsFalse(selectionItemProvider.IsSelected, "ItemContainer should not be selected");
00133
00134 #if MUX_PRERELEASE
00135                 itemContainer.CanUserSelect = ItemContainerUserSelectMode.UserCannotSelect;
00136                 Verify.AreEqual(itemContainer.CanUserSelect, ItemContainerUserSelectMode.UserCannotSelect);
00137                 Log.Comment("Set ItemContainer CanUserSelect to UserCannotSelect");
00138 #endif
00139                 Content.UpdateLayout();
00140             });
00141
00142             IdleSynchronizer.Wait();
00143
00144             RunOnUIThread.Execute(() =>
00145             {
00146 #if MUX_PRERELEASE
00147                 // Try change selection through automationPeer.
00148                 selectionItemProvider.Select();
00149                 Verify.IsFalse(selectionItemProvider.IsSelected, "ItemContainer should not be selected since UserCannotSelect");
00150 #endif
00151
00152                 // Try setting selection through itemContainer API.
00153                 itemContainer.IsSelected = true;
00154                 Verify.IsTrue(selectionItemProvider.IsSelected, "ItemContainer should be selected since IsSelected bypasses SelectionItemProvider.Select()");
00155             });
00156         }
00157
00158 #if MUX_PRERELEASE
00159         [TestMethod]
00160         public void VerifyItemContainerUIAInvokeBehavior()
00161         {
00162             IInvokeProvider invokeProvider = null;
00163             ItemContainer itemContainer = null;
00164             bool itemInvoked = false;
00165
00166             RunOnUIThread.Execute(() =>
00167             {
00168                 itemContainer = new ItemContainer();
00169                 Content = itemContainer;
00170
00171                 itemContainer.ItemInvoked += (ItemContainer sender, ItemContainerInvokedEventArgs args) =>
00172                 {
00173                     itemInvoked = true;
00174                 };
00175
00176                 Content.UpdateLayout();
00177
00178                 var itemContainerPeer = ItemContainerAutomationPeer.CreatePeerForElement(itemContainer);
00179                 Verify.IsNotNull(itemContainerPeer);
00180                 var itemContainerInvokePattern = itemContainerPeer.GetPattern(PatternInterface.Invoke);
00181
00182                 Verify.AreEqual(itemContainer.CanUserSelect, ItemContainerUserSelectMode.Auto);
00183                 Log.Comment("ItemContainer CanUserSelect is Auto by default");
00184                 Verify.AreEqual(itemContainer.CanUserInvoke, ItemContainerUserInvokeMode.Auto);
00185                 Log.Comment("ItemContainer CanUserInvoke is Auto by default");
00186
00187                 Verify.IsNull(itemContainerInvokePattern, "InvokePattern is not implemented since CanUserInvoke != UserCanInvoke");
00188
00189                 Log.Comment("Set ItemContainer CanUserInvoke to UserCanInvoke");
00190                 itemContainer.CanUserInvoke = ItemContainerUserInvokeMode.UserCanInvoke;
00191                 Verify.AreEqual(itemContainer.CanUserInvoke, ItemContainerUserInvokeMode.UserCanInvoke);
00192
00193                 itemContainerInvokePattern = itemContainerPeer.GetPattern(PatternInterface.Invoke);
00194                 invokeProvider = itemContainerInvokePattern as IInvokeProvider;
00195                 Verify.IsNotNull(itemContainerInvokePattern, "InvokePattern is implemented since CanUserInvoke == UserCanInvoke");
00196
00197                 // Invoke through automationPeer.
00198                 invokeProvider.Invoke();
00199
00200                 Verify.IsTrue(itemInvoked, "ItemContainer ItemInvoked event should be raised");
00201             });
00202         }
00203 #endif
00204     }
00205 }
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterBringIntoViewPage::SampleDataSource Member List

This is the complete list of members for ScrollPresenterBringIntoViewPage::SampleDataSource, including all inherited members.
_inner | ScrollPresenterBringIntoViewPage::SampleDataSource | [private]
Add(object value) | CustomItemsSourceView | [inline]
Clear() | CustomItemsSourceView | [inline]
CollectionChanged | CustomItemsSourceView |
Contains(object value) | CustomItemsSourceView | [inline]
CopyTo(Array array, int index) | CustomItemsSourceView | [inline]
Count | CustomItemsSourceView |
GetAtCore(int index) | ScrollPresenterBringIntoViewPage::SampleDataSource | [inline, protected, virtual]
GetEnumerator() | CustomItemsSourceView | [inline]
GetSizeCore() | ScrollPresenterBringIntoViewPage::SampleDataSource | [inline, protected, virtual]
IndexFromKey(string id) | CustomItemsSourceViewWithUniqueIdMapping | [inline]
IndexFromKeyCore(string id) | CustomItemsSourceViewWithUniqueIdMapping | [inline, protected, virtual]
IndexOf(object value) | CustomItemsSourceView | [inline]
Inner | ScrollPresenterBringIntoViewPage::SampleDataSource |
Insert(int index, object value) | CustomItemsSourceView | [inline]
IsFixedSize | CustomItemsSourceView |
IsReadOnly | CustomItemsSourceView |
IsSynchronized | CustomItemsSourceView |
KeyFromIndex(int index) | CustomItemsSourceViewWithUniqueIdMapping | [inline]
KeyFromIndexCore(int index) | ScrollPresenterBringIntoViewPage::SampleDataSource | [inline, protected, virtual]
OnItemsSourceChanged(NotifyCollectionChangedEventArgs args) | CustomItemsSourceView | [inline, protected]
Owner | ScrollPresenterBringIntoViewPage::SampleDataSource | [private]
Remove(object value) | CustomItemsSourceView | [inline]
RemoveAt(int index) | CustomItemsSourceView | [inline]
SampleDataSource(ScrollPresenterBringIntoViewPage owner, List< string > source) | ScrollPresenterBringIntoViewPage::SampleDataSource | [inline]
SyncRoot | CustomItemsSourceView |
this | CustomItemsSourceView |
Generated on Sun Dec 1 2024 20:54:26 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml.cs Source File

  • AutoSuggestBox
  • TestUI

AutoSuggestBoxPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     [TopLevelTestPage(Name = "AutoSuggestBox", Icon = "AutoSuggestBox.png")]
00007     [AxeScanTestPage(Name = "AutoSuggestBox-Axe")]
00008     public sealed partial class AutoSuggestBoxPage : TestPage
00009     {
00010         string[] suggestions =
00011         {
00012             "Lorem",
00013             "ipsum",
00014             "dolor",
00015             "sit",
00016             "amet"
00017         };
00018
00019         public AutoSuggestBoxPage()
00020         {
00021             this.InitializeComponent();
00022         }
00023
00024         private void AutoSuggestBox_QuerySubmitted(Microsoft.UI.Xaml.Controls.AutoSuggestBox sender, Microsoft.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
00025         {
00026             sender.ItemsSource = string.IsNullOrWhiteSpace(args.QueryText) ? null : suggestions;
00027         }
00028     }
00029 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsViewSummaryPage Member List

This is the complete list of members for ItemsViewSummaryPage, including all inherited members.
_asyncEventReportingLock | ItemsViewSummaryPage | [private]
_colEntities | ItemsViewSummaryPage | [private]
_colSmallEntities | ItemsViewSummaryPage | [private]
_colSmallImages | ItemsViewSummaryPage | [private]
_colSmallItemContainers | ItemsViewSummaryPage | [private]
_colSmallUniformEntities | ItemsViewSummaryPage | [private]
_currentItemIndexChangedToken | ItemsViewSummaryPage | [private]
_dynamicItemsView | ItemsViewSummaryPage | [private]
_entityTemplates | ItemsViewSummaryPage | [private]
_flowLayout | ItemsViewSummaryPage | [private]
_fullLogs | ItemsViewSummaryPage | [private]
_itemsView | ItemsViewSummaryPage | [private]
_itemsViewPointerWheelChangedEventHandler | ItemsViewSummaryPage | [private]
_linedFlowLayout | ItemsViewSummaryPage | [private]
_lorem | ItemsViewSummaryPage | [private]
_lstAsyncEventMessage | ItemsViewSummaryPage | [private]
_lstEntities | ItemsViewSummaryPage | [private]
_lstLinedFlowLayoutLockedItemIndexes | ItemsViewSummaryPage | [private]
_lstQueuedOperations | ItemsViewSummaryPage | [private]
_queuedOperationsTimer | ItemsViewSummaryPage | [private]
_redBrush | ItemsViewSummaryPage | [private]
_scrollViewPointerWheelChangedEventHandler | ItemsViewSummaryPage | [private]
_stackLayout | ItemsViewSummaryPage | [private]
_uniformGridLayout | ItemsViewSummaryPage | [private]
_whiteBrush | ItemsViewSummaryPage | [private]
AppendAsyncEventMessage(string asyncEventMessage) | ItemsViewSummaryPage | [inline, private]
AppendAsyncEventMessage() | ItemsViewSummaryPage | [inline, private]
AppendEventMessage(string eventMessage) | ItemsViewSummaryPage | [inline, private]
BtnClearExceptionReport_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnClearFullLog_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnClearLogs_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnCopyItemsViewEvents_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnCreateDynamicItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDataSourceAddItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDataSourceGetItemCount_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDataSourceInsertItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDataSourceRemoveAllItems_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDataSourceRemoveItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDataSourceReplaceItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDataSourceReplaceItemContent_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDataSourceSetItemCount_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDeselect_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDeselectAll_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnDiscardQueuedOperations_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnExecuteQueuedOperations_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetBorderThickness_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetContentOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetCornerRadius_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetCurrentItemIndex_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetExtentHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetExtentWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetFullLog_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetHorizontalAnchorRatio_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetHorizontalOffset_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetHorizontalScrollBarVisibility_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetHorizontalScrollMode_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterChildrenCount_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementActualHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementActualWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementDesiredSize_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementIsEnabled_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementMaxHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementMaxWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementMinHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementMinWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementRenderSize_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterElementWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterHorizontalAlignment_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterHorizontalCacheLength_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterItemContainerCanUserInvoke_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterItemContainerCanUserSelect_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterItemContainerIsSelected_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterLogItemIndexDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterVerticalAlignment_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetItemsRepeaterVerticalCacheLength_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLayoutForcedIndexBasedLayoutOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutActualLineHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutAverageItemAspectRatioDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutForcedAverageItemAspectRatioDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutForcedAverageItemsPerLineDividerDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutForcedWrapMultiplierDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutFrozenItemIndexesDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutLineHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutLineSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutLogItemIndexDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutMinItemSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutRealizedItemIndexesDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutRequestedRangeLength_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutRequestedRangeStartIndex_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetLinedFlowLayoutSnappedAverageItemsPerLineDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetMargin_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetMaxHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetMaxWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetPadding_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetSelectedItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetSelectedItems_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetStackLayoutOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetStackLayoutSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetUniformGridLayoutMaximumRowsOrColumns_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetUniformGridLayoutMinColumnSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetUniformGridLayoutMinRowSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetUniformGridLayoutOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetVerticalAnchorRatio_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetVerticalOffset_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetVerticalScrollBarVisibility_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetVerticalScrollMode_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetZoomFactor_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnGetZoomMode_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnInvertSelection_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnIsSelected_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnItemsRepeaterElementInvalidateArrange_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnItemsRepeaterElementInvalidateMeasure_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnItemsViewStartBringItemIntoView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnItemsViewStartBringItemIntoViewAsync_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnItemsViewTryGetItemIndex_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnLayoutInvalidateMeasure_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnLinedFlowLayoutClearItemAspectRatios_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnLinedFlowLayoutGetLineIndex_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnLinedFlowLayoutInvalidateItemsInfo_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnLinedFlowLayoutLockItemToLine_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnLinedFlowLayoutUnlockItems_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnParentDynamicItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnParentMarkupItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnQueueDataSourceAddItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnQueueDataSourceInsertItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnQueueDataSourceRemoveAllItems_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnQueueDataSourceRemoveItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnQueueDataSourceReplaceItem_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnQueueHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnQueueWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnReleaseDynamicItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnResetLayoutForcedIndexBasedLayoutOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSelect_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSelectAll_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetBorderThickness_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetContentOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetCornerRadius_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetHorizontalAnchorRatio_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetHorizontalOffset_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetHorizontalScrollBarVisibility_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetHorizontalScrollMode_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterElementHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterElementIsEnabled_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterElementMaxHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterElementMaxWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterElementMinHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterElementMinWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterElementWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterHorizontalAlignment_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterHorizontalCacheLength_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterItemContainerCanUserInvoke_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterItemContainerCanUserSelect_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterItemContainerIsSelected_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterLogItemIndexDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterVerticalAlignment_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetItemsRepeaterVerticalCacheLength_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetLayoutForcedIndexBasedLayoutOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetLinedFlowLayoutForcedAverageItemAspectRatioDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetLinedFlowLayoutForcedAverageItemsPerLineDividerDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetLinedFlowLayoutForcedWrapMultiplierDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetLinedFlowLayoutLineHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetLinedFlowLayoutLineSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetLinedFlowLayoutLogItemIndexDbg_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetLinedFlowLayoutMinItemSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetMargin_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetMaxHeight_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetMaxWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetPadding_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetStackLayoutOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetStackLayoutSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetUniformGridLayoutMaximumRowsOrColumns_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetUniformGridLayoutMinColumnSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetUniformGridLayoutMinRowSpacing_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetUniformGridLayoutOrientation_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetVerticalAnchorRatio_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetVerticalConstantVelocity_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetVerticalOffset_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetVerticalScrollBarVisibility_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetVerticalScrollMode_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetWidth_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetZoomFactor_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnSetZoomMode_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnShareLinedFlowLayout_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnUnparentDynamicItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnUnparentMarkupItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnUnparentReparentMarkupItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnUseDynamicItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
BtnUseMarkupItemsView_Click(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkChildrenProperties_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkChildrenProperties_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkIsEnabled_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkIsEnabled_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkIsItemInvokedEnabled_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkIsItemInvokedEnabled_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkIsTabStop_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkIsTabStop_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkItemsViewDataSource_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkItemsViewDataSource_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkItemsViewMethods_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkItemsViewMethods_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkItemsViewProperties_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkItemsViewProperties_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLinedFlowLayoutIsFastPathSupportedDbg_IsCheckedChanged(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLinedFlowLayoutShowLockedItems_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLinedFlowLayoutShowLockedItems_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogItemContainerMessages_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogItemContainerMessages_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogItemsRepeaterMessages_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogItemsRepeaterMessages_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogItemsViewEvents_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogItemsViewEvents_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogItemsViewMessages_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogItemsViewMessages_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogLinedFlowLayoutMessages_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogLinedFlowLayoutMessages_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogs_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogs_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogScrollViewEvents_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogScrollViewEvents_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogScrollViewMessages_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkLogScrollViewMessages_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkPageMethods_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkPageMethods_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkShowCurrentElement_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkShowCurrentElement_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkShowKeyboardNavigationReferenceOffset_Checked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ChkShowKeyboardNavigationReferenceOffset_Unchecked(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ClearFullLog() | ItemsViewSummaryPage | [inline, private]
CmbBackground_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbBorderBrush_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbItemsSource_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbItemTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbLayout_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbLinedFlowLayoutItemsJustification_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbLinedFlowLayoutItemsStretch_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbSelectionMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbTabNavigation_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbUniformGridLayoutItemsJustification_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbUniformGridLayoutItemsStretch_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
CmbXYFocusKeyboardNavigation_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
DataSourceAddItem() | ItemsViewSummaryPage | [inline, private]
DataSourceInsertItem(int newItemIndex) | ItemsViewSummaryPage | [inline, private]
DataSourceRemoveAllItems() | ItemsViewSummaryPage | [inline, private]
DataSourceRemoveItem(int oldItemIndex) | ItemsViewSummaryPage | [inline, private]
DataSourceReplaceItem(int itemIndex) | ItemsViewSummaryPage | [inline, private]
DataSourceReplaceItemContent(int itemIndex) | ItemsViewSummaryPage | [inline, private]
ExecuteQueuedOperations() | ItemsViewSummaryPage | [inline, private]
GetCaptionText(Image image) | ItemsViewSummaryPage | [inline, private]
GetCornerRadiusFromString(string cornerRadius) | ItemsViewSummaryPage | [inline, private]
GetFullLog() | ItemsViewSummaryPage | [inline, private]
GetImageAsItemsSourceItem(int itemIndex) | ItemsViewSummaryPage | [inline, private]
GetItemContainerAsItemsSourceItem(int itemIndex) | ItemsViewSummaryPage | [inline, private]
GetItemsRepeaterElement(ItemsRepeater itemsRepeater, int index) | ItemsViewSummaryPage | [inline, private]
GetItemsRepeaterElementIndex(FrameworkElement element) | ItemsViewSummaryPage | [inline, private]
GetItemsRepeaterMethodElement(ItemsRepeater itemsRepeater) | ItemsViewSummaryPage | [inline, private]
GetItemsRepeaterPropertyElement(ItemsRepeater itemsRepeater) | ItemsViewSummaryPage | [inline, private]
GetLinedFlowLayoutMethodElement(ItemsRepeater itemsRepeater) | ItemsViewSummaryPage | [inline, private]
GetThicknessFromString(string thickness) | ItemsViewSummaryPage | [inline, private]
HookItemsRepeaterEvents(ItemsRepeater itemsRepeater) | ItemsViewSummaryPage | [inline, private]
HookItemsViewEvents() | ItemsViewSummaryPage | [inline, private]
HookLinedFlowLayoutEvents(LinedFlowLayout linedFlowLayout) | ItemsViewSummaryPage | [inline, private]
HookScrollViewEvents(ScrollView scrollView) | ItemsViewSummaryPage | [inline, private]
Image_ImageFailed(object sender, ExceptionRoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
Image_ImageOpened(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ItemsRepeater_ElementClearing(ItemsRepeater sender, ItemsRepeaterElementClearingEventArgs args) | ItemsViewSummaryPage | [inline, private]
ItemsRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) | ItemsViewSummaryPage | [inline, private]
ItemsRepeater_LayoutUpdated(object sender, object e) | ItemsViewSummaryPage | [inline, private]
ItemsRepeater_Loaded(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ItemsRepeater_SizeChanged(object sender, SizeChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ItemsView_CurrentItemIndexChanged(DependencyObject o, DependencyProperty p) | ItemsViewSummaryPage | [inline, private]
ItemsView_GettingFocus(UIElement sender, Microsoft.UI.Xaml.Input.GettingFocusEventArgs args) | ItemsViewSummaryPage | [inline, private]
ItemsView_GotFocus(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ItemsView_ItemInvoked(ItemsView sender, ItemsViewItemInvokedEventArgs args) | ItemsViewSummaryPage | [inline, private]
ItemsView_Loaded(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ItemsView_LosingFocus(UIElement sender, Microsoft.UI.Xaml.Input.LosingFocusEventArgs args) | ItemsViewSummaryPage | [inline, private]
ItemsView_LostFocus(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ItemsView_PointerWheelChanged(object sender, PointerRoutedEventArgs args) | ItemsViewSummaryPage | [inline, private]
ItemsView_SelectionChanged(ItemsView sender, ItemsViewSelectionChangedEventArgs args) | ItemsViewSummaryPage | [inline, private]
ItemsView_SizeChanged(object sender, SizeChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ItemsViewSetHeight(double value) | ItemsViewSummaryPage | [inline, private]
ItemsViewSetWidth(double value) | ItemsViewSummaryPage | [inline, private]
ItemsViewStartBringItemIntoView() | ItemsViewSummaryPage | [inline, private]
ItemsViewSummaryPage() | ItemsViewSummaryPage | [inline]
ItemsViewSummaryPage_KeyDown(object sender, KeyRoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ItemsViewTestHooks_KeyboardNavigationReferenceOffsetChanged(ItemsView itemsView, object args) | ItemsViewSummaryPage | [inline, private]
LayoutsTestHooks_LinedFlowLayoutInvalidated(object sender, LayoutsTestHooksLinedFlowLayoutInvalidatedEventArgs args) | ItemsViewSummaryPage | [inline, private]
LayoutsTestHooks_LinedFlowLayoutItemLocked(object sender, LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs args) | ItemsViewSummaryPage | [inline, private]
LayoutsTestHooks_LinedFlowLayoutItemLocked2(object sender, LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs args) | ItemsViewSummaryPage | [inline, private]
LayoutsTestHooks_LinedFlowLayoutSnappedAverageItemsPerLineChanged(object sender, object args) | ItemsViewSummaryPage | [inline, private]
LinedFlowLayout_ItemsInfoRequested(LinedFlowLayout sender, LinedFlowLayoutItemsInfoRequestedEventArgs args) | ItemsViewSummaryPage | [inline, private]
LinedFlowLayout_ItemsUnlocked(LinedFlowLayout sender, object args) | ItemsViewSummaryPage | [inline, private]
LogItemsRepeaterInfo() | ItemsViewSummaryPage | [inline, private]
LogItemsViewInfo() | ItemsViewSummaryPage | [inline, private]
LogScrollViewInfo() | ItemsViewSummaryPage | [inline, private]
MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args) | ItemsViewSummaryPage | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | ItemsViewSummaryPage | [inline, protected]
QueuedOperationsTimer_Tick(object sender, object e) | ItemsViewSummaryPage | [inline, private]
QueuedOperationType enum name | ItemsViewSummaryPage | [private]
ScrollView_BringingIntoView(ScrollView sender, ScrollingBringingIntoViewEventArgs args) | ItemsViewSummaryPage | [inline, private]
ScrollView_ExtentChanged(ScrollView sender, object args) | ItemsViewSummaryPage | [inline, private]
ScrollView_Loaded(object sender, RoutedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ScrollView_PointerWheelChanged(object sender, PointerRoutedEventArgs args) | ItemsViewSummaryPage | [inline, private]
ScrollView_ScrollAnimationStarting(ScrollView sender, ScrollingScrollAnimationStartingEventArgs args) | ItemsViewSummaryPage | [inline, private]
ScrollView_ScrollCompleted(ScrollView sender, ScrollingScrollCompletedEventArgs args) | ItemsViewSummaryPage | [inline, private]
ScrollView_SizeChanged(object sender, SizeChangedEventArgs e) | ItemsViewSummaryPage | [inline, private]
ScrollView_StateChanged(ScrollView sender, object args) | ItemsViewSummaryPage | [inline, private]
ScrollView_ViewChanged(ScrollView sender, object args) | ItemsViewSummaryPage | [inline, private]
ScrollView_ViewChangedForCurrentElementVisual(ScrollView sender, object args) | ItemsViewSummaryPage | [inline, private]
ScrollView_ViewChangedForLockedItemsVisuals(ScrollView sender, object args) | ItemsViewSummaryPage | [inline, private]
ScrollView_ZoomAnimationStarting(ScrollView sender, ScrollingZoomAnimationStartingEventArgs args) | ItemsViewSummaryPage | [inline, private]
ScrollView_ZoomCompleted(ScrollView sender, ScrollingZoomCompletedEventArgs args) | ItemsViewSummaryPage | [inline, private]
SetCaptionColor(Image image, Brush brush) | ItemsViewSummaryPage | [inline, private]
UIElement_DragStarting(UIElement sender, DragStartingEventArgs args) | ItemsViewSummaryPage | [inline, private]
UnhookItemsRepeaterEvents(ItemsRepeater itemsRepeater) | ItemsViewSummaryPage | [inline, private]
UnhookItemsViewEvents() | ItemsViewSummaryPage | [inline, private]
UnhookLinedFlowLayoutEvents(LinedFlowLayout linedFlowLayout) | ItemsViewSummaryPage | [inline, private]
UnhookScrollViewEvents(ScrollView scrollView) | ItemsViewSummaryPage | [inline, private]
UpdateBackground() | ItemsViewSummaryPage | [inline, private]
UpdateBorderBrush() | ItemsViewSummaryPage | [inline, private]
UpdateBorderThickness() | ItemsViewSummaryPage | [inline, private]
UpdateContentOrientation() | ItemsViewSummaryPage | [inline, private]
UpdateCornerRadius() | ItemsViewSummaryPage | [inline, private]
UpdateCurrentItemIndex() | ItemsViewSummaryPage | [inline, private]
UpdateDataSourceItemCount() | ItemsViewSummaryPage | [inline, private]
UpdateExtentHeight() | ItemsViewSummaryPage | [inline, private]
UpdateExtentWidth() | ItemsViewSummaryPage | [inline, private]
UpdateHeight() | ItemsViewSummaryPage | [inline, private]
UpdateHorizontalAnchorRatio() | ItemsViewSummaryPage | [inline, private]
UpdateHorizontalOffset() | ItemsViewSummaryPage | [inline, private]
UpdateHorizontalScrollBarVisibility() | ItemsViewSummaryPage | [inline, private]
UpdateHorizontalScrollMode() | ItemsViewSummaryPage | [inline, private]
UpdateIsEnabled() | ItemsViewSummaryPage | [inline, private]
UpdateIsTabStop() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterChildrenCount() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterDefaultCacheLengths() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementActualHeight() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementActualWidth() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementDesiredSize() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementHeight() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementIsEnabled() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementMaxHeight() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementMaxWidth() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementMinHeight() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementMinWidth() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementRenderSize() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterElementWidth() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterFields() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterHorizontalAlignment() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterHorizontalCacheLength() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterItemContainerCanUserInvoke() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterItemContainerCanUserSelect() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterItemContainerIsSelected() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterLogItemIndexDbg() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterVerticalAlignment() | ItemsViewSummaryPage | [inline, private]
UpdateItemsRepeaterVerticalCacheLength() | ItemsViewSummaryPage | [inline, private]
UpdateItemsViewCurrentElementVisual(bool log) | ItemsViewSummaryPage | [inline, private]
UpdateItemsViewIsItemInvokedEnabled() | ItemsViewSummaryPage | [inline, private]
UpdateItemsViewKeyboardNavigationReferenceOffsetVisual(bool log) | ItemsViewSummaryPage | [inline, private]
UpdateItemsViewLayout() | ItemsViewSummaryPage | [inline, private]
UpdateItemsViewSelectionMode() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutActualLineHeight() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutAverageItemAspectRatioDbg() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutForcedAverageItemAspectRatioDbg() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutForcedAverageItemsPerLineDividerDbg() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutForcedWrapMultiplierDbg() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutFrozenItemIndexes() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutIsFastPathSupportedDbg() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutItemsJustification() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutItemsStretch() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutLineHeight() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutLineSpacing() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutLockedItemsVisuals() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutLogItemIndexDbg() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutMinItemSpacing() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutRealizedItemIndexes() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutRequestedRangeLength() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutRequestedRangeStartIndex() | ItemsViewSummaryPage | [inline, private]
UpdateLinedFlowLayoutSnappedAverageItemsPerLineDbg() | ItemsViewSummaryPage | [inline, private]
UpdateMargin() | ItemsViewSummaryPage | [inline, private]
UpdateMaxHeight() | ItemsViewSummaryPage | [inline, private]
UpdateMaxWidth() | ItemsViewSummaryPage | [inline, private]
UpdatePadding() | ItemsViewSummaryPage | [inline, private]
UpdateScrollViewDefaultAnchorRatios() | ItemsViewSummaryPage | [inline, private]
UpdateScrollViewFields() | ItemsViewSummaryPage | [inline, private]
UpdateSelectedItem() | ItemsViewSummaryPage | [inline, private]
UpdateSelectedItems() | ItemsViewSummaryPage | [inline, private]
UpdateStackLayoutOrientation() | ItemsViewSummaryPage | [inline, private]
UpdateStackLayoutSpacing() | ItemsViewSummaryPage | [inline, private]
UpdateTabNavigation() | ItemsViewSummaryPage | [inline, private]
UpdateUniformGridLayoutMaximumRowsOrColumns() | ItemsViewSummaryPage | [inline, private]
UpdateUniformGridLayoutMinColumnSpacing() | ItemsViewSummaryPage | [inline, private]
UpdateUniformGridLayoutMinRowSpacing() | ItemsViewSummaryPage | [inline, private]
UpdateUniformGridLayoutOrientation() | ItemsViewSummaryPage | [inline, private]
UpdateVerticalAnchorRatio() | ItemsViewSummaryPage | [inline, private]
UpdateVerticalOffset() | ItemsViewSummaryPage | [inline, private]
UpdateVerticalScrollBarVisibility() | ItemsViewSummaryPage | [inline, private]
UpdateVerticalScrollMode() | ItemsViewSummaryPage | [inline, private]
UpdateWidth() | ItemsViewSummaryPage | [inline, private]
UpdateXYFocusKeyboardNavigation() | ItemsViewSummaryPage | [inline, private]
UpdateZoomFactor() | ItemsViewSummaryPage | [inline, private]
UpdateZoomMode() | ItemsViewSummaryPage | [inline, private]
UseItemsView(ItemsView iv) | ItemsViewSummaryPage | [inline, private]
~ItemsViewSummaryPage() | ItemsViewSummaryPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/AppBarPage.xaml.cs Source File

  • CommonStyles
  • TestUI

AppBarPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using MUXControlsTestApp.Utilities;
00008
00009 namespace MUXControlsTestApp
00010 {
00011     [TopLevelTestPage(Name="AppBar")]
00012     public sealed partial class AppBarPage : TestPage
00013     {
00014         public AppBarPage()
00015         {
00016             this.InitializeComponent();
00017         }
00018
00019         private void CmbLabelPosition_SelectionChanged(object sender, SelectionChangedEventArgs e)
00020         {
00021             if (cmbLabelPosition == null) return;
00022
00023             CommandBarLabelPosition labelPosition = (CommandBarLabelPosition)cmbLabelPosition.SelectedIndex;
00024
00025             abbA1.LabelPosition =
00026             abbA2.LabelPosition =
00027             abbA3.LabelPosition =
00028             abbB1.LabelPosition =
00029             abbB2.LabelPosition =
00030             abbB3.LabelPosition = labelPosition;
00031         }
00032
00033         private void CmbClosedDisplayMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
00034         {
00035             if (cmbClosedDisplayMode == null) return;
00036
00037             AppBarClosedDisplayMode closedDisplayMode = (AppBarClosedDisplayMode)cmbClosedDisplayMode.SelectedIndex;
00038
00039             abA.ClosedDisplayMode =
00040             abB.ClosedDisplayMode = closedDisplayMode;
00041         }
00042
00043         private void CmbIsOpen_SelectionChanged(object sender, SelectionChangedEventArgs e)
00044         {
00045             if (cmbIsOpen == null) return;
00046
00047             bool isOpen = cmbIsOpen.SelectedIndex == 1;
00048
00049             abA.IsOpen =
00050             abB.IsOpen = isOpen;
00051         }
00052     }
00053 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TabView/TabView.idl Source File

  • TabView

TabView.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 enum TabViewWidthMode
00007 {
00008     Equal = 0,
00009     SizeToContent = 1,
00010     Compact = 2,
00011 };
00012
00013 [MUX_PUBLIC]
00014 [webhosthidden]
00015 enum TabViewCloseButtonOverlayMode
00016 {
00017     Auto = 0,
00018     OnPointerOver = 1,
00019     Always = 2,
00020 };
00021
00022 [MUX_PUBLIC]
00023 [webhosthidden]
00024 runtimeclass TabViewTabCloseRequestedEventArgs
00025 {
00026     Object Item { get; };
00027     TabViewItem Tab { get; };
00028 }
00029
00030 [MUX_PUBLIC]
00031 [webhosthidden]
00032 runtimeclass TabViewTabDroppedOutsideEventArgs
00033 {
00034     Object Item { get; };
00035     TabViewItem Tab { get; };
00036 }
00037
00038 [MUX_PUBLIC]
00039 [webhosthidden]
00040 runtimeclass TabViewTabDragStartingEventArgs
00041 {
00042     Boolean Cancel { get; set; };
00043     Windows.ApplicationModel.DataTransfer.DataPackage Data { get; };
00044     Object Item { get; };
00045     TabViewItem Tab { get; };
00046 }
00047
00048 [MUX_PUBLIC]
00049 [webhosthidden]
00050 runtimeclass TabViewTabDragCompletedEventArgs
00051 {
00052     Windows.ApplicationModel.DataTransfer.DataPackageOperation DropResult { get; };
00053     Object Item { get; };
00054     TabViewItem Tab { get; };
00055 }
00056
00057 [MUX_PUBLIC_V7]
00058 [webhosthidden]
00059 runtimeclass TabViewTabTearOutWindowRequestedEventArgs
00060 {
00061     Object[] Items { get; };
00062     Microsoft.UI.Xaml.UIElement[] Tabs { get; };
00063
00064     Microsoft.UI.WindowId NewWindowId;
00065 };
00066
00067 [MUX_PUBLIC_V7]
00068 [webhosthidden]
00069 runtimeclass TabViewTabTearOutRequestedEventArgs
00070 {
00071     Object[] Items { get; };
00072     Microsoft.UI.Xaml.UIElement[] Tabs { get; };
00073
00074     Microsoft.UI.WindowId NewWindowId { get; };
00075 };
00076
00077 [MUX_PUBLIC_V7]
00078 [webhosthidden]
00079 runtimeclass TabViewExternalTornOutTabsDroppingEventArgs
00080 {
00081     Object[] Items { get; };
00082     Microsoft.UI.Xaml.UIElement[] Tabs { get; };
00083
00084     Int32 DropIndex { get; };
00085     Boolean AllowDrop;
00086 };
00087
00088 [MUX_PUBLIC_V7]
00089 [webhosthidden]
00090 runtimeclass TabViewExternalTornOutTabsDroppedEventArgs
00091 {
00092     Object[] Items { get; };
00093     Microsoft.UI.Xaml.UIElement[] Tabs { get; };
00094
00095     Int32 DropIndex { get; };
00096 };
00097
00098 [MUX_PUBLIC]
00099 [webhosthidden]
00100 [contentproperty("TabItems")]
00101 unsealed runtimeclass TabView : Microsoft.UI.Xaml.Controls.Control
00102 {
00103     TabView();
00104
00105     [MUX_DEFAULT_VALUE("winrt::TabViewWidthMode::Equal")]
00106     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00107     TabViewWidthMode TabWidthMode{ get; set; };
00108
00109     [MUX_DEFAULT_VALUE("winrt::TabViewCloseButtonOverlayMode::Auto")]
00110     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00111     TabViewCloseButtonOverlayMode CloseButtonOverlayMode{ get; set; };
00112
00113     Object TabStripHeader{ get; set; };
00114     Microsoft.UI.Xaml.DataTemplate TabStripHeaderTemplate{ get; set; };
00115
00116     Object TabStripFooter{ get; set; };
00117     Microsoft.UI.Xaml.DataTemplate TabStripFooterTemplate{ get; set; };
00118
00119     [MUX_DEFAULT_VALUE("true")]
00120     Boolean IsAddTabButtonVisible{ get; set; };
00121     Microsoft.UI.Xaml.Input.ICommand AddTabButtonCommand{ get; set; };
00122     Object AddTabButtonCommandParameter{ get; set; };
00123
00124     event Windows.Foundation.TypedEventHandler<TabView, TabViewTabCloseRequestedEventArgs> TabCloseRequested;
00125
00126     event Windows.Foundation.TypedEventHandler<TabView, TabViewTabDroppedOutsideEventArgs> TabDroppedOutside;
00127
00128     event Windows.Foundation.TypedEventHandler<TabView, Object> AddTabButtonClick;
00129
00130     event Windows.Foundation.TypedEventHandler<TabView, Windows.Foundation.Collections.IVectorChangedEventArgs> TabItemsChanged;
00131
00132     // From ListView
00133     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00134     Object TabItemsSource;
00135     Windows.Foundation.Collections.IVector<Object> TabItems{ get; };
00136
00137     Microsoft.UI.Xaml.DataTemplate TabItemTemplate;
00138     Microsoft.UI.Xaml.Controls.DataTemplateSelector TabItemTemplateSelector{ get; set; };
00139
00140     [MUX_DEFAULT_VALUE("false")]
00141     Boolean CanDragTabs{ get; set; };
00142     [MUX_DEFAULT_VALUE("true")]
00143     Boolean CanReorderTabs{ get; set; };
00144     [MUX_DEFAULT_VALUE("true")]
00145     Boolean AllowDropTabs{ get; set; };
00146
00147     [MUX_PUBLIC_V7]
00148     {
00149         [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00150         [MUX_DEFAULT_VALUE("false")]
00151         Boolean CanTearOutTabs{ get; set; };
00152
00153         event Windows.Foundation.TypedEventHandler<TabView, TabViewTabTearOutWindowRequestedEventArgs> TabTearOutWindowRequested;
00154         event Windows.Foundation.TypedEventHandler<TabView, TabViewTabTearOutRequestedEventArgs> TabTearOutRequested;
00155         event Windows.Foundation.TypedEventHandler<TabView, TabViewExternalTornOutTabsDroppingEventArgs> ExternalTornOutTabsDropping;
00156         event Windows.Foundation.TypedEventHandler<TabView, TabViewExternalTornOutTabsDroppedEventArgs> ExternalTornOutTabsDropped;
00157     }
00158
00159     [MUX_DEFAULT_VALUE("0")]
00160     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00161     Int32 SelectedIndex;
00162
00163     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00164     Object SelectedItem;
00165
00166     Microsoft.UI.Xaml.DependencyObject ContainerFromItem(Object item);
00167     Microsoft.UI.Xaml.DependencyObject ContainerFromIndex(Int32 index);
00168
00169     event Microsoft.UI.Xaml.Controls.SelectionChangedEventHandler SelectionChanged;
00170
00171     event Windows.Foundation.TypedEventHandler<TabView, TabViewTabDragStartingEventArgs> TabDragStarting;
00172     event Windows.Foundation.TypedEventHandler<TabView, TabViewTabDragCompletedEventArgs> TabDragCompleted;
00173     event Microsoft.UI.Xaml.DragEventHandler TabStripDragOver;
00174     event Microsoft.UI.Xaml.DragEventHandler TabStripDrop;
00175
00176     static Microsoft.UI.Xaml.DependencyProperty TabWidthModeProperty{ get; };
00177     static Microsoft.UI.Xaml.DependencyProperty TabStripHeaderProperty{ get; };
00178     static Microsoft.UI.Xaml.DependencyProperty TabStripHeaderTemplateProperty{ get; };
00179     static Microsoft.UI.Xaml.DependencyProperty TabStripFooterProperty{ get; };
00180     static Microsoft.UI.Xaml.DependencyProperty TabStripFooterTemplateProperty{ get; };
00181     static Microsoft.UI.Xaml.DependencyProperty IsAddTabButtonVisibleProperty{ get; };
00182     static Microsoft.UI.Xaml.DependencyProperty AddTabButtonCommandProperty{ get; };
00183     static Microsoft.UI.Xaml.DependencyProperty AddTabButtonCommandParameterProperty{ get; };
00184
00185     static Microsoft.UI.Xaml.DependencyProperty TabItemsSourceProperty{ get; };
00186     static Microsoft.UI.Xaml.DependencyProperty TabItemsProperty{ get; };
00187     static Microsoft.UI.Xaml.DependencyProperty TabItemTemplateProperty{ get; };
00188     static Microsoft.UI.Xaml.DependencyProperty TabItemTemplateSelectorProperty{ get; };
00189     static Microsoft.UI.Xaml.DependencyProperty CloseButtonOverlayModeProperty{ get; };
00190     static Microsoft.UI.Xaml.DependencyProperty CanDragTabsProperty{ get; };
00191     static Microsoft.UI.Xaml.DependencyProperty CanReorderTabsProperty{ get; };
00192     static Microsoft.UI.Xaml.DependencyProperty AllowDropTabsProperty{ get; };
00193
00194     [MUX_PUBLIC_V7]
00195     {
00196         static Microsoft.UI.Xaml.DependencyProperty CanTearOutTabsProperty{ get; };
00197     }
00198
00199     static Microsoft.UI.Xaml.DependencyProperty SelectedIndexProperty{ get; };
00200     static Microsoft.UI.Xaml.DependencyProperty SelectedItemProperty{ get; };
00201 }
00202
00203 [MUX_PUBLIC]
00204 [webhosthidden]
00205 unsealed runtimeclass TabViewItem : Microsoft.UI.Xaml.Controls.ListViewItem
00206 {
00207     TabViewItem();
00208
00209     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00210     Object Header{ get; set; };
00211
00212     Microsoft.UI.Xaml.DataTemplate HeaderTemplate{ get; set; };
00213
00214     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00215     IconSource IconSource{ get; set; };
00216
00217     [MUX_DEFAULT_VALUE("true")]
00218     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00219     Boolean IsClosable{ get; set; };
00220
00221     TabViewItemTemplateSettings TabViewTemplateSettings{ get; };
00222
00223     event Windows.Foundation.TypedEventHandler<TabViewItem, TabViewTabCloseRequestedEventArgs> CloseRequested;
00224
00225     static Microsoft.UI.Xaml.DependencyProperty HeaderProperty{ get; };
00226     static Microsoft.UI.Xaml.DependencyProperty HeaderTemplateProperty{ get; };
00227     static Microsoft.UI.Xaml.DependencyProperty IconSourceProperty{ get; };
00228     static Microsoft.UI.Xaml.DependencyProperty IsClosableProperty{ get; };
00229     static Microsoft.UI.Xaml.DependencyProperty TabViewTemplateSettingsProperty{ get; };
00230 }
00231
00232 [MUX_PUBLIC]
00233 [webhosthidden]
00234 unsealed runtimeclass TabViewItemTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00235 {
00236     TabViewItemTemplateSettings();
00237
00238     Microsoft.UI.Xaml.Controls.IconElement IconElement;
00239
00240     [MUX_PUBLIC_V3]
00241     {
00242         Microsoft.UI.Xaml.Media.Geometry TabGeometry;
00243     }
00244
00245     static Microsoft.UI.Xaml.DependencyProperty IconElementProperty{ get; };
00246
00247     [MUX_PUBLIC_V3]
00248     {
00249         static Microsoft.UI.Xaml.DependencyProperty TabGeometryProperty{ get; };
00250     }
00251 }
00252
00253 }
00254
00255 namespace MU_XCP_NAMESPACE
00256 {
00257
00258 [MUX_PUBLIC]
00259 [webhosthidden]
00260 unsealed runtimeclass TabViewListView : Microsoft.UI.Xaml.Controls.ListView
00261 {
00262     TabViewListView();
00263 }
00264
00265 }
00266
00267 namespace MU_XAP_NAMESPACE
00268 {
00269
00270 [MUX_PUBLIC]
00271 [webhosthidden]
00272 unsealed runtimeclass TabViewAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer
00273 {
00274     TabViewAutomationPeer(MU_XC_NAMESPACE.TabView owner);
00275 }
00276
00277 [MUX_PUBLIC]
00278 [webhosthidden]
00279 unsealed runtimeclass TabViewItemAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.ListViewItemAutomationPeer
00280 {
00281     TabViewItemAutomationPeer(MU_XC_NAMESPACE.TabViewItem owner);
00282 }
00283
00284 }
00285
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IAcrylicBrushStaticsPrivate Member List

This is the complete list of members for IAcrylicBrushStaticsPrivate, including all inherited members.
CreateBackdropAcrylicEffectBrush(Microsoft.UI.Composition.Compositor compositor, Windows.UI.Color initialTintColor, Windows.UI.Color initialFallbackColor, Boolean willTintColorAlwaysBeOpaque) | IAcrylicBrushStaticsPrivate
CreateBackdropAcrylicEffectBrushWithLuminosity(Microsoft.UI.Composition.Compositor compositor, Windows.UI.Color initialTintColor, Windows.Foundation.IReference< double > luminosityOpacity, Windows.UI.Color initialFallbackColor, Boolean willTintColorAlwaysBeOpaque) | IAcrylicBrushStaticsPrivate
Generated on Sun Dec 1 2024 20:53:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/SpotLightStateHelper.cpp Source File

  • Lights

SpotLightStateHelper.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SpotLightStateHelper.h"
00007 #include "AnimationUtility.h"
00008
00009 bool IsStateAnimated(const RevealHoverSpotlightStateDesc& state)
00010 {
00011     bool isColorOrIntensityAnimated = (!IsIgnored(state.InnerConeIntensity) && IsAnimated(state.InnerConeIntensity)) ||
00012         (!IsIgnored(state.OuterConeIntensity) && IsAnimated(state.OuterConeIntensity));
00013
00014     const bool isOuterAngleScaleAnimated = !IsIgnored(state.OuterAngleScale) && IsAnimated(state.OuterAngleScale);
00015
00016     return isColorOrIntensityAnimated || isOuterAngleScaleAnimated;
00017 }
00018
00019 bool IsStateIgnored(const RevealHoverSpotlightStateDesc& state)
00020 {
00021     bool isColorOrIntensityIgnored = IsIgnored(state.InnerConeIntensity) && IsIgnored(state.OuterConeIntensity);
00022     const bool isOuterAngleScaleIgnored = IsIgnored(state.OuterAngleScale);
00023
00024     return isColorOrIntensityIgnored && isOuterAngleScaleIgnored;
00025 }
00026
00027
00028 // Returns a function that cancels onComplete callback
00029 void PlaySpotLightStateAnimation(
00030     const winrt::SpotLight& compositionSpotLight,
00031     const winrt::CompositionPropertySet& colorsProxy,
00032     const winrt::CompositionPropertySet& offsetProps,
00033     const RevealHoverSpotlightStateDesc& targetState,
00034     std::function<void()>* cancelationFunction,
00035     std::function<void()> onComplete)
00036 {
00037     if (cancelationFunction) *cancelationFunction = nullptr;
00038
00039     if (compositionSpotLight && colorsProxy && offsetProps)
00040     {
00041         if (!IsStateAnimated(targetState))
00042         {
00043             AnimateTo(compositionSpotLight, targetState.InnerConeIntensity);
00044             AnimateTo(compositionSpotLight, targetState.OuterConeIntensity);
00045             AnimateTo(offsetProps, targetState.OuterAngleScale);
00046
00047             if (onComplete)
00048             {
00049                 onComplete();
00050             }
00051         }
00052         else
00053         {
00054             winrt::CompositionScopedBatch scopedBatch = compositionSpotLight.Compositor().CreateScopedBatch(winrt::CompositionBatchTypes::Animation);
00055
00056             AnimateTo(compositionSpotLight, targetState.InnerConeIntensity);
00057             AnimateTo(compositionSpotLight, targetState.OuterConeIntensity);
00058             AnimateTo(offsetProps, targetState.OuterAngleScale);
00059
00060             scopedBatch.End();
00061
00062             if (onComplete)
00063             {
00064                 const auto completedEventToken = scopedBatch.Completed([onComplete = std::move(onComplete)](auto&, auto&)
00065                 {
00066                     onComplete();
00067                 });
00068
00069                 if (cancelationFunction)
00070                 {
00071                     *cancelationFunction = [scopedBatch, completedEventToken]
00072                     {
00073                         scopedBatch.Completed(completedEventToken);
00074                     };
00075                 }
00076             }
00077         }
00078     }
00079     else
00080     {
00081         if (onComplete)
00082         {
00083             onComplete();
00084         }
00085     }
00086 }
00087
00088 void SetSpotLightStateImmediate(const winrt::SpotLight& compositionSpotLight,
00089     const winrt::CompositionPropertySet& colorsProxy,
00090     const winrt::CompositionPropertySet& offsetProps,
00091     const RevealHoverSpotlightStateDesc& targetState)
00092 {
00093     if (!compositionSpotLight || IsStateIgnored(targetState))
00094     {
00095         return;
00096     }
00097
00098     if (!IsIgnored(targetState.InnerConeIntensity))
00099     {
00100         SetValueDirect(compositionSpotLight, targetState.InnerConeIntensity.SpotlightProperty, targetState.InnerConeIntensity.Value);
00101     }
00102
00103     if (!IsIgnored(targetState.OuterConeIntensity))
00104     {
00105         SetValueDirect(compositionSpotLight, targetState.OuterConeIntensity.SpotlightProperty, targetState.OuterConeIntensity.Value);
00106     }
00107
00108     if (!IsIgnored(targetState.OuterAngleScale))
00109     {
00110         SetValueDirect(offsetProps, targetState.OuterAngleScale.PropertyName, targetState.OuterAngleScale.Value);
00111     }
00112 }
00113
00114 void SetSpotLightStateImmediate(const winrt::SpotLight& compositionSpotLight,
00115     const winrt::CompositionPropertySet& colorsProxy,
00116     const winrt::CompositionPropertySet& offsetProps,
00117     const RevealBorderSpotlightStateDesc& targetState)
00118 {
00119     if (!compositionSpotLight)
00120     {
00121         return;
00122     }
00123
00124     SetValueDirect(compositionSpotLight, targetState.ConstantAttenuation.SpotlightProperty, targetState.ConstantAttenuation.Value);
00125     SetValueDirect(compositionSpotLight, targetState.LinearAttenuation.SpotlightProperty, targetState.LinearAttenuation.Value);
00126     SetValueDirect(compositionSpotLight, targetState.InnerConeAngleInDegrees.SpotlightProperty, targetState.InnerConeAngleInDegrees.Value);
00127     SetValueDirect(colorsProxy, targetState.InnerConeColor.SpotlightProperty, targetState.InnerConeColor.Value);
00128     SetValueDirect(compositionSpotLight, targetState.OuterConeAngleInDegrees.SpotlightProperty, targetState.OuterConeAngleInDegrees.Value);
00129     SetValueDirect(colorsProxy, targetState.OuterConeColor.SpotlightProperty, targetState.OuterConeColor.Value);
00130     SetValueDirect(offsetProps, targetState.Height.PropertyName, targetState.Height.Value);
00131     SetValueDirect(offsetProps, targetState.OuterAngleScale.PropertyName, targetState.OuterAngleScale.Value);
00132 }
00133
00134 // Returns property set that contains InnerConeColor, OuterConeColor and LightIntensity properties.
00135 // Since the light does not have a dedicated linear intensity knob we introduce our own by combining
00136 // the scalar LightIntensity and the color in an expression animation.
00137 // SoftLightSwitch operates on the LightIntensity property of the returned property set.
00138 // Other parties may independently set InnerConeColor and OuterConeColor.
00139 // Note that the light ignores the A component of the color so the intensity must affect all RGB channels.
00140 winrt::CompositionPropertySet CreateSpotLightColorsProxy(const winrt::SpotLight& compositionSpotLight)
00141 {
00142     auto lightProperties = compositionSpotLight.Properties();
00143     auto compositor = compositionSpotLight.Compositor();
00144
00145     lightProperties.InsertColor(L"InnerConeColor", { 255, 255, 255, 255 });
00146     lightProperties.InsertColor(L"OuterConeColor", { 255, 255, 255, 255 });
00147     lightProperties.InsertScalar(L"LightIntensity", 0);
00148
00149     auto innerConeColorExpression = compositor.CreateExpressionAnimation(L"ColorLerp(ColorRgb(0,0,0,0), target.InnerConeColor, target.LightIntensity)");
00150     innerConeColorExpression.SetReferenceParameter(L"target", lightProperties);
00151
00152     auto outerConeColorExpression = compositor.CreateExpressionAnimation(L"ColorLerp(ColorRgb(0,0,0,0), target.OuterConeColor, target.LightIntensity)");
00153     outerConeColorExpression.SetReferenceParameter(L"target", lightProperties);
00154
00155     compositionSpotLight.StartAnimation(L"InnerConeColor", innerConeColorExpression);
00156     compositionSpotLight.StartAnimation(L"OuterConeColor", outerConeColorExpression);
00157
00158     return lightProperties;
00159 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RatingControl/RatingControlAutomationPeer.idl Source File

  • RatingControl

RatingControlAutomationPeer.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XAP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 unsealed runtimeclass RatingControlAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer
00007 {
00008     [method_name("CreateInstanceWithOwner")] RatingControlAutomationPeer(MU_XC_NAMESPACE.RatingControl owner);
00009 }
00010
00011 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioButtons/RadioButtonsAutomationPeer.cpp Source File

  • RadioButtons

RadioButtonsAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "RadioButtons.h"
00008 #include "RadioButtonsAutomationPeer.h"
00009 #include "Utils.h"
00010
00011 #include "RadioButtonsAutomationPeer.properties.cpp"
00012
00013 RadioButtonsAutomationPeer::RadioButtonsAutomationPeer(winrt::RadioButtons const& owner)
00014     : ReferenceTracker(owner)
00015 {
00016 }
00017
00018 hstring RadioButtonsAutomationPeer::GetClassNameCore()
00019 {
00020     return winrt::hstring_name_of<winrt::RadioButtons>();
00021 }
00022
00023 hstring RadioButtonsAutomationPeer::GetNameCore()
00024 {
00025     winrt::hstring name = __super::GetNameCore();
00026
00027     if (name.empty())
00028     {
00029         if (auto radioButtons = Owner().try_as<winrt::RadioButtons>())
00030         {
00031             name = SharedHelpers::TryGetStringRepresentationFromObject(radioButtons.Header());
00032         }
00033     }
00034
00035     return name;
00036 }
00037
00038 winrt::AutomationControlType RadioButtonsAutomationPeer::GetAutomationControlTypeCore()
00039 {
00040     return winrt::AutomationControlType::Group;
00041 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/SliderInteraction.properties.h Source File

  • Generated

SliderInteraction.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class SliderInteractionProperties
00008 {
00009 public:
00010     SliderInteractionProperties();
00011
00012
00013
00014     winrt::event_token PropertyChanged(winrt::PropertyChangedEventHandler const& value);
00015     void PropertyChanged(winrt::event_token const& token);
00016
00017     event_source<winrt::PropertyChangedEventHandler> m_propertyChangedEventSource;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021 };
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnimatedVisualPlayerPage Member List

This is the complete list of members for AnimatedVisualPlayerPage, including all inherited members.
AnimatedVisualPlayerPage() | AnimatedVisualPlayerPage | [inline]
AroundTheEndAnimationPlayButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
DelayForHalfAnimationDurationThenReverse() | AnimatedVisualPlayerPage | [inline, private]
FallenBackButton_ClickAsync(Object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
FromOneKeyframeAnimationPlayButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
GetIsPlayingAsync() | AnimatedVisualPlayerPage | [inline, private]
Play(double from, double to, TextBox statusTextBox) | AnimatedVisualPlayerPage | [inline, private]
PlayButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
Player_PointerMoved(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
PlayForward(double fromProgress, double toProgress, TextBox statusTextBox) | AnimatedVisualPlayerPage | [inline, private]
PlayHalfButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
ReverseNegativePlaybackRateAnimationPlayButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
ReversePositivePlaybackRateAnimationPlayButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
SetAutomationPeerNames(Panel root) | AnimatedVisualPlayerPage | [inline, private]
SetProgressButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
SetTextBoxTextToPlayerProgress(TextBox textBox) | AnimatedVisualPlayerPage | [inline, private]
StopButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
SwitchCacheModeButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
ToZeroKeyframeAnimationPlayButton_Click(object sender, RoutedEventArgs e) | AnimatedVisualPlayerPage | [inline, private]
Generated on Sun Dec 1 2024 20:53:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressRing/AnimatedVisuals/ProgressRingIndeterminate.h Source File

  • ProgressRing
  • AnimatedVisuals

ProgressRingIndeterminate.h

Go to the documentation of this file.
00001 ﻿#pragma once
00002 //------------------------------------------------------------------------------
00003 // <auto-generated>
00004 //     This code was generated by a tool.
00005 //
00006 //       LottieGen version:
00007 //           7.0.0-build.16+g667576ee09
00008 //
00009 //       LottieGen source:
00010 //           http://aka.ms/Lottie
00011 //
00012 //     Changes to this file may cause incorrect behavior and will be lost if
00013 //     the code is regenerated.
00014 // </auto-generated>
00015 //------------------------------------------------------------------------------
00016
00017 namespace AnimatedVisuals
00018 {
00019     // Name:        ProgressRingIndeterminate
00020     // Frame rate:  60 fps
00021     // Frame count: 120
00022     // Duration:    2000.0 mS
00023     // ________________________________________________
00024     // | Theme property | Type  |    Default value    |
00025     // |________________|_______|_____________________|
00026     // | Background     | Color | #FFD3D3D3 LightGray |
00027     // | Foreground     | Color |      #FF0078D7      |
00028     // ------------------------------------------------
00029     class ProgressRingIndeterminate
00030         : public winrt::implements<ProgressRingIndeterminate, winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisualSource>
00031     {
00032         winrt::Microsoft::UI::Composition::CompositionPropertySet _themeProperties{ nullptr };
00033         winrt::Windows::UI::Color _themeBackground{ 0xFF, 0xD3, 0xD3, 0xD3 };
00034         winrt::Windows::UI::Color _themeForeground{ 0xFF, 0x00, 0x78, 0xD7 };
00035
00036         winrt::float4 ColorAsVector4(winrt::Windows::UI::Color color);
00037
00038         winrt::Microsoft::UI::Composition::CompositionPropertySet EnsureThemeProperties(winrt::Microsoft::UI::Composition::Compositor compositor);
00039
00040         // Animation duration: 2.000 seconds.
00041         static constexpr int64_t c_durationTicks{ 20000000L };
00042
00043         // Theme property: Background.
00044         static inline const winrt::Windows::UI::Color c_themeBackground{ 0xFF, 0xD3, 0xD3, 0xD3 };
00045
00046         // Theme property: Foreground.
00047         static inline const winrt::Windows::UI::Color c_themeForeground{ 0xFF, 0x00, 0x78, 0xD7 };
00048
00049         winrt::Windows::UI::Color Background();
00050         void Background(winrt::Windows::UI::Color value);
00051         winrt::Windows::UI::Color Foreground();
00052         void Foreground(winrt::Windows::UI::Color value);
00053
00054     public:
00055         virtual winrt::Microsoft::UI::Composition::CompositionPropertySet GetThemeProperties(winrt::Microsoft::UI::Composition::Compositor compositor);
00056
00057         virtual winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual(
00058             const winrt::Microsoft::UI::Composition::Compositor& compositor,
00059             winrt::IInspectable& diagnostics);
00060     };
00061 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/SelectionSample/Grouped/GroupedSample.xaml.cs Source File

  • Repeater
  • TestUI
  • Samples
  • SelectionSample
  • Grouped

GroupedSample.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.ObjectModel;
00006 using System.Linq;
00007 using Microsoft.UI.Xaml;
00008 using Microsoft.UI.Xaml.Controls;
00009 using MUXControlsTestApp.Utilities;
00010
00011 namespace MUXControlsTestApp.Samples.Selection
00012 {
00013     public sealed partial class GroupedSample : Page
00014     {
00015         private Random _rnd = new Random(12345);
00016         private StackLayout _layout = new StackLayout();
00017         private ObservableCollection<object> _groupedData = new ObservableCollection<object>(Enumerable.Range(0, 10).Select(i => Enumerable.Range(0, 20).Select(j => j.ToString()).ToList()));
00018
00019         public GroupedSample()
00020         {
00021             this.InitializeComponent();
00022             repeater.ItemsSource = _groupedData;
00023             selectionModel.Source = _groupedData;
00024         }
00025
00026         private void OnMultipleSelectionClicked(object sender, RoutedEventArgs e)
00027         {
00028             selectionModel.SingleSelect = multipleSelection.IsChecked.Value ? false : true;
00029         }
00030
00031         private void OnSelectTemplateKey(RecyclingElementFactory sender, SelectTemplateEventArgs args)
00032         {
00033             args.TemplateKey = args.DataContext is string ? "RepeaterItemTemplate" : "RepeaterGroupTemplate";
00034         }
00035
00036         private void groupRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args)
00037         {
00038             if (args.Element is GroupedRepeaterItem)
00039             {
00040                 (args.Element as GroupedRepeaterItem).RepeatedIndex = args.Index;
00041             }
00042         }
00043
00044         private void OnBackClicked(object sender, RoutedEventArgs e)
00045         {
00046             Frame.GoBack();
00047         }
00048
00049         private void OnTreeViewClicked(object sender, RoutedEventArgs e)
00050         {
00051             Frame.NavigateWithoutAnimation(typeof(TreeViewSample));
00052         }
00053
00054         private void groupRepeater_ElementIndexChanged(ItemsRepeater sender, ItemsRepeaterElementIndexChangedEventArgs args)
00055         {
00056             if (args.Element is GroupedRepeaterItem)
00057             {
00058                 (args.Element as GroupedRepeaterItem).RepeatedIndex = args.NewIndex;
00059             }
00060         }
00061     }
00062 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/IndexPathTests.cs Source File

  • Repeater
  • APITests

IndexPathTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Controls;
00005 using MUXControlsTestApp.Utilities;
00006 using Common;
00007
00008 using WEX.TestExecution;
00009 using WEX.TestExecution.Markup;
00010 using WEX.Logging.Interop;
00011
00012 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests
00013 {
00014     [TestClass]
00015     public class IndexPathTests : ApiTestBase
00016     {
00017         [TestMethod]
00018         public void ValidateIndexPath()
00019         {
00020             RunOnUIThread.Execute(() =>
00021             {
00022                 IndexPath path = IndexPath.CreateFromIndices(null);
00023                 Verify.AreEqual(0, path.GetSize());
00024
00025                 path = IndexPath.CreateFrom(5);
00026                 Verify.AreEqual(1, path.GetSize());
00027                 Verify.AreEqual(5, path.GetAt(0));
00028
00029                 path = IndexPath.CreateFrom(1, 2);
00030                 Verify.AreEqual(2, path.GetSize());
00031                 Verify.AreEqual(1, path.GetAt(0));
00032                 Verify.AreEqual(2, path.GetAt(1));
00033
00034                 Verify.AreEqual(0, IndexPath.CreateFrom(0, 1).CompareTo(IndexPath.CreateFrom(0, 1)));
00035                 Verify.AreEqual(-1, IndexPath.CreateFrom(0, 1).CompareTo(IndexPath.CreateFrom(1, 0)));
00036                 Verify.AreEqual(1, IndexPath.CreateFrom(0, 1).CompareTo(IndexPath.CreateFrom(0, 0)));
00037
00038                 Verify.AreEqual(-1, IndexPath.CreateFrom(1, 0).CompareTo(IndexPath.CreateFrom(1, 1)));
00039                 Verify.AreEqual(0, IndexPath.CreateFrom(1, 0).CompareTo(IndexPath.CreateFrom(1, 0)));
00040                 Verify.AreEqual(1, IndexPath.CreateFrom(1, 1).CompareTo(IndexPath.CreateFrom(1, 0)));
00041
00042
00043                 var emptyPath = IndexPath.CreateFromIndices(null);
00044                 Verify.AreEqual(0, emptyPath.CompareTo(emptyPath));
00045                 var path1 = IndexPath.CreateFrom(1);
00046                 Verify.AreEqual(-1, emptyPath.CompareTo(path1));
00047                 Verify.AreEqual(1, path1.CompareTo(emptyPath));
00048                 var path12 = IndexPath.CreateFrom(1, 2);
00049                 Verify.AreEqual(-1, path1.CompareTo(path12));
00050                 Verify.AreEqual(1, path12.CompareTo(path1));
00051             });
00052         }
00053     }
00054 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/TestUI/ItemsViewPictureLibraryPage.xaml.cs Source File

  • ItemsView
  • TestUI

ItemsViewPictureLibraryPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Collections.ObjectModel;
00007 using Microsoft.UI.Xaml;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Private.Controls;
00010
00011 namespace MUXControlsTestApp
00012 {
00013     public sealed partial class ItemsViewPictureLibraryPage : TestPage
00014     {
00015         private List<string> lstEventMessage = new List<string>();
00016         private PictureLibrary pictureLibrary = null;
00017         private double[] aspectRatios = null;
00018
00019         public ItemsViewPictureLibraryPage()
00020         {
00021             this.InitializeComponent();
00022
00023             if (chkLogItemsViewMessages.IsChecked == true || chkLogScrollViewMessages.IsChecked == true || chkLogItemsRepeaterMessages.IsChecked == true)
00024             {
00025                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00026
00027                 if (chkLogItemsRepeaterMessages.IsChecked == true)
00028                 {
00029                     MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00030                 }
00031                 if (chkLogScrollViewMessages.IsChecked == true)
00032                 {
00033                     MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00034                 }
00035                 if (chkLogItemsViewMessages.IsChecked == true)
00036                 {
00037                     MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00038                 }
00039             }
00040
00041             pictureLibrary = PictureLibrary.CreateLarge();
00042         }
00043
00044         private void ChkCustomUI_Checked(object sender, RoutedEventArgs e)
00045         {
00046             if (grdCustomUI != null)
00047                 grdCustomUI.Visibility = Visibility.Visible;
00048         }
00049
00050         private void ChkCustomUI_Unchecked(object sender, RoutedEventArgs e)
00051         {
00052             if (grdCustomUI != null)
00053                 grdCustomUI.Visibility = Visibility.Collapsed;
00054         }
00055
00056         private void ChkLogs_Checked(object sender, RoutedEventArgs e)
00057         {
00058             if (grdLogs != null)
00059                 grdLogs.Visibility = Visibility.Visible;
00060         }
00061
00062         private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
00063         {
00064             if (grdLogs != null)
00065                 grdLogs.Visibility = Visibility.Collapsed;
00066         }
00067
00068         private void ItemsView_Loaded(object sender, RoutedEventArgs e)
00069         {
00070             AppendEventMessage($"ItemsView.Loaded");
00071             if (chkLogItemsRepeaterEvents.IsChecked == true)
00072             {
00073                 LogItemsRepeaterInfo();
00074             }
00075             if (chkLogScrollViewEvents.IsChecked == true)
00076             {
00077                 LogScrollViewInfo();
00078             }
00079             LogItemsViewInfo();
00080         }
00081
00082         private void ItemsView_SizeChanged(object sender, SizeChangedEventArgs e)
00083         {
00084             AppendEventMessage($"ItemsView.SizeChanged Size={itemsView.ActualWidth}, {itemsView.ActualHeight}");
00085             if (chkLogItemsRepeaterEvents.IsChecked == true)
00086             {
00087                 LogItemsRepeaterInfo();
00088             }
00089             if (chkLogScrollViewEvents.IsChecked == true)
00090             {
00091                 LogScrollViewInfo();
00092             }
00093             LogItemsViewInfo();
00094         }
00095
00096         private void ItemsView_GettingFocus(UIElement sender, Microsoft.UI.Xaml.Input.GettingFocusEventArgs args)
00097         {
00098             FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
00099             string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
00100             FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
00101             string newFEName = (newFE == null) ? "null" : newFE.Name;
00102
00103             AppendEventMessage($"ItemsView.GettingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
00104         }
00105
00106         private void ItemsView_LostFocus(object sender, RoutedEventArgs e)
00107         {
00108             AppendEventMessage("ItemsView.LostFocus");
00109         }
00110
00111         private void ItemsView_LosingFocus(UIElement sender, Microsoft.UI.Xaml.Input.LosingFocusEventArgs args)
00112         {
00113             FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
00114             string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
00115             FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
00116             string newFEName = (newFE == null) ? "null" : newFE.Name;
00117
00118             AppendEventMessage($"ItemsView.LosingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
00119         }
00120
00121         private void ItemsView_GotFocus(object sender, RoutedEventArgs e)
00122         {
00123             AppendEventMessage("ItemsView.GotFocus");
00124         }
00125
00126         private void ItemsRepeater_Loaded(object sender, RoutedEventArgs e)
00127         {
00128             AppendEventMessage($"ItemsRepeater.Loaded");
00129             LogItemsRepeaterInfo();
00130             if (chkLogItemsViewEvents.IsChecked == true)
00131             {
00132                 LogItemsViewInfo();
00133             }
00134         }
00135
00136         private void ItemsRepeater_SizeChanged(object sender, SizeChangedEventArgs e)
00137         {
00138             AppendEventMessage($"ItemsRepeater.SizeChanged Size={itemsView.ActualWidth}, {itemsView.ActualHeight}");
00139             LogItemsRepeaterInfo();
00140             if (chkLogItemsViewEvents.IsChecked == true)
00141             {
00142                 LogItemsViewInfo();
00143             }
00144         }
00145
00146         private void LinedFlowLayout_ItemsInfoRequested(LinedFlowLayout sender, LinedFlowLayoutItemsInfoRequestedEventArgs args)
00147         {
00148             AppendEventMessage($"LinedFlowLayout.ItemsInfoRequested ItemsRangeStartIndex={args.ItemsRangeStartIndex}, ItemsRangeRequestedLength={args.ItemsRangeRequestedLength}");
00149
00150             int itemsRangeStartIndex = args.ItemsRangeStartIndex;
00151
00152             args.SetDesiredAspectRatios(GetAspectRatios(ref itemsRangeStartIndex, args.ItemsRangeRequestedLength));
00153             args.ItemsRangeStartIndex = itemsRangeStartIndex;
00154             args.MinWidth = 86;
00155         }
00156
00157         private void ScrollView_Loaded(object sender, RoutedEventArgs e)
00158         {
00159             AppendEventMessage($"ScrollView.Loaded");
00160             LogScrollViewInfo();
00161             if (chkLogItemsViewEvents.IsChecked == true)
00162             {
00163                 LogItemsViewInfo();
00164             }
00165         }
00166
00167         private void ScrollView_SizeChanged(object sender, SizeChangedEventArgs e)
00168         {
00169             AppendEventMessage($"ScrollView.SizeChanged Size={itemsView.ActualWidth}, {itemsView.ActualHeight}");
00170             LogScrollViewInfo();
00171             if (chkLogItemsViewEvents.IsChecked == true)
00172             {
00173                 LogItemsViewInfo();
00174             }
00175         }
00176
00177         private void ScrollView_ExtentChanged(ScrollView sender, object args)
00178         {
00179             AppendEventMessage("ScrollView.ExtentChanged ExtentWidth={sender.ExtentWidth}, ExtentHeight={sender.ExtentHeight}");
00180         }
00181
00182         private void ScrollView_StateChanged(ScrollView sender, object args)
00183         {
00184             AppendEventMessage($"ScrollView.StateChanged {sender.State.ToString()}");
00185         }
00186
00187         private void ScrollView_ViewChanged(ScrollView sender, object args)
00188         {
00189             AppendEventMessage($"ScrollView.ViewChanged HorizontalOffset={sender.HorizontalOffset.ToString()}, VerticalOffset={sender.VerticalOffset}, ZoomFactor={sender.ZoomFactor}");
00190         }
00191
00192         private void ScrollView_ScrollAnimationStarting(ScrollView sender, ScrollingScrollAnimationStartingEventArgs args)
00193         {
00194             AppendEventMessage($"ScrollView.ScrollAnimationStarting OffsetsChangeCorrelationId={args.CorrelationId}, SP=({args.StartPosition.X}, {args.StartPosition.Y}), EP=({args.EndPosition.X}, {args.EndPosition.Y})");
00195         }
00196
00197         private void ScrollView_ZoomAnimationStarting(ScrollView sender, ScrollingZoomAnimationStartingEventArgs args)
00198         {
00199             AppendEventMessage($"ScrollView.ZoomAnimationStarting ZoomFactorChangeCorrelationId={args.CorrelationId}, CenterPoint={args.CenterPoint}, SZF={args.StartZoomFactor}, EZF={args.EndZoomFactor}");
00200         }
00201
00202         private void ScrollView_ScrollCompleted(ScrollView sender, ScrollingScrollCompletedEventArgs args)
00203         {
00204             AppendEventMessage($"ScrollView.ScrollCompleted OffsetsChangeCorrelationId={args.CorrelationId}");
00205         }
00206
00207         private void ScrollView_ZoomCompleted(ScrollView sender, ScrollingZoomCompletedEventArgs args)
00208         {
00209             AppendEventMessage($"ScrollView.ZoomCompleted ZoomFactorChangeCorrelationId={args.CorrelationId}");
00210         }
00211
00212         private void LogItemsRepeaterInfo()
00213         {
00214             ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
00215
00216             AppendEventMessage($"ItemsRepeater Info: ItemsSource={itemsRepeater.ItemsSource}, ItemTemplate={itemsRepeater.ItemTemplate}, Layout={itemsRepeater.Layout}");
00217         }
00218
00219         private void LogScrollViewInfo()
00220         {
00221             ScrollView scrollView = ItemsViewTestHooks.GetScrollViewPart(itemsView);
00222
00223             AppendEventMessage($"ScrollView Info: HorizontalOffset={scrollView.HorizontalOffset}, VerticalOffset={scrollView.VerticalOffset}, ZoomFactor={scrollView.ZoomFactor}");
00224             AppendEventMessage($"ScrollView Info: ViewportWidth={scrollView.ViewportWidth}, ExtentHeight={scrollView.ViewportHeight}");
00225             AppendEventMessage($"ScrollView Info: ExtentWidth={scrollView.ExtentWidth}, ExtentHeight={scrollView.ExtentHeight}");
00226             AppendEventMessage($"ScrollView Info: ScrollableWidth={scrollView.ScrollableWidth}, ScrollableHeight={scrollView.ScrollableHeight}");
00227         }
00228
00229         private void LogItemsViewInfo()
00230         {
00231             //AppendEventMessage($"ItemsView Info: ItemsSource={itemsView.ItemsSource}, ItemTemplate={itemsView.ItemTemplate}, Layout={itemsView.Layout}");
00232         }
00233
00234         private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
00235         {
00236             lstLogs.Items.Clear();
00237         }
00238
00239         private void ChkLogItemsRepeaterEvents_Checked(object sender, RoutedEventArgs e)
00240         {
00241             if (itemsView != null)
00242             {
00243                 ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
00244
00245                 if (itemsRepeater != null)
00246                 {
00247                     itemsRepeater.Loaded += ItemsRepeater_Loaded;
00248                     itemsRepeater.SizeChanged += ItemsRepeater_SizeChanged;
00249                 }
00250             }
00251         }
00252
00253         private void ChkLogItemsRepeaterEvents_Unchecked(object sender, RoutedEventArgs e)
00254         {
00255             if (itemsView != null)
00256             {
00257                 ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
00258
00259                 if (itemsRepeater != null)
00260                 {
00261                     itemsRepeater.Loaded -= ItemsRepeater_Loaded;
00262                     itemsRepeater.SizeChanged -= ItemsRepeater_SizeChanged;
00263                 }
00264             }
00265         }
00266
00267         private void ChkLogScrollViewEvents_Checked(object sender, RoutedEventArgs e)
00268         {
00269             if (itemsView != null)
00270             {
00271                 ScrollView scrollView = ItemsViewTestHooks.GetScrollViewPart(itemsView);
00272
00273                 if (scrollView != null)
00274                 {
00275                     scrollView.Loaded += ScrollView_Loaded;
00276                     scrollView.SizeChanged += ScrollView_SizeChanged;
00277                     scrollView.ExtentChanged += ScrollView_ExtentChanged;
00278                     scrollView.StateChanged += ScrollView_StateChanged;
00279                     scrollView.ViewChanged += ScrollView_ViewChanged;
00280                     scrollView.ScrollAnimationStarting += ScrollView_ScrollAnimationStarting;
00281                     scrollView.ZoomAnimationStarting += ScrollView_ZoomAnimationStarting;
00282                     scrollView.ScrollCompleted += ScrollView_ScrollCompleted;
00283                     scrollView.ZoomCompleted += ScrollView_ZoomCompleted;
00284                 }
00285             }
00286         }
00287
00288         private void ChkLogScrollViewEvents_Unchecked(object sender, RoutedEventArgs e)
00289         {
00290             if (itemsView != null)
00291             {
00292                 ScrollView scrollView = ItemsViewTestHooks.GetScrollViewPart(itemsView);
00293
00294                 if (scrollView != null)
00295                 {
00296                     scrollView.Loaded -= ScrollView_Loaded;
00297                     scrollView.SizeChanged -= ScrollView_SizeChanged;
00298                     scrollView.ExtentChanged -= ScrollView_ExtentChanged;
00299                     scrollView.StateChanged -= ScrollView_StateChanged;
00300                     scrollView.ViewChanged -= ScrollView_ViewChanged;
00301                     scrollView.ScrollAnimationStarting -= ScrollView_ScrollAnimationStarting;
00302                     scrollView.ZoomAnimationStarting -= ScrollView_ZoomAnimationStarting;
00303                     scrollView.ScrollCompleted -= ScrollView_ScrollCompleted;
00304                     scrollView.ZoomCompleted -= ScrollView_ZoomCompleted;
00305                 }
00306             }
00307         }
00308
00309         private void ChkLogItemsViewEvents_Checked(object sender, RoutedEventArgs e)
00310         {
00311             if (itemsView != null)
00312             {
00313                 itemsView.GettingFocus += ItemsView_GettingFocus;
00314                 itemsView.GotFocus += ItemsView_GotFocus;
00315                 itemsView.LosingFocus += ItemsView_LosingFocus;
00316                 itemsView.LostFocus += ItemsView_LostFocus;
00317                 itemsView.Loaded += ItemsView_Loaded;
00318                 itemsView.SizeChanged += ItemsView_SizeChanged;
00319             }
00320         }
00321
00322         private void ChkLogItemsViewEvents_Unchecked(object sender, RoutedEventArgs e)
00323         {
00324             if (itemsView != null)
00325             {
00326                 itemsView.GettingFocus -= ItemsView_GettingFocus;
00327                 itemsView.GotFocus -= ItemsView_GotFocus;
00328                 itemsView.LosingFocus -= ItemsView_LosingFocus;
00329                 itemsView.LostFocus -= ItemsView_LostFocus;
00330                 itemsView.Loaded -= ItemsView_Loaded;
00331                 itemsView.SizeChanged -= ItemsView_SizeChanged;
00332             }
00333         }
00334
00335         private void ChkLogItemsRepeaterMessages_Checked(object sender, RoutedEventArgs e)
00336         {
00337             MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00338             if (chkLogItemsViewMessages.IsChecked == false && chkLogScrollViewMessages.IsChecked == false)
00339                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00340         }
00341
00342         private void ChkLogItemsRepeaterMessages_Unchecked(object sender, RoutedEventArgs e)
00343         {
00344             MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00345             if (chkLogItemsViewMessages.IsChecked == false && chkLogScrollViewMessages.IsChecked == false)
00346                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00347         }
00348
00349         private void ChkLogScrollViewMessages_Checked(object sender, RoutedEventArgs e)
00350         {
00351             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00352             if (chkLogItemsViewMessages.IsChecked == false && chkLogItemsRepeaterMessages.IsChecked == false)
00353                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00354         }
00355
00356         private void ChkLogScrollViewMessages_Unchecked(object sender, RoutedEventArgs e)
00357         {
00358             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00359             if (chkLogItemsViewMessages.IsChecked == false && chkLogItemsRepeaterMessages.IsChecked == false)
00360                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00361         }
00362
00363         private void ChkLogItemsViewMessages_Checked(object sender, RoutedEventArgs e)
00364         {
00365             MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00366             if (chkLogScrollViewMessages.IsChecked == false && chkLogItemsRepeaterMessages.IsChecked == false)
00367                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00368         }
00369
00370         private void ChkLogItemsViewMessages_Unchecked(object sender, RoutedEventArgs e)
00371         {
00372             MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00373             if (chkLogScrollViewMessages.IsChecked == false && chkLogItemsRepeaterMessages.IsChecked == false)
00374                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00375         }
00376
00377         private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
00378         {
00379             // Cut off the terminating new line.
00380             string msg = args.Message.Substring(0, args.Message.Length - 1);
00381             string eventMessage = string.Empty;
00382             string senderName = string.Empty;
00383
00384             try
00385             {
00386                 FrameworkElement fe = sender as FrameworkElement;
00387
00388                 if (fe != null)
00389                 {
00390                     senderName = "s:" + fe.Name + ", ";
00391                 }
00392             }
00393             catch
00394             {
00395             }
00396
00397             if (args.IsVerboseLevel)
00398             {
00399                 eventMessage = "Verbose: " + senderName + "m:" + msg;
00400             }
00401             else
00402             {
00403                 eventMessage = "Info: " + senderName + "m:" + msg;
00404             }
00405
00406             AppendEventMessage(eventMessage);
00407         }
00408
00409         private double[] GetAspectRatios(ref int itemsRangeStartIndex, int itemsRangeRequestedLength)
00410         {
00411             const int bufferedAspectRatiosLength = 500;
00412             int cappedBufferedAspectRatiosLength = Math.Min(bufferedAspectRatiosLength, pictureLibrary.Count);
00413
00414             cappedBufferedAspectRatiosLength = Math.Max(cappedBufferedAspectRatiosLength, itemsRangeRequestedLength);
00415
00416             if (aspectRatios == null || aspectRatios.Length != cappedBufferedAspectRatiosLength)
00417             {
00418                 aspectRatios = new double[cappedBufferedAspectRatiosLength];
00419             }
00420
00421             if (itemsRangeStartIndex > 0 && itemsRangeRequestedLength < cappedBufferedAspectRatiosLength)
00422             {
00423                 itemsRangeStartIndex -= (cappedBufferedAspectRatiosLength - itemsRangeRequestedLength) / 2;
00424             }
00425
00426             if (itemsRangeStartIndex + cappedBufferedAspectRatiosLength - 1 >= pictureLibrary.Count)
00427             {
00428                 cappedBufferedAspectRatiosLength -= itemsRangeStartIndex + cappedBufferedAspectRatiosLength - pictureLibrary.Count;
00429             }
00430
00431             for (int i = 0; i < cappedBufferedAspectRatiosLength; i++)
00432             {
00433                 aspectRatios[i] = pictureLibrary[itemsRangeStartIndex + i].AspectRatio;
00434             }
00435
00436             AppendEventMessage($"GetAspectRatios: itemsRangeStartIndex={itemsRangeStartIndex}, cappedBufferedAspectRatiosLength={cappedBufferedAspectRatiosLength}");
00437
00438             return aspectRatios;
00439         }
00440
00441         private void AppendEventMessage(string eventMessage)
00442         {
00443             while (eventMessage.Length > 0)
00444             {
00445                 string msgHead = eventMessage;
00446
00447                 if (eventMessage.Length > 110)
00448                 {
00449                     int commaIndex = eventMessage.IndexOf(',', 110);
00450                     if (commaIndex != -1)
00451                     {
00452                         msgHead = eventMessage.Substring(0, commaIndex);
00453                         eventMessage = eventMessage.Substring(commaIndex + 1);
00454                     }
00455                     else
00456                     {
00457                         eventMessage = string.Empty;
00458                     }
00459                 }
00460                 else
00461                 {
00462                     eventMessage = string.Empty;
00463                 }
00464
00465                 lstEventMessage.Add(msgHead);
00466             }
00467             AppendEventMessage();
00468         }
00469
00470         private void AppendEventMessage()
00471         {
00472             foreach (string eventMessage in lstEventMessage)
00473             {
00474                 lstLogs.Items.Add(eventMessage);
00475             }
00476             lstEventMessage.Clear();
00477         }
00478
00479         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00480         {
00481             txtExceptionReport.Text = string.Empty;
00482         }
00483     }
00484
00485     public class Picture
00486     {
00487         public string Path { get; set; }
00488         public string Title { get; set; } = string.Empty;
00489         public int Id { get; set; }
00490
00491         public double AspectRatio { get; set; } = 1;
00492
00493         public Location Location { get; set; }
00494     }
00495
00496     public enum Location
00497     {
00498         Seattle,
00499         Miami,
00500         LA
00501     }
00502
00503     public class PictureLibrary : ObservableCollection<Picture>
00504     {
00505         public string Title { get; set; }
00506
00507         public PictureLibrary()
00508         {
00509         }
00510
00511         public static PictureLibrary CreateSmall()
00512         {
00513             if (s_SmallLibrary == null)
00514             {
00515                 s_SmallLibrary = new PictureLibrary()
00516                 {
00517                     new Picture() { Path = "ms-appx:///Images/Picture1.png",  Location = Location.Seattle},
00518                     new Picture() { Path = "ms-appx:///Images/Picture2.png",  Location = Location.LA},
00519                     new Picture() { Path = "ms-appx:///Images/Picture3.png",  Location = Location.Miami},
00520                     new Picture() { Path = "ms-appx:///Images/Picture4.png",  Location = Location.Seattle},
00521                     new Picture() { Path = "ms-appx:///Images/Picture5.png",  Location = Location.LA},
00522                     new Picture() { Path = "ms-appx:///Images/Picture6.png",  Location = Location.Miami},
00523                     new Picture() { Path = "ms-appx:///Images/Picture7.png",  Location = Location.Seattle},
00524                     new Picture() { Path = "ms-appx:///Images/Picture8.png",  Location = Location.LA},
00525                     new Picture() { Path = "ms-appx:///Images/Picture9.png",  Location = Location.Miami},
00526                     new Picture() { Path = "ms-appx:///Images/Picture10.png", Location = Location.Seattle},
00527                     new Picture() { Path = "ms-appx:///Images/Picture11.png", Location = Location.LA},
00528                     new Picture() { Path = "ms-appx:///Images/Picture12.png", Location = Location.Miami},
00529                     new Picture() { Path = "ms-appx:///Images/Picture13.png", Location = Location.Seattle}
00530                 };
00531             }
00532
00533             return s_SmallLibrary;
00534         }
00535
00536         public static PictureLibrary CreateLarge()
00537         {
00538             if (s_LargeLibrary == null)
00539             {
00540                 var library = new PictureLibrary();
00541
00542                 for (int i = 0; i < 1000000 / 40; i++)
00543                 {
00544                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture1.png",  Title = "Image", Id = i * 40,      Location = Location.Seattle, AspectRatio = 1.497 });
00545                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture2.png",  Title = "Image", Id = i * 40 + 1,  Location = Location.LA, AspectRatio = 1.529 });
00546                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture3.png",  Title = "Image", Id = i * 40 + 2,  Location = Location.Miami, AspectRatio = 0.820 });
00547                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture4.png",  Title = "Image", Id = i * 40 + 3,  Location = Location.Seattle, AspectRatio = 1.504 });
00548                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture5.png",  Title = "Image", Id = i * 40 + 4,  Location = Location.LA, AspectRatio = 1.267 });
00549                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture6.png",  Title = "Image", Id = i * 40 + 5,  Location = Location.Miami, AspectRatio = 0.740 });
00550                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture7.png",  Title = "Image", Id = i * 40 + 6,  Location = Location.Seattle, AspectRatio = 1.488 });
00551                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture8.png",  Title = "Image", Id = i * 40 + 7,  Location = Location.LA, AspectRatio = 0.727 });
00552                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture9.png",  Title = "Image", Id = i * 40 + 8,  Location = Location.Miami, AspectRatio = 1.488 });
00553                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture10.png", Title = "Image", Id = i * 40 + 9,  Location = Location.Seattle, AspectRatio = 0.813 });
00554                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture11.png", Title = "Image", Id = i * 40 + 10, Location = Location.Seattle, AspectRatio = 0.797 });
00555                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture12.png", Title = "Image", Id = i * 40 + 11, Location = Location.LA, AspectRatio = 1.496 });
00556                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture13.png", Title = "Image", Id = i * 40 + 12, Location = Location.Miami, AspectRatio = 0.555 });
00557                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture14.png", Title = "Image", Id = i * 40 + 13, Location = Location.Seattle, AspectRatio = 1.777 });
00558                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture15.png", Title = "Image", Id = i * 40 + 14, Location = Location.LA, AspectRatio = 0.858 });
00559                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture16.png", Title = "Image", Id = i * 40 + 15, Location = Location.Miami, AspectRatio = 1.782 });
00560                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture17.png", Title = "Image", Id = i * 40 + 16, Location = Location.Seattle, AspectRatio = 1.334 });
00561                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture18.png", Title = "Image", Id = i * 40 + 17, Location = Location.LA, AspectRatio = 0.998 });
00562                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture19.png", Title = "Image", Id = i * 40 + 18, Location = Location.Miami, AspectRatio = 1.790 });
00563                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture20.png", Title = "Image", Id = i * 40 + 19, Location = Location.Seattle, AspectRatio = 0.569 });
00564                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture21.png", Title = "Image", Id = i * 40 + 20, Location = Location.Seattle, AspectRatio = 1.787 });
00565                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture22.png", Title = "Image", Id = i * 40 + 21, Location = Location.LA, AspectRatio = 0.742 });
00566                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture23.png", Title = "Image", Id = i * 40 + 22, Location = Location.Miami, AspectRatio = 0.555 });
00567                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture24.png", Title = "Image", Id = i * 40 + 23, Location = Location.Seattle, AspectRatio = 1.778 });
00568                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture25.png", Title = "Image", Id = i * 40 + 24, Location = Location.LA, AspectRatio = 0.998 });
00569                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture26.png", Title = "Image", Id = i * 40 + 25, Location = Location.Miami, AspectRatio = 1.002 });
00570                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture27.png", Title = "Image", Id = i * 40 + 26, Location = Location.Seattle, AspectRatio = 0.745 });
00571                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture28.png", Title = "Image", Id = i * 40 + 27, Location = Location.LA, AspectRatio = 0.748 });
00572                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture29.png", Title = "Image", Id = i * 40 + 28, Location = Location.Miami, AspectRatio = 1.512 });
00573                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture30.png", Title = "Image", Id = i * 40 + 29, Location = Location.Seattle, AspectRatio = 0.997 });
00574                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture31.png", Title = "Image", Id = i * 40 + 30, Location = Location.Seattle, AspectRatio = 0.798 });
00575                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture32.png", Title = "Image", Id = i * 40 + 31, Location = Location.LA, AspectRatio = 1.501 });
00576                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture33.png", Title = "Image", Id = i * 40 + 32, Location = Location.Miami, AspectRatio = 1.509 });
00577                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture34.png", Title = "Image", Id = i * 40 + 33, Location = Location.Seattle, AspectRatio = 1.340 });
00578                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture35.png", Title = "Image", Id = i * 40 + 34, Location = Location.LA, AspectRatio = 1.327 });
00579                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture36.png", Title = "Image", Id = i * 40 + 35, Location = Location.Miami, AspectRatio = 1.848 });
00580                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture37.png", Title = "Image", Id = i * 40 + 36, Location = Location.Seattle, AspectRatio = 1.526 });
00581                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture38.png", Title = "Image", Id = i * 40 + 37, Location = Location.LA, AspectRatio = 0.743 });
00582                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture39.png", Title = "Image", Id = i * 40 + 38, Location = Location.Miami, AspectRatio = 0.742 });
00583                     library.Add(new Picture() { Path = "ms-appx:///Images/Picture40.png", Title = "Image", Id = i * 40 + 39, Location = Location.Seattle, AspectRatio = 0.742 });
00584                 };
00585
00586                 s_LargeLibrary = library;
00587             }
00588
00589             return s_LargeLibrary;
00590         }
00591
00592         static PictureLibrary s_LargeLibrary = null;
00593         static PictureLibrary s_SmallLibrary = null;
00594     }
00595 }
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewTabDragCompletedEventArgs Member List

This is the complete list of members for TabViewTabDragCompletedEventArgs, including all inherited members.
DropResult() | TabViewTabDragCompletedEventArgs | [inline]
Item() | TabViewTabDragCompletedEventArgs | [inline]
Tab() | TabViewTabDragCompletedEventArgs | [inline]
TabViewTabDragCompletedEventArgs(winrt::DragItemsCompletedEventArgs const &args, winrt::IInspectable const &item, winrt::TabViewItem tab) | TabViewTabDragCompletedEventArgs | [inline]
Generated on Sun Dec 1 2024 20:53:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterManipulationModePage Member List

This is the complete list of members for ScrollPresenterManipulationModePage, including all inherited members.
btnClearFullLog_Click(object sender, RoutedEventArgs e) | ScrollPresenterManipulationModePage | [inline, private]
btnGetFullLog_Click(object sender, RoutedEventArgs e) | ScrollPresenterManipulationModePage | [inline, private]
ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e) | ScrollPresenterManipulationModePage | [inline, private]
ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterManipulationModePage | [inline, private]
CmbManipulationMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterManipulationModePage | [inline, private]
fullLogs | ScrollPresenterManipulationModePage | [private]
ManipulationModeFromIndex(int index) | ScrollPresenterManipulationModePage | [inline, private]
MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args) | ScrollPresenterManipulationModePage | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | ScrollPresenterManipulationModePage | [inline, protected]
ScrollPresenter_StateChanged(ScrollPresenter sender, object args) | ScrollPresenterManipulationModePage | [inline, private]
ScrollPresenterManipulationModePage() | ScrollPresenterManipulationModePage | [inline]
~ScrollPresenterManipulationModePage() | ScrollPresenterManipulationModePage | [inline, private]
Generated on Sun Dec 1 2024 20:54:30 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/TestUI/BreadcrumbBarAxeTestPage.xaml.cs Source File

  • Breadcrumb
  • TestUI

BreadcrumbBarAxeTestPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003 using System.Collections.ObjectModel;
00004
00005 namespace MUXControlsTestApp
00006 {
00007     [AxeScanTestPage(Name = "BreadcrumbBar-Axe")]
00008     public sealed partial class BreadcrumbBarAxeTestPage : TestPage
00009     {
00010         public ObservableCollection<object> breadCrumbList { get; } = new ObservableCollection<object>();
00011
00012         public BreadcrumbBarAxeTestPage()
00013         {
00014             for(int i = 0; i < 10; i++)
00015             {
00016                 breadCrumbList.Add("Item " + i);
00017             }
00018             this.InitializeComponent();
00019         }
00020     }
00021 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TestCommand Member List

This is the complete list of members for TestCommand, including all inherited members.
CanExecute(object o) | TestCommand | [inline]
CanExecuteChanged | TestCommand |
Execute(object o) | TestCommand | [inline]
TestCommand() | TestCommand | [inline]
Generated on Sun Dec 1 2024 20:53:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ComboBox/TestUI/ComboBoxPage.xaml.cs Source File

  • ComboBox
  • TestUI

ComboBoxPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     [TopLevelTestPage(Name = "ComboBox", Icon = "ComboBox.png")]
00007     public sealed partial class ComboBoxPage : TestPage
00008     {
00009         public ComboBoxPage()
00010         {
00011             this.InitializeComponent();
00012         }
00013     }
00014 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshVisualizer/RefreshInteractionRatioChangedEventArgs.h Source File

  • PullToRefresh
  • RefreshVisualizer

RefreshInteractionRatioChangedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "RefreshInteractionRatioChangedEventArgs.g.h"
00007
00008 class RefreshInteractionRatioChangedEventArgs :
00009     public winrt::implementation::RefreshInteractionRatioChangedEventArgsT<RefreshInteractionRatioChangedEventArgs>
00010 {
00011 public:
00012     RefreshInteractionRatioChangedEventArgs(double value);
00013
00014     double InteractionRatio();
00015
00016 private:
00017     double m_interactionRatio{ 0.0 };
00018 };
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/NavigationViewItemHeader.properties.cpp Source File

  • Generated

NavigationViewItemHeader.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "NavigationViewItemHeader.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(NavigationViewItemHeader)
00012 }
00013
00014 #include "NavigationViewItemHeader.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewItem Member List

This is the complete list of members for TreeViewItem, including all inherited members.
abi_enter() | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
AncestorTreeView() | TreeViewItem | [private]
c_expandCollapseChevronName | TreeViewItem | [private, static]
c_multiSelectCheckBoxName | TreeViewItem | [private, static]
CheckBoxSelectionState(winrt::CheckBox const &checkBox) | TreeViewItem | [private]
CheckThread() | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
ClearProperties() | TreeViewItemProperties | [static]
CollapsedGlyph(winrt::hstring const &value) | TreeViewItemProperties |
CollapsedGlyph() | TreeViewItemProperties |
CollapsedGlyphProperty() | TreeViewItemProperties | [inline, static]
DeleteInstanceOnUIThread(std::unique_ptr< TreeViewItem > &&self) noexcept | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline, static]
EnsureProperties() | TreeViewItemProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
ExpandedGlyph(winrt::hstring const &value) | TreeViewItemProperties |
ExpandedGlyph() | TreeViewItemProperties |
ExpandedGlyphProperty() | TreeViewItemProperties | [inline, static]
final_release(std::unique_ptr< TreeViewItem > &&self) | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline, static]
GetAncestorView() | TreeViewItem | [private]
GetBase() | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
GetInner() | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
GlyphBrush(winrt::Brush const &value) | TreeViewItemProperties |
GlyphBrush() | TreeViewItemProperties |
GlyphBrushProperty() | TreeViewItemProperties | [inline, static]
GlyphOpacity(double value) | TreeViewItemProperties |
GlyphOpacity() | TreeViewItemProperties |
GlyphOpacityProperty() | TreeViewItemProperties | [inline, static]
GlyphSize(double value) | TreeViewItemProperties |
GlyphSize() | TreeViewItemProperties |
GlyphSizeProperty() | TreeViewItemProperties | [inline, static]
HandleExpandCollapse(winrt::VirtualKey key) | TreeViewItem | [private]
HandleGamepadAInMultiselectMode(const winrt::TreeViewNode &node) | TreeViewItem | [private]
HandleReorder(winrt::VirtualKey key) | TreeViewItem | [private]
HasUnrealizedChildren(bool value) | TreeViewItemProperties |
HasUnrealizedChildren() | TreeViewItemProperties |
HasUnrealizedChildrenProperty() | TreeViewItemProperties | [inline, static]
IsDirectionalKey(winrt::VirtualKey key) | TreeViewItem | [private, static]
IsExpandCollapse(winrt::VirtualKey key) | TreeViewItem | [private]
IsExpanded(bool value) | TreeViewItemProperties |
IsExpanded() | TreeViewItemProperties |
IsExpandedProperty() | TreeViewItemProperties | [inline, static]
IsInContentMode() | TreeViewItem | [private]
IsInReorderMode(winrt::VirtualKey keys) | TreeViewItem | [private]
IsOnThread() | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
IsSelectedInternal() | TreeViewItem |
ItemsSource(winrt::IInspectable const &value) | TreeViewItemProperties |
ItemsSource() | TreeViewItemProperties |
ItemsSourceProperty() | TreeViewItemProperties | [inline, static]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
OnApplyTemplate() | TreeViewItem |
OnCheckToggle(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | TreeViewItem | [private]
OnCreateAutomationPeer() | TreeViewItem |
OnDragEnter(winrt::DragEventArgs const &e) | TreeViewItem |
OnDragLeave(winrt::DragEventArgs const &e) | TreeViewItem |
OnDragOver(winrt::DragEventArgs const &e) | TreeViewItem |
OnDrop(winrt::DragEventArgs const &e) | TreeViewItem |
OnExpandCollapseChevronPointerPressed(const winrt::IInspectable &, const winrt::PointerRoutedEventArgs &args) | TreeViewItem | [private]
OnExpandContentTimerTick(const winrt::IInspectable &sender, const winrt::IInspectable &e) | TreeViewItem | [private]
OnHasUnrealizedChildrenPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewItemProperties | [static]
OnIsExpandedPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewItemProperties | [static]
OnIsSelectedChanged(const winrt::DependencyObject &, const winrt::DependencyProperty &) | TreeViewItem | [private]
OnItemsSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewItemProperties | [static]
OnKeyDown(winrt::KeyRoutedEventArgs const &e) | TreeViewItem |
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | TreeViewItem |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
RaiseExpandCollapseAutomationEvent(bool isExpanded) | TreeViewItem | [private]
RaiseSelectionChangeEvents(bool isSelected) | TreeViewItem | [private]
RecycleEvents(bool useSafeGet=false) | TreeViewItem | [private]
ReferenceTracker(Args &&...args) | ReferenceTracker< TreeViewItem, winrt::implementation::TreeViewItemT > | [inline]
ReorderItems(const winrt::ListView &listControl, const winrt::TreeViewNode &targetNode, int position, int childIndex, bool isForwards) | TreeViewItem | [private]
s_CollapsedGlyphProperty | TreeViewItemProperties | [static]
s_ExpandedGlyphProperty | TreeViewItemProperties | [static]
s_GlyphBrushProperty | TreeViewItemProperties | [static]
s_GlyphOpacityProperty | TreeViewItemProperties | [static]
s_GlyphSizeProperty | TreeViewItemProperties | [static]
s_HasUnrealizedChildrenProperty | TreeViewItemProperties | [static]
s_IsExpandedProperty | TreeViewItemProperties | [static]
s_ItemsSourceProperty | TreeViewItemProperties | [static]
s_TreeViewItemTemplateSettingsProperty | TreeViewItemProperties | [static]
SetItemsSource(winrt::TreeViewNode const &node, winrt::IInspectable const &value) | TreeViewItem |
ToggleSelection() | TreeViewItem | [private]
TreeNode() | TreeViewItem | [private]
TreeViewItem() | TreeViewItem |
TreeViewItemProperties() | TreeViewItemProperties |
TreeViewItemTemplateSettings(winrt::TreeViewItemTemplateSettings const &value) | TreeViewItemProperties |
TreeViewItemTemplateSettings() | TreeViewItemProperties |
TreeViewItemTemplateSettingsProperty() | TreeViewItemProperties | [inline, static]
UpdateIndentation(int depth) | TreeViewItem |
UpdateMultipleSelection(TreeNodeSelectionState const &state) | TreeViewItem |
UpdateNodeIsExpandedAsync(winrt::TreeViewNode const &node, bool isExpanded) | TreeViewItem | [private]
UpdateSelection(bool isSelected) | TreeViewItem |
UpdateSelectionVisual(TreeNodeSelectionState const &state) | TreeViewItem |
UpdateTreeViewItemVisualState(TreeNodeSelectionState const &state) | TreeViewItem | [private]
~TreeViewItem() | TreeViewItem |
Generated on Sun Dec 1 2024 20:53:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

FixedSizeItem Member List

This is the complete list of members for FixedSizeItem, including all inherited members.
FixedSizeItem() | FixedSizeItem | [inline]
Size | FixedSizeItem |
Text | FixedSizeItem |
Generated on Sun Dec 1 2024 20:54:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/MapElement.properties.cpp Source File

  • Generated

MapElement.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "MapElement.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(MapElement)
00012 }
00013
00014 #include "MapElement.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NumberBox/NumberBox.idl Source File

  • NumberBox

NumberBox.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 enum NumberBoxSpinButtonPlacementMode
00007 {
00008     Hidden,
00009     Compact,
00010     Inline
00011 };
00012
00013 [MUX_PUBLIC]
00014 [webhosthidden]
00015 enum NumberBoxValidationMode
00016 {
00017     InvalidInputOverwritten,
00018     Disabled
00019 };
00020
00021 [MUX_PUBLIC]
00022 [webhosthidden]
00023 runtimeclass NumberBoxValueChangedEventArgs
00024 {
00025     Double OldValue{ get; };
00026     Double NewValue{ get; };
00027 };
00028
00029 [MUX_PUBLIC]
00030 [webhosthidden]
00031 unsealed runtimeclass NumberBox : Microsoft.UI.Xaml.Controls.Control
00032 {
00033     NumberBox();
00034
00035     [MUX_DEFAULT_VALUE("-std::numeric_limits<double>::max()")]
00036     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00037     Double Minimum;
00038
00039     [MUX_DEFAULT_VALUE("std::numeric_limits<double>::max()")]
00040     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00041     Double Maximum;
00042
00043     [MUX_DEFAULT_VALUE("std::numeric_limits<double>::quiet_NaN()")]
00044     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00045     Double Value;
00046
00047     [MUX_DEFAULT_VALUE("1")]
00048     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00049     Double SmallChange;
00050
00051     [MUX_DEFAULT_VALUE("10")]
00052     Double LargeChange;
00053
00054     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00055     String Text;
00056
00057     // TextBox properties
00058     Object Header;
00059     Microsoft.UI.Xaml.DataTemplate HeaderTemplate;
00060
00061     [MUX_PREVIEW]
00062     {
00063         Microsoft.UI.Xaml.Input.InputScope InputScope;
00064     }
00065
00066     String PlaceholderText;
00067     Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase SelectionFlyout;
00068     Microsoft.UI.Xaml.Media.SolidColorBrush SelectionHighlightColor;
00069
00070     [MUX_PREVIEW]
00071     {
00072         [MUX_DEFAULT_VALUE("winrt::TextAlignment::Left")]
00073         Microsoft.UI.Xaml.TextAlignment TextAlignment;
00074     }
00075
00076     Microsoft.UI.Xaml.TextReadingOrder TextReadingOrder;
00077     Boolean PreventKeyboardDisplayOnProgrammaticFocus;
00078     Object Description;
00079
00080     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00081     NumberBoxValidationMode ValidationMode;
00082
00083     [MUX_DEFAULT_VALUE("winrt::NumberBoxSpinButtonPlacementMode::Hidden")]
00084     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00085     NumberBoxSpinButtonPlacementMode SpinButtonPlacementMode{ get; set; };
00086
00087     [MUX_DEFAULT_VALUE("false")]
00088     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00089     Boolean IsWrapEnabled;
00090
00091     [MUX_DEFAULT_VALUE("false")]
00092     Boolean AcceptsExpression;
00093
00094     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00095     [MUX_PROPERTY_VALIDATION_CALLBACK("ValidateNumberFormatter")]
00096     Windows.Globalization.NumberFormatting.INumberFormatter2 NumberFormatter;
00097
00098     event Windows.Foundation.TypedEventHandler<NumberBox, NumberBoxValueChangedEventArgs> ValueChanged;
00099
00100     static Microsoft.UI.Xaml.DependencyProperty MinimumProperty{ get; };
00101     static Microsoft.UI.Xaml.DependencyProperty MaximumProperty{ get; };
00102     static Microsoft.UI.Xaml.DependencyProperty ValueProperty{ get; };
00103     static Microsoft.UI.Xaml.DependencyProperty SmallChangeProperty{ get; };
00104     static Microsoft.UI.Xaml.DependencyProperty LargeChangeProperty{ get; };
00105     static Microsoft.UI.Xaml.DependencyProperty TextProperty{ get; };
00106
00107     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00108     static Microsoft.UI.Xaml.DependencyProperty HeaderProperty{ get; };
00109     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00110     static Microsoft.UI.Xaml.DependencyProperty HeaderTemplateProperty{ get; };
00111
00112     [MUX_PREVIEW]
00113     {
00114         static Microsoft.UI.Xaml.DependencyProperty InputScopeProperty{ get; };
00115     }
00116
00117     static Microsoft.UI.Xaml.DependencyProperty PlaceholderTextProperty{ get; };
00118     static Microsoft.UI.Xaml.DependencyProperty SelectionFlyoutProperty{ get; };
00119     static Microsoft.UI.Xaml.DependencyProperty SelectionHighlightColorProperty{ get; };
00120
00121     [MUX_PREVIEW]
00122     {
00123         static Microsoft.UI.Xaml.DependencyProperty TextAlignmentProperty{ get; };
00124     }
00125
00126     static Microsoft.UI.Xaml.DependencyProperty TextReadingOrderProperty{ get; };
00127     static Microsoft.UI.Xaml.DependencyProperty PreventKeyboardDisplayOnProgrammaticFocusProperty{ get; };
00128     static Microsoft.UI.Xaml.DependencyProperty DescriptionProperty{ get; };
00129
00130     static Microsoft.UI.Xaml.DependencyProperty ValidationModeProperty{ get; };
00131     static Microsoft.UI.Xaml.DependencyProperty SpinButtonPlacementModeProperty{ get; };
00132     static Microsoft.UI.Xaml.DependencyProperty IsWrapEnabledProperty{ get; };
00133     static Microsoft.UI.Xaml.DependencyProperty AcceptsExpressionProperty{ get; };
00134
00135     static Microsoft.UI.Xaml.DependencyProperty NumberFormatterProperty{ get; };
00136 }
00137
00138 }
00139
00140 namespace MU_XAP_NAMESPACE
00141 {
00142
00143 [MUX_PUBLIC]
00144 [webhosthidden]
00145 unsealed runtimeclass NumberBoxAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer
00146 {
00147     NumberBoxAutomationPeer(MU_XC_NAMESPACE.NumberBox owner);
00148 }
00149
00150 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RadioMenuFlyoutItemTests Member List

This is the complete list of members for RadioMenuFlyoutItemTests, including all inherited members.
BasicTest() | RadioMenuFlyoutItemTests | [inline]
ClassInitialize(TestContext testContext) | RadioMenuFlyoutItemTests | [inline, static]
InvokeItem(string flyoutButtonName, string itemName) | RadioMenuFlyoutItemTests | [inline]
InvokeSubItem(string flyoutButtonName, string menuName, string itemName) | RadioMenuFlyoutItemTests | [inline]
Items | RadioMenuFlyoutItemTests | [private]
SubMenuTest() | RadioMenuFlyoutItemTests | [inline]
TestCleanup() | RadioMenuFlyoutItemTests | [inline]
VerifySelectedItems(string item1, string item2, string item3) | RadioMenuFlyoutItemTests | [inline]
Generated on Sun Dec 1 2024 20:53:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RadioButtonsElementFactory Member List

This is the complete list of members for RadioButtonsElementFactory, including all inherited members.
GetElementCore(const winrt::ElementFactoryGetArgs &args) override | RadioButtonsElementFactory
RadioButtonsElementFactory() | RadioButtonsElementFactory
RecycleElementCore(const winrt::ElementFactoryRecycleArgs &args) override | RadioButtonsElementFactory
UserElementFactory(const winrt::IInspectable &newValue) | RadioButtonsElementFactory
Generated on Sun Dec 1 2024 20:53:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectionModel Member List

This is the complete list of members for SelectionModel, including all inherited members.
abi_enter() | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
AnchorIndex() | SelectionModel |
AnchorIndex(winrt::IndexPath const &value) | SelectionModel |
CheckThread() | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
ChildrenRequested(winrt::TypedEventHandler< winrt::SelectionModel, winrt::SelectionModelChildrenRequestedEventArgs > const &value) | SelectionModelProperties |
ChildrenRequested(winrt::event_token const &token) | SelectionModelProperties |
ClearProperties() | SelectionModelProperties | [static]
ClearSelection() | SelectionModel |
ClearSelection(bool resetAnchor, bool raiseSelectionChanged) | SelectionModel | [private]
DeleteInstanceOnUIThread(std::unique_ptr< SelectionModel > &&self) noexcept | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline, static]
Deselect(int index) | SelectionModel |
Deselect(int groupIndex, int itemIndex) | SelectionModel |
DeselectAt(winrt::IndexPath const &index) | SelectionModel |
DeselectRange(winrt::IndexPath const &start, winrt::IndexPath const &end) | SelectionModel |
DeselectRangeFromAnchor(int32_t index) | SelectionModel |
DeselectRangeFromAnchor(int groupIndex, int itemIndex) | SelectionModel |
DeselectRangeFromAnchorTo(winrt::IndexPath const &index) | SelectionModel |
EnsureProperties() | SelectionModelProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
final_release(std::unique_ptr< SelectionModel > &&self) | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline, static]
GetBase() | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
GetCustomProperty(hstring const &name) | SelectionModel |
GetIndexedProperty(hstring const &name, winrt::TypeName const &type) | SelectionModel |
GetInner() | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
GetStringRepresentation() | SelectionModel |
IsOnThread() | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
IsSelected(int index) | SelectionModel |
IsSelected(int groupIndex, int itemIndex) | SelectionModel |
IsSelectedAt(winrt::IndexPath const &index) | SelectionModel |
m_childrenRequestedEventSource | SelectionModelProperties |
m_leafNode | SelectionModel | [private]
m_propertyChangedEventSource | SelectionModelProperties |
m_selectionChangedEventSource | SelectionModelProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
OnPropertyChanged(winrt::hstring const &propertyName) | SelectionModel |
OnSelectionChanged() | SelectionModel | [private]
OnSelectionInvalidatedDueToCollectionChange() | SelectionModel |
PropertyChanged(winrt::PropertyChangedEventHandler const &value) | SelectionModel |
PropertyChanged(winrt::event_token const &token) | SelectionModel |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
RaisePropertyChanged(std::wstring_view const &name) | SelectionModel | [private]
ReferenceTracker(Args &&...args) | ReferenceTracker< SelectionModel, winrt::implementation::SelectionModelT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::composing > | [inline]
ResolvePath(const winrt::IInspectable &data, const winrt::IndexPath &dataIndexPath) | SelectionModel |
Select(int index) | SelectionModel |
Select(int groupIndex, int itemIndex) | SelectionModel |
SelectAll() | SelectionModel |
SelectAllFlat() | SelectionModel |
SelectAt(winrt::IndexPath const &index) | SelectionModel |
SelectedIndex() | SelectionModel |
SelectedIndex(winrt::IndexPath const &value) | SelectionModel |
SelectedIndices() | SelectionModel |
SelectedItem() | SelectionModel |
SelectedItems() | SelectionModel |
SelectImpl(int index, bool select) | SelectionModel | [private]
SelectionChanged(winrt::TypedEventHandler< winrt::SelectionModel, winrt::SelectionModelSelectionChangedEventArgs > const &value) | SelectionModelProperties |
SelectionChanged(winrt::event_token const &token) | SelectionModelProperties |
SelectionInvalidatedDueToCollectionChange() const | SelectionModel | [inline]
SelectionModel() | SelectionModel |
SelectionModelProperties() | SelectionModelProperties |
SelectRange(winrt::IndexPath const &start, winrt::IndexPath const &end) | SelectionModel |
SelectRangeFromAnchor(int32_t index) | SelectionModel |
SelectRangeFromAnchor(int groupIndex, int itemIndex) | SelectionModel |
SelectRangeFromAnchorImpl(int index, bool select) | SelectionModel | [private]
SelectRangeFromAnchorTo(winrt::IndexPath const &index) | SelectionModel |
SelectRangeFromAnchorWithGroupImpl(int groupIndex, int itemIndex, bool select) | SelectionModel | [private]
SelectRangeImpl(const winrt::IndexPath &start, const winrt::IndexPath &end, bool select) | SelectionModel | [private]
SelectWithGroupImpl(int groupIndex, int itemIndex, bool select) | SelectionModel | [private]
SelectWithPathImpl(const winrt::IndexPath &index, bool select, bool raiseSelectionChanged) | SelectionModel | [private]
SetAnchorIndex(int32_t index) | SelectionModel |
SetAnchorIndex(int groupIndex, int itemIndex) | SelectionModel |
SharedLeafNode() | SelectionModel | [inline]
SingleSelect() | SelectionModel |
SingleSelect(bool value) | SelectionModel |
Source() | SelectionModel |
Source(winrt::IInspectable const &value) | SelectionModel |
Type() | SelectionModel |
~SelectionModel() | SelectionModel |
Generated on Sun Dec 1 2024 20:53:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/SelectionSample/TreeView/TreeViewItemAutomationPeer.cs Source File

  • Repeater
  • TestUI
  • Samples
  • SelectionSample
  • TreeView

TreeViewItemAutomationPeer.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Automation.Peers;
00006 using Microsoft.UI.Xaml.Automation.Provider;
00007
00008 namespace MUXControlsTestApp.Samples.Selection
00009 {
00010     public class TreeViewItemAutomationPeer : FrameworkElementAutomationPeer, ISelectionItemProvider
00011     {
00012         private TreeViewItem _owner;
00013         public TreeViewItemAutomationPeer(FrameworkElement owner) : base(owner)
00014         {
00015             _owner = (TreeViewItem)owner;
00016         }
00017
00018         protected override object GetPatternCore(PatternInterface patternInterface)
00019         {
00020             if (patternInterface == PatternInterface.SelectionItem)
00021             {
00022                 return this;
00023             }
00024
00025             return base.GetPatternCore(patternInterface);
00026         }
00027
00028         public void AddToSelection()
00029         {
00030             _owner.Select(true);
00031         }
00032
00033         public void RemoveFromSelection()
00034         {
00035             _owner.Select(false);
00036         }
00037
00038         public void Select()
00039         {
00040             _owner.Select(true);
00041         }
00042
00043         public bool IsSelected
00044         {
00045             get
00046             {
00047                 return _owner.IsSelected.HasValue && _owner.IsSelected.Value;
00048             }
00049         }
00050
00051         public IRawElementProviderSimple SelectionContainer
00052         {
00053             get
00054             {
00055                 // TODO: could cache this to avoid the walk every time
00056                 IRawElementProviderSimple containerPeer = null;
00057                 FrameworkElement element = _owner;
00058                 while (element != null && !(element is SelectionContainer))
00059                 {
00060                     element = (FrameworkElement)element.Parent;
00061                 }
00062
00063                 if (element != null)
00064                 {
00065                     var container = (SelectionContainer)element;
00066                     containerPeer = ProviderFromPeer(CreatePeerForElement(container));
00067                 }
00068
00069                 return containerPeer;
00070             }
00071         }
00072
00073         protected override AutomationControlType GetAutomationControlTypeCore()
00074         {
00075             return AutomationControlType.ListItem;
00076         }
00077
00078         protected override string GetLocalizedControlTypeCore()
00079         {
00080             return "Item";
00081         }
00082     }
00083 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsControlPage Member List

This is the complete list of members for ItemsControlPage, including all inherited members.
ItemsControlPage() ItemsControlPage [inline]
Generated on Sun Dec 1 2024 20:54:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarFlyoutItem.h Source File

  • InkToolBar

InkToolBarFlyoutItem.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarFlyoutItem.g.h"
00011 #include "InkToolBarFlyoutItem.properties.h"
00012
00013 class InkToolBarFlyoutItem :
00014     public ReferenceTracker<InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT>,
00015     public InkToolBarFlyoutItemProperties
00016 {
00017 public:
00018
00019     winrt::InkToolBarFlyoutItemKind Kind() { winrt::throw_hresult(E_NOTIMPL); }
00020     void Kind(winrt::InkToolBarFlyoutItemKind value) { winrt::throw_hresult(E_NOTIMPL); }
00021     bool IsChecked() { winrt::throw_hresult(E_NOTIMPL); }
00022     void IsChecked(bool value) { winrt::throw_hresult(E_NOTIMPL); }
00023 };
00024
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollBarPage Member List

This is the complete list of members for ScrollBarPage, including all inherited members.
ScrollBarPage() ScrollBarPage [inline]
Generated on Sun Dec 1 2024 20:54:26 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectorBarSamplePage Member List

This is the complete list of members for SelectorBarSamplePage, including all inherited members.
_colFavoritePhotos | SelectorBarSamplePage | [private]
_colRemotePhotos | SelectorBarSamplePage | [private]
_colSharedPhotos | SelectorBarSamplePage | [private]
SelectorBar_SelectionChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs args) | SelectorBarSamplePage | [inline, private]
SelectorBarSamplePage() | SelectorBarSamplePage | [inline]
~SelectorBarSamplePage() | SelectorBarSamplePage | [inline, private]
Generated on Sun Dec 1 2024 20:54:36 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewItemSeparator Member List

This is the complete list of members for NavigationViewItemSeparator, including all inherited members.
ForwardRefToBaseReferenceTracker(NavigationViewItemBase) NavigationViewItemSeparator() | NavigationViewItemSeparator |
OnApplyTemplate() override | NavigationViewItemSeparator |
OnNavigationViewItemBaseDepthChanged() override | NavigationViewItemSeparator | [private]
OnNavigationViewItemBasePositionChanged() override | NavigationViewItemSeparator | [private]
OnSplitViewPropertyChanged(const winrt::DependencyObject &, const winrt::DependencyProperty &) | NavigationViewItemSeparator | [private]
UpdateIsClosedCompact(bool updateVisualState) | NavigationViewItemSeparator | [private]
UpdateItemIndentation() | NavigationViewItemSeparator | [private]
UpdateVisualState(bool useTransitions) | NavigationViewItemSeparator | [private]
Generated on Sun Dec 1 2024 20:52:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommonStylesVisualTreeTestSamples::CustomizedFilter Member List

This is the complete list of members for CommonStylesVisualTreeTestSamples::CustomizedFilter, including all inherited members.
_knownPropertyValueDict | CommonStylesVisualTreeTestSamples::CustomizedFilter | [private, static]
_propertyNameBlockList | CommonStylesVisualTreeTestSamples::CustomizedFilter | [private, static]
_propertyNamePostfixBlockList | CommonStylesVisualTreeTestSamples::CustomizedFilter | [private, static]
ShouldVisitElement(string elementName) | CommonStylesVisualTreeTestSamples::CustomizedFilter | [inline]
ShouldVisitProperty(string propertyName) | CommonStylesVisualTreeTestSamples::CustomizedFilter | [inline]
ShouldVisitPropertyValuePair(string propertyName, string value) | CommonStylesVisualTreeTestSamples::CustomizedFilter | [inline]
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PipsPager/PipsPager.cpp Source File

  • PipsPager

PipsPager.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "Vector.h"
00007 #include "PipsPager.h"
00008 #include "RuntimeProfiler.h"
00009 #include "ResourceAccessor.h"
00010 #include "PipsPagerTemplateSettings.h"
00011 #include "PipsPagerSelectedIndexChangedEventArgs.h"
00012 #include "PipsPagerAutomationPeer.h"
00013 #include "StackLayout.h"
00014
00015 typedef winrt::PipsPagerButtonVisibility ButtonVisibility;
00016
00017 static constexpr wstring_view s_pipButtonHandlersPropertyName = L"PipButtonHandlers"sv;
00018
00019 constexpr auto c_previousPageButtonVisibleVisualState = L"PreviousPageButtonVisible"sv;
00020 constexpr auto c_previousPageButtonHiddenVisualState = L"PreviousPageButtonHidden"sv;
00021 constexpr auto c_previousPageButtonCollapsedVisualState = L"PreviousPageButtonCollapsed"sv;
00022
00023 constexpr auto c_previousPageButtonEnabledVisualState = L"PreviousPageButtonEnabled"sv;
00024 constexpr auto c_previousPageButtonDisabledVisualState = L"PreviousPageButtonDisabled"sv;
00025
00026 constexpr auto c_nextPageButtonVisibleVisualState = L"NextPageButtonVisible"sv;
00027 constexpr auto c_nextPageButtonHiddenVisualState = L"NextPageButtonHidden"sv;
00028 constexpr auto c_nextPageButtonCollapsedVisualState = L"NextPageButtonCollapsed"sv;
00029
00030 constexpr auto c_nextPageButtonEnabledVisualState = L"NextPageButtonEnabled"sv;
00031 constexpr auto c_nextPageButtonDisabledVisualState = L"NextPageButtonDisabled"sv;
00032
00033 constexpr auto c_previousPageButtonName = L"PreviousPageButton"sv;
00034 constexpr auto c_nextPageButtonName = L"NextPageButton"sv;
00035
00036 constexpr auto c_pipsPagerRepeaterName = L"PipsPagerItemsRepeater"sv;
00037 constexpr auto c_pipsPagerScrollViewerName = L"PipsPagerScrollViewer"sv;
00038
00039 constexpr auto c_pipsPagerVerticalOrientationButtonWidthPropertyName = L"PipsPagerVerticalOrientationButtonWidth"sv;
00040 constexpr auto c_pipsPagerVerticalOrientationButtonHeightPropertyName = L"PipsPagerVerticalOrientationButtonHeight"sv;
00041
00042 constexpr auto c_pipsPagerHorizontalOrientationButtonWidthPropertyName = L"PipsPagerHorizontalOrientationButtonWidth"sv;
00043 constexpr auto c_pipsPagerHorizontalOrientationButtonHeightPropertyName = L"PipsPagerHorizontalOrientationButtonHeight"sv;
00044
00045 constexpr auto c_pipsPagerHorizontalOrientationVisualState = L"HorizontalOrientationView"sv;
00046 constexpr auto c_pipsPagerVerticalOrientationVisualState = L"VerticalOrientationView"sv;
00047
00048 constexpr auto c_pipsPagerButtonVerticalOrientationVisualState = L"VerticalOrientation"sv;
00049 constexpr auto c_pipsPagerButtonHorizontalOrientationVisualState = L"HorizontalOrientation"sv;
00050
00051
00052 PipsPager::PipsPager()
00053 {
00054     __RP_Marker_ClassById(RuntimeProfiler::ProfId_PipsPager);
00055     m_pipsPagerItems = winrt::single_threaded_observable_vector<int>();
00056     const auto templateSettings = winrt::make<PipsPagerTemplateSettings>();
00057     templateSettings.SetValue(PipsPagerTemplateSettings::s_PipsPagerItemsProperty, m_pipsPagerItems);
00058     SetValue(s_TemplateSettingsProperty, templateSettings);
00059
00060     s_pipButtonHandlersProperty =
00061         InitializeDependencyProperty(
00062             s_pipButtonHandlersPropertyName,
00063             winrt::name_of<PipsPagerViewItemRevokers>(),
00064             winrt::name_of<winrt::PipsPager>(),
00065             true,
00066             nullptr,
00067             nullptr);
00068     SetDefaultStyleKey(this);
00069 }
00070
00071 void PipsPager::OnApplyTemplate()
00072 {
00073     winrt::AutomationProperties::SetName(*this, ResourceAccessor::GetLocalizedStringResource(SR_PipsPagerNameText));
00074
00075     m_previousPageButtonClickRevoker.revoke();
00076     [this](const winrt::Button button)
00077     {
00078         m_previousPageButton.set(button);
00079         if (button)
00080         {
00081             winrt::AutomationProperties::SetName(button, ResourceAccessor::GetLocalizedStringResource(SR_PipsPagerPreviousPageButtonText));
00082             m_previousPageButtonClickRevoker = button.Click(winrt::auto_revoke, { this, &PipsPager::OnPreviousButtonClicked });
00083         }
00084     }(GetTemplateChildT<winrt::Button>(c_previousPageButtonName, *this));
00085
00086     m_nextPageButtonClickRevoker.revoke();
00087     [this](const winrt::Button button)
00088     {
00089         m_nextPageButton.set(button);
00090         if (button)
00091         {
00092             winrt::AutomationProperties::SetName(button, ResourceAccessor::GetLocalizedStringResource(SR_PipsPagerNextPageButtonText));
00093             m_nextPageButtonClickRevoker = button.Click(winrt::auto_revoke, { this, &PipsPager::OnNextButtonClicked });
00094         }
00095     }(GetTemplateChildT<winrt::Button>(c_nextPageButtonName, *this));
00096
00097     m_pipsPagerElementPreparedRevoker.revoke();
00098     m_pipsAreaGettingFocusRevoker.revoke();
00099     m_pipsAreaBringIntoViewRequestedRevoker.revoke();
00100     m_itemsRepeaterStackLayoutChangedRevoker.revoke();
00101     RestoreLayoutVirtualization();
00102     [this](const winrt::ItemsRepeater repeater)
00103     {
00104         m_pipsPagerRepeater.set(repeater);
00105         if (repeater)
00106         {
00107             m_pipsPagerElementPreparedRevoker = repeater.ElementPrepared(winrt::auto_revoke, { this, &PipsPager::OnElementPrepared });
00108             m_pipsAreaGettingFocusRevoker = repeater.GettingFocus(winrt::auto_revoke, { this, &PipsPager::OnPipsAreaGettingFocus });
00109             m_pipsAreaBringIntoViewRequestedRevoker = repeater.BringIntoViewRequested(winrt::auto_revoke, { this, &PipsPager::OnPipsAreaBringIntoViewRequested });
00110
00111             m_itemsRepeaterStackLayoutChangedRevoker = RegisterPropertyChanged(repeater,
00112             winrt::ItemsRepeater::LayoutProperty(),
00113             { this, &PipsPager::OnItemsRepeaterLayoutChanged });
00114
00115             UpdateLayoutVirtualization();
00116         }
00117     }(GetTemplateChildT<winrt::ItemsRepeater>(c_pipsPagerRepeaterName, *this));
00118
00119     m_scrollViewerBringIntoViewRequestedRevoker.revoke();
00120     [this](const winrt::FxScrollViewer scrollViewer)
00121     {
00122         m_pipsPagerScrollViewer.set(scrollViewer);
00123         if (scrollViewer)
00124         {
00125             m_scrollViewerBringIntoViewRequestedRevoker = scrollViewer.BringIntoViewRequested(winrt::auto_revoke, { this, &PipsPager::OnScrollViewerBringIntoViewRequested });
00126         }
00127     }(GetTemplateChildT<winrt::FxScrollViewer>(c_pipsPagerScrollViewerName, *this));
00128
00129     m_defaultPipSize = GetDesiredPipSize(NormalPipStyle());
00130     m_selectedPipSize = GetDesiredPipSize(SelectedPipStyle());
00131     OnNavigationButtonVisibilityChanged(PreviousButtonVisibility(), c_previousPageButtonCollapsedVisualState, c_previousPageButtonDisabledVisualState);
00132     OnNavigationButtonVisibilityChanged(NextButtonVisibility(), c_nextPageButtonCollapsedVisualState, c_nextPageButtonDisabledVisualState);
00133     UpdatePipsItems(NumberOfPages(), MaxVisiblePips());
00134     OnOrientationChanged();
00135     OnSelectedPageIndexChanged(m_lastSelectedPageIndex);
00136 }
00137
00138 void PipsPager::RaiseSelectedIndexChanged()
00139 {
00140     const auto args = winrt::make_self<PipsPagerSelectedIndexChangedEventArgs>();
00141     m_selectedIndexChangedEventSource(*this, *args);
00142 }
00143
00144 winrt::Size PipsPager::GetDesiredPipSize(const winrt::Style& style) {
00145     if (auto const repeater = m_pipsPagerRepeater.get())
00146     {
00147         if (auto const itemTemplate = repeater.ItemTemplate().try_as<winrt::DataTemplate>())
00148         {
00149             if (auto const element = itemTemplate.LoadContent().try_as<winrt::FrameworkElement>())
00150             {
00151                 ApplyStyleToPipAndUpdateOrientation(element, style);
00152                 element.Measure({ std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity() });
00153                 return element.DesiredSize();
00154             }
00155         }
00156     }
00157
00158     return { 0.0, 0.0 };
00159 }
00160
00161 void PipsPager::OnKeyDown(const winrt::KeyRoutedEventArgs& args) {
00162     winrt::FocusNavigationDirection previousPipDirection;
00163     winrt::FocusNavigationDirection nextPipDirection;
00164     if (Orientation() == winrt::Orientation::Vertical)
00165     {
00166         previousPipDirection = winrt::FocusNavigationDirection::Up;
00167         nextPipDirection = winrt::FocusNavigationDirection::Down;
00168     }
00169     else
00170     {
00171         previousPipDirection = winrt::FocusNavigationDirection::Left;
00172         nextPipDirection = winrt::FocusNavigationDirection::Right;
00173     }
00174
00175     if (args.Key() == winrt::VirtualKey::Left || args.Key() == winrt::VirtualKey::Up)
00176     {
00177         auto options = winrt::FindNextElementOptions();
00178         options.SearchRoot(this->XamlRoot().Content());
00179         winrt::FocusManager::TryMoveFocus(previousPipDirection, options);
00180         args.Handled(true);
00181     }
00182     else if (args.Key() == winrt::VirtualKey::Right || args.Key() == winrt::VirtualKey::Down)
00183     {
00184         auto options = winrt::FindNextElementOptions();
00185         options.SearchRoot(this->XamlRoot().Content());
00186         winrt::FocusManager::TryMoveFocus(nextPipDirection, options);
00187         args.Handled(true);
00188     }
00189     // Call for all other presses
00190     __super::OnKeyDown(args);
00191 }
00192
00193 void PipsPager::UpdateIndividualNavigationButtonVisualState(
00194     const bool hiddenOnEdgeCondition,
00195     const ButtonVisibility visibility,
00196     const wstring_view& visibleStateName,
00197     const wstring_view& hiddenStateName,
00198     const wstring_view& enabledStateName,
00199     const wstring_view& disabledStateName) {
00200
00201     const auto isGenerallyVisible = (!hiddenOnEdgeCondition || (IsWrapEnabled() && NumberOfPages() > 1)) &&
00202                                      NumberOfPages() != 0 && MaxVisiblePips() > 0;
00203     if (visibility != ButtonVisibility::Collapsed)
00204     {
00205         if ((visibility == ButtonVisibility::Visible || m_isPointerOver || m_isFocused) && isGenerallyVisible)
00206         {
00207             winrt::VisualStateManager::GoToState(*this, visibleStateName, false);
00208             winrt::VisualStateManager::GoToState(*this, enabledStateName, false);
00209         }
00210         else
00211         {
00212             if (!isGenerallyVisible)
00213             {
00214                 winrt::VisualStateManager::GoToState(*this, disabledStateName, false);
00215             }
00216             else
00217             {
00218                 winrt::VisualStateManager::GoToState(*this, enabledStateName, false);
00219             }
00220             winrt::VisualStateManager::GoToState(*this, hiddenStateName, false);
00221         }
00222     }
00223 }
00224
00225 void PipsPager::UpdateNavigationButtonVisualStates() {
00226     const int selectedPageIndex = SelectedPageIndex();
00227     const int numberOfPages = NumberOfPages();
00228
00229     auto const isPreviousButtonHiddenOnEdge = selectedPageIndex == 0;
00230     UpdateIndividualNavigationButtonVisualState(isPreviousButtonHiddenOnEdge, PreviousButtonVisibility(),
00231         c_previousPageButtonVisibleVisualState, c_previousPageButtonHiddenVisualState,
00232         c_previousPageButtonEnabledVisualState, c_previousPageButtonDisabledVisualState);
00233
00234     auto const isNextButtonHiddenOnEdge = selectedPageIndex == numberOfPages - 1;
00235     UpdateIndividualNavigationButtonVisualState(isNextButtonHiddenOnEdge, NextButtonVisibility(),
00236         c_nextPageButtonVisibleVisualState, c_nextPageButtonHiddenVisualState,
00237         c_nextPageButtonEnabledVisualState, c_nextPageButtonDisabledVisualState);
00238 }
00239
00240 void PipsPager::ScrollToCenterOfViewport(const winrt::UIElement sender, const int index)
00241 {
00242     winrt::BringIntoViewOptions options;
00243     if (Orientation() == winrt::Orientation::Horizontal)
00244     {
00245         options.HorizontalAlignmentRatio(0.5);
00246     }
00247     else
00248     {
00249         options.VerticalAlignmentRatio(0.5);
00250     }
00251     options.AnimationDesired(true);
00252     sender.StartBringIntoView(options);
00253 }
00254
00255 void PipsPager::UpdateSelectedPip(const int index) {
00256     if (NumberOfPages() != 0 && MaxVisiblePips() > 0)
00257     {
00258         if (const auto repeater = m_pipsPagerRepeater.get())
00259         {
00260             repeater.UpdateLayout();
00261             if (const auto pip = repeater.TryGetElement(m_lastSelectedPageIndex).try_as<winrt::FrameworkElement>())
00262             {
00263                 ApplyStyleToPipAndUpdateOrientation(pip, NormalPipStyle());
00264             }
00265             if (const auto pip = repeater.GetOrCreateElement(index).try_as<winrt::FrameworkElement>())
00266             {
00267                 ApplyStyleToPipAndUpdateOrientation(pip, SelectedPipStyle());
00268                 ScrollToCenterOfViewport(pip, index);
00269             }
00270         }
00271     }
00272 }
00273
00274 double PipsPager::CalculateScrollViewerSize(const double defaultPipSize, const double selectedPipSize, const int numberOfPages, int maxVisualIndicators) {
00275
00276     auto numberOfPagesToDisplay = 0;
00277     maxVisualIndicators = std::max(0, maxVisualIndicators);
00278     if (maxVisualIndicators == 0 || numberOfPages == 0) {
00279         return 0;
00280     }
00281     else if (numberOfPages > 0)
00282     {
00283         numberOfPagesToDisplay = std::min(maxVisualIndicators, numberOfPages);
00284     }
00285     else
00286     {
00287         numberOfPagesToDisplay = maxVisualIndicators;
00288     }
00289     return defaultPipSize * (static_cast<double>(numberOfPagesToDisplay) - 1) + selectedPipSize;
00290 }
00291
00292 void PipsPager::SetScrollViewerMaxSize() {
00293     if (const auto scrollViewer = m_pipsPagerScrollViewer.get())
00294     {
00295         if (Orientation() == winrt::Orientation::Horizontal)
00296         {
00297             const auto scrollViewerWidth = CalculateScrollViewerSize(m_defaultPipSize.Width, m_selectedPipSize.Width, NumberOfPages(), MaxVisiblePips());
00298             scrollViewer.MaxWidth(scrollViewerWidth);
00299             scrollViewer.MaxHeight(std::max(m_defaultPipSize.Height, m_selectedPipSize.Height));
00300         }
00301         else
00302         {
00303             const auto scrollViewerHeight = CalculateScrollViewerSize(m_defaultPipSize.Height, m_selectedPipSize.Height, NumberOfPages(), MaxVisiblePips());
00304             scrollViewer.MaxHeight(scrollViewerHeight);
00305             scrollViewer.MaxWidth(std::max(m_defaultPipSize.Width, m_selectedPipSize.Width));
00306         }
00307     }
00308 }
00309
00310 void PipsPager::UpdatePipsItems(const int numberOfPages, int maxVisualIndicators) {
00311     auto const pipsListSize = int(m_pipsPagerItems.Size());
00312
00313     if (numberOfPages == 0 || maxVisualIndicators == 0)
00314     {
00315         m_pipsPagerItems.Clear();
00316     }
00317     /* Inifinite number of pages case */
00318     else if (numberOfPages < 0)
00319     {
00320         /* Treat negative max visual indicators as 0*/
00321         auto const minNumberOfElements = std::max(SelectedPageIndex() + 1, std::max(0, maxVisualIndicators));
00322         if (minNumberOfElements > pipsListSize)
00323         {
00324             for (int i = pipsListSize; i < minNumberOfElements; i++)
00325             {
00326                 m_pipsPagerItems.Append(i + 1);
00327             }
00328         }
00329         else if (SelectedPageIndex() == pipsListSize - 1) {
00330             m_pipsPagerItems.Append(pipsListSize + 1);
00331         }
00332     }
00333     else if (pipsListSize < numberOfPages)
00334     {
00335         for (int i = pipsListSize; i < numberOfPages; i++)
00336         {
00337             m_pipsPagerItems.Append(i + 1);
00338         }
00339     }
00340     else {
00341         for (int i = numberOfPages; i < pipsListSize; i++)
00342         {
00343             m_pipsPagerItems.RemoveAtEnd();
00344         }
00345     }
00346 }
00347
00348 void PipsPager::OnElementPrepared(winrt::ItemsRepeater sender, winrt::ItemsRepeaterElementPreparedEventArgs args)
00349 {
00350     if (auto const element = args.Element().try_as<winrt::FrameworkElement>())
00351     {
00352         auto const index = args.Index();
00353         auto const style = index == SelectedPageIndex() ? SelectedPipStyle() : NormalPipStyle();
00354         ApplyStyleToPipAndUpdateOrientation(element, style);
00355
00356         winrt::AutomationProperties::SetName(element, ResourceAccessor::GetLocalizedStringResource(SR_PipsPagerPageText) + L" " + winrt::to_hstring(index + 1));
00357         winrt::AutomationProperties::SetPositionInSet(element, index + 1);
00358         winrt::AutomationProperties::SetSizeOfSet(element, NumberOfPages());
00359
00360         if (const auto pip = element.try_as<winrt::ButtonBase>())
00361         {
00362             auto pciRevokers = winrt::make_self<PipsPagerViewItemRevokers>();
00363             pciRevokers->clickRevoker = pip.Click(winrt::auto_revoke,
00364                 [this, index](auto const& sender, auto const& args)
00365                 {
00366                     if (const auto repeater = m_pipsPagerRepeater.get()) {
00367                         if (const auto button = sender.try_as<winrt::Button>())
00368                         {
00369                             SelectedPageIndex(repeater.GetElementIndex(button));
00370                         }
00371                     }
00372                 }
00373             );
00374             pip.SetValue(s_pipButtonHandlersProperty, pciRevokers.as<winrt::IInspectable>());
00375         }
00376     }
00377 }
00378
00379 void PipsPager::OnElementIndexChanged(const winrt::ItemsRepeater&, const winrt::ItemsRepeaterElementIndexChangedEventArgs& args)
00380 {
00381     if (auto const pip = args.Element())
00382     {
00383         auto const newIndex = args.NewIndex();
00384         winrt::AutomationProperties::SetName(pip, ResourceAccessor::GetLocalizedStringResource(SR_PipsPagerPageText) + L" " + winrt::to_hstring(newIndex + 1));
00385         winrt::AutomationProperties::SetPositionInSet(pip, newIndex + 1);
00386     }
00387 }
00388
00389 void PipsPager::OnMaxVisiblePipsChanged()
00390 {
00391     const auto numberOfPages = NumberOfPages();
00392     if (numberOfPages < 0) {
00393         UpdatePipsItems(numberOfPages, MaxVisiblePips());
00394     }
00395     SetScrollViewerMaxSize();
00396     UpdateSelectedPip(SelectedPageIndex());
00397     UpdateNavigationButtonVisualStates();
00398 }
00399
00400 void PipsPager::OnNumberOfPagesChanged()
00401 {
00402     const int numberOfPages = NumberOfPages();
00403     const int selectedPageIndex = SelectedPageIndex();
00404     UpdateSizeOfSetForElements(numberOfPages, m_pipsPagerItems.Size());
00405     UpdatePipsItems(numberOfPages, MaxVisiblePips());
00406     SetScrollViewerMaxSize();
00407     if (SelectedPageIndex() > numberOfPages - 1 && numberOfPages > -1)
00408     {
00409         SelectedPageIndex(numberOfPages - 1);
00410     }
00411     else
00412     {
00413         UpdateSelectedPip(selectedPageIndex);
00414         UpdateNavigationButtonVisualStates();
00415     }
00416 }
00417
00418 void PipsPager::OnSelectedPageIndexChanged(const int oldValue)
00419 {
00420     // If we don't have any pages, there is nothing we should do.
00421     // Ensure that SelectedPageIndex will end up in the valid range of values
00422     // Special case is NumberOfPages being 0, in that case, don't verify upperbound restrictions
00423     if (SelectedPageIndex() > NumberOfPages() - 1 && NumberOfPages() > 0)
00424     {
00425         SelectedPageIndex(NumberOfPages() - 1);
00426     }
00427     else if (SelectedPageIndex() < 0)
00428     {
00429         SelectedPageIndex(0);
00430     }
00431     else {
00432         // Now handle the value changes
00433         m_lastSelectedPageIndex = oldValue;
00434
00435         // Fire value property change for UIA
00436         if (const auto peer = winrt::FrameworkElementAutomationPeer::FromElement(*this).try_as<winrt::PipsPagerAutomationPeer>())
00437         {
00438             winrt::get_self<PipsPagerAutomationPeer>(peer)->RaiseSelectionChanged(m_lastSelectedPageIndex, SelectedPageIndex());
00439         }
00440         if (NumberOfPages() < 0) {
00441             UpdatePipsItems(NumberOfPages(), MaxVisiblePips());
00442         }
00443         UpdateSelectedPip(SelectedPageIndex());
00444         UpdateNavigationButtonVisualStates();
00445         RaiseSelectedIndexChanged();
00446     }
00447 }
00448
00449 void PipsPager::OnWrapModeChanged()
00450 {
00451     UpdateLayoutVirtualization();
00452     UpdateNavigationButtonVisualStates();
00453 }
00454
00455 void PipsPager::OnOrientationChanged()
00456 {
00457     if (Orientation() == winrt::Orientation::Horizontal)
00458     {
00459         winrt::VisualStateManager::GoToState(*this, c_pipsPagerHorizontalOrientationVisualState, false);
00460     }
00461     else
00462     {
00463         winrt::VisualStateManager::GoToState(*this, c_pipsPagerVerticalOrientationVisualState, false);
00464     }
00465     if (const auto repeater = m_pipsPagerRepeater.get())
00466     {
00467         if (const auto itemsSourceView = repeater.ItemsSourceView())
00468         {
00469             const auto itemCount = itemsSourceView.Count();
00470             for (int i = 0; i < itemCount; i++)
00471             {
00472                 if (const auto pip = repeater.TryGetElement(i).try_as<winrt::Control>())
00473                 {
00474                     UpdatePipOrientation(pip);
00475                 }
00476             }
00477         }
00478     }
00479     m_defaultPipSize = GetDesiredPipSize(NormalPipStyle());
00480     m_selectedPipSize = GetDesiredPipSize(SelectedPipStyle());
00481     SetScrollViewerMaxSize();
00482     if (const auto selectedPip = GetSelectedItem())
00483     {
00484         ScrollToCenterOfViewport(selectedPip, SelectedPageIndex());
00485     }
00486 }
00487
00488 void PipsPager::ApplyStyleToPipAndUpdateOrientation(const winrt::FrameworkElement& pip, const winrt::Style& style)
00489 {
00490     pip.Style(style);
00491     if (const auto control = pip.try_as<winrt::Control>())
00492     {
00493         control.ApplyTemplate();
00494         UpdatePipOrientation(control);
00495     }
00496 }
00497
00498 void PipsPager::UpdatePipOrientation(const winrt::Control& pip)
00499 {
00500     if (Orientation() == winrt::Orientation::Horizontal)
00501     {
00502         winrt::VisualStateManager::GoToState(pip, c_pipsPagerButtonHorizontalOrientationVisualState, false);
00503     }
00504     else
00505     {
00506         winrt::VisualStateManager::GoToState(pip, c_pipsPagerButtonVerticalOrientationVisualState, false);
00507     }
00508 }
00509
00510 void PipsPager::OnNavigationButtonVisibilityChanged(const ButtonVisibility visibility, const wstring_view& collapsedStateName, const wstring_view& disabledStateName) {
00511     if (visibility == ButtonVisibility::Collapsed)
00512     {
00513         winrt::VisualStateManager::GoToState(*this, collapsedStateName, false);
00514         winrt::VisualStateManager::GoToState(*this, disabledStateName, false);
00515     }
00516     else
00517     {
00518         UpdateNavigationButtonVisualStates();
00519     }
00520 }
00521
00522 void PipsPager::OnPreviousButtonClicked(const IInspectable& sender, const winrt::RoutedEventArgs& e)
00523 {
00524     // Navigation buttons are hidden in this scenario.
00525     // However in case someone re-templates the control and
00526     // leaves the buttons active, we want to make sure
00527     // we don't navigate to a non-existent index.
00528     if (NumberOfPages() == 0 || NumberOfPages() == 1)
00529     {
00530         return;
00531     }
00532
00533     auto newPageIndex = std::max(0, SelectedPageIndex() - 1);
00534
00535     if (IsWrapEnabled() && NumberOfPages() > -1 &&
00536         SelectedPageIndex() == 0)
00537     {
00538         newPageIndex = NumberOfPages() - 1;
00539     }
00540
00541     SelectedPageIndex(newPageIndex);
00542 }
00543
00544 void PipsPager::OnNextButtonClicked(const IInspectable& sender, const winrt::RoutedEventArgs& e)
00545 {
00546     // Navigation buttons are hidden in this scenario.
00547     // However in case someone re-templates the control and
00548     // leaves the buttons active, we want to make sure
00549     // we don't navigate to a non-existent index.
00550     if (NumberOfPages() == 0 || NumberOfPages() == 1)
00551     {
00552         return;
00553     }
00554
00555     auto newPageIndex = NumberOfPages() > -1 ?
00556                             std::min(SelectedPageIndex() + 1, NumberOfPages() - 1) : SelectedPageIndex() + 1;
00557
00558     if (IsWrapEnabled() &&
00559         SelectedPageIndex() == (NumberOfPages() - 1))
00560     {
00561         newPageIndex = 0;
00562     }
00563
00564     SelectedPageIndex(newPageIndex);
00565 }
00566
00567
00568 void PipsPager::OnGotFocus(const winrt::RoutedEventArgs& args)
00569 {
00570     if (const auto btn = args.OriginalSource().try_as<winrt::Button>())
00571     {
00572         // If the element inside the Pager is already keyboard focused
00573         // and the user will use the mouse to focus on something else
00574         // the LostFocus will not be triggered on keyboard focused element
00575         // while GotFocus will be triggered on the new mouse focused element.
00576         // We account for this scenario and update m_isFocused in case
00577         // user will use mouse while being in keyboard focus.
00578         if (btn.FocusState() != winrt::FocusState::Pointer)
00579         {
00580             m_isFocused = true;
00581             UpdateNavigationButtonVisualStates();
00582         }
00583         else
00584         {
00585             m_isFocused = false;
00586         }
00587     }
00588 }
00589
00590 void PipsPager::OnPipsAreaGettingFocus(const IInspectable& sender, const winrt::GettingFocusEventArgs& args)
00591 {
00592     if (const auto repeater = m_pipsPagerRepeater.get())
00593     {
00594         // Easiest way to check if focus change came from within:
00595         // Check if element is child of repeater by getting index and checking for -1
00596         // If it is -1, focus came from outside and we want to get to selected element.
00597         if (const auto oldFocusedElement = args.OldFocusedElement().try_as<winrt::UIElement>())
00598         {
00599             if (repeater.GetElementIndex(oldFocusedElement) == -1)
00600             {
00601                 if (const auto realizedElement = repeater.GetOrCreateElement(SelectedPageIndex()).try_as<winrt::UIElement>())
00602                 {
00603                     if (args.TrySetNewFocusedElement(realizedElement))
00604                     {
00605                         args.Handled(true);
00606                     }
00607                 }
00608             }
00609         }
00610     }
00611 }
00612
00613 void PipsPager::OnLostFocus(const winrt::RoutedEventArgs& args)
00614 {
00615     m_isFocused = false;
00616     UpdateNavigationButtonVisualStates();
00617 }
00618
00619 void PipsPager::OnPointerEntered(const winrt::PointerRoutedEventArgs& args)
00620 {
00621     __super::OnPointerEntered(args);
00622     m_isPointerOver = true;
00623     UpdateNavigationButtonVisualStates();
00624 }
00625 void PipsPager::OnPointerExited(const winrt::PointerRoutedEventArgs& args)
00626 {
00627     // We can get a spurious Exited and then Entered if the button
00628     // that is being clicked on hides itself. In order to avoid switching
00629     // visual states in this case, we check if the pointer is over the
00630     // control bounds when we get the exited event.
00631     if (IsOutOfControlBounds(args.GetCurrentPoint(*this).Position()))
00632     {
00633         m_isPointerOver = false;
00634         UpdateNavigationButtonVisualStates();
00635     }
00636     else
00637     {
00638         args.Handled(true);
00639     }
00640     __super::OnPointerExited(args);
00641 }
00642
00643 void PipsPager::OnPointerCanceled(const winrt::PointerRoutedEventArgs& args)
00644 {
00645     __super::OnPointerCanceled(args);
00646     m_isPointerOver = false;
00647     UpdateNavigationButtonVisualStates();
00648 }
00649
00650 bool PipsPager::IsOutOfControlBounds(const winrt::Point& point)
00651 {
00652     // This is a conservative check. It is okay to say we are
00653     // out of the bounds when close to the edge to account for rounding.
00654     const auto tolerance = 1.0;
00655     const auto actualWidth = ActualWidth();
00656     const auto actualHeight = ActualHeight();
00657     return point.X < tolerance ||
00658         point.X > actualWidth - tolerance ||
00659         point.Y < tolerance ||
00660         point.Y  > actualHeight - tolerance;
00661 }
00662
00663 // In order to handle undesired scrolling when a user
00664 // tabs into the pipspager/focuses a pip using keyboard
00665 // we'll check for offsets and if they're NAN -
00666 // meaning it was not scroll initiated by us, we handle it.
00667 void PipsPager::OnPipsAreaBringIntoViewRequested(const IInspectable& sender, const winrt::BringIntoViewRequestedEventArgs& args)
00668 {
00669     if (
00670         (Orientation() == winrt::Orientation::Vertical && isnan(args.VerticalAlignmentRatio())) ||
00671         (Orientation() == winrt::Orientation::Horizontal && isnan(args.HorizontalAlignmentRatio()))
00672        )
00673     {
00674         args.Handled(true);
00675     }
00676 }
00677
00678 // Inner scrollviewer will bubble BringIntoView event to
00679 // parent scrollviewers (if they exist) if the scrolling was
00680 // not complete (could not scroll to specified offset because
00681 // the beginning/end of the scrollable area was already reached).
00682 // To avoid that, we handle BringIntoViewRequested on inner scrollviewer.
00683 void PipsPager::OnScrollViewerBringIntoViewRequested(const IInspectable& sender, const winrt::BringIntoViewRequestedEventArgs& args)
00684 {
00685     args.Handled(true);
00686 }
00687
00688 void PipsPager::OnItemsRepeaterLayoutChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& args)
00689 {
00690     RestoreLayoutVirtualization();
00691     UpdateLayoutVirtualization();
00692 }
00693
00694 void PipsPager::RestoreLayoutVirtualization()
00695 {
00696     // Make sure to reset the layout virtualization settings on old layout
00697     if (auto stackLayout = m_itemsRepeaterStackLayout.get())
00698     {
00699         auto stackLayoutImpl = winrt::get_self<StackLayout>(stackLayout);
00700         stackLayoutImpl->IsVirtualizationEnabled(m_cachedIsVirtualizationEnabledFlag);
00701     }
00702     m_itemsRepeaterStackLayout = nullptr;
00703     m_cachedIsVirtualizationEnabledFlag = true;
00704 }
00705
00706 void PipsPager::UpdateLayoutVirtualization()
00707 {
00708     if (auto repeater = m_pipsPagerRepeater.get())
00709     {
00710         if (auto stackLayout = repeater.Layout().try_as<winrt::StackLayout>())
00711         {
00712             // Turn off virtualization when wrap around is enabled
00713             // in order to avoid a bug where the pips disappear
00714             // when navigating to the last page from the first page
00715             auto stackLayoutImpl = winrt::get_self<StackLayout>(stackLayout);
00716             if (m_itemsRepeaterStackLayout.get() == nullptr)
00717             {
00718                 m_cachedIsVirtualizationEnabledFlag = stackLayoutImpl->IsVirtualizationEnabled();
00719                 m_itemsRepeaterStackLayout = winrt::make_weak(stackLayout);
00720             }
00721             stackLayoutImpl->IsVirtualizationEnabled(!IsWrapEnabled());
00722         }
00723     }
00724 }
00725
00726 void PipsPager::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00727 {
00728     winrt::IDependencyProperty property = args.Property();
00729     if (this->Template() != nullptr)
00730     {
00731         if (property == NumberOfPagesProperty())
00732         {
00733             OnNumberOfPagesChanged();
00734         }
00735         else if (property == SelectedPageIndexProperty())
00736         {
00737             OnSelectedPageIndexChanged(winrt::unbox_value<int>(args.OldValue()));
00738         }
00739         else if (property == MaxVisiblePipsProperty()) {
00740             OnMaxVisiblePipsChanged();
00741         }
00742         else if (property == WrapModeProperty())
00743         {
00744             OnWrapModeChanged();
00745         }
00746         else if (property == PreviousButtonVisibilityProperty())
00747         {
00748             OnNavigationButtonVisibilityChanged(PreviousButtonVisibility(), c_previousPageButtonCollapsedVisualState, c_previousPageButtonDisabledVisualState);
00749         }
00750         else if (property == NextButtonVisibilityProperty())
00751         {
00752             OnNavigationButtonVisibilityChanged(NextButtonVisibility(), c_nextPageButtonCollapsedVisualState, c_nextPageButtonDisabledVisualState);
00753         }
00754         else if (property == NormalPipStyleProperty())
00755         {
00756             m_defaultPipSize = GetDesiredPipSize(NormalPipStyle());
00757             SetScrollViewerMaxSize();
00758             UpdateSelectedPip(SelectedPageIndex());
00759         }
00760         else if (property == SelectedPipStyleProperty())
00761         {
00762             m_selectedPipSize = GetDesiredPipSize(SelectedPipStyle());
00763             SetScrollViewerMaxSize();
00764             UpdateSelectedPip(SelectedPageIndex());
00765         }
00766         else if (property == OrientationProperty())
00767         {
00768             OnOrientationChanged();
00769         }
00770     }
00771 }
00772
00773 winrt::UIElement PipsPager::GetSelectedItem() {
00774     if (auto const repeater = m_pipsPagerRepeater.get())
00775     {
00776         return repeater.TryGetElement(SelectedPageIndex());
00777     }
00778     return nullptr;
00779 }
00780
00781 winrt::AutomationPeer PipsPager::OnCreateAutomationPeer()
00782 {
00783     return winrt::make<PipsPagerAutomationPeer>(*this);
00784 }
00785
00786 // Number of items is passed to ensure that in case we're
00787 // in infinite mode (numberOfPages = - 1), we will correctly
00788 // iterate over all the pips.
00789 void PipsPager::UpdateSizeOfSetForElements(const int numberOfPages, const int numberOfItems) {
00790     if (auto const repeater = m_pipsPagerRepeater.get())
00791     {
00792         for (int i = 0; i < numberOfItems; i++)
00793         {
00794             if (auto const pip = repeater.TryGetElement(i))
00795             {
00796                 winrt::AutomationProperties::SetSizeOfSet(pip, numberOfPages);
00797             }
00798         }
00799     }
00800 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ActivityFeedLayout Member List

This is the complete list of members for ActivityFeedLayout, including all inherited members.
_itemSpacing | ActivityFeedLayout | [private]
_minItemSize | ActivityFeedLayout | [private]
_rowSpacing | ActivityFeedLayout | [private]
ArrangeOverride(VirtualizingLayoutContext context, Size finalSize) | ActivityFeedLayout | [inline, protected]
VirtualizingLayout::ArrangeOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &finalSize) | VirtualizingLayout | [virtual]
CalculateLayoutBoundsForRow(int rowIndex) | ActivityFeedLayout | [inline, private]
InitializeForContextCore(VirtualizingLayoutContext context) | ActivityFeedLayout | [inline, protected]
VirtualizingLayout::InitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | VirtualizingLayout | [virtual]
ItemSpacing | ActivityFeedLayout |
ItemSpacingProperty | ActivityFeedLayout | [static]
MeasureOverride(VirtualizingLayoutContext context, Size availableSize) | ActivityFeedLayout | [inline, protected]
VirtualizingLayout::MeasureOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &availableSize) | VirtualizingLayout | [virtual]
MinItemSize | ActivityFeedLayout |
MinItemSizeProperty | ActivityFeedLayout | [static]
OnItemsChangedCore(winrt::VirtualizingLayoutContext const &context, winrt::IInspectable const &source, winrt::NotifyCollectionChangedEventArgs const &args) | VirtualizingLayout | [virtual]
OnPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) | ActivityFeedLayout | [inline, private, static]
RowSpacing | ActivityFeedLayout |
RowSpacingProperty | ActivityFeedLayout | [static]
UninitializeForContextCore(VirtualizingLayoutContext context) | ActivityFeedLayout | [inline, protected]
VirtualizingLayout::UninitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | VirtualizingLayout | [virtual]
VirtualizingLayout() | VirtualizingLayout |
Generated on Sun Dec 1 2024 20:54:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/SnapPointBase.properties.cpp Source File

  • Generated

SnapPointBase.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "SnapPointBase.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::Primitives
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(SnapPointBase)
00012 }
00013
00014 #include "SnapPointBase.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbBar.cpp Source File

  • Breadcrumb

BreadcrumbBar.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "Vector.h"
00007 #include "BreadcrumbBar.h"
00008 #include "RuntimeProfiler.h"
00009 #include "ResourceAccessor.h"
00010 #include "BreadcrumbBarItem.h"
00011 #include "BreadcrumbLayout.h"
00012 #include "BreadcrumbBarItemClickedEventArgs.h"
00013
00014 BreadcrumbBar::BreadcrumbBar()
00015 {
00016     __RP_Marker_ClassById(RuntimeProfiler::ProfId_BreadcrumbBar);
00017
00018     SetDefaultStyleKey(this);
00019     m_itemsRepeaterElementFactory = winrt::make_self<BreadcrumbElementFactory>();
00020     m_itemsRepeaterLayout = winrt::make_self<BreadcrumbLayout>(*this);
00021     m_itemsIterable = winrt::make_self<BreadcrumbIterable>();
00022 }
00023
00024 void BreadcrumbBar::RevokeListeners()
00025 {
00026     m_itemsRepeaterLoadedRevoker.revoke();
00027     m_itemsRepeaterElementPreparedRevoker.revoke();
00028     m_itemsRepeaterElementIndexChangedRevoker.revoke();
00029     m_itemsRepeaterElementClearingRevoker.revoke();
00030     m_itemsSourceChanged.revoke();
00031     m_itemsSourceAsObservableVectorChanged.revoke();
00032 }
00033
00034 void BreadcrumbBar::OnApplyTemplate()
00035 {
00036     __super::OnApplyTemplate();
00037
00038     RevokeListeners();
00039
00040     winrt::IControlProtected controlProtected{ *this };
00041
00042     m_itemsRepeater.set(GetTemplateChildT<winrt::ItemsRepeater>(s_itemsRepeaterPartName, controlProtected));
00043
00044     PreviewKeyDown({ this, &BreadcrumbBar::OnChildPreviewKeyDown });
00045     AccessKeyInvoked({ this, &BreadcrumbBar::OnAccessKeyInvoked });
00046     GettingFocus({ this, &BreadcrumbBar::OnGettingFocus });
00047
00048     RegisterPropertyChangedCallback(winrt::FrameworkElement::FlowDirectionProperty(), { this, &BreadcrumbBar::OnFlowDirectionChanged });
00049
00050     if (const auto& itemsRepeater = m_itemsRepeater.get())
00051     {
00052         itemsRepeater.Layout(*m_itemsRepeaterLayout);
00053         itemsRepeater.ItemsSource(winrt::make<Vector<IInspectable>>());
00054         itemsRepeater.ItemTemplate(*m_itemsRepeaterElementFactory);
00055
00056         m_itemsRepeaterElementPreparedRevoker = itemsRepeater.ElementPrepared(winrt::auto_revoke, { this, &BreadcrumbBar::OnElementPreparedEvent });
00057         m_itemsRepeaterElementIndexChangedRevoker = itemsRepeater.ElementIndexChanged(winrt::auto_revoke, { this, &BreadcrumbBar::OnElementIndexChangedEvent });
00058         m_itemsRepeaterElementClearingRevoker = itemsRepeater.ElementClearing(winrt::auto_revoke, { this, &BreadcrumbBar::OnElementClearingEvent });
00059
00060         m_itemsRepeaterLoadedRevoker = itemsRepeater.Loaded(winrt::auto_revoke, { this, &BreadcrumbBar::OnBreadcrumbBarItemsRepeaterLoaded });
00061     }
00062
00063     UpdateItemsRepeaterItemsSource();
00064 }
00065
00066 void BreadcrumbBar::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00067 {
00068     const winrt::IDependencyProperty& property = args.Property();
00069
00070     if (property == s_ItemsSourceProperty)
00071     {
00072         UpdateItemsRepeaterItemsSource();
00073     }
00074     else if (property == s_ItemTemplateProperty)
00075     {
00076         UpdateItemTemplate();
00077         UpdateEllipsisBreadcrumbBarItemDropDownItemTemplate();
00078     }
00079 }
00080
00081 void BreadcrumbBar::OnFlowDirectionChanged(winrt::DependencyObject const& o, winrt::DependencyProperty const& p)
00082 {
00083     UpdateBreadcrumbBarItemsFlowDirection();
00084 }
00085
00086 void BreadcrumbBar::OnBreadcrumbBarItemsRepeaterLoaded(const winrt::IInspectable&, const winrt::RoutedEventArgs&)
00087 {
00088     if (const auto& breadcrumbItemsRepeater = m_itemsRepeater.get())
00089     {
00090         OnBreadcrumbBarItemsSourceCollectionChanged(nullptr, nullptr);
00091     }
00092 }
00093
00094 void BreadcrumbBar::UpdateItemTemplate()
00095 {
00096     const winrt::IInspectable& newItemTemplate = ItemTemplate();
00097     m_itemsRepeaterElementFactory->UserElementFactory(newItemTemplate);
00098 }
00099
00100 void BreadcrumbBar::UpdateEllipsisBreadcrumbBarItemDropDownItemTemplate()
00101 {
00102     const winrt::IInspectable& newItemTemplate = ItemTemplate();
00103
00104     // Copy the item template to the ellipsis item too
00105     if (const auto& ellipsisBreadcrumbBarItem = m_ellipsisBreadcrumbBarItem.get())
00106     {
00107         if (const auto& itemImpl = winrt::get_self<BreadcrumbBarItem>(ellipsisBreadcrumbBarItem))
00108         {
00109             itemImpl->SetEllipsisDropDownItemDataTemplate(newItemTemplate);
00110         }
00111     }
00112 }
00113
00114 void BreadcrumbBar::UpdateBreadcrumbBarItemsFlowDirection()
00115 {
00116     // Only if some ItemsSource has been defined then we change the BreadcrumbBarItems flow direction
00117     if (ItemsSource())
00118     {
00119         if (const auto& itemsRepeater = m_itemsRepeater.get())
00120         {
00121             // Add 1 to account for the leading null
00122             const int32_t elementCount = m_breadcrumbItemsSourceView.Count() + 1;
00123             for (int32_t i{}; i < elementCount; ++i)
00124             {
00125                 const auto& element = itemsRepeater.TryGetElement(i).try_as<winrt::BreadcrumbBarItem>();
00126                 element.FlowDirection(FlowDirection());
00127             }
00128         }
00129     }
00130 }
00131
00132 void BreadcrumbBar::UpdateItemsRepeaterItemsSource()
00133 {
00134     m_itemsSourceChanged.revoke();
00135     m_itemsSourceAsObservableVectorChanged.revoke();
00136
00137     m_breadcrumbItemsSourceView = nullptr;
00138     if (ItemsSource())
00139     {
00140         m_breadcrumbItemsSourceView = winrt::ItemsSourceView(ItemsSource());
00141         if (const auto& itemsRepeater = m_itemsRepeater.get())
00142         {
00143             m_itemsIterable = winrt::make_self<BreadcrumbIterable>(ItemsSource());
00144             itemsRepeater.ItemsSource(*m_itemsIterable);
00145         }
00146         if (m_breadcrumbItemsSourceView)
00147         {
00148             m_itemsSourceChanged = m_breadcrumbItemsSourceView.CollectionChanged(winrt::auto_revoke, { this, &BreadcrumbBar::OnBreadcrumbBarItemsSourceCollectionChanged });
00149         }
00150     }
00151 }
00152
00153 void BreadcrumbBar::OnBreadcrumbBarItemsSourceCollectionChanged(const winrt::IInspectable&, const winrt::IInspectable& args)
00154 {
00155     if (const auto& itemsRepeater = m_itemsRepeater.get())
00156     {
00157         // A new BreadcrumbIterable must be created as ItemsRepeater compares if the previous
00158         // itemsSource is equals to the new one
00159         m_itemsIterable = winrt::make_self<BreadcrumbIterable>(ItemsSource());
00160         itemsRepeater.ItemsSource(*m_itemsIterable);
00161
00162         // For some reason, when interacting with keyboard, the last element doesn't raise the OnPrepared event
00163         ForceUpdateLastElement();
00164     }
00165 }
00166
00167 void BreadcrumbBar::ResetLastBreadcrumbBarItem()
00168 {
00169     if (const auto& lastItem = m_lastBreadcrumbBarItem.get())
00170     {
00171         auto lastItemImpl = winrt::get_self<BreadcrumbBarItem>(lastItem);
00172         lastItemImpl->ResetVisualProperties();
00173     }
00174 }
00175
00176 void BreadcrumbBar::ForceUpdateLastElement()
00177 {
00178     if (m_breadcrumbItemsSourceView)
00179     {
00180         const uint32_t itemCount = m_breadcrumbItemsSourceView.Count();
00181
00182         if (const auto& itemsRepeater = m_itemsRepeater.get())
00183         {
00184             const auto& newLastItem = itemsRepeater.TryGetElement(itemCount).try_as<winrt::BreadcrumbBarItem>();
00185             UpdateLastElement(newLastItem);
00186         }
00187
00188         // If the given collection is empty, then reset the last element visual properties
00189         if (itemCount == 0)
00190         {
00191             ResetLastBreadcrumbBarItem();
00192         }
00193     }
00194     else
00195     {
00196         // Or if the ItemsSource was null, also reset the last breadcrumb Item
00197         ResetLastBreadcrumbBarItem();
00198     }
00199 }
00200
00201 void BreadcrumbBar::UpdateLastElement(const winrt::BreadcrumbBarItem& newLastBreadcrumbBarItem)
00202 {
00203     // If the element is the last element in the array,
00204     // then we reset the visual properties for the previous
00205     // last element
00206     ResetLastBreadcrumbBarItem();
00207
00208     if (const auto& newLastItemImpl = winrt::get_self<BreadcrumbBarItem>(newLastBreadcrumbBarItem))
00209     {
00210         newLastItemImpl->SetPropertiesForLastItem();
00211         m_lastBreadcrumbBarItem.set(newLastBreadcrumbBarItem);
00212     }
00213 }
00214
00215 void BreadcrumbBar::OnElementPreparedEvent(const winrt::ItemsRepeater&, const winrt::ItemsRepeaterElementPreparedEventArgs& args)
00216 {
00217     if (const auto& item = args.Element().try_as<winrt::BreadcrumbBarItem>())
00218     {
00219         if (const auto& itemImpl = winrt::get_self<BreadcrumbBarItem>(item))
00220         {
00221             itemImpl->SetIsEllipsisDropDownItem(false /*isEllipsisDropDownItem*/);
00222
00223             // Set the parent breadcrumb reference for raising click events
00224             itemImpl->SetParentBreadcrumb(*this);
00225
00226             // Set the item index to fill the Index parameter in the ClickedEventArgs
00227             const uint32_t itemIndex = args.Index();
00228             itemImpl->SetIndex(itemIndex);
00229
00230             // The first element is always the ellipsis item
00231             if (itemIndex == 0)
00232             {
00233                 itemImpl->SetPropertiesForEllipsisItem();
00234                 m_ellipsisBreadcrumbBarItem.set(item);
00235                 UpdateEllipsisBreadcrumbBarItemDropDownItemTemplate();
00236
00237                 winrt::AutomationProperties::SetName(item, ResourceAccessor::GetLocalizedStringResource(SR_AutomationNameEllipsisBreadcrumbBarItem));
00238             }
00239             else
00240             {
00241                 if (m_breadcrumbItemsSourceView)
00242                 {
00243                     const uint32_t itemCount = m_breadcrumbItemsSourceView.Count();
00244
00245                     if (itemIndex == itemCount)
00246                     {
00247                         UpdateLastElement(item);
00248                     }
00249                     else
00250                     {
00251                         // Any other element just resets the visual properties
00252                         itemImpl->ResetVisualProperties();
00253                     }
00254                 }
00255             }
00256         }
00257     }
00258 }
00259
00260 void BreadcrumbBar::OnElementIndexChangedEvent(const winrt::ItemsRepeater& sender, const winrt::ItemsRepeaterElementIndexChangedEventArgs& args)
00261 {
00262     if (m_focusedIndex == args.OldIndex())
00263     {
00264         const uint32_t newIndex = args.NewIndex();
00265
00266         if (const auto& item = args.Element().try_as<winrt::BreadcrumbBarItem>())
00267         {
00268             if (const auto& itemImpl = winrt::get_self<BreadcrumbBarItem>(item))
00269             {
00270                 itemImpl->SetIndex(newIndex);
00271             }
00272         }
00273
00274         FocusElementAt(newIndex);
00275     }
00276 }
00277
00278 void BreadcrumbBar::OnElementClearingEvent(const winrt::ItemsRepeater&, const winrt::ItemsRepeaterElementClearingEventArgs& args)
00279 {
00280     if (const auto& item = args.Element().try_as<winrt::BreadcrumbBarItem>())
00281     {
00282         const auto& itemImpl = winrt::get_self<BreadcrumbBarItem>(item);
00283         itemImpl->ResetVisualProperties();
00284     }
00285 }
00286
00287 void BreadcrumbBar::RaiseItemClickedEvent(const winrt::IInspectable& content, const uint32_t index)
00288 {
00289     const auto& eventArgs = winrt::make_self<BreadcrumbBarItemClickedEventArgs>();
00290     eventArgs->Item(content);
00291     eventArgs->Index(index);
00292
00293     if (m_itemClickedEventSource)
00294     {
00295         m_itemClickedEventSource(*this, *eventArgs);
00296     }
00297 }
00298
00299 winrt::IVector<winrt::IInspectable> BreadcrumbBar::GetHiddenElementsList(uint32_t firstShownElement) const
00300 {
00301     auto hiddenElements = winrt::make<Vector<winrt::IInspectable>>();
00302
00303     if (m_breadcrumbItemsSourceView)
00304     {
00305         for (uint32_t i = 0; i < firstShownElement - 1; ++i)
00306         {
00307             hiddenElements.Append(m_breadcrumbItemsSourceView.GetAt(i));
00308         }
00309     }
00310
00311     return hiddenElements;
00312 }
00313
00314 winrt::IVector<winrt::IInspectable> BreadcrumbBar::HiddenElements() const
00315 {
00316     // The hidden element list is generated in the BreadcrumbLayout during
00317     // the arrange method, so we retrieve the list from it
00318     if (const auto& itemsRepeater = m_itemsRepeater.get())
00319     {
00320         if (m_itemsRepeaterLayout)
00321         {
00322             if (m_itemsRepeaterLayout->EllipsisIsRendered())
00323             {
00324                 return GetHiddenElementsList(m_itemsRepeaterLayout->FirstRenderedItemIndexAfterEllipsis());
00325             }
00326         }
00327     }
00328
00329     // By default just return an empty list
00330     return winrt::make<Vector<winrt::IInspectable>>();
00331 }
00332
00333 void BreadcrumbBar::ReIndexVisibleElementsForAccessibility() const
00334 {
00335     // Once the arrangement of BreadcrumbBar Items has happened then index all visible items
00336     if (auto const& itemsRepeater = m_itemsRepeater.get())
00337     {
00338         const uint32_t visibleItemsCount{ m_itemsRepeaterLayout->GetVisibleItemsCount() };
00339         const auto isEllipsisRendered = m_itemsRepeaterLayout->EllipsisIsRendered();
00340         uint32_t firstItemToIndex{ 1 };
00341
00342         if (isEllipsisRendered)
00343         {
00344             firstItemToIndex = m_itemsRepeaterLayout->FirstRenderedItemIndexAfterEllipsis();
00345         }
00346
00347         // In order to make the ellipsis inaccessible to accessbility tools when it's hidden,
00348         // we set the accessibilityView to raw and restore it to content when it becomes visible.
00349         if (const auto ellipsisItem = m_ellipsisBreadcrumbBarItem.get())
00350         {
00351             const auto accessibilityView = isEllipsisRendered ? winrt::AccessibilityView::Content : winrt::AccessibilityView::Raw;
00352             ellipsisItem.SetValue(winrt::AutomationProperties::AccessibilityViewProperty(), box_value(accessibilityView));
00353         }
00354
00355         // For every BreadcrumbBar item we set the index (starting from 1 for the root/highest-level item)
00356         // accessibilityIndex is the index to be assigned to each item
00357         // itemToIndex is the real index and it may differ from accessibilityIndex as we must only index the visible items
00358         for (uint32_t accessibilityIndex = 1, itemToIndex = firstItemToIndex; accessibilityIndex <= visibleItemsCount; ++accessibilityIndex, ++itemToIndex)
00359         {
00360             if (const auto& element = itemsRepeater.TryGetElement(itemToIndex))
00361             {
00362                 element.SetValue(winrt::AutomationProperties::PositionInSetProperty(), box_value(accessibilityIndex));
00363                 element.SetValue(winrt::AutomationProperties::SizeOfSetProperty(), box_value(visibleItemsCount));
00364             }
00365         }
00366     }
00367 }
00368
00369 // When focus comes from outside the BreadcrumbBar control we will put focus on the selected item.
00370 void BreadcrumbBar::OnGettingFocus(const winrt::IInspectable&, const winrt::GettingFocusEventArgs& args)
00371 {
00372     if (auto const& itemsRepeater = m_itemsRepeater.get())
00373     {
00374         auto const& inputDevice = args.InputDevice();
00375         if (inputDevice == winrt::FocusInputDeviceKind::Keyboard)
00376         {
00377             // If focus is coming from outside the repeater, put focus on the selected item.
00378             auto const& oldFocusedElement = args.OldFocusedElement();
00379             if (!oldFocusedElement || itemsRepeater != winrt::VisualTreeHelper::GetParent(oldFocusedElement))
00380             {
00381                 // Reset the focused index
00382                 if (m_itemsRepeaterLayout)
00383                 {
00384                     if (m_itemsRepeaterLayout.get()->EllipsisIsRendered())
00385                     {
00386                         m_focusedIndex = 0;
00387                     }
00388                     else
00389                     {
00390                         m_focusedIndex = 1;
00391                     }
00392
00393                     FocusElementAt(m_focusedIndex);
00394                 }
00395
00396                 if (auto const& selectedItem = itemsRepeater.TryGetElement(m_focusedIndex))
00397                 {
00398                     if (args.TrySetNewFocusedElement(selectedItem))
00399                     {
00400                         args.Handled(true);
00401                     }
00402                 }
00403             }
00404
00405             // Focus was already in the repeater: in RS3+ Selection follows focus unless control is held down.
00406             else if ((winrt::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::VirtualKey::Control) &
00407                     winrt::CoreVirtualKeyStates::Down) != winrt::CoreVirtualKeyStates::Down)
00408             {
00409                 if (auto const& newFocusedElementAsUIE = args.NewFocusedElement().as<winrt::UIElement>())
00410                 {
00411                     FocusElementAt(itemsRepeater.GetElementIndex(newFocusedElementAsUIE));
00412                     args.Handled(true);
00413                 }
00414             }
00415         }
00416     }
00417 }
00418
00419 void BreadcrumbBar::FocusElementAt(int index)
00420 {
00421     if (index >= 0)
00422     {
00423         m_focusedIndex = index;
00424     }
00425 }
00426
00427 bool BreadcrumbBar::MoveFocus(int indexIncrement)
00428 {
00429     if (auto const& itemsRepeater = m_itemsRepeater.get())
00430     {
00431         const auto& focusedElem = winrt::FocusManager::GetFocusedElement();
00432
00433         if (auto const& focusedElement = focusedElem.try_as<winrt::UIElement>())
00434         {
00435             auto focusedIndex = itemsRepeater.GetElementIndex(focusedElement);
00436
00437             if (focusedIndex >= 0 && indexIncrement != 0)
00438             {
00439                 focusedIndex += indexIncrement;
00440                 auto const itemCount = itemsRepeater.ItemsSourceView().Count();
00441                 while (focusedIndex >= 0 && focusedIndex < itemCount)
00442                 {
00443                     if (auto const item = itemsRepeater.TryGetElement(focusedIndex))
00444                     {
00445                         if (auto const itemAsUIE = item.try_as<winrt::IUIElement>())
00446                         {
00447                             if (itemAsUIE.Focus(winrt::FocusState::Programmatic))
00448                             {
00449                                 FocusElementAt(focusedIndex);
00450                                 return true;
00451                             }
00452                         }
00453                     }
00454                     focusedIndex += indexIncrement;
00455                 }
00456             }
00457         }
00458     }
00459     return false;
00460 }
00461
00462 bool BreadcrumbBar::MoveFocusPrevious()
00463 {
00464     int movementPrevious{ -1 };
00465
00466     // If the focus is in the first visible item, then move to the ellipsis
00467     if (const auto& itemsRepeater = m_itemsRepeater.get())
00468     {
00469         const auto& repeaterLayout = itemsRepeater.Layout();
00470         if (m_itemsRepeaterLayout)
00471         {
00472             if (m_focusedIndex == 1)
00473             {
00474                 movementPrevious = 0;
00475             }
00476             else if (m_itemsRepeaterLayout->EllipsisIsRendered() &&
00477                 m_focusedIndex == static_cast<int>(m_itemsRepeaterLayout->FirstRenderedItemIndexAfterEllipsis()))
00478             {
00479                 movementPrevious = -m_focusedIndex;
00480             }
00481         }
00482     }
00483
00484     return MoveFocus(movementPrevious);
00485 }
00486
00487 bool BreadcrumbBar::MoveFocusNext()
00488 {
00489     int movementNext{ 1 };
00490
00491     // If the focus is in the ellipsis, then move to the first visible item
00492     if (m_focusedIndex == 0)
00493     {
00494         if (const auto& itemsRepeater = m_itemsRepeater.get())
00495         {
00496             const auto& repeaterLayout = itemsRepeater.Layout();
00497             if (m_itemsRepeaterLayout)
00498             {
00499                 movementNext = m_itemsRepeaterLayout->FirstRenderedItemIndexAfterEllipsis();
00500             }
00501         }
00502     }
00503
00504     return MoveFocus(movementNext);
00505 }
00506
00507 winrt::FindNextElementOptions BreadcrumbBar::GetFindNextElementOptions()
00508 {
00509     auto const& findNextElementOptions = winrt::FindNextElementOptions{};
00510     findNextElementOptions.SearchRoot(*this);
00511     return findNextElementOptions;
00512 }
00513
00514 void BreadcrumbBar::OnChildPreviewKeyDown(const winrt::IInspectable&, const winrt::KeyRoutedEventArgs& args)
00515 {
00516     const bool flowDirectionIsLTR = (FlowDirection() == winrt::FlowDirection::LeftToRight);
00517     const bool keyIsLeft = (args.Key() == winrt::VirtualKey::Left);
00518     const bool keyIsRight = (args.Key() == winrt::VirtualKey::Right);
00519
00520     // Moving to the next element
00521     if ((flowDirectionIsLTR && keyIsRight) || (!flowDirectionIsLTR && keyIsLeft))
00522     {
00523         if (MoveFocusNext())
00524         {
00525             args.Handled(true);
00526             return;
00527         }
00528         else if ((flowDirectionIsLTR && (args.OriginalKey() == winrt::VirtualKey::GamepadDPadRight)) ||
00529             (!flowDirectionIsLTR && (args.OriginalKey() == winrt::VirtualKey::GamepadDPadLeft)))
00530         {
00531             auto options = winrt::FindNextElementOptions();
00532             options.SearchRoot(this->XamlRoot().Content());
00533             if (winrt::FocusManager::TryMoveFocus(winrt::FocusNavigationDirection::Next, options))
00534             {
00535                 args.Handled(true);
00536                 return;
00537             }
00538         }
00539     }
00540     // Moving to previous element
00541     else if ((flowDirectionIsLTR && keyIsLeft) || (!flowDirectionIsLTR && keyIsRight))
00542     {
00543         if (MoveFocusPrevious())
00544         {
00545             args.Handled(true);
00546             return;
00547         }
00548         else if ((flowDirectionIsLTR && (args.OriginalKey() == winrt::VirtualKey::GamepadDPadLeft)) ||
00549             (!flowDirectionIsLTR && (args.OriginalKey() == winrt::VirtualKey::GamepadDPadRight)))
00550         {
00551             auto options = winrt::FindNextElementOptions();
00552             options.SearchRoot(this->XamlRoot().Content());
00553             if (winrt::FocusManager::TryMoveFocus(winrt::FocusNavigationDirection::Previous, options))
00554             {
00555                 args.Handled(true);
00556                 return;
00557             }
00558         }
00559     }
00560 }
00561
00562 void BreadcrumbBar::OnAccessKeyInvoked(const winrt::UIElement&, const winrt::AccessKeyInvokedEventArgs& args)
00563 {
00564     // If BreadcrumbBar is an AccessKeyScope then we do not want to handle the access
00565     // key invoked event because the user has (probably) set up access keys for the
00566     // BreadcrumbBarItem elements.
00567     if (!IsAccessKeyScope())
00568     {
00569         if (m_focusedIndex)
00570         {
00571             if (auto const itemsRepeater = m_itemsRepeater.get())
00572             {
00573                 if (auto const selectedItem = itemsRepeater.TryGetElement(m_focusedIndex))
00574                 {
00575                     if (auto const selectedItemAsControl = selectedItem.try_as<winrt::Control>())
00576                     {
00577                         args.Handled(selectedItemAsControl.Focus(winrt::FocusState::Programmatic));
00578                         return;
00579                     }
00580                 }
00581             }
00582         }
00583
00584         // If we don't have a selected index, focus the RadioButton's which under normal
00585         // circumstances will put focus on the first radio button.
00586         args.Handled(this->Focus(winrt::FocusState::Programmatic));
00587     }
00588 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SpecialTreeViewNode Member List

This is the complete list of members for SpecialTreeViewNode, including all inherited members.
abi_enter() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
AddExpandedChanged(winrt::TypedEventHandler< winrt::TreeViewNode, winrt::DependencyPropertyChangedEventArgs > const &value) | TreeViewNode |
CheckThread() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
Children() | TreeViewNode |
ChildrenChanged(winrt::TypedEventHandler< winrt::TreeViewNode, winrt::IVectorChangedEventArgs > const &value) | TreeViewNode |
ChildrenChanged(winrt::event_token) | TreeViewNode |
ChildVectorChanged(winrt::IObservableVector< winrt::TreeViewNode > const &sender, winrt::IInspectable const &args) | TreeViewNode |
ClearProperties() | TreeViewNodeProperties | [static]
Content(winrt::IInspectable const &value) | TreeViewNodeProperties |
Content() | TreeViewNodeProperties |
ContentProperty() | TreeViewNodeProperties | [inline, static]
DeleteInstanceOnUIThread(std::unique_ptr< TreeViewNode > &&self) noexcept | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline, static]
Depth(int value) | TreeViewNodeProperties |
Depth() | TreeViewNodeProperties |
DepthProperty() | TreeViewNodeProperties | [inline, static]
EnsureProperties() | TreeViewNodeProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
final_release(std::unique_ptr< TreeViewNode > &&self) | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline, static]
get_ParentImpl() | TreeViewNode |
GetBase() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
GetCustomProperty(hstring const &name) | TreeViewNode |
GetIndexedProperty(hstring const &name, winrt::TypeName const &type) | TreeViewNode |
GetInner() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
GetStringRepresentation() | TreeViewNode |
HasChildren(bool value) | TreeViewNodeProperties |
HasChildren() | TreeViewNodeProperties |
HasChildrenProperty() | TreeViewNodeProperties | [inline, static]
HasUnrealizedChildren() | TreeViewNode |
HasUnrealizedChildren(bool value) | TreeViewNode |
IsContentMode() | TreeViewNode |
IsContentMode(bool value) | TreeViewNode |
IsExpanded(bool value) | TreeViewNodeProperties |
IsExpanded() | TreeViewNodeProperties |
IsExpandedProperty() | TreeViewNodeProperties | [inline, static]
IsOnThread() | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
ItemsSource() | TreeViewNode |
ItemsSource(winrt::IInspectable const &value) | TreeViewNode |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
OnHasChildrenPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewNodeProperties | [static]
OnIsExpandedPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewNodeProperties | [static]
OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewNode |
Parent() | TreeViewNode |
PartialSelected enum value | TreeViewNode |
put_ParentImpl(winrt::TreeViewNode const &value) | TreeViewNode |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
RaiseChildrenChanged(winrt::CollectionChange CC, unsigned int index) | TreeViewNode |
ReferenceTracker(Args &&...args) | ReferenceTracker< TreeViewNode, winrt::implementation::TreeViewNodeT, winrt::Microsoft::UI::Xaml::Data::ICustomPropertyProvider, winrt::Windows::Foundation::IStringable > | [inline]
RemoveExpandedChanged(winrt::event_token) | TreeViewNode |
s_ContentProperty | TreeViewNodeProperties | [static]
s_DepthProperty | TreeViewNodeProperties | [static]
s_HasChildrenProperty | TreeViewNodeProperties | [static]
s_IsExpandedProperty | TreeViewNodeProperties | [static]
Selected enum value | TreeViewNode |
SelectionState() | TreeViewNode |
SelectionState(TreeNodeSelectionState const &state) | TreeViewNode |
ToString() | TreeViewNode |
TreeNodeSelectionState enum name | TreeViewNode |
TreeViewNode() | TreeViewNode |
TreeViewNodeProperties() | TreeViewNodeProperties |
Type() | TreeViewNode |
UnSelected enum value | TreeViewNode |
UpdateDepth(int depth) | TreeViewNode |
UpdateHasChildren() | TreeViewNode |
Generated on Sun Dec 1 2024 20:53:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorPicker Member List

This is the complete list of members for ColorPicker, including all inherited members.
abi_enter() | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
AddGradientStop(const winrt::LinearGradientBrush &brush, double offset, Hsv hsvColor, double alpha) | ColorPicker | [private, static]
AlphaSliderChanged enum value | ColorPicker | [private]
AlphaTextBoxChanged enum value | ColorPicker | [private]
ApplyConstraintsToRgbColor(const Rgb &rgb) | ColorPicker | [private]
CheckThread() | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
ClearProperties() | ColorPickerProperties | [static]
Color(winrt::Color const &value) | ColorPickerProperties |
Color() | ColorPickerProperties |
ColorChanged(winrt::TypedEventHandler< winrt::ColorPicker, winrt::ColorChangedEventArgs > const &value) | ColorPickerProperties |
ColorChanged(winrt::event_token const &token) | ColorPickerProperties |
ColorPicker() | ColorPicker |
ColorPickerProperties() | ColorPickerProperties |
ColorProperty() | ColorPickerProperties | [inline, static]
ColorPropertyChanged enum value | ColorPicker | [private]
ColorSpectrumColorChanged enum value | ColorPicker | [private]
ColorSpectrumComponents(winrt::ColorSpectrumComponents const &value) | ColorPickerProperties |
ColorSpectrumComponents() | ColorPickerProperties |
ColorSpectrumComponentsProperty() | ColorPickerProperties | [inline, static]
ColorSpectrumShape(winrt::ColorSpectrumShape const &value) | ColorPickerProperties |
ColorSpectrumShape() | ColorPickerProperties |
ColorSpectrumShapeProperty() | ColorPickerProperties | [inline, static]
ColorUpdateReason enum name | ColorPicker | [private]
CreateAlphaSliderCheckeredBackground() | ColorPicker | [private]
CreateColorPreviewCheckeredBackground() | ColorPicker | [private]
DeleteInstanceOnUIThread(std::unique_ptr< ColorPicker > &&self) noexcept | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline, static]
EnsureProperties() | ColorPickerProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
final_release(std::unique_ptr< ColorPicker > &&self) | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline, static]
GetBase() | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
GetCheckerColor() | ColorPicker | [private]
GetCurrentHexValue() | ColorPicker | [private]
GetCurrentHsv() | ColorPicker | [inline]
GetHsvColorFromTextBoxes() | ColorPicker | [private]
GetInner() | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
GetRgbColorFromTextBoxes() | ColorPicker | [private]
HexTextBoxChanged enum value | ColorPicker | [private]
HsvTextBoxChanged enum value | ColorPicker | [private]
InitializeColor() | ColorPicker | [private]
InitializingColor enum value | ColorPicker | [private]
IsAlphaEnabled(bool value) | ColorPickerProperties |
IsAlphaEnabled() | ColorPickerProperties |
IsAlphaEnabledProperty() | ColorPickerProperties | [inline, static]
IsAlphaSliderVisible(bool value) | ColorPickerProperties |
IsAlphaSliderVisible() | ColorPickerProperties |
IsAlphaSliderVisibleProperty() | ColorPickerProperties | [inline, static]
IsAlphaTextInputVisible(bool value) | ColorPickerProperties |
IsAlphaTextInputVisible() | ColorPickerProperties |
IsAlphaTextInputVisibleProperty() | ColorPickerProperties | [inline, static]
IsColorChannelTextInputVisible(bool value) | ColorPickerProperties |
IsColorChannelTextInputVisible() | ColorPickerProperties |
IsColorChannelTextInputVisibleProperty() | ColorPickerProperties | [inline, static]
IsColorPreviewVisible(bool value) | ColorPickerProperties |
IsColorPreviewVisible() | ColorPickerProperties |
IsColorPreviewVisibleProperty() | ColorPickerProperties | [inline, static]
IsColorSliderVisible(bool value) | ColorPickerProperties |
IsColorSliderVisible() | ColorPickerProperties |
IsColorSliderVisibleProperty() | ColorPickerProperties | [inline, static]
IsColorSpectrumVisible(bool value) | ColorPickerProperties |
IsColorSpectrumVisible() | ColorPickerProperties |
IsColorSpectrumVisibleProperty() | ColorPickerProperties | [inline, static]
IsHexInputVisible(bool value) | ColorPickerProperties |
IsHexInputVisible() | ColorPickerProperties |
IsHexInputVisibleProperty() | ColorPickerProperties | [inline, static]
IsMoreButtonVisible(bool value) | ColorPickerProperties |
IsMoreButtonVisible() | ColorPickerProperties |
IsMoreButtonVisibleProperty() | ColorPickerProperties | [inline, static]
IsOnThread() | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
m_colorChangedEventSource | ColorPickerProperties |
MaxHue(int value) | ColorPickerProperties |
MaxHue() | ColorPickerProperties |
MaxHueProperty() | ColorPickerProperties | [inline, static]
MaxSaturation(int value) | ColorPickerProperties |
MaxSaturation() | ColorPickerProperties |
MaxSaturationProperty() | ColorPickerProperties | [inline, static]
MaxValue(int value) | ColorPickerProperties |
MaxValue() | ColorPickerProperties |
MaxValueProperty() | ColorPickerProperties | [inline, static]
MinHue(int value) | ColorPickerProperties |
MinHue() | ColorPickerProperties |
MinHueProperty() | ColorPickerProperties | [inline, static]
MinSaturation(int value) | ColorPickerProperties |
MinSaturation() | ColorPickerProperties |
MinSaturationProperty() | ColorPickerProperties | [inline, static]
MinValue(int value) | ColorPickerProperties |
MinValue() | ColorPickerProperties |
MinValueProperty() | ColorPickerProperties | [inline, static]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
OnAlphaSliderBackgroundRectangleSizeChanged(winrt::IInspectable const &sender, winrt::SizeChangedEventArgs const &args) | ColorPicker | [private]
OnAlphaSliderValueChanged(winrt::IInspectable const &sender, winrt::RangeBaseValueChangedEventArgs const &args) | ColorPicker | [private]
OnAlphaTextChanging(winrt::TextBox const &sender, winrt::TextBoxTextChangingEventArgs const &args) | ColorPicker | [private]
OnApplyTemplate() | ColorPicker |
OnCheckerColorChanged(winrt::DependencyObject const &o, winrt::DependencyProperty const &p) | ColorPicker | [private]
OnColorChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnColorPreviewRectangleGridSizeChanged(winrt::IInspectable const &sender, winrt::SizeChangedEventArgs const &args) | ColorPicker | [private]
OnColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnColorRepresentationComboBoxSelectionChanged(winrt::IInspectable const &sender, winrt::SelectionChangedEventArgs const &args) | ColorPicker | [private]
OnColorSpectrumColorChanged(const winrt::ColorSpectrum &sender, const winrt::ColorChangedEventArgs &args) | ColorPicker | [private]
OnColorSpectrumComponentsChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnColorSpectrumComponentsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnColorSpectrumShapePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnColorSpectrumSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &args) | ColorPicker | [private]
OnHexTextChanging(winrt::TextBox const &sender, winrt::TextBoxTextChangingEventArgs const &args) | ColorPicker | [private]
OnHueTextChanging(winrt::TextBox const &sender, winrt::TextBoxTextChangingEventArgs const &args) | ColorPicker | [private]
OnIsAlphaEnabledChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnIsAlphaEnabledPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsAlphaSliderVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsAlphaTextInputVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsColorChannelTextInputVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsColorPreviewVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsColorSliderVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsColorSpectrumVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsHexInputVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsMoreButtonVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMaxHuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMaxSaturationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMaxValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMinHuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMinMaxHueChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnMinMaxSaturationChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnMinMaxValueChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnMinSaturationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMinValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMoreButtonChecked(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | ColorPicker | [private]
OnMoreButtonClicked(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | ColorPicker | [private]
OnMoreButtonUnchecked(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | ColorPicker | [private]
OnOrientationChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnOrientationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnPartVisibilityChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnPreviousColorChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker | [private]
OnPreviousColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorPicker |
OnRgbTextChanging(winrt::TextBox const &sender, winrt::TextBoxTextChangingEventArgs const &args) | ColorPicker | [private]
OnSaturationTextChanging(winrt::TextBox const &sender, winrt::TextBoxTextChangingEventArgs const &args) | ColorPicker | [private]
OnTextBoxGotFocus(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | ColorPicker | [private]
OnTextBoxLostFocus(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | ColorPicker | [private]
OnThirdDimensionSliderValueChanged(winrt::IInspectable const &sender, winrt::RangeBaseValueChangedEventArgs const &args) | ColorPicker | [private]
OnUnloaded(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | ColorPicker | [private]
OnValueTextChanging(winrt::TextBox const &sender, winrt::TextBoxTextChangingEventArgs const &args) | ColorPicker | [private]
Orientation(winrt::Orientation const &value) | ColorPickerProperties |
Orientation() | ColorPickerProperties |
OrientationProperty() | ColorPickerProperties | [inline, static]
PreviousColor(winrt::IReference< winrt::Color > const &value) | ColorPickerProperties |
PreviousColor() | ColorPickerProperties |
PreviousColorProperty() | ColorPickerProperties | [inline, static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ColorPicker, winrt::implementation::ColorPickerT > | [inline]
RgbTextBoxChanged enum value | ColorPicker | [private]
s_ColorProperty | ColorPickerProperties | [static]
s_ColorSpectrumComponentsProperty | ColorPickerProperties | [static]
s_ColorSpectrumShapeProperty | ColorPickerProperties | [static]
s_IsAlphaEnabledProperty | ColorPickerProperties | [static]
s_IsAlphaSliderVisibleProperty | ColorPickerProperties | [static]
s_IsAlphaTextInputVisibleProperty | ColorPickerProperties | [static]
s_IsColorChannelTextInputVisibleProperty | ColorPickerProperties | [static]
s_IsColorPreviewVisibleProperty | ColorPickerProperties | [static]
s_IsColorSliderVisibleProperty | ColorPickerProperties | [static]
s_IsColorSpectrumVisibleProperty | ColorPickerProperties | [static]
s_IsHexInputVisibleProperty | ColorPickerProperties | [static]
s_IsMoreButtonVisibleProperty | ColorPickerProperties | [static]
s_MaxHueProperty | ColorPickerProperties | [static]
s_MaxSaturationProperty | ColorPickerProperties | [static]
s_MaxValueProperty | ColorPickerProperties | [static]
s_MinHueProperty | ColorPickerProperties | [static]
s_MinSaturationProperty | ColorPickerProperties | [static]
s_MinValueProperty | ColorPickerProperties | [static]
s_OrientationProperty | ColorPickerProperties | [static]
s_PreviousColorProperty | ColorPickerProperties | [static]
SetColorAndUpdateControls(ColorUpdateReason reason) | ColorPicker | [private]
SetThirdDimensionSliderChannel() | ColorPicker | [private]
ThirdDimensionSliderChanged enum value | ColorPicker | [private]
UpdateAlphaSlider() | ColorPicker | [private]
UpdateColor(const Rgb &rgb, ColorUpdateReason reason) | ColorPicker | [private]
UpdateColor(const Hsv &hsv, ColorUpdateReason reason) | ColorPicker | [private]
UpdateColor(double alpha, ColorUpdateReason reason) | ColorPicker | [private]
UpdateColorControls(ColorUpdateReason reason) | ColorPicker | [private]
UpdateMoreButton() | ColorPicker | [private]
UpdatePreviousColorRectangle() | ColorPicker | [private]
UpdateThirdDimensionSlider() | ColorPicker | [private]
UpdateVisualState(bool useTransitions) | ColorPicker | [private]
Generated on Sun Dec 1 2024 20:52:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkCanvas/InkCanvasAutomationPeer.cpp Source File

  • InkCanvas

InkCanvasAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿#include "pch.h"
00002 #include "common.h"
00003 #include "InkCanvasAutomationPeer.h"
00004 #include "InkCanvas.h"
00005
00006 #include "InkCanvasAutomationPeer.properties.cpp"
00007
00008 InkCanvasAutomationPeer::InkCanvasAutomationPeer(winrt::InkCanvas const& owner)
00009     : ReferenceTracker(owner)
00010 {
00011 }
00012
00013 hstring InkCanvasAutomationPeer::GetClassNameCore()
00014 {
00015     return winrt::hstring_name_of<winrt::InkCanvas>();
00016 }
00017
00018 winrt::AutomationControlType InkCanvasAutomationPeer::GetAutomationControlTypeCore()
00019 {
00020     return winrt::AutomationControlType::Pane;
00021 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MenuBar/MenuBar.cpp Source File

  • MenuBar

MenuBar.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MenuBar.h"
00007 #include "MenuBarItem.h"
00008 #include "Vector.h"
00009 #include "VectorIterator.h"
00010 #include "MenuBarAutomationPeer.h"
00011
00012 MenuBar::MenuBar()
00013 {
00014     SetDefaultStyleKey(this);
00015
00016     auto items = winrt::make<ObservableVector<winrt::MenuBarItem>>();
00017     SetValue(s_ItemsProperty, items);
00018
00019     auto observableVector = Items().try_as<winrt::IObservableVector<winrt::MenuBarItem>>();
00020     m_itemsVectorChangedRevoker = observableVector.VectorChanged(winrt::auto_revoke,
00021     {
00022         [this](auto const&, auto const&)
00023         {
00024             UpdateAutomationSizeAndPosition();
00025         }
00026     });
00027 }
00028
00029 // IUIElement / IUIElementOverridesHelper
00030 winrt::AutomationPeer MenuBar::OnCreateAutomationPeer()
00031 {
00032     return winrt::make<MenuBarAutomationPeer>(*this);
00033 }
00034
00035 void MenuBar::OnApplyTemplate()
00036 {
00037     SetUpTemplateParts();
00038 }
00039
00040 void MenuBar::SetUpTemplateParts()
00041 {
00042     winrt::IControlProtected thisAsControlProtected = *this;
00043     if (auto layoutRoot = GetTemplateChildT<winrt::Grid>(L"LayoutRoot", thisAsControlProtected))
00044     {
00045         m_layoutRoot.set(layoutRoot);
00046     }
00047     if (auto contentRoot = GetTemplateChildT<winrt::ItemsControl>(L"ContentRoot", thisAsControlProtected))
00048     {
00049         contentRoot.XYFocusKeyboardNavigation(winrt::XYFocusKeyboardNavigationMode::Enabled);
00050
00051         auto observableVector = Items().try_as<winrt::IObservableVector<winrt::MenuBarItem>>();
00052         contentRoot.ItemsSource(observableVector);
00053
00054         m_contentRoot.set(contentRoot);
00055     }
00056 }
00057
00058 void MenuBar::RequestPassThroughElement(const winrt::Microsoft::UI::Xaml::Controls::MenuBarItem& menuBarItem)
00059 {
00060     // To enable switching flyout on hover, every menubar item needs the MenuBar root to include it for hit detection with flyouts open
00061     winrt::get_self<MenuBarItem>(menuBarItem)->AddPassThroughElement(m_layoutRoot.get());
00062 }
00063
00064 void MenuBar::IsFlyoutOpen(bool state)
00065 {
00066     m_isFlyoutOpen = state;
00067 }
00068
00069 // Automation Properties
00070 void MenuBar::UpdateAutomationSizeAndPosition()
00071 {
00072     int sizeOfSet = 0;
00073
00074     for (const auto& item : Items())
00075     {
00076         if (auto itemAsUIElement = item.try_as<winrt::UIElement>())
00077         {
00078             if (itemAsUIElement.Visibility() == winrt::Visibility::Visible)
00079             {
00080                 sizeOfSet++;
00081                 winrt::AutomationProperties::SetPositionInSet(itemAsUIElement, sizeOfSet);
00082             }
00083         }
00084     }
00085
00086     for (const auto& item : Items())
00087     {
00088         if (auto itemAsUIElement = item.try_as<winrt::UIElement>())
00089         {
00090             if (itemAsUIElement.Visibility() == winrt::Visibility::Visible)
00091             {
00092                 winrt::AutomationProperties::SetSizeOfSet(itemAsUIElement, sizeOfSet);
00093             }
00094         }
00095     }
00096 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AnimatedBackVisualSource.properties.cpp Source File

  • Generated

AnimatedBackVisualSource.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "AnimatedBackVisualSource.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(AnimatedBackVisualSource)
00012 }
00013
00014 #include "AnimatedBackVisualSource.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewItemInvokedEventArgs Member List

This is the complete list of members for TreeViewItemInvokedEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
CheckThread() | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< TreeViewItemInvokedEventArgs > &&self) noexcept | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
final_release(std::unique_ptr< TreeViewItemInvokedEventArgs > &&self) | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
GetInner() | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
Handled() | TreeViewItemInvokedEventArgs |
Handled(bool value) | TreeViewItemInvokedEventArgs |
InvokedItem() | TreeViewItemInvokedEventArgs |
InvokedItem(const winrt::IInspectable &invokedItem) | TreeViewItemInvokedEventArgs |
IsOnThread() | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable > | [inline]
Generated on Sun Dec 1 2024 20:53:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/TestUI/ItemsViewTransitionPage.xaml.cs Source File

  • ItemsView
  • TestUI

ItemsViewTransitionPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Composition;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Hosting;
00008 using Microsoft.UI.Xaml.Input;
00009 using Microsoft.UI.Xaml.Media;
00010 using Microsoft.UI.Xaml.Media.Imaging;
00011 using System;
00012 using System.Collections.Generic;
00013 using System.Collections.ObjectModel;
00014 using System.Collections.Specialized;
00015 using System.IO;
00016 using System.Linq;
00017 using System.Numerics;
00018 using Windows.Foundation;
00019 using Windows.Storage;
00020 using Windows.System;
00021 using ItemsViewTestHooks = Microsoft.UI.Private.Controls.ItemsViewTestHooks;
00022
00023 namespace MUXControlsTestApp
00024 {
00025     public class RefreshableCollection<T> : ObservableCollection<T>
00026     {
00027         public void Refresh(IEnumerable<T> newItems)
00028         {
00029             Items.Clear();
00030
00031             foreach (T item in newItems)
00032             {
00033                 Items.Add(item);
00034             }
00035
00036             OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
00037         }
00038     }
00039
00040     public sealed partial class ItemsViewTransitionPage : TestPage
00041     {
00042         readonly RefreshableCollection<BitmapImage> items = new();
00043
00044         public ItemsViewTransitionPage()
00045         {
00046             this.InitializeComponent();
00047
00048             ItemCountComboBox.Items.Add(1);
00049             ItemCountComboBox.Items.Add(5);
00050             ItemCountComboBox.Items.Add(10);
00051             ItemCountComboBox.Items.Add(100);
00052             ItemCountComboBox.SelectedIndex = 0;
00053         }
00054
00055         private void OnItemsViewKeyDown(object sender, KeyRoutedEventArgs e)
00056         {
00057             if (e.Key == VirtualKey.Delete)
00058             {
00059                 DeleteSelectedItem();
00060             }
00061         }
00062
00063         private void OnDeleteButtonClick(object sender, RoutedEventArgs e)
00064         {
00065             DeleteSelectedItem();
00066         }
00067
00068         private void OnAddButtonClick(object sender, RoutedEventArgs e)
00069         {
00070             items.Insert(0, new BitmapImage(new Uri($"ms-appx:///Images/vette6.jpg")));
00071         }
00072
00073         private void OnMoveButtonClick(object sender, RoutedEventArgs e)
00074         {
00075             var selectionModel = ItemsViewTestHooks.GetSelectionModel(itemsView);
00076             if (selectionModel.SelectedIndex?.GetSize() > 0)
00077             {
00078                 int selectedIndex = selectionModel.SelectedIndex.GetAt(0);
00079
00080                 var item = items[selectedIndex];
00081                 items.RemoveAt(selectedIndex);
00082                 items.Insert(0, item);
00083             }
00084         }
00085
00086         private void OnRefreshButtonClick(object sender, RoutedEventArgs e)
00087         {
00088             RefreshItems((int)ItemCountComboBox.SelectedItem);
00089         }
00090
00091         private void OnResetItemTransitionProviderButtonClick(object sender, RoutedEventArgs e)
00092         {
00093             itemsView.ItemTransitionProvider = null;
00094         }
00095
00096         private void OnLayoutSelectionChanged(object sender, SelectionChangedEventArgs e)
00097         {
00098             switch (((ComboBox)sender).SelectedIndex)
00099             {
00100                 case 0:
00101                     itemsView.Layout = null;
00102                     break;
00103                 case 1:
00104                     itemsView.Layout = (LinedFlowLayout)Resources["LinedFlowLayout"];
00105                     itemsView.ItemTransitionProvider = (LinedFlowLayoutItemCollectionTransitionProvider)Resources["LinedFlowLayoutItemCollectionTransitionProvider"];
00106                     break;
00107                 case 2:
00108                     itemsView.Layout = (StackLayout)Resources["StackLayout"];
00109                     break;
00110                 case 3:
00111                     itemsView.Layout = (UniformGridLayout)Resources["UniformGridLayout"];
00112                     break;
00113             }
00114         }
00115
00116         private void DeleteSelectedItem()
00117         {
00118             var selectionModel = ItemsViewTestHooks.GetSelectionModel(itemsView);
00119             if (selectionModel.SelectedIndex?.GetSize() > 0)
00120             {
00121                 int selectedIndex = selectionModel.SelectedIndex.GetAt(0);
00122                 items.RemoveAt(selectedIndex);
00123             }
00124         }
00125
00126         private void RefreshItems(int itemCount)
00127         {
00128             List<BitmapImage> newItems = new();
00129
00130             foreach (int i in Enumerable.Range(0, itemCount))
00131             {
00132                 BitmapImage image = new(new Uri($"ms-appx:///Images/vette{i % 126 + 1}.jpg"));
00133                 newItems.Add(image);
00134             }
00135
00136             items.Refresh(newItems);
00137         }
00138
00139         private void OnClearHistoryButtonClick(object sender, RoutedEventArgs e)
00140         {
00141             TransitionCompletedHistoryTextBox.Text = string.Empty;
00142         }
00143
00144         private void OnTransitionProviderTransitionCompleted(ItemCollectionTransitionProvider sender, ItemCollectionTransitionCompletedEventArgs args)
00145         {
00146             static string BoundsToString(Rect bounds)
00147             {
00148                 return $"({Math.Round(bounds.X)}, {Math.Round(bounds.Y)}, {Math.Round(bounds.Width)}, {Math.Round(bounds.Height)})";
00149             }
00150
00151             TransitionCompletedHistoryTextBox.Text =
00152                 $"Operation = {args.Transition.Operation}, " +
00153                 $"Triggers = {args.Transition.Triggers}, " +
00154                 $"OldBounds = {BoundsToString(args.Transition.OldBounds)}, " +
00155                 $"NewBounds = {BoundsToString(args.Transition.NewBounds)}" +
00156                 (TransitionCompletedHistoryTextBox.Text.Length > 0 ? Environment.NewLine : "") +
00157                 TransitionCompletedHistoryTextBox.Text;
00158         }
00159     }
00160 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewTabItemsSourcePage Member List

This is the complete list of members for TabViewTabItemsSourcePage, including all inherited members.
ChkAllowDrop_Checked(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
ChkAllowDrop_Unchecked(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
ChkCanDrag_Checked(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
ChkCanDrag_Unchecked(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
ChkCanDragItems_Checked(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
ChkCanDragItems_Unchecked(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
ChkCanReorderItems_Checked(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
ChkCanReorderItems_Unchecked(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
CreateNewMyData(int index) | TabViewTabItemsSourcePage | [inline, private]
InitializeDataBindingSampleData() | TabViewTabItemsSourcePage | [inline, private]
initialTabsCount | TabViewTabItemsSourcePage | [private]
innerListView | TabViewTabItemsSourcePage | [private]
myDatas | TabViewTabItemsSourcePage | [private]
TabViewItemsSourceSample_AddTabButtonClick(TabView sender, object args) | TabViewTabItemsSourcePage | [inline, private]
TabViewItemsSourceSample_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args) | TabViewTabItemsSourcePage | [inline, private]
TabViewItemsSourceSample_TabItemsChanged(TabView sender, IVectorChangedEventArgs args) | TabViewTabItemsSourcePage | [inline, private]
TabViewTabItemsSourcePage() | TabViewTabItemsSourcePage | [inline]
TabViewTabItemsSourcePage_Loaded(object sender, RoutedEventArgs e) | TabViewTabItemsSourcePage | [inline, private]
Generated on Sun Dec 1 2024 20:54:39 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: dll/dllmain.cpp Source File

  • dll

dllmain.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "RuntimeProfiler.h"
00007 #include "WinUIrc.ver"
00008 #include <winstring.h>
00009 #include <initguid.h>
00010 #include <wrl\module.h>
00011 #include "LifetimeHandler.h"
00012
00013 using namespace Microsoft::WRL;
00014
00015 #include "MuxcTraceLogging.h"
00016
00017
00018 HINSTANCE g_hInstance = nullptr;
00019
00020 //  Version of the binary, used to distinguish between versions of types
00021 const char *gFileVersion = (const char *)(VER_FILEVERSION_STR);
00022
00023 STDAPI_(void) SendTelemetryOnSuspend();
00024
00025 STDAPI_(BOOL) DllMain(_In_ HINSTANCE hInstance, _In_ DWORD reason, _In_opt_ void *)
00026 {
00027     if (DLL_PROCESS_ATTACH == reason)
00028     {
00029         g_hInstance = hInstance;
00030         DisableThreadLibraryCalls(hInstance);
00031         RegisterTraceLogging();
00032         _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
00033     }
00034     else if (DLL_PROCESS_DETACH == reason)
00035     {
00036         SendTelemetryOnSuspend();
00037         UnRegisterTraceLogging();
00038     }
00039
00040     return TRUE;
00041 }
00042
00043 HRESULT WINAPI DllGetActivationFactory(_In_ HSTRING activatableClassId, _Out_ ::IActivationFactory** factory)
00044 {
00045     // This "FrameworkPackageDetector" class is a breadcrumb to help us detect if we're running in a framework package.
00046     // The way this works is that our WinMD does not contain this type so attempting to activate it will fail. However,
00047     // our framework package AppX contains an activatable class registration for it, so code that tries to activate
00048     // it will succeed in that context.
00049     uint32_t length{};
00050     wchar_t const* const buffer = WindowsGetStringRawBuffer(activatableClassId, &length);
00051     std::wstring_view const name{ buffer, length };
00052     if (name == L"Microsoft.UI.Private.Controls.FrameworkPackageDetector"sv ||
00053         name == L"Microsoft.UI.Private.Controls.CBSPackageDetector"sv)
00054     {
00055         winrt::hstring resources{L"Microsoft.UI.Xaml.Controls.XamlControlsResources"sv};
00056         // It doesn't matter *what* we return so return a type that everyone uses.
00057         return WINRT_GetActivationFactory(winrt::get_abi(resources), reinterpret_cast<void**>(factory));
00058     }
00059
00060     return WINRT_GetActivationFactory(activatableClassId, reinterpret_cast<void**>(factory));
00061 }
00062
00063 __control_entrypoint(DllExport)
00064 HRESULT __stdcall DllCanUnloadNow()
00065 {
00066     return WINRT_CanUnloadNow();
00067 }
00068
00069 // Needed to clear our list of dependency properties between XAML initializations.
00070 STDAPI_(void) DeinitializeMUXC()
00071 {
00072     XamlMetadataProvider::ClearTypes();
00073     MUXControlsFactory::Deinitialize();
00074     RuntimeProfiler::UninitializeRuntimeProfiler();
00075     LifetimeHandler::ClearMaterialHelperInstance();
00076 }
00077
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/InteractionTrackerOwner.h Source File

  • ScrollPresenter

InteractionTrackerOwner.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007
00008 // Class that handles the InteractionTracker callbacks. Has a weak reference back to the ScrollPresenter so it can be garbage-collected,
00009 // since the InteractionTracker keeps a strong reference to this object.
00010 class InteractionTrackerOwner
00011     : public winrt::implements<InteractionTrackerOwner, winrt::IInteractionTrackerOwner>
00012 {
00013 public:
00014     InteractionTrackerOwner(const winrt::ScrollPresenter& scrollPresenter);
00015     ~InteractionTrackerOwner();
00016
00017 #pragma region IInteractionTrackerOwner
00018     void ValuesChanged(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerValuesChangedArgs& args);
00019     void RequestIgnored(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerRequestIgnoredArgs& args);
00020     void InteractingStateEntered(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerInteractingStateEnteredArgs& args);
00021     void InertiaStateEntered(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerInertiaStateEnteredArgs& args);
00022     void IdleStateEntered(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerIdleStateEnteredArgs& args);
00023     void CustomAnimationStateEntered(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerCustomAnimationStateEnteredArgs& args);
00024 #pragma endregion
00025
00026 private:
00027     weak_ref<winrt::ScrollPresenter> m_owner{ nullptr };
00028 };
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SplitButton/SplitButtonTestHelper.h Source File

  • SplitButton

SplitButtonTestHelper.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 class SplitButtonTestHelper :
00007     public winrt::implements<SplitButtonTestHelper, winrt::IInspectable>
00008 {
00009 public:
00010     static void SimulateTouch(bool value);
00011     static bool SimulateTouch();
00012
00013 private:
00014     static com_ptr<SplitButtonTestHelper> EnsureInstance();
00015
00016     bool m_simulateTouch{ false };
00017
00018     static thread_local com_ptr<SplitButtonTestHelper> s_instance;
00019 };
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Common/Flags_Enum.h Source File

  • Common

Flags_Enum.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include <type_traits>
00007
00008 // Specialize this trait with value = true to enable bitwise operators.
00009
00010 template <typename T>
00011 struct is_flags_enum
00012 {
00013     static constexpr bool value = false;
00014 };
00015
00016 template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00017 constexpr T operator|(T lhs, T rhs) noexcept
00018 {
00019     using type = std::underlying_type_t<T>;
00020     return static_cast<T>(static_cast<type>(lhs) | static_cast<type>(rhs));
00021 }
00022
00023 template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00024 constexpr T operator&(T lhs, T rhs) noexcept
00025 {
00026     using type = std::underlying_type_t<T>;
00027     return static_cast<T>(static_cast<type>(lhs) & static_cast<type>(rhs));
00028 }
00029
00030 template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00031 constexpr T operator^(T lhs, T rhs) noexcept
00032 {
00033     using type = std::underlying_type_t<T>;
00034     return static_cast<T>(static_cast<type>(lhs) ^ static_cast<type>(rhs));
00035 }
00036
00037 template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00038 constexpr T operator<<(T lhs, size_t shift) noexcept
00039 {
00040     using type = std::underlying_type_t<T>;
00041     return static_cast<T>(static_cast<type>(lhs) << shift);
00042 }
00043
00044 template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00045 constexpr T operator>>(T lhs, size_t shift) noexcept
00046 {
00047     using type = std::underlying_type_t<T>;
00048     return static_cast<T>(static_cast<type>(lhs) >> shift);
00049 }
00050
00051 template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00052 constexpr T operator~(T lhs) noexcept
00053 {
00054     using type = std::underlying_type_t<T>;
00055     return static_cast<T>(~static_cast<type>(lhs));
00056 }
00057
00058 namespace flags_enum
00059 {
00060     // Tests if ANY of value bits are set on lhs.
00061     template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00062     constexpr bool is_set(T lhs, T value) noexcept
00063     {
00064         using type = std::underlying_type_t<T>;
00065         return static_cast<type>(lhs & value) != static_cast<type>(0);
00066     }
00067
00068     // Tests if ALL of value bits are set on lhs.
00069     template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00070     constexpr bool are_all_set(T lhs, T value) noexcept
00071     {
00072         return (lhs & value) == value;
00073     }
00074
00075     template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00076     constexpr T set(T lhs, T value) noexcept
00077     {
00078         return lhs | value;
00079     }
00080
00081     template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00082     constexpr T unset(T lhs, T value) noexcept
00083     {
00084         return lhs & (~value);
00085     }
00086
00087     template<typename T, typename = std::enable_if_t<std::is_enum<T>::value && is_flags_enum<T>::value>>
00088     constexpr std::underlying_type_t<T> underlying_type(T lhs) noexcept
00089     {
00090         return static_cast<std::underlying_type_t<T>>(lhs);
00091     }
00092 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkCanvas.properties.h Source File

  • Generated

InkCanvas.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InkCanvasProperties
00008 {
00009 public:
00010     InkCanvasProperties();
00011
00012     void IsEnabled(bool value);
00013     bool IsEnabled();
00014
00015     static winrt::DependencyProperty IsEnabledProperty() { return s_IsEnabledProperty; }
00016
00017     static GlobalDependencyProperty s_IsEnabledProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021
00022     static void OnIsEnabledPropertyChanged(
00023         winrt::DependencyObject const& sender,
00024         winrt::DependencyPropertyChangedEventArgs const& args);
00025 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/VisualPropertiesPage.xaml.cs Source File

  • CommonStyles
  • TestUI

VisualPropertiesPage.xaml.cs

Go to the documentation of this file.
00001 ﻿using Microsoft.UI;
00002 using Microsoft.UI.Xaml;
00003 using Microsoft.UI.Xaml.Controls;
00004 using Microsoft.UI.Xaml.Media;
00005 using System;
00006 using System.Collections.Generic;
00007 using System.Collections.ObjectModel;
00008 using System.IO;
00009 using System.Linq;
00010 using System.Runtime.InteropServices.WindowsRuntime;
00011 using Windows.Foundation;
00012 using Windows.Foundation.Collections;
00013
00014 namespace MUXControlsTestApp
00015 {
00016     public class BreadcrumbBarFolder
00017     {
00018         public string Name { get; set; }
00019         public SolidColorBrush Foreground { get; set; }
00020         public SolidColorBrush Background { get; set; }
00021     }
00022
00023     [TopLevelTestPage(Name = "VisualProperties")]
00024     public sealed partial class VisualPropertiesPage : TestPage
00025     {
00026         TreeViewNode treeViewFolder;
00027
00028         public VisualPropertiesPage()
00029         {
00030             this.InitializeComponent();
00031
00032             Loaded += VisualPropertiesPage_Loaded;
00033
00034             DefaultBreadCrumbBar.ItemsSource = new ObservableCollection<BreadcrumbBarFolder>{
00035                 new BreadcrumbBarFolder { Name = "Home"},
00036                 new BreadcrumbBarFolder { Name = "Folder1" },
00037                 new BreadcrumbBarFolder { Name = "Folder2" },
00038                 new BreadcrumbBarFolder { Name = "Folder3" },
00039             };
00040
00041             InitializeSampleTreeView();
00042         }
00043
00044         private void VisualPropertiesPage_Loaded(object sender, RoutedEventArgs e)
00045         {
00046             ForegroundPropertyComboBox.SelectedIndex = 0;
00047             BackgroundPropertyComboBox.SelectedIndex = 0;
00048         }
00049
00050         private void ForegroundPropertyComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00051         {
00052             string colorName = e.AddedItems[0].ToString();
00053             SolidColorBrush color;
00054
00055             switch (colorName)
00056             {
00057                 case "Red":
00058                     color = new SolidColorBrush(Colors.Red);
00059                     break;
00060                 case "Blue":
00061                     color = new SolidColorBrush(Colors.Blue);
00062                     break;
00063                 default:
00064                     throw new Exception($"Invalid argument: {colorName}");
00065             }
00066
00067             SetControlStackPanelForeground(color);
00068         }
00069
00070         private void SetControlStackPanelForeground(SolidColorBrush color)
00071         {
00072
00073             foreach (var child in ControlStackPanel.Children)
00074             {
00075                 if (child is Control)
00076                 {
00077                     (child as Control).Foreground = color;
00078                 }
00079             }
00080         }
00081
00082         private void BackgroundPropertyComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00083         {
00084             string colorName = e.AddedItems[0].ToString();
00085             SolidColorBrush color;
00086
00087             switch (colorName)
00088             {
00089                 case "Green":
00090                     color = new SolidColorBrush(Colors.Green);
00091                     break;
00092                 case "Purple":
00093                     color = new SolidColorBrush(Colors.Purple);
00094                     break;
00095                 default:
00096                     throw new Exception($"Invalid argument: {colorName}");
00097             }
00098
00099             SetControlStackPanelBackground(color);
00100         }
00101
00102         private void SetControlStackPanelBackground(SolidColorBrush color)
00103         {
00104
00105             foreach (var child in ControlStackPanel.Children)
00106             {
00107                 if (child is Control)
00108                 {
00109                     (child as Control).Background = color;
00110                 }
00111             }
00112         }
00113
00114         private void InitializeSampleTreeView()
00115         {
00116             treeViewFolder = new TreeViewNode() { Content = "TreeViewFolder" };
00117             treeViewFolder.IsExpanded = true;
00118             treeViewFolder.Children.Add(new TreeViewNode() { Content = "TreeViewItem1" });
00119
00120             DefaultTreeView.RootNodes.Add(treeViewFolder);
00121         }
00122
00123         private async void ShowDialog_Click(object sender, RoutedEventArgs e)
00124         {
00125             await DefaultContentDialog.ShowAsync();
00126         }
00127     }
00128 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TeachingTip/InteractionTests/TeachingTipTestPageElements.cs Source File

  • TeachingTip
  • InteractionTests

TeachingTipTestPageElements.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00006 using System;
00007 using System.Numerics;
00008 using Common;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00016 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00017 using Microsoft.Windows.Apps.Test.Foundation;
00018
00019 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00020 {
00021     class TeachingTipTestPageElements
00022     {
00023         public ListBox GetLstTeachingTipEvents()
00024         {
00025             return GetElement(ref lstTeachingTipEvents, "lstTeachingTipEvents");
00026         }
00027         private ListBox lstTeachingTipEvents;
00028
00029         public Button GetBtnClearTeachingTipEvents()
00030         {
00031             return GetElement(ref btnClearTeachingTipEvents, "btnClearTeachingTipEvents");
00032         }
00033         private Button btnClearTeachingTipEvents;
00034
00035         public ComboBox GetTipLocationComboBox()
00036         {
00037             return GetElement(ref tipLocationComboBox, "TipLocationComboBox");
00038         }
00039         private ComboBox tipLocationComboBox;
00040
00041         public Button GetSetTipLocationButton()
00042         {
00043             return GetElement(ref setTipLocationButton, "SetTipLocationButton");
00044         }
00045         private Button setTipLocationButton;
00046
00047         public TextBlock GetEffectivePlacementTextBlock()
00048         {
00049             return GetElement(ref effectivePlacementTextBlock, "EffectivePlacementTextBlock");
00050         }
00051         private TextBlock effectivePlacementTextBlock;
00052
00053         public Button GetTargetBoundsButton()
00054         {
00055             return GetElement(ref targetBoundsButton, "GetTargetBoundsButton");
00056         }
00057         private Button targetBoundsButton;
00058
00059         public TextBlock GetTargetXOffsetTextBlock()
00060         {
00061             return GetElement(ref targetXOffsetTextBlock, "TargetXOffsetTextBlock");
00062         }
00063         private TextBlock targetXOffsetTextBlock;
00064
00065         public TextBlock GetTargetYOffsetTextBlock()
00066         {
00067             return GetElement(ref targetYOffsetTextBlock, "TargetYOffsetTextBlock");
00068         }
00069         private TextBlock targetYOffsetTextBlock;
00070
00071         public TextBlock GetTargetWidthTextBlock()
00072         {
00073             return GetElement(ref targetWidthTextBlock, "TargetWidthTextBlock");
00074         }
00075         private TextBlock targetWidthTextBlock;
00076
00077         public TextBlock GetTargetHeightTextBlock()
00078         {
00079             return GetElement(ref targetHeightTextBlock, "TargetHeightTextBlock");
00080         }
00081         private TextBlock targetHeightTextBlock;
00082
00083         public CheckBox GetUseTestWindowBoundsCheckbox()
00084         {
00085             return GetElement(ref useTestWindowBoundsCheckbox, "UseTestWindowBoundsCheckbox");
00086         }
00087         private CheckBox useTestWindowBoundsCheckbox;
00088
00089         public Edit GetTestWindowBoundsXTextBox()
00090         {
00091             return GetElement(ref testWindowBoundsXTextBox, "TestWindowBoundsXTextBox");
00092         }
00093         private Edit testWindowBoundsXTextBox;
00094
00095         public Edit GetTestWindowBoundsYTextBox()
00096         {
00097             return GetElement(ref testWindowBoundsYTextBox, "TestWindowBoundsYTextBox");
00098         }
00099         private Edit testWindowBoundsYTextBox;
00100
00101         public Edit GetTestWindowBoundsWidthTextBox()
00102         {
00103             return GetElement(ref testWindowBoundsWidthTextBox, "TestWindowBoundsWidthTextBox");
00104         }
00105         private Edit testWindowBoundsWidthTextBox;
00106
00107         public Edit GetTestWindowBoundsHeightTextBox()
00108         {
00109             return GetElement(ref testWindowBoundsHeightTextBox, "TestWindowBoundsHeightTextBox");
00110         }
00111         private Edit testWindowBoundsHeightTextBox;
00112
00113         public CheckBox GetUseTestScreenBoundsCheckbox()
00114         {
00115             return GetElement(ref useTestScreenBoundsCheckbox, "UseTestScreenBoundsCheckbox");
00116         }
00117         private CheckBox useTestScreenBoundsCheckbox;
00118
00119         public Edit GetTestScreenBoundsXTextBox()
00120         {
00121             return GetElement(ref testScreenBoundsXTextBox, "TestScreenBoundsXTextBox");
00122         }
00123         private Edit testScreenBoundsXTextBox;
00124
00125         public Edit GetTestScreenBoundsYTextBox()
00126         {
00127             return GetElement(ref testScreenBoundsYTextBox, "TestScreenBoundsYTextBox");
00128         }
00129         private Edit testScreenBoundsYTextBox;
00130
00131         public Edit GetTestScreenBoundsWidthTextBox()
00132         {
00133             return GetElement(ref testScreenBoundsWidthTextBox, "TestScreenBoundsWidthTextBox");
00134         }
00135         private Edit testScreenBoundsWidthTextBox;
00136
00137         public Edit GetTestScreenBoundsHeightTextBox()
00138         {
00139             return GetElement(ref testScreenBoundsHeightTextBox, "TestScreenBoundsHeightTextBox");
00140         }
00141         private Edit testScreenBoundsHeightTextBox;
00142
00143         public TextBlock GetTipWidthTextBlock()
00144         {
00145             return GetElement(ref tipWidthTextBlock, "TipWidthTextBlock");
00146         }
00147         private TextBlock tipWidthTextBlock;
00148
00149         public TextBlock GetScrollViewerStateTextBox()
00150         {
00151             return GetElement(ref scrollViewerStateTextBox, "ScrollViewerStateTextBox");
00152         }
00153         private TextBlock scrollViewerStateTextBox;
00154
00155         public Edit GetScrollViewerOffsetTextBox()
00156         {
00157             return GetElement(ref scrollViewerOffsetTextBox, "ScrollViewerOffsetTextBox");
00158         }
00159         private Edit scrollViewerOffsetTextBox;
00160
00161         public Button GetScrollViewerOffsetButton()
00162         {
00163             return GetElement(ref scrollViewerOffsetButton, "ScrollViewerOffsetButton");
00164         }
00165         private Button scrollViewerOffsetButton;
00166
00167         public TextBlock GetPopupVerticalOffsetTextBlock()
00168         {
00169             return GetElement(ref popupVerticalOffsetTextBlock, "PopupVerticalOffsetTextBlock");
00170         }
00171         private TextBlock popupVerticalOffsetTextBlock;
00172
00173         public ComboBox GetHeroContentComboBox()
00174         {
00175             return GetElement(ref heroContentComboBox, "HeroContentComboBox");
00176         }
00177         private ComboBox heroContentComboBox;
00178
00179         public Button GetSetHeroContentButton()
00180         {
00181             return GetElement(ref setHeroContentButton, "SetHeroContentButton");
00182         }
00183         private Button setHeroContentButton;
00184
00185         public ComboBox GetPreferredPlacementComboBox()
00186         {
00187             return GetElement(ref preferredPlacementComboBox, "PreferredPlacementComboBox");
00188         }
00189         private ComboBox preferredPlacementComboBox;
00190
00191         public Button GetSetPreferredPlacementButton()
00192         {
00193             return GetElement(ref setPreferredPlacementButton, "SetPreferredPlacementButton");
00194         }
00195         private Button setPreferredPlacementButton;
00196
00197         public Button GetSetTargetButton()
00198         {
00199             return GetElement(ref setTargetButton, "SetTargetButton");
00200         }
00201         private Button setTargetButton;
00202
00203         public Button GetRemoveTargetButton()
00204         {
00205             return GetElement(ref removeTargetButton, "RemoveTargetButton");
00206         }
00207         private Button removeTargetButton;
00208
00209         public Button GetSwitchTargetButton()
00210         {
00211             return GetElement(ref SwitchTargetButton, "SwitchTargetButton");
00212         }
00213         private Button SwitchTargetButton;
00214
00215         public ComboBox GetIsLightDismissEnabledComboBox()
00216         {
00217             return GetElement(ref isLightDismissEnabledComboBox, "IsLightDismissEnabledComboBox");
00218         }
00219         private ComboBox isLightDismissEnabledComboBox;
00220
00221         public ComboBox GetCloseButtonContentComboBox()
00222         {
00223             return GetElement(ref closeButtonContentComboBox, "CloseButtonContentComboBox");
00224         }
00225         private ComboBox closeButtonContentComboBox;
00226
00227         public Button GetSetCloseButtonContentButton()
00228         {
00229             return GetElement(ref setCloseButtonContentButton, "SetCloseButtonContentButton");
00230         }
00231         private Button setCloseButtonContentButton;
00232
00233         public Button GetIsLightDismissEnabledButton()
00234         {
00235             return GetElement(ref isLightDismissEnabledButton, "IsLightDismissEnabledButton");
00236         }
00237         private Button isLightDismissEnabledButton;
00238
00239         public ComboBox GetShouldConstrainToRootBoundsComboBox()
00240         {
00241             return GetElement(ref shouldConstrainToRootBoundsComboBox, "ShouldConstrainToRootBoundsComboBox");
00242         }
00243         private ComboBox shouldConstrainToRootBoundsComboBox;
00244
00245         public Button GetShouldConstrainToRootBoundsButton()
00246         {
00247             return GetElement(ref shouldConstrainToRootBoundsButton, "ShouldConstrainToRootBoundsButton");
00248         }
00249         private Button shouldConstrainToRootBoundsButton;
00250
00251         public Button GetShowButton()
00252         {
00253             return GetElement(ref showButton, "ShowButton");
00254         }
00255         private Button showButton;
00256
00257         public Button GetCloseButton()
00258         {
00259             return GetElement(ref closeButton, "CloseButton");
00260         }
00261         private Button closeButton;
00262
00263         public CheckBox GetIsOpenCheckBox()
00264         {
00265             return GetElement(ref isOpenCheckBox, "IsOpenCheckBox");
00266         }
00267         private CheckBox isOpenCheckBox;
00268
00269         public CheckBox GetIsIdleCheckBox()
00270         {
00271             return GetElement(ref isIdleCheckBox, "IsIdleCheckBox");
00272         }
00273         private CheckBox isIdleCheckBox;
00274
00275         public Button GetBringTargetIntoViewButton()
00276         {
00277             return GetElement(ref bringTargetIntoViewButton, "BringTargetIntoViewButton");
00278         }
00279         private Button bringTargetIntoViewButton;
00280
00281         public CheckBox GetTipFollowsTargetCheckBox()
00282         {
00283             return GetElement(ref tipFollowsTargetCheckBox, "TipFollowsTargetCheckBox");
00284         }
00285         private CheckBox tipFollowsTargetCheckBox;
00286
00287         public CheckBox GetReturnTopForOutOfWindowPlacementCheckBox()
00288         {
00289             return GetElement(ref returnTopForOutOfWindowPlacementCheckBox, "ReturnTopForOutOfWindowPlacementCheckBox");
00290         }
00291         private CheckBox returnTopForOutOfWindowPlacementCheckBox;
00292
00293         public ComboBox GetTitleComboBox()
00294         {
00295             return GetElement(ref titleComboBox, "TitleComboBox");
00296         }
00297         private ComboBox titleComboBox;
00298
00299         public Button GetSetTitleButton()
00300         {
00301             return GetElement(ref setTitleButton, "SetTitleButton");
00302         }
00303         private Button setTitleButton;
00304
00305         public ComboBox GetSubtitleComboBox()
00306         {
00307             return GetElement(ref subtitleComboBox, "SubtitleComboBox");
00308         }
00309         private ComboBox subtitleComboBox;
00310
00311         public Button GetSetSubtitleButton()
00312         {
00313             return GetElement(ref setSubtitleButton, "SetSubtitleButton");
00314         }
00315         private Button setSubtitleButton;
00316
00317         public ComboBox GetIconComboBox()
00318         {
00319             return GetElement(ref iconComboBox, "IconComboBox");
00320         }
00321         private ComboBox iconComboBox;
00322
00323         public Button GetSetIconButton()
00324         {
00325             return GetElement(ref setIconButton, "SetIconButton");
00326         }
00327         private Button setIconButton;
00328
00329         public ComboBox GetActionButtonContentComboBox()
00330         {
00331             return GetElement(ref actionButtonContentComboBox, "ActionButtonContentComboBox");
00332         }
00333         private ComboBox actionButtonContentComboBox;
00334
00335         public Button GetSetActionButtonContentButton()
00336         {
00337             return GetElement(ref setActionContentButton, "SetActionContentButton");
00338         }
00339         private Button setActionContentButton;
00340
00341         public ComboBox GetThemingComboBox()
00342         {
00343             return GetElement(ref themingComboBox, "PageThemeComboBox");
00344         }
00345         private ComboBox themingComboBox;
00346
00347         public UIObject GetTeachingTipAlternateCloseButton()
00348         {
00349             ElementCache.Clear();
00350             var element = GetElement(ref teachingTipAlternateCloseButton, "Close");
00351             teachingTipAlternateCloseButton = null;
00352             return element;
00353         }
00354         private UIObject teachingTipAlternateCloseButton;
00355
00356         public UIObject GetTeachingTipCloseButton()
00357         {
00358             ElementCache.Clear();
00359             var element = GetElement(ref teachingTipCloseButton, "C:Short Text.");
00360             teachingTipCloseButton = null;
00361             return element;
00362         }
00363         private UIObject teachingTipCloseButton;
00364
00365         public UIObject GetTitleVisibilityTextBlock()
00366         {
00367             return GetElement(ref titleVisibilityTextBlock, "TitleVisibilityTextBlock");
00368         }
00369         private UIObject titleVisibilityTextBlock;
00370
00371         public UIObject GetSubtitleVisibilityTextBlock()
00372         {
00373             return GetElement(ref subtitleVisibilityTextBlock, "SubtitleVisibilityTextBlock");
00374         }
00375         private UIObject subtitleVisibilityTextBlock;
00376
00377         public ComboBox GetAutomationNameComboBox()
00378         {
00379             return GetElement(ref automationNameComboBox, "AutomationNameComboBox");
00380         }
00381         private ComboBox automationNameComboBox;
00382
00383         public Button GetSetAutomationNameButton()
00384         {
00385             return GetElement(ref setAutomationNameButton, "SetAutomationNameButton");
00386         }
00387         private Button setAutomationNameButton;
00388
00389         public TextBlock GetEffectiveForegroundOfTeachingTipButtonTextBlock()
00390         {
00391             return GetElement(ref effectiveForegroundOfTeachingTipButtonTextBlock, "EffectiveForegroundOfTeachingTipButton");
00392         }
00393         private TextBlock effectiveForegroundOfTeachingTipButtonTextBlock;
00394
00395         public TextBlock GetEffectiveForegroundOfTeachingTipContentTextBlock()
00396         {
00397             return GetElement(ref effectiveForegroundOfTeachingTipContentTextBlock, "EffectiveForegroundOfTeachingTipContent");
00398         }
00399         private TextBlock effectiveForegroundOfTeachingTipContentTextBlock;
00400
00401         public Button GetRemoveTeachingTipButton()
00402         {
00403             return GetElement(ref effectiveRemoveTeachingTipButton, "RemoveTeachingTipButton");
00404         }
00405         private Button effectiveRemoveTeachingTipButton;
00406
00407         public TextBlock GetTeachingTipContent()
00408         {
00409             return GetElement(ref effectiveTeachingTipContent, "TeachingTipContentTextBlock");
00410         }
00411         private TextBlock effectiveTeachingTipContent;
00412
00413         public CheckBox GetTeachingTipContentUnloadedCheck()
00414         {
00415             return GetElement(ref effectiveTeachingTipContentUnloadedCheckbox, "VisualTreeTeachingTipContentTextBlockUnloaded");
00416         }
00417         private CheckBox effectiveTeachingTipContentUnloadedCheckbox;
00418
00419         public CheckBox GetPageRTLCheckbox()
00420         {
00421             return GetElement(ref effectivePageRTLCheckbox, "PageRTLCheckbox");
00422         }
00423         private CheckBox effectivePageRTLCheckbox;
00424
00425         public Button GetRemoveOpenButtonFromVisualTreeButton()
00426         {
00427             return GetElement(ref effectiveRemoveOpenButton, "RemoveButtonFromVisualTreeButton");
00428         }
00429         private Button effectiveRemoveOpenButton;
00430
00431         public Button GetOpenTeachingTipOnEdgeButton()
00432         {
00433             return GetElement(ref effectiveOpenTeachingTipOnEdgeButton, "TargetButtonRightEdge");
00434         }
00435         private Button effectiveOpenTeachingTipOnEdgeButton;
00436
00437         public Button GetTeachingTipOnEdgeOffsetButton()
00438         {
00439             return GetElement(ref effectiveTeachingTipOnEdgeOffsetButton, "GetEdgeTeachingTipOffset");
00440         }
00441         private Button effectiveTeachingTipOnEdgeOffsetButton;
00442
00443         public TextBlock GetTeachingTipOnEdgeOffsetTextblock()
00444         {
00445             return GetElement(ref effectiveTeachingTipOnEdgeOffsetTextblock, "EdgeTeachingTipOffset");
00446         }
00447         private TextBlock effectiveTeachingTipOnEdgeOffsetTextblock;
00448
00449         public double GetTeachingTipOnEdgeHorizontalOffset()
00450         {
00451             return double.Parse(GetTeachingTipOnEdgeOffsetTextblock().GetText().Split(";")[0]);
00452         }
00453         public double GetTeachingTipOnEdgeVerticalOffset()
00454         {
00455             return double.Parse(GetTeachingTipOnEdgeOffsetTextblock().GetText().Split(";")[1]);
00456         }
00457
00458         private T GetElement<T>(ref T element, string elementName) where T : UIObject
00459         {
00460             if (element == null)
00461             {
00462                 Log.Comment("Find the " + elementName);
00463                 element = FindElement.ByNameOrId<T>(elementName);
00464                 Verify.IsNotNull(element);
00465             }
00466             return element;
00467         }
00468
00469         public enum PlacementOptions
00470         {
00471             Top,
00472             Bottom,
00473             Left,
00474             Right,
00475             TopRight,
00476             TopLeft,
00477             BottomRight,
00478             BottomLeft,
00479             LeftTop,
00480             LeftBottom,
00481             RightTop,
00482             RightBottom,
00483             Center,
00484             Auto
00485         }
00486
00487         public enum HeroContentOptions
00488         {
00489             RedSquare,
00490             BlueSquare,
00491             Image,
00492             NoContent
00493         }
00494
00495         public enum TitleContentOptions
00496         {
00497             No,
00498             Small,
00499             Long
00500         }
00501
00502         public enum SubtitleContentOptions
00503         {
00504             No,
00505             Small,
00506             Long
00507         }
00508
00509         public enum IconOptions
00510         {
00511             People,
00512             NoIcon
00513         }
00514
00515         public enum TipLocationOptions
00516         {
00517             ResourceDictionary,
00518             VisualTree
00519         }
00520
00521         public enum CloseButtonContentOptions
00522         {
00523             NoText,
00524             ShortText,
00525             LongText
00526         }
00527
00528         public enum AutomationNameOptions
00529         {
00530             VisualTree,
00531             Resources,
00532             None
00533         }
00534     }
00535 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LifetimeHandler Member List

This is the complete list of members for LifetimeHandler, including all inherited members.
ClearMaterialHelperInstance() | LifetimeHandler | [static]
GetMaterialHelperInstance() | LifetimeHandler | [static]
Instance() | LifetimeHandler | [private, static]
LifetimeHandler() | LifetimeHandler |
m_materialHelper | LifetimeHandler | [private]
s_tlsInstanceNoRef | LifetimeHandler | [private, static]
TryGetMaterialHelperInstance() | LifetimeHandler | [static]
~LifetimeHandler() | LifetimeHandler |
Generated on Sun Dec 1 2024 20:52:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsViewTransitionPage Member List

This is the complete list of members for ItemsViewTransitionPage, including all inherited members.
DeleteSelectedItem() | ItemsViewTransitionPage | [inline, private]
items | ItemsViewTransitionPage | [private]
ItemsViewTransitionPage() | ItemsViewTransitionPage | [inline]
OnAddButtonClick(object sender, RoutedEventArgs e) | ItemsViewTransitionPage | [inline, private]
OnClearHistoryButtonClick(object sender, RoutedEventArgs e) | ItemsViewTransitionPage | [inline, private]
OnDeleteButtonClick(object sender, RoutedEventArgs e) | ItemsViewTransitionPage | [inline, private]
OnItemsViewKeyDown(object sender, KeyRoutedEventArgs e) | ItemsViewTransitionPage | [inline, private]
OnLayoutSelectionChanged(object sender, SelectionChangedEventArgs e) | ItemsViewTransitionPage | [inline, private]
OnMoveButtonClick(object sender, RoutedEventArgs e) | ItemsViewTransitionPage | [inline, private]
OnRefreshButtonClick(object sender, RoutedEventArgs e) | ItemsViewTransitionPage | [inline, private]
OnResetItemTransitionProviderButtonClick(object sender, RoutedEventArgs e) | ItemsViewTransitionPage | [inline, private]
OnTransitionProviderTransitionCompleted(ItemCollectionTransitionProvider sender, ItemCollectionTransitionCompletedEventArgs args) | ItemsViewTransitionPage | [inline, private]
RefreshItems(int itemCount) | ItemsViewTransitionPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RatingControl.properties.cpp Source File

  • Generated

RatingControl.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RatingControl.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(RatingControl)
00012 }
00013
00014 #include "RatingControl.g.cpp"
00015
00016 GlobalDependencyProperty RatingControlProperties::s_CaptionProperty{ nullptr };
00017 GlobalDependencyProperty RatingControlProperties::s_InitialSetValueProperty{ nullptr };
00018 GlobalDependencyProperty RatingControlProperties::s_IsClearEnabledProperty{ nullptr };
00019 GlobalDependencyProperty RatingControlProperties::s_IsReadOnlyProperty{ nullptr };
00020 GlobalDependencyProperty RatingControlProperties::s_ItemInfoProperty{ nullptr };
00021 GlobalDependencyProperty RatingControlProperties::s_MaxRatingProperty{ nullptr };
00022 GlobalDependencyProperty RatingControlProperties::s_PlaceholderValueProperty{ nullptr };
00023 GlobalDependencyProperty RatingControlProperties::s_ValueProperty{ nullptr };
00024
00025 RatingControlProperties::RatingControlProperties()
00026     : m_valueChangedEventSource{static_cast<RatingControl*>(this)}
00027 {
00028     EnsureProperties();
00029 }
00030
00031 void RatingControlProperties::EnsureProperties()
00032 {
00033     if (!s_CaptionProperty)
00034     {
00035         s_CaptionProperty =
00036             InitializeDependencyProperty(
00037                 L"Caption",
00038                 winrt::name_of<winrt::hstring>(),
00039                 winrt::name_of<winrt::RatingControl>(),
00040                 false /* isAttached */,
00041                 ValueHelper<winrt::hstring>::BoxedDefaultValue(),
00042                 winrt::PropertyChangedCallback(&OnCaptionPropertyChanged));
00043     }
00044     if (!s_InitialSetValueProperty)
00045     {
00046         s_InitialSetValueProperty =
00047             InitializeDependencyProperty(
00048                 L"InitialSetValue",
00049                 winrt::name_of<int>(),
00050                 winrt::name_of<winrt::RatingControl>(),
00051                 false /* isAttached */,
00052                 ValueHelper<int>::BoxValueIfNecessary(1),
00053                 winrt::PropertyChangedCallback(&OnInitialSetValuePropertyChanged));
00054     }
00055     if (!s_IsClearEnabledProperty)
00056     {
00057         s_IsClearEnabledProperty =
00058             InitializeDependencyProperty(
00059                 L"IsClearEnabled",
00060                 winrt::name_of<bool>(),
00061                 winrt::name_of<winrt::RatingControl>(),
00062                 false /* isAttached */,
00063                 ValueHelper<bool>::BoxValueIfNecessary(true),
00064                 winrt::PropertyChangedCallback(&OnIsClearEnabledPropertyChanged));
00065     }
00066     if (!s_IsReadOnlyProperty)
00067     {
00068         s_IsReadOnlyProperty =
00069             InitializeDependencyProperty(
00070                 L"IsReadOnly",
00071                 winrt::name_of<bool>(),
00072                 winrt::name_of<winrt::RatingControl>(),
00073                 false /* isAttached */,
00074                 ValueHelper<bool>::BoxedDefaultValue(),
00075                 winrt::PropertyChangedCallback(&OnIsReadOnlyPropertyChanged));
00076     }
00077     if (!s_ItemInfoProperty)
00078     {
00079         s_ItemInfoProperty =
00080             InitializeDependencyProperty(
00081                 L"ItemInfo",
00082                 winrt::name_of<winrt::RatingItemInfo>(),
00083                 winrt::name_of<winrt::RatingControl>(),
00084                 false /* isAttached */,
00085                 ValueHelper<winrt::RatingItemInfo>::BoxedDefaultValue(),
00086                 winrt::PropertyChangedCallback(&OnItemInfoPropertyChanged));
00087     }
00088     if (!s_MaxRatingProperty)
00089     {
00090         s_MaxRatingProperty =
00091             InitializeDependencyProperty(
00092                 L"MaxRating",
00093                 winrt::name_of<int>(),
00094                 winrt::name_of<winrt::RatingControl>(),
00095                 false /* isAttached */,
00096                 ValueHelper<int>::BoxValueIfNecessary(5),
00097                 winrt::PropertyChangedCallback(&OnMaxRatingPropertyChanged));
00098     }
00099     if (!s_PlaceholderValueProperty)
00100     {
00101         s_PlaceholderValueProperty =
00102             InitializeDependencyProperty(
00103                 L"PlaceholderValue",
00104                 winrt::name_of<double>(),
00105                 winrt::name_of<winrt::RatingControl>(),
00106                 false /* isAttached */,
00107                 ValueHelper<double>::BoxValueIfNecessary(-1),
00108                 winrt::PropertyChangedCallback(&OnPlaceholderValuePropertyChanged));
00109     }
00110     if (!s_ValueProperty)
00111     {
00112         s_ValueProperty =
00113             InitializeDependencyProperty(
00114                 L"Value",
00115                 winrt::name_of<double>(),
00116                 winrt::name_of<winrt::RatingControl>(),
00117                 false /* isAttached */,
00118                 ValueHelper<double>::BoxValueIfNecessary(-1),
00119                 winrt::PropertyChangedCallback(&OnValuePropertyChanged));
00120     }
00121 }
00122
00123 void RatingControlProperties::ClearProperties()
00124 {
00125     s_CaptionProperty = nullptr;
00126     s_InitialSetValueProperty = nullptr;
00127     s_IsClearEnabledProperty = nullptr;
00128     s_IsReadOnlyProperty = nullptr;
00129     s_ItemInfoProperty = nullptr;
00130     s_MaxRatingProperty = nullptr;
00131     s_PlaceholderValueProperty = nullptr;
00132     s_ValueProperty = nullptr;
00133 }
00134
00135 void RatingControlProperties::OnCaptionPropertyChanged(
00136     winrt::DependencyObject const& sender,
00137     winrt::DependencyPropertyChangedEventArgs const& args)
00138 {
00139     auto owner = sender.as<winrt::RatingControl>();
00140     winrt::get_self<RatingControl>(owner)->OnPropertyChanged(args);
00141 }
00142
00143 void RatingControlProperties::OnInitialSetValuePropertyChanged(
00144     winrt::DependencyObject const& sender,
00145     winrt::DependencyPropertyChangedEventArgs const& args)
00146 {
00147     auto owner = sender.as<winrt::RatingControl>();
00148     winrt::get_self<RatingControl>(owner)->OnPropertyChanged(args);
00149 }
00150
00151 void RatingControlProperties::OnIsClearEnabledPropertyChanged(
00152     winrt::DependencyObject const& sender,
00153     winrt::DependencyPropertyChangedEventArgs const& args)
00154 {
00155     auto owner = sender.as<winrt::RatingControl>();
00156     winrt::get_self<RatingControl>(owner)->OnPropertyChanged(args);
00157 }
00158
00159 void RatingControlProperties::OnIsReadOnlyPropertyChanged(
00160     winrt::DependencyObject const& sender,
00161     winrt::DependencyPropertyChangedEventArgs const& args)
00162 {
00163     auto owner = sender.as<winrt::RatingControl>();
00164     winrt::get_self<RatingControl>(owner)->OnPropertyChanged(args);
00165 }
00166
00167 void RatingControlProperties::OnItemInfoPropertyChanged(
00168     winrt::DependencyObject const& sender,
00169     winrt::DependencyPropertyChangedEventArgs const& args)
00170 {
00171     auto owner = sender.as<winrt::RatingControl>();
00172     winrt::get_self<RatingControl>(owner)->OnPropertyChanged(args);
00173 }
00174
00175 void RatingControlProperties::OnMaxRatingPropertyChanged(
00176     winrt::DependencyObject const& sender,
00177     winrt::DependencyPropertyChangedEventArgs const& args)
00178 {
00179     auto owner = sender.as<winrt::RatingControl>();
00180     winrt::get_self<RatingControl>(owner)->OnPropertyChanged(args);
00181 }
00182
00183 void RatingControlProperties::OnPlaceholderValuePropertyChanged(
00184     winrt::DependencyObject const& sender,
00185     winrt::DependencyPropertyChangedEventArgs const& args)
00186 {
00187     auto owner = sender.as<winrt::RatingControl>();
00188     winrt::get_self<RatingControl>(owner)->OnPropertyChanged(args);
00189 }
00190
00191 void RatingControlProperties::OnValuePropertyChanged(
00192     winrt::DependencyObject const& sender,
00193     winrt::DependencyPropertyChangedEventArgs const& args)
00194 {
00195     auto owner = sender.as<winrt::RatingControl>();
00196     winrt::get_self<RatingControl>(owner)->OnPropertyChanged(args);
00197 }
00198
00199 void RatingControlProperties::Caption(winrt::hstring const& value)
00200 {
00201     [[gsl::suppress(con)]]
00202     {
00203     static_cast<RatingControl*>(this)->SetValue(s_CaptionProperty, ValueHelper<winrt::hstring>::BoxValueIfNecessary(value));
00204     }
00205 }
00206
00207 winrt::hstring RatingControlProperties::Caption()
00208 {
00209     return ValueHelper<winrt::hstring>::CastOrUnbox(static_cast<RatingControl*>(this)->GetValue(s_CaptionProperty));
00210 }
00211
00212 void RatingControlProperties::InitialSetValue(int value)
00213 {
00214     [[gsl::suppress(con)]]
00215     {
00216     static_cast<RatingControl*>(this)->SetValue(s_InitialSetValueProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00217     }
00218 }
00219
00220 int RatingControlProperties::InitialSetValue()
00221 {
00222     return ValueHelper<int>::CastOrUnbox(static_cast<RatingControl*>(this)->GetValue(s_InitialSetValueProperty));
00223 }
00224
00225 void RatingControlProperties::IsClearEnabled(bool value)
00226 {
00227     [[gsl::suppress(con)]]
00228     {
00229     static_cast<RatingControl*>(this)->SetValue(s_IsClearEnabledProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00230     }
00231 }
00232
00233 bool RatingControlProperties::IsClearEnabled()
00234 {
00235     return ValueHelper<bool>::CastOrUnbox(static_cast<RatingControl*>(this)->GetValue(s_IsClearEnabledProperty));
00236 }
00237
00238 void RatingControlProperties::IsReadOnly(bool value)
00239 {
00240     [[gsl::suppress(con)]]
00241     {
00242     static_cast<RatingControl*>(this)->SetValue(s_IsReadOnlyProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00243     }
00244 }
00245
00246 bool RatingControlProperties::IsReadOnly()
00247 {
00248     return ValueHelper<bool>::CastOrUnbox(static_cast<RatingControl*>(this)->GetValue(s_IsReadOnlyProperty));
00249 }
00250
00251 void RatingControlProperties::ItemInfo(winrt::RatingItemInfo const& value)
00252 {
00253     [[gsl::suppress(con)]]
00254     {
00255     static_cast<RatingControl*>(this)->SetValue(s_ItemInfoProperty, ValueHelper<winrt::RatingItemInfo>::BoxValueIfNecessary(value));
00256     }
00257 }
00258
00259 winrt::RatingItemInfo RatingControlProperties::ItemInfo()
00260 {
00261     return ValueHelper<winrt::RatingItemInfo>::CastOrUnbox(static_cast<RatingControl*>(this)->GetValue(s_ItemInfoProperty));
00262 }
00263
00264 void RatingControlProperties::MaxRating(int value)
00265 {
00266     [[gsl::suppress(con)]]
00267     {
00268     static_cast<RatingControl*>(this)->SetValue(s_MaxRatingProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00269     }
00270 }
00271
00272 int RatingControlProperties::MaxRating()
00273 {
00274     return ValueHelper<int>::CastOrUnbox(static_cast<RatingControl*>(this)->GetValue(s_MaxRatingProperty));
00275 }
00276
00277 void RatingControlProperties::PlaceholderValue(double value)
00278 {
00279     [[gsl::suppress(con)]]
00280     {
00281     static_cast<RatingControl*>(this)->SetValue(s_PlaceholderValueProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00282     }
00283 }
00284
00285 double RatingControlProperties::PlaceholderValue()
00286 {
00287     return ValueHelper<double>::CastOrUnbox(static_cast<RatingControl*>(this)->GetValue(s_PlaceholderValueProperty));
00288 }
00289
00290 void RatingControlProperties::Value(double value)
00291 {
00292     [[gsl::suppress(con)]]
00293     {
00294     static_cast<RatingControl*>(this)->SetValue(s_ValueProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00295     }
00296 }
00297
00298 double RatingControlProperties::Value()
00299 {
00300     return ValueHelper<double>::CastOrUnbox(static_cast<RatingControl*>(this)->GetValue(s_ValueProperty));
00301 }
00302
00303 winrt::event_token RatingControlProperties::ValueChanged(winrt::TypedEventHandler<winrt::RatingControl, winrt::IInspectable> const& value)
00304 {
00305     return m_valueChangedEventSource.add(value);
00306 }
00307
00308 void RatingControlProperties::ValueChanged(winrt::event_token const& token)
00309 {
00310     m_valueChangedEventSource.remove(token);
00311 }
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterTestHooks.h Source File

  • ScrollPresenter

ScrollPresenterTestHooks.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ScrollPresenter.h"
00007 #include "ScrollPresenterTestHooksAnchorEvaluatedEventArgs.h"
00008 #include "ScrollPresenterTestHooksInteractionSourcesChangedEventArgs.h"
00009 #include "ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs.h"
00010 #include "ScrollPresenterTestHooks.g.h"
00011 #include "RegUtil.h"
00012
00013 class ScrollPresenterTestHooks :
00014     public winrt::implementation::ScrollPresenterTestHooksT<ScrollPresenterTestHooks>
00015 {
00016 public:
00017     ScrollPresenterTestHooks();
00018
00019     static com_ptr<ScrollPresenterTestHooks> GetGlobalTestHooks()
00020     {
00021         return s_testHooks;
00022     }
00023
00024     static com_ptr<ScrollPresenterTestHooks> EnsureGlobalTestHooks();
00025
00026     static bool AreAnchorNotificationsRaised();
00027     static void AreAnchorNotificationsRaised(bool areAnchorNotificationsRaised);
00028     static bool AreInteractionSourcesNotificationsRaised();
00029     static void AreInteractionSourcesNotificationsRaised(bool areInteractionSourcesNotificationsRaised);
00030     static bool AreExpressionAnimationStatusNotificationsRaised();
00031     static void AreExpressionAnimationStatusNotificationsRaised(bool areExpressionAnimationStatusNotificationsRaised);
00032     static winrt::IReference<bool> IsAnimationsEnabledOverride();
00033     static void IsAnimationsEnabledOverride(winrt::IReference<bool> isAnimationsEnabledOverride);
00034     static void GetOffsetsChangeVelocityParameters(int& millisecondsPerUnit, int& minMilliseconds, int& maxMilliseconds);
00035     static void SetOffsetsChangeVelocityParameters(int millisecondsPerUnit, int minMilliseconds, int maxMilliseconds);
00036     static void GetZoomFactorChangeVelocityParameters(int& millisecondsPerUnit, int& minMilliseconds, int& maxMilliseconds);
00037     static void SetZoomFactorChangeVelocityParameters(int millisecondsPerUnit, int minMilliseconds, int maxMilliseconds);
00038     static void GetContentLayoutOffsetX(const winrt::ScrollPresenter& scrollPresenter, float& contentLayoutOffsetX);
00039     static void SetContentLayoutOffsetX(const winrt::ScrollPresenter& scrollPresenter, float contentLayoutOffsetX);
00040     static void GetContentLayoutOffsetY(const winrt::ScrollPresenter& scrollPresenter, float& contentLayoutOffsetY);
00041     static void SetContentLayoutOffsetY(const winrt::ScrollPresenter& scrollPresenter, float contentLayoutOffsetY);
00042     static winrt::hstring GetTransformExpressionAnimationExpression(const winrt::ScrollPresenter& scrollPresenter);
00043     static void SetTransformExpressionAnimationExpression(const winrt::ScrollPresenter& scrollPresenter, winrt::hstring const& transformExpressionAnimationExpression);
00044     static winrt::hstring GetMinPositionExpressionAnimationExpression(const winrt::ScrollPresenter& scrollPresenter);
00045     static void SetMinPositionExpressionAnimationExpression(const winrt::ScrollPresenter& scrollPresenter, winrt::hstring const& minPositionExpressionAnimationExpression);
00046     static winrt::hstring GetMaxPositionExpressionAnimationExpression(const winrt::ScrollPresenter& scrollPresenter);
00047     static void SetMaxPositionExpressionAnimationExpression(const winrt::ScrollPresenter& scrollPresenter, winrt::hstring const& maxPositionExpressionAnimationExpression);
00048     static winrt::float2 GetArrangeRenderSizesDelta(const winrt::ScrollPresenter& scrollPresenter);
00049     static winrt::float2 GetPosition(const winrt::ScrollPresenter& scrollPresenter);
00050     static winrt::float2 GetMinPosition(const winrt::ScrollPresenter& scrollPresenter);
00051     static void SetMinPosition(const winrt::ScrollPresenter& scrollPresenter, winrt::float2 minPosition);
00052     static winrt::float2 GetMaxPosition(const winrt::ScrollPresenter& scrollPresenter);
00053     static void SetMaxPosition(const winrt::ScrollPresenter& scrollPresenter, winrt::float2 maxPosition);
00054     static winrt::ScrollPresenterViewChangeResult GetScrollCompletedResult(const winrt::ScrollingScrollCompletedEventArgs& scrollCompletedEventArgs);
00055     static winrt::ScrollPresenterViewChangeResult GetZoomCompletedResult(const winrt::ScrollingZoomCompletedEventArgs& zoomCompletedEventArgs);
00056
00057     static void NotifyAnchorEvaluated(const winrt::ScrollPresenter& sender, const winrt::UIElement& anchorElement, double viewportAnchorPointHorizontalOffset, double viewportAnchorPointVerticalOffset);
00058     static winrt::event_token AnchorEvaluated(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollPresenterTestHooksAnchorEvaluatedEventArgs> const& value);
00059     static void AnchorEvaluated(winrt::event_token const& token);
00060
00061     static void NotifyInteractionSourcesChanged(const winrt::ScrollPresenter& sender, const winrt::Microsoft::UI::Composition::Interactions::CompositionInteractionSourceCollection& interactionSources);
00062     static winrt::event_token InteractionSourcesChanged(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollPresenterTestHooksInteractionSourcesChangedEventArgs> const& value);
00063     static void InteractionSourcesChanged(winrt::event_token const& token);
00064
00065     static void NotifyExpressionAnimationStatusChanged(const winrt::ScrollPresenter& sender, bool isExpressionAnimationStarted, wstring_view const& propertyName);
00066     static winrt::event_token ExpressionAnimationStatusChanged(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs> const& value);
00067     static void ExpressionAnimationStatusChanged(winrt::event_token const& token);
00068
00069     static void NotifyContentLayoutOffsetXChanged(const winrt::ScrollPresenter& sender);
00070     static winrt::event_token ContentLayoutOffsetXChanged(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable> const& value);
00071     static void ContentLayoutOffsetXChanged(winrt::event_token const& token);
00072
00073     static void NotifyContentLayoutOffsetYChanged(const winrt::ScrollPresenter& sender);
00074     static winrt::event_token ContentLayoutOffsetYChanged(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable> const& value);
00075     static void ContentLayoutOffsetYChanged(winrt::event_token const& token);
00076
00077     static winrt::IVector<winrt::ScrollSnapPointBase> GetConsolidatedHorizontalScrollSnapPoints(const winrt::ScrollPresenter& scrollPresenter);
00078     static winrt::IVector<winrt::ScrollSnapPointBase> GetConsolidatedVerticalScrollSnapPoints(const winrt::ScrollPresenter& scrollPresenter);
00079     static winrt::IVector<winrt::ZoomSnapPointBase> GetConsolidatedZoomSnapPoints(const winrt::ScrollPresenter& scrollPresenter);
00080     static winrt::float2 GetHorizontalSnapPointActualApplicableZone(
00081         const winrt::ScrollPresenter& scrollPresenter,
00082         const winrt::ScrollSnapPointBase& scrollSnapPoint);
00083     static winrt::float2 GetVerticalSnapPointActualApplicableZone(
00084         const winrt::ScrollPresenter& scrollPresenter,
00085         const winrt::ScrollSnapPointBase& scrollSnapPoint);
00086     static winrt::float2 GetZoomSnapPointActualApplicableZone(
00087         const winrt::ScrollPresenter& scrollPresenter,
00088         const winrt::ZoomSnapPointBase& zoomSnapPoint);
00089     static int GetHorizontalSnapPointCombinationCount(
00090         const winrt::ScrollPresenter& scrollPresenter,
00091         const winrt::ScrollSnapPointBase& scrollSnapPoint);
00092     static int GetVerticalSnapPointCombinationCount(
00093         const winrt::ScrollPresenter& scrollPresenter,
00094         const winrt::ScrollSnapPointBase& scrollSnapPoint);
00095     static int GetZoomSnapPointCombinationCount(
00096         const winrt::ScrollPresenter& scrollPresenter,
00097         const winrt::ZoomSnapPointBase& zoomSnapPoint);
00098     static winrt::Color GetSnapPointVisualizationColor(const winrt::SnapPointBase& snapPoint);
00099     static void SetSnapPointVisualizationColor(const winrt::SnapPointBase& snapPoint, const winrt::Color& color);
00100
00101 private:
00102     static winrt::ScrollPresenterViewChangeResult TestHooksViewChangeResult(ScrollPresenterViewChangeResult result);
00103
00104     static com_ptr<ScrollPresenterTestHooks> s_testHooks;
00105     winrt::event<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollPresenterTestHooksAnchorEvaluatedEventArgs>> m_anchorEvaluatedEventSource;
00106     winrt::event<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollPresenterTestHooksInteractionSourcesChangedEventArgs>> m_interactionSourcesChangedEventSource;
00107     winrt::event<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs>> m_expressionAnimationStatusChangedEventSource;
00108     winrt::event<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable>> m_contentLayoutOffsetXChangedEventSource;
00109     winrt::event<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable>> m_contentLayoutOffsetYChangedEventSource;
00110     bool m_areAnchorNotificationsRaised{ false };
00111     bool m_areInteractionSourcesNotificationsRaised{ false };
00112     bool m_areExpressionAnimationStatusNotificationsRaised{ false };
00113     winrt::IReference<bool> m_isAnimationsEnabledOverride{ nullptr };
00114     int m_offsetsChangeMsPerUnit{ ScrollPresenter::s_offsetsChangeMsPerUnit };
00115     int m_offsetsChangeMinMs{ ScrollPresenter::s_offsetsChangeMinMs };
00116     int m_offsetsChangeMaxMs{ ScrollPresenter::s_offsetsChangeMaxMs };
00117     int m_zoomFactorChangeMsPerUnit{ ScrollPresenter::s_zoomFactorChangeMsPerUnit };
00118     int m_zoomFactorChangeMinMs{ ScrollPresenter::s_zoomFactorChangeMinMs };
00119     int m_zoomFactorChangeMaxMs{ ScrollPresenter::s_zoomFactorChangeMaxMs };
00120 };
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorChangedEventArgs Member List

This is the complete list of members for ColorChangedEventArgs, including all inherited members.
NewColor() | ColorChangedEventArgs
NewColor(winrt::Color const &value) | ColorChangedEventArgs
OldColor() | ColorChangedEventArgs
OldColor(winrt::Color const &value) | ColorChangedEventArgs
Generated on Sun Dec 1 2024 20:52:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NumberBoxParser Member List

This is the complete list of members for NumberBoxParser, including all inherited members.
Compute(const std::wstring_view expr, const winrt::INumberParser &numberParser) | NumberBoxParser | [static]
ComputePostfixExpression(const std::vector< MathToken > &tokens) | NumberBoxParser | [private, static]
ConvertInfixToPostfix(const std::vector< MathToken > &tokens) | NumberBoxParser | [private, static]
GetNextNumber(const std::wstring &input, const winrt::INumberParser &numberParser) | NumberBoxParser | [private, static]
GetPrecedenceValue(wchar_t c) | NumberBoxParser | [private, static]
GetTokens(const wchar_t *input, const winrt::INumberParser &numberParser) | NumberBoxParser | [private, static]
Generated on Sun Dec 1 2024 20:52:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealBasicPage Member List

This is the complete list of members for RevealBasicPage, including all inherited members.
OnBackgroundColorButtonClick(object sender, RoutedEventArgs e) | RevealBasicPage | [inline, private]
OnChangeDefaultPositionClick(object sender, RoutedEventArgs e) | RevealBasicPage | [inline, private]
RevealBasicPage() | RevealBasicPage | [inline]
Generated on Sun Dec 1 2024 20:54:25 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IconSourceApiTests Member List

This is the complete list of members for IconSourceApiTests, including all inherited members.
AnimatedIconSourceTest() | IconSourceApiTests | [inline]
ImageIconSourceTest() | IconSourceApiTests | [inline]
Generated on Sun Dec 1 2024 20:53:34 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/TestUI/TreeStructure.cs Source File

  • Breadcrumb
  • TestUI

TreeStructure.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004
00005 namespace Breadcrumb_TestUI
00006 {
00007     class TreeStructure
00008     {
00009         public TreeNode Root = null;
00010
00011         public List<TreeNode> GetRootAsList()
00012         {
00013             return new List<TreeNode>() { Root };
00014         }
00015
00016         public void UpdateParents()
00017         {
00018             Root.UpdateParents(null);
00019         }
00020     }
00021
00022     public class TreeNode
00023     {
00024         private TreeNode Parent = null;
00025         public string Name { get; set; }
00026
00027         public List<object> Children { get; set; } = new List<object>();
00028
00029         public List<object> GetBreadCrumbPath()
00030         {
00031             List<object> path = new List<object>();
00032
00033             TreeNode currentNode = this;
00034             while (currentNode != null)
00035             {
00036                 path.Add(currentNode);
00037                 currentNode = currentNode.Parent;
00038             }
00039
00040             path.Reverse();
00041
00042             return path;
00043         }
00044
00045         public void UpdateParents(TreeNode parent)
00046         {
00047             Parent = parent;
00048             foreach (TreeNode node in Children)
00049             {
00050                 node.UpdateParents(this);
00051             }
00052         }
00053
00054         public override string ToString()
00055         {
00056             return Name;
00057         }
00058
00059         public string CustomAutomationName
00060         {
00061             get
00062             {
00063                 return "Custom automation name " + Name;
00064             }
00065         }
00066     }
00067 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewTopNavOverflowButtonPage Member List

This is the complete list of members for NavigationViewTopNavOverflowButtonPage, including all inherited members.
AddItem4Button_Click(object sender, RoutedEventArgs e) | NavigationViewTopNavOverflowButtonPage | [inline, private]
NavigationViewTopNavOverflowButtonPage() | NavigationViewTopNavOverflowButtonPage | [inline]
RemoveFirstItemButton_Click(object sender, RoutedEventArgs e) | NavigationViewTopNavOverflowButtonPage | [inline, private]
RemoveLastItemButton_Click(object sender, RoutedEventArgs e) | NavigationViewTopNavOverflowButtonPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ImageIcon/ImageIcon.idl Source File

  • ImageIcon

ImageIcon.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 unsealed runtimeclass ImageIcon : Microsoft.UI.Xaml.Controls.IconElement
00007 {
00008     ImageIcon();
00009
00010     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00011     Microsoft.UI.Xaml.Media.ImageSource Source{ get; set; };
00012
00013     static Microsoft.UI.Xaml.DependencyProperty SourceProperty{ get; };
00014 }
00015
00016 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewList.h Source File

  • TreeView

TreeViewList.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "ViewModel.h"
00006
00007 #include "TreeViewList.g.h"
00008
00009 class TreeViewList :
00010     public ReferenceTracker<TreeViewList, winrt::implementation::TreeViewListT>
00011 {
00012 public:
00013     TreeViewList();
00014
00015     void OnDragItemsStarting(const winrt::IInspectable& sender, const winrt::DragItemsStartingEventArgs& args);
00016     void OnDragItemsCompleted(const winrt::IInspectable& sender, const winrt::DragItemsCompletedEventArgs& args);
00017     void OnContainerContentChanging(const winrt::IInspectable& sender, const winrt::ContainerContentChangingEventArgs& args);
00018
00019     // IControlOverrides
00020     void OnDrop(winrt::DragEventArgs const& e);
00021     void OnDragOver(winrt::DragEventArgs const& e);
00022     void OnDragEnter(winrt::DragEventArgs const& e);
00023     void OnDragLeave(winrt::DragEventArgs const& e);
00024
00025     // IItemsControlOverrides
00026     void PrepareContainerForItemOverride(winrt::DependencyObject const& element, winrt::IInspectable const& item);
00027     winrt::DependencyObject GetContainerForItemOverride();
00028
00029     // IFrameworkElementOverrides
00030     void OnApplyTemplate();
00031
00032     // IUIElementOverrides
00033     winrt::AutomationPeer OnCreateAutomationPeer();
00034
00035     winrt::hstring GetDropTargetDropEffect();
00036     void SetDraggedOverItem(winrt::TreeViewItem newDraggedOverItem);
00037     void UpdateDropTargetDropEffect(bool forceUpdate, bool isLeaving, winrt::TreeViewItem keyboardReorderedContainer);
00038     void EnableMultiselect(bool isEnabled);
00039     bool IsMultiselect() const;
00040
00041     bool IsMutiSelectWithSelectedItems() const;
00042     bool IsSelected(const winrt::TreeViewNode& node) const;
00043     std::vector<winrt::TreeViewNode> GetRootsOfSelectedSubtrees() const;
00044     int FlatIndex(const winrt::TreeViewNode& node) const;
00045     bool IsFlatIndexValid(int index) const;
00046     unsigned int RemoveNodeFromParent(const winrt::TreeViewNode& node) const;
00047     winrt::TreeViewNode NodeFromContainer(winrt::DependencyObject const& container) const;
00048     winrt::DependencyObject ContainerFromNode(winrt::TreeViewNode const& node) const;
00049     winrt::TreeViewNode NodeFromItem(winrt::IInspectable const& item) const;
00050     winrt::IInspectable ItemFromNode(winrt::TreeViewNode const& node) const;
00051     com_ptr<ViewModel> ListViewModel() const;
00052     void ListViewModel(com_ptr<ViewModel> viewModel);
00053     winrt::TreeViewNode DraggedTreeViewNode() const;
00054     void DraggedTreeViewNode(winrt::TreeViewNode const& node);
00055     bool IsContentMode() const;
00056
00057 private:
00058     bool IsIndexValid(int index) const;
00059     hstring GetAutomationName(int index) const;
00060     hstring BuildEffectString(hstring priorString, hstring afterString, hstring dragString, hstring dragOverString) const;
00061     unsigned int IndexInParent(const winrt::TreeViewNode& node) const;
00062     winrt::TreeViewNode NodeAtFlatIndex(int index) const;
00063     winrt::TreeViewNode GetRootOfSelection(const winrt::TreeViewNode& node) const;
00064     void MoveNodeInto(winrt::TreeViewNode const& node, winrt::TreeViewNode const& insertAtNode) const;
00065
00066     tracker_ref<winrt::TreeViewItem> m_draggedOverItem{ this };
00067     winrt::hstring m_dropTargetDropEffectString;
00068     int m_emptySlotIndex{ 0 };
00069     bool m_itemsSourceAttached{ false };
00070     bool m_isMultiselectEnabled{ false };
00071     tracker_com_ref<ViewModel> m_viewModel{ this };
00072     tracker_ref<winrt::TreeViewNode> m_draggedTreeViewNode{ this };
00073 };
00074
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/CommandBarFlyoutCommandBarTemplateSettings.properties.cpp Source File

  • Generated

CommandBarFlyoutCommandBarTemplateSettings.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "CommandBarFlyoutCommandBarTemplateSettings.h"
00008
00009 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_CloseAnimationEndPositionProperty{ nullptr };
00010 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ContentClipRectProperty{ nullptr };
00011 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_CurrentWidthProperty{ nullptr };
00012 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandDownAnimationEndPositionProperty{ nullptr };
00013 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandDownAnimationHoldPositionProperty{ nullptr };
00014 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandDownAnimationStartPositionProperty{ nullptr };
00015 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandDownOverflowVerticalPositionProperty{ nullptr };
00016 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandedWidthProperty{ nullptr };
00017 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandUpAnimationEndPositionProperty{ nullptr };
00018 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandUpAnimationHoldPositionProperty{ nullptr };
00019 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandUpAnimationStartPositionProperty{ nullptr };
00020 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_ExpandUpOverflowVerticalPositionProperty{ nullptr };
00021 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_OpenAnimationEndPositionProperty{ nullptr };
00022 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_OpenAnimationStartPositionProperty{ nullptr };
00023 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_OverflowContentClipRectProperty{ nullptr };
00024 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_WidthExpansionAnimationEndPositionProperty{ nullptr };
00025 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_WidthExpansionAnimationStartPositionProperty{ nullptr };
00026 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_WidthExpansionDeltaProperty{ nullptr };
00027 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_WidthExpansionMoreButtonAnimationEndPositionProperty{ nullptr };
00028 GlobalDependencyProperty CommandBarFlyoutCommandBarTemplateSettingsProperties::s_WidthExpansionMoreButtonAnimationStartPositionProperty{ nullptr };
00029
00030 CommandBarFlyoutCommandBarTemplateSettingsProperties::CommandBarFlyoutCommandBarTemplateSettingsProperties()
00031 {
00032     EnsureProperties();
00033 }
00034
00035 void CommandBarFlyoutCommandBarTemplateSettingsProperties::EnsureProperties()
00036 {
00037     if (!s_CloseAnimationEndPositionProperty)
00038     {
00039         s_CloseAnimationEndPositionProperty =
00040             InitializeDependencyProperty(
00041                 L"CloseAnimationEndPosition",
00042                 winrt::name_of<double>(),
00043                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00044                 false /* isAttached */,
00045                 ValueHelper<double>::BoxedDefaultValue(),
00046                 nullptr);
00047     }
00048     if (!s_ContentClipRectProperty)
00049     {
00050         s_ContentClipRectProperty =
00051             InitializeDependencyProperty(
00052                 L"ContentClipRect",
00053                 winrt::name_of<winrt::Rect>(),
00054                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00055                 false /* isAttached */,
00056                 ValueHelper<winrt::Rect>::BoxedDefaultValue(),
00057                 nullptr);
00058     }
00059     if (!s_CurrentWidthProperty)
00060     {
00061         s_CurrentWidthProperty =
00062             InitializeDependencyProperty(
00063                 L"CurrentWidth",
00064                 winrt::name_of<double>(),
00065                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00066                 false /* isAttached */,
00067                 ValueHelper<double>::BoxedDefaultValue(),
00068                 nullptr);
00069     }
00070     if (!s_ExpandDownAnimationEndPositionProperty)
00071     {
00072         s_ExpandDownAnimationEndPositionProperty =
00073             InitializeDependencyProperty(
00074                 L"ExpandDownAnimationEndPosition",
00075                 winrt::name_of<double>(),
00076                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00077                 false /* isAttached */,
00078                 ValueHelper<double>::BoxedDefaultValue(),
00079                 nullptr);
00080     }
00081     if (!s_ExpandDownAnimationHoldPositionProperty)
00082     {
00083         s_ExpandDownAnimationHoldPositionProperty =
00084             InitializeDependencyProperty(
00085                 L"ExpandDownAnimationHoldPosition",
00086                 winrt::name_of<double>(),
00087                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00088                 false /* isAttached */,
00089                 ValueHelper<double>::BoxedDefaultValue(),
00090                 nullptr);
00091     }
00092     if (!s_ExpandDownAnimationStartPositionProperty)
00093     {
00094         s_ExpandDownAnimationStartPositionProperty =
00095             InitializeDependencyProperty(
00096                 L"ExpandDownAnimationStartPosition",
00097                 winrt::name_of<double>(),
00098                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00099                 false /* isAttached */,
00100                 ValueHelper<double>::BoxedDefaultValue(),
00101                 nullptr);
00102     }
00103     if (!s_ExpandDownOverflowVerticalPositionProperty)
00104     {
00105         s_ExpandDownOverflowVerticalPositionProperty =
00106             InitializeDependencyProperty(
00107                 L"ExpandDownOverflowVerticalPosition",
00108                 winrt::name_of<double>(),
00109                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00110                 false /* isAttached */,
00111                 ValueHelper<double>::BoxedDefaultValue(),
00112                 nullptr);
00113     }
00114     if (!s_ExpandedWidthProperty)
00115     {
00116         s_ExpandedWidthProperty =
00117             InitializeDependencyProperty(
00118                 L"ExpandedWidth",
00119                 winrt::name_of<double>(),
00120                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00121                 false /* isAttached */,
00122                 ValueHelper<double>::BoxedDefaultValue(),
00123                 nullptr);
00124     }
00125     if (!s_ExpandUpAnimationEndPositionProperty)
00126     {
00127         s_ExpandUpAnimationEndPositionProperty =
00128             InitializeDependencyProperty(
00129                 L"ExpandUpAnimationEndPosition",
00130                 winrt::name_of<double>(),
00131                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00132                 false /* isAttached */,
00133                 ValueHelper<double>::BoxedDefaultValue(),
00134                 nullptr);
00135     }
00136     if (!s_ExpandUpAnimationHoldPositionProperty)
00137     {
00138         s_ExpandUpAnimationHoldPositionProperty =
00139             InitializeDependencyProperty(
00140                 L"ExpandUpAnimationHoldPosition",
00141                 winrt::name_of<double>(),
00142                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00143                 false /* isAttached */,
00144                 ValueHelper<double>::BoxedDefaultValue(),
00145                 nullptr);
00146     }
00147     if (!s_ExpandUpAnimationStartPositionProperty)
00148     {
00149         s_ExpandUpAnimationStartPositionProperty =
00150             InitializeDependencyProperty(
00151                 L"ExpandUpAnimationStartPosition",
00152                 winrt::name_of<double>(),
00153                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00154                 false /* isAttached */,
00155                 ValueHelper<double>::BoxedDefaultValue(),
00156                 nullptr);
00157     }
00158     if (!s_ExpandUpOverflowVerticalPositionProperty)
00159     {
00160         s_ExpandUpOverflowVerticalPositionProperty =
00161             InitializeDependencyProperty(
00162                 L"ExpandUpOverflowVerticalPosition",
00163                 winrt::name_of<double>(),
00164                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00165                 false /* isAttached */,
00166                 ValueHelper<double>::BoxedDefaultValue(),
00167                 nullptr);
00168     }
00169     if (!s_OpenAnimationEndPositionProperty)
00170     {
00171         s_OpenAnimationEndPositionProperty =
00172             InitializeDependencyProperty(
00173                 L"OpenAnimationEndPosition",
00174                 winrt::name_of<double>(),
00175                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00176                 false /* isAttached */,
00177                 ValueHelper<double>::BoxedDefaultValue(),
00178                 nullptr);
00179     }
00180     if (!s_OpenAnimationStartPositionProperty)
00181     {
00182         s_OpenAnimationStartPositionProperty =
00183             InitializeDependencyProperty(
00184                 L"OpenAnimationStartPosition",
00185                 winrt::name_of<double>(),
00186                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00187                 false /* isAttached */,
00188                 ValueHelper<double>::BoxedDefaultValue(),
00189                 nullptr);
00190     }
00191     if (!s_OverflowContentClipRectProperty)
00192     {
00193         s_OverflowContentClipRectProperty =
00194             InitializeDependencyProperty(
00195                 L"OverflowContentClipRect",
00196                 winrt::name_of<winrt::Rect>(),
00197                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00198                 false /* isAttached */,
00199                 ValueHelper<winrt::Rect>::BoxedDefaultValue(),
00200                 nullptr);
00201     }
00202     if (!s_WidthExpansionAnimationEndPositionProperty)
00203     {
00204         s_WidthExpansionAnimationEndPositionProperty =
00205             InitializeDependencyProperty(
00206                 L"WidthExpansionAnimationEndPosition",
00207                 winrt::name_of<double>(),
00208                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00209                 false /* isAttached */,
00210                 ValueHelper<double>::BoxedDefaultValue(),
00211                 nullptr);
00212     }
00213     if (!s_WidthExpansionAnimationStartPositionProperty)
00214     {
00215         s_WidthExpansionAnimationStartPositionProperty =
00216             InitializeDependencyProperty(
00217                 L"WidthExpansionAnimationStartPosition",
00218                 winrt::name_of<double>(),
00219                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00220                 false /* isAttached */,
00221                 ValueHelper<double>::BoxedDefaultValue(),
00222                 nullptr);
00223     }
00224     if (!s_WidthExpansionDeltaProperty)
00225     {
00226         s_WidthExpansionDeltaProperty =
00227             InitializeDependencyProperty(
00228                 L"WidthExpansionDelta",
00229                 winrt::name_of<double>(),
00230                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00231                 false /* isAttached */,
00232                 ValueHelper<double>::BoxedDefaultValue(),
00233                 nullptr);
00234     }
00235     if (!s_WidthExpansionMoreButtonAnimationEndPositionProperty)
00236     {
00237         s_WidthExpansionMoreButtonAnimationEndPositionProperty =
00238             InitializeDependencyProperty(
00239                 L"WidthExpansionMoreButtonAnimationEndPosition",
00240                 winrt::name_of<double>(),
00241                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00242                 false /* isAttached */,
00243                 ValueHelper<double>::BoxedDefaultValue(),
00244                 nullptr);
00245     }
00246     if (!s_WidthExpansionMoreButtonAnimationStartPositionProperty)
00247     {
00248         s_WidthExpansionMoreButtonAnimationStartPositionProperty =
00249             InitializeDependencyProperty(
00250                 L"WidthExpansionMoreButtonAnimationStartPosition",
00251                 winrt::name_of<double>(),
00252                 winrt::name_of<winrt::CommandBarFlyoutCommandBarTemplateSettings>(),
00253                 false /* isAttached */,
00254                 ValueHelper<double>::BoxedDefaultValue(),
00255                 nullptr);
00256     }
00257 }
00258
00259 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ClearProperties()
00260 {
00261     s_CloseAnimationEndPositionProperty = nullptr;
00262     s_ContentClipRectProperty = nullptr;
00263     s_CurrentWidthProperty = nullptr;
00264     s_ExpandDownAnimationEndPositionProperty = nullptr;
00265     s_ExpandDownAnimationHoldPositionProperty = nullptr;
00266     s_ExpandDownAnimationStartPositionProperty = nullptr;
00267     s_ExpandDownOverflowVerticalPositionProperty = nullptr;
00268     s_ExpandedWidthProperty = nullptr;
00269     s_ExpandUpAnimationEndPositionProperty = nullptr;
00270     s_ExpandUpAnimationHoldPositionProperty = nullptr;
00271     s_ExpandUpAnimationStartPositionProperty = nullptr;
00272     s_ExpandUpOverflowVerticalPositionProperty = nullptr;
00273     s_OpenAnimationEndPositionProperty = nullptr;
00274     s_OpenAnimationStartPositionProperty = nullptr;
00275     s_OverflowContentClipRectProperty = nullptr;
00276     s_WidthExpansionAnimationEndPositionProperty = nullptr;
00277     s_WidthExpansionAnimationStartPositionProperty = nullptr;
00278     s_WidthExpansionDeltaProperty = nullptr;
00279     s_WidthExpansionMoreButtonAnimationEndPositionProperty = nullptr;
00280     s_WidthExpansionMoreButtonAnimationStartPositionProperty = nullptr;
00281 }
00282
00283 void CommandBarFlyoutCommandBarTemplateSettingsProperties::CloseAnimationEndPosition(double value)
00284 {
00285     [[gsl::suppress(con)]]
00286     {
00287     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_CloseAnimationEndPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00288     }
00289 }
00290
00291 double CommandBarFlyoutCommandBarTemplateSettingsProperties::CloseAnimationEndPosition()
00292 {
00293     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_CloseAnimationEndPositionProperty));
00294 }
00295
00296 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ContentClipRect(winrt::Rect const& value)
00297 {
00298     [[gsl::suppress(con)]]
00299     {
00300     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ContentClipRectProperty, ValueHelper<winrt::Rect>::BoxValueIfNecessary(value));
00301     }
00302 }
00303
00304 winrt::Rect CommandBarFlyoutCommandBarTemplateSettingsProperties::ContentClipRect()
00305 {
00306     return ValueHelper<winrt::Rect>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ContentClipRectProperty));
00307 }
00308
00309 void CommandBarFlyoutCommandBarTemplateSettingsProperties::CurrentWidth(double value)
00310 {
00311     [[gsl::suppress(con)]]
00312     {
00313     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_CurrentWidthProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00314     }
00315 }
00316
00317 double CommandBarFlyoutCommandBarTemplateSettingsProperties::CurrentWidth()
00318 {
00319     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_CurrentWidthProperty));
00320 }
00321
00322 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandDownAnimationEndPosition(double value)
00323 {
00324     [[gsl::suppress(con)]]
00325     {
00326     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandDownAnimationEndPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00327     }
00328 }
00329
00330 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandDownAnimationEndPosition()
00331 {
00332     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandDownAnimationEndPositionProperty));
00333 }
00334
00335 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandDownAnimationHoldPosition(double value)
00336 {
00337     [[gsl::suppress(con)]]
00338     {
00339     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandDownAnimationHoldPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00340     }
00341 }
00342
00343 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandDownAnimationHoldPosition()
00344 {
00345     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandDownAnimationHoldPositionProperty));
00346 }
00347
00348 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandDownAnimationStartPosition(double value)
00349 {
00350     [[gsl::suppress(con)]]
00351     {
00352     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandDownAnimationStartPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00353     }
00354 }
00355
00356 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandDownAnimationStartPosition()
00357 {
00358     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandDownAnimationStartPositionProperty));
00359 }
00360
00361 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandDownOverflowVerticalPosition(double value)
00362 {
00363     [[gsl::suppress(con)]]
00364     {
00365     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandDownOverflowVerticalPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00366     }
00367 }
00368
00369 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandDownOverflowVerticalPosition()
00370 {
00371     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandDownOverflowVerticalPositionProperty));
00372 }
00373
00374 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandedWidth(double value)
00375 {
00376     [[gsl::suppress(con)]]
00377     {
00378     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandedWidthProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00379     }
00380 }
00381
00382 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandedWidth()
00383 {
00384     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandedWidthProperty));
00385 }
00386
00387 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandUpAnimationEndPosition(double value)
00388 {
00389     [[gsl::suppress(con)]]
00390     {
00391     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandUpAnimationEndPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00392     }
00393 }
00394
00395 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandUpAnimationEndPosition()
00396 {
00397     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandUpAnimationEndPositionProperty));
00398 }
00399
00400 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandUpAnimationHoldPosition(double value)
00401 {
00402     [[gsl::suppress(con)]]
00403     {
00404     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandUpAnimationHoldPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00405     }
00406 }
00407
00408 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandUpAnimationHoldPosition()
00409 {
00410     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandUpAnimationHoldPositionProperty));
00411 }
00412
00413 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandUpAnimationStartPosition(double value)
00414 {
00415     [[gsl::suppress(con)]]
00416     {
00417     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandUpAnimationStartPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00418     }
00419 }
00420
00421 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandUpAnimationStartPosition()
00422 {
00423     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandUpAnimationStartPositionProperty));
00424 }
00425
00426 void CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandUpOverflowVerticalPosition(double value)
00427 {
00428     [[gsl::suppress(con)]]
00429     {
00430     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_ExpandUpOverflowVerticalPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00431     }
00432 }
00433
00434 double CommandBarFlyoutCommandBarTemplateSettingsProperties::ExpandUpOverflowVerticalPosition()
00435 {
00436     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_ExpandUpOverflowVerticalPositionProperty));
00437 }
00438
00439 void CommandBarFlyoutCommandBarTemplateSettingsProperties::OpenAnimationEndPosition(double value)
00440 {
00441     [[gsl::suppress(con)]]
00442     {
00443     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_OpenAnimationEndPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00444     }
00445 }
00446
00447 double CommandBarFlyoutCommandBarTemplateSettingsProperties::OpenAnimationEndPosition()
00448 {
00449     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_OpenAnimationEndPositionProperty));
00450 }
00451
00452 void CommandBarFlyoutCommandBarTemplateSettingsProperties::OpenAnimationStartPosition(double value)
00453 {
00454     [[gsl::suppress(con)]]
00455     {
00456     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_OpenAnimationStartPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00457     }
00458 }
00459
00460 double CommandBarFlyoutCommandBarTemplateSettingsProperties::OpenAnimationStartPosition()
00461 {
00462     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_OpenAnimationStartPositionProperty));
00463 }
00464
00465 void CommandBarFlyoutCommandBarTemplateSettingsProperties::OverflowContentClipRect(winrt::Rect const& value)
00466 {
00467     [[gsl::suppress(con)]]
00468     {
00469     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_OverflowContentClipRectProperty, ValueHelper<winrt::Rect>::BoxValueIfNecessary(value));
00470     }
00471 }
00472
00473 winrt::Rect CommandBarFlyoutCommandBarTemplateSettingsProperties::OverflowContentClipRect()
00474 {
00475     return ValueHelper<winrt::Rect>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_OverflowContentClipRectProperty));
00476 }
00477
00478 void CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionAnimationEndPosition(double value)
00479 {
00480     [[gsl::suppress(con)]]
00481     {
00482     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_WidthExpansionAnimationEndPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00483     }
00484 }
00485
00486 double CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionAnimationEndPosition()
00487 {
00488     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_WidthExpansionAnimationEndPositionProperty));
00489 }
00490
00491 void CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionAnimationStartPosition(double value)
00492 {
00493     [[gsl::suppress(con)]]
00494     {
00495     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_WidthExpansionAnimationStartPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00496     }
00497 }
00498
00499 double CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionAnimationStartPosition()
00500 {
00501     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_WidthExpansionAnimationStartPositionProperty));
00502 }
00503
00504 void CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionDelta(double value)
00505 {
00506     [[gsl::suppress(con)]]
00507     {
00508     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_WidthExpansionDeltaProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00509     }
00510 }
00511
00512 double CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionDelta()
00513 {
00514     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_WidthExpansionDeltaProperty));
00515 }
00516
00517 void CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionMoreButtonAnimationEndPosition(double value)
00518 {
00519     [[gsl::suppress(con)]]
00520     {
00521     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_WidthExpansionMoreButtonAnimationEndPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00522     }
00523 }
00524
00525 double CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionMoreButtonAnimationEndPosition()
00526 {
00527     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_WidthExpansionMoreButtonAnimationEndPositionProperty));
00528 }
00529
00530 void CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionMoreButtonAnimationStartPosition(double value)
00531 {
00532     [[gsl::suppress(con)]]
00533     {
00534     static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->SetValue(s_WidthExpansionMoreButtonAnimationStartPositionProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00535     }
00536 }
00537
00538 double CommandBarFlyoutCommandBarTemplateSettingsProperties::WidthExpansionMoreButtonAnimationStartPosition()
00539 {
00540     return ValueHelper<double>::CastOrUnbox(static_cast<CommandBarFlyoutCommandBarTemplateSettings*>(this)->GetValue(s_WidthExpansionMoreButtonAnimationStartPositionProperty));
00541 }
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TeachingTipTemplateSettings.properties.h Source File

  • Generated

TeachingTipTemplateSettings.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class TeachingTipTemplateSettingsProperties
00008 {
00009 public:
00010     TeachingTipTemplateSettingsProperties();
00011
00012     void IconElement(winrt::IconElement const& value);
00013     winrt::IconElement IconElement();
00014
00015     void TopLeftHighlightMargin(winrt::Thickness const& value);
00016     winrt::Thickness TopLeftHighlightMargin();
00017
00018     void TopRightHighlightMargin(winrt::Thickness const& value);
00019     winrt::Thickness TopRightHighlightMargin();
00020
00021     static winrt::DependencyProperty IconElementProperty() { return s_IconElementProperty; }
00022     static winrt::DependencyProperty TopLeftHighlightMarginProperty() { return s_TopLeftHighlightMarginProperty; }
00023     static winrt::DependencyProperty TopRightHighlightMarginProperty() { return s_TopRightHighlightMarginProperty; }
00024
00025     static GlobalDependencyProperty s_IconElementProperty;
00026     static GlobalDependencyProperty s_TopLeftHighlightMarginProperty;
00027     static GlobalDependencyProperty s_TopRightHighlightMarginProperty;
00028
00029     static void EnsureProperties();
00030     static void ClearProperties();
00031 };
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/RevealBrushTestApi.h Source File

  • Materials
  • Reveal

RevealBrushTestApi.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "RevealBrushTestApi.g.h"
00007
00008 class RevealBrushTestApi :
00009     public ReferenceTracker<RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable>
00010 {
00011 public:
00012     winrt::RevealBrush RevealBrush();
00013     void RevealBrush(winrt::RevealBrush const& value);
00014
00015     bool IsInFallbackMode();
00016     bool IsAmbientLightSet();
00017     bool IsBorderLightSet();
00018     bool IsHoverLightSet();
00019     winrt::CompositionBrush CompositionBrush();
00020     winrt::CompositionBrush NoiseBrush();
00021
00022 private:
00023     winrt::RevealBrush m_revealBrush{ nullptr };
00024 };
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ColorPicker.properties.h Source File

  • Generated

ColorPicker.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class ColorPickerProperties
00008 {
00009 public:
00010     ColorPickerProperties();
00011
00012     void Color(winrt::Color const& value);
00013     winrt::Color Color();
00014
00015     void ColorSpectrumComponents(winrt::ColorSpectrumComponents const& value);
00016     winrt::ColorSpectrumComponents ColorSpectrumComponents();
00017
00018     void ColorSpectrumShape(winrt::ColorSpectrumShape const& value);
00019     winrt::ColorSpectrumShape ColorSpectrumShape();
00020
00021     void IsAlphaEnabled(bool value);
00022     bool IsAlphaEnabled();
00023
00024     void IsAlphaSliderVisible(bool value);
00025     bool IsAlphaSliderVisible();
00026
00027     void IsAlphaTextInputVisible(bool value);
00028     bool IsAlphaTextInputVisible();
00029
00030     void IsColorChannelTextInputVisible(bool value);
00031     bool IsColorChannelTextInputVisible();
00032
00033     void IsColorPreviewVisible(bool value);
00034     bool IsColorPreviewVisible();
00035
00036     void IsColorSliderVisible(bool value);
00037     bool IsColorSliderVisible();
00038
00039     void IsColorSpectrumVisible(bool value);
00040     bool IsColorSpectrumVisible();
00041
00042     void IsHexInputVisible(bool value);
00043     bool IsHexInputVisible();
00044
00045     void IsMoreButtonVisible(bool value);
00046     bool IsMoreButtonVisible();
00047
00048     void MaxHue(int value);
00049     int MaxHue();
00050
00051     void MaxSaturation(int value);
00052     int MaxSaturation();
00053
00054     void MaxValue(int value);
00055     int MaxValue();
00056
00057     void MinHue(int value);
00058     int MinHue();
00059
00060     void MinSaturation(int value);
00061     int MinSaturation();
00062
00063     void MinValue(int value);
00064     int MinValue();
00065
00066     void Orientation(winrt::Orientation const& value);
00067     winrt::Orientation Orientation();
00068
00069     void PreviousColor(winrt::IReference<winrt::Color> const& value);
00070     winrt::IReference<winrt::Color> PreviousColor();
00071
00072     static winrt::DependencyProperty ColorProperty() { return s_ColorProperty; }
00073     static winrt::DependencyProperty ColorSpectrumComponentsProperty() { return s_ColorSpectrumComponentsProperty; }
00074     static winrt::DependencyProperty ColorSpectrumShapeProperty() { return s_ColorSpectrumShapeProperty; }
00075     static winrt::DependencyProperty IsAlphaEnabledProperty() { return s_IsAlphaEnabledProperty; }
00076     static winrt::DependencyProperty IsAlphaSliderVisibleProperty() { return s_IsAlphaSliderVisibleProperty; }
00077     static winrt::DependencyProperty IsAlphaTextInputVisibleProperty() { return s_IsAlphaTextInputVisibleProperty; }
00078     static winrt::DependencyProperty IsColorChannelTextInputVisibleProperty() { return s_IsColorChannelTextInputVisibleProperty; }
00079     static winrt::DependencyProperty IsColorPreviewVisibleProperty() { return s_IsColorPreviewVisibleProperty; }
00080     static winrt::DependencyProperty IsColorSliderVisibleProperty() { return s_IsColorSliderVisibleProperty; }
00081     static winrt::DependencyProperty IsColorSpectrumVisibleProperty() { return s_IsColorSpectrumVisibleProperty; }
00082     static winrt::DependencyProperty IsHexInputVisibleProperty() { return s_IsHexInputVisibleProperty; }
00083     static winrt::DependencyProperty IsMoreButtonVisibleProperty() { return s_IsMoreButtonVisibleProperty; }
00084     static winrt::DependencyProperty MaxHueProperty() { return s_MaxHueProperty; }
00085     static winrt::DependencyProperty MaxSaturationProperty() { return s_MaxSaturationProperty; }
00086     static winrt::DependencyProperty MaxValueProperty() { return s_MaxValueProperty; }
00087     static winrt::DependencyProperty MinHueProperty() { return s_MinHueProperty; }
00088     static winrt::DependencyProperty MinSaturationProperty() { return s_MinSaturationProperty; }
00089     static winrt::DependencyProperty MinValueProperty() { return s_MinValueProperty; }
00090     static winrt::DependencyProperty OrientationProperty() { return s_OrientationProperty; }
00091     static winrt::DependencyProperty PreviousColorProperty() { return s_PreviousColorProperty; }
00092
00093     static GlobalDependencyProperty s_ColorProperty;
00094     static GlobalDependencyProperty s_ColorSpectrumComponentsProperty;
00095     static GlobalDependencyProperty s_ColorSpectrumShapeProperty;
00096     static GlobalDependencyProperty s_IsAlphaEnabledProperty;
00097     static GlobalDependencyProperty s_IsAlphaSliderVisibleProperty;
00098     static GlobalDependencyProperty s_IsAlphaTextInputVisibleProperty;
00099     static GlobalDependencyProperty s_IsColorChannelTextInputVisibleProperty;
00100     static GlobalDependencyProperty s_IsColorPreviewVisibleProperty;
00101     static GlobalDependencyProperty s_IsColorSliderVisibleProperty;
00102     static GlobalDependencyProperty s_IsColorSpectrumVisibleProperty;
00103     static GlobalDependencyProperty s_IsHexInputVisibleProperty;
00104     static GlobalDependencyProperty s_IsMoreButtonVisibleProperty;
00105     static GlobalDependencyProperty s_MaxHueProperty;
00106     static GlobalDependencyProperty s_MaxSaturationProperty;
00107     static GlobalDependencyProperty s_MaxValueProperty;
00108     static GlobalDependencyProperty s_MinHueProperty;
00109     static GlobalDependencyProperty s_MinSaturationProperty;
00110     static GlobalDependencyProperty s_MinValueProperty;
00111     static GlobalDependencyProperty s_OrientationProperty;
00112     static GlobalDependencyProperty s_PreviousColorProperty;
00113
00114     winrt::event_token ColorChanged(winrt::TypedEventHandler<winrt::ColorPicker, winrt::ColorChangedEventArgs> const& value);
00115     void ColorChanged(winrt::event_token const& token);
00116
00117     event_source<winrt::TypedEventHandler<winrt::ColorPicker, winrt::ColorChangedEventArgs>> m_colorChangedEventSource;
00118
00119     static void EnsureProperties();
00120     static void ClearProperties();
00121
00122     static void OnColorPropertyChanged(
00123         winrt::DependencyObject const& sender,
00124         winrt::DependencyPropertyChangedEventArgs const& args);
00125
00126     static void OnColorSpectrumComponentsPropertyChanged(
00127         winrt::DependencyObject const& sender,
00128         winrt::DependencyPropertyChangedEventArgs const& args);
00129
00130     static void OnColorSpectrumShapePropertyChanged(
00131         winrt::DependencyObject const& sender,
00132         winrt::DependencyPropertyChangedEventArgs const& args);
00133
00134     static void OnIsAlphaEnabledPropertyChanged(
00135         winrt::DependencyObject const& sender,
00136         winrt::DependencyPropertyChangedEventArgs const& args);
00137
00138     static void OnIsAlphaSliderVisiblePropertyChanged(
00139         winrt::DependencyObject const& sender,
00140         winrt::DependencyPropertyChangedEventArgs const& args);
00141
00142     static void OnIsAlphaTextInputVisiblePropertyChanged(
00143         winrt::DependencyObject const& sender,
00144         winrt::DependencyPropertyChangedEventArgs const& args);
00145
00146     static void OnIsColorChannelTextInputVisiblePropertyChanged(
00147         winrt::DependencyObject const& sender,
00148         winrt::DependencyPropertyChangedEventArgs const& args);
00149
00150     static void OnIsColorPreviewVisiblePropertyChanged(
00151         winrt::DependencyObject const& sender,
00152         winrt::DependencyPropertyChangedEventArgs const& args);
00153
00154     static void OnIsColorSliderVisiblePropertyChanged(
00155         winrt::DependencyObject const& sender,
00156         winrt::DependencyPropertyChangedEventArgs const& args);
00157
00158     static void OnIsColorSpectrumVisiblePropertyChanged(
00159         winrt::DependencyObject const& sender,
00160         winrt::DependencyPropertyChangedEventArgs const& args);
00161
00162     static void OnIsHexInputVisiblePropertyChanged(
00163         winrt::DependencyObject const& sender,
00164         winrt::DependencyPropertyChangedEventArgs const& args);
00165
00166     static void OnIsMoreButtonVisiblePropertyChanged(
00167         winrt::DependencyObject const& sender,
00168         winrt::DependencyPropertyChangedEventArgs const& args);
00169
00170     static void OnMaxHuePropertyChanged(
00171         winrt::DependencyObject const& sender,
00172         winrt::DependencyPropertyChangedEventArgs const& args);
00173
00174     static void OnMaxSaturationPropertyChanged(
00175         winrt::DependencyObject const& sender,
00176         winrt::DependencyPropertyChangedEventArgs const& args);
00177
00178     static void OnMaxValuePropertyChanged(
00179         winrt::DependencyObject const& sender,
00180         winrt::DependencyPropertyChangedEventArgs const& args);
00181
00182     static void OnMinHuePropertyChanged(
00183         winrt::DependencyObject const& sender,
00184         winrt::DependencyPropertyChangedEventArgs const& args);
00185
00186     static void OnMinSaturationPropertyChanged(
00187         winrt::DependencyObject const& sender,
00188         winrt::DependencyPropertyChangedEventArgs const& args);
00189
00190     static void OnMinValuePropertyChanged(
00191         winrt::DependencyObject const& sender,
00192         winrt::DependencyPropertyChangedEventArgs const& args);
00193
00194     static void OnOrientationPropertyChanged(
00195         winrt::DependencyObject const& sender,
00196         winrt::DependencyPropertyChangedEventArgs const& args);
00197
00198     static void OnPreviousColorPropertyChanged(
00199         winrt::DependencyObject const& sender,
00200         winrt::DependencyPropertyChangedEventArgs const& args);
00201 };
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/InfoBarPanel.cpp Source File

  • InfoBar

InfoBarPanel.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "InfoBarPanel.h"
00007
00008 winrt::Size InfoBarPanel::MeasureOverride(winrt::Size const& availableSize)
00009 {
00010     winrt::Size desiredSize{};
00011
00012     float totalWidth = 0;
00013     float totalHeight = 0;
00014     float widthOfWidest = 0;
00015     float heightOfTallest = 0;
00016     float heightOfTallestInHorizontal = 0;
00017     int nItems = 0;
00018
00019     const auto parent = this->Parent().try_as<winrt::FrameworkElement>();
00020     const float minHeight = !parent ? 0.0f : (float)(parent.MinHeight() - (Margin().Top + Margin().Bottom));
00021
00022     const auto children = Children();
00023     const auto childCount = (int)children.Size();
00024     for (winrt::UIElement const& child : children)
00025     {
00026         child.Measure(availableSize);
00027         const auto childDesiredSize = child.DesiredSize();
00028
00029         if (childDesiredSize.Width != 0 && childDesiredSize.Height != 0)
00030         {
00031             // Add up the width of all items if they were laid out horizontally
00032             const auto horizontalMargin = winrt::InfoBarPanel::GetHorizontalOrientationMargin(child);
00033             // Ignore left margin of first and right margin of last child
00034             totalWidth += childDesiredSize.Width +
00035                 (nItems > 0 ? (float)horizontalMargin.Left : 0) +
00036                 (nItems < childCount -1 ? (float)horizontalMargin.Right : 0);
00037
00038             // Add up the height of all items if they were laid out vertically
00039             const auto verticalMargin = winrt::InfoBarPanel::GetVerticalOrientationMargin(child);
00040             // Ignore top margin of first and bottom margin of last child
00041             totalHeight += childDesiredSize.Height +
00042                 (nItems > 0 ? (float)verticalMargin.Top : 0) +
00043                 (nItems < childCount -1 ? (float)verticalMargin.Bottom: 0);
00044
00045             if (childDesiredSize.Width > widthOfWidest)
00046             {
00047                 widthOfWidest = childDesiredSize.Width;
00048             }
00049
00050             if (childDesiredSize.Height > heightOfTallest)
00051             {
00052                 heightOfTallest = childDesiredSize.Height;
00053             }
00054
00055             const float childHeightInHorizontal = childDesiredSize.Height + (float)horizontalMargin.Top + float(horizontalMargin.Bottom);
00056             if (childHeightInHorizontal > heightOfTallestInHorizontal)
00057             {
00058                 heightOfTallestInHorizontal = childHeightInHorizontal;
00059             }
00060
00061             nItems++;
00062         }
00063     }
00064
00065     // Since this panel is inside a *-sized grid column, availableSize.Width should not be infinite
00066     // If there is only one item inside the panel, we will count it as vertical (the margins work out better that way)
00067     // Also, if the height of any item is taller than the desired min height of the InfoBar,
00068     // the items should be laid out vertically even though they may seem to fit due to text wrapping.
00069     if (nItems == 1 || totalWidth > availableSize.Width || (minHeight > 0 && heightOfTallestInHorizontal > minHeight))
00070     {
00071         m_isVertical = true;
00072         const auto verticalPadding = VerticalOrientationPadding();
00073
00074         desiredSize.Width = widthOfWidest + (float)verticalPadding.Left + (float)verticalPadding.Right;
00075         desiredSize.Height = totalHeight + (float)verticalPadding.Top + (float)verticalPadding.Bottom;
00076     }
00077     else
00078     {
00079         m_isVertical = false;
00080         const auto horizontalPadding = HorizontalOrientationPadding();
00081
00082         desiredSize.Width = totalWidth + (float)horizontalPadding.Left + (float)horizontalPadding.Right;
00083         desiredSize.Height = heightOfTallest + (float)horizontalPadding.Top + (float)horizontalPadding.Bottom ;
00084     }
00085
00086     return desiredSize;
00087 }
00088
00089 winrt::Size InfoBarPanel::ArrangeOverride(winrt::Size const& finalSize)
00090 {
00091     winrt::Size result = finalSize;
00092
00093     if (m_isVertical)
00094     {
00095         // Layout elements vertically
00096         const auto verticalOrientationPadding = VerticalOrientationPadding();
00097         float verticalOffset = (float)verticalOrientationPadding.Top;
00098
00099         bool hasPreviousElement = false;
00100         for (winrt::UIElement const& child : Children())
00101         {
00102             if (auto childAsFe = child.try_as<winrt::FrameworkElement>())
00103             {
00104                 auto const desiredSize = child.DesiredSize();
00105                 if (desiredSize.Width != 0 && desiredSize.Height != 0)
00106                 {
00107                     const auto verticalMargin = winrt::InfoBarPanel::GetVerticalOrientationMargin(child);
00108
00109                     verticalOffset += hasPreviousElement ? (float)verticalMargin.Top : 0;
00110                     child.Arrange(winrt::Rect{ (float)verticalOrientationPadding.Left + (float)verticalMargin.Left, verticalOffset, desiredSize.Width, desiredSize.Height });
00111                     verticalOffset += desiredSize.Height + (float)verticalMargin.Bottom;
00112
00113                     hasPreviousElement = true;
00114                 }
00115             }
00116         }
00117     }
00118     else
00119     {
00120         // Layout elements horizontally
00121         const auto horizontalOrientationPadding = HorizontalOrientationPadding();
00122         float horizontalOffset = (float)horizontalOrientationPadding.Left;
00123         bool hasPreviousElement = false;
00124
00125         const auto children = Children();
00126         const auto childCount = children.Size();
00127         for (unsigned int i=0; i< childCount; i++)
00128         {
00129             const auto child = children.GetAt(i);
00130             if (auto childAsFe = child.try_as<winrt::FrameworkElement>())
00131             {
00132                 auto const desiredSize = child.DesiredSize();
00133                 if (desiredSize.Width != 0 && desiredSize.Height != 0)
00134                 {
00135                     auto horizontalMargin = winrt::InfoBarPanel::GetHorizontalOrientationMargin(child);
00136
00137                     horizontalOffset += hasPreviousElement ? (float)horizontalMargin.Left : 0;
00138                     if (i < childCount - 1)
00139                     {
00140                         child.Arrange(winrt::Rect{ horizontalOffset, (float)horizontalOrientationPadding.Top + (float)horizontalMargin.Top, desiredSize.Width, desiredSize.Height });
00141                     }
00142                     else
00143                     {
00144                         // Give the rest of the horizontal space to the last child.
00145                         child.Arrange(winrt::Rect{ horizontalOffset, (float)horizontalOrientationPadding.Top + (float)horizontalMargin.Top,
00146                             std::max(desiredSize.Width, finalSize.Width - horizontalOffset), desiredSize.Height });
00147                     }
00148
00149                     horizontalOffset += desiredSize.Width + (float)horizontalMargin.Right;
00150
00151                     hasPreviousElement = true;
00152                 }
00153             }
00154         }
00155     }
00156
00157     return result;
00158 }
00159
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommandBarFlyoutTests::CommandBarFlyoutTestSetupHelper Member List

This is the complete list of members for CommandBarFlyoutTests::CommandBarFlyoutTestSetupHelper, including all inherited members.
[instance initializer] | CommandBarFlyoutTests::CommandBarFlyoutTestSetupHelper | [inline, private]
CommandBarFlyoutTestSetupHelper(string languageOverride="") | CommandBarFlyoutTests::CommandBarFlyoutTestSetupHelper | [inline]
ExecuteAndWaitForEvent(Action action, string eventText) | CommandBarFlyoutTests::CommandBarFlyoutTestSetupHelper | [inline]
ExecuteAndWaitForEvents(Action action, IList< string > eventTexts) | CommandBarFlyoutTests::CommandBarFlyoutTestSetupHelper | [inline]
statusReportingTextBox | CommandBarFlyoutTests::CommandBarFlyoutTestSetupHelper | [private]
TestSetupHelperOptions | CommandBarFlyoutTests::CommandBarFlyoutTestSetupHelper | [private]
Generated on Sun Dec 1 2024 20:53:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/MaterialHelperTestApiFactory.h Source File

  • Lights

MaterialHelperTestApiFactory.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "MaterialHelperTestApi.h"
00007
00008 #include "MaterialHelperTestApi.properties.cpp"
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LinedFlowLayoutItemsInfoRequestedEventArgs Member List

This is the complete list of members for LinedFlowLayoutItemsInfoRequestedEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
CheckThread() | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< LinedFlowLayoutItemsInfoRequestedEventArgs > &&self) noexcept | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
final_release(std::unique_ptr< LinedFlowLayoutItemsInfoRequestedEventArgs > &&self) | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline, static]
GetBase() | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
GetInner() | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
IsOnThread() | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
ItemsRangeLength() | LinedFlowLayoutItemsInfoRequestedEventArgs | [inline]
ItemsRangeRequestedLength() | LinedFlowLayoutItemsInfoRequestedEventArgs | [inline]
ItemsRangeStartIndex() | LinedFlowLayoutItemsInfoRequestedEventArgs | [inline]
ItemsRangeStartIndex(int32_t value) | LinedFlowLayoutItemsInfoRequestedEventArgs |
LinedFlowLayoutItemsInfoRequestedEventArgs(winrt::LinedFlowLayout const &linedFlowLayout, int itemsRangeStartIndex, int itemsRangeRequestedLength) | LinedFlowLayoutItemsInfoRequestedEventArgs |
MaxWidth() | LinedFlowLayoutItemsInfoRequestedEventArgs | [inline]
MaxWidth(double value) | LinedFlowLayoutItemsInfoRequestedEventArgs |
MinWidth() | LinedFlowLayoutItemsInfoRequestedEventArgs | [inline]
MinWidth(double value) | LinedFlowLayoutItemsInfoRequestedEventArgs |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< LinedFlowLayoutItemsInfoRequestedEventArgs, winrt::implementation::LinedFlowLayoutItemsInfoRequestedEventArgsT, winrt::composable, winrt::composing > | [inline]
ResetLinedFlowLayout() | LinedFlowLayoutItemsInfoRequestedEventArgs | [inline]
SetDesiredAspectRatios(winrt::array_view< double const > const &values) | LinedFlowLayoutItemsInfoRequestedEventArgs |
SetItemsRangeEstablishedLength(int value) | LinedFlowLayoutItemsInfoRequestedEventArgs | [private]
SetMaxWidths(winrt::array_view< double const > const &values) | LinedFlowLayoutItemsInfoRequestedEventArgs |
SetMinWidths(winrt::array_view< double const > const &values) | LinedFlowLayoutItemsInfoRequestedEventArgs |
~LinedFlowLayoutItemsInfoRequestedEventArgs() | LinedFlowLayoutItemsInfoRequestedEventArgs |
Generated on Sun Dec 1 2024 20:52:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/TestUI/ScrollPresenterPage.xaml.cs Source File

  • ScrollPresenter
  • TestUI

ScrollPresenterPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using System;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Controls;
00008 using Microsoft.UI.Private.Controls;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 namespace MUXControlsTestApp
00015 {
00016     [TopLevelTestPage(Name = "ScrollPresenter", Icon = "ScrollPresenter.png")]
00017     public sealed partial class ScrollPresenterPage : TestPage
00018     {
00019         public ScrollPresenterPage()
00020         {
00021             // Some pages we will navigate to will need the resources, so lets load them now!
00022             App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00023
00024             LogController.InitializeLogging();
00025
00026             this.InitializeComponent();
00027
00028             navigateToSimpleContents.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresentersWithSimpleContentsPage), 0); };
00029             navigateToDynamic.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterDynamicPage), 0); };
00030             navigateToExpressionAnimationSources.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterExpressionAnimationSourcesPage), 0); };
00031             navigateToChainingAndRailing.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterChainingAndRailingPage), 0); };
00032             navigateToStackPanelAnchoring.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterStackPanelAnchoringPage), 0); };
00033             navigateToRepeaterAnchoring.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterRepeaterAnchoringPage), 0); };
00034             navigateToScrollSnapPoints.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterScrollSnapPointsPage), 0); };
00035             navigateToZoomSnapPoints.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterZoomSnapPointsPage), 0); };
00036             navigateToBringIntoView.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterBringIntoViewPage), 0); };
00037             navigateToManipulationMode.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterManipulationModePage), 0); };
00038             navigateToAccessibility.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterAccessibilityPage), 0); };
00039             navigateToSimpleScrollControllers.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterWithSimpleScrollControllersPage), 0); };
00040             navigateToCompositionScrollControllers.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterWithCompositionScrollControllersPage), 0); };
00041             navigateToBiDirectionalScrollController.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterWithBiDirectionalScrollControllerPage), 0); };
00042             navigateToLeakDetection.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterLeakDetectionPage), 0); };
00043             navigateToMousePanning.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ScrollPresenterMousePanningPage), 0); };
00044
00045             try
00046             {
00047                 int millisecondsPerUnit;
00048                 int minMilliseconds;
00049                 int maxMilliseconds;
00050
00051                 ScrollPresenterTestHooks.GetOffsetsChangeVelocityParameters(
00052                     out millisecondsPerUnit,
00053                     out minMilliseconds,
00054                     out maxMilliseconds);
00055
00056                 txtOffsetsChangeMillisecondsPerUnit.Text = millisecondsPerUnit.ToString();
00057                 txtOffsetsChangeMinMilliseconds.Text = minMilliseconds.ToString();
00058                 txtOffsetsChangeMaxMilliseconds.Text = maxMilliseconds.ToString();
00059
00060                 ScrollPresenterTestHooks.GetZoomFactorChangeVelocityParameters(
00061                     out millisecondsPerUnit,
00062                     out minMilliseconds,
00063                     out maxMilliseconds);
00064
00065                 txtZoomFactorChangeMillisecondsPerUnit.Text = millisecondsPerUnit.ToString();
00066                 txtZoomFactorChangeMinMilliseconds.Text = minMilliseconds.ToString();
00067                 txtZoomFactorChangeMaxMilliseconds.Text = maxMilliseconds.ToString();
00068
00069             }
00070             catch (Exception ex)
00071             {
00072                 tbException.Text = ex.ToString();
00073             }
00074         }
00075
00076         private void CmbScrollPresenterOutputDebugStringLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
00077         {
00078             MUXControlsTestHooks.SetOutputDebugStringLevelForType(
00079                 "ScrollPresenter",
00080                 cmbScrollPresenterOutputDebugStringLevel.SelectedIndex == 1 || cmbScrollPresenterOutputDebugStringLevel.SelectedIndex == 2,
00081                 cmbScrollPresenterOutputDebugStringLevel.SelectedIndex == 2);
00082         }
00083         private void BtnSetOffsetsChangeVelocityParameters_Click(object sender, RoutedEventArgs e)
00084         {
00085             try
00086             {
00087                 ScrollPresenterTestHooks.SetOffsetsChangeVelocityParameters(
00088                     Convert.ToInt32(txtOffsetsChangeMillisecondsPerUnit.Text),
00089                     Convert.ToInt32(txtOffsetsChangeMinMilliseconds.Text),
00090                     Convert.ToInt32(txtOffsetsChangeMaxMilliseconds.Text));
00091             }
00092             catch (Exception ex)
00093             {
00094                 tbException.Text = ex.ToString();
00095             }
00096         }
00097
00098         private void BtnSetZoomFactorChangeVelocityParameters_Click(object sender, RoutedEventArgs e)
00099         {
00100             try
00101             {
00102                 ScrollPresenterTestHooks.SetZoomFactorChangeVelocityParameters(
00103                     Convert.ToInt32(txtZoomFactorChangeMillisecondsPerUnit.Text),
00104                     Convert.ToInt32(txtZoomFactorChangeMinMilliseconds.Text),
00105                     Convert.ToInt32(txtZoomFactorChangeMaxMilliseconds.Text));
00106             }
00107             catch (Exception ex)
00108             {
00109                 tbException.Text = ex.ToString();
00110             }
00111         }
00112     }
00113 }
Generated on Sun Dec 1 2024 20:52:16 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/SwipeItem.properties.cpp Source File

  • Generated

SwipeItem.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "SwipeItem.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(SwipeItem)
00012 }
00013
00014 #include "SwipeItem.g.cpp"
00015
00016 GlobalDependencyProperty SwipeItemProperties::s_BackgroundProperty{ nullptr };
00017 GlobalDependencyProperty SwipeItemProperties::s_BehaviorOnInvokedProperty{ nullptr };
00018 GlobalDependencyProperty SwipeItemProperties::s_CommandProperty{ nullptr };
00019 GlobalDependencyProperty SwipeItemProperties::s_CommandParameterProperty{ nullptr };
00020 GlobalDependencyProperty SwipeItemProperties::s_ForegroundProperty{ nullptr };
00021 GlobalDependencyProperty SwipeItemProperties::s_IconSourceProperty{ nullptr };
00022 GlobalDependencyProperty SwipeItemProperties::s_TextProperty{ nullptr };
00023
00024 SwipeItemProperties::SwipeItemProperties()
00025     : m_invokedEventSource{static_cast<SwipeItem*>(this)}
00026 {
00027     EnsureProperties();
00028 }
00029
00030 void SwipeItemProperties::EnsureProperties()
00031 {
00032     if (!s_BackgroundProperty)
00033     {
00034         s_BackgroundProperty =
00035             InitializeDependencyProperty(
00036                 L"Background",
00037                 winrt::name_of<winrt::Brush>(),
00038                 winrt::name_of<winrt::SwipeItem>(),
00039                 false /* isAttached */,
00040                 ValueHelper<winrt::Brush>::BoxedDefaultValue(),
00041                 winrt::PropertyChangedCallback(&OnBackgroundPropertyChanged));
00042     }
00043     if (!s_BehaviorOnInvokedProperty)
00044     {
00045         s_BehaviorOnInvokedProperty =
00046             InitializeDependencyProperty(
00047                 L"BehaviorOnInvoked",
00048                 winrt::name_of<winrt::SwipeBehaviorOnInvoked>(),
00049                 winrt::name_of<winrt::SwipeItem>(),
00050                 false /* isAttached */,
00051                 ValueHelper<winrt::SwipeBehaviorOnInvoked>::BoxValueIfNecessary(winrt::SwipeBehaviorOnInvoked::Auto),
00052                 winrt::PropertyChangedCallback(&OnBehaviorOnInvokedPropertyChanged));
00053     }
00054     if (!s_CommandProperty)
00055     {
00056         s_CommandProperty =
00057             InitializeDependencyProperty(
00058                 L"Command",
00059                 winrt::name_of<winrt::ICommand>(),
00060                 winrt::name_of<winrt::SwipeItem>(),
00061                 false /* isAttached */,
00062                 ValueHelper<winrt::ICommand>::BoxedDefaultValue(),
00063                 winrt::PropertyChangedCallback(&OnCommandPropertyChanged));
00064     }
00065     if (!s_CommandParameterProperty)
00066     {
00067         s_CommandParameterProperty =
00068             InitializeDependencyProperty(
00069                 L"CommandParameter",
00070                 winrt::name_of<winrt::IInspectable>(),
00071                 winrt::name_of<winrt::SwipeItem>(),
00072                 false /* isAttached */,
00073                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00074                 winrt::PropertyChangedCallback(&OnCommandParameterPropertyChanged));
00075     }
00076     if (!s_ForegroundProperty)
00077     {
00078         s_ForegroundProperty =
00079             InitializeDependencyProperty(
00080                 L"Foreground",
00081                 winrt::name_of<winrt::Brush>(),
00082                 winrt::name_of<winrt::SwipeItem>(),
00083                 false /* isAttached */,
00084                 ValueHelper<winrt::Brush>::BoxedDefaultValue(),
00085                 winrt::PropertyChangedCallback(&OnForegroundPropertyChanged));
00086     }
00087     if (!s_IconSourceProperty)
00088     {
00089         s_IconSourceProperty =
00090             InitializeDependencyProperty(
00091                 L"IconSource",
00092                 winrt::name_of<winrt::IconSource>(),
00093                 winrt::name_of<winrt::SwipeItem>(),
00094                 false /* isAttached */,
00095                 ValueHelper<winrt::IconSource>::BoxedDefaultValue(),
00096                 winrt::PropertyChangedCallback(&OnIconSourcePropertyChanged));
00097     }
00098     if (!s_TextProperty)
00099     {
00100         s_TextProperty =
00101             InitializeDependencyProperty(
00102                 L"Text",
00103                 winrt::name_of<winrt::hstring>(),
00104                 winrt::name_of<winrt::SwipeItem>(),
00105                 false /* isAttached */,
00106                 ValueHelper<winrt::hstring>::BoxedDefaultValue(),
00107                 winrt::PropertyChangedCallback(&OnTextPropertyChanged));
00108     }
00109 }
00110
00111 void SwipeItemProperties::ClearProperties()
00112 {
00113     s_BackgroundProperty = nullptr;
00114     s_BehaviorOnInvokedProperty = nullptr;
00115     s_CommandProperty = nullptr;
00116     s_CommandParameterProperty = nullptr;
00117     s_ForegroundProperty = nullptr;
00118     s_IconSourceProperty = nullptr;
00119     s_TextProperty = nullptr;
00120 }
00121
00122 void SwipeItemProperties::OnBackgroundPropertyChanged(
00123     winrt::DependencyObject const& sender,
00124     winrt::DependencyPropertyChangedEventArgs const& args)
00125 {
00126     auto owner = sender.as<winrt::SwipeItem>();
00127     winrt::get_self<SwipeItem>(owner)->OnPropertyChanged(args);
00128 }
00129
00130 void SwipeItemProperties::OnBehaviorOnInvokedPropertyChanged(
00131     winrt::DependencyObject const& sender,
00132     winrt::DependencyPropertyChangedEventArgs const& args)
00133 {
00134     auto owner = sender.as<winrt::SwipeItem>();
00135     winrt::get_self<SwipeItem>(owner)->OnPropertyChanged(args);
00136 }
00137
00138 void SwipeItemProperties::OnCommandPropertyChanged(
00139     winrt::DependencyObject const& sender,
00140     winrt::DependencyPropertyChangedEventArgs const& args)
00141 {
00142     auto owner = sender.as<winrt::SwipeItem>();
00143     winrt::get_self<SwipeItem>(owner)->OnPropertyChanged(args);
00144 }
00145
00146 void SwipeItemProperties::OnCommandParameterPropertyChanged(
00147     winrt::DependencyObject const& sender,
00148     winrt::DependencyPropertyChangedEventArgs const& args)
00149 {
00150     auto owner = sender.as<winrt::SwipeItem>();
00151     winrt::get_self<SwipeItem>(owner)->OnPropertyChanged(args);
00152 }
00153
00154 void SwipeItemProperties::OnForegroundPropertyChanged(
00155     winrt::DependencyObject const& sender,
00156     winrt::DependencyPropertyChangedEventArgs const& args)
00157 {
00158     auto owner = sender.as<winrt::SwipeItem>();
00159     winrt::get_self<SwipeItem>(owner)->OnPropertyChanged(args);
00160 }
00161
00162 void SwipeItemProperties::OnIconSourcePropertyChanged(
00163     winrt::DependencyObject const& sender,
00164     winrt::DependencyPropertyChangedEventArgs const& args)
00165 {
00166     auto owner = sender.as<winrt::SwipeItem>();
00167     winrt::get_self<SwipeItem>(owner)->OnPropertyChanged(args);
00168 }
00169
00170 void SwipeItemProperties::OnTextPropertyChanged(
00171     winrt::DependencyObject const& sender,
00172     winrt::DependencyPropertyChangedEventArgs const& args)
00173 {
00174     auto owner = sender.as<winrt::SwipeItem>();
00175     winrt::get_self<SwipeItem>(owner)->OnPropertyChanged(args);
00176 }
00177
00178 void SwipeItemProperties::Background(winrt::Brush const& value)
00179 {
00180     [[gsl::suppress(con)]]
00181     {
00182     static_cast<SwipeItem*>(this)->SetValue(s_BackgroundProperty, ValueHelper<winrt::Brush>::BoxValueIfNecessary(value));
00183     }
00184 }
00185
00186 winrt::Brush SwipeItemProperties::Background()
00187 {
00188     return ValueHelper<winrt::Brush>::CastOrUnbox(static_cast<SwipeItem*>(this)->GetValue(s_BackgroundProperty));
00189 }
00190
00191 void SwipeItemProperties::BehaviorOnInvoked(winrt::SwipeBehaviorOnInvoked const& value)
00192 {
00193     [[gsl::suppress(con)]]
00194     {
00195     static_cast<SwipeItem*>(this)->SetValue(s_BehaviorOnInvokedProperty, ValueHelper<winrt::SwipeBehaviorOnInvoked>::BoxValueIfNecessary(value));
00196     }
00197 }
00198
00199 winrt::SwipeBehaviorOnInvoked SwipeItemProperties::BehaviorOnInvoked()
00200 {
00201     return ValueHelper<winrt::SwipeBehaviorOnInvoked>::CastOrUnbox(static_cast<SwipeItem*>(this)->GetValue(s_BehaviorOnInvokedProperty));
00202 }
00203
00204 void SwipeItemProperties::Command(winrt::ICommand const& value)
00205 {
00206     [[gsl::suppress(con)]]
00207     {
00208     static_cast<SwipeItem*>(this)->SetValue(s_CommandProperty, ValueHelper<winrt::ICommand>::BoxValueIfNecessary(value));
00209     }
00210 }
00211
00212 winrt::ICommand SwipeItemProperties::Command()
00213 {
00214     return ValueHelper<winrt::ICommand>::CastOrUnbox(static_cast<SwipeItem*>(this)->GetValue(s_CommandProperty));
00215 }
00216
00217 void SwipeItemProperties::CommandParameter(winrt::IInspectable const& value)
00218 {
00219     [[gsl::suppress(con)]]
00220     {
00221     static_cast<SwipeItem*>(this)->SetValue(s_CommandParameterProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00222     }
00223 }
00224
00225 winrt::IInspectable SwipeItemProperties::CommandParameter()
00226 {
00227     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<SwipeItem*>(this)->GetValue(s_CommandParameterProperty));
00228 }
00229
00230 void SwipeItemProperties::Foreground(winrt::Brush const& value)
00231 {
00232     [[gsl::suppress(con)]]
00233     {
00234     static_cast<SwipeItem*>(this)->SetValue(s_ForegroundProperty, ValueHelper<winrt::Brush>::BoxValueIfNecessary(value));
00235     }
00236 }
00237
00238 winrt::Brush SwipeItemProperties::Foreground()
00239 {
00240     return ValueHelper<winrt::Brush>::CastOrUnbox(static_cast<SwipeItem*>(this)->GetValue(s_ForegroundProperty));
00241 }
00242
00243 void SwipeItemProperties::IconSource(winrt::IconSource const& value)
00244 {
00245     [[gsl::suppress(con)]]
00246     {
00247     static_cast<SwipeItem*>(this)->SetValue(s_IconSourceProperty, ValueHelper<winrt::IconSource>::BoxValueIfNecessary(value));
00248     }
00249 }
00250
00251 winrt::IconSource SwipeItemProperties::IconSource()
00252 {
00253     return ValueHelper<winrt::IconSource>::CastOrUnbox(static_cast<SwipeItem*>(this)->GetValue(s_IconSourceProperty));
00254 }
00255
00256 void SwipeItemProperties::Text(winrt::hstring const& value)
00257 {
00258     [[gsl::suppress(con)]]
00259     {
00260     static_cast<SwipeItem*>(this)->SetValue(s_TextProperty, ValueHelper<winrt::hstring>::BoxValueIfNecessary(value));
00261     }
00262 }
00263
00264 winrt::hstring SwipeItemProperties::Text()
00265 {
00266     return ValueHelper<winrt::hstring>::CastOrUnbox(static_cast<SwipeItem*>(this)->GetValue(s_TextProperty));
00267 }
00268
00269 winrt::event_token SwipeItemProperties::Invoked(winrt::TypedEventHandler<winrt::SwipeItem, winrt::SwipeItemInvokedEventArgs> const& value)
00270 {
00271     return m_invokedEventSource.add(value);
00272 }
00273
00274 void SwipeItemProperties::Invoked(winrt::event_token const& token)
00275 {
00276     m_invokedEventSource.remove(token);
00277 }
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/VirtualizingLayoutContext.properties.cpp Source File

  • Generated

VirtualizingLayoutContext.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "VirtualizingLayoutContext.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(VirtualizingLayoutContext)
00012 }
00013
00014 #include "VirtualizingLayoutContext.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewItemTemplateSelector Member List

This is the complete list of members for TreeViewItemTemplateSelector, including all inherited members.
SelectTemplateCore(object item) | TreeViewItemTemplateSelector | [inline, protected]
Template1 | TreeViewItemTemplateSelector |
Template2 | TreeViewItemTemplateSelector |
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ICoreWebView2Interop Member List

This is the complete list of members for ICoreWebView2Interop, including all inherited members.
AddHostObjectToScript([In] string name,[In] ref object obj) ICoreWebView2Interop
Generated on Sun Dec 1 2024 20:54:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/WindowPage.xaml.cs Source File

  • CommonStyles
  • TestUI

WindowPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Controls;
00006
00007 namespace MUXControlsTestApp
00008 {
00009     [TopLevelTestPage(Name="Window")]
00010     public sealed partial class WindowPage : TestPage
00011     {
00012         public WindowPage()
00013         {
00014             this.InitializeComponent();
00015         }
00016
00017         private void BtnOpenNewWindowRootPage_Click(object sender, RoutedEventArgs e)
00018         {
00019             Window newWindow = new Window() { Title = "MUXControlsTestApp.Desktop - Secondary NewWindowRootPage" };
00020             TestFrame rootFrame = new TestFrame(typeof(NewWindowRootPage));
00021             newWindow.Content = rootFrame;
00022             rootFrame.NavigateWithoutAnimation(typeof(NewWindowRootPage));
00023             newWindow.Activate();
00024         }
00025
00026         private void BtnOpenNewMainPage_Click(object sender, RoutedEventArgs e)
00027         {
00028             Window newWindow = new Window() { Title = "MUXControlsTestApp.Desktop - Secondary MainPage" };
00029             TestFrame rootFrame = new TestFrame(typeof(MainPage));
00030             newWindow.Content = rootFrame;
00031             rootFrame.NavigateWithoutAnimation(typeof(MainPage));
00032             newWindow.Activate();
00033         }
00034     }
00035 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemsRepeater.h Source File

  • Repeater

ItemsRepeater.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "TransitionManager.h"
00007 #include "ViewManager.h"
00008 #include "VirtualizationInfo.h"
00009 #include "ItemsRepeaterElementPreparedEventArgs.h"
00010 #include "ItemsRepeaterElementClearingEventArgs.h"
00011 #include "ItemsRepeaterElementIndexChangedEventArgs.h"
00012 #include "ItemsRepeater.g.h"
00013 #include "ItemsRepeater.properties.h"
00014 #include "ViewportManager.h"
00015
00016 class VirtualizationInfo;
00017
00018 class ItemsRepeater :
00019     public ReferenceTracker<ItemsRepeater, DeriveFromPanelHelper_base, winrt::ItemsRepeater, winrt::IItemsRepeater2>,
00020     public ItemsRepeaterProperties
00021 {
00022 public:
00023     ItemsRepeater();
00024
00025     // StackLayout measurements are shortcut when m_stackLayoutMeasureCounter reaches this value
00026     // to prevent a layout cycle exception.
00027     // The XAML Framework's iteration limit is 250, but that limit has been reached in practice
00028     // with this value as small as 61. It was never reached with 60.
00029     static constexpr uint8_t s_maxStackLayoutIterations = 60u;
00030
00031     static winrt::Point ClearedElementsArrangePosition;
00032     // A convention we use in the ItemsRepeater codebase for an invalid Rect value.
00033     static winrt::Rect InvalidRect;
00034
00035     using ItemsRepeaterProperties::Background;
00036
00037 #pragma region IUIElementOverrides
00038
00039     winrt::AutomationPeer OnCreateAutomationPeer();
00040
00041 #pragma endregion
00042
00043 #pragma region IUIElementOverrides7
00044
00045     winrt::IIterable<winrt::DependencyObject> GetChildrenInTabFocusOrder();
00046
00047 #pragma endregion
00048
00049 #pragma region IUIElementOverrides8
00050
00051     void OnBringIntoViewRequested(winrt::BringIntoViewRequestedEventArgs const& e);
00052
00053 #pragma endregion
00054
00055 #pragma region IFrameworkElementOverrides
00056
00057     winrt::Size MeasureOverride(winrt::Size const& availableSize);
00058     winrt::Size ArrangeOverride(winrt::Size const& finalSize);
00059
00060 #pragma endregion
00061
00062 #pragma region IRepeater interface.
00063
00064     winrt::ItemsSourceView ItemsSourceView();
00065
00066     // Mapping APIs
00067     int32_t GetElementIndex(winrt::UIElement const& element);
00068     winrt::UIElement TryGetElement(int index);
00069     winrt::UIElement GetOrCreateElement(int index);
00070
00071 #pragma endregion
00072
00073     winrt::Microsoft::UI::Xaml::IElementFactory ItemTemplateShim() { return m_itemTemplateWrapper; };
00074     ViewManager& ViewManager() { return m_viewManager; }
00075     TransitionManager& TransitionManager() { return m_transitionManager; }
00076
00077     winrt::UIElement GetElementImpl(int index, bool forceCreate, bool suppressAutoRecycle);
00078     void ClearElementImpl(const winrt::UIElement& element);
00079
00080     // Mapping APIs (exception based)
00081     int GetElementIndexImpl(const winrt::UIElement& element);
00082     winrt::UIElement GetElementFromIndexImpl(int index);
00083
00084
00085     winrt::UIElement GetOrCreateElementImpl(int index);
00086
00087     static winrt::com_ptr<VirtualizationInfo> TryGetVirtualizationInfo(const winrt::UIElement& element);
00088     static winrt::com_ptr<VirtualizationInfo> GetVirtualizationInfo(const winrt::UIElement& element);
00089     static winrt::com_ptr<VirtualizationInfo> CreateAndInitializeVirtualizationInfo(const winrt::UIElement& element);
00090
00091     winrt::IInspectable LayoutState() const { return m_layoutState.get(); }
00092     void LayoutState(const winrt::IInspectable& value) { m_layoutState.set(value); }
00093     winrt::Rect VisibleWindow() const { return m_viewportManager->GetLayoutVisibleWindow(); }
00094     winrt::Rect RealizationWindow() const { return m_viewportManager->GetLayoutRealizationWindow(); }
00095     winrt::UIElement SuggestedAnchor() const { return m_viewportManager->SuggestedAnchor(); }
00096     winrt::UIElement MadeAnchor() const { return m_viewportManager->MadeAnchor(); }
00097     winrt::Point LayoutOrigin() const { return m_layoutOrigin; }
00098     void LayoutOrigin(winrt::Point value) { m_layoutOrigin = value; }
00099
00100     // Pinning APIs
00101     void PinElement(winrt::UIElement const& element);
00102     void UnpinElement(winrt::UIElement const& element);
00103
00104     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00105
00106     void OnElementPrepared(const winrt::UIElement& element, int index);
00107     void OnElementClearing(const winrt::UIElement& element);
00108     void OnElementIndexChanged(const winrt::UIElement& element, int oldIndex, int newIndex);
00109
00110     static winrt::DependencyProperty GetVirtualizationInfoProperty()
00111     {
00112         static GlobalDependencyProperty s_VirtualizationInfoProperty =
00113             InitializeDependencyProperty(
00114                 L"VirtualizationInfo",
00115                 winrt::name_of<winrt::IInspectable>(),
00116                 winrt::name_of<winrt::ItemsRepeater>(),
00117                 true /* isAttached */,
00118                 nullptr /* defaultValue */);
00119
00120         return s_VirtualizationInfoProperty;
00121     }
00122
00123     int Indent();
00124
00125 #pragma region RepeaterTestHooks methods
00126     static int GetLogItemIndex();
00127     static void SetLogItemIndex(int logItemIndex);
00128 #pragma endregion
00129
00130 private:
00131     void OnLoaded(const winrt::IInspectable& /*sender*/, const winrt::RoutedEventArgs& /*args*/);
00132     void OnUnloaded(const winrt::IInspectable& /*sender*/, const winrt::RoutedEventArgs& /*args*/);
00133     void OnLayoutUpdated(const winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*args*/);
00134
00135     void OnDataSourcePropertyChanged(const winrt::ItemsSourceView& oldValue, const winrt::ItemsSourceView& newValue);
00136     void OnItemTemplateChanged(const winrt::IElementFactory& oldValue, const winrt::IElementFactory& newValue);
00137     void OnLayoutChanged(winrt::Layout oldValue, winrt::Layout newValue);
00138     void OnTransitionProviderChanged(const winrt::ItemCollectionTransitionProvider& oldValue, const winrt::ItemCollectionTransitionProvider& newValue);
00139
00140     void OnItemsSourceViewChanged(const winrt::IInspectable& sender, const winrt::NotifyCollectionChangedEventArgs& args);
00141     void InvalidateMeasureForLayout(winrt::Layout const& sender, winrt::IInspectable const& args);
00142     void InvalidateArrangeForLayout(winrt::Layout const& sender, winrt::IInspectable const& args);
00143     void EnsureDefaultLayoutState();
00144
00145     winrt::VirtualizingLayoutContext GetLayoutContext();
00146     bool IsProcessingCollectionChange() const { return m_processingItemsSourceChange != nullptr; }
00147
00148     winrt::IIterable<winrt::DependencyObject> CreateChildrenInTabFocusOrderIterable();
00149
00150     winrt::Layout GetDefaultLayout();
00151     winrt::Layout GetEffectiveLayout();
00152
00153     ::TransitionManager m_transitionManager{ this };
00154     ::ViewManager m_viewManager{ this };
00155     std::shared_ptr<::ViewportManager> m_viewportManager{ nullptr };
00156
00157     tracker_ref<winrt::ItemsSourceView> m_itemsSourceView{ this };
00158
00159     winrt::Microsoft::UI::Xaml::IElementFactory m_itemTemplateWrapper{ nullptr };
00160
00161     tracker_ref<winrt::VirtualizingLayoutContext> m_layoutContext{ this };
00162     tracker_ref<winrt::IInspectable> m_layoutState{ this };
00163     // Value is different from null only while we are on the OnItemsSourceChanged call stack.
00164     tracker_ref<winrt::NotifyCollectionChangedEventArgs> m_processingItemsSourceChange{ this };
00165
00166     winrt::Size m_lastAvailableSize{};
00167     bool m_isLayoutInProgress{ false };
00168     // The value of _layoutOrigin is expected to be set by the layout
00169     // when it gets measured. It should not be used outside of measure.
00170     winrt::Point m_layoutOrigin{};
00171
00172     // Event revokers
00173     winrt::ItemsSourceView::CollectionChanged_revoker m_itemsSourceViewChanged{};
00174     winrt::Layout::MeasureInvalidated_revoker m_measureInvalidated{};
00175     winrt::Layout::ArrangeInvalidated_revoker m_arrangeInvalidated{};
00176
00177     // Cached Event args to avoid creation cost every time
00178     tracker_ref<winrt::ItemsRepeaterElementPreparedEventArgs> m_elementPreparedArgs{ this };
00179     tracker_ref<winrt::ItemsRepeaterElementClearingEventArgs> m_elementClearingArgs{ this };
00180     tracker_ref<winrt::ItemsRepeaterElementIndexChangedEventArgs> m_elementIndexChangedArgs{ this };
00181
00182     // Loaded events fire on the first tick after an element is put into the tree
00183     // while unloaded is posted on the UI tree and may be processed out of sync with subsequent loaded
00184     // events. We keep these counters to detect out-of-sync unloaded events and take action to rectify.
00185     int _loadedCounter{};
00186     int _unloadedCounter{};
00187
00188     // Used to avoid layout cycles with StackLayout layouts where variable sized children prevent
00189     // the ItemsRepeater's layout to settle.
00190     uint8_t m_stackLayoutMeasureCounter{ 0u };
00191
00192     // If no ItemCollectionTransitionProvider is explicitly provided, we'll retrieve a default one
00193     // from the Layout object. In that case, we'll want to know that we own that object and can
00194     // overwrite it if the Layout object changes.
00195     bool m_ownsTransitionProvider{ true };
00196
00197     // Bug where DataTemplate with no content causes a crash.
00198     // See: https://github.com/microsoft/microsoft-ui-xaml/issues/776
00199     // Solution: Have flag that is only true when DataTemplate exists but it is empty.
00200     bool m_isItemTemplateEmpty{ false };
00201
00202     // Tracks whether OnLayoutChanged has already been called or not so that
00203     // EnsureDefaultLayoutState does not trigger a second call after the control's creation.
00204     bool m_wasLayoutChangedCalled{ false };
00205
00206 #pragma region RepeaterTestHooks-related fields
00207 #ifdef DBG
00208     static int s_logItemIndexDbg;
00209 #endif // DBG
00210 #pragma endregion
00211 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/DataModel/Year.cs Source File

  • Repeater
  • TestUI
  • Samples
  • DataModel

Year.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.Generic;
00005 using System.Collections.ObjectModel;
00006 using MUXControlsTestApp.Utilities;
00007
00008 namespace MUXControlsTestApp.Samples.Model
00009 {
00010     public class Year : ObservableCollection<RecipeGroup>
00011     {
00012         public int Value { get; set; }
00013
00014         public Year(IEnumerable<RecipeGroup> recipeGroups)
00015             : base(recipeGroups)
00016         {
00017
00018         }
00019
00020         public override string ToString()
00021         {
00022             return string.Format("Year {0}", Value);
00023         }
00024     }
00025 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PagerControl/PagerControl.idl Source File

  • PagerControl

PagerControl.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003 [MUX_PREVIEW]
00004 [webhosthidden]
00005 enum PagerControlDisplayMode
00006 {
00007     Auto,
00008     ComboBox,
00009     NumberBox,
00010     ButtonPanel,
00011 };
00012
00013 [MUX_PREVIEW]
00014 [webhosthidden]
00015 enum PagerControlButtonVisibility
00016 {
00017     Visible,
00018     HiddenOnEdge,
00019     Hidden,
00020 };
00021
00022 [MUX_PREVIEW]
00023 [webhosthidden]
00024 runtimeclass PagerControlSelectedIndexChangedEventArgs
00025 {
00026     Int32 NewPageIndex{get; };
00027     Int32 PreviousPageIndex{get; };
00028 };
00029
00030 [MUX_PREVIEW]
00031 [webhosthidden]
00032 [MUX_PROPERTY_NEEDS_DP_FIELD]
00033 unsealed runtimeclass PagerControlTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00034 {
00035     PagerControlTemplateSettings();
00036
00037     Windows.Foundation.Collections.IVector<Object> Pages{ get; };
00038     Windows.Foundation.Collections.IVector<Object> NumberPanelItems { get; };
00039 }
00040
00041 [MUX_PREVIEW]
00042 [webhosthidden]
00043 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00044 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00045 unsealed runtimeclass PagerControl : Microsoft.UI.Xaml.Controls.Control
00046 {
00047     PagerControl();
00048
00049     PagerControlDisplayMode DisplayMode;
00050
00051     [MUX_DEFAULT_VALUE("0")]
00052     Int32 NumberOfPages;
00053
00054     PagerControlButtonVisibility FirstButtonVisibility;
00055     PagerControlButtonVisibility PreviousButtonVisibility;
00056     PagerControlButtonVisibility NextButtonVisibility;
00057     PagerControlButtonVisibility LastButtonVisibility;
00058
00059     Microsoft.UI.Xaml.Input.ICommand FirstButtonCommand;
00060     Microsoft.UI.Xaml.Input.ICommand PreviousButtonCommand;
00061     Microsoft.UI.Xaml.Input.ICommand NextButtonCommand;
00062     Microsoft.UI.Xaml.Input.ICommand LastButtonCommand;
00063     Microsoft.UI.Xaml.Input.ICommand PagerInputCommand;
00064
00065     Microsoft.UI.Xaml.Style FirstButtonStyle;
00066     Microsoft.UI.Xaml.Style PreviousButtonStyle;
00067     Microsoft.UI.Xaml.Style NextButtonStyle;
00068     Microsoft.UI.Xaml.Style LastButtonStyle;
00069
00070     [MUX_DEFAULT_VALUE("true")]
00071     Boolean ButtonPanelAlwaysShowFirstLastPageIndex;
00072
00073     [MUX_DEFAULT_VALUE("0")]
00074     Int32 SelectedPageIndex;
00075
00076     String PrefixText;
00077     String SuffixText;
00078
00079     event Windows.Foundation.TypedEventHandler<PagerControl, PagerControlSelectedIndexChangedEventArgs> SelectedIndexChanged;
00080
00081
00082     [MUX_PROPERTY_NEEDS_DP_FIELD]
00083     PagerControlTemplateSettings TemplateSettings{ get; };
00084
00085     static Microsoft.UI.Xaml.DependencyProperty DisplayModeProperty{ get; };
00086
00087     static Microsoft.UI.Xaml.DependencyProperty NumberOfPagesProperty{ get; };
00088
00089     static Microsoft.UI.Xaml.DependencyProperty FirstButtonVisibilityProperty{ get; };
00090     static Microsoft.UI.Xaml.DependencyProperty PreviousButtonVisibilityProperty{ get; };
00091     static Microsoft.UI.Xaml.DependencyProperty NextButtonVisibilityProperty{ get; };
00092     static Microsoft.UI.Xaml.DependencyProperty LastButtonVisibilityProperty{ get; };
00093
00094     static Microsoft.UI.Xaml.DependencyProperty FirstButtonCommandProperty{ get; };
00095     static Microsoft.UI.Xaml.DependencyProperty PreviousButtonCommandProperty{ get; };
00096     static Microsoft.UI.Xaml.DependencyProperty NextButtonCommandProperty{ get; };
00097     static Microsoft.UI.Xaml.DependencyProperty LastButtonCommandProperty{ get; };
00098     static Microsoft.UI.Xaml.DependencyProperty PagerInputCommandProperty{ get; };
00099
00100     static Microsoft.UI.Xaml.DependencyProperty FirstButtonStyleProperty{ get; };
00101     static Microsoft.UI.Xaml.DependencyProperty PreviousButtonStyleProperty{ get; };
00102     static Microsoft.UI.Xaml.DependencyProperty NextButtonStyleProperty{ get; };
00103     static Microsoft.UI.Xaml.DependencyProperty LastButtonStyleProperty{ get; };
00104
00105     static Microsoft.UI.Xaml.DependencyProperty ButtonPanelAlwaysShowFirstLastPageIndexProperty{ get; };
00106     static Microsoft.UI.Xaml.DependencyProperty SelectedPageIndexProperty{get; };
00107
00108     static Microsoft.UI.Xaml.DependencyProperty PrefixTextProperty{ get; };
00109     static Microsoft.UI.Xaml.DependencyProperty SuffixTextProperty{ get; };
00110 }
00111
00112 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ObservableTraits< T, isObservable, isBindable >::Dummy Member List

This is the complete list of members for ObservableTraits< T, isObservable, isBindable >::Dummy, including all inherited members.
Dummy(ITrackerHandleManager *) ObservableTraits< T, isObservable, isBindable >::Dummy [inline]
Generated on Sun Dec 1 2024 20:52:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/Phaser.h Source File

  • Repeater

Phaser.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 class ItemsRepeater;
00007
00008 struct ElementInfo
00009 {
00010     ElementInfo(const winrt::UIElement& element, const winrt::com_ptr<VirtualizationInfo>& virtInfo);
00011
00012     winrt::UIElement Element() const { return m_element; }
00013     winrt::com_ptr<VirtualizationInfo> VirtInfo() const { return m_virtInfo; }
00014 private:
00015     winrt::UIElement m_element{ nullptr };
00016     winrt::com_ptr<VirtualizationInfo> m_virtInfo{ nullptr };
00017 };
00018
00019 class Phaser final
00020 {
00021 public:
00022     Phaser(ItemsRepeater* owner);
00023     void PhaseElement(const winrt::UIElement& element, const winrt::com_ptr<VirtualizationInfo>& virtInfo);
00024     void StopPhasing(const winrt::UIElement& element, const winrt::com_ptr<VirtualizationInfo>& virtInfo);
00025
00026 private:
00027     void DoPhasedWorkCallback();
00028     void RegisterForCallback();
00029     void MarkCallbackRecieved();
00030     void SortElements(const winrt::Rect& visibleWindow);
00031     static void ValidatePhaseOrdering(int currentPhase, int nextPhase);
00032
00033     ItemsRepeater* m_owner{ nullptr };
00034     std::vector<ElementInfo> m_pendingElements{};
00035     bool m_registeredForCallback{ false };
00036 };
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DefaultItemCollectionTransitionProvider Member List

This is the complete list of members for DefaultItemCollectionTransitionProvider, including all inherited members.
abi_enter() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
AnimateOffset(Visual visual, Compositor compositor, Rect oldBounds, Rect newBounds, bool hasRemoveAnimations) | DefaultItemCollectionTransitionProvider | [inline, private, static]
AnimationSlowdownFactor | DefaultItemCollectionTransitionProvider | [static]
CheckThread() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
ClearProperties() | ItemCollectionTransitionProviderProperties | [static]
DefaultAnimationDurationInMs | DefaultItemCollectionTransitionProvider | [private]
DefaultItemCollectionTransitionProvider() | DefaultItemCollectionTransitionProvider | [inline, private, static]
DeleteInstanceOnUIThread(std::unique_ptr< ItemCollectionTransitionProvider > &&self) noexcept | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline, static]
EnsureProperties() | ItemCollectionTransitionProviderProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
final_release(std::unique_ptr< ItemCollectionTransitionProvider > &&self) | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
GetInner() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
IsOnThread() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
ItemCollectionTransitionProviderProperties() | ItemCollectionTransitionProviderProperties |
m_transitionCompletedEventSource | ItemCollectionTransitionProviderProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
NotifyTransitionCompleted(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionProvider |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
QueueTransition(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionProvider |
ReferenceTracker(Args &&...args) | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
ShouldAnimate(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionProvider |
ShouldAnimateCore(ItemCollectionTransition transition) | DefaultItemCollectionTransitionProvider | [inline, protected]
ItemCollectionTransitionProvider::ShouldAnimateCore(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionProvider | [virtual]
StartAddTransitions(IList< ItemCollectionTransition > transitions, bool hasRemoveTransitions, bool hasMoveTransitions) | DefaultItemCollectionTransitionProvider | [inline, private, static]
StartMoveTransitions(IList< ItemCollectionTransition > transitions, bool hasRemoveAnimations) | DefaultItemCollectionTransitionProvider | [inline, private, static]
StartRemoveTransitions(IList< ItemCollectionTransition > transitions) | DefaultItemCollectionTransitionProvider | [inline, private, static]
StartTransitions(IList< ItemCollectionTransition > transitions) | DefaultItemCollectionTransitionProvider | [inline, protected]
ItemCollectionTransitionProvider::StartTransitions(winrt::IVector< winrt::ItemCollectionTransition > const &transitions) | ItemCollectionTransitionProvider | [virtual]
TransitionCompleted(winrt::TypedEventHandler< winrt::ItemCollectionTransitionProvider, winrt::ItemCollectionTransitionCompletedEventArgs > const &value) | ItemCollectionTransitionProviderProperties |
TransitionCompleted(winrt::event_token const &token) | ItemCollectionTransitionProviderProperties |
~ItemCollectionTransitionProvider() | ItemCollectionTransitionProvider |
Generated on Sun Dec 1 2024 20:54:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PersonPicture/APITests/PersonPictureTests.cs Source File

  • PersonPicture
  • APITests

PersonPictureTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Reflection;
00006 using System.Threading;
00007 using Windows.ApplicationModel.Contacts;
00008 using Microsoft.UI.Xaml.Automation;
00009 using Microsoft.UI.Xaml.Controls;
00010 using Microsoft.UI.Xaml.Media;
00011 using Microsoft.UI.Xaml.Media.Imaging;
00012 using MUXControlsTestApp.Utilities;
00013 using Common;
00014
00015 using WEX.TestExecution;
00016 using WEX.TestExecution.Markup;
00017 using WEX.Logging.Interop;
00018
00019 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00020 {
00021     [TestClass]
00022     public class PersonPictureTests : ApiTestBase
00023     {
00024         [TestMethod]
00025         public void VerifyDefaultsAndBasicSetting()
00026         {
00027             RunOnUIThread.Execute(() =>
00028             {
00029                 PersonPicture personPicture = new PersonPicture();
00030                 Verify.IsNotNull(personPicture);
00031
00032                 // Confirm initial dependency property values
00033                 Verify.AreEqual(personPicture.BadgeGlyph, "");
00034                 Verify.AreEqual(personPicture.BadgeNumber, 0);
00035                 Verify.AreEqual(personPicture.IsGroup, false);
00036                 Verify.AreEqual(personPicture.PreferSmallImage, false);
00037                 Verify.AreEqual(personPicture.ProfilePicture, null);
00038                 Verify.AreEqual(personPicture.Contact, null);
00039                 Verify.AreEqual(personPicture.DisplayName, "");
00040                 Verify.AreEqual(personPicture.Initials, "");
00041
00042                 // Now verify setting/retrieving the parameters
00043                 personPicture.BadgeGlyph = "\uE765";
00044                 Verify.AreEqual(personPicture.BadgeGlyph, "\uE765");
00045                 personPicture.BadgeNumber = 10;
00046                 Verify.AreEqual(personPicture.BadgeNumber, 10);
00047                 personPicture.IsGroup = true;
00048                 Verify.AreEqual(personPicture.IsGroup, true);
00049                 personPicture.PreferSmallImage = true;
00050                 Verify.AreEqual(personPicture.PreferSmallImage, true);
00051                 personPicture.DisplayName = "Some Name";
00052                 Verify.AreEqual(personPicture.DisplayName, "Some Name");
00053                 personPicture.Initials = "MS";
00054                 Verify.AreEqual(personPicture.Initials, "MS");
00055
00056                 Contact contact = new Contact();
00057                 contact.FirstName = "FirstName";
00058                 personPicture.Contact = contact;
00059                 Verify.AreEqual(personPicture.Contact.FirstName, "FirstName");
00060
00061                 ImageSource imageSrc = new BitmapImage(new Uri("ms-appx:/Assets/StoreLogo.png"));
00062                 personPicture.ProfilePicture = imageSrc;
00063                 Verify.IsNotNull(personPicture.ProfilePicture);
00064             });
00065         }
00066
00067         [TestMethod]
00068         public void VerifyAutomationName()
00069         {
00070             RunOnUIThread.Execute(() =>
00071             {
00072                 PersonPicture personPicture = new PersonPicture();
00073                 Verify.IsNotNull(personPicture);
00074
00075                 // Set properties and ensure that the AutomationName updates accordingly
00076                 personPicture.Initials = "AB";
00077                 String automationName = AutomationProperties.GetName(personPicture);
00078                 Verify.AreEqual(automationName, "AB");
00079
00080                 personPicture.DisplayName = "Jane Smith";
00081                 automationName = AutomationProperties.GetName(personPicture);
00082                 Verify.AreEqual(automationName, "Jane Smith");
00083
00084                 Contact contact = new Contact();
00085                 contact.FirstName = "John";
00086                 contact.LastName = "Doe";
00087                 personPicture.Contact = contact;
00088                 automationName = AutomationProperties.GetName(personPicture);
00089                 Verify.AreEqual(automationName, "John Doe");
00090
00091                 personPicture.IsGroup = true;
00092                 automationName = AutomationProperties.GetName(personPicture);
00093                 Verify.AreEqual(automationName, "Group");
00094                 personPicture.IsGroup = false;
00095
00096                 personPicture.BadgeGlyph = "\uE765";
00097                 automationName = AutomationProperties.GetName(personPicture);
00098                 Verify.AreEqual(automationName, "John Doe, icon");
00099
00100                 personPicture.BadgeText = "Skype";
00101                 automationName = AutomationProperties.GetName(personPicture);
00102                 Verify.AreEqual(automationName, "John Doe, Skype");
00103                 personPicture.BadgeText = "";
00104
00105                 personPicture.BadgeNumber = 5;
00106                 automationName = AutomationProperties.GetName(personPicture);
00107                 Verify.AreEqual(automationName, "John Doe, 5 items");
00108
00109                 personPicture.BadgeText = "direct reports";
00110                 automationName = AutomationProperties.GetName(personPicture);
00111                 Verify.AreEqual(automationName, "John Doe, 5 direct reports");
00112             });
00113         }
00114
00115         // XamlControlsXamlMetaDataProvider does not exist in the OS repo,
00116         // so we can't execute this test as authored there.
00117         [TestMethod]
00118         public void VerifyContactPropertyMetadata()
00119         {
00120             RunOnUIThread.Execute(() =>
00121             {
00122                 Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider provider = new Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider();
00123                 var picturePersonType = provider.GetXamlType(typeof(PersonPicture).FullName);
00124                 var contactMember = picturePersonType.GetMember("Contact");
00125                 var memberType = contactMember.Type;
00126                 Verify.AreEqual(memberType.BaseType.FullName, "Object");
00127             });
00128         }
00129
00130         [TestMethod]
00131         public void VerifySmallWidthAndHeightDoNotCrash()
00132         {
00133             ManualResetEvent sizeChangedEvent = new ManualResetEvent(false);
00134             RunOnUIThread.Execute(() =>
00135             {
00136                 var personPicture = new PersonPicture();
00137                 Content = personPicture;
00138                 Content.UpdateLayout();
00139                 personPicture.SizeChanged += (sender, args) => sizeChangedEvent.Set();
00140                 personPicture.Width = 0.4;
00141                 personPicture.Height = 0.4;
00142                 Content.UpdateLayout();
00143             });
00144             sizeChangedEvent.WaitOne();
00145         }
00146
00147         [TestMethod]
00148         public void VerifyVSMStatesForPhotosAndInitials()
00149         {
00150             RunOnUIThread.Execute(() =>
00151             {
00152                 var personPicture = new PersonPicture();
00153                 Content = personPicture;
00154                 Content.UpdateLayout();
00155                 var initialsTextBlock = (TextBlock)VisualTreeUtils.FindVisualChildByName(personPicture, "InitialsTextBlock");
00156                 personPicture.IsGroup = true;
00157                 Content.UpdateLayout();
00158                 Verify.AreEqual(initialsTextBlock.FontFamily.Source, "Segoe Fluent Icons,Segoe MDL2 Assets");
00159                 Verify.AreEqual(initialsTextBlock.Text, "\xE716");
00160
00161                 personPicture.IsGroup = false;
00162                 personPicture.Initials = "JS";
00163                 Content.UpdateLayout();
00164                 Verify.AreEqual(initialsTextBlock.FontFamily.Source, "Segoe UI Variable");
00165                 Verify.AreEqual(initialsTextBlock.Text, "JS");
00166
00167                 personPicture.Initials = "";
00168                 Content.UpdateLayout();
00169                 Verify.AreEqual(initialsTextBlock.FontFamily.Source, "Segoe Fluent Icons,Segoe MDL2 Assets");
00170                 Verify.AreEqual(initialsTextBlock.Text, "\xE77B");
00171
00172                 // Make sure that custom FontFamily takes effect after the control is created
00173                 // and also goes back to the MDL2 font after setting IsGroup = true.
00174                 personPicture.FontFamily = new FontFamily("Segoe UI Emoji");
00175                 personPicture.Initials = "👍";
00176                 Content.UpdateLayout();
00177                 Verify.AreEqual(initialsTextBlock.FontFamily.Source, "Segoe UI Emoji");
00178                 Verify.AreEqual(initialsTextBlock.Text, "👍");
00179
00180                 personPicture.IsGroup = true;
00181                 Content.UpdateLayout();
00182                 Verify.AreEqual(initialsTextBlock.FontFamily.Source, "Segoe Fluent Icons,Segoe MDL2 Assets");
00183                 Verify.AreEqual(initialsTextBlock.Text, "\xE716");
00184             });
00185         }
00186
00187         [TestMethod]
00188         public void VerifyPersonPictureVisualTree()
00189         {
00190             PersonPicture personPicture = null;
00191             RunOnUIThread.Execute(() =>
00192             {
00193                 personPicture = new PersonPicture { Initials="LC", Width=100, Height=100 };
00194             });
00195             TestUtilities.SetAsVisualTreeRoot(personPicture);
00196
00197             VisualTreeTestHelper.VerifyVisualTree(root: personPicture, verificationFileNamePrefix: "PersonPicture");
00198         }
00199     }
00200 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RatingItemImageInfoProperties Member List

This is the complete list of members for RatingItemImageInfoProperties, including all inherited members.
ClearProperties() | RatingItemImageInfoProperties | [static]
DisabledImage(winrt::ImageSource const &value) | RatingItemImageInfoProperties |
DisabledImage() | RatingItemImageInfoProperties |
DisabledImageProperty() | RatingItemImageInfoProperties | [inline, static]
EnsureProperties() | RatingItemImageInfoProperties | [static]
Image(winrt::ImageSource const &value) | RatingItemImageInfoProperties |
Image() | RatingItemImageInfoProperties |
ImageProperty() | RatingItemImageInfoProperties | [inline, static]
PlaceholderImage(winrt::ImageSource const &value) | RatingItemImageInfoProperties |
PlaceholderImage() | RatingItemImageInfoProperties |
PlaceholderImageProperty() | RatingItemImageInfoProperties | [inline, static]
PointerOverImage(winrt::ImageSource const &value) | RatingItemImageInfoProperties |
PointerOverImage() | RatingItemImageInfoProperties |
PointerOverImageProperty() | RatingItemImageInfoProperties | [inline, static]
PointerOverPlaceholderImage(winrt::ImageSource const &value) | RatingItemImageInfoProperties |
PointerOverPlaceholderImage() | RatingItemImageInfoProperties |
PointerOverPlaceholderImageProperty() | RatingItemImageInfoProperties | [inline, static]
RatingItemImageInfoProperties() | RatingItemImageInfoProperties |
s_DisabledImageProperty | RatingItemImageInfoProperties | [static]
s_ImageProperty | RatingItemImageInfoProperties | [static]
s_PlaceholderImageProperty | RatingItemImageInfoProperties | [static]
s_PointerOverImageProperty | RatingItemImageInfoProperties | [static]
s_PointerOverPlaceholderImageProperty | RatingItemImageInfoProperties | [static]
s_UnsetImageProperty | RatingItemImageInfoProperties | [static]
UnsetImage(winrt::ImageSource const &value) | RatingItemImageInfoProperties |
UnsetImage() | RatingItemImageInfoProperties |
UnsetImageProperty() | RatingItemImageInfoProperties | [inline, static]
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ColorPickerSliderAutomationPeer.properties.cpp Source File

  • Generated

ColorPickerSliderAutomationPeer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "ColorPickerSliderAutomationPeer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Automation::Peers
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(ColorPickerSliderAutomationPeer)
00012 }
00013
00014 #include "ColorPickerSliderAutomationPeer.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ParallaxView/APITests/ParallaxViewTests.cs Source File

  • ParallaxView
  • APITests

ParallaxViewTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using MUXControlsTestApp.Utilities;
00006
00007 using System;
00008 using System.Numerics;
00009 using System.Threading;
00010
00011 using Windows.Foundation;
00012 using Windows.UI;
00013 using Microsoft.UI.Composition;
00014 using Microsoft.UI.Xaml;
00015 using Microsoft.UI.Xaml.Controls;
00016 using Microsoft.UI.Xaml.Controls.Primitives;
00017 using Microsoft.UI.Xaml.Hosting;
00018 using Microsoft.UI.Xaml.Media;
00019 using Microsoft.UI.Xaml.Shapes;
00020 using Microsoft.UI.Private.Controls;
00021
00022 using WEX.TestExecution;
00023 using WEX.TestExecution.Markup;
00024 using WEX.Logging.Interop;
00025
00026 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00027 {
00028     [TestClass]
00029     public class ParallaxViewTests : ApiTestBase
00030     {
00031         private const float c_shiftTolerance = 0.0001f;
00032         private const int c_MaxWaitDuration = 5000;
00033
00034         private const ParallaxSourceOffsetKind c_defaultHorizontalSourceOffsetKind = ParallaxSourceOffsetKind.Relative;
00035         private const double c_defaultHorizontalSourceStartOffset = 0.0;
00036         private const double c_defaultHorizontalSourceEndOffset = 0.0;
00037         private const double c_defaultMaxHorizontalShiftRatio = 1.0;
00038         private const double c_defaultHorizontalShift = 0.0;
00039         private const bool c_defaultIsHorizontalShiftClamped = true;
00040         private const ParallaxSourceOffsetKind c_defaultVerticalSourceOffsetKind = ParallaxSourceOffsetKind.Relative;
00041         private const double c_defaultVerticalSourceStartOffset = 0.0;
00042         private const double c_defaultVerticalSourceEndOffset = 0.0;
00043         private const double c_defaultMaxVerticalShiftRatio = 1.0;
00044         private const double c_defaultVerticalShift = 0.0;
00045         private const bool c_defaultIsVerticalShiftClamped = true;
00046
00047         private const double c_scrollViewerMaxOverpanRatio = 0.1;  // ScrollViewer's maximum underpan/viewport and overpan/viewport ratio
00048         private const double c_scrollViewerMaxOverpanRatioWithZoom = 1.0;  // ScrollViewer's maximum underpan/viewport and overpan/viewport ratio when ZoomMode is Enabled
00049         private const double c_scrollPresenterMaxOverpanRatio = 1.0;  // ScrollPresenter's maximum underpan/viewport and overpan/viewport ratio
00050         private const double c_defaultUIScrollPresenterWidth = 200.0;
00051         private const double c_defaultUIScrollPresenterHeight = 100.0;
00052         private const double c_defaultUIScrollPresenterContentWidth = 1200.0;
00053         private const double c_defaultUIScrollPresenterContentHeight = 600.0;
00054         private const double c_defaultUIFinalScrollPresenterHorizontalOffset = 100.0;
00055         private const double c_defaultUIFinalScrollPresenterVerticalOffset = 50.0;
00056         private const double c_defaultUIScrollViewerWidth = 200.0;
00057         private const double c_defaultUIScrollViewerHeight = 100.0;
00058         private const double c_defaultUIScrollViewerContentWidth = 1200.0;
00059         private const double c_defaultUIScrollViewerContentHeight = 600.0;
00060         private const double c_defaultUIFinalScrollViewerHorizontalOffset = 100.0;
00061         private const double c_defaultUIFinalScrollViewerVerticalOffset = 50.0;
00062         private const double c_defaultUIHorizontalShift = 100.0;
00063         private const double c_defaultUIVerticalShift = 50.0;
00064
00065         // Enum used in tests that use ChangePropertyAfterParallaxViewDisposal
00066         private enum PropertyId
00067         {
00068             ParallaxViewChildVerticalAlignment,
00069             ScrollViewerContentHeight,
00070         }
00071
00072         private enum SourceType
00073         {
00074             ScrollViewer,
00075             ScrollPresenter,
00076         }
00077
00078         [TestMethod]
00079         [Description("Verifies the ParallaxView default properties.")]
00080         public void VerifyDefaultPropertyValues()
00081         {
00082             RunOnUIThread.Execute(() =>
00083             {
00084                 ParallaxView parallaxView = new ParallaxView();
00085                 Verify.IsNotNull(parallaxView);
00086
00087                 Log.Comment("Verifying ParallaxView default property values");
00088                 Verify.IsNull(parallaxView.Child);
00089                 Verify.IsNull(parallaxView.Source);
00090                 Verify.AreEqual(parallaxView.HorizontalSourceOffsetKind, c_defaultHorizontalSourceOffsetKind);
00091                 Verify.AreEqual(parallaxView.HorizontalSourceStartOffset, c_defaultHorizontalSourceStartOffset);
00092                 Verify.AreEqual(parallaxView.HorizontalSourceEndOffset, c_defaultHorizontalSourceEndOffset);
00093                 Verify.AreEqual(parallaxView.MaxHorizontalShiftRatio, c_defaultMaxHorizontalShiftRatio);
00094                 Verify.AreEqual(parallaxView.HorizontalShift, c_defaultHorizontalShift);
00095                 Verify.AreEqual(parallaxView.IsHorizontalShiftClamped, c_defaultIsHorizontalShiftClamped);
00096                 Verify.AreEqual(parallaxView.VerticalSourceOffsetKind, c_defaultVerticalSourceOffsetKind);
00097                 Verify.AreEqual(parallaxView.VerticalSourceStartOffset, c_defaultVerticalSourceStartOffset);
00098                 Verify.AreEqual(parallaxView.VerticalSourceEndOffset, c_defaultVerticalSourceEndOffset);
00099                 Verify.AreEqual(parallaxView.MaxVerticalShiftRatio, c_defaultMaxVerticalShiftRatio);
00100                 Verify.AreEqual(parallaxView.VerticalShift, c_defaultVerticalShift);
00101                 Verify.AreEqual(parallaxView.IsVerticalShiftClamped, c_defaultIsVerticalShiftClamped);
00102             });
00103         }
00104
00105         [TestMethod]
00106         [Description("Exercises the ParallaxView property setters and getters for non-default values.")]
00107         public void VerifyPropertyGettersAndSetters()
00108         {
00109             ParallaxView parallaxView = null;
00110             Rectangle rectangle = null;
00111             ScrollViewer scrollViewer = null;
00112
00113             RunOnUIThread.Execute(() =>
00114             {
00115                 parallaxView = new ParallaxView();
00116                 Verify.IsNotNull(parallaxView);
00117
00118                 rectangle = new Rectangle();
00119                 Verify.IsNotNull(rectangle);
00120
00121                 scrollViewer = new ScrollViewer();
00122                 Verify.IsNotNull(scrollViewer);
00123
00124                 Log.Comment("Setting ParallaxView properties to non-default values");
00125                 parallaxView.Child = rectangle;
00126                 parallaxView.Source = scrollViewer;
00127                 parallaxView.HorizontalSourceOffsetKind = ParallaxSourceOffsetKind.Absolute;
00128                 parallaxView.HorizontalSourceStartOffset = 11.0;
00129                 parallaxView.HorizontalSourceEndOffset = 22.0;
00130                 parallaxView.MaxHorizontalShiftRatio = 0.123;
00131                 parallaxView.HorizontalShift = 321.0;
00132                 parallaxView.IsHorizontalShiftClamped = false;
00133                 parallaxView.VerticalSourceOffsetKind = ParallaxSourceOffsetKind.Absolute;
00134                 parallaxView.VerticalSourceStartOffset = 4.5;
00135                 parallaxView.VerticalSourceEndOffset = 5.4;
00136                 parallaxView.MaxVerticalShiftRatio = 0.321;
00137                 parallaxView.VerticalShift = 45.6;
00138                 parallaxView.IsVerticalShiftClamped = false;
00139             });
00140
00141             IdleSynchronizer.Wait();
00142
00143             RunOnUIThread.Execute(() =>
00144             {
00145                 Log.Comment("Verifying ParallaxView non-default property values");
00146                 Verify.AreEqual(parallaxView.Child, rectangle);
00147                 Verify.AreEqual(parallaxView.Source, scrollViewer);
00148                 Verify.AreEqual(parallaxView.HorizontalSourceOffsetKind, ParallaxSourceOffsetKind.Absolute);
00149                 Verify.AreEqual(parallaxView.HorizontalSourceStartOffset, 11.0);
00150                 Verify.AreEqual(parallaxView.HorizontalSourceEndOffset, 22.0);
00151                 Verify.AreEqual(parallaxView.MaxHorizontalShiftRatio, 0.123);
00152                 Verify.AreEqual(parallaxView.HorizontalShift, 321.0);
00153                 Verify.IsFalse(parallaxView.IsHorizontalShiftClamped);
00154                 Verify.AreEqual(parallaxView.VerticalSourceOffsetKind, ParallaxSourceOffsetKind.Absolute);
00155                 Verify.AreEqual(parallaxView.VerticalSourceStartOffset, 4.5);
00156                 Verify.AreEqual(parallaxView.VerticalSourceEndOffset, 5.4);
00157                 Verify.AreEqual(parallaxView.MaxVerticalShiftRatio, 0.321);
00158                 Verify.AreEqual(parallaxView.VerticalShift, 45.6);
00159                 Verify.IsFalse(parallaxView.IsVerticalShiftClamped);
00160             });
00161         }
00162
00163         [TestMethod]
00164         [Description("Parallaxes a Rectangle based on a ListView's ScrollViewer.")]
00165         public void VerifyBasicParallaxingWithListView()
00166         {
00167             ParallaxView parallaxView = null;
00168             Rectangle rectanglePVChild = null;
00169             ListView listView = null;
00170             ScrollViewer scrollViewer = null;
00171             Visual visualPPChild = null;
00172             AutoResetEvent parallaxViewLoadedEvent = null;
00173             AutoResetEvent sourceLoadedEvent = null;
00174             float? finalHorizontalShift = 0f;
00175             float? finalVerticalShift = 0f;
00176             double expectedVerticalShift = 0.0;
00177
00178             RunOnUIThread.Execute(() =>
00179             {
00180                 parallaxViewLoadedEvent = new AutoResetEvent(false);
00181                 sourceLoadedEvent = new AutoResetEvent(false);
00182                 listView = new ListView();
00183                 rectanglePVChild = new Rectangle();
00184                 parallaxView = new ParallaxView();
00185
00186                 SetupDefaultUIWithListView(
00187                     parallaxView, rectanglePVChild, listView,
00188                     parallaxViewLoadedEvent, sourceLoadedEvent);
00189
00190                 parallaxView.VerticalSourceOffsetKind = c_defaultVerticalSourceOffsetKind;
00191                 parallaxView.VerticalSourceStartOffset = c_defaultVerticalSourceStartOffset;
00192                 parallaxView.VerticalSourceEndOffset = c_defaultVerticalSourceEndOffset;
00193                 parallaxView.MaxVerticalShiftRatio = c_defaultMaxVerticalShiftRatio;
00194                 parallaxView.IsVerticalShiftClamped = c_defaultIsVerticalShiftClamped;
00195             });
00196
00197             Log.Comment("Waiting for Loaded events");
00198             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00199             sourceLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00200             Log.Comment("Default UI set up");
00201
00202             RunOnUIThread.Execute(() =>
00203             {
00204                 // Locate ListView's inner ScrollViewer
00205                 scrollViewer = FindInnerScrollViewer(listView);
00206
00207                 expectedVerticalShift =
00208                     (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerVerticalOffset) * c_defaultUIVerticalShift /
00209                     (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio * 2.0 + ((scrollViewer.Content as FrameworkElement).ActualHeight - c_defaultUIScrollViewerHeight));
00210
00211                 Log.Comment("Setting up spy property set");
00212                 visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild);
00213
00214                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00215                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00216             });
00217
00218             ChangeScrollViewerView(
00219                 scrollViewer: scrollViewer,
00220                 horizontalOffset: 0.0,
00221                 verticalOffset: c_defaultUIFinalScrollViewerVerticalOffset,
00222                 zoomFactor: 1.0f,
00223                 disableAnimation: false,
00224                 visualPPChild: visualPPChild,
00225                 finalHorizontalShift: ref finalHorizontalShift,
00226                 finalVerticalShift: ref finalVerticalShift);
00227
00228             RunOnUIThread.Execute(() =>
00229             {
00230                 Log.Comment("Validating the final parallax amount of the target Rectangle.");
00231                 Log.Comment("expectedHorizontalShift=0, finalHorizontalShift={0}", finalHorizontalShift);
00232                 Log.Comment("expectedVerticalShift={0}, finalVerticalShift={1}", -expectedVerticalShift, finalVerticalShift);
00233                 Verify.AreEqual(finalHorizontalShift, 0);
00234                 Verify.IsTrue(Math.Abs((double)finalVerticalShift + expectedVerticalShift) < 0.00001);
00235             });
00236         }
00237
00238         [TestMethod]
00239         [Description("Parallaxes a Rectangle based on another Rectangle in a ScrollViewer.")]
00240         public void VerifyBasicParallaxingWithScrollViewer()
00241         {
00242             const double expectedHorizontalShift =
00243                 (c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerHorizontalOffset) * c_defaultUIHorizontalShift /
00244                 (c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatio * 2.0 + (c_defaultUIScrollViewerContentWidth - c_defaultUIScrollViewerWidth));
00245             const double expectedVerticalShift =
00246                 (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerVerticalOffset) * c_defaultUIVerticalShift /
00247                 (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio * 2.0 + (c_defaultUIScrollViewerContentHeight - c_defaultUIScrollViewerHeight));
00248
00249             VerifyParallaxingWithDefaultSourceUI(
00250                 sourceType: SourceType.ScrollViewer,
00251                 horizontalSourceOffsetKind: c_defaultHorizontalSourceOffsetKind,
00252                 horizontalSourceStartOffset: c_defaultHorizontalSourceStartOffset,
00253                 horizontalSourceEndOffset: c_defaultHorizontalSourceEndOffset,
00254                 maxHorizontalShiftRatio: c_defaultMaxHorizontalShiftRatio,
00255                 isHorizontalShiftClamped: c_defaultIsHorizontalShiftClamped,
00256                 expectedHorizontalShift: expectedHorizontalShift,
00257                 verticalSourceOffsetKind: c_defaultVerticalSourceOffsetKind,
00258                 verticalSourceStartOffset: c_defaultVerticalSourceStartOffset,
00259                 verticalSourceEndOffset: c_defaultVerticalSourceEndOffset,
00260                 maxVerticalShiftRatio: c_defaultMaxVerticalShiftRatio,
00261                 isVerticalShiftClamped: c_defaultIsVerticalShiftClamped,
00262                 expectedVerticalShift: expectedVerticalShift);
00263         }
00264
00265         [TestMethod]
00266         [Description("Parallaxes a Rectangle based on another Rectangle in a Scroller.")]
00267         public void VerifyBasicParallaxingWithScroller()
00268         {
00269             const double expectedHorizontalShift =
00270                 (c_defaultUIScrollPresenterWidth * c_scrollPresenterMaxOverpanRatio + c_defaultUIFinalScrollPresenterHorizontalOffset) * c_defaultUIHorizontalShift /
00271                 (c_defaultUIScrollPresenterWidth * c_scrollPresenterMaxOverpanRatio * 2.0 + (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth));
00272             const double expectedVerticalShift =
00273                 (c_defaultUIScrollPresenterHeight * c_scrollPresenterMaxOverpanRatio + c_defaultUIFinalScrollPresenterVerticalOffset) * c_defaultUIVerticalShift /
00274                 (c_defaultUIScrollPresenterHeight * c_scrollPresenterMaxOverpanRatio * 2.0 + (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight));
00275
00276             VerifyParallaxingWithDefaultSourceUI(
00277                 sourceType: SourceType.ScrollPresenter,
00278                 horizontalSourceOffsetKind: c_defaultHorizontalSourceOffsetKind,
00279                 horizontalSourceStartOffset: c_defaultHorizontalSourceStartOffset,
00280                 horizontalSourceEndOffset: c_defaultHorizontalSourceEndOffset,
00281                 maxHorizontalShiftRatio: c_defaultMaxHorizontalShiftRatio,
00282                 isHorizontalShiftClamped: c_defaultIsHorizontalShiftClamped,
00283                 expectedHorizontalShift: expectedHorizontalShift,
00284                 verticalSourceOffsetKind: c_defaultVerticalSourceOffsetKind,
00285                 verticalSourceStartOffset: c_defaultVerticalSourceStartOffset,
00286                 verticalSourceEndOffset: c_defaultVerticalSourceEndOffset,
00287                 maxVerticalShiftRatio: c_defaultMaxVerticalShiftRatio,
00288                 isVerticalShiftClamped: c_defaultIsVerticalShiftClamped,
00289                 expectedVerticalShift: expectedVerticalShift);
00290         }
00291
00292         [TestMethod]
00293         [Description("Parallaxes a Rectangle based on another Rectangle in a ScrollViewer, using the Absolute HorizontalSourceOffsetKind/VerticalSourceOffsetKind value.")]
00294         public void VerifyParallaxingWithAbsoluteExtremes()
00295         {
00296             ParallaxView parallaxView = null;
00297             Rectangle rectanglePVChild = null;
00298             ScrollViewer scrollViewer = null;
00299             Rectangle rectangleSVContent = null;
00300             Visual visualPPChild = null;
00301             AutoResetEvent parallaxViewLoadedEvent = null;
00302             AutoResetEvent scrollViewerLoadedEvent = null;
00303             float? finalHorizontalShift = null;
00304             float? finalVerticalShift = null;
00305
00306             RunOnUIThread.Execute(() =>
00307             {
00308                 parallaxViewLoadedEvent = new AutoResetEvent(false);
00309                 scrollViewerLoadedEvent = new AutoResetEvent(false);
00310                 rectangleSVContent = new Rectangle();
00311                 scrollViewer = new ScrollViewer();
00312                 rectanglePVChild = new Rectangle();
00313                 parallaxView = new ParallaxView();
00314
00315                 SetupDefaultUIWithScrollViewer(
00316                     parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent,
00317                     parallaxViewLoadedEvent, scrollViewerLoadedEvent);
00318
00319                 parallaxView.HorizontalSourceOffsetKind = ParallaxSourceOffsetKind.Absolute;
00320                 parallaxView.HorizontalSourceStartOffset = 40.0;
00321                 parallaxView.HorizontalSourceEndOffset = 920.0;
00322                 parallaxView.VerticalSourceOffsetKind = ParallaxSourceOffsetKind.Absolute;
00323                 parallaxView.VerticalSourceStartOffset = -30.0;
00324                 parallaxView.VerticalSourceEndOffset = 560.0;
00325             });
00326
00327             Log.Comment("Waiting for Loaded events");
00328             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00329             scrollViewerLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00330             Log.Comment("Default UI set up");
00331
00332             ChangeScrollViewerView(
00333                 scrollViewer: scrollViewer,
00334                 horizontalOffset: c_defaultUIFinalScrollViewerHorizontalOffset,
00335                 verticalOffset: c_defaultUIFinalScrollViewerVerticalOffset,
00336                 zoomFactor: 1.0f,
00337                 disableAnimation: false,
00338                 visualPPChild: null,
00339                 finalHorizontalShift: ref finalHorizontalShift,
00340                 finalVerticalShift: ref finalVerticalShift);
00341
00342             RunOnUIThread.Execute(() =>
00343             {
00344                 Log.Comment("Setting up spy property set");
00345                 visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild);
00346
00347                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00348                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00349             });
00350
00351             Log.Comment("Waiting for spied properties to be captured");
00352             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00353
00354             RunOnUIThread.Execute(() =>
00355             {
00356                 Log.Comment("Cancelling spying");
00357                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00358                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00359             });
00360
00361             Log.Comment("Waiting for captured properties to be updated");
00362             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00363
00364             RunOnUIThread.Execute(() =>
00365             {
00366                 // Validate the final parallax amount of the target Rectangle.
00367                 double expectedHorizontalShift =
00368                     (scrollViewer.HorizontalOffset - parallaxView.HorizontalSourceStartOffset) * parallaxView.HorizontalShift / (parallaxView.HorizontalSourceEndOffset - parallaxView.HorizontalSourceStartOffset);
00369                 double expectedVerticalShift =
00370                     (scrollViewer.VerticalOffset - parallaxView.VerticalSourceStartOffset) * parallaxView.VerticalShift / (parallaxView.VerticalSourceEndOffset - parallaxView.VerticalSourceStartOffset);
00371
00372                 float offset;
00373                 CompositionGetValueStatus status;
00374
00375                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out offset);
00376                 Log.Comment("Target transform after view change: status={0}, horizontal offset={1}", status, offset);
00377                 Log.Comment("expectedHorizontalShift={0}", -expectedHorizontalShift);
00378                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedHorizontalShift, c_shiftTolerance));
00379
00380                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out offset);
00381                 Log.Comment("Target transform after view change: status={0}, vertical offset={1}", status, offset);
00382                 Log.Comment("expectedVerticalShift={0}", -expectedVerticalShift);
00383                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedVerticalShift, c_shiftTolerance));
00384             });
00385         }
00386
00387         [TestMethod]
00388         [Description("Parallaxes a Rectangle based on another Rectangle in a ScrollViewer, while ScrollViewer.ZoomMode is Enabled.")]
00389         public void VerifyParallaxingWithZooming()
00390         {
00391             ParallaxView parallaxView = null;
00392             Rectangle rectanglePVChild = null;
00393             ScrollViewer scrollViewer = null;
00394             Rectangle rectangleSVContent = null;
00395             Visual visualPPChild = null;
00396             AutoResetEvent parallaxViewLoadedEvent = null;
00397             AutoResetEvent scrollViewerLoadedEvent = null;
00398             float? finalHorizontalShift = null;
00399             float? finalVerticalShift = null;
00400
00401             RunOnUIThread.Execute(() =>
00402             {
00403                 parallaxViewLoadedEvent = new AutoResetEvent(false);
00404                 scrollViewerLoadedEvent = new AutoResetEvent(false);
00405                 rectangleSVContent = new Rectangle();
00406                 scrollViewer = new ScrollViewer();
00407                 rectanglePVChild = new Rectangle();
00408                 parallaxView = new ParallaxView();
00409
00410                 SetupDefaultUIWithScrollViewer(
00411                     parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent,
00412                     parallaxViewLoadedEvent, scrollViewerLoadedEvent);
00413
00414                 scrollViewer.ZoomMode = Microsoft.UI.Xaml.Controls.ZoomMode.Enabled;
00415             });
00416
00417             Log.Comment("Waiting for Loaded events");
00418             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00419             scrollViewerLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00420             Log.Comment("Default UI set up");
00421
00422             RunOnUIThread.Execute(() =>
00423             {
00424                 Log.Comment("Setting up spy property set");
00425                 visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild);
00426
00427                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00428                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00429             });
00430
00431             Log.Comment("Waiting for spied properties to be captured");
00432             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00433
00434             RunOnUIThread.Execute(() =>
00435             {
00436                 Log.Comment("Cancelling spying");
00437                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00438                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00439             });
00440
00441             Log.Comment("Waiting for captured properties to be updated");
00442             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00443
00444             RunOnUIThread.Execute(() =>
00445             {
00446                 // Validate the initial parallax amount of the target Rectangle.
00447                 const double expectedHorizontalShift =
00448                     c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatioWithZoom * c_defaultUIHorizontalShift /
00449                     (c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatioWithZoom * 2.0 + (c_defaultUIScrollViewerContentWidth - c_defaultUIScrollViewerWidth));
00450                 const double expectedVerticalShift =
00451                     c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatioWithZoom * c_defaultUIVerticalShift /
00452                     (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatioWithZoom * 2.0 + (c_defaultUIScrollViewerContentHeight - c_defaultUIScrollViewerHeight));
00453
00454                 float offset;
00455                 CompositionGetValueStatus status;
00456
00457                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out offset);
00458                 Log.Comment("Target transform before view change: status={0}, horizontal offset={1}", status, offset);
00459                 Log.Comment("expectedHorizontalShift={0}", -expectedHorizontalShift);
00460                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedHorizontalShift, c_shiftTolerance));
00461
00462                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out offset);
00463                 Log.Comment("Target transform before view change: status={0}, vertical offset={1}", status, offset);
00464                 Log.Comment("expectedVerticalShift={0}", -expectedVerticalShift);
00465                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedVerticalShift, c_shiftTolerance));
00466
00467                 Log.Comment("Start spying again");
00468                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00469                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00470             });
00471
00472             ChangeScrollViewerView(
00473                 scrollViewer: scrollViewer,
00474                 horizontalOffset: c_defaultUIFinalScrollViewerHorizontalOffset,
00475                 verticalOffset: c_defaultUIFinalScrollViewerVerticalOffset,
00476                 zoomFactor: 2.0f,
00477                 disableAnimation: false,
00478                 visualPPChild: null,
00479                 finalHorizontalShift: ref finalHorizontalShift,
00480                 finalVerticalShift: ref finalVerticalShift);
00481
00482             Log.Comment("Waiting for spied properties to be captured");
00483             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00484
00485             RunOnUIThread.Execute(() =>
00486             {
00487                 Log.Comment("Cancelling spying");
00488                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00489                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00490             });
00491
00492             Log.Comment("Waiting for captured properties to be updated");
00493             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00494
00495             RunOnUIThread.Execute(() =>
00496             {
00497                 // Validate the final parallax amount of the target Rectangle.
00498                 const double expectedHorizontalShift =
00499                     (c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatioWithZoom + c_defaultUIFinalScrollViewerHorizontalOffset) * c_defaultUIHorizontalShift /
00500                     (c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatioWithZoom * 2.0 + (c_defaultUIScrollViewerContentWidth * 2.0 - c_defaultUIScrollViewerWidth));
00501                 const double expectedVerticalShift =
00502                     (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatioWithZoom + c_defaultUIFinalScrollViewerVerticalOffset) * c_defaultUIVerticalShift /
00503                     (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatioWithZoom * 2.0 + (c_defaultUIScrollViewerContentHeight * 2.0 - c_defaultUIScrollViewerHeight));
00504
00505                 float offset;
00506                 CompositionGetValueStatus status;
00507
00508                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out offset);
00509                 Log.Comment("Target transform after view change: status={0}, horizontal offset={1}", status, offset);
00510                 Log.Comment("expectedHorizontalShift={0}", -expectedHorizontalShift);
00511                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedHorizontalShift, c_shiftTolerance));
00512
00513                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out offset);
00514                 Log.Comment("Target transform after view change: status={0}, vertical offset={1}", status, offset);
00515                 Log.Comment("expectedVerticalShift={0}", -expectedVerticalShift);
00516                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedVerticalShift, c_shiftTolerance));
00517             });
00518         }
00519
00520         [TestMethod]
00521         [Description("Parallaxes a Rectangle based on another Rectangle in a ScrollViewer, using the MaxHorizontalShiftRatio/MaxVerticalShiftRatio properties.")]
00522         public void VerifyParallaxingWithMaxRatios()
00523         {
00524             const double maxHorizontalShiftRatio = 0.01;
00525             const double maxVerticalShiftRatio = 0.02;
00526
00527             const double expectedHorizontalShift =
00528                 (c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerHorizontalOffset) * maxHorizontalShiftRatio;
00529             const double expectedVerticalShift =
00530                 (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerVerticalOffset) * maxVerticalShiftRatio;
00531
00532             VerifyParallaxingWithDefaultSourceUI(
00533                 sourceType: SourceType.ScrollViewer,
00534                 horizontalSourceOffsetKind: c_defaultHorizontalSourceOffsetKind,
00535                 horizontalSourceStartOffset: c_defaultHorizontalSourceStartOffset,
00536                 horizontalSourceEndOffset: c_defaultHorizontalSourceEndOffset,
00537                 maxHorizontalShiftRatio: maxHorizontalShiftRatio,
00538                 isHorizontalShiftClamped: c_defaultIsHorizontalShiftClamped,
00539                 expectedHorizontalShift: expectedHorizontalShift,
00540                 verticalSourceOffsetKind: c_defaultVerticalSourceOffsetKind,
00541                 verticalSourceStartOffset: c_defaultVerticalSourceStartOffset,
00542                 verticalSourceEndOffset: c_defaultVerticalSourceEndOffset,
00543                 maxVerticalShiftRatio: maxVerticalShiftRatio,
00544                 isVerticalShiftClamped: c_defaultIsVerticalShiftClamped,
00545                 expectedVerticalShift: expectedVerticalShift);
00546         }
00547
00548         [TestMethod]
00549         [Description("Parallaxes a Rectangle based on another Rectangle in a ScrollViewer, without clamping, using the IsHorizontalShiftClamped/IsVerticalShiftClamped properties.")]
00550         public void VerifyParallaxingWithoutClamping()
00551         {
00552             const double horizontalSourceStartOffset = 40.0;
00553             const double horizontalSourceEndOffset = 60.0;
00554             const double maxHorizontalShiftRatio = 5.0;
00555             const double verticalSourceStartOffset = 10.0;
00556             const double verticalSourceEndOffset = 30.0;
00557             const double maxVerticalShiftRatio = 2.5;
00558
00559             const double expectedHorizontalShift =
00560                 (c_defaultUIFinalScrollViewerHorizontalOffset - horizontalSourceStartOffset) * c_defaultUIHorizontalShift / (horizontalSourceEndOffset - horizontalSourceStartOffset);
00561             const double expectedVerticalShift =
00562                 (c_defaultUIFinalScrollViewerVerticalOffset - verticalSourceStartOffset) * c_defaultUIVerticalShift / (verticalSourceEndOffset - verticalSourceStartOffset);
00563
00564             VerifyParallaxingWithDefaultSourceUI(
00565                 sourceType: SourceType.ScrollViewer,
00566                 horizontalSourceOffsetKind: ParallaxSourceOffsetKind.Absolute,
00567                 horizontalSourceStartOffset: horizontalSourceStartOffset,
00568                 horizontalSourceEndOffset: horizontalSourceEndOffset,
00569                 maxHorizontalShiftRatio: maxHorizontalShiftRatio,
00570                 isHorizontalShiftClamped: false,
00571                 expectedHorizontalShift: expectedHorizontalShift,
00572                 verticalSourceOffsetKind: ParallaxSourceOffsetKind.Absolute,
00573                 verticalSourceStartOffset: verticalSourceStartOffset,
00574                 verticalSourceEndOffset: verticalSourceEndOffset,
00575                 maxVerticalShiftRatio: maxVerticalShiftRatio,
00576                 isVerticalShiftClamped: false,
00577                 expectedVerticalShift: expectedVerticalShift);
00578         }
00579
00580         [TestMethod]
00581         [Description("Parallaxes a Rectangle based on another Rectangle in a ScrollViewer, with clamping, using the IsHorizontalShiftClamped/IsVerticalShiftClamped properties.")]
00582         public void VerifyParallaxingWithClamping()
00583         {
00584             VerifyParallaxingWithDefaultSourceUI(
00585                 sourceType: SourceType.ScrollViewer,
00586                 horizontalSourceOffsetKind: ParallaxSourceOffsetKind.Absolute,
00587                 horizontalSourceStartOffset: 40.0,
00588                 horizontalSourceEndOffset: 60.0,
00589                 maxHorizontalShiftRatio: 5.0 ,
00590                 isHorizontalShiftClamped: true,
00591                 expectedHorizontalShift: c_defaultUIHorizontalShift,
00592                 verticalSourceOffsetKind: ParallaxSourceOffsetKind.Absolute,
00593                 verticalSourceStartOffset: 10.0,
00594                 verticalSourceEndOffset: 30.0,
00595                 maxVerticalShiftRatio: 2.5,
00596                 isVerticalShiftClamped: true,
00597                 expectedVerticalShift: c_defaultUIVerticalShift);
00598         }
00599
00600         [TestMethod]
00601         [Description("Parallaxes a Rectangle based on another Rectangle in a ScrollViewer, and changes the sizes of the ScrollViewer & its content.")]
00602         public void VerifyParallaxingWithSizeChanges()
00603         {
00604             ParallaxView parallaxView = null;
00605             Rectangle rectanglePVChild = null;
00606             ScrollViewer scrollViewer = null;
00607             Rectangle rectangleSVContent = null;
00608             Visual visualPPChild = null;
00609             AutoResetEvent parallaxViewLoadedEvent = null;
00610             AutoResetEvent scrollViewerLoadedEvent = null;
00611             float? finalHorizontalShift = null;
00612             float? finalVerticalShift = null;
00613
00614             RunOnUIThread.Execute(() =>
00615             {
00616                 parallaxViewLoadedEvent = new AutoResetEvent(false);
00617                 scrollViewerLoadedEvent = new AutoResetEvent(false);
00618                 rectangleSVContent = new Rectangle();
00619                 scrollViewer = new ScrollViewer();
00620                 rectanglePVChild = new Rectangle();
00621                 parallaxView = new ParallaxView();
00622
00623                 SetupDefaultUIWithScrollViewer(
00624                     parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent,
00625                     parallaxViewLoadedEvent, scrollViewerLoadedEvent);
00626             });
00627
00628             Log.Comment("Waiting for Loaded events");
00629             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00630             scrollViewerLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00631             Log.Comment("Default UI set up");
00632
00633             ChangeScrollViewerView(
00634                 scrollViewer: scrollViewer,
00635                 horizontalOffset: c_defaultUIFinalScrollViewerHorizontalOffset,
00636                 verticalOffset: c_defaultUIFinalScrollViewerVerticalOffset,
00637                 zoomFactor: 1.0f,
00638                 disableAnimation: false,
00639                 visualPPChild: null,
00640                 finalHorizontalShift: ref finalHorizontalShift,
00641                 finalVerticalShift: ref finalVerticalShift);
00642
00643             RunOnUIThread.Execute(() =>
00644             {
00645                 Log.Comment("Setting up spy property set");
00646                 visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild);
00647
00648                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00649                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00650             });
00651
00652             Log.Comment("Waiting for spied properties to be captured");
00653             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00654
00655             RunOnUIThread.Execute(() =>
00656             {
00657                 Log.Comment("Cancelling spying");
00658                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00659                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00660             });
00661
00662             Log.Comment("Waiting for captured properties to be updated");
00663             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00664
00665             RunOnUIThread.Execute(() =>
00666             {
00667                 // Validate the parallax amount of the target Rectangle.
00668                 const double expectedHorizontalShift =
00669                     (c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerHorizontalOffset) * c_defaultUIHorizontalShift /
00670                     (c_defaultUIScrollViewerWidth * c_scrollViewerMaxOverpanRatio * 2.0 + (c_defaultUIScrollViewerContentWidth - c_defaultUIScrollViewerWidth));
00671                 const double expectedVerticalShift =
00672                     (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerVerticalOffset) * c_defaultUIVerticalShift /
00673                     (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio * 2.0 + (c_defaultUIScrollViewerContentHeight - c_defaultUIScrollViewerHeight));
00674
00675                 float offset;
00676                 CompositionGetValueStatus status;
00677
00678                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out offset);
00679                 Log.Comment("Target transform after view change: status={0}, horizontal offset={1}", status, offset);
00680                 Log.Comment("expectedHorizontalShift={0}", -expectedHorizontalShift);
00681                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedHorizontalShift, c_shiftTolerance));
00682
00683                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out offset);
00684                 Log.Comment("Target transform after view change: status={0}, vertical offset={1}", status, offset);
00685                 Log.Comment("expectedVerticalShift={0}", -expectedVerticalShift);
00686                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedVerticalShift, c_shiftTolerance));
00687
00688                 Log.Comment("Decreasing the ScrollViewer's Width and increasing its Height");
00689                 scrollViewer.Width -= 20.0;
00690                 scrollViewer.Height += 20.0;
00691
00692                 Log.Comment("Setting up spy property set");
00693                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00694                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00695             });
00696
00697             Log.Comment("Waiting for spied properties to be captured");
00698             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00699
00700             RunOnUIThread.Execute(() =>
00701             {
00702                 Log.Comment("Cancelling spying");
00703                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00704                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00705             });
00706
00707             Log.Comment("Waiting for captured properties to be updated");
00708             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00709
00710             RunOnUIThread.Execute(() =>
00711             {
00712                 const double expectedHorizontalShift =
00713                     ((c_defaultUIScrollViewerWidth - 20.0) * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerHorizontalOffset) * c_defaultUIHorizontalShift /
00714                     ((c_defaultUIScrollViewerWidth - 20.0) * c_scrollViewerMaxOverpanRatio * 2.0 + (c_defaultUIScrollViewerContentWidth - (c_defaultUIScrollViewerWidth - 20.0)));
00715                 const double expectedVerticalShift =
00716                     ((c_defaultUIScrollViewerHeight + 20.0) * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerVerticalOffset) * c_defaultUIVerticalShift /
00717                     ((c_defaultUIScrollViewerHeight + 20.0) * c_scrollViewerMaxOverpanRatio * 2.0 + (c_defaultUIScrollViewerContentHeight - (c_defaultUIScrollViewerHeight + 20.0)));
00718
00719                 // Validate the parallax amount of the target Rectangle.
00720                 float offset;
00721                 CompositionGetValueStatus status;
00722
00723                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out offset);
00724                 Log.Comment("Target transform after view change: status={0}, horizontal offset={1}", status, offset);
00725                 Log.Comment("expectedHorizontalShift={0}", -expectedHorizontalShift);
00726                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedHorizontalShift, c_shiftTolerance));
00727
00728                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out offset);
00729                 Log.Comment("Target transform after view change: status={0}, vertical offset={1}", status, offset);
00730                 Log.Comment("expectedVerticalShift={0}", -expectedVerticalShift);
00731                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedVerticalShift, c_shiftTolerance));
00732
00733                 Log.Comment("Decreasing the ScrollViewer.Content's Width and increasing its Height");
00734                 rectangleSVContent.Width -= 20.0;
00735                 rectangleSVContent.Height += 20.0;
00736
00737                 Log.Comment("Setting up spy property set");
00738                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00739                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00740             });
00741
00742             Log.Comment("Waiting for spied properties to be captured");
00743             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00744
00745             RunOnUIThread.Execute(() =>
00746             {
00747                 Log.Comment("Cancelling spying");
00748                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
00749                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00750             });
00751
00752             Log.Comment("Waiting for captured properties to be updated");
00753             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00754
00755             RunOnUIThread.Execute(() =>
00756             {
00757                 const double expectedHorizontalShift =
00758                     ((c_defaultUIScrollViewerWidth - 20.0) * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerHorizontalOffset) * c_defaultUIHorizontalShift /
00759                     ((c_defaultUIScrollViewerWidth - 20.0) * c_scrollViewerMaxOverpanRatio * 2.0 + ((c_defaultUIScrollViewerContentWidth - 20.0) - (c_defaultUIScrollViewerWidth - 20.0)));
00760                 const double expectedVerticalShift =
00761                     ((c_defaultUIScrollViewerHeight + 20.0) * c_scrollViewerMaxOverpanRatio + c_defaultUIFinalScrollViewerVerticalOffset) * c_defaultUIVerticalShift /
00762                     ((c_defaultUIScrollViewerHeight + 20.0) * c_scrollViewerMaxOverpanRatio * 2.0 + ((c_defaultUIScrollViewerContentHeight + 20.0) - (c_defaultUIScrollViewerHeight + 20.0)));
00763
00764                 // Validate the parallax amount of the target Rectangle.
00765                 float offset;
00766                 CompositionGetValueStatus status;
00767
00768                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out offset);
00769                 Log.Comment("Target transform after view change: status={0}, horizontal offset={1}", status, offset);
00770                 Log.Comment("expectedHorizontalShift={0}", -expectedHorizontalShift);
00771                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedHorizontalShift, c_shiftTolerance));
00772
00773                 status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out offset);
00774                 Log.Comment("Target transform after view change: status={0}, vertical offset={1}", status, offset);
00775                 Log.Comment("expectedVerticalShift={0}", -expectedVerticalShift);
00776                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedVerticalShift, c_shiftTolerance));
00777             });
00778         }
00779
00780         [TestMethod]
00781         [Description("Regression test for MSFT:11812935 - Validates that event handlers in ScrollInputHelper are unhooked when the ParallaxView element is disposed. Changes the ScrollViewer.Content size after the ParallaxView's garbage-collection.")]
00782         [TestProperty("Ignore", "True")] // TODO 29556617: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00783         public void ChangeSizeOfDisconnectedScrollViewerContent()
00784         {
00785             ChangePropertyAfterParallaxViewDisposal(PropertyId.ScrollViewerContentHeight);
00786         }
00787
00788         [TestMethod]
00789         [Description("Validates that event handlers in ParallaxView element are unhooked when it is disposed. Changes the old ParallaxView.Child's VerticalAlignment after the ParallaxView's garbage-collection.")]
00790         [TestProperty("Ignore", "True")] // TODO 29556617: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00791         public void ChangeAlignmentOfDisconnectedParallaxViewChild()
00792         {
00793             ChangePropertyAfterParallaxViewDisposal(PropertyId.ParallaxViewChildVerticalAlignment);
00794         }
00795
00796         [TestMethod]
00797         [Description("Basic parallaxing of a ParallaxView inside a ScrollViewer.")]
00798         public void VerifyBasicParallaxingInsideScrollViewer()
00799         {
00800             double expectedVerticalShift =
00801                 c_defaultUIVerticalShift * (1.0 - (c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio / ((2.0 * c_scrollViewerMaxOverpanRatio + 1.5) * c_defaultUIScrollViewerHeight)));
00802
00803             VerifyParallaxingWithParallaxViewInsideScrollViewer(
00804                 verticalSourceOffsetKind: ParallaxSourceOffsetKind.Relative,
00805                 verticalSourceStartOffset: 0.0,
00806                 verticalSourceEndOffset: 0.0,
00807                 maxVerticalShiftRatio: 1.0,
00808                 verticalParallaxViewOffset: 0.0,
00809                 isVerticalShiftClamped: true,
00810                 expectedVerticalShift: expectedVerticalShift);
00811
00812             const double verticalParallaxViewOffset = 75.0;
00813             expectedVerticalShift =
00814                 c_defaultUIVerticalShift * (1.0 - ((c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio + verticalParallaxViewOffset) / ((2.0 * c_scrollViewerMaxOverpanRatio + 1.5) * c_defaultUIScrollViewerHeight)));
00815
00816             VerifyParallaxingWithParallaxViewInsideScrollViewer(
00817                 verticalSourceOffsetKind: ParallaxSourceOffsetKind.Relative,
00818                 verticalSourceStartOffset: 0.0,
00819                 verticalSourceEndOffset: 0.0,
00820                 maxVerticalShiftRatio: 1.0,
00821                 verticalParallaxViewOffset: verticalParallaxViewOffset,
00822                 isVerticalShiftClamped: true,
00823                 expectedVerticalShift: expectedVerticalShift);
00824         }
00825
00826         [TestMethod]
00827         [Description("Basic parallaxing of a ParallaxView inside a Scroller.")]
00828         public void VerifyBasicParallaxingInsideScroller()
00829         {
00830             VerifyParallaxingWithParallaxViewInsideScrollPresenter(
00831                 scrollPresenterHorizontalOffset: 0.0,
00832                 scrollPresenterVerticalOffset: 0.0,
00833                 expectedHorizontalShift: c_defaultUIHorizontalShift / 4.5,
00834                 expectedVerticalShift: c_defaultUIVerticalShift / 4.5);
00835
00836             VerifyParallaxingWithParallaxViewInsideScrollPresenter(
00837                 scrollPresenterHorizontalOffset: c_defaultUIFinalScrollPresenterHorizontalOffset,
00838                 scrollPresenterVerticalOffset: c_defaultUIFinalScrollPresenterVerticalOffset,
00839                 expectedHorizontalShift: (c_defaultUIHorizontalShift + c_defaultUIFinalScrollPresenterHorizontalOffset / 4.0) / 4.5,
00840                 expectedVerticalShift: (c_defaultUIVerticalShift + c_defaultUIFinalScrollPresenterVerticalOffset / 4.0) / 4.5);
00841         }
00842
00843         [TestMethod]
00844         [Description("Basic parallaxing of a ParallaxView used as a header inside a ScrollViewer.")]
00845         public void VerifyHeaderParallaxingInsideScrollViewer()
00846         {
00847             VerifyParallaxingWithParallaxViewInsideScrollViewer(
00848                 verticalSourceOffsetKind: ParallaxSourceOffsetKind.Absolute,
00849                 verticalSourceStartOffset: 0.0,
00850                 verticalSourceEndOffset: c_defaultUIScrollViewerHeight / 2.0,
00851                 maxVerticalShiftRatio: 1.0,
00852                 verticalParallaxViewOffset: 0.0,
00853                 isVerticalShiftClamped: true,
00854                 expectedVerticalShift: c_defaultUIVerticalShift);
00855         }
00856
00857         [TestMethod]
00858         [Description("Changing ParallaxView offset inside a ScrollViewer.")]
00859         public void VerifyParallaxViewOffsetChangeInsideScrollViewer()
00860         {
00861             const double verticalParallaxViewOffset1 = 15.0;
00862             const double verticalParallaxViewOffset2 = 75.0;
00863             const double expectedVerticalShift1 =
00864                 c_defaultUIVerticalShift * (1.0 - ((c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio + verticalParallaxViewOffset1) / ((2.0 * c_scrollViewerMaxOverpanRatio + 1.5) * c_defaultUIScrollViewerHeight)));
00865             const double expectedVerticalShift2 =
00866                 c_defaultUIVerticalShift * (1.0 - ((c_defaultUIScrollViewerHeight * c_scrollViewerMaxOverpanRatio + verticalParallaxViewOffset2) / ((2.0 * c_scrollViewerMaxOverpanRatio + 1.5) * c_defaultUIScrollViewerHeight)));
00867
00868             ParallaxView parallaxView = null;
00869             Rectangle rectanglePVChild = null;
00870             ScrollViewer scrollViewer = null;
00871             StackPanel stackPanelSVContent = null;
00872             Visual visualPPChild = null;
00873             AutoResetEvent parallaxViewLoadedEvent = null;
00874             AutoResetEvent scrollViewerLoadedEvent = null;
00875             float? finalHorizontalShift = null;
00876             float? finalVerticalShift = 0f;
00877
00878             RunOnUIThread.Execute(() =>
00879             {
00880                 parallaxViewLoadedEvent = new AutoResetEvent(false);
00881                 scrollViewerLoadedEvent = new AutoResetEvent(false);
00882                 stackPanelSVContent = new StackPanel();
00883                 scrollViewer = new ScrollViewer();
00884                 rectanglePVChild = new Rectangle();
00885                 parallaxView = new ParallaxView();
00886
00887                 SetupUIWithParallaxViewInsideScrollViewer(
00888                     verticalParallaxViewOffset1,
00889                     parallaxView, rectanglePVChild, scrollViewer, stackPanelSVContent,
00890                     parallaxViewLoadedEvent, scrollViewerLoadedEvent);
00891             });
00892
00893             Log.Comment("Waiting for Loaded events");
00894             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00895             scrollViewerLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
00896             Log.Comment("Default UI set up");
00897
00898             RunOnUIThread.Execute(() =>
00899             {
00900                 Verify.AreEqual(scrollViewer.ActualWidth, c_defaultUIScrollViewerWidth);
00901                 Verify.AreEqual(scrollViewer.ActualHeight, c_defaultUIScrollViewerHeight);
00902                 Verify.AreEqual(stackPanelSVContent.ActualWidth, c_defaultUIScrollViewerWidth);
00903                 Verify.AreEqual(stackPanelSVContent.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset1);
00904                 Verify.AreEqual(parallaxView.ActualWidth, c_defaultUIScrollViewerWidth);
00905                 Verify.AreEqual(parallaxView.ActualHeight, c_defaultUIScrollViewerHeight / 2.0);
00906                 Verify.AreEqual(rectanglePVChild.ActualWidth, c_defaultUIScrollViewerWidth);
00907                 Verify.AreEqual(rectanglePVChild.ActualHeight, c_defaultUIScrollViewerHeight / 2.0 + c_defaultUIVerticalShift);
00908
00909                 Log.Comment("Setting up spy property set");
00910                 visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild);
00911
00912                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00913             });
00914
00915             ChangeScrollViewerView(
00916                 scrollViewer: scrollViewer,
00917                 horizontalOffset: null,
00918                 verticalOffset: c_defaultUIFinalScrollViewerVerticalOffset,
00919                 zoomFactor: null,
00920                 disableAnimation: false,
00921                 visualPPChild: visualPPChild,
00922                 finalHorizontalShift: ref finalHorizontalShift,
00923                 finalVerticalShift: ref finalVerticalShift);
00924
00925             RunOnUIThread.Execute(() =>
00926             {
00927                 Log.Comment("Validating the parallax amount of the target Rectangle.");
00928                 Log.Comment("expectedVerticalShift1={0}, finalVerticalShift={1}", -expectedVerticalShift1, finalVerticalShift);
00929                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance((float)finalVerticalShift, (float)-expectedVerticalShift1, c_shiftTolerance));
00930
00931                 Log.Comment("Changing the vertical offset of the ParallaxView within the ScrollViewer.Content");
00932                 Rectangle rectangle = stackPanelSVContent.Children[0] as Rectangle;
00933                 rectangle.Height = verticalParallaxViewOffset2;
00934
00935                 Log.Comment("Invoking ParallaxView.RefreshAutomaticVerticalOffsets() to update the vertical shift.");
00936                 parallaxView.RefreshAutomaticVerticalOffsets();
00937
00938                 Log.Comment("Start spying again");
00939                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00940             });
00941
00942             Log.Comment("Waiting for captured properties to be updated");
00943             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00944
00945             RunOnUIThread.Execute(() =>
00946             {
00947                 Verify.AreEqual(stackPanelSVContent.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset2);
00948
00949                 Log.Comment("Cancelling spying");
00950                 CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
00951             });
00952
00953             Log.Comment("Waiting for captured properties to be updated");
00954             CompositionPropertySpy.SynchronouslyTickUIThread(10);
00955
00956             RunOnUIThread.Execute(() =>
00957             {
00958                 // Validate the final parallax amount of the target Rectangle.
00959                 float offset;
00960                 CompositionGetValueStatus status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out offset);
00961                 Log.Comment("Target transform after offset change: status={0}, vertical offset={1}", status, offset);
00962                 Log.Comment("expectedVerticalShift2={0}", -expectedVerticalShift2);
00963                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedVerticalShift2, c_shiftTolerance));
00964             });
00965         }
00966
00967         private void VerifyParallaxingWithDefaultSourceUI(
00968             SourceType sourceType,
00969             ParallaxSourceOffsetKind horizontalSourceOffsetKind,
00970             double horizontalSourceStartOffset,
00971             double horizontalSourceEndOffset,
00972             double maxHorizontalShiftRatio,
00973             bool isHorizontalShiftClamped,
00974             double expectedHorizontalShift,
00975             ParallaxSourceOffsetKind verticalSourceOffsetKind,
00976             double verticalSourceStartOffset,
00977             double verticalSourceEndOffset,
00978             double maxVerticalShiftRatio,
00979             bool isVerticalShiftClamped,
00980             double expectedVerticalShift)
00981         {
00982             ParallaxView parallaxView = null;
00983             Rectangle rectanglePVChild = null;
00984             ScrollViewer scrollViewer = null;
00985             ScrollPresenter scrollPresenter = null;
00986             Rectangle rectangleSVContent = null;
00987             Visual visualPPChild = null;
00988             AutoResetEvent parallaxViewLoadedEvent = null;
00989             AutoResetEvent sourceLoadedEvent = null;
00990             float? finalHorizontalShift = 0f;
00991             float? finalVerticalShift = 0f;
00992
00993             RunOnUIThread.Execute(() =>
00994             {
00995                 parallaxViewLoadedEvent = new AutoResetEvent(false);
00996                 sourceLoadedEvent = new AutoResetEvent(false);
00997                 rectangleSVContent = new Rectangle();
00998                 rectanglePVChild = new Rectangle();
00999                 parallaxView = new ParallaxView();
01000
01001                 if (sourceType == SourceType.ScrollViewer)
01002                 {
01003                     scrollViewer = new ScrollViewer();
01004                     SetupDefaultUIWithScrollViewer(
01005                         parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent,
01006                         parallaxViewLoadedEvent, sourceLoadedEvent);
01007                 }
01008                 else
01009                 {
01010                     scrollPresenter = new ScrollPresenter();
01011                     SetupDefaultUIWithScrollPresenter(
01012                         parallaxView, rectanglePVChild, scrollPresenter, rectangleSVContent,
01013                         parallaxViewLoadedEvent, sourceLoadedEvent);
01014                 }
01015
01016                 parallaxView.HorizontalSourceOffsetKind = horizontalSourceOffsetKind;
01017                 parallaxView.HorizontalSourceStartOffset = horizontalSourceStartOffset;
01018                 parallaxView.HorizontalSourceEndOffset = horizontalSourceEndOffset;
01019                 parallaxView.MaxHorizontalShiftRatio = maxHorizontalShiftRatio;
01020                 parallaxView.IsHorizontalShiftClamped = isHorizontalShiftClamped;
01021                 parallaxView.VerticalSourceOffsetKind = verticalSourceOffsetKind;
01022                 parallaxView.VerticalSourceStartOffset = verticalSourceStartOffset;
01023                 parallaxView.VerticalSourceEndOffset = verticalSourceEndOffset;
01024                 parallaxView.MaxVerticalShiftRatio = maxVerticalShiftRatio;
01025                 parallaxView.IsVerticalShiftClamped = isVerticalShiftClamped;
01026             });
01027
01028             Log.Comment("Waiting for Loaded events");
01029             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01030             sourceLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01031             Log.Comment("Default UI set up");
01032
01033             RunOnUIThread.Execute(() =>
01034             {
01035                 Log.Comment("Setting up spy property set");
01036                 visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild);
01037
01038                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
01039                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
01040             });
01041
01042             if (sourceType == SourceType.ScrollViewer)
01043             {
01044                 ChangeScrollViewerView(
01045                     scrollViewer: scrollViewer,
01046                     horizontalOffset: c_defaultUIFinalScrollViewerHorizontalOffset,
01047                     verticalOffset: c_defaultUIFinalScrollViewerVerticalOffset,
01048                     zoomFactor: 1.0f,
01049                     disableAnimation: false,
01050                     visualPPChild: visualPPChild,
01051                     finalHorizontalShift: ref finalHorizontalShift,
01052                     finalVerticalShift: ref finalVerticalShift);
01053             }
01054             else
01055             {
01056                 ChangeScrollPresenterView(
01057                     scrollPresenter: scrollPresenter,
01058                     horizontalOffset: c_defaultUIFinalScrollPresenterHorizontalOffset,
01059                     verticalOffset: c_defaultUIFinalScrollPresenterVerticalOffset,
01060                     zoomFactor: 1.0f,
01061                     disableAnimation: false,
01062                     visualPPChild: visualPPChild,
01063                     finalHorizontalShift: ref finalHorizontalShift,
01064                     finalVerticalShift: ref finalVerticalShift);
01065             }
01066
01067             RunOnUIThread.Execute(() =>
01068             {
01069                 Log.Comment("Validating the final parallax amount of the target Rectangle.");
01070                 Log.Comment("expectedHorizontalShift={0}, finalHorizontalShift={1}", -expectedHorizontalShift, finalHorizontalShift);
01071                 Log.Comment("expectedVerticalShift={0}, finalVerticalShift={1}", -expectedVerticalShift, finalVerticalShift);
01072                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance((float)finalHorizontalShift, (float)-expectedHorizontalShift, c_shiftTolerance));
01073                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance((float)finalVerticalShift, (float)-expectedVerticalShift, c_shiftTolerance));
01074             });
01075         }
01076
01077         private void VerifyParallaxingWithParallaxViewInsideScrollViewer(
01078             ParallaxSourceOffsetKind verticalSourceOffsetKind,
01079             double verticalSourceStartOffset,
01080             double verticalSourceEndOffset,
01081             double maxVerticalShiftRatio,
01082             double verticalParallaxViewOffset,
01083             bool isVerticalShiftClamped,
01084             double expectedVerticalShift)
01085         {
01086             ParallaxView parallaxView = null;
01087             Rectangle rectanglePVChild = null;
01088             ScrollViewer scrollViewer = null;
01089             StackPanel stackPanelSVContent = null;
01090             Visual visualPPChild = null;
01091             AutoResetEvent parallaxViewLoadedEvent = null;
01092             AutoResetEvent scrollViewerLoadedEvent = null;
01093             float? finalHorizontalShift = null;
01094             float? finalVerticalShift = 0f;
01095
01096             RunOnUIThread.Execute(() =>
01097             {
01098                 parallaxViewLoadedEvent = new AutoResetEvent(false);
01099                 scrollViewerLoadedEvent = new AutoResetEvent(false);
01100                 stackPanelSVContent = new StackPanel();
01101                 scrollViewer = new ScrollViewer();
01102                 rectanglePVChild = new Rectangle();
01103                 parallaxView = new ParallaxView();
01104
01105                 SetupUIWithParallaxViewInsideScrollViewer(
01106                     verticalParallaxViewOffset,
01107                     parallaxView, rectanglePVChild, scrollViewer, stackPanelSVContent,
01108                     parallaxViewLoadedEvent, scrollViewerLoadedEvent);
01109
01110                 parallaxView.VerticalSourceOffsetKind = verticalSourceOffsetKind;
01111                 parallaxView.VerticalSourceStartOffset = verticalSourceStartOffset;
01112                 parallaxView.VerticalSourceEndOffset = verticalSourceEndOffset;
01113                 parallaxView.MaxVerticalShiftRatio = maxVerticalShiftRatio;
01114                 parallaxView.IsVerticalShiftClamped = isVerticalShiftClamped;
01115             });
01116
01117             Log.Comment("Waiting for Loaded events");
01118             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01119             scrollViewerLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01120             Log.Comment("Default UI set up");
01121
01122             RunOnUIThread.Execute(() =>
01123             {
01124                 Verify.AreEqual(scrollViewer.ActualWidth, c_defaultUIScrollViewerWidth);
01125                 Verify.AreEqual(scrollViewer.ActualHeight, c_defaultUIScrollViewerHeight);
01126                 Verify.AreEqual(stackPanelSVContent.ActualWidth, c_defaultUIScrollViewerWidth);
01127                 Verify.AreEqual(stackPanelSVContent.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset);
01128                 Verify.AreEqual(parallaxView.ActualWidth, c_defaultUIScrollViewerWidth);
01129                 Verify.AreEqual(parallaxView.ActualHeight, c_defaultUIScrollViewerHeight / 2.0);
01130                 Verify.AreEqual(rectanglePVChild.ActualWidth, c_defaultUIScrollViewerWidth);
01131                 Verify.AreEqual(rectanglePVChild.ActualHeight, c_defaultUIScrollViewerHeight / 2.0 + c_defaultUIVerticalShift);
01132
01133                 Log.Comment("Setting up spy property set");
01134                 visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild);
01135
01136                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
01137             });
01138
01139             ChangeScrollViewerView(
01140                 scrollViewer: scrollViewer,
01141                 horizontalOffset: null,
01142                 verticalOffset: c_defaultUIFinalScrollViewerVerticalOffset,
01143                 zoomFactor: null,
01144                 disableAnimation: false,
01145                 visualPPChild: visualPPChild,
01146                 finalHorizontalShift: ref finalHorizontalShift,
01147                 finalVerticalShift: ref finalVerticalShift);
01148
01149             RunOnUIThread.Execute(() =>
01150             {
01151                 Log.Comment("Validating the final parallax amount of the target Rectangle.");
01152                 Log.Comment("expectedVerticalShift={0}, finalVerticalShift={1}", -expectedVerticalShift, finalVerticalShift);
01153                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance((float)finalVerticalShift, (float)-expectedVerticalShift, c_shiftTolerance));
01154             });
01155         }
01156
01157         private void VerifyParallaxingWithParallaxViewInsideScrollPresenter(
01158             double scrollPresenterHorizontalOffset,
01159             double scrollPresenterVerticalOffset,
01160             double expectedHorizontalShift,
01161             double expectedVerticalShift)
01162         {
01163             ParallaxView parallaxView = null;
01164             Rectangle rectanglePVChild = null;
01165             ScrollPresenter scrollPresenter = null;
01166             Visual visualPPChild = null;
01167             AutoResetEvent parallaxViewLoadedEvent = null;
01168             AutoResetEvent scrollPresenterLoadedEvent = null;
01169             float? finalHorizontalShift = 0f;
01170             float? finalVerticalShift = 0f;
01171
01172             RunOnUIThread.Execute(() =>
01173             {
01174                 parallaxViewLoadedEvent = new AutoResetEvent(false);
01175                 scrollPresenterLoadedEvent = new AutoResetEvent(false);
01176                 scrollPresenter = new ScrollPresenter();
01177                 rectanglePVChild = new Rectangle();
01178                 parallaxView = new ParallaxView();
01179
01180                 SetupUIWithParallaxViewInsideScrollPresenter(
01181                     parallaxView,
01182                     rectanglePVChild,
01183                     scrollPresenter,
01184                     parallaxViewLoadedEvent,
01185                     scrollPresenterLoadedEvent);
01186             });
01187
01188             Log.Comment("Waiting for Loaded events");
01189             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01190             scrollPresenterLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01191             Log.Comment("Default UI set up");
01192
01193             RunOnUIThread.Execute(() =>
01194             {
01195                 Log.Comment("scrollPresenter Actual Size={0}, {1}", scrollPresenter.ActualWidth, scrollPresenter.ActualHeight);
01196                 Log.Comment("parallaxView Actual Size={0}, {1}", parallaxView.ActualWidth, parallaxView.ActualHeight);
01197                 Log.Comment("rectanglePVChild Actual Size={0}, {1}", rectanglePVChild.ActualWidth, rectanglePVChild.ActualHeight);
01198
01199                 Verify.AreEqual(scrollPresenter.ActualWidth, c_defaultUIScrollPresenterWidth);
01200                 Verify.AreEqual(scrollPresenter.ActualHeight, c_defaultUIScrollPresenterHeight);
01201
01202                 Verify.AreEqual(parallaxView.ActualWidth, c_defaultUIScrollPresenterContentWidth);
01203                 Verify.AreEqual(parallaxView.ActualHeight, c_defaultUIScrollPresenterContentHeight);
01204
01205                 Verify.AreEqual(rectanglePVChild.ActualWidth, c_defaultUIScrollPresenterContentWidth + c_defaultUIHorizontalShift);
01206                 Verify.AreEqual(rectanglePVChild.ActualHeight, c_defaultUIScrollPresenterContentHeight + c_defaultUIVerticalShift);
01207
01208                 Log.Comment("Setting up spy property set");
01209                 visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild);
01210
01211                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
01212                 CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
01213             });
01214
01215             if (scrollPresenterHorizontalOffset != 0.0 || scrollPresenterVerticalOffset != 0.0)
01216             {
01217                 ChangeScrollPresenterView(
01218                     scrollPresenter: scrollPresenter,
01219                     horizontalOffset: scrollPresenterHorizontalOffset,
01220                     verticalOffset: scrollPresenterVerticalOffset,
01221                     zoomFactor: null,
01222                     disableAnimation: false,
01223                     visualPPChild: visualPPChild,
01224                     finalHorizontalShift: ref finalHorizontalShift,
01225                     finalVerticalShift: ref finalVerticalShift);
01226             }
01227             else
01228             {
01229                 Log.Comment("Waiting for captured properties to be updated");
01230                 CompositionPropertySpy.SynchronouslyTickUIThread(10);
01231
01232                 RunOnUIThread.Execute(() =>
01233                 {
01234                     Log.Comment("Cancelling spying");
01235                     CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
01236                     CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
01237                 });
01238
01239                 Log.Comment("Waiting for captured properties to be updated");
01240                 CompositionPropertySpy.SynchronouslyTickUIThread(10);
01241
01242                 float horizontalShift = 0f;
01243                 float verticalShift = 0f;
01244
01245                 RunOnUIThread.Execute(() =>
01246                 {
01247                     CompositionGetValueStatus status;
01248
01249                     Log.Comment("Accessing final shift values");
01250
01251                         status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out horizontalShift);
01252                         Log.Comment("Target transform after view change: status={0}, horizontal offset={1}", status, horizontalShift);
01253                         status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out verticalShift);
01254                         Log.Comment("Target transform after view change: status={0}, vertical offset={1}", status, verticalShift);
01255                 });
01256
01257                 finalHorizontalShift = horizontalShift;
01258                 finalVerticalShift = verticalShift;
01259             }
01260
01261             RunOnUIThread.Execute(() =>
01262             {
01263                 Log.Comment("Validating the final parallax amount of the target Rectangle.");
01264                 Log.Comment("expectedHorizontalShift={0}, finalHorizontalShift={1}", -expectedHorizontalShift, finalHorizontalShift);
01265                 Log.Comment("expectedVerticalShift={0}, finalVerticalShift={1}", -expectedVerticalShift, finalVerticalShift);
01266
01267                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance((float)finalHorizontalShift, (float)-expectedHorizontalShift, c_shiftTolerance));
01268                 Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance((float)finalVerticalShift, (float)-expectedVerticalShift, c_shiftTolerance));
01269             });
01270         }
01271
01272         private void SetupDefaultUIWithListView(
01273             ParallaxView parallaxView,
01274             Rectangle rectanglePVChild,
01275             ListView listView,
01276             AutoResetEvent parallaxViewLoadedEvent,
01277             AutoResetEvent listViewLoadedEvent)
01278         {
01279             Log.Comment("Setting up default UI with ParallaxView and ListView");
01280
01281             LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
01282
01283             GradientStop brownGS = new GradientStop() { Color = Microsoft.UI.Colors.Brown, Offset = 0.0 };
01284             twoColorLGB.GradientStops.Add(brownGS);
01285
01286             GradientStop orangeGS = new GradientStop() { Color = Microsoft.UI.Colors.Orange, Offset = 1.0 };
01287             twoColorLGB.GradientStops.Add(orangeGS);
01288
01289             Verify.IsNotNull(listView);
01290             if (string.IsNullOrEmpty(listView.Name))
01291             {
01292                 listView.Name = "listView";
01293             }
01294             listView.Width = c_defaultUIScrollViewerWidth;
01295             listView.Height = c_defaultUIScrollViewerHeight;
01296
01297             for (int listViewItemIndex = 0; listViewItemIndex < 32; listViewItemIndex++)
01298             {
01299                 listView.Items.Add("Item #" + listViewItemIndex);
01300             }
01301
01302             Verify.IsNotNull(rectanglePVChild);
01303             rectanglePVChild.Width = c_defaultUIScrollViewerWidth + c_defaultHorizontalShift;
01304             rectanglePVChild.Height = c_defaultUIScrollViewerHeight + c_defaultVerticalShift;
01305             rectanglePVChild.Fill = twoColorLGB;
01306
01307             Verify.IsNotNull(parallaxView);
01308             parallaxView.Width = c_defaultUIScrollViewerWidth;
01309             parallaxView.Height = c_defaultUIScrollViewerHeight;
01310             parallaxView.Child = rectanglePVChild;
01311             parallaxView.VerticalShift = c_defaultUIVerticalShift;
01312
01313             StackPanel stackPanel = new StackPanel();
01314             Verify.IsNotNull(stackPanel);
01315             stackPanel.Children.Add(parallaxView);
01316             stackPanel.Children.Add(listView);
01317
01318             if (parallaxViewLoadedEvent != null)
01319             {
01320                 parallaxView.Loaded += (object sender, RoutedEventArgs e) =>
01321                 {
01322                     Log.Comment("ParallaxView.Loaded event handler");
01323                     parallaxViewLoadedEvent.Set();
01324                 };
01325             }
01326
01327             if (listViewLoadedEvent != null)
01328             {
01329                 listView.Loaded += (object sender, RoutedEventArgs e) =>
01330                 {
01331                     Log.Comment("ListView.Loaded event handler");
01332                     parallaxView.Source = listView;
01333                     listViewLoadedEvent.Set();
01334                 };
01335             }
01336
01337             Log.Comment("Setting window content");
01338             Content = stackPanel;
01339         }
01340
01341         private void SetupDefaultUIWithScrollViewer(
01342             ParallaxView parallaxView,
01343             Rectangle rectanglePVChild,
01344             ScrollViewer scrollViewer,
01345             Rectangle rectangleSVContent,
01346             AutoResetEvent parallaxViewLoadedEvent,
01347             AutoResetEvent scrollViewerLoadedEvent)
01348         {
01349             Log.Comment("Setting up default UI with ParallaxView, ScrollViewer and Rectangles");
01350
01351             LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
01352
01353             GradientStop brownGS = new GradientStop() { Color = Microsoft.UI.Colors.Brown, Offset = 0.0 };
01354             twoColorLGB.GradientStops.Add(brownGS);
01355
01356             GradientStop orangeGS = new GradientStop() { Color = Microsoft.UI.Colors.Orange, Offset = 1.0 };
01357             twoColorLGB.GradientStops.Add(orangeGS);
01358
01359             Verify.IsNotNull(rectangleSVContent);
01360             rectangleSVContent.Width = c_defaultUIScrollViewerContentWidth;
01361             rectangleSVContent.Height = c_defaultUIScrollViewerContentHeight;
01362             rectangleSVContent.Fill = twoColorLGB;
01363
01364             Verify.IsNotNull(scrollViewer);
01365             if (string.IsNullOrEmpty(scrollViewer.Name))
01366             {
01367                 scrollViewer.Name = "scrollViewer";
01368             }
01369             scrollViewer.Width = c_defaultUIScrollViewerWidth;
01370             scrollViewer.Height = c_defaultUIScrollViewerHeight;
01371             scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
01372             scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
01373             scrollViewer.ZoomMode = Microsoft.UI.Xaml.Controls.ZoomMode.Disabled;
01374             scrollViewer.Content = rectangleSVContent;
01375
01376             Verify.IsNotNull(rectanglePVChild);
01377             rectanglePVChild.Width = c_defaultUIScrollViewerWidth + c_defaultHorizontalShift;
01378             rectanglePVChild.Height = c_defaultUIScrollViewerHeight + c_defaultVerticalShift;
01379             rectanglePVChild.Fill = twoColorLGB;
01380
01381             Verify.IsNotNull(parallaxView);
01382             parallaxView.Width = c_defaultUIScrollViewerWidth;
01383             parallaxView.Height = c_defaultUIScrollViewerHeight;
01384             parallaxView.Child = rectanglePVChild;
01385             parallaxView.HorizontalShift = c_defaultUIHorizontalShift;
01386             parallaxView.VerticalShift = c_defaultUIVerticalShift;
01387
01388             StackPanel stackPanel = new StackPanel();
01389             Verify.IsNotNull(stackPanel);
01390             stackPanel.Children.Add(parallaxView);
01391             stackPanel.Children.Add(scrollViewer);
01392
01393             if (parallaxViewLoadedEvent != null)
01394             {
01395                 parallaxView.Loaded += (object sender, RoutedEventArgs e) =>
01396                 {
01397                     Log.Comment("ParallaxView.Loaded event handler");
01398                     parallaxViewLoadedEvent.Set();
01399                 };
01400             }
01401
01402             if (scrollViewerLoadedEvent != null)
01403             {
01404                 scrollViewer.Loaded += (object sender, RoutedEventArgs e) =>
01405                 {
01406                     Log.Comment("ScrollViewer.Loaded event handler");
01407                     parallaxView.Source = scrollViewer;
01408                     scrollViewerLoadedEvent.Set();
01409                 };
01410             }
01411
01412             Log.Comment("Setting window content");
01413             Content = stackPanel;
01414         }
01415
01416         private void SetupDefaultUIWithScrollPresenter(
01417             ParallaxView parallaxView,
01418             Rectangle rectanglePVChild,
01419             ScrollPresenter scrollPresenter,
01420             Rectangle rectangleScrollPresenterContent,
01421             AutoResetEvent parallaxViewLoadedEvent,
01422             AutoResetEvent scrollPresenterLoadedEvent)
01423         {
01424             Log.Comment("Setting up default UI with ParallaxView, ScrollPresenter and Rectangles");
01425
01426             LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
01427
01428             GradientStop brownGS = new GradientStop() { Color = Microsoft.UI.Colors.Brown, Offset = 0.0 };
01429             twoColorLGB.GradientStops.Add(brownGS);
01430
01431             GradientStop orangeGS = new GradientStop() { Color = Microsoft.UI.Colors.Orange, Offset = 1.0 };
01432             twoColorLGB.GradientStops.Add(orangeGS);
01433
01434             Verify.IsNotNull(rectangleScrollPresenterContent);
01435             rectangleScrollPresenterContent.Width = c_defaultUIScrollPresenterContentWidth;
01436             rectangleScrollPresenterContent.Height = c_defaultUIScrollPresenterContentHeight;
01437             rectangleScrollPresenterContent.Fill = twoColorLGB;
01438
01439             Verify.IsNotNull(scrollPresenter);
01440             if (string.IsNullOrEmpty(scrollPresenter.Name))
01441             {
01442                 scrollPresenter.Name = "scrollPresenter";
01443             }
01444             scrollPresenter.Width = c_defaultUIScrollPresenterWidth;
01445             scrollPresenter.Height = c_defaultUIScrollPresenterHeight;
01446             scrollPresenter.ZoomMode = ScrollingZoomMode.Disabled;
01447             scrollPresenter.Content = rectangleScrollPresenterContent;
01448
01449             Verify.IsNotNull(rectanglePVChild);
01450             rectanglePVChild.Width = c_defaultUIScrollPresenterWidth + c_defaultHorizontalShift;
01451             rectanglePVChild.Height = c_defaultUIScrollPresenterHeight + c_defaultVerticalShift;
01452             rectanglePVChild.Fill = twoColorLGB;
01453
01454             Verify.IsNotNull(parallaxView);
01455             parallaxView.Width = c_defaultUIScrollPresenterWidth;
01456             parallaxView.Height = c_defaultUIScrollPresenterHeight;
01457             parallaxView.Child = rectanglePVChild;
01458             parallaxView.HorizontalShift = c_defaultUIHorizontalShift;
01459             parallaxView.VerticalShift = c_defaultUIVerticalShift;
01460
01461             StackPanel stackPanel = new StackPanel();
01462             Verify.IsNotNull(stackPanel);
01463             stackPanel.Children.Add(parallaxView);
01464             stackPanel.Children.Add(scrollPresenter);
01465
01466             if (parallaxViewLoadedEvent != null)
01467             {
01468                 parallaxView.Loaded += (object sender, RoutedEventArgs e) =>
01469                 {
01470                     Log.Comment("ParallaxView.Loaded event handler");
01471                     parallaxViewLoadedEvent.Set();
01472                 };
01473             }
01474
01475             if (scrollPresenterLoadedEvent != null)
01476             {
01477                 scrollPresenter.Loaded += (object sender, RoutedEventArgs e) =>
01478                 {
01479                     Log.Comment("ScrollPresenter.Loaded event handler");
01480                     parallaxView.Source = scrollPresenter;
01481                     scrollPresenterLoadedEvent.Set();
01482                 };
01483             }
01484
01485             Log.Comment("Setting window content");
01486             Content = stackPanel;
01487         }
01488
01489         private void SetupUIWithParallaxViewInsideScrollPresenter(
01490             ParallaxView parallaxView,
01491             Rectangle rectanglePVChild,
01492             ScrollPresenter scrollPresenter,
01493             AutoResetEvent parallaxViewLoadedEvent,
01494             AutoResetEvent scrollPresenterLoadedEvent)
01495         {
01496             Log.Comment("Setting up UI with ParallaxView inside ScrollPresenter");
01497
01498             LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
01499
01500             GradientStop brownGS = new GradientStop() { Color = Microsoft.UI.Colors.Brown, Offset = 0.0 };
01501             twoColorLGB.GradientStops.Add(brownGS);
01502
01503             GradientStop orangeGS = new GradientStop() { Color = Microsoft.UI.Colors.Orange, Offset = 1.0 };
01504             twoColorLGB.GradientStops.Add(orangeGS);
01505
01506             Verify.IsNotNull(scrollPresenter);
01507             if (string.IsNullOrEmpty(scrollPresenter.Name))
01508             {
01509                 scrollPresenter.Name = "scrollPresenter";
01510             }
01511             scrollPresenter.Width = c_defaultUIScrollPresenterWidth;
01512             scrollPresenter.Height = c_defaultUIScrollPresenterHeight;
01513             scrollPresenter.ZoomMode = ScrollingZoomMode.Disabled;
01514
01515             Grid gridScrollPresenterContent = new Grid();
01516             scrollPresenter.Content = gridScrollPresenterContent;
01517
01518             Verify.IsNotNull(rectanglePVChild);
01519             rectanglePVChild.Width = c_defaultUIScrollPresenterContentWidth + c_defaultUIHorizontalShift;
01520             rectanglePVChild.Height = c_defaultUIScrollPresenterContentHeight + c_defaultUIVerticalShift;
01521             rectanglePVChild.Fill = twoColorLGB;
01522
01523             Verify.IsNotNull(parallaxView);
01524             parallaxView.Width = c_defaultUIScrollPresenterContentWidth;
01525             parallaxView.Height = c_defaultUIScrollPresenterContentHeight;
01526             parallaxView.Child = rectanglePVChild;
01527             parallaxView.HorizontalShift = c_defaultUIHorizontalShift;
01528             parallaxView.VerticalShift = c_defaultUIVerticalShift;
01529
01530             gridScrollPresenterContent.Children.Add(parallaxView);
01531
01532             if (parallaxViewLoadedEvent != null)
01533             {
01534                 parallaxView.Loaded += (object sender, RoutedEventArgs e) =>
01535                 {
01536                     Log.Comment("ParallaxView.Loaded event handler");
01537                     parallaxViewLoadedEvent.Set();
01538                 };
01539             }
01540
01541             if (scrollPresenterLoadedEvent != null)
01542             {
01543                 scrollPresenter.Loaded += (object sender, RoutedEventArgs e) =>
01544                 {
01545                     Log.Comment("ScrollPresenter.Loaded event handler");
01546                     parallaxView.Source = scrollPresenter;
01547                     scrollPresenterLoadedEvent.Set();
01548                 };
01549             }
01550
01551             Log.Comment("Setting window content");
01552             Content = scrollPresenter;
01553         }
01554
01555         private void SetupUIWithParallaxViewInsideScrollViewer(
01556             double verticalParallaxViewOffset,
01557             ParallaxView parallaxView,
01558             Rectangle rectanglePVChild,
01559             ScrollViewer scrollViewer,
01560             StackPanel stackPanelSVContent,
01561             AutoResetEvent parallaxViewLoadedEvent,
01562             AutoResetEvent scrollViewerLoadedEvent)
01563         {
01564             Log.Comment("Setting up UI with ParallaxView inside ScrollViewer");
01565
01566             LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
01567
01568             GradientStop brownGS = new GradientStop() { Color = Microsoft.UI.Colors.Brown, Offset = 0.0 };
01569             twoColorLGB.GradientStops.Add(brownGS);
01570
01571             GradientStop orangeGS = new GradientStop() { Color = Microsoft.UI.Colors.Orange, Offset = 1.0 };
01572             twoColorLGB.GradientStops.Add(orangeGS);
01573
01574             Verify.IsNotNull(stackPanelSVContent);
01575             stackPanelSVContent.Width = c_defaultUIScrollViewerWidth;
01576
01577             if (verticalParallaxViewOffset > 0.0)
01578             {
01579                 Rectangle rectangleChild = new Rectangle() { Width = c_defaultUIScrollViewerWidth, Height = verticalParallaxViewOffset, Fill = twoColorLGB };
01580                 stackPanelSVContent.Children.Add(rectangleChild);
01581             }
01582
01583             Verify.IsNotNull(rectanglePVChild);
01584             rectanglePVChild.Width = c_defaultUIScrollViewerWidth;
01585             rectanglePVChild.Height = c_defaultUIScrollViewerHeight / 2.0 + c_defaultUIVerticalShift;
01586             rectanglePVChild.Fill = twoColorLGB;
01587
01588             Verify.IsNotNull(parallaxView);
01589             parallaxView.Width = c_defaultUIScrollViewerWidth;
01590             parallaxView.Height = c_defaultUIScrollViewerHeight / 2.0;
01591             parallaxView.Child = rectanglePVChild;
01592             parallaxView.VerticalShift = c_defaultUIVerticalShift;
01593             parallaxView.MaxVerticalShiftRatio = c_defaultMaxVerticalShiftRatio;
01594
01595             stackPanelSVContent.Children.Add(parallaxView);
01596
01597             for (int childRect = 0; childRect < 3; childRect++)
01598             {
01599                 Rectangle rectangleChild = new Rectangle() { Width = c_defaultUIScrollViewerWidth, Height = c_defaultUIScrollViewerHeight, Fill = twoColorLGB };
01600                 stackPanelSVContent.Children.Add(rectangleChild);
01601             }
01602
01603             Verify.IsNotNull(scrollViewer);
01604             scrollViewer.Width = c_defaultUIScrollViewerWidth;
01605             scrollViewer.Height = c_defaultUIScrollViewerHeight;
01606             scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
01607             scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
01608             scrollViewer.ZoomMode = Microsoft.UI.Xaml.Controls.ZoomMode.Disabled;
01609             scrollViewer.Content = stackPanelSVContent;
01610
01611             if (parallaxViewLoadedEvent != null)
01612             {
01613                 parallaxView.Loaded += (object sender, RoutedEventArgs e) =>
01614                 {
01615                     Log.Comment("ParallaxView.Loaded event handler");
01616                     parallaxViewLoadedEvent.Set();
01617                 };
01618             }
01619
01620             if (scrollViewerLoadedEvent != null)
01621             {
01622                 scrollViewer.Loaded += (object sender, RoutedEventArgs e) =>
01623                 {
01624                     Log.Comment("ScrollViewer.Loaded event handler");
01625                     parallaxView.Source = scrollViewer;
01626                     scrollViewerLoadedEvent.Set();
01627                 };
01628             }
01629
01630             Log.Comment("Setting window content");
01631             Content = scrollViewer;
01632         }
01633
01634         private void ChangePropertyAfterParallaxViewDisposal(PropertyId propertyToChange)
01635         {
01636             ParallaxView parallaxView = null;
01637             Rectangle rectanglePVChild = null;
01638             ScrollViewer scrollViewer = null;
01639             Rectangle rectangleSVContent = null;
01640             AutoResetEvent parallaxViewLoadedEvent = null;
01641             AutoResetEvent scrollViewerLoadedEvent = null;
01642
01643             RunOnUIThread.Execute(() =>
01644             {
01645                 parallaxViewLoadedEvent = new AutoResetEvent(false);
01646                 scrollViewerLoadedEvent = new AutoResetEvent(false);
01647                 rectangleSVContent = new Rectangle();
01648                 scrollViewer = new ScrollViewer();
01649                 rectanglePVChild = new Rectangle();
01650                 parallaxView = new ParallaxView();
01651
01652                 scrollViewer.Loaded += (object sender, RoutedEventArgs e) =>
01653                 {
01654                     Log.Comment("ScrollViewer.Loaded event handler");
01655                     scrollViewerLoadedEvent.Set();
01656                 };
01657
01658                 SetupDefaultUIWithScrollViewer(
01659                     parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent,
01660                     parallaxViewLoadedEvent, scrollViewerLoadedEvent: null);
01661
01662                 parallaxView.Source = scrollViewer;
01663             });
01664
01665             Log.Comment("Waiting for Loaded events");
01666             parallaxViewLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01667             scrollViewerLoadedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01668             Log.Comment("Default UI set up");
01669
01670             RunOnUIThread.Execute(() =>
01671             {
01672                 Log.Comment("Disposing the ParallaxView");
01673                 (Content as StackPanel).Children.Remove(parallaxView);
01674                 WeakReference parallaxViewWeakReference = new WeakReference(parallaxView);
01675                 parallaxView = null;
01676                 Log.Comment("Garbage-collecting the ParallaxView");
01677                 GC.Collect();
01678                 GC.WaitForPendingFinalizers();
01679                 GC.Collect();
01680                 Verify.IsNull(parallaxViewWeakReference.Target);
01681
01682                 switch (propertyToChange)
01683                 {
01684                     case PropertyId.ParallaxViewChildVerticalAlignment:
01685                         Log.Comment("Changing prior ParallaxView.Child's VerticalAlignment");
01686                         rectanglePVChild.VerticalAlignment = VerticalAlignment.Bottom;
01687                         break;
01688                     case PropertyId.ScrollViewerContentHeight:
01689                         Log.Comment("Changing ScrollViewer.Content.Height");
01690                         rectangleSVContent.Height += 10;
01691                         break;
01692                 }
01693             });
01694         }
01695
01696         private static void ChangeScrollViewerView(
01697             ScrollViewer scrollViewer,
01698             double? horizontalOffset,
01699             double? verticalOffset,
01700             float? zoomFactor,
01701             bool disableAnimation,
01702             Visual visualPPChild,
01703             ref float? finalHorizontalShift,
01704             ref float? finalVerticalShift)
01705         {
01706             AutoResetEvent scrollViewerViewChangedEvent = null;
01707             double? targetHorizontalOffset = horizontalOffset;
01708             double? targetVerticalOffset = verticalOffset;
01709             float? targetZoomFactor = zoomFactor;
01710             bool spyOnHorizontalShift = visualPPChild != null && finalHorizontalShift != null;
01711             bool spyOnVerticalShift = visualPPChild != null && finalVerticalShift != null;
01712             float horizontalShift = 0f;
01713             float verticalShift = 0f;
01714
01715             RunOnUIThread.Execute(() =>
01716             {
01717                 scrollViewerViewChangedEvent = new AutoResetEvent(false);
01718
01719                 scrollViewer.ViewChanged += (object sender, ScrollViewerViewChangedEventArgs e) =>
01720                 {
01721                     try
01722                     {
01723                         Log.Comment("ScrollViewer.ViewChanged - IsIntermediate={0}, View=({1}, {2}, {3})",
01724                             e.IsIntermediate, scrollViewer.HorizontalOffset, scrollViewer.VerticalOffset, scrollViewer.ZoomFactor);
01725
01726                         CompositionGetValueStatus status;
01727
01728                         if (spyOnHorizontalShift)
01729                         {
01730                             status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out horizontalShift);
01731                             Log.Comment("Target transform during view change: status={0}, horizontal offset={1}", status, horizontalShift);
01732                         }
01733
01734                         if (spyOnVerticalShift)
01735                         {
01736                             status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out verticalShift);
01737                             Log.Comment("Target transform during view change: status={0}, vertical offset={1}", status, verticalShift);
01738                         }
01739
01740                         if (!e.IsIntermediate)
01741                         {
01742                             Log.Comment("ScrollViewer - final notification. Final view: {0}, {1}, {2}", scrollViewer.HorizontalOffset, scrollViewer.VerticalOffset, scrollViewer.ZoomFactor);
01743                             scrollViewerViewChangedEvent.Set();
01744                         }
01745                     }
01746                     catch (Exception ex)
01747                     {
01748                         Log.Error("Exception in ScrollViewer.ViewChanged: " + ex.ToString());
01749                     }
01750                 };
01751
01752                 Log.Comment("Changing ScrollViewer view to ({0}, {1}, {2}) with disableAnimation={3}", targetHorizontalOffset, targetVerticalOffset, targetZoomFactor, disableAnimation);
01753                 bool result = scrollViewer.ChangeView(targetHorizontalOffset, targetVerticalOffset, targetZoomFactor, disableAnimation);
01754                 Log.Comment("View change result: {0}", result);
01755                 Verify.IsTrue(result);
01756             });
01757
01758             Log.Comment("Waiting for scrollViewerViewChangedEvent event");
01759             scrollViewerViewChangedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01760             Log.Comment("First view change completed");
01761
01762             Log.Comment("Waiting for captured properties to be updated");
01763             CompositionPropertySpy.SynchronouslyTickUIThread(10);
01764
01765             if (spyOnHorizontalShift || spyOnVerticalShift)
01766             {
01767                 RunOnUIThread.Execute(() =>
01768                 {
01769                     Log.Comment("Cancelling spying");
01770
01771                     if (spyOnHorizontalShift)
01772                     {
01773                         CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
01774                     }
01775                     if (spyOnVerticalShift)
01776                     {
01777                         CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
01778                     }
01779                 });
01780
01781                 Log.Comment("Waiting for captured properties to be updated");
01782                 CompositionPropertySpy.SynchronouslyTickUIThread(10);
01783
01784                 RunOnUIThread.Execute(() =>
01785                 {
01786                     CompositionGetValueStatus status;
01787
01788                     Log.Comment("Accessing final shift values");
01789
01790                     if (spyOnHorizontalShift)
01791                     {
01792                         status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out horizontalShift);
01793                         Log.Comment("Target transform after view change: status={0}, horizontal offset={1}", status, horizontalShift);
01794                     }
01795
01796                     if (spyOnVerticalShift)
01797                     {
01798                         status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out verticalShift);
01799                         Log.Comment("Target transform after view change: status={0}, vertical offset={1}", status, verticalShift);
01800                     }
01801                 });
01802
01803                 if (spyOnHorizontalShift)
01804                 {
01805                     finalHorizontalShift = horizontalShift;
01806                 }
01807
01808                 if (spyOnVerticalShift)
01809                 {
01810                     finalVerticalShift = verticalShift;
01811                 }
01812             }
01813         }
01814
01815         private static void ChangeScrollPresenterView(
01816             ScrollPresenter scrollPresenter,
01817             double? horizontalOffset,
01818             double? verticalOffset,
01819             float? zoomFactor,
01820             bool disableAnimation,
01821             Visual visualPPChild,
01822             ref float? finalHorizontalShift,
01823             ref float? finalVerticalShift)
01824         {
01825             bool isPrivateLoggingEnabled = false;
01826             AutoResetEvent scrollPresenterStateChangedEvent = null;
01827             bool spyOnHorizontalShift = visualPPChild != null && finalHorizontalShift != null;
01828             bool spyOnVerticalShift = visualPPChild != null && finalVerticalShift != null;
01829             float horizontalShift = 0f;
01830             float verticalShift = 0f;
01831
01832             RunOnUIThread.Execute(() =>
01833             {
01834                 if (isPrivateLoggingEnabled)
01835                 {
01836                     // Turn on private tracing for ScrollPresenter control
01837                     MUXControlsTestHooks.SetOutputDebugStringLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
01838                     MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
01839                     MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
01840                 }
01841
01842                 scrollPresenterStateChangedEvent = new AutoResetEvent(false);
01843
01844                 scrollPresenter.ViewChanged += (ScrollPresenter sender, object e) =>
01845                 {
01846                     try
01847                     {
01848                         Log.Comment("ScrollPresenter.ViewChanged - View=({0}, {1}, {2})", scrollPresenter.HorizontalOffset, scrollPresenter.VerticalOffset, scrollPresenter.ZoomFactor);
01849
01850                         CompositionGetValueStatus status;
01851
01852                         if (spyOnHorizontalShift)
01853                         {
01854                             status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out horizontalShift);
01855                             Log.Comment("Target transform during view change: status={0}, horizontal offset={1}", status, horizontalShift);
01856                         }
01857
01858                         if (spyOnVerticalShift)
01859                         {
01860                             status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out verticalShift);
01861                             Log.Comment("Target transform during view change: status={0}, vertical offset={1}", status, verticalShift);
01862                         }
01863                     }
01864                     catch (Exception ex)
01865                     {
01866                         Log.Error("Exception in ScrollPresenter.ViewChanged: " + ex.ToString());
01867                     }
01868                 };
01869
01870                 scrollPresenter.StateChanged += (ScrollPresenter sender, object e) =>
01871                 {
01872                     try
01873                     {
01874                         Log.Comment("ScrollPresenter.StateChanged - State={0}", scrollPresenter.State);
01875                         if (scrollPresenter.State == ScrollingInteractionState.Idle)
01876                         {
01877                             Log.Comment("ScrollPresenter - idling notification. Final view: {0}, {1}, {2}", scrollPresenter.HorizontalOffset, scrollPresenter.VerticalOffset, scrollPresenter.ZoomFactor);
01878                             scrollPresenterStateChangedEvent.Set();
01879                         }
01880                     }
01881                     catch (Exception ex)
01882                     {
01883                         Log.Error("Exception in ScrollPresenter.StateChanged: " + ex.ToString());
01884                     }
01885                 };
01886
01887                 Log.Comment("Changing ScrollPresenter view to ({0}, {1}, {2}) with disableAnimation={3}", horizontalOffset, verticalOffset, zoomFactor, disableAnimation);
01888                 if (zoomFactor != null && (float)zoomFactor != scrollPresenter.ZoomFactor)
01889                 {
01890                     int viewChangeCorrelationId = scrollPresenter.ZoomTo(
01891                         (float)zoomFactor,
01892                         Vector2.Zero,
01893                         new ScrollingZoomOptions(
01894                             disableAnimation ? ScrollingAnimationMode.Disabled : ScrollingAnimationMode.Enabled,
01895                             ScrollingSnapPointsMode.Ignore));
01896                     Verify.IsGreaterThan(viewChangeCorrelationId, 0);
01897                 }
01898
01899                 if ((horizontalOffset != null && (double)horizontalOffset != scrollPresenter.HorizontalOffset) || (verticalOffset != null && (double)verticalOffset != scrollPresenter.VerticalOffset))
01900                 {
01901                     Log.Comment("Invoking ScrollPresenter.ChangeOffsets");
01902                     int viewChangeCorrelationId = scrollPresenter.ScrollTo(
01903                         horizontalOffset == null ? scrollPresenter.HorizontalOffset : (double)horizontalOffset,
01904                         verticalOffset == null ? scrollPresenter.VerticalOffset : (double)verticalOffset,
01905                         new ScrollingScrollOptions(
01906                             disableAnimation ? ScrollingAnimationMode.Disabled : ScrollingAnimationMode.Enabled,
01907                             ScrollingSnapPointsMode.Ignore));
01908                     Verify.IsGreaterThan(viewChangeCorrelationId, 0);
01909                 }
01910             });
01911
01912             Log.Comment("Waiting for scrollPresenterStateChangedEvent event");
01913             scrollPresenterStateChangedEvent.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration));
01914             Log.Comment("First view change completed");
01915
01916             Log.Comment("Waiting for captured properties to be updated");
01917             CompositionPropertySpy.SynchronouslyTickUIThread(10);
01918
01919             if (spyOnHorizontalShift || spyOnVerticalShift)
01920             {
01921                 RunOnUIThread.Execute(() =>
01922                 {
01923                     Log.Comment("Cancelling spying");
01924
01925                     if (spyOnHorizontalShift)
01926                     {
01927                         CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName());
01928                     }
01929                     if (spyOnVerticalShift)
01930                     {
01931                         CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName());
01932                     }
01933                 });
01934
01935                 Log.Comment("Waiting for captured properties to be updated");
01936                 CompositionPropertySpy.SynchronouslyTickUIThread(10);
01937
01938                 RunOnUIThread.Execute(() =>
01939                 {
01940                     CompositionGetValueStatus status;
01941
01942                     Log.Comment("Accessing final shift values");
01943
01944                     if (spyOnHorizontalShift)
01945                     {
01946                         status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualHorizontalTargetedPropertyName(), out horizontalShift);
01947                         Log.Comment("Target transform after view change: status={0}, horizontal offset={1}", status, horizontalShift);
01948                     }
01949
01950                     if (spyOnVerticalShift)
01951                     {
01952                         status = CompositionPropertySpy.TryGetScalar(visualPPChild, GetVisualVerticalTargetedPropertyName(), out verticalShift);
01953                         Log.Comment("Target transform after view change: status={0}, vertical offset={1}", status, verticalShift);
01954                     }
01955
01956                     if (isPrivateLoggingEnabled)
01957                     {
01958                         // Turn off private tracing for ScrollPresenter control
01959                         MUXControlsTestHooks.SetOutputDebugStringLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
01960                         MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
01961                         MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
01962                     }
01963                 });
01964
01965                 if (spyOnHorizontalShift)
01966                 {
01967                     finalHorizontalShift = horizontalShift;
01968                 }
01969
01970                 if (spyOnVerticalShift)
01971                 {
01972                     finalVerticalShift = verticalShift;
01973                 }
01974             }
01975         }
01976
01977         private static string GetVisualHorizontalTargetedPropertyName()
01978         {
01979             return "Translation.X";
01980         }
01981
01982         private static string GetVisualVerticalTargetedPropertyName()
01983         {
01984             return "Translation.Y";
01985         }
01986
01987         private static void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
01988         {
01989             string msg = args.Message.Substring(0, args.Message.Length - 1);
01990             string senderName = string.Empty;
01991             ScrollPresenter scr = sender as ScrollPresenter;
01992
01993             if (scr != null)
01994             {
01995                 senderName = "s:" + scr.Name + ", ";
01996             }
01997
01998             if (args.IsVerboseLevel)
01999             {
02000                 Log.Comment("  Verbose: " + senderName + "m:" + msg);
02001             }
02002             else
02003             {
02004                 Log.Comment("  Info:    " + senderName + "m:" + msg);
02005             }
02006         }
02007
02008         private static ScrollViewer FindInnerScrollViewer(ItemsControl ic)
02009         {
02010             Panel p = ic.ItemsPanelRoot;
02011
02012             UIElement parent = VisualTreeHelper.GetParent(p) as UIElement;
02013             while (parent != null && !(parent is ScrollViewer))
02014                 parent = VisualTreeHelper.GetParent(parent) as UIElement;
02015
02016             return parent as ScrollViewer;
02017         }
02018     }
02019 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/WebView2.properties.h Source File

  • Generated

WebView2.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class WebView2Properties
00008 {
00009 public:
00010     WebView2Properties();
00011
00012     void CanGoBack(bool value);
00013     bool CanGoBack();
00014
00015     void CanGoForward(bool value);
00016     bool CanGoForward();
00017
00018     void DefaultBackgroundColor(winrt::Color const& value);
00019     winrt::Color DefaultBackgroundColor();
00020
00021     void Source(winrt::Uri const& value);
00022     winrt::Uri Source();
00023
00024     static winrt::DependencyProperty CanGoBackProperty() { return s_CanGoBackProperty; }
00025     static winrt::DependencyProperty CanGoForwardProperty() { return s_CanGoForwardProperty; }
00026     static winrt::DependencyProperty DefaultBackgroundColorProperty() { return s_DefaultBackgroundColorProperty; }
00027     static winrt::DependencyProperty SourceProperty() { return s_SourceProperty; }
00028
00029     static GlobalDependencyProperty s_CanGoBackProperty;
00030     static GlobalDependencyProperty s_CanGoForwardProperty;
00031     static GlobalDependencyProperty s_DefaultBackgroundColorProperty;
00032     static GlobalDependencyProperty s_SourceProperty;
00033
00034     winrt::event_token CoreProcessFailed(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2ProcessFailedEventArgs> const& value);
00035     void CoreProcessFailed(winrt::event_token const& token);
00036     winrt::event_token CoreWebView2Initialized(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2InitializedEventArgs> const& value);
00037     void CoreWebView2Initialized(winrt::event_token const& token);
00038     winrt::event_token NavigationCompleted(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2NavigationCompletedEventArgs> const& value);
00039     void NavigationCompleted(winrt::event_token const& token);
00040     winrt::event_token NavigationStarting(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2NavigationStartingEventArgs> const& value);
00041     void NavigationStarting(winrt::event_token const& token);
00042     winrt::event_token WebMessageReceived(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2WebMessageReceivedEventArgs> const& value);
00043     void WebMessageReceived(winrt::event_token const& token);
00044
00045     event_source<winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2ProcessFailedEventArgs>> m_coreProcessFailedEventSource;
00046     event_source<winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2InitializedEventArgs>> m_coreWebView2InitializedEventSource;
00047     event_source<winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2NavigationCompletedEventArgs>> m_navigationCompletedEventSource;
00048     event_source<winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2NavigationStartingEventArgs>> m_navigationStartingEventSource;
00049     event_source<winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2WebMessageReceivedEventArgs>> m_webMessageReceivedEventSource;
00050
00051     static void EnsureProperties();
00052     static void ClearProperties();
00053
00054     static void OnCanGoBackPropertyChanged(
00055         winrt::DependencyObject const& sender,
00056         winrt::DependencyPropertyChangedEventArgs const& args);
00057
00058     static void OnCanGoForwardPropertyChanged(
00059         winrt::DependencyObject const& sender,
00060         winrt::DependencyPropertyChangedEventArgs const& args);
00061
00062     static void OnDefaultBackgroundColorPropertyChanged(
00063         winrt::DependencyObject const& sender,
00064         winrt::DependencyPropertyChangedEventArgs const& args);
00065
00066     static void OnSourcePropertyChanged(
00067         winrt::DependencyObject const& sender,
00068         winrt::DependencyPropertyChangedEventArgs const& args);
00069 };
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewPaneClosingEventArgs Member List

This is the complete list of members for NavigationViewPaneClosingEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
Cancel() | NavigationViewPaneClosingEventArgs |
Cancel(bool value) | NavigationViewPaneClosingEventArgs |
CheckThread() | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< NavigationViewPaneClosingEventArgs > &&self) noexcept | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
final_release(std::unique_ptr< NavigationViewPaneClosingEventArgs > &&self) | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
GetInner() | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
IsOnThread() | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable > | [inline]
SplitViewClosingArgs(winrt::SplitViewPaneClosingEventArgs const &value) | NavigationViewPaneClosingEventArgs |
Generated on Sun Dec 1 2024 20:52:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RepeaterLayoutContext Member List

This is the complete list of members for RepeaterLayoutContext, including all inherited members.
GetItemAtCore(int index) | RepeaterLayoutContext |
GetOrCreateElementAtCore(int index, winrt::ElementRealizationOptions const &options) | RepeaterLayoutContext |
GetOwner() | RepeaterLayoutContext | [private]
GetRuntimeClassName() const | RepeaterLayoutContext | [inline]
ItemCountCore() | RepeaterLayoutContext |
LayoutOriginCore() | RepeaterLayoutContext |
LayoutOriginCore(winrt::Point const &value) | RepeaterLayoutContext |
LayoutStateCore() | RepeaterLayoutContext |
LayoutStateCore(winrt::IInspectable const &state) | RepeaterLayoutContext |
m_owner | RepeaterLayoutContext | [private]
RealizationRectCore() | RepeaterLayoutContext |
RecommendedAnchorIndexCore() | RepeaterLayoutContext |
RecycleElementCore(winrt::UIElement const &element) | RepeaterLayoutContext |
RepeaterLayoutContext(const winrt::ItemsRepeater &owner) | RepeaterLayoutContext |
VisibleRectCore() | RepeaterLayoutContext |
Generated on Sun Dec 1 2024 20:53:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RadioButtonsTests Member List

This is the complete list of members for RadioButtonsTests, including all inherited members.
VerifyCustomItemTemplate() | RadioButtonsTests | [inline]
VerifyIsEnabledChangeUpdatesVisualState() | RadioButtonsTests | [inline]
Generated on Sun Dec 1 2024 20:53:35 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PagerControlPage Member List

This is the complete list of members for PagerControlPage, including all inherited members.
CheckIfButtonsHiddenButtonClicked(object sender, RoutedEventArgs args) | PagerControlPage | [inline, private]
firstPageButton | PagerControlPage | [private]
IncreaseNumberOfPagesButtonClicked(object sender, RoutedEventArgs args) | PagerControlPage | [inline, private]
lastPageButton | PagerControlPage | [private]
nextPageButton | PagerControlPage | [private]
NumberOfPagesInfinityButtonClicked(object sender, RoutedEventArgs args) | PagerControlPage | [inline, private]
NumberOfPagesSetterButtonClicked(object sender, RoutedEventArgs args) | PagerControlPage | [inline, private]
OnDisplayModeChanged(object sender, SelectionChangedEventArgs e) | PagerControlPage | [inline, private]
OnFirstButtonVisibilityChanged(object sender, SelectionChangedEventArgs e) | PagerControlPage | [inline, private]
OnLastButtonVisibilityChanged(object sender, SelectionChangedEventArgs e) | PagerControlPage | [inline, private]
OnLoad(object sender, RoutedEventArgs args) | PagerControlPage | [inline, private]
OnNextButtonVisibilityChanged(object sender, SelectionChangedEventArgs e) | PagerControlPage | [inline, private]
OnPreviousButtonVisibilityChanged(object sender, SelectionChangedEventArgs e) | PagerControlPage | [inline, private]
OnSelectedIndexChanged(PagerControl sender, PagerControlSelectedIndexChangedEventArgs args) | PagerControlPage | [inline, private]
pagerComboBox | PagerControlPage | [private]
PagerControlPage() | PagerControlPage | [inline]
pagerItemsRepeater | PagerControlPage | [private]
pagerNumberBox | PagerControlPage | [private]
previousPageButton | PagerControlPage | [private]
UpdateNumberPanelContentTextBlock(object sender, NotifyCollectionChangedEventArgs args) | PagerControlPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/TestUI/ColorToSolidColorBrushConverter.cs Source File

  • AnimatedIcon
  • TestUI

ColorToSolidColorBrushConverter.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004 using Windows.UI;
00005 using Microsoft.UI.Xaml.Data;
00006 using Microsoft.UI.Xaml.Media;
00007
00008 namespace MUXControlsTestApp
00009 {
00010     class ColorToSolidColorBrushConverter : IValueConverter
00011     {
00012         public object Convert(object value, Type targetType, object parameter, string language)
00013         {
00014             return new SolidColorBrush((Color)value);
00015         }
00016
00017         public object ConvertBack(object value, Type targetType, object parameter, string language)
00018         {
00019             return ((SolidColorBrush)value).Color;
00020         }
00021     }
00022 }
Generated on Sun Dec 1 2024 20:51:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnnotatedScrollBar/TestUI/AnnotatedScrollBarSummaryPage.xaml.cs Source File

  • AnnotatedScrollBar
  • TestUI

AnnotatedScrollBarSummaryPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Collections.ObjectModel;
00007 using System.Windows.Input;
00008 using Microsoft.UI.Xaml;
00009 using Microsoft.UI.Xaml.Controls;
00010 using Microsoft.UI.Xaml.Controls.Primitives;
00011 using Microsoft.UI.Xaml.Markup;
00012 using Microsoft.UI.Xaml.Media;
00013 using Windows.UI;
00014
00015 namespace MUXControlsTestApp
00016 {
00017     public class Square
00018     {
00019         public string Name { get; set; }
00020         public string Color { get; set; }
00021         public double Width { get; set; }
00022     };
00023
00024     public sealed partial class AnnotatedScrollBarSummaryPage : TestPage
00025     {
00026         public ObservableCollection<Square> SquareCollection = new ObservableCollection<Square>();
00027         public ObservableCollection<AnnotatedScrollBarLabel> LabelCollection = new ObservableCollection<AnnotatedScrollBarLabel>();
00028
00029         private double _offsetBetweenLabels = 100;
00030         private int _numLabels = 0;
00031         private double _lastRequestedDetailLabelOffset = 0;
00032         private string _detailLabelContent = null;
00033         private bool _useLongLabels = false;
00034         private bool _cancelScrolling = false;
00035         private double _lastScrollOffset = 0.0;
00036
00037         public AnnotatedScrollBarSummaryPage()
00038         {
00039             this.InitializeComponent();
00040
00041             Loaded += AnnotatedScrollBarPage_Loaded;
00042
00043             pageAnnotatedScrollbar.Scrolling += AnnotatedScrollbar_Scrolling;
00044
00045             PopulateSquares(200);
00046         }
00047
00048         ~AnnotatedScrollBarSummaryPage()
00049         {
00050         }
00051
00052         private void AnnotatedScrollBarPage_Loaded(object sender, RoutedEventArgs e)
00053         {
00054             pageScrollView.VerticalScrollBarVisibility = ScrollingScrollBarVisibility.Hidden;
00055             ScrollPresenter scrollPresenter = pageScrollView.GetValue(ScrollView.ScrollPresenterProperty) as ScrollPresenter;
00056             scrollPresenter.VerticalScrollController = pageAnnotatedScrollbar as IScrollController;
00057         }
00058
00059         private void PopulateSquares(int rows)
00060         {
00061             for (int i = 0; i < rows; i++)
00062             {
00063                 string squareName = "Item: " + i;
00064                 double itemWidth = (i % 2 == 0) ? 100 : 100;
00065                 SquareCollection.Add(new Square() { Name = squareName, Color = GetSquareColor(i), Width = itemWidth });
00066             }
00067         }
00068
00069         private string GetSquareColor(int squareNum)
00070         {
00071             if (squareNum <= 30)
00072             {
00073                 return "Violet";
00074             }
00075             else if (squareNum <= 80)
00076             {
00077                 return "Blue";
00078             }
00079             else if (squareNum <= 190)
00080             {
00081                 return "Green";
00082             }
00083             else
00084             {
00085                 return "Red";
00086             }
00087         }
00088
00089         private void PopulateLabels(int numLabels, double offsetBetweenLabels)
00090         {
00091             pageAnnotatedScrollbar.Labels.Clear();
00092
00093             var labelPrefix = _useLongLabels ? "ThisIsALongLabelWhichShouldExpandASB " : "Num ";
00094
00095             double currentLabelOffset = 0;
00096             for(int i = 0; i < numLabels; i++)
00097             {
00098                 var labelString = labelPrefix + i;
00099                 pageAnnotatedScrollbar.Labels.Add(new AnnotatedScrollBarLabel(labelString, currentLabelOffset));
00100                 currentLabelOffset += offsetBetweenLabels;
00101             }
00102         }
00103
00104         private void BtnPrePopulateLabels_Click(object sender, RoutedEventArgs e)
00105         {
00106             if (pageAnnotatedScrollbar != null)
00107             {
00108                 pageAnnotatedScrollbar.Labels.Clear();
00109                 PopulateLabels(20, 200);
00110             }
00111         }
00112
00113         public void AnnotatedScrollBar_DetailLabelRequested(object sender, AnnotatedScrollBarDetailLabelRequestedEventArgs args)
00114         {
00115             _lastRequestedDetailLabelOffset = args.ScrollOffset;
00116             args.Content = _detailLabelContent;
00117         }
00118
00119         private void isDetailLabelEnabled_Checked(object sender, RoutedEventArgs e)
00120         {
00121             pageAnnotatedScrollbar.DetailLabelRequested += AnnotatedScrollBar_DetailLabelRequested;
00122         }
00123
00124         private void isDetailLabelEnabled_Unchecked(object sender, RoutedEventArgs e)
00125         {
00126             pageAnnotatedScrollbar.DetailLabelRequested -= AnnotatedScrollBar_DetailLabelRequested;
00127         }
00128
00129         private void useLongLabelContent_Checked(object sender, RoutedEventArgs e)
00130         {
00131             _useLongLabels = true;
00132             _numLabels = 1;
00133             PopulateLabels(_numLabels, _offsetBetweenLabels);
00134         }
00135
00136         private void useLongLabelContent_Unchecked(object sender, RoutedEventArgs e)
00137         {
00138             _useLongLabels = false;
00139             _numLabels = 1;
00140             PopulateLabels(_numLabels, _offsetBetweenLabels);
00141         }
00142
00143         private void cancelScrollingEvent_Checked(object sender, RoutedEventArgs e)
00144         {
00145             _cancelScrolling = true;
00146         }
00147
00148         private void cancelScrollingEvent_Unchecked(object sender, RoutedEventArgs e)
00149         {
00150             _cancelScrolling = false;
00151         }
00152
00153         private void AnnotatedScrollbar_Scrolling(AnnotatedScrollBar sender, AnnotatedScrollBarScrollingEventArgs args)
00154         {
00155             args.Cancel = _cancelScrolling;
00156             _lastScrollOffset = args.ScrollOffset;
00157         }
00158
00159         private void CmbLabelTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
00160         {
00161             switch (cmbLabelTemplate.SelectedIndex)
00162             {
00163                 case 0:
00164                     pageAnnotatedScrollbar.LabelTemplate = Resources["LabelTemplate_TextBlock"] as DataTemplate;
00165                     break;
00166             }
00167         }
00168
00169         private void CmbDetailLabelTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
00170         {
00171             switch (cmbDetailLabelTemplate.SelectedIndex)
00172             {
00173                 case 0:
00174                     pageAnnotatedScrollbar.DetailLabelTemplate = Resources["DetailLabelTemplate_TextBlock"] as DataTemplate;
00175                     break;
00176             }
00177         }
00178
00179         private void CmbItemTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
00180         {
00181             switch (cmbItemTemplate.SelectedIndex)
00182             {
00183                 case 0:
00184                     pageContentRepeater.ItemTemplate = Resources["SquareTemplate"] as DataTemplate;
00185                     break;
00186             }
00187         }
00188
00189         private void CmbItemsSource_SelectionChanged(object sender, SelectionChangedEventArgs e)
00190         {
00191             switch (cmbItemsSource.SelectedIndex)
00192             {
00193                 case 0:
00194                     pageContentRepeater.ItemsSource = null;
00195                     break;
00196                 case 1:
00197                     pageContentRepeater.ItemsSource = SquareCollection;
00198                     break;
00199             }
00200         }
00201
00202         private void BtnGetViewportSize_Click(object sender, RoutedEventArgs e)
00203         {
00204             if(txtViewportSize != null)
00205             {
00206                 txtViewportSize.Text = pageScrollView.ViewportHeight.ToString();
00207             }
00208         }
00209
00210         private void BtnSetViewportSize_Click(object sender, RoutedEventArgs e)
00211         {
00212             if(pageAnnotatedScrollbar != null)
00213             {
00214                 // pageAnnotatedScrollbar.ViewportSize = Convert.ToDouble(txtViewportSize.Text);
00215                 //pageScrollView.ViewportHeight = Convert.ToDouble(txtViewportSize.Text);
00216             }
00217         }
00218
00219         private void BtnGetNumLabels_Click(object sender, RoutedEventArgs e)
00220         {
00221             if(pageAnnotatedScrollbar != null)
00222             {
00223                 txtNumLabels.Text = pageAnnotatedScrollbar.Labels.Count.ToString();
00224             }
00225         }
00226
00227         private void BtnSetNumLabels_Click(object sender, RoutedEventArgs e)
00228         {
00229             if(pageAnnotatedScrollbar != null)
00230             {
00231                 _numLabels = Convert.ToInt16(txtNumLabels.Text);
00232                 PopulateLabels(_numLabels, _offsetBetweenLabels);
00233             }
00234         }
00235
00236         private void BtnGetOffsetBetweenLabels_Click(object sender, RoutedEventArgs e)
00237         {
00238             if(pageAnnotatedScrollbar != null)
00239             {
00240                 txtOffsetBetweenLabels.Text = _offsetBetweenLabels.ToString();
00241             }
00242         }
00243
00244         private void BtnSetOffsetBetweenLabels_Click(object sender, RoutedEventArgs e)
00245         {
00246             if(pageAnnotatedScrollbar != null)
00247             {
00248                 _offsetBetweenLabels = Convert.ToDouble(txtOffsetBetweenLabels.Text);
00249                 PopulateLabels(_numLabels, _offsetBetweenLabels);
00250             }
00251         }
00252
00253         private void BtnGetDetailLabelContent_Click(object sender, RoutedEventArgs e)
00254         {
00255             if (pageAnnotatedScrollbar != null)
00256             {
00257                 txtDetailLabelContent.Text = _detailLabelContent;
00258             }
00259         }
00260
00261         private void BtnSetDetailLabelContent_Click(object sender, RoutedEventArgs e)
00262         {
00263             if (pageAnnotatedScrollbar != null)
00264             {
00265                 _detailLabelContent = txtDetailLabelContent.Text;
00266             }
00267         }
00268
00269         private void BtnGetValue_Click(object sender, RoutedEventArgs e)
00270         {
00271             txtValue.Text = _lastScrollOffset.ToString();
00272         }
00273
00274         private void BtnGetMinimum_Click(object sender, RoutedEventArgs e)
00275         {
00276         }
00277
00278         private void BtnSetMinimum_Click(object sender, RoutedEventArgs e)
00279         {
00280         }
00281
00282         private void BtnGetMaximum_Click(object sender, RoutedEventArgs e)
00283         {
00284             txtMaximum.Text = pageScrollView.ScrollableHeight.ToString();
00285         }
00286
00287         private void BtnSetMaximum_Click(object sender, RoutedEventArgs e)
00288         {
00289         }
00290
00291         private void BtnGetSmallChange_Click(object sender, RoutedEventArgs e)
00292         {
00293             if(pageAnnotatedScrollbar != null)
00294             {
00295                 txtSmallChange.Text = pageAnnotatedScrollbar.SmallChange.ToString();
00296             }
00297         }
00298
00299         private void BtnSetSmallChange_Click(object sender, RoutedEventArgs e)
00300         {
00301             if(pageAnnotatedScrollbar != null)
00302             {
00303                 pageAnnotatedScrollbar.SmallChange = Convert.ToDouble(txtSmallChange.Text);
00304             }
00305         }
00306
00307         private void BtnGetLastRequestedDetailLabelOffset_Click(object sender, RoutedEventArgs e)
00308         {
00309             txtLastRequestedDetailLabelOffset.Text = _lastRequestedDetailLabelOffset.ToString();
00310         }
00311     }
00312 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SplitButton/ToggleSplitButtonAutomationPeer.cpp Source File

  • SplitButton

ToggleSplitButtonAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "ToggleSplitButton.h"
00008 #include "ToggleSplitButtonAutomationPeer.h"
00009 #include "Utils.h"
00010
00011 #include "ToggleSplitButtonAutomationPeer.properties.cpp"
00012
00013 ToggleSplitButtonAutomationPeer::ToggleSplitButtonAutomationPeer(winrt::ToggleSplitButton const& owner)
00014     : ReferenceTracker(owner)
00015 {
00016 }
00017
00018 // IAutomationPeerOverrides
00019 winrt::IInspectable ToggleSplitButtonAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00020 {
00021     if (patternInterface == winrt::PatternInterface::ExpandCollapse ||
00022         patternInterface == winrt::PatternInterface::Toggle)
00023     {
00024         return *this;
00025     }
00026
00027     return __super::GetPatternCore(patternInterface);
00028 }
00029
00030 hstring ToggleSplitButtonAutomationPeer::GetClassNameCore()
00031 {
00032     return winrt::hstring_name_of<winrt::ToggleSplitButton>();
00033 }
00034
00035 winrt::AutomationControlType ToggleSplitButtonAutomationPeer::GetAutomationControlTypeCore()
00036 {
00037     return winrt::AutomationControlType::SplitButton;
00038 }
00039
00040 com_ptr<ToggleSplitButton> ToggleSplitButtonAutomationPeer::GetImpl()
00041 {
00042     com_ptr<ToggleSplitButton> impl = nullptr;
00043
00044     if (auto splitButton = Owner().try_as<winrt::ToggleSplitButton>())
00045     {
00046         impl = winrt::get_self<ToggleSplitButton>(splitButton)->get_strong();
00047     }
00048
00049     return impl;
00050 }
00051
00052 // IExpandCollapseProvider
00053 winrt::ExpandCollapseState ToggleSplitButtonAutomationPeer::ExpandCollapseState()
00054 {
00055     winrt::ExpandCollapseState currentState = winrt::ExpandCollapseState::Collapsed;
00056
00057     if (auto splitButton = GetImpl())
00058     {
00059         if (splitButton->IsFlyoutOpen())
00060         {
00061             currentState = winrt::ExpandCollapseState::Expanded;
00062         }
00063     }
00064
00065     return currentState;
00066 }
00067
00068 void ToggleSplitButtonAutomationPeer::Expand()
00069 {
00070     if (auto splitButton = GetImpl())
00071     {
00072         splitButton->OpenFlyout();
00073     }
00074 }
00075
00076 void ToggleSplitButtonAutomationPeer::Collapse()
00077 {
00078     if (auto splitButton = GetImpl())
00079     {
00080         splitButton->CloseFlyout();
00081     }
00082 }
00083
00084 // IToggleProvider
00085 winrt::ToggleState ToggleSplitButtonAutomationPeer::ToggleState()
00086 {
00087     winrt::ToggleState state = winrt::ToggleState::Off;
00088
00089     if (auto splitButton = GetImpl())
00090     {
00091         if (splitButton->IsChecked())
00092         {
00093             state = winrt::ToggleState::On;
00094         }
00095     }
00096
00097     return state;
00098 }
00099
00100 void ToggleSplitButtonAutomationPeer::Toggle()
00101 {
00102     if (auto splitButton = GetImpl())
00103     {
00104         splitButton->Toggle();
00105     }
00106 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LayoutContext Member List

This is the complete list of members for LayoutContext, including all inherited members.
Indent() | LayoutContext | [inline]
LayoutState() | LayoutContext |
LayoutState(winrt::IInspectable const &value) | LayoutContext |
LayoutStateCore() | LayoutContext | [virtual]
LayoutStateCore(winrt::IInspectable const &state) | LayoutContext | [virtual]
Generated on Sun Dec 1 2024 20:52:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RevealBorderBrush.properties.cpp Source File

  • Generated

RevealBorderBrush.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RevealBorderBrush.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Media
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(RevealBorderBrush)
00012 }
00013
00014 #include "RevealBorderBrush.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/StackLayout.h Source File

  • Repeater

StackLayout.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "VirtualizingLayout.h"
00007 #include "StackLayout.g.h"
00008 #include "StackLayout.properties.h"
00009 #include "IFlowLayoutAlgorithmDelegates.h"
00010 #include "OrientationBasedMeasures.h"
00011 #include "StackLayoutState.h"
00012
00013 class StackLayout :
00014     public ReferenceTracker<StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout>,
00015     public IFlowLayoutAlgorithmDelegates,
00016     public OrientationBasedMeasures,
00017     public StackLayoutProperties
00018 {
00019 public:
00020     StackLayout();
00021
00022 #pragma region IVirtualizingLayoutOverrides
00023     void InitializeForContextCore(winrt::VirtualizingLayoutContext const& context);
00024     void UninitializeForContextCore(winrt::VirtualizingLayoutContext const& context);
00025     winrt::Size MeasureOverride(
00026         winrt::VirtualizingLayoutContext const& context,
00027         winrt::Size const& availableSize);
00028     winrt::Size ArrangeOverride(
00029         winrt::VirtualizingLayoutContext const& context,
00030         winrt::Size const& finalSize);
00031     void OnItemsChangedCore(
00032         winrt::VirtualizingLayoutContext const& context,
00033         winrt::IInspectable const& source,
00034         winrt::NotifyCollectionChangedEventArgs const& args);
00035 #pragma endregion
00036
00037 #pragma region IStackLayoutOverrides
00038     winrt::FlowLayoutAnchorInfo GetAnchorForRealizationRect(
00039         winrt::Size const& availableSize,
00040         winrt::VirtualizingLayoutContext const& context);
00041
00042     winrt::Rect GetExtent(
00043         winrt::Size const& availableSize,
00044         winrt::VirtualizingLayoutContext const& context,
00045         winrt::UIElement const& firstRealized,
00046          int firstRealizedItemIndex,
00047         winrt::Rect const& firstRealizedLayoutBounds,
00048         winrt::UIElement const& lastRealized,
00049          int lastRealizedItemIndex,
00050         winrt::Rect const& lastRealizedLayoutBounds);
00051
00052     void OnElementMeasured(
00053         winrt::UIElement const& element,
00054         int index,
00055         winrt::Size const& availableSize,
00056         winrt::Size const& measureSize,
00057         winrt::Size const& desiredSize,
00058         winrt::Size const& provisionalArrangeSize,
00059         winrt::VirtualizingLayoutContext const& context);
00060 #pragma endregion
00061
00062 #pragma region IFlowLayoutAlgorithmDelegates
00063     winrt::Size Algorithm_GetMeasureSize(int index, const winrt::Size& availableSize, const winrt::VirtualizingLayoutContext& context) override;
00064     winrt::Size Algorithm_GetProvisionalArrangeSize(int index, const winrt::Size& measureSize, winrt::Size const& desiredSize, const winrt::VirtualizingLayoutContext& context) override;
00065     bool Algorithm_ShouldBreakLine(int index, double remainingSpace) override;
00066     winrt::FlowLayoutAnchorInfo Algorithm_GetAnchorForRealizationRect(
00067         const winrt::Size& availableSize,
00068         const winrt::VirtualizingLayoutContext& context) override;
00069     winrt::FlowLayoutAnchorInfo Algorithm_GetAnchorForTargetElement(
00070         int targetIndex,
00071         const winrt::Size& availableSize,
00072         const winrt::VirtualizingLayoutContext& context) override;
00073     winrt::Rect Algorithm_GetExtent(const winrt::Size& availableSize,
00074         const winrt::VirtualizingLayoutContext& context,
00075         const winrt::UIElement& firstRealized,
00076         int firstRealizedItemIndex,
00077         const winrt::Rect& firstRealizedLayoutBounds,
00078         const winrt::UIElement& lastRealized,
00079         int lastRealizedItemIndex,
00080         const winrt::Rect& lastRealizedLayoutBounds) override;
00081     void Algorithm_OnElementMeasured(
00082         const winrt::UIElement& element,
00083         int index,
00084         const winrt::Size& availableSize,
00085         const winrt::Size& measureSize,
00086         const winrt::Size& desiredSize,
00087         const winrt::Size& provisionalArrangeSize,
00088         const winrt::VirtualizingLayoutContext& context) override;
00089     void Algorithm_OnLineArranged(
00090         int /*startIndex*/,
00091         int /*countInLine*/,
00092         double /*lineSize*/,
00093         const winrt::VirtualizingLayoutContext& /*context*/) override {}
00094 #pragma endregion
00095
00096     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00097
00098 private:
00099     double GetAverageElementSize(
00100         winrt::Size availableSize,
00101         winrt::VirtualizingLayoutContext context,
00102         const winrt::com_ptr<StackLayoutState>& layoutState);
00103
00104     winrt::com_ptr<StackLayoutState> GetAsStackState(const winrt::IInspectable& state)
00105     {
00106         return winrt::get_self<StackLayoutState>(state.as<winrt::StackLayoutState>())->get_strong();
00107     }
00108
00109     void InvalidateLayout()
00110     {
00111         __super::InvalidateMeasure();
00112     }
00113
00114     ::FlowLayoutAlgorithm& GetFlowAlgorithm(const winrt::VirtualizingLayoutContext& context)
00115     {
00116         return GetAsStackState(context.LayoutState())->FlowAlgorithm();
00117     }
00118
00119     void UpdateIndexBasedLayoutOrientation(const winrt::Orientation& orientation);
00120
00121     // Fields
00122     double m_itemSpacing{};
00123
00124     // !!! WARNING !!!
00125     // Any storage here needs to be related to layout configuration.
00126     // layout specific state needs to be stored in StackLayoutState.
00127 };
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ColorPicker.properties.cpp Source File

  • Generated

ColorPicker.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "ColorPicker.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(ColorPicker)
00012 }
00013
00014 #include "ColorPicker.g.cpp"
00015
00016 GlobalDependencyProperty ColorPickerProperties::s_ColorProperty{ nullptr };
00017 GlobalDependencyProperty ColorPickerProperties::s_ColorSpectrumComponentsProperty{ nullptr };
00018 GlobalDependencyProperty ColorPickerProperties::s_ColorSpectrumShapeProperty{ nullptr };
00019 GlobalDependencyProperty ColorPickerProperties::s_IsAlphaEnabledProperty{ nullptr };
00020 GlobalDependencyProperty ColorPickerProperties::s_IsAlphaSliderVisibleProperty{ nullptr };
00021 GlobalDependencyProperty ColorPickerProperties::s_IsAlphaTextInputVisibleProperty{ nullptr };
00022 GlobalDependencyProperty ColorPickerProperties::s_IsColorChannelTextInputVisibleProperty{ nullptr };
00023 GlobalDependencyProperty ColorPickerProperties::s_IsColorPreviewVisibleProperty{ nullptr };
00024 GlobalDependencyProperty ColorPickerProperties::s_IsColorSliderVisibleProperty{ nullptr };
00025 GlobalDependencyProperty ColorPickerProperties::s_IsColorSpectrumVisibleProperty{ nullptr };
00026 GlobalDependencyProperty ColorPickerProperties::s_IsHexInputVisibleProperty{ nullptr };
00027 GlobalDependencyProperty ColorPickerProperties::s_IsMoreButtonVisibleProperty{ nullptr };
00028 GlobalDependencyProperty ColorPickerProperties::s_MaxHueProperty{ nullptr };
00029 GlobalDependencyProperty ColorPickerProperties::s_MaxSaturationProperty{ nullptr };
00030 GlobalDependencyProperty ColorPickerProperties::s_MaxValueProperty{ nullptr };
00031 GlobalDependencyProperty ColorPickerProperties::s_MinHueProperty{ nullptr };
00032 GlobalDependencyProperty ColorPickerProperties::s_MinSaturationProperty{ nullptr };
00033 GlobalDependencyProperty ColorPickerProperties::s_MinValueProperty{ nullptr };
00034 GlobalDependencyProperty ColorPickerProperties::s_OrientationProperty{ nullptr };
00035 GlobalDependencyProperty ColorPickerProperties::s_PreviousColorProperty{ nullptr };
00036
00037 ColorPickerProperties::ColorPickerProperties()
00038     : m_colorChangedEventSource{static_cast<ColorPicker*>(this)}
00039 {
00040     EnsureProperties();
00041 }
00042
00043 void ColorPickerProperties::EnsureProperties()
00044 {
00045     if (!s_ColorProperty)
00046     {
00047         s_ColorProperty =
00048             InitializeDependencyProperty(
00049                 L"Color",
00050                 winrt::name_of<winrt::Color>(),
00051                 winrt::name_of<winrt::ColorPicker>(),
00052                 false /* isAttached */,
00053                 ValueHelper<winrt::Color>::BoxValueIfNecessary({ 255, 255, 255, 255 }),
00054                 winrt::PropertyChangedCallback(&OnColorPropertyChanged));
00055     }
00056     if (!s_ColorSpectrumComponentsProperty)
00057     {
00058         s_ColorSpectrumComponentsProperty =
00059             InitializeDependencyProperty(
00060                 L"ColorSpectrumComponents",
00061                 winrt::name_of<winrt::ColorSpectrumComponents>(),
00062                 winrt::name_of<winrt::ColorPicker>(),
00063                 false /* isAttached */,
00064                 ValueHelper<winrt::ColorSpectrumComponents>::BoxValueIfNecessary(winrt::ColorSpectrumComponents::HueSaturation),
00065                 winrt::PropertyChangedCallback(&OnColorSpectrumComponentsPropertyChanged));
00066     }
00067     if (!s_ColorSpectrumShapeProperty)
00068     {
00069         s_ColorSpectrumShapeProperty =
00070             InitializeDependencyProperty(
00071                 L"ColorSpectrumShape",
00072                 winrt::name_of<winrt::ColorSpectrumShape>(),
00073                 winrt::name_of<winrt::ColorPicker>(),
00074                 false /* isAttached */,
00075                 ValueHelper<winrt::ColorSpectrumShape>::BoxValueIfNecessary(winrt::ColorSpectrumShape::Box),
00076                 winrt::PropertyChangedCallback(&OnColorSpectrumShapePropertyChanged));
00077     }
00078     if (!s_IsAlphaEnabledProperty)
00079     {
00080         s_IsAlphaEnabledProperty =
00081             InitializeDependencyProperty(
00082                 L"IsAlphaEnabled",
00083                 winrt::name_of<bool>(),
00084                 winrt::name_of<winrt::ColorPicker>(),
00085                 false /* isAttached */,
00086                 ValueHelper<bool>::BoxedDefaultValue(),
00087                 winrt::PropertyChangedCallback(&OnIsAlphaEnabledPropertyChanged));
00088     }
00089     if (!s_IsAlphaSliderVisibleProperty)
00090     {
00091         s_IsAlphaSliderVisibleProperty =
00092             InitializeDependencyProperty(
00093                 L"IsAlphaSliderVisible",
00094                 winrt::name_of<bool>(),
00095                 winrt::name_of<winrt::ColorPicker>(),
00096                 false /* isAttached */,
00097                 ValueHelper<bool>::BoxValueIfNecessary(true),
00098                 winrt::PropertyChangedCallback(&OnIsAlphaSliderVisiblePropertyChanged));
00099     }
00100     if (!s_IsAlphaTextInputVisibleProperty)
00101     {
00102         s_IsAlphaTextInputVisibleProperty =
00103             InitializeDependencyProperty(
00104                 L"IsAlphaTextInputVisible",
00105                 winrt::name_of<bool>(),
00106                 winrt::name_of<winrt::ColorPicker>(),
00107                 false /* isAttached */,
00108                 ValueHelper<bool>::BoxValueIfNecessary(true),
00109                 winrt::PropertyChangedCallback(&OnIsAlphaTextInputVisiblePropertyChanged));
00110     }
00111     if (!s_IsColorChannelTextInputVisibleProperty)
00112     {
00113         s_IsColorChannelTextInputVisibleProperty =
00114             InitializeDependencyProperty(
00115                 L"IsColorChannelTextInputVisible",
00116                 winrt::name_of<bool>(),
00117                 winrt::name_of<winrt::ColorPicker>(),
00118                 false /* isAttached */,
00119                 ValueHelper<bool>::BoxValueIfNecessary(true),
00120                 winrt::PropertyChangedCallback(&OnIsColorChannelTextInputVisiblePropertyChanged));
00121     }
00122     if (!s_IsColorPreviewVisibleProperty)
00123     {
00124         s_IsColorPreviewVisibleProperty =
00125             InitializeDependencyProperty(
00126                 L"IsColorPreviewVisible",
00127                 winrt::name_of<bool>(),
00128                 winrt::name_of<winrt::ColorPicker>(),
00129                 false /* isAttached */,
00130                 ValueHelper<bool>::BoxValueIfNecessary(true),
00131                 winrt::PropertyChangedCallback(&OnIsColorPreviewVisiblePropertyChanged));
00132     }
00133     if (!s_IsColorSliderVisibleProperty)
00134     {
00135         s_IsColorSliderVisibleProperty =
00136             InitializeDependencyProperty(
00137                 L"IsColorSliderVisible",
00138                 winrt::name_of<bool>(),
00139                 winrt::name_of<winrt::ColorPicker>(),
00140                 false /* isAttached */,
00141                 ValueHelper<bool>::BoxValueIfNecessary(true),
00142                 winrt::PropertyChangedCallback(&OnIsColorSliderVisiblePropertyChanged));
00143     }
00144     if (!s_IsColorSpectrumVisibleProperty)
00145     {
00146         s_IsColorSpectrumVisibleProperty =
00147             InitializeDependencyProperty(
00148                 L"IsColorSpectrumVisible",
00149                 winrt::name_of<bool>(),
00150                 winrt::name_of<winrt::ColorPicker>(),
00151                 false /* isAttached */,
00152                 ValueHelper<bool>::BoxValueIfNecessary(true),
00153                 winrt::PropertyChangedCallback(&OnIsColorSpectrumVisiblePropertyChanged));
00154     }
00155     if (!s_IsHexInputVisibleProperty)
00156     {
00157         s_IsHexInputVisibleProperty =
00158             InitializeDependencyProperty(
00159                 L"IsHexInputVisible",
00160                 winrt::name_of<bool>(),
00161                 winrt::name_of<winrt::ColorPicker>(),
00162                 false /* isAttached */,
00163                 ValueHelper<bool>::BoxValueIfNecessary(true),
00164                 winrt::PropertyChangedCallback(&OnIsHexInputVisiblePropertyChanged));
00165     }
00166     if (!s_IsMoreButtonVisibleProperty)
00167     {
00168         s_IsMoreButtonVisibleProperty =
00169             InitializeDependencyProperty(
00170                 L"IsMoreButtonVisible",
00171                 winrt::name_of<bool>(),
00172                 winrt::name_of<winrt::ColorPicker>(),
00173                 false /* isAttached */,
00174                 ValueHelper<bool>::BoxedDefaultValue(),
00175                 winrt::PropertyChangedCallback(&OnIsMoreButtonVisiblePropertyChanged));
00176     }
00177     if (!s_MaxHueProperty)
00178     {
00179         s_MaxHueProperty =
00180             InitializeDependencyProperty(
00181                 L"MaxHue",
00182                 winrt::name_of<int>(),
00183                 winrt::name_of<winrt::ColorPicker>(),
00184                 false /* isAttached */,
00185                 ValueHelper<int>::BoxValueIfNecessary(359),
00186                 winrt::PropertyChangedCallback(&OnMaxHuePropertyChanged));
00187     }
00188     if (!s_MaxSaturationProperty)
00189     {
00190         s_MaxSaturationProperty =
00191             InitializeDependencyProperty(
00192                 L"MaxSaturation",
00193                 winrt::name_of<int>(),
00194                 winrt::name_of<winrt::ColorPicker>(),
00195                 false /* isAttached */,
00196                 ValueHelper<int>::BoxValueIfNecessary(100),
00197                 winrt::PropertyChangedCallback(&OnMaxSaturationPropertyChanged));
00198     }
00199     if (!s_MaxValueProperty)
00200     {
00201         s_MaxValueProperty =
00202             InitializeDependencyProperty(
00203                 L"MaxValue",
00204                 winrt::name_of<int>(),
00205                 winrt::name_of<winrt::ColorPicker>(),
00206                 false /* isAttached */,
00207                 ValueHelper<int>::BoxValueIfNecessary(100),
00208                 winrt::PropertyChangedCallback(&OnMaxValuePropertyChanged));
00209     }
00210     if (!s_MinHueProperty)
00211     {
00212         s_MinHueProperty =
00213             InitializeDependencyProperty(
00214                 L"MinHue",
00215                 winrt::name_of<int>(),
00216                 winrt::name_of<winrt::ColorPicker>(),
00217                 false /* isAttached */,
00218                 ValueHelper<int>::BoxValueIfNecessary(0),
00219                 winrt::PropertyChangedCallback(&OnMinHuePropertyChanged));
00220     }
00221     if (!s_MinSaturationProperty)
00222     {
00223         s_MinSaturationProperty =
00224             InitializeDependencyProperty(
00225                 L"MinSaturation",
00226                 winrt::name_of<int>(),
00227                 winrt::name_of<winrt::ColorPicker>(),
00228                 false /* isAttached */,
00229                 ValueHelper<int>::BoxValueIfNecessary(0),
00230                 winrt::PropertyChangedCallback(&OnMinSaturationPropertyChanged));
00231     }
00232     if (!s_MinValueProperty)
00233     {
00234         s_MinValueProperty =
00235             InitializeDependencyProperty(
00236                 L"MinValue",
00237                 winrt::name_of<int>(),
00238                 winrt::name_of<winrt::ColorPicker>(),
00239                 false /* isAttached */,
00240                 ValueHelper<int>::BoxValueIfNecessary(0),
00241                 winrt::PropertyChangedCallback(&OnMinValuePropertyChanged));
00242     }
00243     if (!s_OrientationProperty)
00244     {
00245         s_OrientationProperty =
00246             InitializeDependencyProperty(
00247                 L"Orientation",
00248                 winrt::name_of<winrt::Orientation>(),
00249                 winrt::name_of<winrt::ColorPicker>(),
00250                 false /* isAttached */,
00251                 ValueHelper<winrt::Orientation>::BoxValueIfNecessary(winrt::Orientation::Vertical),
00252                 winrt::PropertyChangedCallback(&OnOrientationPropertyChanged));
00253     }
00254     if (!s_PreviousColorProperty)
00255     {
00256         s_PreviousColorProperty =
00257             InitializeDependencyProperty(
00258                 L"PreviousColor",
00259                 winrt::name_of<winrt::IReference<winrt::Color>>(),
00260                 winrt::name_of<winrt::ColorPicker>(),
00261                 false /* isAttached */,
00262                 ValueHelper<winrt::IReference<winrt::Color>>::BoxedDefaultValue(),
00263                 winrt::PropertyChangedCallback(&OnPreviousColorPropertyChanged));
00264     }
00265 }
00266
00267 void ColorPickerProperties::ClearProperties()
00268 {
00269     s_ColorProperty = nullptr;
00270     s_ColorSpectrumComponentsProperty = nullptr;
00271     s_ColorSpectrumShapeProperty = nullptr;
00272     s_IsAlphaEnabledProperty = nullptr;
00273     s_IsAlphaSliderVisibleProperty = nullptr;
00274     s_IsAlphaTextInputVisibleProperty = nullptr;
00275     s_IsColorChannelTextInputVisibleProperty = nullptr;
00276     s_IsColorPreviewVisibleProperty = nullptr;
00277     s_IsColorSliderVisibleProperty = nullptr;
00278     s_IsColorSpectrumVisibleProperty = nullptr;
00279     s_IsHexInputVisibleProperty = nullptr;
00280     s_IsMoreButtonVisibleProperty = nullptr;
00281     s_MaxHueProperty = nullptr;
00282     s_MaxSaturationProperty = nullptr;
00283     s_MaxValueProperty = nullptr;
00284     s_MinHueProperty = nullptr;
00285     s_MinSaturationProperty = nullptr;
00286     s_MinValueProperty = nullptr;
00287     s_OrientationProperty = nullptr;
00288     s_PreviousColorProperty = nullptr;
00289 }
00290
00291 void ColorPickerProperties::OnColorPropertyChanged(
00292     winrt::DependencyObject const& sender,
00293     winrt::DependencyPropertyChangedEventArgs const& args)
00294 {
00295     auto owner = sender.as<winrt::ColorPicker>();
00296     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00297 }
00298
00299 void ColorPickerProperties::OnColorSpectrumComponentsPropertyChanged(
00300     winrt::DependencyObject const& sender,
00301     winrt::DependencyPropertyChangedEventArgs const& args)
00302 {
00303     auto owner = sender.as<winrt::ColorPicker>();
00304     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00305 }
00306
00307 void ColorPickerProperties::OnColorSpectrumShapePropertyChanged(
00308     winrt::DependencyObject const& sender,
00309     winrt::DependencyPropertyChangedEventArgs const& args)
00310 {
00311     auto owner = sender.as<winrt::ColorPicker>();
00312     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00313 }
00314
00315 void ColorPickerProperties::OnIsAlphaEnabledPropertyChanged(
00316     winrt::DependencyObject const& sender,
00317     winrt::DependencyPropertyChangedEventArgs const& args)
00318 {
00319     auto owner = sender.as<winrt::ColorPicker>();
00320     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00321 }
00322
00323 void ColorPickerProperties::OnIsAlphaSliderVisiblePropertyChanged(
00324     winrt::DependencyObject const& sender,
00325     winrt::DependencyPropertyChangedEventArgs const& args)
00326 {
00327     auto owner = sender.as<winrt::ColorPicker>();
00328     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00329 }
00330
00331 void ColorPickerProperties::OnIsAlphaTextInputVisiblePropertyChanged(
00332     winrt::DependencyObject const& sender,
00333     winrt::DependencyPropertyChangedEventArgs const& args)
00334 {
00335     auto owner = sender.as<winrt::ColorPicker>();
00336     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00337 }
00338
00339 void ColorPickerProperties::OnIsColorChannelTextInputVisiblePropertyChanged(
00340     winrt::DependencyObject const& sender,
00341     winrt::DependencyPropertyChangedEventArgs const& args)
00342 {
00343     auto owner = sender.as<winrt::ColorPicker>();
00344     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00345 }
00346
00347 void ColorPickerProperties::OnIsColorPreviewVisiblePropertyChanged(
00348     winrt::DependencyObject const& sender,
00349     winrt::DependencyPropertyChangedEventArgs const& args)
00350 {
00351     auto owner = sender.as<winrt::ColorPicker>();
00352     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00353 }
00354
00355 void ColorPickerProperties::OnIsColorSliderVisiblePropertyChanged(
00356     winrt::DependencyObject const& sender,
00357     winrt::DependencyPropertyChangedEventArgs const& args)
00358 {
00359     auto owner = sender.as<winrt::ColorPicker>();
00360     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00361 }
00362
00363 void ColorPickerProperties::OnIsColorSpectrumVisiblePropertyChanged(
00364     winrt::DependencyObject const& sender,
00365     winrt::DependencyPropertyChangedEventArgs const& args)
00366 {
00367     auto owner = sender.as<winrt::ColorPicker>();
00368     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00369 }
00370
00371 void ColorPickerProperties::OnIsHexInputVisiblePropertyChanged(
00372     winrt::DependencyObject const& sender,
00373     winrt::DependencyPropertyChangedEventArgs const& args)
00374 {
00375     auto owner = sender.as<winrt::ColorPicker>();
00376     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00377 }
00378
00379 void ColorPickerProperties::OnIsMoreButtonVisiblePropertyChanged(
00380     winrt::DependencyObject const& sender,
00381     winrt::DependencyPropertyChangedEventArgs const& args)
00382 {
00383     auto owner = sender.as<winrt::ColorPicker>();
00384     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00385 }
00386
00387 void ColorPickerProperties::OnMaxHuePropertyChanged(
00388     winrt::DependencyObject const& sender,
00389     winrt::DependencyPropertyChangedEventArgs const& args)
00390 {
00391     auto owner = sender.as<winrt::ColorPicker>();
00392     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00393 }
00394
00395 void ColorPickerProperties::OnMaxSaturationPropertyChanged(
00396     winrt::DependencyObject const& sender,
00397     winrt::DependencyPropertyChangedEventArgs const& args)
00398 {
00399     auto owner = sender.as<winrt::ColorPicker>();
00400     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00401 }
00402
00403 void ColorPickerProperties::OnMaxValuePropertyChanged(
00404     winrt::DependencyObject const& sender,
00405     winrt::DependencyPropertyChangedEventArgs const& args)
00406 {
00407     auto owner = sender.as<winrt::ColorPicker>();
00408     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00409 }
00410
00411 void ColorPickerProperties::OnMinHuePropertyChanged(
00412     winrt::DependencyObject const& sender,
00413     winrt::DependencyPropertyChangedEventArgs const& args)
00414 {
00415     auto owner = sender.as<winrt::ColorPicker>();
00416     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00417 }
00418
00419 void ColorPickerProperties::OnMinSaturationPropertyChanged(
00420     winrt::DependencyObject const& sender,
00421     winrt::DependencyPropertyChangedEventArgs const& args)
00422 {
00423     auto owner = sender.as<winrt::ColorPicker>();
00424     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00425 }
00426
00427 void ColorPickerProperties::OnMinValuePropertyChanged(
00428     winrt::DependencyObject const& sender,
00429     winrt::DependencyPropertyChangedEventArgs const& args)
00430 {
00431     auto owner = sender.as<winrt::ColorPicker>();
00432     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00433 }
00434
00435 void ColorPickerProperties::OnOrientationPropertyChanged(
00436     winrt::DependencyObject const& sender,
00437     winrt::DependencyPropertyChangedEventArgs const& args)
00438 {
00439     auto owner = sender.as<winrt::ColorPicker>();
00440     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00441 }
00442
00443 void ColorPickerProperties::OnPreviousColorPropertyChanged(
00444     winrt::DependencyObject const& sender,
00445     winrt::DependencyPropertyChangedEventArgs const& args)
00446 {
00447     auto owner = sender.as<winrt::ColorPicker>();
00448     winrt::get_self<ColorPicker>(owner)->OnPropertyChanged(args);
00449 }
00450
00451 void ColorPickerProperties::Color(winrt::Color const& value)
00452 {
00453     [[gsl::suppress(con)]]
00454     {
00455     static_cast<ColorPicker*>(this)->SetValue(s_ColorProperty, ValueHelper<winrt::Color>::BoxValueIfNecessary(value));
00456     }
00457 }
00458
00459 winrt::Color ColorPickerProperties::Color()
00460 {
00461     return ValueHelper<winrt::Color>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_ColorProperty));
00462 }
00463
00464 void ColorPickerProperties::ColorSpectrumComponents(winrt::ColorSpectrumComponents const& value)
00465 {
00466     [[gsl::suppress(con)]]
00467     {
00468     static_cast<ColorPicker*>(this)->SetValue(s_ColorSpectrumComponentsProperty, ValueHelper<winrt::ColorSpectrumComponents>::BoxValueIfNecessary(value));
00469     }
00470 }
00471
00472 winrt::ColorSpectrumComponents ColorPickerProperties::ColorSpectrumComponents()
00473 {
00474     return ValueHelper<winrt::ColorSpectrumComponents>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_ColorSpectrumComponentsProperty));
00475 }
00476
00477 void ColorPickerProperties::ColorSpectrumShape(winrt::ColorSpectrumShape const& value)
00478 {
00479     [[gsl::suppress(con)]]
00480     {
00481     static_cast<ColorPicker*>(this)->SetValue(s_ColorSpectrumShapeProperty, ValueHelper<winrt::ColorSpectrumShape>::BoxValueIfNecessary(value));
00482     }
00483 }
00484
00485 winrt::ColorSpectrumShape ColorPickerProperties::ColorSpectrumShape()
00486 {
00487     return ValueHelper<winrt::ColorSpectrumShape>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_ColorSpectrumShapeProperty));
00488 }
00489
00490 void ColorPickerProperties::IsAlphaEnabled(bool value)
00491 {
00492     [[gsl::suppress(con)]]
00493     {
00494     static_cast<ColorPicker*>(this)->SetValue(s_IsAlphaEnabledProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00495     }
00496 }
00497
00498 bool ColorPickerProperties::IsAlphaEnabled()
00499 {
00500     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsAlphaEnabledProperty));
00501 }
00502
00503 void ColorPickerProperties::IsAlphaSliderVisible(bool value)
00504 {
00505     [[gsl::suppress(con)]]
00506     {
00507     static_cast<ColorPicker*>(this)->SetValue(s_IsAlphaSliderVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00508     }
00509 }
00510
00511 bool ColorPickerProperties::IsAlphaSliderVisible()
00512 {
00513     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsAlphaSliderVisibleProperty));
00514 }
00515
00516 void ColorPickerProperties::IsAlphaTextInputVisible(bool value)
00517 {
00518     [[gsl::suppress(con)]]
00519     {
00520     static_cast<ColorPicker*>(this)->SetValue(s_IsAlphaTextInputVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00521     }
00522 }
00523
00524 bool ColorPickerProperties::IsAlphaTextInputVisible()
00525 {
00526     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsAlphaTextInputVisibleProperty));
00527 }
00528
00529 void ColorPickerProperties::IsColorChannelTextInputVisible(bool value)
00530 {
00531     [[gsl::suppress(con)]]
00532     {
00533     static_cast<ColorPicker*>(this)->SetValue(s_IsColorChannelTextInputVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00534     }
00535 }
00536
00537 bool ColorPickerProperties::IsColorChannelTextInputVisible()
00538 {
00539     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsColorChannelTextInputVisibleProperty));
00540 }
00541
00542 void ColorPickerProperties::IsColorPreviewVisible(bool value)
00543 {
00544     [[gsl::suppress(con)]]
00545     {
00546     static_cast<ColorPicker*>(this)->SetValue(s_IsColorPreviewVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00547     }
00548 }
00549
00550 bool ColorPickerProperties::IsColorPreviewVisible()
00551 {
00552     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsColorPreviewVisibleProperty));
00553 }
00554
00555 void ColorPickerProperties::IsColorSliderVisible(bool value)
00556 {
00557     [[gsl::suppress(con)]]
00558     {
00559     static_cast<ColorPicker*>(this)->SetValue(s_IsColorSliderVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00560     }
00561 }
00562
00563 bool ColorPickerProperties::IsColorSliderVisible()
00564 {
00565     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsColorSliderVisibleProperty));
00566 }
00567
00568 void ColorPickerProperties::IsColorSpectrumVisible(bool value)
00569 {
00570     [[gsl::suppress(con)]]
00571     {
00572     static_cast<ColorPicker*>(this)->SetValue(s_IsColorSpectrumVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00573     }
00574 }
00575
00576 bool ColorPickerProperties::IsColorSpectrumVisible()
00577 {
00578     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsColorSpectrumVisibleProperty));
00579 }
00580
00581 void ColorPickerProperties::IsHexInputVisible(bool value)
00582 {
00583     [[gsl::suppress(con)]]
00584     {
00585     static_cast<ColorPicker*>(this)->SetValue(s_IsHexInputVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00586     }
00587 }
00588
00589 bool ColorPickerProperties::IsHexInputVisible()
00590 {
00591     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsHexInputVisibleProperty));
00592 }
00593
00594 void ColorPickerProperties::IsMoreButtonVisible(bool value)
00595 {
00596     [[gsl::suppress(con)]]
00597     {
00598     static_cast<ColorPicker*>(this)->SetValue(s_IsMoreButtonVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00599     }
00600 }
00601
00602 bool ColorPickerProperties::IsMoreButtonVisible()
00603 {
00604     return ValueHelper<bool>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_IsMoreButtonVisibleProperty));
00605 }
00606
00607 void ColorPickerProperties::MaxHue(int value)
00608 {
00609     [[gsl::suppress(con)]]
00610     {
00611     static_cast<ColorPicker*>(this)->SetValue(s_MaxHueProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00612     }
00613 }
00614
00615 int ColorPickerProperties::MaxHue()
00616 {
00617     return ValueHelper<int>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_MaxHueProperty));
00618 }
00619
00620 void ColorPickerProperties::MaxSaturation(int value)
00621 {
00622     [[gsl::suppress(con)]]
00623     {
00624     static_cast<ColorPicker*>(this)->SetValue(s_MaxSaturationProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00625     }
00626 }
00627
00628 int ColorPickerProperties::MaxSaturation()
00629 {
00630     return ValueHelper<int>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_MaxSaturationProperty));
00631 }
00632
00633 void ColorPickerProperties::MaxValue(int value)
00634 {
00635     [[gsl::suppress(con)]]
00636     {
00637     static_cast<ColorPicker*>(this)->SetValue(s_MaxValueProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00638     }
00639 }
00640
00641 int ColorPickerProperties::MaxValue()
00642 {
00643     return ValueHelper<int>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_MaxValueProperty));
00644 }
00645
00646 void ColorPickerProperties::MinHue(int value)
00647 {
00648     [[gsl::suppress(con)]]
00649     {
00650     static_cast<ColorPicker*>(this)->SetValue(s_MinHueProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00651     }
00652 }
00653
00654 int ColorPickerProperties::MinHue()
00655 {
00656     return ValueHelper<int>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_MinHueProperty));
00657 }
00658
00659 void ColorPickerProperties::MinSaturation(int value)
00660 {
00661     [[gsl::suppress(con)]]
00662     {
00663     static_cast<ColorPicker*>(this)->SetValue(s_MinSaturationProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00664     }
00665 }
00666
00667 int ColorPickerProperties::MinSaturation()
00668 {
00669     return ValueHelper<int>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_MinSaturationProperty));
00670 }
00671
00672 void ColorPickerProperties::MinValue(int value)
00673 {
00674     [[gsl::suppress(con)]]
00675     {
00676     static_cast<ColorPicker*>(this)->SetValue(s_MinValueProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00677     }
00678 }
00679
00680 int ColorPickerProperties::MinValue()
00681 {
00682     return ValueHelper<int>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_MinValueProperty));
00683 }
00684
00685 void ColorPickerProperties::Orientation(winrt::Orientation const& value)
00686 {
00687     [[gsl::suppress(con)]]
00688     {
00689     static_cast<ColorPicker*>(this)->SetValue(s_OrientationProperty, ValueHelper<winrt::Orientation>::BoxValueIfNecessary(value));
00690     }
00691 }
00692
00693 winrt::Orientation ColorPickerProperties::Orientation()
00694 {
00695     return ValueHelper<winrt::Orientation>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_OrientationProperty));
00696 }
00697
00698 void ColorPickerProperties::PreviousColor(winrt::IReference<winrt::Color> const& value)
00699 {
00700     [[gsl::suppress(con)]]
00701     {
00702     static_cast<ColorPicker*>(this)->SetValue(s_PreviousColorProperty, ValueHelper<winrt::IReference<winrt::Color>>::BoxValueIfNecessary(value));
00703     }
00704 }
00705
00706 winrt::IReference<winrt::Color> ColorPickerProperties::PreviousColor()
00707 {
00708     return ValueHelper<winrt::IReference<winrt::Color>>::CastOrUnbox(static_cast<ColorPicker*>(this)->GetValue(s_PreviousColorProperty));
00709 }
00710
00711 winrt::event_token ColorPickerProperties::ColorChanged(winrt::TypedEventHandler<winrt::ColorPicker, winrt::ColorChangedEventArgs> const& value)
00712 {
00713     return m_colorChangedEventSource.add(value);
00714 }
00715
00716 void ColorPickerProperties::ColorChanged(winrt::event_token const& token)
00717 {
00718     m_colorChangedEventSource.remove(token);
00719 }
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IContrastEffect Member List

This is the complete list of members for IContrastEffect, including all inherited members.
ClampSource([out, retval] boolean *value) | IContrastEffect
ClampSource([in] boolean value) | IContrastEffect
Contrast([out, retval] float *value) | IContrastEffect
Contrast([in] float value) | IContrastEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | IContrastEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | IContrastEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/TestUI/RevealScenarioLights.xaml.cs Source File

  • Materials
  • Reveal
  • TestUI

RevealScenarioLights.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.IO;
00007 using System.Linq;
00008 using System.Numerics;
00009 using System.Runtime.InteropServices.WindowsRuntime;
00010 using Windows.Foundation;
00011 using Windows.Foundation.Collections;
00012 using Windows.UI;
00013 using Microsoft.UI.Composition;
00014 using Microsoft.UI.Xaml;
00015 using Microsoft.UI.Xaml.Controls;
00016 using Microsoft.UI.Xaml.Controls.Primitives;
00017 using Microsoft.UI.Xaml.Data;
00018 using Microsoft.UI.Xaml.Input;
00019 using Microsoft.UI.Xaml.Media;
00020 using Microsoft.UI.Xaml.Navigation;
00021 using Microsoft.UI.Private.Media;
00022
00023 namespace MUXControlsTestApp
00024 {
00025     public sealed partial class RevealScenarioLights : TestPage
00026     {
00027         public RevealScenarioLights()
00028         {
00029             this.InitializeComponent();
00030             _revealTest = new RevealTestApi { TargetTheme = CurrentTheme };
00031
00032             Compositor compositor = CompositionTarget.GetCompositorForCurrentThread();
00033             _backgroundLight = compositor.CreateSpotLight();
00034             _borderLight = compositor.CreateSpotLight();
00035             _borderWideLight = compositor.CreateSpotLight();
00036
00037             _borderLight.Offset = _borderWideLight.Offset =
00038             _backgroundLight.Offset = new Vector3((float)SwatchInnerGrid.Width / 2, (float)SwatchInnerGrid.Height / 2, 100);
00039
00040             ExprBind(_backgroundLight, _revealTest.BackgroundLight, "InnerConeAngle");
00041             ExprBind(_backgroundLight, _revealTest.BackgroundLight, "OuterConeAngle");
00042             ExprBind(_backgroundLight, _revealTest.BackgroundLight, "ConstantAttenuation");
00043             ExprBind(_backgroundLight, _revealTest.BackgroundLight, "InnerConeColor");
00044             ExprBind(_backgroundLight, _revealTest.BackgroundLight, "OuterConeColor");
00045
00046             SpotLight borderSpotlight = _revealTest.GetSpotLight(_revealTest.BorderLight as XamlLight);
00047             ExprBind(_borderLight, borderSpotlight, "InnerConeAngle");
00048             ExprBind(_borderLight, borderSpotlight, "OuterConeAngle");
00049             ExprBind(_borderLight, borderSpotlight, "ConstantAttenuation");
00050             ExprBind(_borderLight, borderSpotlight, "InnerConeColor");
00051             ExprBind(_borderLight, borderSpotlight, "OuterConeColor");
00052
00053             SpotLight borderWideSpotlight = _revealTest.GetSpotLight(_revealTest.BorderWideLight as XamlLight);
00054             ExprBind(_borderWideLight, borderWideSpotlight, "InnerConeAngle");
00055             ExprBind(_borderWideLight, borderWideSpotlight, "OuterConeAngle");
00056             ExprBind(_borderWideLight, borderWideSpotlight, "ConstantAttenuation");
00057             ExprBind(_borderWideLight, borderWideSpotlight, "InnerConeColor");
00058             ExprBind(_borderWideLight, borderWideSpotlight, "OuterConeColor");
00059         }
00060
00061         void ExprBind(CompositionObject target, CompositionObject source, string targetProperty, string sourceProperty = null)
00062         {
00063             if (sourceProperty == null) sourceProperty = targetProperty;
00064             var expr = target.Compositor.CreateExpressionAnimation(String.Format("source.{0}", sourceProperty));
00065             expr.SetReferenceParameter("source", source);
00066             target.StartAnimation(targetProperty, expr);
00067         }
00068
00069         private RevealTestApi _revealTest;
00070         private SpotLight _backgroundLight;
00071         private SpotLight _borderLight;
00072         private SpotLight _borderWideLight;
00073
00074         public RevealTestApi RevealTest
00075         {
00076             get { return _revealTest; }
00077         }
00078
00079         protected override void OnCurrentThemeChanged()
00080         {
00081             // Refresh the UI so the bindings re-resolve against current theme
00082             Frame.NavigateWithoutAnimation(GetType(), null);
00083             Frame.GoBack();
00084         }
00085
00086         // Animate so that we are consistent with MUX in hitting Bug 10979961:SpotLight.Inner/OuterConeAngleInDegrees return wrong value after animation completes.
00087         // When that's fixed we don't need to animate and don't need to multiply the cone angle below.
00088         void AnimateTo(CompositionObject obj, string prop, float value)
00089         {
00090             var anim = obj.Compositor.CreateScalarKeyFrameAnimation();
00091             anim.Duration = TimeSpan.FromMilliseconds(1);
00092             anim.InsertKeyFrame(1.0f, value);
00093             obj.StartAnimation(prop, anim);
00094         }
00095
00096         double SpotlightInnerConeValue
00097         {
00098             get { return _revealTest.BackgroundLight.InnerConeAngleInDegrees; }
00099             set { _revealTest.BackgroundLight.InnerConeAngleInDegrees = (float)value; }
00100         }
00101
00102         double SpotlightOuterConeValue
00103         {
00104             get { return _revealTest.BackgroundLight.OuterConeAngleInDegrees; }
00105             set { _revealTest.BackgroundLight.OuterConeAngleInDegrees = (float)value; }
00106         }
00107
00108         double SpotlightInnerConeAlphaValue
00109         {
00110             get { return _revealTest.BackgroundLight.InnerConeColor.A; }
00111             set { _revealTest.BackgroundLight.InnerConeColor = Microsoft.UI.ColorHelper.FromArgb((byte)value, (byte)value, (byte)value, (byte)value); }
00112         }
00113
00114         double SpotlightOuterConeAlphaValue
00115         {
00116             get { return _revealTest.BackgroundLight.OuterConeColor.A; }
00117             set { _revealTest.BackgroundLight.OuterConeColor = Microsoft.UI.ColorHelper.FromArgb((byte)value, (byte)value, (byte)value, (byte)value); }
00118         }
00119
00120         double SpotlightAttenuationValue
00121         {
00122             get { return _revealTest.BackgroundLight.ConstantAttenuation; }
00123             set { _revealTest.BackgroundLight.ConstantAttenuation = (float)value; }
00124         }
00125
00126         double SpotlightMinSizeValue
00127         {
00128             get { return _revealTest.BackgroundLightMinSize; }
00129             set { _revealTest.BackgroundLightMinSize = value; }
00130         }
00131
00132         double SpotlightMaxSizeValue
00133         {
00134             get { return _revealTest.BackgroundLightMaxSize; }
00135             set { _revealTest.BackgroundLightMaxSize = value; }
00136         }
00137
00138         double BorderSpotlightInnerConeValue
00139         {
00140             get { return _revealTest.GetSpotLight(_revealTest.BorderLight).InnerConeAngleInDegrees / 180 * Math.PI; }
00141             set { AnimateTo(_revealTest.GetSpotLight(_revealTest.BorderLight), "InnerConeAngleInDegrees", (float)value); }
00142         }
00143
00144         double BorderSpotlightOuterConeValue
00145         {
00146             get { return _revealTest.GetSpotLight(_revealTest.BorderLight).OuterConeAngleInDegrees / 180 * Math.PI; }
00147             set { AnimateTo(_revealTest.GetSpotLight(_revealTest.BorderLight), "OuterConeAngleInDegrees", (float)value); }
00148         }
00149
00150         double BorderSpotlightAttenuationValue
00151         {
00152             get { return _revealTest.GetSpotLight(_revealTest.BorderLight).ConstantAttenuation; }
00153             set { _revealTest.GetSpotLight(_revealTest.BorderLight).ConstantAttenuation = (float)value; }
00154         }
00155
00156         double WideBorderSpotlightInnerConeValue
00157         {
00158             get { return _revealTest.GetSpotLight(_revealTest.BorderWideLight).InnerConeAngleInDegrees / 180 * Math.PI; }
00159             set { AnimateTo(_revealTest.GetSpotLight(_revealTest.BorderWideLight), "InnerConeAngleInDegrees", (float)value); }
00160         }
00161
00162         double WideBorderSpotlightOuterConeValue
00163         {
00164             get { return _revealTest.GetSpotLight(_revealTest.BorderWideLight).OuterConeAngleInDegrees / 180 * Math.PI; }
00165             set { AnimateTo(_revealTest.GetSpotLight(_revealTest.BorderWideLight), "OuterConeAngleInDegrees", (float)value); }
00166         }
00167
00168         double WideBorderSpotlightAttenuationValue
00169         {
00170             get { return _revealTest.GetSpotLight(_revealTest.BorderWideLight).ConstantAttenuation; }
00171             set { _revealTest.GetSpotLight(_revealTest.BorderWideLight).ConstantAttenuation = (float)value; }
00172         }
00173     }
00174 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationView_InteractionTests/CommonTests.cs Source File

  • NavigationView
  • NavigationView_InteractionTests

CommonTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using System;
00006 using System.Collections.Generic;
00007 using System.Linq;
00008 using System.Threading.Tasks;
00009 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00010 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00011
00012 using WEX.TestExecution;
00013 using WEX.TestExecution.Markup;
00014 using WEX.Logging.Interop;
00015
00016 using Microsoft.Windows.Apps.Test.Automation;
00017 using Microsoft.Windows.Apps.Test.Foundation;
00018 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00019 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00020 using MUXTestInfra.Shared.Infra;
00021
00022 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.NavigationViewTests
00023 {
00024     [TestClass]
00025     public class CommonTests : NavigationViewTestsBase
00026     {
00027         [ClassInitialize]
00028         [TestProperty("RunAs", "User")]
00029         [TestProperty("Classification", "Integration")]
00030         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00031         [TestProperty("MUXControlsTestEnabledForPhone", "True")]
00032         [TestProperty("TestSuite", "A")]
00033         public static void ClassInitialize(TestContext testContext)
00034         {
00035             TestEnvironment.Initialize(testContext);
00036         }
00037
00038         [TestMethod]
00039         public void VerifyAxeScanPasses()
00040         {
00041             using (var setup = new TestSetupHelper("NavigationView-Axe"))
00042             {
00043                 AxeTestHelper.TestForAxeIssues();
00044             }
00045         }
00046
00047         [TestMethod]
00048         [TestProperty("TestSuite", "A")]
00049         public void DisplayModeTest()
00050         {
00051             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00052             foreach (var testScenario in testScenarios)
00053             {
00054                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00055                 {
00056                     TextBlock displayModeTextBox = new TextBlock(FindElement.ByName("DisplayModeTextBox"));
00057
00058                     // Tests with PaneDisplayMode='Auto', which enables adaptive layout.
00059
00060                     Log.Comment("Test the adaptive layout with the default Compact and Expanded mode Thresholds");
00061                     SetNavViewWidth(ControlWidth.Narrow);
00062                     Wait.ForIdle();
00063                     Verify.AreEqual(minimal, displayModeTextBox.DocumentText);
00064
00065                     SetNavViewWidth(ControlWidth.Medium);
00066                     Wait.ForIdle();
00067                     Verify.AreEqual(compact, displayModeTextBox.DocumentText);
00068
00069                     SetNavViewWidth(ControlWidth.Wide);
00070                     Wait.ForIdle();
00071                     Verify.AreEqual(expanded, displayModeTextBox.DocumentText);
00072
00073                     Log.Comment("Test adaptive layout when the compact mode threshold is larger than the expanded mode threshold");
00074                     SetThreshold(Threshold.High, ComboBoxName.CompactModeComboBox);
00075                     SetThreshold(Threshold.Low, ComboBoxName.ExpandedModeComboBox);
00076
00077                     SetNavViewWidth(ControlWidth.Narrow);
00078                     Wait.ForIdle();
00079                     Verify.AreEqual(minimal, displayModeTextBox.DocumentText);
00080
00081                     SetNavViewWidth(ControlWidth.Medium);
00082                     Wait.ForIdle();
00083                     Verify.AreEqual(expanded, displayModeTextBox.DocumentText);
00084
00085                     SetNavViewWidth(ControlWidth.Wide);
00086                     Wait.ForIdle();
00087                     Verify.AreEqual(expanded, displayModeTextBox.DocumentText);
00088
00089                     Log.Comment("Test adaptive layout when the compact mode threshold is equal to the expanded mode threshold");
00090                     SetThreshold(Threshold.Low, ComboBoxName.CompactModeComboBox);
00091                     SetThreshold(Threshold.Low, ComboBoxName.ExpandedModeComboBox);
00092
00093                     SetNavViewWidth(ControlWidth.Narrow);
00094                     Wait.ForIdle();
00095                     Verify.AreEqual(minimal, displayModeTextBox.DocumentText);
00096
00097                     SetNavViewWidth(ControlWidth.Medium);
00098                     Wait.ForIdle();
00099                     Verify.AreEqual(expanded, displayModeTextBox.DocumentText);
00100                 }
00101             }
00102         }
00103
00104         [TestMethod]
00105         [TestProperty("TestSuite", "A")]
00106         public void IsSettingsVisibleTest()
00107         {
00108             var testScenarios = RegressionTestScenario.BuildAllRegressionTestScenarios();
00109             foreach (var testScenario in testScenarios)
00110             {
00111                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00112                 {
00113                     Log.Comment("Verify that settings item is enabled by default");
00114                     VerifyElement.Found("Settings", FindBy.Name);
00115
00116                     CheckBox settingsCheckbox = new CheckBox(FindElement.ByName("SettingsItemVisibilityCheckbox"));
00117
00118                     Log.Comment("Verify that settings item is not visible when IsSettingsVisible == false");
00119                     settingsCheckbox.Uncheck();
00120                     ElementCache.Clear();
00121                     Wait.ForIdle();
00122                     VerifyElement.NotFound("Settings", FindBy.Name);
00123
00124                     Log.Comment("Verify that settings item is visible when IsSettingsVisible == true");
00125                     settingsCheckbox.Check();
00126                     Wait.ForIdle();
00127                     VerifyElement.Found("Settings", FindBy.Name);
00128                 }
00129             }
00130         }
00131
00132         [TestMethod]
00133         [TestProperty("TestSuite", "A")]
00134         public void IsPaneToggleButtonVisibleTest()
00135         {
00136             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00137             foreach (var testScenario in testScenarios)
00138             {
00139                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00140                 {
00141                     Log.Comment("Verify that toggle button item is enabled by default");
00142                     VerifyElement.Found("TogglePaneButton", FindBy.Id);
00143
00144                     CheckBox toggleCheckbox = new CheckBox(FindElement.ByName("PaneToggleButtonVisiblityCheckbox"));
00145
00146                     Log.Comment("Verify that toggle button is not visible when IsPaneToggleButtonVisible == false");
00147                     toggleCheckbox.Uncheck();
00148                     Wait.ForIdle();
00149                     VerifyElement.NotFound("TogglePaneButton", FindBy.Id);
00150
00151                     Log.Comment("Verify that settings item is visible when IsSettingsVisible == true");
00152                     toggleCheckbox.Check();
00153                     Wait.ForIdle();
00154                     VerifyElement.Found("SettingsItem", FindBy.Id);
00155                 }
00156             }
00157         }
00158
00159         [TestMethod]
00160         [TestProperty("TestSuite", "A")]
00161         public void AlwaysShowHeaderTest()
00162         {
00163             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00164             foreach (var testScenario in testScenarios)
00165             {
00166                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00167                 {
00168                     Log.Comment("Verify that header is visible by default");
00169                     VerifyElement.Found("Home as header", FindBy.Name);
00170
00171                     CheckBox headerVisibilityCheckbox = new CheckBox(FindElement.ByName("HeaderVisiblityCheckbox"));
00172
00173                     Log.Comment("Verify that header is not visible in display mode expanded when AlwaysShowHeader == false");
00174                     headerVisibilityCheckbox.Uncheck();
00175                     Wait.ForIdle();
00176                     VerifyElement.NotFound("Home as header", FindBy.Name);
00177
00178                     Log.Comment("Verify that header is visible in display mode minimal when AlwaysShowHeader == false");
00179                     SetNavViewWidth(ControlWidth.Narrow);
00180                     Wait.ForIdle();
00181                     VerifyElement.Found("Home as header", FindBy.Name);
00182
00183                     Log.Comment("Verify that header is not visible in display mode compact when AlwaysShowHeader == false");
00184                     SetNavViewWidth(ControlWidth.Medium);
00185                     Wait.ForIdle();
00186                     VerifyElement.NotFound("Home as header", FindBy.Name);
00187
00188                     Log.Comment("Verify that header is visible in display mode compact when AlwaysShowHeader == true");
00189                     headerVisibilityCheckbox.Check();
00190                     Wait.ForIdle();
00191                     VerifyElement.Found("Home as header", FindBy.Name);
00192
00193                     // PaneDisplayMode and Top option were added on RS5, so just run the next tests if we are not using RS4 Style
00194                     if (!testScenario.IsUsingRS4Style)
00195                     {
00196                         var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox"));
00197                         Log.Comment("Set PaneDisplayMode to Top");
00198                         panelDisplayModeComboBox.SelectItemByName("Top");
00199                         Wait.ForIdle();
00200
00201                         Log.Comment("Verify that header is visible in Top display mode when AlwaysShowHeader == true");
00202                         VerifyElement.Found("Home as header", FindBy.Name);
00203
00204                         Log.Comment("Verify that header is not visible in Top display mode when AlwaysShowHeader == false");
00205                         headerVisibilityCheckbox.Uncheck();
00206                         Wait.ForIdle();
00207                         VerifyElement.NotFound("Home as header", FindBy.Name);
00208                     }
00209                 }
00210             }
00211         }
00212
00213         [TestMethod]
00214         [TestProperty("TestSuite", "A")]
00215         public void AddRemoveItemTest()
00216         {
00217             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00218             foreach (var testScenario in testScenarios)
00219             {
00220                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00221                 {
00222                     var addButton = FindElement.ById<Button>("AddItemButton");
00223                     var removeButton = FindElement.ById<Button>("RemoveItemButton");
00224
00225                     Log.Comment("Verify that menu items can be added");
00226                     addButton.Invoke();
00227                     Wait.ForIdle();
00228                     VerifyElement.Found("New Menu Item 0", FindBy.Name);
00229
00230                     Log.Comment("Verify that more menu items can be added");
00231                     addButton.Invoke();
00232                     Wait.ForIdle();
00233                     VerifyElement.Found("New Menu Item 1", FindBy.Name);
00234
00235                     Log.Comment("Verify that menu items can be removed");
00236                     removeButton.Invoke();
00237                     Wait.ForIdle();
00238                     VerifyElement.NotFound("New Menu Item 1", FindBy.Name);
00239                     VerifyElement.Found("New Menu Item 0", FindBy.Name);
00240
00241                     Log.Comment("Verify that more menu items can be removed");
00242                     removeButton.Invoke();
00243                     Wait.ForIdle();
00244                     VerifyElement.NotFound("New Menu Item 0", FindBy.Name);
00245                 }
00246             }
00247         }
00248
00249         [TestMethod]
00250         [TestProperty("TestSuite", "A")]
00251         public void AddRemoveOriginalItemTest()
00252         {
00253             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00254             foreach (var testScenario in testScenarios)
00255             {
00256                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00257                 {
00258                     var addButton = FindElement.ById<Button>("AddItemButton");
00259                     var removeButton = FindElement.ById<Button>("RemoveItemButton");
00260
00261                     Log.Comment("Verify that original menu items can be removed");
00262                     removeButton.Invoke();
00263                     Wait.ForIdle();
00264                     VerifyElement.NotFound("HasChildItem", FindBy.Name);
00265
00266                     Log.Comment("Verify that menu items can be added after removing");
00267                     addButton.Invoke();
00268                     Wait.ForIdle();
00269                     VerifyElement.Found("New Menu Item 0", FindBy.Name);
00270                 }
00271             }
00272         }
00273
00274         [TestMethod]
00275         [TestProperty("TestSuite", "A")]
00276         public void AddRemoveFooterItemTest()
00277         {
00278             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00279             foreach (var testScenario in testScenarios)
00280             {
00281                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00282                 {
00283                     var addButton = FindElement.ById<Button>("AddFooterItemButton");
00284                     var removeButton = FindElement.ById<Button>("RemoveFooterItemButton");
00285
00286                     Log.Comment("Verify that footer menu items can be added");
00287                     addButton.Invoke();
00288                     Wait.ForIdle();
00289                     VerifyElement.Found("New Footer Menu Item 0", FindBy.Name);
00290
00291                     Log.Comment("Verify that more footer menu items can be added");
00292                     addButton.Invoke();
00293                     Wait.ForIdle();
00294                     VerifyElement.Found("New Footer Menu Item 1", FindBy.Name);
00295
00296                     Log.Comment("Verify that footer menu items can be removed");
00297                     removeButton.Invoke();
00298                     Wait.ForIdle();
00299                     VerifyElement.NotFound("New Footer Menu Item 1", FindBy.Name);
00300                     VerifyElement.Found("New Footer Menu Item 0", FindBy.Name);
00301
00302                     Log.Comment("Verify that more Footer menu items can be removed");
00303                     removeButton.Invoke();
00304                     Wait.ForIdle();
00305                     VerifyElement.NotFound("New Menu Item 0", FindBy.Name);
00306                 }
00307             }
00308         }
00309
00310         [TestMethod]
00311         [TestProperty("TestSuite", "A")]
00312         public void ItemSourceTest()
00313         {
00314             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Init Test" }))
00315             {
00316                 var addButton = FindElement.ByName<Button>("AddItemButton");
00317                 var removeButton = FindElement.ByName<Button>("RemoveItemButton");
00318
00319                 var addFooterButton = FindElement.ByName<Button>("AddFooterItemButton");
00320                 var removeFooterButton = FindElement.ByName<Button>("RemoveFooterItemButton");
00321
00322                 Log.Comment("Verify that the MenuItemsSource was loaded and is selected");
00323                 UIObject item1 = FindElement.ByName("Menu Item 1");
00324                 Verify.IsNotNull(item1);
00325                 Verify.IsTrue(Convert.ToBoolean(item1.GetProperty(UIProperty.Get("SelectionItem.IsSelected"))));
00326
00327                 Log.Comment("Verify that menu items added to MenuItemsSource appear in the list");
00328                 addButton.Invoke();
00329                 Wait.ForIdle();
00330                 VerifyElement.Found("New Menu Item", FindBy.Name);
00331
00332                 Log.Comment("Verify that menu items removed from MenuItemsSource disappear from the list");
00333                 removeButton.Invoke();
00334                 Wait.ForIdle();
00335                 VerifyElement.NotFound("New Menu Item", FindBy.Name);
00336
00337                 Log.Comment("Verify that footer menu items added to FooterMenuItemsSource appear in the list");
00338                 addFooterButton.Invoke();
00339                 Wait.ForIdle();
00340                 VerifyElement.Found("New Footer Item", FindBy.Name);
00341
00342                 Log.Comment("Verify that footer menu items removed from FooterMenuItemsSource disappear from the list");
00343                 removeFooterButton.Invoke();
00344                 Wait.ForIdle();
00345                 VerifyElement.NotFound("New Footer Item", FindBy.Name);
00346             }
00347         }
00348
00349
00350         [TestMethod]
00351         [TestProperty("TestSuite", "A")]
00352         public void DisabledItemTest()
00353         {
00354             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00355             foreach (var testScenario in testScenarios)
00356             {
00357                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00358                 {
00359                     UIObject moviesItem = FindElement.ByName("Movies");
00360                     CheckBox moviesEnabledCheckbox = new CheckBox(FindElement.ByName("MoviesEnabledCheckbox"));
00361
00362                     Log.Comment("Verify that Movies item is enabled");
00363                     Verify.IsTrue(moviesItem.IsEnabled);
00364
00365                     Log.Comment("Uncheck checkbox to disable Movies item");
00366                     moviesEnabledCheckbox.Uncheck();
00367                     Wait.ForIdle();
00368
00369                     Log.Comment("Verify that Movies item is disabled");
00370                     Verify.IsFalse(moviesItem.IsEnabled);
00371
00372                     Log.Comment("Check checkbox to enable Movies item");
00373                     moviesEnabledCheckbox.Check();
00374                     Wait.ForIdle();
00375
00376                     Log.Comment("Verify that Movies item is enabled");
00377                     Verify.IsTrue(moviesItem.IsEnabled);
00378                 }
00379             }
00380         }
00381
00382         [TestMethod]
00383         [TestProperty("TestSuite", "A")]
00384         public void AutoSuggestBoxTest()
00385         {
00386             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00387             foreach (var testScenario in testScenarios)
00388             {
00389                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00390                 {
00391                     SetNavViewWidth(ControlWidth.Wide);
00392                     Wait.ForIdle();
00393
00394                     Log.Comment("Verify that the AutoSuggestBox is visible and the search button is not in Expanded mode");
00395                     VerifyElement.Found("PaneAutoSuggestBox", FindBy.Name);
00396                     VerifyElement.NotFound("Click to search", FindBy.Name);
00397
00398                     SetNavViewWidth(ControlWidth.Medium);
00399                     Wait.ForIdle();
00400
00401                     Log.Comment("Verify that the AutoSuggestBox is not visible and the search button is in Compact mode with the pane closed");
00402                     VerifyElement.NotFound("PaneAutoSuggestBox", FindBy.Name);
00403                     Button searchButton = new Button(FindElement.ByName("Click to search"));
00404                     Verify.IsNotNull(searchButton);
00405
00406                     Log.Comment("Verify that invoking the search button opens the pane and put focus in the AutoSuggestBox");
00407                     CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox"));
00408                     Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False");
00409
00410                     searchButton.Invoke();
00411                     Wait.ForIdle();
00412
00413                     Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True");
00414
00415                     // AutoSuggestBox never gets keyboard focus itself; focus goes to the edit box inside it
00416                     UIObject autoSuggestEditBox = FindElement.ByNameAndClassName("PaneAutoSuggestBox", "TextBox");
00417                     Verify.IsNotNull(autoSuggestEditBox);
00418                     Verify.IsTrue(autoSuggestEditBox.HasKeyboardFocus);
00419
00420                     Log.Comment("Verify that setting AutoSuggestBox to null removes it and the search button");
00421                     CheckBox autoSuggestCheckBox = new CheckBox(FindElement.ByName("AutoSuggestCheckbox"));
00422                     autoSuggestCheckBox.Uncheck();
00423                     Wait.ForIdle();
00424
00425                     VerifyElement.NotFound("PaneAutoSuggestBox", FindBy.Name);
00426                     VerifyElement.NotFound("Click to search", FindBy.Name);
00427
00428                     Log.Comment("Verify that setting AutoSuggestBox puts it back");
00429                     autoSuggestCheckBox.Check();
00430                     Wait.ForIdle();
00431
00432                     VerifyElement.Found("PaneAutoSuggestBox", FindBy.Name);
00433                 }
00434             }
00435         }
00436
00437         [TestMethod]
00438         [TestProperty("TestSuite", "A")]
00439         public void AutoSuggestBoxOnTopNavTest()
00440         {
00441             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView TopNav Test" }))
00442             {
00443                 ElementCache.Refresh();
00444                 ElementCache.Dump();
00445                 Log.Comment("Verify that the AutoSuggestBox is visible by default");
00446                 VerifyElement.Found("PaneAutoSuggestBox", FindBy.Name);
00447
00448                 Log.Comment("Verify that setting AutoSuggestBox to null removes it and the search button");
00449                 CheckBox autoSuggestCheckBox = new CheckBox(FindElement.ByName("AutoSuggestCheckbox"));
00450                 autoSuggestCheckBox.Uncheck();
00451                 Wait.ForIdle();
00452
00453                 VerifyElement.NotFound("PaneAutoSuggestBox", FindBy.Name);
00454
00455                 Log.Comment("Verify that setting AutoSuggestBox puts it back");
00456                 autoSuggestCheckBox.Check();
00457                 Wait.ForIdle();
00458
00459                 VerifyElement.Found("PaneAutoSuggestBox", FindBy.Name);
00460             }
00461         }
00462
00463         [TestMethod] //bug 17792706
00464         [TestProperty("TestSuite", "A")]
00465         public void BackButtonPlaceHolderOnTopNavTest()
00466         {
00467             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" }))
00468             {
00469                 var getActiveVisualStateButton = new Button(FindElement.ByName("GetActiveVisualState"));
00470                 var invokeResult = new Edit(FindElement.ById("TestResult"));
00471                 using (var waiter = new ValueChangedEventWaiter(invokeResult))
00472                 {
00473                     getActiveVisualStateButton.Click();
00474                     waiter.Wait();
00475                 }
00476
00477                 Verify.IsTrue(invokeResult.Value.Contains("BackButtonVisible"));
00478
00479                 Log.Comment("Hide backbutton");
00480                 var backButtonCheckBox = new CheckBox(FindElement.ByName("BackButtonVisibilityCheckbox"));
00481
00482                 backButtonCheckBox.Uncheck();
00483                 Wait.ForIdle();
00484
00485                 using (var waiter = new ValueChangedEventWaiter(invokeResult))
00486                 {
00487                     getActiveVisualStateButton.Click();
00488                     waiter.Wait();
00489                 }
00490
00491                 Verify.IsTrue(invokeResult.Value.Contains("BackButtonCollapsed"));
00492
00493                 Log.Comment("Show backbutton");
00494                 backButtonCheckBox.Check();
00495                 Wait.ForIdle();
00496
00497                 using (var waiter = new ValueChangedEventWaiter(invokeResult))
00498                 {
00499                     getActiveVisualStateButton.Click();
00500                     waiter.Wait();
00501                 }
00502                 Verify.IsTrue(invokeResult.Value.Contains("BackButtonVisible"));
00503             }
00504         }
00505
00506         [TestMethod]
00507         [TestProperty("TestSuite", "B")]
00508         public void NavigationViewDensityChange()
00509         {
00510             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
00511             {
00512                 int height = FindElement.ById("AppsItem").BoundingRectangle.Height;
00513                 Verify.AreEqual(height, 36);
00514             }
00515         }
00516
00517         [TestMethod]
00518         [TestProperty("Ignore", "True")] // Disabled as per tracking issue #3125 and internal issue 18650478
00519         [TestProperty("TestSuite", "B")]
00520         public void TitleBarTest()
00521         {
00522             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00523             foreach (var testScenario in testScenarios)
00524             {
00525                 using (IDisposable page1 = new TestSetupHelper("NavigationView Tests"),
00526                     page2 = new TestSetupHelper(testScenario.TestPageName))
00527                 {
00528                     CheckBox titleBarCheckbox = new CheckBox(FindElement.ByName("TitleBarCheckbox"));
00529                     CheckBox testFrameCheckbox = new CheckBox(FindElement.ByName("TestFrameCheckbox"));
00530                     Button navButton = new Button(FindElement.ById("TogglePaneButton"));
00531                     Button backButton = new Button(FindElement.ByName("NavigationViewBackButton"));
00532                     Button fullScreenButton = new Button(FindElement.ById("FullScreenInvokerButton"));
00533
00534                     int testFrameBarHeight = FindElement.ById("__BackButton").BoundingRectangle.Height;
00535
00536                     // The title bar is a peer of the CoreWindow, so we have to search one level up.
00537                     UIObject titleBar;
00538                     TestEnvironment.Application.CoreWindow.Parent.Descendants.TryFind(UICondition.CreateFromClassName("ApplicationFrameTitleBarWindow"), out titleBar);
00539                     int titleBarHeight = titleBar.BoundingRectangle.Height;
00540
00541                     double backButtonSpace = backButton.BoundingRectangle.Height;
00542
00543                     int tabbedShellAffordance = 0;
00544
00545                     if (TestHelpers.SystemTabbedShellIsEnabled)
00546                     {
00547                         titleBarHeight = 0;
00548                         tabbedShellAffordance = testFrameBarHeight;
00549                         Log.Comment("Tabbed shell is enabled, adjusting expectations...");
00550                     }
00551
00552                     Log.Comment("Test scenario: Standard NavView control.");
00553                     Log.Comment("Verify that the toggle button y = height of title bar + height of test frame bar + spacing of back button");
00554                     Verify.AreEqual(testFrameBarHeight + titleBarHeight + backButtonSpace + tabbedShellAffordance, navButton.BoundingRectangle.Y);
00555
00556                     Log.Comment("Test scenario: ExtendViewIntoTitleBar:");
00557                     titleBarCheckbox.Uncheck();
00558                     Wait.ForIdle();
00559
00560                     Log.Comment("Verify that the toggle button y = height of test frame bar + back button spacing");
00561
00562                     TestEnvironment.VerifyAreEqualWithRetry(20,
00563                         () => (int)(testFrameBarHeight + backButtonSpace + tabbedShellAffordance),
00564                         () => (int)(navButton.BoundingRectangle.Y));
00565
00566
00567                     Log.Comment("Test scenario: Hide TestFrame:");
00568                     titleBarCheckbox.Check();
00569                     testFrameCheckbox.Uncheck();
00570                     Wait.ForIdle();
00571
00572                     Log.Comment("Verify that the toggle button y = height of title bar + back button spacing");
00573                     Verify.AreEqual(titleBarHeight + backButtonSpace + tabbedShellAffordance, navButton.BoundingRectangle.Y);
00574
00575
00576                     Log.Comment("Test scenario: Hide TestFrame and ExtendViewIntoTitleBar:");
00577                     titleBarCheckbox.Uncheck();
00578                     Wait.ForIdle();
00579
00580                     if (!testScenario.IsUsingRS4Style)
00581                     {
00582                         // If we extend the backbutton to titlebar area, the button is not clickable. so the new implementation keeps backbutton not in titlebar area.
00583                         Log.Comment("Verify that the toggle button y = height of title bar + back button spacing");
00584                         Verify.AreEqual(titleBarHeight + backButtonSpace + tabbedShellAffordance, navButton.BoundingRectangle.Y);
00585                     }
00586                     else
00587                     {
00588                         // To maintain back compat we maintain RS4 behavior when using the RS4 style:
00589                         Log.Comment("Verify that the toggle button y = back button spacing");
00590                         Verify.AreEqual(backButtonSpace + tabbedShellAffordance, navButton.BoundingRectangle.Y);
00591                     }
00592
00593                     Log.Comment("Test scenario: Fullscreen mode:");
00594                     Log.Comment("Invoking fullscreen button:");
00595                     fullScreenButton.Invoke();
00596                     Wait.ForIdle();
00597
00598                     TestEnvironment.VerifyAreEqualWithRetry(20,
00599                         () => 0,
00600                         () => backButton.BoundingRectangle.Y);
00601                     Log.Comment("Verify that the toggle button y = back button spacing");
00602                     Verify.AreEqual(backButtonSpace + tabbedShellAffordance, navButton.BoundingRectangle.Y);
00603
00604
00605                     fullScreenButton.Invoke();
00606                     Wait.ForIdle();
00607                     titleBarCheckbox.Check();
00608                     testFrameCheckbox.Check();
00609                 }
00610             }
00611         }
00612
00613         [TestMethod]
00614         [TestProperty("TestSuite", "B")]
00615         public void VerifyBackButtonHidesWhenInMinimalOpenState()
00616         {
00617             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00618             foreach (var testScenario in testScenarios)
00619             {
00620                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00621                 {
00622                     TextBlock displayModeTextBox = new TextBlock(FindElement.ByName("DisplayModeTextBox"));
00623
00624                     Log.Comment("Test the adaptive layout with the default Compact and Expanded mode Thresholds");
00625                     SetNavViewWidth(ControlWidth.Narrow);
00626                     Wait.ForIdle();
00627                     Verify.AreEqual(minimal, displayModeTextBox.DocumentText);
00628
00629                     CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox"));
00630                     isPaneOpenCheckBox.Check();
00631                     Wait.ForIdle();
00632
00633                     VerifyElement.NotFound("NavigationViewBackButton", FindBy.Name);
00634                 }
00635             }
00636         }
00637
00638         [TestMethod]
00639         [TestProperty("TestSuite", "B")]
00640         [TestProperty("Ignore", "True")] // Disabling test as Reveal style is being deprecated
00641         public void LeftNavigationFocusKindRevealTest()
00642         {
00643             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
00644             {
00645                 Log.Comment("Invoke button GetHomeItemRevealVisualState");
00646                 Button getHomeItemRevealVisualState = new Button(FindElement.ByName("GetHomeItemRevealVisualState"));
00647                 getHomeItemRevealVisualState.Invoke();
00648                 Wait.ForIdle();
00649
00650                 Log.Comment("Verify No OnLeftNavigationReveal visualstate");
00651                 var state = TryFindElement.ById("OnLeftNavigationRevealVisualState");
00652                 Verify.AreEqual("False", state.GetText());
00653
00654                 Log.Comment("Change FocusVisualKind to Reveal");
00655                 Button changeFocusVisualKind = new Button(FindElement.ByName("ChangeFocusVisualKind"));
00656                 changeFocusVisualKind.Invoke();
00657                 Wait.ForIdle();
00658
00659                 Log.Comment("Invoke button GetHomeItemRevealVisualState");
00660                 getHomeItemRevealVisualState.Invoke();
00661                 Wait.ForIdle();
00662                 // changing FocusVisualKind impacts others test cases, and we need to change it back immediately.
00663                 // So recover it to default before verify state1 visualstate
00664                 var state1 = state.GetText();
00665
00666                 Log.Comment("Change FocusVisualKind to default");
00667                 changeFocusVisualKind.Invoke();
00668                 Wait.ForIdle();
00669
00670                 Log.Comment("Invoke button GetHomeItemRevealVisualState");
00671                 getHomeItemRevealVisualState.Invoke();
00672                 Wait.ForIdle();
00673                 var state2 = state.GetText();
00674
00675                 Verify.AreEqual("True", state1, "There is OnLeftNavigationReveal visualstate");
00676                 Verify.AreEqual("False", state2, "No OnLeftNavigationReveal visualstate");
00677             }
00678         }
00679
00680
00681         [TestMethod]
00682         [TestProperty("TestSuite", "B")]
00683         public void ContentOverlayTest()
00684         {
00685             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" }))
00686             {
00687                 var topNavAutomationId = "TopNavMenuItemsHost";
00688                 var contentOverlayName = "CONTENT OVERLAY";
00689                 var addRemoveContentOverlayButton = new Button(FindElement.ById("AddRemoveContentOverlay"));
00690                 var changeTopNavVisibilityButton = new Button(FindElement.ById("ChangeTopNavVisibility"));
00691
00692                 Log.Comment("Verify that after NavView loads, the top nav is visible and that there is no content overlay");
00693                 VerifyElement.Found(topNavAutomationId, FindBy.Id);
00694                 VerifyElement.NotFound(contentOverlayName, FindBy.Name);
00695
00696                 addRemoveContentOverlayButton.Click();
00697                 Wait.ForIdle();
00698
00699                 Log.Comment("Verify that after content overlay is added, the top nav is visible and the content overlay too");
00700                 VerifyElement.Found(topNavAutomationId, FindBy.Id);
00701                 VerifyElement.Found(contentOverlayName, FindBy.Name);
00702
00703                 changeTopNavVisibilityButton.Click();
00704                 Wait.ForIdle();
00705
00706                 Log.Comment("Verify that after setting IsPaneVisible to false, the top nav is hidden and the content overlay is still visible");
00707                 VerifyElement.NotFound(topNavAutomationId, FindBy.Id);
00708                 VerifyElement.Found(contentOverlayName, FindBy.Name);
00709
00710                 changeTopNavVisibilityButton.Click();
00711                 Wait.ForIdle();
00712
00713                 Log.Comment("Verify that after setting IsPaneVisible to true, the top nav is visible and the content overlay remains visible");
00714                 VerifyElement.Found(topNavAutomationId, FindBy.Id);
00715                 VerifyElement.Found(contentOverlayName, FindBy.Name);
00716             }
00717         }
00718
00719         [TestMethod]
00720         [TestProperty("TestSuite", "B")]
00721         public void LeftNavigationWithAccessKeysTest()
00722         {
00723             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00724             foreach (var testScenario in testScenarios)
00725             {
00726                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00727                 {
00728                     Log.Comment("Set control to compact");
00729                     SetNavViewWidth(ControlWidth.Medium);
00730                     Wait.ForIdle();
00731
00732                     CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox"));
00733
00734                     Log.Comment("Verify that the pane is closed");
00735                     TestEnvironment.VerifyAreEqualWithRetry(20,
00736                         () => ToggleState.Off,
00737                         () => isPaneOpenCheckBox.ToggleState,
00738                         () =>
00739                         {
00740                             Task.Delay(TimeSpan.FromMilliseconds(100)).Wait(); // UIA's state isn't updating immediately. Wait a sec.
00741                             ElementCache.Clear(); /* Test is flaky sometimes -- perhaps element cache is stale? Clear it and try again. */
00742                         });
00743
00744                     InvokeNavigationViewAccessKeyAndVerifyKeyTipPlacement("TogglePaneButton");
00745
00746                     Log.Comment("Verify that the pane is open");
00747                     Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True");
00748                 }
00749             }
00750         }
00751
00752         [TestMethod]
00753         [TestProperty("TestSuite", "B")]
00754         public void MenuItemKeyboardInvokeTest()
00755         {
00756             // On RS2 scrollviewer handles arrow keys and this causes an issue with the current setup of the "NavigationView Test" test page
00757             // used for the left NavigationView test. So instead we now execute this test on the "NavigationView Regression Test" test page for
00758             // left navigation.
00759             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Regression Test" }))
00760             {
00761                 Log.Comment("Verify the first menu item has focus and is selected");
00762                 UIObject firstItem = FindElement.ByName("Home");
00763                 firstItem.SetFocus();
00764                 Verify.IsTrue(firstItem.HasKeyboardFocus);
00765                 Verify.IsTrue(Convert.ToBoolean(firstItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected"))));
00766
00767                 Log.Comment("Move focus to the second menu item by pressing down arrow");
00768                 KeyboardHelper.PressKey(Key.Down);
00769                 Wait.ForIdle();
00770
00771                 Log.Comment("Verify second menu item has focus but is not selected");
00772                 UIObject secondItem = FindElement.ByName("Apps");
00773                 Verify.IsTrue(secondItem.HasKeyboardFocus);
00774                 Verify.IsFalse(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected"))));
00775
00776                 Log.Comment("Select the second item by pressing enter");
00777                 KeyboardHelper.PressKey(Key.Enter);
00778                 Wait.ForIdle();
00779                 Verify.IsTrue(Convert.ToBoolean(secondItem.GetProperty(UIProperty.Get("SelectionItem.IsSelected"))));
00780             }
00781         }
00782
00783         [TestMethod]
00784         [TestProperty("TestSuite", "B")]
00785         public void SettingsAccessibilitySetTest()
00786         {
00787             var testScenarios = RegressionTestScenario.BuildAllRegressionTestScenarios();
00788             foreach (var testScenario in testScenarios)
00789             {
00790                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00791                 {
00792                     Log.Comment("Setting focus to Settings");
00793                     UIObject settingsItem = FindElement.ByName("Settings");
00794                     settingsItem.SetFocus();
00795                     Wait.ForIdle();
00796
00797                     AutomationElement ae = AutomationElement.FocusedElement;
00798                     int positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00799                     int sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00800
00801                     Verify.AreEqual(1, positionInSet, "Position in set");
00802                     Verify.AreEqual(1, sizeOfSet, "Size of set");
00803
00804                     var addButton = FindElement.ById<Button>("AddFooterItemButton");
00805                     var removeButton = FindElement.ById<Button>("RemoveFooterItemButton");
00806
00807                     addButton.Invoke();
00808                     addButton.Invoke();
00809                     Wait.ForIdle();
00810
00811                     positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00812                     sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00813
00814                     Verify.AreEqual(3, positionInSet, "Position in set");
00815                     Verify.AreEqual(3, sizeOfSet, "Size of set");
00816
00817                     removeButton.Invoke();
00818                     removeButton.Invoke();
00819                 }
00820             }
00821         }
00822
00823         [TestMethod]
00824         [TestProperty("TestSuite", "B")]
00825         public void ItemsAccessibilitySetTest()
00826         {
00827             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00828             foreach (var testScenario in testScenarios)
00829             {
00830                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00831                 {
00832                     Log.Comment("Setting focus to Games");
00833                     UIObject gamesItem = FindElement.ByName("Games");
00834                     gamesItem.SetFocus();
00835                     Wait.ForIdle();
00836
00837                     AutomationElement ae = AutomationElement.FocusedElement;
00838                     int positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00839                     int sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00840
00841                     Verify.AreEqual(3, positionInSet, "Position in set");
00842                     Verify.AreEqual(3, sizeOfSet, "Size of set");
00843
00844                     Log.Comment("Setting focus to Movies");
00845                     UIObject moviesItem = FindElement.ByName("Movies");
00846                     moviesItem.SetFocus();
00847                     Wait.ForIdle();
00848
00849                     ae = AutomationElement.FocusedElement;
00850                     positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00851                     sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00852
00853                     Verify.AreEqual(2, positionInSet, "Position in set, not including separator/header");
00854                     Verify.AreEqual(2, sizeOfSet, "Size of set");
00855
00856                     Log.Comment("Setting focus to HasChildItem");
00857                     UIObject hasChildItem = FindElement.ByName("HasChildItem");
00858                     hasChildItem.SetFocus();
00859                     Wait.ForIdle();
00860
00861                     ae = AutomationElement.FocusedElement;
00862                     positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00863                     sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00864
00865                     Verify.AreEqual(5, positionInSet, "Position in set, not including separator/header");
00866                     Verify.AreEqual(5, sizeOfSet, "Size of set");
00867                 }
00868             }
00869         }
00870
00871         [TestMethod]
00872         [TestProperty("TestSuite", "B")]
00873         public void HierarchyItemsAccessibilitySetAndLevelTest()
00874         {
00875             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "HierarchicalNavigationView Markup Test" }))
00876             {
00877                 Log.Comment("Setting focus to Menu Item 15");
00878                 UIObject menuItem15 = FindElement.ByName("Menu Item 15");
00879                 menuItem15.SetFocus();
00880                 Wait.ForIdle();
00881
00882                 AutomationElement ae = AutomationElement.FocusedElement;
00883                 int positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00884                 int sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00885                 int itemLevel = (int)ae.GetCurrentPropertyValue(AutomationElement.LevelProperty);
00886
00887                 Verify.AreEqual(4, positionInSet, "Position in set");
00888                 Verify.AreEqual(15, sizeOfSet, "Size of set");
00889                 Verify.AreEqual(1, itemLevel, "Level of item");
00890
00891                 Log.Comment("Expanding Menu Item 15.");
00892                 InputHelper.LeftClick(menuItem15);
00893                 Wait.ForIdle();
00894
00895                 Log.Comment("Setting focus to Menu Item 17");
00896                 UIObject menuItem17 = FindElement.ByName("Menu Item 17");
00897                 menuItem17.SetFocus();
00898                 Wait.ForIdle();
00899
00900                 ae = AutomationElement.FocusedElement;
00901                 positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00902                 sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00903                 itemLevel = (int)ae.GetCurrentPropertyValue(AutomationElement.LevelProperty);
00904
00905                 Verify.AreEqual(2, positionInSet, "Position in set, not including separator/header");
00906                 Verify.AreEqual(3, sizeOfSet, "Size of set");
00907                 Verify.AreEqual(2, itemLevel, "Level of item");
00908             }
00909         }
00910
00911         [TestMethod]
00912         [TestProperty("TestSuite", "B")]
00913         public void ItemsSourceAccessibilitySetTest()
00914         {
00915             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Init Test" }))
00916             {
00917                 Log.Comment("Set focus to second menu item");
00918                 UIObject item = FindElement.ByName("Menu Item 2");
00919                 item.SetFocus();
00920                 Wait.ForIdle();
00921
00922                 AutomationElement ae = AutomationElement.FocusedElement;
00923                 int positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00924                 int sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00925
00926                 // choose 2nd item so if it accidentally succeeds
00927                 // on firstor last item, we don't get false positives
00928                 Verify.AreEqual(2, positionInSet, "Position in set");
00929                 Verify.AreEqual(4, sizeOfSet, "Size of set");
00930
00931                 // Perform the test again with an IIterable (IEnumerable in C# projection)
00932                 Button changeButton = new Button(FindElement.ByName("ChangeToIEnumerableButton"));
00933                 changeButton.Invoke();
00934                 Wait.ForIdle();
00935                 ElementCache.Clear();
00936
00937                 Log.Comment("Set focus to second menu item [2]");
00938                 item = FindElement.ByName("IIterator/Enumerable/LinkedList Item 2");
00939                 item.SetFocus();
00940                 Wait.ForIdle();
00941
00942                 ae = AutomationElement.FocusedElement;
00943                 positionInSet = (int)ae.GetCurrentPropertyValue(AutomationElement.PositionInSetProperty);
00944                 sizeOfSet = (int)ae.GetCurrentPropertyValue(AutomationElement.SizeOfSetProperty);
00945
00946                 // choose 2nd item so if it accidentally succeeds
00947                 // on firstor last item, we don't get false positives
00948                 Verify.AreEqual(2, positionInSet, "Position in set [2]");
00949                 Verify.AreEqual(3, sizeOfSet, "Size of set [2]");
00950             }
00951         }
00952
00953         [TestMethod]
00954         [TestProperty("TestSuite", "B")]
00955         public void SettingsItemGamepadTest()
00956         {
00957             var testScenarios = RegressionTestScenario.BuildAllRegressionTestScenarios();
00958             foreach (var testScenario in testScenarios)
00959             {
00960                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00961                 {
00962                     UIObject settingsItem = FindElement.ByName("Settings");
00963
00964                     settingsItem.SetFocus();
00965                     Wait.ForIdle();
00966
00967                     Log.Comment("Invoking settings through the gamepad");
00968                     GamepadHelper.PressButton(settingsItem, GamepadButton.A);
00969                     Wait.ForIdle();
00970
00971                     Log.Comment("Verify settings is selected");
00972                     TextBlock header = new TextBlock(FindElement.ByName("Settings as header"));
00973                     Verify.AreEqual("Settings as header", header.DocumentText);
00974                 }
00975             }
00976         }
00977
00978         [TestMethod]
00979         [TestProperty("TestSuite", "C")]
00980         public void ScrollToMenuItemTest()
00981         {
00982             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
00983             foreach (var testScenario in testScenarios)
00984             {
00985                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
00986                 {
00987                     SetNavViewHeight(ControlHeight.Small);
00988
00989                     UIObject lastItem = FindElement.ByName("TV");
00990                     UIObject firstItem = FindElement.ByName("Home");
00991
00992                     Log.Comment("Verify last item is offscreen");
00993                     Verify.AreEqual(true, lastItem.IsOffscreen);
00994
00995                     Log.Comment("Move focus to the last item by giving focus to the toggle pane button then tab twice then down arrow 5 times");
00996                     Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton"));
00997
00998                     togglePaneButton.SetFocus();
00999                     Wait.ForIdle();
01000
01001                     KeyboardHelper.PressKey(Key.Tab, ModifierKey.None, 2);
01002                     Wait.ForIdle();
01003
01004                     Verify.IsTrue(firstItem.HasKeyboardFocus);
01005                     AutomationElement firstItemAE = AutomationElement.FocusedElement;
01006                     KeyboardHelper.PressKey(Key.Down, ModifierKey.None, 5);
01007                     Wait.ForIdle();
01008
01009                     Verify.IsTrue(lastItem.HasKeyboardFocus, "Verify last item has keyboard focus");
01010
01011                     Log.Comment("Verify the last item is now onscreen");
01012                     Verify.AreEqual(false, lastItem.IsOffscreen);
01013                     Log.Comment("Verify the first item is now offscreen");
01014                     Verify.AreEqual(true, firstItem.IsOffscreen);
01015
01016                     Log.Comment("Scroll to the first item using the automation ScrollItemPattern");
01017                     ScrollItemPattern firstItemSIP = firstItemAE.GetCurrentPattern(ScrollItemPattern.Pattern) as ScrollItemPattern;
01018                     firstItemSIP.ScrollIntoView();
01019                     Wait.ForIdle();
01020
01021                     Log.Comment("Verify the first item is onscreen again");
01022                     Verify.AreEqual(false, firstItem.IsOffscreen);
01023                 }
01024             }
01025         }
01026
01027         [TestMethod]
01028         [TestProperty("TestSuite", "C")]
01029         public void SystemBackTest()
01030         {
01031             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
01032             foreach (var testScenario in testScenarios)
01033             {
01034                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
01035                 {
01036                     Log.Comment("Set control to compact");
01037                     SetNavViewWidth(ControlWidth.Medium);
01038                     Wait.ForIdle();
01039
01040                     Log.Comment("Open pane");
01041                     CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox"));
01042                     isPaneOpenCheckBox.Check();
01043                     Wait.ForIdle();
01044
01045                     Log.Comment("Click back button (invoking does not work)");
01046                     Button backButton = new Button(FindElement.ById("__BackButton"));
01047                     backButton.Click(); // NOTE: Must be Click because this is verifying that the mouse light dismiss behavior closes the nav view
01048                     Wait.ForIdle();
01049
01050                     Log.Comment("Verify that the pane is closed");
01051
01052                     TestEnvironment.VerifyAreEqualWithRetry(20,
01053                         () => ToggleState.Off,
01054                         () => isPaneOpenCheckBox.ToggleState,
01055                         () =>
01056                         {
01057                             Task.Delay(TimeSpan.FromMilliseconds(100)).Wait(); // UIA's state isn't updating immediately. Wait a sec.
01058                             ElementCache.Clear(); /* Test is flaky sometimes -- perhaps element cache is stale? Clear it and try again. */
01059                         });
01060
01061                     Log.Comment("Click pane toggle button");
01062                     Button navButton = new Button(FindElement.ById("TogglePaneButton"));
01063                     navButton.Invoke();
01064                     Wait.ForIdle();
01065
01066                     Log.Comment("Verify that the pane is open");
01067                     Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True");
01068                 }
01069             }
01070         }
01071
01072         [TestMethod]
01073         [TestProperty("TestSuite", "C")]
01074         public void AccTypeTest()
01075         {
01076             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
01077             foreach (var testScenario in testScenarios)
01078             {
01079                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
01080                 {
01081                     UIObject menuItem = FindElement.ByName("Games");
01082                     Verify.AreEqual(ControlType.ListItem, menuItem.ControlType);
01083                 }
01084             }
01085         }
01086
01087         [TestMethod]
01088         [TestProperty("TestSuite", "C")]
01089         [TestProperty("Ignore", "True")] // Disabled as per tracking issue #3125
01090         public void ToolTipTest() // Verify tooltips appear, and that their contents change when headers change
01091         {
01092             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
01093             foreach (var testScenario in testScenarios)
01094             {
01095                 using (IDisposable page1 = new TestSetupHelper("NavigationView Tests"),
01096                     page2 = new TestSetupHelper(testScenario.TestPageName))
01097                 {
01098                     // Close the pane
01099                     Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton"));
01100                     togglePaneButton.Invoke();
01101                     Wait.ForIdle();
01102
01103                     UIObject menuItem = FindElement.ByName("Games");
01104                     Verify.AreEqual(ControlType.ListItem, menuItem.ControlType);
01105
01106                     Button reverseButton = new Button(FindElement.ById("ReverseButton"));
01107
01108                     Button copyTextButton = new Button(FindElement.ById("CopyGamesLabelButton"));
01109                     copyTextButton.Invoke();
01110                     Wait.ForIdle();
01111
01112                     TextBlock toolTipStatusTextBlock = new TextBlock(FindElement.ByName("ToolTipStatusTextBlock"));
01113                     Verify.AreEqual("There are no popups", toolTipStatusTextBlock.DocumentText);
01114
01115                     using (var waiter = new ToolTipOpenedWaiter())
01116                     {
01117                         menuItem.Click(); // I think the underlying SinglePointGesture doesn't do what you expect sometimes unless you click first
01118                         menuItem.MovePointer();
01119                         Log.Comment("Waiting for tooltip open event");
01120                         if (waiter != null)
01121                         {
01122                             waiter.Wait();
01123                         }
01124
01125                         copyTextButton.Invoke();
01126
01127                         Verify.AreEqual("Games", toolTipStatusTextBlock.DocumentText); // Verify default case
01128                     }
01129
01130                     reverseButton.MovePointer(); // dismissssss the tooltip
01131                     reverseButton.Invoke();
01132                     Wait.ForIdle();
01133
01134                     using (var waiter = new ToolTipOpenedWaiter())
01135                     {
01136                         menuItem.Click(); // I think the underlying SinglePointGesture doesn't do what you expect sometimes unless you click first
01137                         menuItem.MovePointer();
01138                         Log.Comment("Waiting for tooltip open event [2]");
01139                         if (waiter != null)
01140                         {
01141                             waiter.Wait();
01142                         }
01143
01144                         copyTextButton.Invoke();
01145
01146                         Verify.AreEqual("semaG", toolTipStatusTextBlock.DocumentText); // Verify tooltips change when content changes
01147                     }
01148                 }
01149             }
01150         }
01151
01152         [TestMethod]
01153         [TestProperty("TestSuite", "C")]
01154         [TestProperty("Ignore", "True")]
01155         // Disabled due to: Multiple unreliable NavigationView tests #134
01156         public void KeyboardFocusToolTipTest() // Verify tooltips appear when Keyboard focused
01157         {
01158             using (IDisposable page1 = new TestSetupHelper("NavigationView Tests"),
01159                 page2 = new TestSetupHelper("NavigationView Test"))
01160             {
01161                 SetNavViewWidth(ControlWidth.Medium);
01162                 Wait.ForIdle();
01163
01164                 // ToolTip is not reliable on RS2, try many times
01165                 bool foundToolTip = false;
01166                 for (int i = 0; i < 5; i++)
01167                 {
01168                     Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton"));
01169                     togglePaneButton.SetFocus();
01170                     Wait.ForIdle();
01171
01172                     UIObject home = FindElement.ByName("Home");
01173                     Button copyTextButton = new Button(FindElement.ById("CopyGamesLabelButton"));
01174                     TextBlock toolTipStatusTextBlock = new TextBlock(FindElement.ByName("ToolTipStatusTextBlock"));
01175
01176                     Log.Comment("tab from the TogglePaneButton goes to the search box");
01177                     KeyboardHelper.PressKey(Key.Tab);
01178                     Wait.ForIdle();
01179
01180                     Log.Comment("Down key from search box goes to the first item");
01181                     KeyboardHelper.PressKey(Key.Down);
01182                     Wait.ForIdle();
01183
01184                     Verify.IsTrue(home.HasKeyboardFocus);
01185                     using (var waiter = new ToolTipOpenedWaiter())
01186                     {
01187                         KeyboardHelper.PressKey(Key.Down);
01188
01189                         Log.Comment("Waiting for tooltip open event");
01190                         waiter.Wait(TimeSpan.FromSeconds(5));
01191                     }
01192
01193                     copyTextButton.Invoke();
01194                     Wait.ForIdle();
01195                     if (toolTipStatusTextBlock.DocumentText != null && !toolTipStatusTextBlock.DocumentText.Contains("popups"))
01196                     {
01197                         Log.Comment("Found ToolTip on Iteration " + i);
01198                         Verify.AreEqual("Apps", toolTipStatusTextBlock.DocumentText);
01199                         foundToolTip = true;
01200                         break;
01201                     }
01202                     else
01203                     {
01204                         Log.Comment("ToolTip Window may be closed, and didn't find ToolTip on Iteration " + i);
01205                     }
01206
01207                 }
01208                 Verify.IsTrue(foundToolTip, "Found ToolTip");
01209             }
01210         }
01211
01212         [TestMethod]
01213         [TestProperty("TestSuite", "C")]
01214         [TestProperty("Ignore", "True")] // Disabled as per tracking issue #3125
01215         public void ToolTipCustomContentTest() // Verify tooltips don't appear for custom NavViewItems (split off due to CatGates timeout)
01216         {
01217             // Since RS5, ToolTip is removed from ControlTemplate. and this test case can't be run on "NavigationView Tests" page
01218             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Regression Test" }))
01219             {
01220                 // Close the pane
01221                 Button togglePaneButton = new Button(FindElement.ById("TogglePaneButton"));
01222                 Verify.IsNotNull(togglePaneButton, "Finding TogglePaneButton");
01223                 togglePaneButton.Invoke();
01224                 Wait.ForIdle();
01225
01226                 Button volumeToolTipCopyButton = new Button(FindElement.ByName("CopyVolumeToolTipButton"));
01227                 Verify.IsNotNull(togglePaneButton, "Finding CopyVolumeToolTipButton");
01228
01229                 TextBlock toolTipStatusTextBlock = new TextBlock(FindElement.ByName("ToolTipStatusTextBlock"));
01230                 Verify.IsNotNull(togglePaneButton, "Finding ToolTipStatusTextBlock");
01231
01232                 volumeToolTipCopyButton.Invoke();
01233                 Wait.ForIdle();
01234
01235                 Verify.AreEqual("The volume navigation view item tooltip content is null", toolTipStatusTextBlock.DocumentText);
01236             }
01237         }
01238
01239         [TestMethod]
01240         [TestProperty("TestSuite", "C")]
01241         public void VerifyCustomHeaderContentTest()
01242         {
01243             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
01244             foreach (var testScenario in testScenarios)
01245             {
01246                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
01247                 {
01248                     TextBlock tb = new TextBlock(FindElement.ByName("Home as header"));
01249                     Verify.AreEqual("Home as header", tb.DocumentText, "Verify initial Header text");
01250
01251                     Button button = new Button(FindElement.ByName("SetHeaderButton"));
01252                     button.Invoke();
01253                     Wait.ForIdle();
01254
01255                     tb = new TextBlock(FindElement.ByName("Bananas"));
01256                     Verify.AreEqual("Bananas", tb.DocumentText, "Verify new TextBlock child was set as the Header");
01257                 }
01258             }
01259         }
01260
01261         [TestMethod]
01262         [TestProperty("TestSuite", "C")]
01263         public void BackToolTipTest()
01264         {
01265             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
01266             {
01267                 Button button = new Button(FindElement.ByName("NavigationViewBackButton"));
01268                 CheckBox checkBox = new CheckBox(FindElement.ByName("BackButtonEnabledCheckbox"));
01269
01270                 checkBox.Check();
01271                 Wait.ForIdle();
01272
01273                 using (var waiter = new ToolTipOpenedWaiter())
01274                 {
01275                     Log.Comment("Moving pointer around, over back button");
01276                     button.MovePointer();
01277                     Wait.ForIdle();
01278                     button.MovePointer(offsetX: 1, offsetY: 1);
01279                     Wait.ForIdle();
01280                     button.MovePointer(offsetX: -1, offsetY: -1);
01281                     Wait.ForIdle();
01282
01283                     Log.Comment("Waiting for tooltip to open");
01284                     waiter.Wait(TimeSpan.FromSeconds(5));
01285                 }
01286             }
01287         }
01288
01289         [TestMethod]
01290         [TestProperty("TestSuite", "C")]
01291         public void CloseToolTipTest()
01292         {
01293             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
01294             {
01295                 var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox"));
01296
01297                 Log.Comment("Set PaneDisplayMode to LeftMinimal");
01298                 panelDisplayModeComboBox.SelectItemByName("LeftMinimal");
01299                 Wait.ForIdle();
01300
01301                 var isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox"));
01302
01303                 Log.Comment("Open the pane");
01304                 isPaneOpenCheckBox.Check();
01305                 Wait.ForIdle();
01306
01307                 Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True");
01308
01309                 Button closeButton = new Button(FindElement.ById("NavigationViewCloseButton"));
01310                 Verify.IsNotNull(closeButton);
01311
01312                 using (var waiter = new ToolTipOpenedWaiter())
01313                 {
01314                     Log.Comment("Moving pointer around, over close button");
01315                     closeButton.MovePointer();
01316                     Wait.ForIdle();
01317                     closeButton.MovePointer(offsetX: 1, offsetY: 1);
01318                     Wait.ForIdle();
01319                     closeButton.MovePointer(offsetX: -1, offsetY: -1);
01320                     Wait.ForIdle();
01321
01322                     Log.Comment("Waiting for tooltip to open");
01323                     waiter.Wait(TimeSpan.FromSeconds(5));
01324                 }
01325             }
01326         }
01327
01328         [TestMethod]
01329         [TestProperty("TestSuite", "C")]
01330         public void VerifyCanCancelClosing()
01331         {
01332             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
01333             foreach (var testScenario in testScenarios)
01334             {
01335                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
01336                 {
01337                     SetNavViewWidth(ControlWidth.Medium);
01338
01339                     var cancelClosingCheckbox = new CheckBox(FindElement.ById("CancelClosingEvents"));
01340                     cancelClosingCheckbox.Toggle();
01341                     Wait.ForIdle();
01342                     Verify.AreEqual(ToggleState.On, cancelClosingCheckbox.ToggleState);
01343
01344                     var isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox"));
01345                     Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False");
01346
01347                     Log.Comment("Reset the event count");
01348                     new Button(FindElement.ById("ClosingEventCountResetButton")).Invoke();
01349                     Wait.ForIdle();
01350
01351                     Log.Comment("Open the Pane");
01352                     using (var waiter = isPaneOpenCheckBox.GetToggledWaiter())
01353                     {
01354                         isPaneOpenCheckBox.Toggle();
01355                         waiter.Wait();
01356                     }
01357                     WaitAndAssertPaneStatus(PaneOpenStatus.Opened);
01358
01359                     Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True");
01360
01361                     var closingCounts = new Edit(FindElement.ByName("ClosingEventCountTextBlock"));
01362                     var expectedString = "1-0";
01363
01364                     //  trigger a light dismiss
01365                     KeyboardHelper.PressKey(Key.Left, ModifierKey.Alt);
01366                     Wait.ForIdle();
01367
01368                     Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState,
01369                         "Verify Alt+Left light dismiss doesn't dismiss the pane when closing events are being canceled");
01370
01371                     Verify.AreEqual(expectedString, closingCounts.GetText());
01372                 }
01373             }
01374         }
01375
01376         [TestMethod]
01377         [TestProperty("TestSuite", "C")]
01378         public void EnsureClearingListIsSafe()
01379         {
01380             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
01381             foreach (var testScenario in testScenarios)
01382             {
01383                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
01384                 {
01385                     Button clearButton = new Button(FindElement.ByName("ClearMenuButton"));
01386                     Log.Comment("About to invoke list clear button");
01387                     clearButton.Invoke();
01388                     Log.Comment("About to wait for idle");
01389                     Wait.ForIdle();
01390
01391                     // that's it, it's a stability test
01392                 }
01393             }
01394         }
01395
01396         [TestMethod]
01397         [TestProperty("TestSuite", "C")]
01398         [TestProperty("Description", "Ensure that the NavigationView button isn't running with rs3+ themeresource on when they're off :)")]
01399         public void VerifyNotShouldPreserveNavigationViewRS3Behavior() // Regression test to make sure that we aren't accidentally running quirks all the time
01400         {
01401             var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios();
01402             foreach (var testScenario in testScenarios)
01403             {
01404                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
01405                 {
01406                     CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox"));
01407
01408                     // On phone, the pane will initially be in the closed compact state, so open it before
01409                     // proceeding with the test.
01410                     if (isPaneOpenCheckBox.ToggleState == ToggleState.Off)
01411                     {
01412                         using (var waiter = isPaneOpenCheckBox.GetToggledWaiter())
01413                         {
01414                             isPaneOpenCheckBox.Toggle();
01415                             waiter.Wait();
01416                         }
01417                     }
01418
01419                     Button navButton = new Button(FindElement.ById("TogglePaneButton"));
01420                     Verify.AreEqual(312, navButton.BoundingRectangle.Width);
01421                 }
01422             }
01423         }
01424
01425         [TestMethod]
01426         [TestProperty("TestSuite", "D")]
01427         [TestProperty("Description", "Ensure that the NavigationView button is rendering as expected if it's targeting RS3")]
01428         public void VerifyShouldPreserveNavigationViewRS3Behavior()
01429         {
01430             // This test exercises how the navigation view intereacts with the titlebar, thus setting shouldRestrictInnerFrameSize to true (the default) doesn't allow us
01431             // to exercise the scenario, thus requiring us to disable this.
01432             using (var setup = new TestSetupHelper(testNames: new[] { "NavigationView Tests", "NavigationView PreserveRS3 Test" }, shouldRestrictInnerFrameSize: false))
01433             {
01434                 CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox"));
01435
01436                 // On phone, the pane will initially be in the closed compact state, so open it before
01437                 // proceeding with the test.
01438                 if (isPaneOpenCheckBox.ToggleState == ToggleState.Off)
01439                 {
01440                     using (var waiter = isPaneOpenCheckBox.GetToggledWaiter())
01441                     {
01442                         isPaneOpenCheckBox.Toggle();
01443                         waiter.Wait();
01444                     }
01445                 }
01446
01447                 // In RS4 or late application, togglePaneTopPadding is 0 when ExtendViewIntoTitleBar=true,
01448                 // but for RS3 application, we expected it be not 0 because apps like Wallpaper make use of it
01449                 var result = new Edit(FindElement.ById("TestResult"));
01450                 using (var waiter = new ValueChangedEventWaiter(result))
01451                 {
01452                     Button button = new Button(FindElement.ById("GetTopPaddingHeight"));
01453                     button.Invoke();
01454                     waiter.Wait();
01455                 }
01456                 var togglePaneTopPadding = Convert.ToInt32(result.Value);
01457
01458                 if (TestEnvironment.Application.SupportsExtendViewIntoTitleBar)
01459                 {
01460                     Verify.AreNotEqual(0, togglePaneTopPadding);
01461                 }
01462                 else
01463                 {
01464                     Log.Comment("ExtendViewIntoTitleBar is not supported in Win32/Desktop mode, so we expect to top padding");
01465                     Verify.AreEqual(0, togglePaneTopPadding);
01466                 }
01467
01468                 // TestFrame is disabled before the testcase. we should enable it and prepare for next test case
01469                 var testFrame = new CheckBox(FindElement.ById("TestFrameCheckbox"));
01470                 testFrame.Check();
01471                 Wait.ForIdle();
01472             }
01473         }
01474
01475         [TestMethod]
01476         [TestProperty("TestSuite", "D")]
01477         public void EnsurePaneHeaderCanBeModifiedForLeftNav()
01478         {
01479             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
01480             {
01481                 EnsurePaneHeaderCanBeModifiedHelper(RegressionTestType.LeftNav);
01482             }
01483         }
01484
01485         [TestMethod]
01486         [TestProperty("TestSuite", "D")]
01487         public void EnsurePaneHeaderCanBeModifiedForTopNav()
01488         {
01489             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
01490             {
01491                 EnsurePaneHeaderCanBeModifiedHelper(RegressionTestType.TopNav);
01492             }
01493         }
01494
01495         [TestMethod]
01496         [TestProperty("TestSuite", "D")]
01497         public void EnsureDisplayModeGroupUpdatesWhenBackButtonVisibilityChanged()
01498         {
01499             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
01500             {
01501                 Log.Comment("Setup test page to be in the minimal display mode with the backbutton hidden...");
01502                 Log.Comment("Hide backbutton");
01503                 var backButtonCheckBox = new CheckBox(FindElement.ByName("BackButtonVisibilityCheckbox"));
01504                 backButtonCheckBox.Uncheck();
01505                 Wait.ForIdle();
01506
01507                 Log.Comment("Change display mode to left minimal");
01508                 var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox"));
01509                 panelDisplayModeComboBox.SelectItemByName("LeftMinimal");
01510                 Wait.ForIdle();
01511
01512                 TextBlock displayModeTextBox = new TextBlock(FindElement.ByName("DisplayModeTextBox"));
01513                 Verify.AreEqual(minimal, displayModeTextBox.DocumentText);
01514
01515                 Log.Comment("Get NavView Active VisualStates");
01516                 var getNavViewActiveVisualStatesButton = new Button(FindElement.ByName("GetNavViewActiveVisualStates"));
01517                 getNavViewActiveVisualStatesButton.Invoke();
01518                 Wait.ForIdle();
01519
01520                 const string visualStateName = "MinimalWithBackButton";
01521                 var result = new TextBlock(FindElement.ByName("NavViewActiveVisualStatesResult"));
01522                 Verify.IsFalse(result.GetText().Contains(visualStateName), "Active VisualStates should not include " + visualStateName);
01523
01524                 Log.Comment("Show backbutton");
01525                 backButtonCheckBox.Check();
01526                 Wait.ForIdle();
01527
01528                 Log.Comment("Get NavView Active VisualStates");
01529                 getNavViewActiveVisualStatesButton.Invoke();
01530                 Wait.ForIdle();
01531                 Verify.IsTrue(result.GetText().Contains(visualStateName), "Active VisualStates should include " + visualStateName);
01532             }
01533         }
01534
01535         [TestMethod]
01536         [TestProperty("TestSuite", "D")]
01537         public void EnsureDisplayModeGroupUpdatesOnPaneClosedToMinimalWithBackButton()
01538         {
01539             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Navigation Minimal Test" }))
01540             {
01541                 Log.Comment("Click on ToggleButton");
01542                 FindElement.ById<Button>("TogglePaneButton").InvokeAndWait();
01543
01544                 Log.Comment("Get NavView Active VisualStates");
01545                 FindElement.ByName<Button>("GetNavViewActiveVisualStates").InvokeAndWait();
01546
01547                 const string visualStateName = "MinimalWithBackButton";
01548                 var result = new TextBlock(FindElement.ByName("NavViewActiveVisualStatesResult"));
01549                 Verify.IsTrue(result.GetText().Contains(visualStateName), "Active VisualStates should include " + visualStateName);
01550             }
01551         }
01552
01553         [TestMethod]
01554         [TestProperty("TestSuite", "D")]
01555         public void VerifyExpandCollapseFunctionality()
01556         {
01557             var testScenarios = RegressionTestScenario.BuildHierarchicalNavRegressionTestScenarios();
01558             foreach (var testScenario in testScenarios)
01559             {
01560                 using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName }))
01561                 {
01562
01563                     TextBlock textblockExpandingItemAndContainerMatch = new TextBlock(FindElement.ByName("TextblockExpandingItemAndContainerMatch"));
01564                     TextBlock textblockCollapsedItemAndContainerMatch = new TextBlock(FindElement.ByName("TextblockCollapsedItemAndContainerMatch"));
01565                     TextBlock textBlockExpandingItem = new TextBlock(FindElement.ByName("TextBlockExpandingItem"));
01566                     TextBlock textBlockCollapsedItem = new TextBlock(FindElement.ByName("TextBlockCollapsedItem"));
01567
01568                     Log.Comment("Verify that first menu item is not expanded.");
01569                     // Verify through test page elements
01570                     Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "N/A");
01571                     Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "N/A");
01572                     Verify.AreEqual(textBlockExpandingItem.DocumentText, "N/A");
01573                     Verify.AreEqual(textBlockCollapsedItem.DocumentText, "N/A");
01574                     // Verify that second menu item is not in tree
01575                     var firstItem = FindElement.ByName("Menu Item 1");
01576                     var childItem = FindElement.ByName("Menu Item 2");
01577                     Verify.IsNull(childItem);
01578
01579                     Log.Comment("Expand first menu item.");
01580                     InputHelper.LeftClick(firstItem);
01581                     Wait.ForIdle();
01582
01583                     Log.Comment("Verify that first menu item was expanded correctly.");
01584                     // Verify through test page elements
01585                     Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "true");
01586                     Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "N/A");
01587                     Verify.AreEqual(textBlockExpandingItem.DocumentText, "Menu Item 1");
01588                     Verify.AreEqual(textBlockCollapsedItem.DocumentText, "N/A");
01589                     // Verify that second menu item is in tree
01590                     childItem = FindElement.ByName("Menu Item 2");
01591                     Verify.IsNotNull(childItem, "Child item should be visible after expanding parent item.");
01592
01593                     Log.Comment("Expand child of first menu item.");
01594                     InputHelper.LeftClick(childItem);
01595                     Wait.ForIdle();
01596
01597                     Log.Comment("Verify that child of first menu item was expanded correctly.");
01598                     // Verify through test page elements
01599                     Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "true");
01600                     Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "N/A");
01601                     Verify.AreEqual(textBlockExpandingItem.DocumentText, "Menu Item 2");
01602                     Verify.AreEqual(textBlockCollapsedItem.DocumentText, "N/A");
01603                     // Verify that third child menu item is in tree
01604                     var secondChildItem = FindElement.ByName("Menu Item 4");
01605                     Verify.IsNotNull(secondChildItem, "Child item should be visible after expanding parent item.");
01606
01607                     Log.Comment("Collapse child of first menu item.");
01608                     InputHelper.LeftClick(childItem, 5, 5);
01609                     Wait.ForIdle();
01610
01611                     Log.Comment("Verify that child of first menu item was collapsed correctly.");
01612                     // Verify through test page elements
01613                     Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "true");
01614                     Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "true");
01615                     Verify.AreEqual(textBlockExpandingItem.DocumentText, "Menu Item 2");
01616                     Verify.AreEqual(textBlockCollapsedItem.DocumentText, "Menu Item 2");
01617
01618
01619                     Log.Comment("Collapse first menu item.");
01620                     InputHelper.LeftClick(firstItem, 5, 5);
01621                     Wait.ForIdle();
01622
01623                     Log.Comment("Verify that first menu item was collapsed correctly.");
01624                     // Verify through test page elements
01625                     Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "true");
01626                     Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "true");
01627                     Verify.AreEqual(textBlockExpandingItem.DocumentText, "Menu Item 2");
01628                     Verify.AreEqual(textBlockCollapsedItem.DocumentText, "Menu Item 1");
01629                 }
01630             }
01631         }
01632
01633         [TestMethod]
01634         [TestProperty("TestSuite", "D")]
01635         public void VerifyExpandCollapseFunctionalityUsingChevron()
01636         {
01637             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "HierarchicalNavigationView Markup Test" }))
01638             {
01639
01640                 TextBlock textblockExpandingItemAndContainerMatch = new TextBlock(FindElement.ByName("TextblockExpandingItemAndContainerMatch"));
01641                 TextBlock textblockCollapsedItemAndContainerMatch = new TextBlock(FindElement.ByName("TextblockCollapsedItemAndContainerMatch"));
01642                 TextBlock textBlockExpandingItem = new TextBlock(FindElement.ByName("TextBlockExpandingItem"));
01643                 TextBlock textBlockCollapsedItem = new TextBlock(FindElement.ByName("TextBlockCollapsedItem"));
01644
01645                 Log.Comment("Verify that Menu Item 6 is not expanded.");
01646                 // Verify through test page elements
01647                 Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "N/A");
01648                 Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "N/A");
01649                 Verify.AreEqual(textBlockExpandingItem.DocumentText, "N/A");
01650                 Verify.AreEqual(textBlockCollapsedItem.DocumentText, "N/A");
01651                 // Verify that child menu item is not in tree
01652                 UIObject parentItem = FindElement.ByName("Menu Item 6 (Selectable)");
01653                 UIObject childItem = FindElement.ByName("Menu Item 7 (Selectable)");
01654                 Verify.IsNull(childItem);
01655
01656                 Log.Comment("Expand Menu Item 6.");
01657                 InputHelper.LeftClick(parentItem, parentItem.BoundingRectangle.Width - 20 , parentItem.BoundingRectangle.Height / 2 + 10);
01658                 Wait.ForIdle();
01659
01660                 Log.Comment("Verify that Menu Item 6 was expanded correctly.");
01661                 // Verify through test page elements
01662                 Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "true");
01663                 Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "N/A");
01664                 Verify.AreEqual(textBlockExpandingItem.DocumentText, "Menu Item 6 (Selectable)");
01665                 Verify.AreEqual(textBlockCollapsedItem.DocumentText, "N/A");
01666                 // Verify that child menu item is in tree
01667                 childItem = FindElement.ByName("Menu Item 7 (Selectable)");
01668                 Verify.IsNotNull(childItem, "Child item should be visible after expanding parent item.");
01669
01670                 Log.Comment("Try collapse Menu Item 6 using an invalid right click.");
01671                 InputHelper.RightClick(parentItem, parentItem.BoundingRectangle.Width - 25, 25);
01672                 Wait.ForIdle();
01673
01674                 Log.Comment("Verify that Menu Item 6 was not collapsed.");
01675                 // Verify through test page elements
01676                 Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "true");
01677                 Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "N/A");
01678                 Verify.AreEqual(textBlockExpandingItem.DocumentText, "Menu Item 6 (Selectable)");
01679                 Verify.AreEqual(textBlockCollapsedItem.DocumentText, "N/A");
01680
01681                 Log.Comment("Collapse Menu Item 6 using left click.");
01682                 InputHelper.LeftClick(parentItem, parentItem.BoundingRectangle.Width - 25, 25);
01683                 Wait.ForIdle();
01684
01685                 Log.Comment("Verify that Menu Item 6 was collapsed correctly.");
01686                 // Verify through test page elements
01687                 Verify.AreEqual(textblockExpandingItemAndContainerMatch.DocumentText, "true");
01688                 Verify.AreEqual(textblockCollapsedItemAndContainerMatch.DocumentText, "true");
01689                 Verify.AreEqual(textBlockExpandingItem.DocumentText, "Menu Item 6 (Selectable)");
01690                 Verify.AreEqual(textBlockCollapsedItem.DocumentText, "Menu Item 6 (Selectable)");
01691             }
01692         }
01693
01694         [TestMethod]
01695         [TestProperty("TestSuite", "D")]
01696         public void VerifyNoCrashWhenSwitchingPaneDisplayModeWithAutoWrappedElements()
01697         {
01698             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView ItemTemplate Test" }))
01699             {
01700                 Log.Comment("Verify that switching pane mode to auto does not crash.");
01701                 var flipOrientationButton = new Button(FindElement.ByName("FlipOrientationButton"));
01702                 flipOrientationButton.Invoke();
01703                 Wait.ForIdle();
01704             }
01705         }
01706
01707         [TestMethod]
01708         [TestProperty("TestSuite", "D")]
01709         public void VerifyNoCrashWhenNavViewInContentDialog()
01710         {
01711             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
01712             {
01713                 Log.Comment("Open a ContentDialog with a NavView inside.");
01714                 Button openContentDialogButton = new Button(FindElement.ById("ContentDialogNavViewButton"));
01715                 openContentDialogButton.Invoke();
01716                 Wait.ForIdle();
01717
01718                 Log.Comment("Close the ContentDialog with a NavView inside.");
01719                 Button closeContentDialogButton = new Button(FindElement.ByName("Button1ContentDialog"));
01720                 closeContentDialogButton.Invoke();
01721                 Wait.ForIdle();
01722             }
01723         }
01724
01725         [TestMethod]
01726         [TestProperty("TestSuite", "D")]
01727         [TestProperty("Ignore", "True")] // 32134869: Temporarily disabling
01728         public void VerifyNavigationViewItemContentPresenterMargin()
01729         {
01730             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
01731             {
01732                 var getTopLevelContentPresenterMarginButton = FindElement.ById<Button>("GetTopLevelNavViewItemContentPresenterMarginButton");
01733                 var getChildContentPresenterMarginButton = FindElement.ById<Button>("GetChildNavViewItemContentPresenterMarginButton");
01734                 var contentPresenterMarginTextBlock = new TextBlock(FindElement.ByName("NavViewItemContentPresenterMarginTextBlock"));
01735
01736                 var scrollItemIntoViewComboBox = new ComboBox(FindElement.ByName("ScrollItemIntoViewComboBox"));
01737                 var scrollItemIntoViewButton = FindElement.ById<Button>("ScrollItemIntoViewButton");
01738
01739                 // Switch the NavigationView to closed compact mode
01740                 Log.Comment("Switch NavigationView to closed compact mode");
01741                 SetNavViewWidth(ControlWidth.Medium);
01742                 Wait.ForIdle();
01743
01744                 Log.Comment("Ensure test menu item is in view");
01745                 scrollItemIntoViewComboBox.SelectItemByName("HasChildItem");
01746                 Wait.ForIdle();
01747                 scrollItemIntoViewButton.InvokeAndWait();
01748
01749                 // Verify that top-level items use the correct content margin
01750                 getTopLevelContentPresenterMarginButton.InvokeAndWait();
01751                 Verify.AreEqual("0,0,0,0", contentPresenterMarginTextBlock.DocumentText);
01752
01753                 // Child items in closed compact mode are shown in a flyout. Verify that they are using the correct margin
01754                 Log.Comment("Expand item with children");
01755                 UIObject hasChildItem = FindElement.ByName("HasChildItem");
01756                 InputHelper.LeftClick(hasChildItem);
01757                 Wait.ForMilliseconds(100); // Give a little bit of time for the flyout to open, then wait for idle.
01758                 Wait.ForIdle();
01759
01760                 getChildContentPresenterMarginButton.InvokeAndWait();
01761                 Verify.AreEqual("4,0,20,0", contentPresenterMarginTextBlock.DocumentText);
01762
01763                 // Close opened flyout
01764                 InputHelper.LeftClick(hasChildItem);
01765                 Wait.ForIdle();
01766
01767                 // Switch the NavigationView to expanded mode
01768                 Log.Comment("Switch NavigationView to expanded mode");
01769                 SetNavViewWidth(ControlWidth.Wide);
01770                 Wait.ForIdle();
01771
01772                 Log.Comment("Ensure test menu item is in view");
01773                 scrollItemIntoViewComboBox.SelectItemByName("HasChildItem");
01774                 Wait.ForIdle();
01775                 scrollItemIntoViewButton.InvokeAndWait();
01776
01777                 // Verify that top-level items use the correct content margin
01778                 getTopLevelContentPresenterMarginButton.InvokeAndWait();
01779                 Verify.AreEqual("4,0,20,0", contentPresenterMarginTextBlock.DocumentText);
01780             }
01781         }
01782
01783         [TestMethod]
01784         [TestProperty("TestSuite", "D")]
01785         public void VerifyNavigationViewItemChildrenFlyoutMenuCornerRadius()
01786         {
01787             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "HierarchicalNavigationView Markup Test" }))
01788             {
01789                 Log.Comment("Set PaneDisplayMode to LeftCompact.");
01790                 var panelDisplayModeComboBox = new ComboBox(FindElement.ByName("PaneDisplayModeCombobox"));
01791                 panelDisplayModeComboBox.SelectItemByName("LeftCompact");
01792                 Wait.ForIdle();
01793
01794                 VerifyChildrenFlyoutMenuCornerRadius();
01795
01796                 // Refresh the cache to make sure that the flyout object we are going to be searching for
01797                 // does not return as a false positive due to the caching mechanism.
01798                 ElementCache.Clear();
01799
01800                 Log.Comment("Set PaneDisplayMode to Top.");
01801                 panelDisplayModeComboBox.SelectItemByName("Top");
01802                 Wait.ForIdle();
01803
01804                 VerifyChildrenFlyoutMenuCornerRadius();
01805
01806                 void VerifyChildrenFlyoutMenuCornerRadius()
01807                 {
01808                     Log.Comment("Verify that the children menu flyout used in this test is closed.");
01809                     var childItem = FindElement.ByName("Menu Item 2");
01810                     Verify.IsNull(childItem, "Menu Item 1's children menu flyout should have been closed.");
01811
01812                     Log.Comment("Select Menu Item 1 which should open children flyout.");
01813                     var item = FindElement.ByName("Menu Item 1");
01814                     InputHelper.LeftClick(item);
01815                     Wait.ForIdle();
01816
01817                     childItem = FindElement.ByName("Menu Item 2");
01818                     Verify.IsNotNull(childItem, "Menu Item 1's children menu flyout should have been open.");
01819
01820                     Log.Comment("Get CornerRadius of Menu Item 1's children menu flyout.");
01821                     FindElement.ByName<Button>("GetMenuItem1ChildrenFlyoutCornerRadiusButton").Invoke();
01822
01823                     // A CornerRadius of (8,8,8,8) is the current default value for flyouts.
01824                     TextBlock menuItem1ChildrenFlyoutCornerRadiusTextBlock = new TextBlock(FindElement.ByName("MenuItem1ChildrenFlyoutCornerRadiusTextBlock"));
01825                     Verify.AreEqual("8,8,8,8", menuItem1ChildrenFlyoutCornerRadiusTextBlock.DocumentText);
01826
01827                     // Close flyout
01828                     InputHelper.LeftClick(item);
01829                     Wait.ForIdle();
01830                 }
01831             }
01832         }
01833
01834         [TestMethod]
01835         public void VerifyAddingChildItemsToNavigationViewItem()
01836         {
01837             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "HierarchicalNavigationView Markup Test" }))
01838             {
01839                 Log.Comment("Verify MI19 does not have the child item we are going to look for.");
01840
01841                 Log.Comment("Click on MI19.");
01842                 var menuItem19 = FindElement.ByName("Menu Item 19");
01843                 InputHelper.LeftClick(menuItem19);
01844                 Wait.ForIdle();
01845
01846                 var childItem = FindElement.ByName("Child of MI19");
01847                 Verify.IsNull(childItem, "MI19 should not have this child item.");
01848
01849                 Log.Comment("Programmatically add a child item to MI19.");
01850                 FindElement.ByName<Button>("Add Child Item to MenuItem19").Invoke();
01851
01852                 Log.Comment("Expand MI19.");
01853                 InputHelper.LeftClick(menuItem19);
01854                 Wait.ForIdle();
01855
01856                 Log.Comment("Verify MI19 has the child item we just added.");
01857                 var newChildItem = FindElement.ByName("Child of MI19");
01858                 Verify.IsNotNull(newChildItem, "MI19 should have a new child item.");
01859             }
01860         }
01861
01862         [TestMethod]
01863         public void VerifyNavigationViewItemInPaneFooterHasTemplateSettingBindings()
01864         {
01865             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "PaneFooterTestPage" }))
01866             {
01867                 TextBlock paneFooterNavViewItemWidthTextBlock = new TextBlock(FindElement.ByName("PaneFooterNavViewItemWidth"));
01868                 ComboBox compactPaneLengthComboBox = new ComboBox(FindElement.ByName("CompactPaneLengthComboBox"));
01869                 UIObject getIconColumnWidth = FindElement.ByName("GetIconColumnWidth");
01870
01871                 getIconColumnWidth.Click();
01872
01873                 Log.Comment("Verify IconColumnWidth is binded correctly to SmallerIconWidthProperty");
01874                 Verify.AreEqual("40", paneFooterNavViewItemWidthTextBlock.DocumentText);
01875
01876                 Log.Comment("Change CompactPaneLength to 40px");
01877                 compactPaneLengthComboBox.SelectItemByName("40");
01878                 Wait.ForIdle();
01879
01880                 getIconColumnWidth.Click();
01881                 Wait.ForIdle();
01882
01883                 Verify.AreEqual("32", paneFooterNavViewItemWidthTextBlock.DocumentText);
01884
01885                 Log.Comment("Change CompactPaneLength to 96px");
01886                 compactPaneLengthComboBox.SelectItemByName("96");
01887                 Wait.ForIdle();
01888                 getIconColumnWidth.Click();
01889                 Wait.ForIdle();
01890
01891                 Verify.AreEqual("88", paneFooterNavViewItemWidthTextBlock.DocumentText);
01892             }
01893         }
01894
01895         [TestMethod]
01896         public void VerifyClickingNavigationViewItemInPaneFooterDoesNotCrash()
01897         {
01898             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationView Test" }))
01899             {
01900                 Log.Comment("Click on PaneFooterNavigationViewItem.");
01901                 var paneFooterNavigationViewItem = FindElement.ByName("PaneFooterNavigationViewItem");
01902                 InputHelper.LeftClick(paneFooterNavigationViewItem);
01903                 Wait.ForIdle();
01904             }
01905         }
01906
01907         [TestMethod]
01908         public void VerifyAddingNewItemsFromIndexZero()
01909         {
01910             // Regression test for #46242746
01911             // Before fix, adding new items in this manner would result in
01912             // two NavigationViewItems to show up both named Item 0.
01913             using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "NavigationViewMenuItemsSourcePage" }))
01914             {
01915                 // Verify that "Item 0" does not exist
01916                 var item0 = FindElement.ByName("Item 0");
01917                 Verify.IsNull(item0, "Item 0 should not exist");
01918
01919                 // Verify that "Item 1" does not exist
01920                 var item1 = FindElement.ByName("Item 1");
01921                 Verify.IsNull(item1, "Item 1 should not exist");
01922
01923                 // Find and click the button "BtnInsertItemsFromBeginning"
01924                 var btnInsertItemsFromBeginning = FindElement.ByName<Button>("BtnInsertItemsFromBeginning");
01925                 Verify.IsNotNull(btnInsertItemsFromBeginning, "BtnInsertItemsFromBeginning should be non-null!");
01926                 btnInsertItemsFromBeginning.InvokeAndWait();
01927
01928                 // Verify that "Item 0" exists
01929                 item0 = FindElement.ByName("Item 0");
01930                 Verify.IsNotNull(item0, "Item 0 should exist");
01931
01932                 // Verify that "Item 1" exists
01933                 item1 = FindElement.ByName("Item 1");
01934                 Verify.IsNotNull(item1, "Item 1 should exist");
01935             }
01936         }
01937     }
01938 }
Generated on Sun Dec 1 2024 20:52:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MapControl/MapElementsLayer.h Source File

  • MapControl

MapElementsLayer.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "MapElementsLayer.g.h"
00010 #include "MapElementsLayer.properties.h"
00011 #include "MapLayer.h"
00012 #include "MapElementClickEventArgs.h"
00013 #include "MapElement.h"
00014
00015 class MapElementsLayer :
00016     public ReferenceTracker<MapElementsLayer, winrt::implementation::MapElementsLayerT, MapLayer>,
00017     public MapElementsLayerProperties
00018 {
00019
00020 public:
00021     MapElementsLayer();
00022
00023     winrt::IVector<winrt::hstring> m_elementIds;
00024
00025     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00026     void RaiseMapElementClick(MapElementClickEventArgs const& args);
00027     void OnMapElementsVectorChanged(const winrt::IObservableVector<winrt::MapElement>&, const winrt::Collections::IVectorChangedEventArgs& args);
00028     void SetParentMapControl(const winrt::MapControl& parent);
00029
00030 private:
00031     winrt::weak_ref<winrt::MapControl> m_parentMapControl{ nullptr };
00032     winrt::fire_and_forget HandleMapElementsChanged(const winrt::IObservableVector<winrt::MapElement>&, const winrt::Collections::IVectorChangedEventArgs& args);
00033
00034 };
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SwipeControl/SwipeControl_InteractionTests/SwipeControlTests.cs Source File

  • SwipeControl
  • SwipeControl_InteractionTests

SwipeControlTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00006 using Windows.System.Threading;
00007 using Windows.Foundation;
00008 using Windows.Foundation.Metadata;
00009 using Common;
00010 using System;
00011 using System.Collections.Generic;
00012 using System.Threading;
00013 using System.Threading.Tasks;
00014
00015 using WEX.TestExecution;
00016 using WEX.TestExecution.Markup;
00017 using WEX.Logging.Interop;
00018
00019 using Microsoft.Windows.Apps.Test.Automation;
00020 using Microsoft.Windows.Apps.Test.Foundation;
00021 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00022 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00023 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00024
00025 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00026 {
00027     using Window = Microsoft.Windows.Apps.Test.Foundation.Controls.Window;
00028
00029     [TestClass]
00030     public class SwipeControlTests
00031     {
00032         [ClassInitialize]
00033         [TestProperty("RunAs", "User")]
00034         [TestProperty("Classification", "Integration")]
00035         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00036         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00037         public static void ClassInitialize(TestContext testContext)
00038         {
00039             TestEnvironment.Initialize(testContext);
00040         }
00041
00042         [TestCleanup]
00043         public void TestCleanup()
00044         {
00045             TestCleanupHelper.Cleanup();
00046         }
00047
00048         [TestMethod]
00049         [TestProperty("TestSuite", "A")]
00050         public void CanSwipeToExecuteHorizontal()
00051         {
00052             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00053             {
00054                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00055                 {
00056                     Log.Warning("Test is disabled on phone.");
00057                     return;
00058                 }
00059
00060                 Log.Comment("Navigating to List Items with simple swipe items");
00061                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00062                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00063
00064                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00065                 navigateToSimpleContentsButton.Invoke();
00066                 Wait.ForIdle();
00067
00068                 Log.Comment("Find the SwipeControl1");
00069                 var SwipeControl1 = FindElement.ByName("SwipeControl1");
00070                 Verify.IsNotNull(SwipeControl1);
00071                 Log.Comment("Find the SwipeItem1IdleCheckBox");
00072                 CheckBox SwipeItem1IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem1IdleCheckBox"));
00073                 Verify.IsNotNull(SwipeItem1IdleCheckBox, "Verifying that SwipeItem1IdleCheckBox Button was found");
00074                 Log.Comment("Find the SwipeItem1OpenCheckBox");
00075                 CheckBox SwipeItem1OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem1OpenCheckBox"));
00076                 Verify.IsNotNull(SwipeItem1OpenCheckBox, "Verifying that SwipeItem1OpenCheckBox Button was found");
00077                 Log.Comment("Getting the textblock");
00078                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00079                 Verify.IsNotNull(textblock);
00080
00081                 PerformSwipe(SwipeControl1, Direction.West);
00082                 WaitForChecked(SwipeItem1OpenCheckBox);
00083                 WaitForChecked(SwipeItem1IdleCheckBox);
00084                 WaitForUnchecked(SwipeItem1OpenCheckBox);
00085                 WaitForChecked(SwipeItem1IdleCheckBox);
00086                 Verify.AreEqual("command's text", textblock.DocumentText);
00087
00088                 Log.Comment("Returning to the main Swipe test page");
00089                 TestSetupHelper.GoBack();
00090             }
00091         }
00092
00093         [TestMethod]
00094         [TestProperty("TestSuite", "A")]
00095         public void CanSwipeToExecuteVertical()
00096         {
00097             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00098             {
00099                 Log.Comment("Navigating to List Items with simple swipe items");
00100                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00101                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00102
00103                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00104                 navigateToSimpleContentsButton.Invoke();
00105                 Wait.ForIdle();
00106
00107                 Log.Comment("Find the SwipeControl8");
00108                 var SwipeControl8 = FindElement.ByName("SwipeControl8");
00109                 Verify.IsNotNull(SwipeControl8);
00110                 Log.Comment("Find the SwipeItem8IdleCheckBox");
00111                 CheckBox SwipeItem8IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem8IdleCheckBox"));
00112                 Verify.IsNotNull(SwipeItem8IdleCheckBox, "Verifying that SwipeItem8IdleCheckBox Button was found");
00113                 Log.Comment("Find the SwipeItem8OpenCheckBox");
00114                 CheckBox SwipeItem8OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem8OpenCheckBox"));
00115                 Verify.IsNotNull(SwipeItem8OpenCheckBox, "Verifying that SwipeItem8OpenCheckBox Button was found");
00116                 Log.Comment("Getting the textblock");
00117                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00118                 Verify.IsNotNull(textblock);
00119
00120                 PerformSwipe(SwipeControl8, Direction.North);
00121                 WaitForChecked(SwipeItem8OpenCheckBox);
00122                 WaitForChecked(SwipeItem8IdleCheckBox);
00123                 WaitForUnchecked(SwipeItem8OpenCheckBox);
00124                 WaitForChecked(SwipeItem8IdleCheckBox);
00125                 Verify.AreEqual("ExecuteItem", textblock.DocumentText);
00126
00127                 Log.Comment("Returning to the main Swipe test page");
00128                 TestSetupHelper.GoBack();
00129             }
00130         }
00131
00132         [TestMethod]
00133         [TestProperty("TestSuite", "A")]
00134         public void CanClearItemsWithoutCrashing()
00135         {
00136             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00137             {
00138                 Log.Comment("Navigating to clear items test page");
00139                 UIObject navigateToClearPageObject = FindElement.ByName("navigateToClear");
00140                 Verify.IsNotNull(navigateToClearPageObject, "Verifying that navigateToClear Button was found");
00141
00142                 Button navigateToClearPageButton = new Button(navigateToClearPageObject);
00143                 navigateToClearPageButton.Invoke();
00144                 Wait.ForIdle();
00145
00146                 Log.Comment("Find FindItemsSum textblock");
00147                 TextBlock sumOfSwipeItemsCount = new TextBlock(FindElement.ByName("SwipeItemsChildSum"));
00148                 Verify.IsNotNull(sumOfSwipeItemsCount);
00149                 Verify.AreEqual("2", sumOfSwipeItemsCount.GetText());
00150
00151                 Log.Comment("Find clear SwipeItems button");
00152                 Button clearItemsButton = new Button(FindElement.ByName("ClearItemsButton"));
00153                 Verify.IsNotNull(clearItemsButton);
00154                 clearItemsButton.Invoke();
00155                 Wait.ForIdle();
00156                 Verify.AreEqual("0", sumOfSwipeItemsCount.GetText());
00157
00158
00159                 Log.Comment("Find add SwipeItem button");
00160                 Button addItemsButton = new Button(FindElement.ByName("AddItemsButton"));
00161                 Verify.IsNotNull(addItemsButton);
00162                 addItemsButton.Invoke();
00163                 Wait.ForIdle();
00164                 // Only adds horizontal items, see test app for explanation
00165                 Verify.AreEqual("1", sumOfSwipeItemsCount.GetText());
00166
00167                 Log.Comment("clearing items again");
00168                 clearItemsButton.Invoke();
00169                 Wait.ForIdle();
00170                 Verify.AreEqual("0", sumOfSwipeItemsCount.GetText());
00171
00172
00173             }
00174         }
00175
00176
00177         [TestMethod]
00178         [TestProperty("TestSuite", "A")]
00179         public void CanSwipeAndTapFirstRevealedItemHorizontal()
00180         {
00181             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00182             {
00183                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00184                 {
00185                     Log.Warning("Test is disabled on phone.");
00186                     return;
00187                 }
00188
00189                 Log.Comment("Navigating to List Items with simple swipe items");
00190                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00191                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00192
00193                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00194                 navigateToSimpleContentsButton.Invoke();
00195                 Wait.ForIdle();
00196
00197                 Log.Comment("Find the SwipeControl4");
00198                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
00199                 Verify.IsNotNull(SwipeControl4);
00200                 Log.Comment("Find the SwipeItem4IdleCheckBox");
00201                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
00202                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
00203                 Log.Comment("Find the SwipeItem4OpenCheckBox");
00204                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
00205                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
00206                 Log.Comment("Getting the textblock");
00207                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00208                 Verify.IsNotNull(textblock);
00209
00210                 PerformSwipe(SwipeControl4, Direction.East);
00211                 WaitForChecked(SwipeItem4OpenCheckBox);
00212                 WaitForChecked(SwipeItem4IdleCheckBox);
00213                 TapItem("RevealItem1");
00214                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
00215                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
00216                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00217
00218                 Log.Comment("Returning to the main Swipe test page");
00219                 TestSetupHelper.GoBack();
00220             }
00221         }
00222
00223         [TestMethod]
00224         [TestProperty("TestSuite", "A")]
00225         public void CanSwipeAndTapSecondtRevealedItemHorizontal()
00226         {
00227             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00228             {
00229                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00230                 {
00231                     Log.Warning("Test is disabled on phone.");
00232                     return;
00233                 }
00234
00235                 Log.Comment("Navigating to List Items with simple swipe items");
00236                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00237                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00238
00239                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00240                 navigateToSimpleContentsButton.Invoke();
00241                 Wait.ForIdle();
00242
00243                 Log.Comment("Find the SwipeControl4");
00244                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
00245                 Verify.IsNotNull(SwipeControl4);
00246                 Log.Comment("Find the SwipeItem4IdleCheckBox");
00247                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
00248                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
00249                 Log.Comment("Find the SwipeItem4OpenCheckBox");
00250                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
00251                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
00252                 Log.Comment("Getting the textblock");
00253                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00254                 Verify.IsNotNull(textblock);
00255
00256                 PerformSwipe(SwipeControl4, Direction.East);
00257                 WaitForChecked(SwipeItem4OpenCheckBox);
00258                 WaitForChecked(SwipeItem4IdleCheckBox);
00259                 TapItem("RevealItem2");
00260                 WaitForUnchecked(SwipeItem4OpenCheckBox);
00261                 WaitForChecked(SwipeItem4IdleCheckBox);
00262                 Verify.AreEqual("RevealItem2", textblock.DocumentText);
00263
00264                 Log.Comment("Returning to the main Swipe test page");
00265                 TestSetupHelper.GoBack();
00266             }
00267         }
00268
00269         [TestMethod]
00270         [TestProperty("TestSuite", "A")]
00271         public void CanSwipeAndTapFirstRevealedItemVertical()
00272         {
00273             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00274             {
00275                 Log.Comment("Navigating to List Items with simple swipe items");
00276                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00277                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00278
00279                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00280                 navigateToSimpleContentsButton.Invoke();
00281                 Wait.ForIdle();
00282
00283                 Log.Comment("Find the SwipeControl8");
00284                 var SwipeControl8 = FindElement.ByName("SwipeControl8");
00285                 Verify.IsNotNull(SwipeControl8);
00286                 Log.Comment("Find the SwipeItem8IdleCheckBox");
00287                 CheckBox SwipeItem8IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem8IdleCheckBox"));
00288                 Verify.IsNotNull(SwipeItem8IdleCheckBox, "Verifying that SwipeItem8IdleCheckBox Button was found");
00289                 Log.Comment("Find the SwipeItem8OpenCheckBox");
00290                 CheckBox SwipeItem8OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem8OpenCheckBox"));
00291                 Verify.IsNotNull(SwipeItem8OpenCheckBox, "Verifying that SwipeItem8OpenCheckBox Button was found");
00292                 Log.Comment("Getting the textblock");
00293                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00294                 Verify.IsNotNull(textblock);
00295
00296                 PerformSwipe(SwipeControl8, Direction.South);
00297                 WaitForChecked(SwipeItem8OpenCheckBox);
00298                 WaitForChecked(SwipeItem8IdleCheckBox);
00299                 TapItem("RevealItem1");
00300                 Verify.AreEqual(ToggleState.On, SwipeItem8OpenCheckBox.ToggleState);
00301                 Verify.AreEqual(ToggleState.On, SwipeItem8IdleCheckBox.ToggleState);
00302                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00303
00304                 Log.Comment("Returning to the main Swipe test page");
00305                 TestSetupHelper.GoBack();
00306             }
00307         }
00308
00309         [TestMethod]
00310         [TestProperty("TestSuite", "A")]
00311         public void CanSwipeAndTapSecondRevealedItemVertical()
00312         {
00313             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00314             {
00315                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00316                 {
00317                     Log.Warning("Test is disabled on phone.");
00318                     return;
00319                 }
00320
00321                 Log.Comment("Navigating to List Items with simple swipe items");
00322                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00323                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00324
00325                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00326                 navigateToSimpleContentsButton.Invoke();
00327                 Wait.ForIdle();
00328
00329                 Log.Comment("Find the SwipeControl8");
00330                 var SwipeControl8 = FindElement.ByName("SwipeControl8");
00331                 Verify.IsNotNull(SwipeControl8);
00332                 Log.Comment("Find the SwipeItem8IdleCheckBox");
00333                 CheckBox SwipeItem8IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem8IdleCheckBox"));
00334                 Verify.IsNotNull(SwipeItem8IdleCheckBox, "Verifying that SwipeItem8IdleCheckBox Button was found");
00335                 Log.Comment("Find the SwipeItem8OpenCheckBox");
00336                 CheckBox SwipeItem8OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem8OpenCheckBox"));
00337                 Verify.IsNotNull(SwipeItem8OpenCheckBox, "Verifying that SwipeItem8OpenCheckBox Button was found");
00338                 Log.Comment("Getting the textblock");
00339                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00340                 Verify.IsNotNull(textblock);
00341
00342                 PerformSwipe(SwipeControl8, Direction.South);
00343                 WaitForChecked(SwipeItem8OpenCheckBox);
00344                 WaitForChecked(SwipeItem8IdleCheckBox);
00345                 TapItem("RevealItem2");
00346                 WaitForUnchecked(SwipeItem8OpenCheckBox);
00347                 WaitForChecked(SwipeItem8IdleCheckBox);
00348                 Verify.AreEqual("RevealItem2", textblock.DocumentText);
00349
00350                 Log.Comment("Returning to the main Swipe test page");
00351                 TestSetupHelper.GoBack();
00352             }
00353         }
00354
00355         [TestMethod]// replace with Dmitry's more reliable method
00356         [TestProperty("Ignore", "True")]  // Disabled as per tracking issue #3125
00357         [TestProperty("TestSuite", "A")]
00358         public void SwipeDoesntJumpWhenItReverts()
00359         {
00360             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00361             {
00362                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00363                 {
00364                     Log.Warning("Test is disabled on phone.");
00365                     return;
00366                 }
00367
00368                 Log.Comment("Navigating to List Items with simple swipe items");
00369                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00370                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00371
00372                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00373                 navigateToSimpleContentsButton.Invoke();
00374                 Wait.ForIdle();
00375
00376                 var XPosition = new TextBlock(FindElement.ByName("PositionX"));
00377                 Verify.IsNotNull(XPosition);
00378                 //SwipeTapAndVerify("SwipeControl4", Direction.East, "RevealItem1", "RevealItem1");
00379                 Verify.AreEqual("146", XPosition.DocumentText);
00380                 KeyboardHelper.PressKey(Key.PageDown);
00381
00382                 bool pass = false;
00383                 while (XPosition.DocumentText != 0.ToString())
00384                 {
00385                     double xPoistion = 0;
00386                     Double.TryParse(XPosition.DocumentText.ToString(), out xPoistion);
00387
00388                     // ensures that we get an intermediate value at least once.
00389                     if (xPoistion < 146 && xPoistion > 0)
00390                     {
00391                         pass = true;
00392                     }
00393                 }
00394
00395                 Verify.AreEqual(true, pass);
00396                 //EnsureAllSwipesAreDismissed();
00397
00398                 Log.Comment("Returning to the main Swipe test page");
00399                 TestSetupHelper.GoBack();
00400             }
00401         }
00402
00403
00404         [TestMethod]
00405         [TestProperty("TestSuite", "A")]
00406         public void CanSwipeAndTapBothItemsHorizontal()
00407         {
00408             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00409             {
00410                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00411                 {
00412                     Log.Warning("Test is disabled on phone.");
00413                     return;
00414                 }
00415
00416                 Log.Comment("Navigating to List Items with simple swipe items");
00417                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00418                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00419
00420                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00421                 navigateToSimpleContentsButton.Invoke();
00422                 Wait.ForIdle();
00423
00424                 Log.Comment("Find the SwipeControl4");
00425                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
00426                 Verify.IsNotNull(SwipeControl4);
00427                 Log.Comment("Find the SwipeItem4IdleCheckBox");
00428                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
00429                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
00430                 Log.Comment("Find the SwipeItem4OpenCheckBox");
00431                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
00432                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
00433                 Log.Comment("Getting the textblock");
00434                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00435                 Verify.IsNotNull(textblock);
00436
00437                 PerformSwipe(SwipeControl4, Direction.East);
00438                 WaitForChecked(SwipeItem4OpenCheckBox);
00439                 WaitForChecked(SwipeItem4IdleCheckBox);
00440                 TapItem("RevealItem1");
00441                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
00442                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
00443                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00444                 TapItem("RevealItem2");
00445                 WaitForUnchecked(SwipeItem4OpenCheckBox);
00446                 WaitForChecked(SwipeItem4IdleCheckBox);
00447                 Verify.AreEqual("RevealItem2", textblock.DocumentText);
00448
00449                 Log.Comment("Returning to the main Swipe test page");
00450                 TestSetupHelper.GoBack();
00451             }
00452         }
00453
00454         [TestMethod]
00455         [TestProperty("TestSuite", "A")]
00456         public void CanSwipeMultipleItemsWithSameSwipeService()
00457         {
00458             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00459             {
00460                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00461                 {
00462                     Log.Warning("Test is disabled on phone.");
00463                     return;
00464                 }
00465
00466                 Log.Comment("Navigating to List Items with simple swipe items");
00467                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00468                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00469
00470                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00471                 navigateToSimpleContentsButton.Invoke();
00472                 Wait.ForIdle();
00473
00474                 Log.Comment("Find the SwipeControl2");
00475                 var SwipeControl2 = FindElement.ByName("SwipeControl2");
00476                 Verify.IsNotNull(SwipeControl2);
00477                 Log.Comment("Find the SwipeItem2IdleCheckBox");
00478                 CheckBox SwipeItem2IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem2IdleCheckBox"));
00479                 Verify.IsNotNull(SwipeItem2IdleCheckBox, "Verifying that SwipeItem2IdleCheckBox Button was found");
00480                 Log.Comment("Find the SwipeItem2OpenCheckBox");
00481                 CheckBox SwipeItem2OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem2OpenCheckBox"));
00482                 Verify.IsNotNull(SwipeItem2OpenCheckBox, "Verifying that SwipeItem2OpenCheckBox Button was found");
00483                 Log.Comment("Find the SwipeControl4");
00484                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
00485                 Verify.IsNotNull(SwipeControl4);
00486                 Log.Comment("Find the SwipeItem4IdleCheckBox");
00487                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
00488                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
00489                 Log.Comment("Find the SwipeItem4OpenCheckBox");
00490                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
00491                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
00492                 Log.Comment("Getting the textblock");
00493                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00494                 Verify.IsNotNull(textblock);
00495
00496                 PerformSwipe(SwipeControl4, Direction.East);
00497                 WaitForChecked(SwipeItem4OpenCheckBox);
00498                 WaitForChecked(SwipeItem4IdleCheckBox);
00499                 TapItem("RevealItem1");
00500                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
00501                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
00502                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00503                 PerformSwipe(SwipeControl2, Direction.East);
00504                 WaitForUnchecked(SwipeItem4OpenCheckBox);
00505                 WaitForChecked(SwipeItem4IdleCheckBox);
00506                 WaitForChecked(SwipeItem2OpenCheckBox);
00507                 WaitForChecked(SwipeItem2IdleCheckBox);
00508                 TapItem("RevealItem1");
00509                 Verify.AreEqual(ToggleState.On, SwipeItem2OpenCheckBox.ToggleState);
00510                 Verify.AreEqual(ToggleState.On, SwipeItem2IdleCheckBox.ToggleState);
00511                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00512
00513                 Log.Comment("Returning to the main Swipe test page");
00514                 TestSetupHelper.GoBack();
00515             }
00516         }
00517
00518         [TestMethod]
00519         [TestProperty("TestSuite", "A")]
00520          public void CanAddSameSwipeItemsInBothSidesHorizontal()
00521         {
00522             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00523             {
00524                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00525                 {
00526                     Log.Warning("Test is disabled on phone.");
00527                     return;
00528                 }
00529
00530                 Log.Comment("Navigating to List Items with simple swipe items");
00531                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00532                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00533
00534                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00535                 navigateToSimpleContentsButton.Invoke();
00536                 Wait.ForIdle();
00537
00538                 Log.Comment("Find the SwipeControl4");
00539                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
00540                 Verify.IsNotNull(SwipeControl4);
00541                 Log.Comment("Find the SwipeItem4IdleCheckBox");
00542                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
00543                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
00544                 Log.Comment("Find the SwipeItem4OpenCheckBox");
00545                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
00546                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
00547                 Log.Comment("Getting the textblock");
00548                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00549                 Verify.IsNotNull(textblock);
00550
00551                 PerformSwipe(SwipeControl4, Direction.East);
00552                 WaitForChecked(SwipeItem4OpenCheckBox);
00553                 WaitForChecked(SwipeItem4IdleCheckBox);
00554                 TapItem("RevealItem2");
00555                 WaitForUnchecked(SwipeItem4OpenCheckBox);
00556                 WaitForChecked(SwipeItem4IdleCheckBox);
00557                 Verify.AreEqual("RevealItem2", textblock.DocumentText);
00558
00559                 PerformSwipe(SwipeControl4, Direction.West);
00560                 WaitForChecked(SwipeItem4OpenCheckBox);
00561                 WaitForChecked(SwipeItem4IdleCheckBox);
00562                 TapItem("RevealItem1");
00563                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
00564                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
00565                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00566
00567                 Log.Comment("Returning to the main Swipe test page");
00568                 TestSetupHelper.GoBack();
00569             }
00570         }
00571
00572         [TestMethod]
00573         [TestProperty("TestSuite", "A")]
00574         public void ValidateItemsLessThanThresholdDontRevertHorizontal() // add a vertical equivalent
00575         {
00576             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00577             {
00578                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00579                 {
00580                     Log.Warning("Test is disabled on phone.");
00581                     return;
00582                 }
00583
00584                 Log.Comment("Navigating to List Items with simple swipe items");
00585                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00586                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00587
00588                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00589                 navigateToSimpleContentsButton.Invoke();
00590                 Wait.ForIdle();
00591
00592                 Log.Comment("Find the SwipeControl2");
00593                 var SwipeControl2 = FindElement.ByName("SwipeControl2");
00594                 Verify.IsNotNull(SwipeControl2);
00595                 Log.Comment("Find the SwipeItem2IdleCheckBox");
00596                 CheckBox SwipeItem2IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem2IdleCheckBox"));
00597                 Verify.IsNotNull(SwipeItem2IdleCheckBox, "Verifying that SwipeItem2IdleCheckBox Button was found");
00598                 Log.Comment("Find the SwipeItem2OpenCheckBox");
00599                 CheckBox SwipeItem2OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem2OpenCheckBox"));
00600                 Verify.IsNotNull(SwipeItem2OpenCheckBox, "Verifying that SwipeItem2OpenCheckBox Button was found");
00601                 Log.Comment("Getting the textblock");
00602                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00603                 Verify.IsNotNull(textblock);
00604
00605                 PerformSwipe(SwipeControl2, Direction.East);
00606                 WaitForChecked(SwipeItem2OpenCheckBox);
00607                 WaitForChecked(SwipeItem2IdleCheckBox);
00608                 TapItem("RevealItem1");
00609                 Verify.AreEqual(ToggleState.On, SwipeItem2OpenCheckBox.ToggleState);
00610                 Verify.AreEqual(ToggleState.On, SwipeItem2IdleCheckBox.ToggleState);
00611                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00612
00613                 Log.Comment("Returning to the main Swipe test page");
00614                 TestSetupHelper.GoBack();
00615             }
00616         }
00617
00618         [TestMethod]
00619         [TestProperty("TestSuite", "A")]
00620         public void ValidateSwipeDoesntCrashOnAddingMoreItemsThanItsSizeHorizontal()
00621         {
00622             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00623             {
00624                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00625                 {
00626                     Log.Warning("Test is disabled on phone.");
00627                     return;
00628                 }
00629
00630                 Log.Comment("Navigating to List Items with simple swipe items");
00631                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00632                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00633
00634                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00635                 navigateToSimpleContentsButton.Invoke();
00636                 Wait.ForIdle();
00637
00638                 Log.Comment("Find the SwipeControl3");
00639                 var SwipeControl3 = FindElement.ByName("SwipeControl3");
00640                 Verify.IsNotNull(SwipeControl3);
00641                 Log.Comment("Find the SwipeItem3IdleCheckBox");
00642                 CheckBox SwipeItem3IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem3IdleCheckBox"));
00643                 Verify.IsNotNull(SwipeItem3IdleCheckBox, "Verifying that SwipeItem3IdleCheckBox Button was found");
00644                 Log.Comment("Find the SwipeItem3OpenCheckBox");
00645                 CheckBox SwipeItem3OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem3OpenCheckBox"));
00646                 Verify.IsNotNull(SwipeItem3OpenCheckBox, "Verifying that SwipeItem3OpenCheckBox Button was found");
00647                 Log.Comment("Getting the textblock");
00648                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00649                 Verify.IsNotNull(textblock);
00650
00651                 PerformSwipe(SwipeControl3, Direction.East);
00652                 WaitForChecked(SwipeItem3OpenCheckBox);
00653                 WaitForChecked(SwipeItem3IdleCheckBox);
00654                 TapItem("RevealItem3");
00655                 Verify.AreEqual(ToggleState.On, SwipeItem3OpenCheckBox.ToggleState);
00656                 Verify.AreEqual(ToggleState.On, SwipeItem3IdleCheckBox.ToggleState);
00657                 Verify.AreEqual("RevealItem3", textblock.DocumentText);
00658
00659                 Log.Comment("Returning to the main Swipe test page");
00660                 TestSetupHelper.GoBack();
00661             }
00662         }
00663
00664         [TestMethod]
00665         [TestProperty("Description", "When swiping items not set on one side, the main content shouldn't move, and it shouldn't throw an access violation exception.")]
00666         [TestProperty("TestSuite", "A")]
00667         public void ValidateSwipeCanHaveNoItemsOnASideHorizontal()
00668         {
00669             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00670             {
00671                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00672                 {
00673                     Log.Warning("Test is disabled on phone.");
00674                     return;
00675                 }
00676
00677                 Log.Comment("Navigating to List Items with simple swipe items");
00678                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00679                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00680
00681                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00682                 navigateToSimpleContentsButton.Invoke();
00683                 Wait.ForIdle();
00684
00685                 Log.Comment("Get the two swipe controls.");
00686                 var swipeControl8 = FindElement.ByName("SwipeControl8");
00687
00688                 Verify.IsNotNull(swipeControl8);
00689
00690                 Log.Comment("Get the two swipe controls.");
00691                 var swipeControl9 = FindElement.ByName("SwipeControl9");
00692
00693                 Verify.IsNotNull(swipeControl8);
00694                 Verify.IsNotNull(swipeControl9);
00695
00696                 // Verifying it doesn't crash
00697                 // same note as before, it might not open, and we still pass the test.
00698                 PerformSwipe(swipeControl8, Direction.East);
00699                 PerformSwipe(swipeControl9, Direction.West);
00700
00701                 Log.Comment("Returning to the main Swipe test page");
00702                 TestSetupHelper.GoBack();
00703             }
00704         }
00705
00706         [TestMethod]
00707         [TestProperty("TestSuite", "A")]
00708         public void PressingAnyKeyDismissesSwipe()
00709         {
00710             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00711             {
00712                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00713                 {
00714                     Log.Warning("Test is disabled on phone.");
00715                     return;
00716                 }
00717
00718                 Log.Comment("Navigating to List Items with simple swipe items");
00719                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00720                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00721
00722                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00723                 navigateToSimpleContentsButton.Invoke();
00724                 Wait.ForIdle();
00725
00726                 Log.Comment("Find the SwipeControl4");
00727                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
00728                 Verify.IsNotNull(SwipeControl4);
00729                 Log.Comment("Find the SwipeItem4IdleCheckBox");
00730                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
00731                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
00732                 Log.Comment("Find the SwipeItem4OpenCheckBox");
00733                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
00734                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
00735                 Log.Comment("Getting the textblock");
00736                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00737                 Verify.IsNotNull(textblock);
00738
00739                 PerformSwipe(SwipeControl4, Direction.East);
00740                 WaitForChecked(SwipeItem4OpenCheckBox);
00741                 WaitForChecked(SwipeItem4IdleCheckBox);
00742                 TapItem("RevealItem1");
00743                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
00744                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
00745                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00746                 KeyboardHelper.PressKey(Key.PageDown);
00747                 WaitForUnchecked(SwipeItem4OpenCheckBox);
00748                 WaitForChecked(SwipeItem4IdleCheckBox);
00749
00750                 Log.Comment("Returning to the main Swipe test page");
00751                 TestSetupHelper.GoBack();
00752             }
00753         }
00754
00755         [TestMethod]
00756         [TestProperty("TestSuite", "A")]
00757         [TestProperty("Ignore", "True")] // TODO 29556945: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00758         public void TogglingTheWindowStateDismissesSwipe()
00759         {
00760             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00761             {
00762                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00763                 {
00764                     Log.Warning("Test is disabled on phone.");
00765                     return;
00766                 }
00767
00768                 Log.Comment("Navigating to List Items with simple swipe items");
00769                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00770                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00771
00772                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00773                 navigateToSimpleContentsButton.Invoke();
00774                 Wait.ForIdle();
00775
00776                 Log.Comment("Find the SwipeControl4");
00777                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
00778                 Verify.IsNotNull(SwipeControl4);
00779                 Log.Comment("Find the SwipeItem4IdleCheckBox");
00780                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
00781                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
00782                 Log.Comment("Find the SwipeItem4OpenCheckBox");
00783                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
00784                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
00785                 Log.Comment("Getting the textblock");
00786                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00787                 Verify.IsNotNull(textblock);
00788
00789                 Window window = new Window(TestEnvironment.Application.ApplicationFrameWindow);
00790                 WindowVisualState initialVisualState = window.WindowVisualState;
00791                 WindowVisualState desiredVisualState;
00792
00793                 if(initialVisualState == WindowVisualState.Normal)
00794                 {
00795                     desiredVisualState = WindowVisualState.Maximized;
00796                 }
00797                 else
00798                 {
00799                     desiredVisualState = WindowVisualState.Normal;
00800                 }
00801
00802                 PerformSwipe(SwipeControl4, Direction.East);
00803                 WaitForChecked(SwipeItem4OpenCheckBox);
00804                 WaitForChecked(SwipeItem4IdleCheckBox);
00805                 TapItem("RevealItem1");
00806                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
00807                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
00808                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00809                 // Maximize the app, which will also trigger it to supsend. Wait for Suspending event from app.
00810                 Log.Comment("Toggling the window's state...");
00811                 window.SetWindowVisualState(desiredVisualState);
00812                 WaitForUnchecked(SwipeItem4OpenCheckBox);
00813                 WaitForChecked(SwipeItem4IdleCheckBox);
00814
00815
00816                 window.SetWindowVisualState(WindowVisualState.Maximized);
00817                 Log.Comment("Returning to the main Swipe test page");
00818                 TestSetupHelper.GoBack();
00819             }
00820         }
00821
00822         [TestMethod]
00823         [TestProperty("TestSuite", "A")]
00824         public void SwipeIsNotTabStop()
00825         {
00826             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00827             {
00828                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00829                 {
00830                     Log.Warning("Test is disabled on phone.");
00831                     return;
00832                 }
00833
00834                 Log.Comment("Navigating to List Items with simple swipe items");
00835                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00836                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00837
00838                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00839                 navigateToSimpleContentsButton.Invoke();
00840                 Wait.ForIdle();
00841
00842                 Log.Comment("Getting swipe controls.");
00843                 var swipeControl1 = FindElement.ByName("SwipeControl1");
00844                 var swipeControl2 = FindElement.ByName("SwipeControl2");
00845                 Verify.IsNotNull(swipeControl1);
00846                 Verify.IsNotNull(swipeControl2);
00847
00848                 FocusHelper.SetFocus(swipeControl1);
00849                 Verify.IsTrue(swipeControl1.HasKeyboardFocus);
00850                 KeyboardHelper.PressKey(Key.Tab);
00851                 Verify.IsTrue(swipeControl2.HasKeyboardFocus);
00852
00853                 Log.Comment("Returning to the main Swipe test page");
00854                 TestSetupHelper.GoBack();
00855             }
00856         }
00857
00858         [TestMethod]
00859         [TestProperty("TestSuite", "B")]
00860         public void AdditionalGridDoesntOverExtendHorizontal()
00861         {
00862             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00863             {
00864                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00865                 {
00866                     Log.Warning("Test is disabled on phone.");
00867                     return;
00868                 }
00869
00870                 Log.Comment("Navigating to List Items with simple swipe items");
00871                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00872                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00873
00874                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00875                 navigateToSimpleContentsButton.Invoke();
00876                 Wait.ForIdle();
00877
00878                 var textbox = new TextBlock(FindElement.ByName("TextBox"));
00879                 Verify.IsNotNull(textbox);
00880
00881                 PerformSwipe(FindElement.ByName("SwipeControl3"), Direction.West);
00882
00883                 Verify.AreEqual("372, 284", textbox.DocumentText);
00884                 TapItem("Scale Up");
00885                 Verify.AreEqual("672, 284", textbox.DocumentText);
00886                 TapItem("Scale Down");
00887                 Verify.AreEqual("372, 284", textbox.DocumentText);
00888
00889                 Log.Comment("Returning to the main Swipe test page");
00890                 TestSetupHelper.GoBack();
00891             }
00892         }
00893
00894         [TestMethod]
00895         [TestProperty("TestSuite", "B")]
00896         public void ContentGridDoesntOverExtendHorizontal()
00897         {
00898             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00899             {
00900                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00901                 {
00902                     Log.Warning("Test is disabled on phone.");
00903                     return;
00904                 }
00905
00906                 Log.Comment("Navigating to List Items with simple swipe items");
00907                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00908                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00909
00910                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00911                 navigateToSimpleContentsButton.Invoke();
00912                 Wait.ForIdle();
00913
00914                 Log.Comment("Find the SwipeControl1");
00915                 var SwipeControl1 = FindElement.ByName("SwipeControl1");
00916                 Verify.IsNotNull(SwipeControl1);
00917                 Log.Comment("Find the SwipeItem1IdleCheckBox");
00918                 CheckBox SwipeItem1IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem1IdleCheckBox"));
00919                 Verify.IsNotNull(SwipeItem1IdleCheckBox, "Verifying that SwipeItem1IdleCheckBox Button was found");
00920                 Log.Comment("Find the SwipeItem1OpenCheckBox");
00921                 CheckBox SwipeItem1OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem1OpenCheckBox"));
00922                 Verify.IsNotNull(SwipeItem1OpenCheckBox, "Verifying that SwipeItem1OpenCheckBox Button was found");
00923                 Log.Comment("Getting the textblock");
00924                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00925                 Verify.IsNotNull(textblock);
00926
00927                 PerformSwipe(SwipeControl1, Direction.East);
00928                 WaitForChecked(SwipeItem1OpenCheckBox);
00929                 WaitForChecked(SwipeItem1IdleCheckBox);
00930                 WaitForUnchecked(SwipeItem1OpenCheckBox);
00931                 WaitForChecked(SwipeItem1IdleCheckBox);
00932                 Verify.AreEqual("Scale Up", textblock.DocumentText);
00933
00934                 var textbox = new TextBlock(FindElement.ByName("TextBox"));
00935                 Verify.IsNotNull(textbox);
00936
00937                 Verify.AreEqual("672, 672", textbox.DocumentText);
00938
00939                 Log.Comment("Returning to the main Swipe test page");
00940                 TestSetupHelper.GoBack();
00941             }
00942         }
00943
00944         [TestMethod]
00945         [TestProperty("TestSuite", "B")]
00946         public void CantOverSwipeToTheOtherSideWhenSwipeItemsAreRevealedHorizontal()
00947         {
00948             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00949             {
00950                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00951                 {
00952                     Log.Warning("Test is disabled on phone.");
00953                     return;
00954                 }
00955
00956                 Log.Comment("Navigating to List Items with simple swipe items");
00957                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
00958                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
00959
00960                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
00961                 navigateToSimpleContentsButton.Invoke();
00962                 Wait.ForIdle();
00963
00964                 Log.Comment("Find the SwipeControl2");
00965                 var SwipeControl2 = FindElement.ByName("SwipeControl2");
00966                 Verify.IsNotNull(SwipeControl2);
00967                 Log.Comment("Find the SwipeItem2IdleCheckBox");
00968                 CheckBox SwipeItem2IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem2IdleCheckBox"));
00969                 Verify.IsNotNull(SwipeItem2IdleCheckBox, "Verifying that SwipeItem2IdleCheckBox Button was found");
00970                 Log.Comment("Find the SwipeItem2OpenCheckBox");
00971                 CheckBox SwipeItem2OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem2OpenCheckBox"));
00972                 Verify.IsNotNull(SwipeItem2OpenCheckBox, "Verifying that SwipeItem2OpenCheckBox Button was found");
00973                 Log.Comment("Getting the textblock");
00974                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
00975                 Verify.IsNotNull(textblock);
00976
00977                 PerformSwipe(SwipeControl2, Direction.East);
00978                 WaitForChecked(SwipeItem2OpenCheckBox);
00979                 WaitForChecked(SwipeItem2IdleCheckBox);
00980                 TapItem("RevealItem1");
00981                 Verify.AreEqual(ToggleState.On, SwipeItem2OpenCheckBox.ToggleState);
00982                 Verify.AreEqual(ToggleState.On, SwipeItem2IdleCheckBox.ToggleState);
00983                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00984                 PerformSwipe(SwipeControl2, Direction.West);
00985                 WaitForUnchecked(SwipeItem2OpenCheckBox);
00986                 WaitForChecked(SwipeItem2IdleCheckBox);
00987                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
00988
00989                 Log.Comment("Returning to the main Swipe test page");
00990                 TestSetupHelper.GoBack();
00991             }
00992         }
00993
00994         [TestMethod]
00995         [TestProperty("TestSuite", "B")]
00996         public void CantOverSwipeToTheOtherSideWhenSwipeItemsAreRevealedVertical()
00997         {
00998             using (var setup = new TestSetupHelper("SwipeControl Tests"))
00999             {
01000                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
01001                 {
01002                     Log.Warning("Test is disabled on phone.");
01003                     return;
01004                 }
01005
01006                 Log.Comment("Navigating to List Items with simple swipe items");
01007                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01008                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01009
01010                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01011                 navigateToSimpleContentsButton.Invoke();
01012                 Wait.ForIdle();
01013
01014                 Log.Comment("Find the SwipeControl8");
01015                 var SwipeControl8 = FindElement.ByName("SwipeControl8");
01016                 Verify.IsNotNull(SwipeControl8);
01017                 Log.Comment("Find the SwipeItem8IdleCheckBox");
01018                 CheckBox SwipeItem8IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem8IdleCheckBox"));
01019                 Verify.IsNotNull(SwipeItem8IdleCheckBox, "Verifying that SwipeItem8IdleCheckBox Button was found");
01020                 Log.Comment("Find the SwipeItem8OpenCheckBox");
01021                 CheckBox SwipeItem8OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem8OpenCheckBox"));
01022                 Verify.IsNotNull(SwipeItem8OpenCheckBox, "Verifying that SwipeItem8OpenCheckBox Button was found");
01023                 Log.Comment("Getting the textblock");
01024                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01025                 Verify.IsNotNull(textblock);
01026
01027                 PerformSwipe(SwipeControl8, Direction.South);
01028                 WaitForChecked(SwipeItem8OpenCheckBox);
01029                 WaitForChecked(SwipeItem8IdleCheckBox);
01030                 TapItem("RevealItem1");
01031                 Verify.AreEqual(ToggleState.On, SwipeItem8OpenCheckBox.ToggleState);
01032                 Verify.AreEqual(ToggleState.On, SwipeItem8IdleCheckBox.ToggleState);
01033                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
01034                 PerformSwipe(SwipeControl8, Direction.North);
01035                 WaitForUnchecked(SwipeItem8OpenCheckBox);
01036                 WaitForChecked(SwipeItem8IdleCheckBox);
01037                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
01038
01039                 Log.Comment("Returning to the main Swipe test page");
01040                 TestSetupHelper.GoBack();
01041             }
01042         }
01043
01044         [TestMethod]
01045         [TestProperty("TestSuite", "B")]
01046         public void SwipeDismissThenSwipe()
01047         {
01048             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01049             {
01050                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
01051                 {
01052                     Log.Warning("Test is disabled on phone.");
01053                     return;
01054                 }
01055
01056                 Log.Comment("Navigating to List Items with simple swipe items");
01057                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01058                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01059
01060                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01061                 navigateToSimpleContentsButton.Invoke();
01062                 Wait.ForIdle();
01063
01064                 Log.Comment("Find the SwipeControl4");
01065                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
01066                 Verify.IsNotNull(SwipeControl4);
01067                 Log.Comment("Find the SwipeItem4IdleCheckBox");
01068                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
01069                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
01070                 Log.Comment("Find the SwipeItem4OpenCheckBox");
01071                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
01072                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
01073                 Log.Comment("Getting the textblock");
01074                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01075                 Verify.IsNotNull(textblock);
01076
01077                 PerformSwipe(SwipeControl4, Direction.East);
01078                 WaitForChecked(SwipeItem4OpenCheckBox);
01079                 WaitForChecked(SwipeItem4IdleCheckBox);
01080                 TapItem("RevealItem1");
01081                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
01082                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
01083                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
01084
01085                 TapItem("ResetButton");
01086                 WaitForUnchecked(SwipeItem4OpenCheckBox);
01087                 WaitForChecked(SwipeItem4IdleCheckBox);
01088
01089                 PerformSwipe(SwipeControl4, Direction.East);
01090                 WaitForChecked(SwipeItem4OpenCheckBox);
01091                 WaitForChecked(SwipeItem4IdleCheckBox);
01092                 TapItem("RevealItem2");
01093                 WaitForUnchecked(SwipeItem4OpenCheckBox);
01094                 WaitForChecked(SwipeItem4IdleCheckBox);
01095                 Verify.AreEqual("RevealItem2", textblock.DocumentText);
01096
01097                 Log.Comment("Returning to the main Swipe test page");
01098                 TestSetupHelper.GoBack();
01099             }
01100         }
01101
01102         [TestMethod]
01103         [TestProperty("TestSuite", "B")]
01104         public void CanSwipeBackFromAnOpenedSwipe()
01105         {
01106             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01107             {
01108                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
01109                 {
01110                     Log.Warning("Test is disabled on phone.");
01111                     return;
01112                 }
01113
01114                 Log.Comment("Navigating to List Items with simple swipe items");
01115                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01116                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01117
01118                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01119                 navigateToSimpleContentsButton.Invoke();
01120                 Wait.ForIdle();
01121
01122                 Log.Comment("Find the SwipeControl4");
01123                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
01124                 Verify.IsNotNull(SwipeControl4);
01125                 Log.Comment("Find the SwipeItem4IdleCheckBox");
01126                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
01127                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
01128                 Log.Comment("Find the SwipeItem4OpenCheckBox");
01129                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
01130                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
01131                 Log.Comment("Getting the textblock");
01132                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01133                 Verify.IsNotNull(textblock);
01134
01135                 PerformSwipe(SwipeControl4, Direction.East);
01136                 WaitForChecked(SwipeItem4OpenCheckBox);
01137                 WaitForChecked(SwipeItem4IdleCheckBox);
01138                 TapItem("RevealItem1");
01139                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
01140                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
01141                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
01142                 PerformSwipe(SwipeControl4, Direction.West);
01143                 WaitForUnchecked(SwipeItem4OpenCheckBox);
01144                 WaitForChecked(SwipeItem4IdleCheckBox);
01145
01146                 Log.Comment("Returning to the main Swipe test page");
01147                 TestSetupHelper.GoBack();
01148             }
01149         }
01150
01151         [TestMethod]
01152         [TestProperty("TestSuite", "B")]
01153         public void CanSwipeOtherDirectionAfterClosingAnOpenedSwipe()
01154         {
01155             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01156             {
01157                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
01158                 {
01159                     Log.Warning("Test is disabled on phone.");
01160                     return;
01161                 }
01162
01163                 Log.Comment("Navigating to List Items with simple swipe items");
01164                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01165                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01166
01167                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01168                 navigateToSimpleContentsButton.Invoke();
01169                 Wait.ForIdle();
01170
01171                 Log.Comment("Find the SwipeControl4");
01172                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
01173                 Verify.IsNotNull(SwipeControl4);
01174                 Log.Comment("Find the SwipeItem4IdleCheckBox");
01175                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
01176                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
01177                 Log.Comment("Find the SwipeItem4OpenCheckBox");
01178                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
01179                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
01180                 Log.Comment("Getting the textblock");
01181                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01182                 Verify.IsNotNull(textblock);
01183
01184                 PerformSwipe(SwipeControl4, Direction.East);
01185                 WaitForChecked(SwipeItem4OpenCheckBox);
01186                 WaitForChecked(SwipeItem4IdleCheckBox);
01187                 TapItem("RevealItem1");
01188                 Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
01189                 Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
01190                 Verify.AreEqual("RevealItem1", textblock.DocumentText);
01191
01192                 TapItem("ResetButton");
01193                 WaitForUnchecked(SwipeItem4OpenCheckBox);
01194                 WaitForChecked(SwipeItem4IdleCheckBox);
01195
01196                 PerformSwipe(SwipeControl4, Direction.West);
01197                 WaitForChecked(SwipeItem4OpenCheckBox);
01198                 WaitForChecked(SwipeItem4IdleCheckBox);
01199                 TapItem("RevealItem2");
01200                 WaitForUnchecked(SwipeItem4OpenCheckBox);
01201                 WaitForChecked(SwipeItem4IdleCheckBox);
01202                 Verify.AreEqual("RevealItem2", textblock.DocumentText);
01203
01204                 Log.Comment("Returning to the main Swipe test page");
01205                 TestSetupHelper.GoBack();
01206             }
01207         }
01208
01209         [TestMethod]
01210         [TestProperty("TestSuite", "B")]
01211         public void SwipingDoesntModifyTheSizeOfSwipeControl()
01212         {
01213             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01214             {
01215                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
01216                 {
01217                     Log.Warning("Test is disabled on phone.");
01218                     return;
01219                 }
01220
01221                 Log.Comment("Navigating to List Items with simple swipe items");
01222                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01223                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01224
01225                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01226                 navigateToSimpleContentsButton.Invoke();
01227                 Wait.ForIdle();
01228
01229                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01230                 Verify.IsNotNull(textblock);
01231
01232                 var resetButton = new Button(FindElement.ByName("ResetButton"));
01233                 Verify.IsNotNull(resetButton);
01234
01235                 // Horizontal, and Vertical
01236                 var swipes = new[] { FindElement.ByName("SwipeControl2"), FindElement.ByName("SwipeControl8") };
01237                 var directions = new[] { Direction.West, Direction.North };
01238                 var idleCheckBoxes = new[] { new CheckBox(FindElement.ByName("SwipeItem2IdleCheckBox")), new CheckBox(FindElement.ByName("SwipeItem8IdleCheckBox")) };
01239                 var openCheckBoxes = new[] { new CheckBox(FindElement.ByName("SwipeItem2OpenCheckBox")), new CheckBox(FindElement.ByName("SwipeItem8OpenCheckBox")) };
01240                 for (int i = 0; i < swipes.Length; i++)
01241                 {
01242                     var swipe = swipes[i];
01243                     var direction = directions[i];
01244                     var idleCheckBox = idleCheckBoxes[i];
01245                     var openCheckBox = openCheckBoxes[i];
01246                     Verify.IsNotNull(swipe);
01247                     int widthBefore = swipe.BoundingRectangle.Width;
01248                     int heightBefore = swipe.BoundingRectangle.Height;
01249                     PerformSwipe(swipe, direction);
01250                     int widthDuring = swipe.BoundingRectangle.Width;
01251                     int heightDuring = swipe.BoundingRectangle.Height;
01252                     WaitForChecked(openCheckBox);
01253                     WaitForChecked(idleCheckBox);
01254                     WaitForUnchecked(openCheckBox);
01255                     WaitForChecked(idleCheckBox);
01256
01257                     int widthAfter = swipe.BoundingRectangle.Width;
01258                     int heightAfter = swipe.BoundingRectangle.Height;
01259                     Verify.AreEqual("ExecuteItem", textblock.DocumentText);
01260                     Verify.AreEqual(widthBefore, widthDuring);
01261                     Verify.AreEqual(heightBefore, heightDuring);
01262                     Verify.AreEqual(widthBefore, widthAfter);
01263                     Verify.AreEqual(heightBefore, heightAfter);
01264                     resetButton.Invoke();
01265                 }
01266
01267                 Log.Comment("Returning to the main Swipe test page");
01268                 TestSetupHelper.GoBack();
01269             }
01270         }
01271
01272         [TestMethod]
01273         [TestProperty("TestSuite", "B")]
01274         public void SwipeItemsAreNullifiedWhenTheAnimationIsDone()
01275         {
01276             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01277             {
01278                 // Bug: 12734833
01279                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
01280                 {
01281                     return;
01282                 }
01283
01284                 Log.Comment("Navigating to List Items with simple swipe items");
01285                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01286                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01287
01288                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01289                 navigateToSimpleContentsButton.Invoke();
01290                 Wait.ForIdle();
01291
01292                 Log.Comment("Find the SwipeControl4");
01293                 var SwipeControl4 = FindElement.ByName("SwipeControl4");
01294                 Verify.IsNotNull(SwipeControl4);
01295                 Log.Comment("Find the SwipeItem4IdleCheckBox");
01296                 CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
01297                 Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
01298                 Log.Comment("Find the SwipeItem4OpenCheckBox");
01299                 CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
01300                 Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
01301                 Log.Comment("Getting the textblock");
01302                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01303                 Verify.IsNotNull(textblock);
01304
01305                 PerformSwipe(SwipeControl4, Direction.East);
01306                 WaitForChecked(SwipeItem4OpenCheckBox);
01307                 WaitForChecked(SwipeItem4IdleCheckBox);
01308
01309                 using (Context.RawContext.Activate())
01310                 {
01311                     var item1 = FindElement.ByName("RevealItem1");
01312                     var firstChild = SwipeControl4.FirstChild;
01313
01314                     Verify.IsNotNull(item1);
01315                     Verify.IsNotNull(firstChild);
01316                     Verify.AreEqual(item1, firstChild);
01317
01318                     PerformSwipe(SwipeControl4, Direction.West);
01319                     WaitForUnchecked(SwipeItem4OpenCheckBox);
01320                     WaitForChecked(SwipeItem4IdleCheckBox);
01321
01322                     firstChild = SwipeControl4.FirstChild;
01323                     // The first child becomes the text block
01324                     Verify.AreNotEqual(item1, firstChild);
01325                 }
01326
01327                 Log.Comment("Returning to the main Swipe test page");
01328                 TestSetupHelper.GoBack();
01329             }
01330         }
01331
01332         [TestMethod]
01333         [Description("Regression test for MSFT:9096017 - Validates that after an initial swipe, SwipeControl doesn't offset to the point where you first released your finger on the start of the new interaction.")]
01334         [TestProperty("TestSuite", "B")]
01335         public void SwipingDoesntChangeTheBoundsOfSwipeControl()
01336         {
01337             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01338             {
01339                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
01340                 {
01341                     Log.Warning("Test is disabled on phone.");
01342                     return;
01343                 }
01344
01345                 Log.Comment("Navigating to List Items with simple swipe items");
01346                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01347                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01348
01349                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01350                 navigateToSimpleContentsButton.Invoke();
01351                 Wait.ForIdle();
01352
01353                 var SwipeControl6 = FindElement.ByName("SwipeControl6");
01354
01355                 // Save off the original bounding rectangle so that we can validate that the
01356                 // swipe container did not offset on the next interaction.
01357                 var originalBounds = SwipeControl6.BoundingRectangle;
01358
01359                 Log.Comment("Initiate the first interaction (a swipe).");
01360
01361                 Verify.IsNotNull(SwipeControl6);
01362                 PerformSwipe(SwipeControl6, Direction.West);
01363
01364                 AutoResetEvent autoEvent = new AutoResetEvent(false);
01365
01366                 // Execute the TapAndHold call on an off thread so that we can validate
01367                 // the bounds hasn't changed during the hold.
01368                 var op = global::System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback((object state) =>
01369                 {
01370                     Log.Comment("Initiate a long tap and validate that the bounding rectangle doesn't change.");
01371                     Verify.IsNotNull(SwipeControl6);
01372                     InputHelper.TapAndHold(SwipeControl6, 5000);
01373                     autoEvent.Set();
01374                 }));
01375
01376                 Log.Comment("Main thread start to validate the bounds");
01377
01378                 while (!autoEvent.WaitOne(250))
01379                 {
01380                     Verify.AreEqual(originalBounds.X, SwipeControl6.BoundingRectangle.X);
01381                     Verify.AreEqual(originalBounds.Y, SwipeControl6.BoundingRectangle.Y);
01382                 }
01383
01384                 Log.Comment("Main thread stop the validation");
01385
01386                 Log.Comment("Returning to the main Swipe test page");
01387                 TestSetupHelper.GoBack();
01388             }
01389         }
01390
01391         [TestMethod]
01392         [TestProperty("TestSuite", "B")]
01393         public void TappingOutsideARevealedSwipeDismissesIt()
01394         {
01395             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01396             {
01397                 Log.Comment("Navigating to List Items with simple swipe items");
01398                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01399                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01400
01401                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01402                 navigateToSimpleContentsButton.Invoke();
01403                 Wait.ForIdle();
01404
01405                 DismissRevealedSwipe(true);
01406
01407                 Log.Comment("Returning to the main Swipe test page");
01408                 TestSetupHelper.GoBack();
01409             }
01410         }
01411
01412         [TestMethod]
01413         [TestProperty("TestSuite", "B")]
01414         public void ClickingOutsideARevealedSwipeDismissesIt()
01415         {
01416             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01417             {
01418                 Log.Comment("Navigating to List Items with simple swipe items");
01419                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01420                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01421
01422                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01423                 navigateToSimpleContentsButton.Invoke();
01424                 Wait.ForIdle();
01425
01426                 DismissRevealedSwipe(false);
01427
01428                 Log.Comment("Returning to the main Swipe test page");
01429                 TestSetupHelper.GoBack();
01430             }
01431         }
01432
01433         [TestMethod]
01434         [TestProperty("TestSuite", "B")]
01435         public void SwipeItemInheritsICommand2Properties()
01436         {
01437             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01438             {
01439                 Log.Comment("Navigating to List Items with simple swipe items");
01440                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01441                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01442
01443                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01444                 navigateToSimpleContentsButton.Invoke();
01445                 Wait.ForIdle();
01446
01447                 Log.Comment("Find the SwipeControl10");
01448                 var SwipeControl10 = FindElement.ByName("SwipeControl10");
01449                 Verify.IsNotNull(SwipeControl10);
01450                 Log.Comment("Find the SwipeItem10IdleCheckBox");
01451                 CheckBox SwipeItem10IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem10IdleCheckBox"));
01452                 Verify.IsNotNull(SwipeItem10IdleCheckBox, "Verifying that SwipeItem10IdleCheckBox Button was found");
01453                 Log.Comment("Find the SwipeItem10OpenCheckBox");
01454                 CheckBox SwipeItem10OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem10OpenCheckBox"));
01455                 Verify.IsNotNull(SwipeItem10OpenCheckBox, "Verifying that SwipeItem10OpenCheckBox Button was found");
01456                 Log.Comment("Getting the textblock");
01457                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01458                 Verify.IsNotNull(textblock);
01459
01460                 PerformSwipe(SwipeControl10, Direction.East);
01461                 WaitForChecked(SwipeItem10OpenCheckBox);
01462                 WaitForChecked(SwipeItem10IdleCheckBox);
01463                 TapItem("UICommand Label");
01464                 Verify.AreEqual(ToggleState.On, SwipeItem10OpenCheckBox.ToggleState);
01465                 Verify.AreEqual(ToggleState.On, SwipeItem10IdleCheckBox.ToggleState);
01466                 Verify.AreEqual("UICommand Label", textblock.DocumentText);
01467
01468                 Log.Comment("Returning to the main Swipe test page");
01469                 TestSetupHelper.GoBack();
01470             }
01471         }
01472
01473         [TestMethod]
01474         [TestProperty("TestSuite", "B")]
01475         public void CloseOnOpenedAndClosedSwipeItemsWorks()
01476         {
01477             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01478             {
01479                 Log.Comment("Navigating to List Items with simple swipe items");
01480                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01481                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01482
01483                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01484                 navigateToSimpleContentsButton.Invoke();
01485                 Wait.ForIdle();
01486
01487                 Log.Comment("Find the SwipeControl3");
01488                 var SwipeControl3 = FindElement.ByName("SwipeControl3");
01489                 Verify.IsNotNull(SwipeControl3);
01490                 Log.Comment("Find the SwipeItem3IdleCheckBox");
01491                 CheckBox SwipeItem3IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem3IdleCheckBox"));
01492                 Verify.IsNotNull(SwipeItem3IdleCheckBox, "Verifying that SwipeItem3IdleCheckBox Button was found");
01493                 Log.Comment("Find the SwipeItem3OpenCheckBox");
01494                 CheckBox SwipeItem3OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem3OpenCheckBox"));
01495                 Verify.IsNotNull(SwipeItem3OpenCheckBox, "Verifying that SwipeItem3OpenCheckBox Button was found");
01496                 Log.Comment("Getting the textblock");
01497                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01498                 Verify.IsNotNull(textblock);
01499
01500                 PerformSwipe(SwipeControl3, Direction.East);
01501                 WaitForChecked(SwipeItem3OpenCheckBox);
01502                 WaitForChecked(SwipeItem3IdleCheckBox);
01503                 TapItem("RevealItem5");
01504                 Verify.AreEqual(ToggleState.On, SwipeItem3OpenCheckBox.ToggleState);
01505                 Verify.AreEqual(ToggleState.On, SwipeItem3IdleCheckBox.ToggleState);
01506                 Verify.AreEqual("sc11.Close()", textblock.DocumentText);
01507                 TapItem("RevealItem4");
01508                 WaitForUnchecked(SwipeItem3OpenCheckBox);
01509                 WaitForChecked(SwipeItem3IdleCheckBox);
01510                 Verify.AreEqual("sc3.Close()", textblock.DocumentText);
01511
01512                 Log.Comment("Find the SwipeControl9");
01513                 var SwipeControl9 = FindElement.ByName("SwipeControl9");
01514                 Verify.IsNotNull(SwipeControl9);
01515                 Log.Comment("Find the SwipeItem9IdleCheckBox");
01516                 CheckBox SwipeItem9IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem9IdleCheckBox"));
01517                 Verify.IsNotNull(SwipeItem9IdleCheckBox, "Verifying that SwipeItem9IdleCheckBox Button was found");
01518                 Log.Comment("Find the SwipeItem9OpenCheckBox");
01519                 CheckBox SwipeItem9OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem9OpenCheckBox"));
01520                 Verify.IsNotNull(SwipeItem9OpenCheckBox, "Verifying that SwipeItem9OpenCheckBox Button was found");
01521
01522                 PerformSwipe(SwipeControl9, Direction.South);
01523                 WaitForChecked(SwipeItem9OpenCheckBox);
01524                 WaitForChecked(SwipeItem9IdleCheckBox);
01525                 WaitForUnchecked(SwipeItem9OpenCheckBox);
01526                 WaitForChecked(SwipeItem9IdleCheckBox);
01527                 Verify.AreEqual("sc9.Close()", textblock.DocumentText);
01528
01529                 Log.Comment("Returning to the main Swipe test page");
01530                 TestSetupHelper.GoBack();
01531             }
01532         }
01533
01534         //[TestMethod] Bug 24048408: DCPP: Multiple MUXC interaction tests fail in CatGates due to taking too long to execute
01535         [TestProperty("TestSuite", "B")]
01536         public void OnlyProgramaticCloseWillCloseRemainOpenExecuteItems()
01537         {
01538             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01539             {
01540                 Log.Comment("Navigating to List Items with simple swipe items");
01541                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01542                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01543
01544                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01545                 navigateToSimpleContentsButton.Invoke();
01546                 Wait.ForIdle();
01547
01548                 Log.Comment("Find the SwipeControl11");
01549                 var SwipeControl11 = FindElement.ByName("SwipeControl11");
01550                 Verify.IsNotNull(SwipeControl11);
01551                 Log.Comment("Find the SwipeItem11IdleCheckBox");
01552                 CheckBox SwipeItem11IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem11IdleCheckBox"));
01553                 Verify.IsNotNull(SwipeItem11IdleCheckBox, "Verifying that SwipeItem11IdleCheckBox Button was found");
01554                 Log.Comment("Find the SwipeItem11OpenCheckBox");
01555                 CheckBox SwipeItem11OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem11OpenCheckBox"));
01556                 Verify.IsNotNull(SwipeItem11OpenCheckBox, "Verifying that SwipeItem11OpenCheckBox Button was found");
01557
01558                 Log.Comment("Find the SwipeControl3");
01559                 var SwipeControl3 = FindElement.ByName("SwipeControl3");
01560                 Verify.IsNotNull(SwipeControl3);
01561                 Log.Comment("Find the SwipeItem3IdleCheckBox");
01562                 CheckBox SwipeItem3IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem3IdleCheckBox"));
01563                 Verify.IsNotNull(SwipeItem3IdleCheckBox, "Verifying that SwipeItem3IdleCheckBox Button was found");
01564                 Log.Comment("Find the SwipeItem3OpenCheckBox");
01565                 CheckBox SwipeItem3OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem3OpenCheckBox"));
01566                 Verify.IsNotNull(SwipeItem3OpenCheckBox, "Verifying that SwipeItem3OpenCheckBox Button was found");
01567
01568                 Log.Comment("Getting the textblock");
01569                 var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01570                 Verify.IsNotNull(textblock);
01571
01572                 Window window = new Window(TestEnvironment.Application.ApplicationFrameWindow);
01573
01574                 PerformSwipe(SwipeControl11, Direction.East);
01575                 WaitForChecked(SwipeItem11OpenCheckBox);
01576                 WaitForChecked(SwipeItem11IdleCheckBox);
01577                 Verify.AreEqual("ExecuteRemainOpen", textblock.DocumentText);
01578                 PerformSwipe(SwipeControl11, Direction.West);
01579                 Verify.AreEqual(ToggleState.On, SwipeItem11OpenCheckBox.ToggleState);
01580                 Verify.AreEqual(ToggleState.On, SwipeItem11IdleCheckBox.ToggleState);
01581                 Verify.AreEqual("ExecuteRemainOpen", textblock.DocumentText);
01582                 window.SetWindowVisualState(WindowVisualState.Normal);
01583                 window.SetWindowVisualState(WindowVisualState.Maximized);
01584                 Verify.AreEqual(ToggleState.On, SwipeItem11OpenCheckBox.ToggleState);
01585                 Verify.AreEqual(ToggleState.On, SwipeItem11IdleCheckBox.ToggleState);
01586                 Verify.AreEqual("ExecuteRemainOpen", textblock.DocumentText);
01587                 TapItem("ExecuteRemainOpen");
01588                 Verify.AreEqual(ToggleState.On, SwipeItem11OpenCheckBox.ToggleState);
01589                 Verify.AreEqual(ToggleState.On, SwipeItem11IdleCheckBox.ToggleState);
01590                 Verify.AreEqual("ExecuteRemainOpen", textblock.DocumentText);
01591                 PerformSwipe(SwipeControl3, Direction.East);
01592                 WaitForChecked(SwipeItem3OpenCheckBox);
01593                 WaitForChecked(SwipeItem3IdleCheckBox);
01594                 Verify.AreEqual(ToggleState.On, SwipeItem11OpenCheckBox.ToggleState);
01595                 Verify.AreEqual(ToggleState.On, SwipeItem11IdleCheckBox.ToggleState);
01596                 Verify.AreEqual("ExecuteRemainOpen", textblock.DocumentText);
01597                 TapItem("RevealItem5");
01598                 WaitForUnchecked(SwipeItem11OpenCheckBox);
01599                 WaitForChecked(SwipeItem11IdleCheckBox);
01600                 Verify.AreEqual(ToggleState.On, SwipeItem3OpenCheckBox.ToggleState);
01601                 Verify.AreEqual(ToggleState.On, SwipeItem3IdleCheckBox.ToggleState);
01602                 Verify.AreEqual("sc11.Close()", textblock.DocumentText);
01603
01604                 Log.Comment("Returning to the main Swipe test page");
01605                 TestSetupHelper.GoBack();
01606             }
01607         }
01608
01609         [TestMethod]
01610         [TestProperty("TestSuite", "B")]
01611         public void SwipeContentBackgroundResetsOnClose()
01612         {
01613             using (var setup = new TestSetupHelper("SwipeControl Tests"))
01614             {
01615                 SetOutputDebugStringLevel("Info");
01616
01617                 Log.Comment("Navigating to List Items with simple swipe items");
01618                 UIObject navigateToSimpleContentsUIObject = FindElement.ByName("navigateToSimpleContents");
01619                 Verify.IsNotNull(navigateToSimpleContentsUIObject, "Verifying that navigateToSimpleContents Button was found");
01620
01621                 Button navigateToSimpleContentsButton = new Button(navigateToSimpleContentsUIObject);
01622                 navigateToSimpleContentsButton.Invoke();
01623                 Wait.ForIdle();
01624
01625                 SetLoggingLevel(isPrivateLoggingEnabled: true);
01626
01627                 Log.Comment("Find the SwipeControl3");
01628                 var SwipeControl3 = FindElement.ByName("SwipeControl3");
01629                 Verify.IsNotNull(SwipeControl3);
01630                 Log.Comment("Find the SwipeItem3IdleCheckBox");
01631                 CheckBox SwipeItem3IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem3IdleCheckBox"));
01632                 Log.Comment("Find the SwipeItem3OpenCheckBox");
01633                 CheckBox SwipeItem3OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem3OpenCheckBox"));
01634
01635                 Log.Comment("Getting the Swipe3BackgroundColorTextBlock");
01636                 var textblock = new TextBlock(FindElement.ByName("Swipe3BackgroundColorTextBlock"));
01637
01638                 PerformSwipe(SwipeControl3, Direction.East);
01639                 WaitForChecked(SwipeItem3OpenCheckBox);
01640                 WaitForChecked(SwipeItem3IdleCheckBox);
01641                 Verify.AreEqual(ToggleState.On, SwipeItem3OpenCheckBox.ToggleState);
01642                 Verify.AreEqual(ToggleState.On, SwipeItem3IdleCheckBox.ToggleState);
01643                 Verify.AreEqual("#FF008000", textblock.DocumentText);
01644
01645                 TapItem("RevealItem2");
01646                 WaitForUnchecked(SwipeItem3OpenCheckBox);
01647                 WaitForChecked(SwipeItem3IdleCheckBox);
01648                 Verify.AreEqual(ToggleState.Off, SwipeItem3OpenCheckBox.ToggleState);
01649                 Verify.AreEqual(ToggleState.On, SwipeItem3IdleCheckBox.ToggleState);
01650                 Verify.AreEqual("null", textblock.DocumentText);
01651
01652                 SetLoggingLevel(isPrivateLoggingEnabled: false);
01653                 LogTraces();
01654
01655                 Log.Comment("Returning to the main Swipe test page");
01656                 TestSetupHelper.GoBack();
01657             }
01658         }
01659
01660         private void DismissRevealedSwipe(bool withOutsideTap)
01661         {
01662             if (PlatformConfiguration.IsDevice(DeviceType.Phone))
01663             {
01664                 Log.Warning("Test is disabled on phone.");
01665                 return;
01666             }
01667
01668             Log.Comment("Find the SwipeControl4");
01669             var SwipeControl4 = FindElement.ByName("SwipeControl4");
01670             Verify.IsNotNull(SwipeControl4);
01671             Log.Comment("Find the SwipeItem4IdleCheckBox");
01672             CheckBox SwipeItem4IdleCheckBox = new CheckBox(FindElement.ByName("SwipeItem4IdleCheckBox"));
01673             Verify.IsNotNull(SwipeItem4IdleCheckBox, "Verifying that SwipeItem4IdleCheckBox Button was found");
01674             Log.Comment("Find the SwipeItem4OpenCheckBox");
01675             CheckBox SwipeItem4OpenCheckBox = new CheckBox(FindElement.ByName("SwipeItem4OpenCheckBox"));
01676             Verify.IsNotNull(SwipeItem4OpenCheckBox, "Verifying that SwipeItem4OpenCheckBox Button was found");
01677             Log.Comment("Getting the textblock");
01678             var textblock = new TextBlock(FindElement.ByName("TextBlock"));
01679             Verify.IsNotNull(textblock);
01680
01681             PerformSwipe(SwipeControl4, Direction.East);
01682             WaitForChecked(SwipeItem4OpenCheckBox);
01683             WaitForChecked(SwipeItem4IdleCheckBox);
01684             TapItem("RevealItem1");
01685             Verify.AreEqual(ToggleState.On, SwipeItem4OpenCheckBox.ToggleState);
01686             Verify.AreEqual(ToggleState.On, SwipeItem4IdleCheckBox.ToggleState);
01687             Verify.AreEqual("RevealItem1", textblock.DocumentText);
01688
01689             var swipePage = FindElement.ByName("SwipePage");
01690
01691             if (withOutsideTap)
01692             {
01693                 InputHelper.Tap(swipePage, 20, 20);
01694             }
01695             else
01696             {
01697                 InputHelper.LeftClick(swipePage, 20, 20);
01698             }
01699
01700             WaitForUnchecked(SwipeItem4OpenCheckBox);
01701             WaitForChecked(SwipeItem4IdleCheckBox);
01702         }
01703
01704         private void PerformSwipe(UIObject element, Direction direction)
01705         {
01706             int distance = 150;
01707             InputHelper.Pan(element, distance, direction, 1500, 0.001f, 100, false);
01708             Log.Comment("PerformSwipe completed.");
01709         }
01710
01711         private bool WaitForChecked(CheckBox checkBox)
01712         {
01713             return WaitForCheckBoxUpdated(checkBox, ToggleState.On);
01714         }
01715
01716         private bool WaitForUnchecked(CheckBox checkBox)
01717         {
01718             return WaitForCheckBoxUpdated(checkBox, ToggleState.Off);
01719         }
01720
01721         // Swipe operation takes 100ms(swipe) + 1500ms(hold) = 1600ms to complete.
01722         // For IdleCheckbox, we also need to wait for the released item to go back to its original position and trigger IdleStatusChanged event.
01723         // Made the default timeout limit 4000ms to give it enough time to finish.
01724         private bool WaitForCheckBoxUpdated(CheckBox checkBox, ToggleState state, double millisecondsTimeout = 4000, bool throwOnError = true)
01725         {
01726             using (var waiter = checkBox.GetToggledWaiter())
01727             {
01728                 Log.Comment(checkBox.Name + " Checked: " + checkBox.ToggleState);
01729                 if (checkBox.ToggleState == state)
01730                 {
01731                     return true;
01732                 }
01733                 else
01734                 {
01735                     Log.Comment("Waiting for toggle state to change to {0} for {1}ms", state, millisecondsTimeout);
01736                     waiter.TryWait(TimeSpan.FromMilliseconds(millisecondsTimeout));
01737                 }
01738                 if (checkBox.ToggleState != state)
01739                 {
01740                     Log.Warning(checkBox.Name + " value never changed");
01741                     if (throwOnError)
01742                     {
01743                         throw new WaiterException();
01744                     }
01745                     else
01746                     {
01747                         return false;
01748                     }
01749                 }
01750                 return true;
01751             }
01752         }
01753
01754         private void TapItem(String item)
01755         {
01756             ElementCache.Clear();
01757             using (Context.RawContext.Activate())
01758             {
01759                 Log.Comment("Tapping on " + item);
01760                 var uiItem = FindElement.ByName(item);
01761                 Verify.IsNotNull(uiItem);
01762
01763                 if (String.IsNullOrEmpty(uiItem.Name) || String.IsNullOrEmpty(uiItem.AutomationId))
01764                 {
01765                     Log.Warning("Item {0} isn't null but doesn't exist anymore.", item);
01766                 }
01767
01768                 InputHelper.Tap(uiItem);
01769             }
01770         }
01771
01772         // outputDebugStringLevel can be "None", "Info" or "Verbose"
01773         private void SetOutputDebugStringLevel(string outputDebugStringLevel)
01774         {
01775             Log.Comment("Retrieving cmbSwipeControlOutputDebugStringLevel");
01776             ComboBox cmbSwipeControlOutputDebugStringLevel = new ComboBox(FindElement.ByName("cmbSwipeControlOutputDebugStringLevel"));
01777             Verify.IsNotNull(cmbSwipeControlOutputDebugStringLevel, "Verifying that cmbSwipeControlOutputDebugStringLevel was found");
01778
01779             Log.Comment("Changing output-debug-string-level selection to " + outputDebugStringLevel);
01780             cmbSwipeControlOutputDebugStringLevel.SelectItemByName(outputDebugStringLevel);
01781             Log.Comment("Selection is now {0}", cmbSwipeControlOutputDebugStringLevel.Selection[0].Name);
01782         }
01783
01784         private void SetLoggingLevel(bool isPrivateLoggingEnabled)
01785         {
01786             Log.Comment("Retrieving chkLogSwipeControlMessages");
01787             CheckBox chkLogSwipeControlMessages = new CheckBox(FindElement.ById("chkLogSwipeControlMessages"));
01788             Verify.IsNotNull(chkLogSwipeControlMessages, "Verifying that chkLogSwipeControlMessages was found");
01789
01790             if (isPrivateLoggingEnabled && chkLogSwipeControlMessages.ToggleState != ToggleState.On ||
01791                 !isPrivateLoggingEnabled && chkLogSwipeControlMessages.ToggleState != ToggleState.Off)
01792             {
01793                 Log.Comment("Toggling chkLogSwipeControlMessages.IsChecked to " + isPrivateLoggingEnabled);
01794                 chkLogSwipeControlMessages.Toggle();
01795                 Wait.ForIdle();
01796             }
01797         }
01798
01799         private void LogTraces()
01800         {
01801             LogTraces(recordWarning: false);
01802         }
01803
01804         private void LogTraces(bool recordWarning)
01805         {
01806             List<string> traces = recordWarning ? new List<string>() : null;
01807
01808             Log.Comment("Reading full log:");
01809
01810             UIObject fullLogUIObject = FindElement.ById("cmbFullLog");
01811             Verify.IsNotNull(fullLogUIObject);
01812             ComboBox cmbFullLog = new ComboBox(fullLogUIObject);
01813             Verify.IsNotNull(cmbFullLog);
01814
01815             UIObject getFullLogUIObject = FindElement.ById("btnGetFullLog");
01816             Verify.IsNotNull(getFullLogUIObject);
01817             Button getFullLogButton = new Button(getFullLogUIObject);
01818             Verify.IsNotNull(getFullLogButton);
01819
01820             getFullLogButton.Invoke();
01821             Wait.ForIdle();
01822
01823             foreach (ComboBoxItem item in cmbFullLog.AllItems)
01824             {
01825                 string trace = item.Name;
01826
01827                 if (recordWarning)
01828                 {
01829                     traces.Add(trace);
01830                 }
01831                 Log.Comment(trace);
01832             }
01833
01834             if (recordWarning)
01835             {
01836                 string warning = "Non-final test pass failed.";
01837                 Log.Warning(warning);
01838
01839                 WarningReportHelper.Record(warning, traces);
01840             }
01841         }
01842
01843         private void ClearTraces()
01844         {
01845             Log.Comment("Clearing full log.");
01846
01847             UIObject clearFullLogUIObject = FindElement.ById("btnClearFullLog");
01848             Verify.IsNotNull(clearFullLogUIObject);
01849             Button clearFullLogButton = new Button(clearFullLogUIObject);
01850             Verify.IsNotNull(clearFullLogButton);
01851
01852             clearFullLogButton.Invoke();
01853             Wait.ForIdle();
01854         }
01855
01856         private void LogAndClearTraces()
01857         {
01858             LogAndClearTraces(recordWarning: false);
01859         }
01860
01861         private void LogAndClearTraces(bool recordWarning)
01862         {
01863             LogTraces(recordWarning);
01864             ClearTraces();
01865         }
01866     }
01867 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InfoBarClosedEventArgs Member List

This is the complete list of members for InfoBarClosedEventArgs, including all inherited members.
Reason() | InfoBarClosedEventArgs
Reason(const winrt::InfoBarCloseReason &reason) | InfoBarClosedEventArgs
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

BreadcrumbElementFactory Member List

This is the complete list of members for BreadcrumbElementFactory, including all inherited members.
BreadcrumbElementFactory() | BreadcrumbElementFactory
GetElementCore(const winrt::ElementFactoryGetArgs &args) override | BreadcrumbElementFactory
RecycleElementCore(const winrt::ElementFactoryRecycleArgs &args) override | BreadcrumbElementFactory
UserElementFactory(const winrt::IInspectable &newValue) | BreadcrumbElementFactory
Generated on Sun Dec 1 2024 20:52:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SwipeControlProperties Member List

This is the complete list of members for SwipeControlProperties, including all inherited members.
BottomItems(winrt::SwipeItems const &value) | SwipeControlProperties |
BottomItems() | SwipeControlProperties |
BottomItemsProperty() | SwipeControlProperties | [inline, static]
ClearProperties() | SwipeControlProperties | [static]
EnsureProperties() | SwipeControlProperties | [static]
LeftItems(winrt::SwipeItems const &value) | SwipeControlProperties |
LeftItems() | SwipeControlProperties |
LeftItemsProperty() | SwipeControlProperties | [inline, static]
OnBottomItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SwipeControlProperties | [static]
OnLeftItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SwipeControlProperties | [static]
OnRightItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SwipeControlProperties | [static]
OnTopItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SwipeControlProperties | [static]
RightItems(winrt::SwipeItems const &value) | SwipeControlProperties |
RightItems() | SwipeControlProperties |
RightItemsProperty() | SwipeControlProperties | [inline, static]
s_BottomItemsProperty | SwipeControlProperties | [static]
s_LeftItemsProperty | SwipeControlProperties | [static]
s_RightItemsProperty | SwipeControlProperties | [static]
s_TopItemsProperty | SwipeControlProperties | [static]
SwipeControlProperties() | SwipeControlProperties |
TopItems(winrt::SwipeItems const &value) | SwipeControlProperties |
TopItems() | SwipeControlProperties |
TopItemsProperty() | SwipeControlProperties | [inline, static]
Generated on Sun Dec 1 2024 20:53:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnimationHandler Member List

This is the complete list of members for AnimationHandler, including all inherited members.
AnimationHandler(UIElement container, RefreshPullDirection pullDirection) | AnimationHandler | [inline]
compositor | AnimationHandler | [private]
GetAnimatedPropertyName() | AnimationHandler | [inline, private]
infoProvider | AnimationHandler | [private]
infoProviderOffsetAnimation | AnimationHandler | [private]
infoProviderRefreshCompletedAnimation | AnimationHandler | [private]
infoProviderRefreshRequestedAnimation | AnimationHandler | [private]
infoProviderVisual | AnimationHandler | [private]
interactionAnimationNeedsUpdating | AnimationHandler | [private]
interactionTracker | AnimationHandler | [private]
InteractionTrackerAnimation(UIElement refreshVisualizer, UIElement infoProvider, InteractionTracker interactionTracker) | AnimationHandler | [inline]
IsOrientationVertical() | AnimationHandler | [inline, private]
RefreshCompletedAnimation(UIElement refreshVisualizer, UIElement infoProvider) | AnimationHandler | [inline]
refreshCompletedAnimationNeedsUpdating | AnimationHandler | [private]
RefreshCompletedBatchCompleted(Object sender, CompositionBatchCompletedEventArgs args) | AnimationHandler | [inline, private]
refreshCompletedScopedBatch | AnimationHandler | [private]
refreshPullDirection | AnimationHandler | [private]
RefreshRequestedAnimation(UIElement refreshVisualizer, UIElement infoProvider, double executionRatio) | AnimationHandler | [inline]
refreshRequestedAnimationNeedsUpdating | AnimationHandler | [private]
refreshVisualizer | AnimationHandler | [private]
refreshVisualizerRefreshCompletedAnimation | AnimationHandler | [private]
refreshVisualizerRefreshRequestedAnimation | AnimationHandler | [private]
refreshVisualizerVisual | AnimationHandler | [private]
refreshVisualizerVisualOffsetAnimation | AnimationHandler | [private]
ValidateAndStoreParameters(UIElement refreshVisualizer, UIElement infoProvider, InteractionTracker interactionTracker) | AnimationHandler | [inline, private]
Generated on Sun Dec 1 2024 20:53:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarFlyoutItem Member List

This is the complete list of members for InkToolBarFlyoutItem, including all inherited members.
abi_enter() | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
Checked(winrt::TypedEventHandler< winrt::InkToolBarFlyoutItem, winrt::IInspectable > const &value) | InkToolBarFlyoutItemProperties |
Checked(winrt::event_token const &token) | InkToolBarFlyoutItemProperties |
CheckThread() | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
ClearProperties() | InkToolBarFlyoutItemProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< InkToolBarFlyoutItem > &&self) noexcept | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline, static]
EnsureProperties() | InkToolBarFlyoutItemProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
final_release(std::unique_ptr< InkToolBarFlyoutItem > &&self) | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline, static]
GetBase() | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
GetInner() | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
InkToolBarFlyoutItemProperties() | InkToolBarFlyoutItemProperties |
IsChecked() | InkToolBarFlyoutItem | [inline]
IsChecked(bool value) | InkToolBarFlyoutItem | [inline]
IsCheckedProperty() | InkToolBarFlyoutItemProperties | [inline, static]
IsOnThread() | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
Kind() | InkToolBarFlyoutItem | [inline]
Kind(winrt::InkToolBarFlyoutItemKind value) | InkToolBarFlyoutItem | [inline]
InkToolBarFlyoutItemProperties::Kind(winrt::InkToolBarFlyoutItemKind const &value) | InkToolBarFlyoutItemProperties |
KindProperty() | InkToolBarFlyoutItemProperties | [inline, static]
m_checkedEventSource | InkToolBarFlyoutItemProperties |
m_uncheckedEventSource | InkToolBarFlyoutItemProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< InkToolBarFlyoutItem, winrt::implementation::InkToolBarFlyoutItemT > | [inline]
s_IsCheckedProperty | InkToolBarFlyoutItemProperties | [static]
s_KindProperty | InkToolBarFlyoutItemProperties | [static]
Unchecked(winrt::TypedEventHandler< winrt::InkToolBarFlyoutItem, winrt::IInspectable > const &value) | InkToolBarFlyoutItemProperties |
Unchecked(winrt::event_token const &token) | InkToolBarFlyoutItemProperties |
Generated on Sun Dec 1 2024 20:52:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TeachingTip/APITests/TeachingTipTests.cs Source File

  • TeachingTip
  • APITests

TeachingTipTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Text;
00007 using Windows.UI;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Xaml.Markup;
00010 using MUXControlsTestApp.Utilities;
00011 using Microsoft.UI.Xaml.Media;
00012 using Microsoft.UI.Xaml;
00013 using Microsoft.UI.Xaml.Controls;
00014 using Microsoft.UI.Xaml.Media.Imaging;
00015 using Common;
00016 using System.Threading;
00017
00018
00019 using WEX.TestExecution;
00020 using WEX.TestExecution.Markup;
00021 using WEX.Logging.Interop;
00022
00023 using Microsoft.UI.Private.Controls;
00024 using Microsoft.UI.Xaml.Controls;
00025 using Microsoft.UI.Xaml.Shapes;
00026
00027 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00028 {
00029     [TestClass]
00030     public class TeachingTipTests : ApiTestBase
00031     {
00032         [TestMethod]
00033         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")] // TeachingTip doesn't appear to show up correctly in OneCore.
00034         public void TeachingTipBackgroundTest()
00035         {
00036             TeachingTip teachingTip = null, teachingTipLightDismiss = null;
00037             SolidColorBrush blueBrush = null;
00038             Brush lightDismissBackgroundBrush = null;
00039             var loadedEvent = new AutoResetEvent(false);
00040             RunOnUIThread.Execute(() =>
00041             {
00042                 Grid root = new Grid();
00043                 teachingTip = new TeachingTip();
00044                 teachingTip.Loaded += (object sender, RoutedEventArgs args) => { loadedEvent.Set(); };
00045
00046                 teachingTipLightDismiss = new TeachingTip();
00047                 teachingTipLightDismiss.IsLightDismissEnabled = true;
00048
00049                 // Set LightDismiss background before show... it shouldn't take effect in the tree
00050                 blueBrush = new SolidColorBrush(Microsoft.UI.Colors.Blue);
00051                 teachingTipLightDismiss.Background = blueBrush;
00052
00053                 root.Resources.Add("TeachingTip", teachingTip);
00054                 root.Resources.Add("TeachingTipLightDismiss", teachingTipLightDismiss);
00055
00056                 lightDismissBackgroundBrush = MUXControlsTestApp.App.Current.Resources["TeachingTipTransientBackground"] as Brush;
00057                 Verify.IsNotNull(lightDismissBackgroundBrush, "lightDismissBackgroundBrush");
00058
00059                 teachingTip.IsOpen = true;
00060                 teachingTipLightDismiss.IsOpen = true;
00061
00062                 MUXControlsTestApp.App.TestContentRoot = root;
00063             });
00064
00065             IdleSynchronizer.Wait();
00066             loadedEvent.WaitOne();
00067             IdleSynchronizer.Wait();
00068
00069             RunOnUIThread.Execute(() =>
00070             {
00071                 var redBrush = new SolidColorBrush(Microsoft.UI.Colors.Red);
00072                 teachingTip.SetValue(TeachingTip.BackgroundProperty, redBrush);
00073                 Verify.AreSame(redBrush, teachingTip.GetValue(TeachingTip.BackgroundProperty) as Brush);
00074                 Verify.AreSame(redBrush, teachingTip.Background);
00075
00076                 teachingTip.Background = blueBrush;
00077                 Verify.AreSame(blueBrush, teachingTip.Background);
00078
00079                 {
00080                     var popup = TeachingTipTestHooks.GetPopup(teachingTip);
00081                     var rootGrid = popup.Child;
00082                     var tailOcclusionGrid = VisualTreeHelper.GetChild(rootGrid, 0);
00083                     var contentRootGrid = VisualTreeHelper.GetChild(tailOcclusionGrid, 0);
00084                     Verify.AreSame(blueBrush, ((Grid)contentRootGrid).Background, "Checking TeachingTip.Background TemplateBinding works");
00085                 }
00086
00087                 {
00088                     var popup = TeachingTipTestHooks.GetPopup(teachingTipLightDismiss);
00089                     var child = popup.Child as Grid;
00090
00091                     Log.Comment("Checking LightDismiss TeachingTip Background is using resource for first invocation");
00092
00093                     Polygon tailPolygon = VisualTreeUtils.FindVisualChildByName(child, "TailPolygon") as Polygon;
00094                     Grid contentRootGrid = VisualTreeUtils.FindVisualChildByName(child, "ContentRootGrid") as Grid;
00095                     ContentPresenter mainContentPresenter = VisualTreeUtils.FindVisualChildByName(child, "MainContentPresenter") as ContentPresenter;
00096                     Border heroContentBorder = VisualTreeUtils.FindVisualChildByName(child, "HeroContentBorder") as Border;
00097
00098                     VerifyLightDismissTipBackground(tailPolygon.Fill, "TailPolygon");
00099                     VerifyLightDismissTipBackground(contentRootGrid.Background, "ContentRootGrid");
00100                     VerifyLightDismissTipBackground(mainContentPresenter.Background, "MainContentPresenter");
00101                     VerifyLightDismissTipBackground(heroContentBorder.Background, "HeroContentBorder");
00102
00103                     void VerifyLightDismissTipBackground(Brush brush, string uiPart)
00104                     {
00105                         if (lightDismissBackgroundBrush != brush)
00106                         {
00107                             if (brush is SolidColorBrush actualSolidBrush)
00108                             {
00109                                 string teachingTipMessage = $"LightDismiss TeachingTip's {uiPart} Background is SolidColorBrush with color {actualSolidBrush.Color}";
00110                                 Log.Comment(teachingTipMessage);
00111                                 Verify.Fail(teachingTipMessage);
00112                             }
00113                             else
00114                             {
00115                                 Verify.AreSame(lightDismissBackgroundBrush, brush, $"Checking LightDismiss TeachingTip's {uiPart} Background is using resource for first invocation");
00116                             }
00117                         }
00118                     }
00119                 }
00120
00121                 teachingTip.IsLightDismissEnabled = true;
00122             });
00123
00124             IdleSynchronizer.Wait();
00125
00126             RunOnUIThread.Execute(() =>
00127             {
00128                 Verify.AreEqual(blueBrush.Color, ((SolidColorBrush)teachingTip.Background).Color);
00129
00130                 var popup = TeachingTipTestHooks.GetPopup(teachingTip);
00131                 var child = popup.Child as Grid;
00132
00133                 Polygon tailPolygon = VisualTreeUtils.FindVisualChildByName(child, "TailPolygon") as Polygon;
00134                 Grid contentRootGrid = VisualTreeUtils.FindVisualChildByName(child, "ContentRootGrid") as Grid;
00135                 ContentPresenter mainContentPresenter = VisualTreeUtils.FindVisualChildByName(child, "MainContentPresenter") as ContentPresenter;
00136                 Border heroContentBorder = VisualTreeUtils.FindVisualChildByName(child, "HeroContentBorder") as Border;
00137
00138                 VerifyBackgroundChanged(tailPolygon.Fill, "TailPolygon");
00139                 VerifyBackgroundChanged(contentRootGrid.Background, "ContentRootGrid");
00140                 VerifyBackgroundChanged(mainContentPresenter.Background, "MainContentPresenter");
00141                 VerifyBackgroundChanged(heroContentBorder.Background, "HeroContentBorder");
00142
00143                 void VerifyBackgroundChanged(Brush brush, string uiPart)
00144                 {
00145                     // If we can no longer cast the background brush to a solid color brush then changing the
00146                     // IsLightDismissEnabled has changed the background as we expected it to.
00147                     if (brush is SolidColorBrush solidColorBrush)
00148                     {
00149                         Verify.AreNotEqual(blueBrush.Color, solidColorBrush.Color, $"TeachingTip's {uiPart} Background should have changed");
00150                     }
00151                 }
00152             });
00153         }
00154
00155         [TestMethod]
00156         public void TeachingTipWithContentAndWithoutHeroContentDoesNotCrash()
00157         {
00158             var loadedEvent = new AutoResetEvent(false);
00159             RunOnUIThread.Execute(() =>
00160             {
00161                 Grid contentGrid = new Grid();
00162                 SymbolIconSource iconSource = new SymbolIconSource();
00163                 iconSource.Symbol = Symbol.People;
00164                 TeachingTip teachingTip = new TeachingTip();
00165                 teachingTip.Content = contentGrid;
00166                 teachingTip.IconSource = (IconSource)iconSource;
00167                 teachingTip.Loaded += (object sender, RoutedEventArgs args) => { loadedEvent.Set(); };
00168                 Content = teachingTip;
00169             });
00170
00171             IdleSynchronizer.Wait();
00172             loadedEvent.WaitOne();
00173         }
00174
00175         [TestMethod]
00176         public void TeachingTipWithContentAndWithoutIconSourceDoesNotCrash()
00177         {
00178             var loadedEvent = new AutoResetEvent(false);
00179             RunOnUIThread.Execute(() =>
00180             {
00181                 Grid contentGrid = new Grid();
00182                 Grid heroGrid = new Grid();
00183                 TeachingTip teachingTip = new TeachingTip();
00184                 teachingTip.Content = contentGrid;
00185                 teachingTip.HeroContent = heroGrid;
00186                 teachingTip.Loaded += (object sender, RoutedEventArgs args) => { loadedEvent.Set(); };
00187                 Content = teachingTip;
00188             });
00189
00190             IdleSynchronizer.Wait();
00191             loadedEvent.WaitOne();
00192         }
00193
00194         [TestMethod]
00195         public void PropagatePropertiesDown()
00196         {
00197             TextBlock content = null;
00198             TeachingTip tip = null;
00199             RunOnUIThread.Execute(() =>
00200             {
00201                 content = new TextBlock() {
00202                     Text = "Some text"
00203                 };
00204
00205                 tip = new TeachingTip() {
00206                     Content = content,
00207                     FontSize = 22,
00208                     Foreground = new SolidColorBrush() {
00209                         Color = Colors.Red
00210                     }
00211                 };
00212
00213                 Content = tip;
00214                 Content.UpdateLayout();
00215                 tip.IsOpen = true;
00216                 Content.UpdateLayout();
00217             });
00218
00219             IdleSynchronizer.Wait();
00220
00221             RunOnUIThread.Execute(() =>
00222             {
00223                 Verify.IsTrue(Math.Abs(22 - content.FontSize) < 1);
00224                 var foregroundBrush = content.Foreground as SolidColorBrush;
00225                 Verify.AreEqual(Colors.Red, foregroundBrush.Color);
00226             });
00227         }
00228
00229         [TestMethod]
00230         public void VerifySubTitleBlockVisibilityOnInitialUnset()
00231         {
00232             TeachingTip teachingTip = null;
00233             RunOnUIThread.Execute(() =>
00234             {
00235                 teachingTip = new TeachingTip();
00236                 teachingTip.IsOpen = true;
00237                 Content = teachingTip;
00238             });
00239
00240             IdleSynchronizer.Wait();
00241
00242             RunOnUIThread.Execute(() =>
00243             {
00244                 Verify.AreEqual("", teachingTip.Title);
00245                 Verify.AreEqual(Visibility.Collapsed,
00246                     TeachingTipTestHooks.GetTitleVisibility(teachingTip));
00247                 Verify.AreEqual("", teachingTip.Subtitle);
00248                 Verify.AreEqual(Visibility.Collapsed,
00249                     TeachingTipTestHooks.GetSubtitleVisibility(teachingTip));
00250             });
00251         }
00252
00253         [TestMethod]
00254         public void TeachingTipHeroContentPlacementTest()
00255         {
00256             RunOnUIThread.Execute(() =>
00257             {
00258                 foreach (var iPlacementMode in Enum.GetValues(typeof(TeachingTipHeroContentPlacementMode)))
00259                 {
00260                     var placementMode = (TeachingTipHeroContentPlacementMode)iPlacementMode;
00261
00262                     Log.Comment($"Verifying TeachingTipHeroContentPlacementMode [{placementMode}]");
00263
00264                     TeachingTip teachingTip = new TeachingTip();
00265                     teachingTip.HeroContentPlacement = placementMode;
00266
00267                     // Open the teaching tip to enter the correct visual state for the HeroContentPlacement.
00268                     teachingTip.IsOpen = true;
00269
00270                     Content = teachingTip;
00271                     Content.UpdateLayout();
00272
00273                     Verify.IsTrue(teachingTip.HeroContentPlacement == placementMode, $"HeroContentPlacement should have been [{placementMode}]");
00274
00275                     var root = VisualTreeUtils.FindVisualChildByName(teachingTip, "Container") as FrameworkElement;
00276
00277                     switch (placementMode)
00278                     {
00279                         case TeachingTipHeroContentPlacementMode.Auto:
00280                             Verify.IsTrue(IsVisualStateActive(root, "HeroContentPlacementStates", "HeroContentTop"),
00281                                 "The [HeroContentTop] visual state should have been active");
00282                             break;
00283                         case TeachingTipHeroContentPlacementMode.Top:
00284                             Verify.IsTrue(IsVisualStateActive(root, "HeroContentPlacementStates", "HeroContentTop"),
00285                                 "The [HeroContentTop] visual state should have been active");
00286                             break;
00287                         case TeachingTipHeroContentPlacementMode.Bottom:
00288                             Verify.IsTrue(IsVisualStateActive(root, "HeroContentPlacementStates", "HeroContentBottom"),
00289                                 "The [HeroContentBottom] visual state should have been active");
00290                             break;
00291                     }
00292                 }
00293             });
00294
00295             bool IsVisualStateActive(FrameworkElement root, string groupName, string stateName)
00296             {
00297                 foreach (var group in VisualStateManager.GetVisualStateGroups(root))
00298                 {
00299                     if (group.Name == groupName)
00300                     {
00301                         return group.CurrentState != null && group.CurrentState.Name == stateName;
00302                     }
00303                 }
00304
00305                 return false;
00306             }
00307         }
00308     }
00309 }
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SwipeControl/SwipeControl.idl Source File

  • SwipeControl

SwipeControl.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 runtimeclass SwipeItems;
00005 runtimeclass SwipeControl;
00006 runtimeclass SwipeItemInvokedEventArgs;
00007 runtimeclass SwipeItem;
00008
00009 [MUX_PUBLIC]
00010 [webhosthidden]
00011 enum SwipeBehaviorOnInvoked
00012 {
00013     Auto = 0,
00014     Close = 1,
00015     RemainOpen = 2,
00016 };
00017
00018 [MUX_PUBLIC]
00019 [webhosthidden]
00020 enum SwipeMode
00021 {
00022     Reveal = 0,
00023     Execute = 1,
00024 };
00025
00026 [MUX_PUBLIC]
00027 [webhosthidden]
00028 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00029 unsealed runtimeclass SwipeItems : Microsoft.UI.Xaml.DependencyObject, Windows.Foundation.Collections.IVector<SwipeItem>
00030 {
00031     SwipeItems();
00032
00033     [MUX_DEFAULT_VALUE("winrt::SwipeMode::Reveal")]
00034     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00035     SwipeMode Mode { get; set; };
00036
00037     static Microsoft.UI.Xaml.DependencyProperty ModeProperty { get; };
00038 }
00039
00040 [MUX_PUBLIC]
00041 [webhosthidden]
00042 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00043 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00044 unsealed runtimeclass SwipeControl : Microsoft.UI.Xaml.Controls.ContentControl
00045 {
00046     SwipeControl();
00047
00048     SwipeItems LeftItems { get; set; };
00049     SwipeItems RightItems { get; set; };
00050     SwipeItems TopItems { get; set; };
00051     SwipeItems BottomItems { get; set; };
00052     void Close();
00053
00054     static Microsoft.UI.Xaml.DependencyProperty LeftItemsProperty { get; };
00055     static Microsoft.UI.Xaml.DependencyProperty RightItemsProperty { get; };
00056     static Microsoft.UI.Xaml.DependencyProperty TopItemsProperty { get; };
00057     static Microsoft.UI.Xaml.DependencyProperty BottomItemsProperty { get; };
00058 }
00059
00060 [MUX_PUBLIC]
00061 [webhosthidden]
00062 runtimeclass SwipeItemInvokedEventArgs
00063 {
00064     SwipeControl SwipeControl { get; };
00065 }
00066
00067 [MUX_PUBLIC]
00068 [webhosthidden]
00069 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00070 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00071 unsealed runtimeclass SwipeItem : Microsoft.UI.Xaml.DependencyObject
00072 {
00073     SwipeItem();
00074
00075     String Text { get; set; };
00076     IconSource IconSource { get; set; };
00077     Microsoft.UI.Xaml.Media.Brush Background { get; set; };
00078     Microsoft.UI.Xaml.Media.Brush Foreground { get; set; };
00079     Microsoft.UI.Xaml.Input.ICommand Command { get; set; };
00080     Object CommandParameter { get; set; };
00081     [MUX_DEFAULT_VALUE("winrt::SwipeBehaviorOnInvoked::Auto")]
00082     SwipeBehaviorOnInvoked BehaviorOnInvoked { get; set; };
00083     event Windows.Foundation.TypedEventHandler<SwipeItem, SwipeItemInvokedEventArgs> Invoked;
00084
00085     static Microsoft.UI.Xaml.DependencyProperty IconSourceProperty { get; };
00086     static Microsoft.UI.Xaml.DependencyProperty TextProperty { get; };
00087     static Microsoft.UI.Xaml.DependencyProperty BackgroundProperty { get; };
00088     static Microsoft.UI.Xaml.DependencyProperty ForegroundProperty { get; };
00089     static Microsoft.UI.Xaml.DependencyProperty CommandProperty { get; };
00090     static Microsoft.UI.Xaml.DependencyProperty CommandParameterProperty { get; };
00091     static Microsoft.UI.Xaml.DependencyProperty BehaviorOnInvokedProperty { get; };
00092 }
00093
00094 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PageInfo Member List

This is the complete list of members for PageInfo, including all inherited members.
Level0Layout | PageInfo
Level1Layout | PageInfo
Level2Layout | PageInfo
NumLevels | PageInfo
Orientation | PageInfo
Generated on Sun Dec 1 2024 20:54:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressBar/ProgressBar.idl Source File

  • ProgressBar

ProgressBar.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 [MUX_PROPERTY_NEEDS_DP_FIELD]
00007 runtimeclass ProgressBarTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00008 {
00009     Double ContainerAnimationStartPosition{ get; };
00010     Double ContainerAnimationEndPosition{ get; };
00011     Double Container2AnimationStartPosition{ get; };
00012     Double Container2AnimationEndPosition{ get; };
00013     Double ContainerAnimationMidPosition{ get; };
00014     Double IndicatorLengthDelta{ get; };
00015     Microsoft.UI.Xaml.Media.RectangleGeometry ClipRect{ get; };
00016
00017     // TemplateSetting properties from WUXC for backwards compatibility.
00018     Double EllipseAnimationEndPosition{ get; };
00019     Double EllipseAnimationWellPosition{ get; };
00020     Double EllipseDiameter{ get; };
00021     Double EllipseOffset{ get; };
00022 }
00023
00024 [MUX_PUBLIC]
00025 [webhosthidden]
00026 unsealed runtimeclass ProgressBar : Microsoft.UI.Xaml.Controls.Primitives.RangeBase
00027 {
00028     ProgressBar();
00029
00030     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00031     Boolean IsIndeterminate{ get; set; };
00032
00033     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00034     Boolean ShowError{ get; set; };
00035
00036     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00037     Boolean ShowPaused{ get; set; };
00038
00039     [MUX_PROPERTY_NEEDS_DP_FIELD]
00040     ProgressBarTemplateSettings TemplateSettings{ get; };
00041
00042     static Microsoft.UI.Xaml.DependencyProperty IsIndeterminateProperty{ get; };
00043     static Microsoft.UI.Xaml.DependencyProperty ShowErrorProperty{ get; };
00044     static Microsoft.UI.Xaml.DependencyProperty ShowPausedProperty{ get; };
00045 }
00046
00047 }
00048
00049 namespace MU_XAP_NAMESPACE
00050 {
00051
00052 [MUX_PUBLIC]
00053 [webhosthidden]
00054 unsealed runtimeclass ProgressBarAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.RangeBaseAutomationPeer
00055 {
00056     ProgressBarAutomationPeer(MU_XC_NAMESPACE.ProgressBar owner);
00057 }
00058
00059 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeStructure Member List

This is the complete list of members for TreeStructure, including all inherited members.
GetRootAsList() | TreeStructure | [inline]
Root | TreeStructure |
UpdateParents() | TreeStructure | [inline]
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

GlobalDependencyProperty Member List

This is the complete list of members for GlobalDependencyProperty, including all inherited members.
GlobalDependencyProperty() | GlobalDependencyProperty |
GlobalDependencyProperty(nullptr_t) | GlobalDependencyProperty | [inline]
GlobalDependencyProperty(winrt::DependencyProperty const &other) | GlobalDependencyProperty | [inline]
GlobalDependencyProperty(GlobalDependencyProperty const &) | GlobalDependencyProperty |
operator bool() const | GlobalDependencyProperty | [inline]
operator winrt::DependencyProperty() const | GlobalDependencyProperty | [inline]
operator=(nullptr_t) | GlobalDependencyProperty | [inline]
operator=(winrt::DependencyProperty const &other) | GlobalDependencyProperty | [inline]
operator=(GlobalDependencyProperty const &other) | GlobalDependencyProperty |
operator==(winrt::DependencyProperty const &other) const | GlobalDependencyProperty | [inline]
operator==(nullptr_t) const | GlobalDependencyProperty | [inline]
Property() | GlobalDependencyProperty | [inline, private]
Property() const | GlobalDependencyProperty | [inline, private]
Generated on Sun Dec 1 2024 20:52:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarStencilButton.properties.h Source File

  • Generated

InkToolBarStencilButton.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InkToolBarStencilButtonProperties
00008 {
00009 public:
00010     InkToolBarStencilButtonProperties();
00011
00012     void IsProtractorItemVisible(bool value);
00013     bool IsProtractorItemVisible();
00014
00015     void IsRulerItemVisible(bool value);
00016     bool IsRulerItemVisible();
00017
00018     void Protractor(winrt::InkPresenterProtractor const& value);
00019     winrt::InkPresenterProtractor Protractor();
00020
00021     void Ruler(winrt::InkPresenterRuler const& value);
00022     winrt::InkPresenterRuler Ruler();
00023
00024     void SelectedStencil(winrt::InkToolBarStencilKind const& value);
00025     winrt::InkToolBarStencilKind SelectedStencil();
00026
00027     static winrt::DependencyProperty IsProtractorItemVisibleProperty() { return s_IsProtractorItemVisibleProperty; }
00028     static winrt::DependencyProperty IsRulerItemVisibleProperty() { return s_IsRulerItemVisibleProperty; }
00029     static winrt::DependencyProperty ProtractorProperty() { return s_ProtractorProperty; }
00030     static winrt::DependencyProperty RulerProperty() { return s_RulerProperty; }
00031     static winrt::DependencyProperty SelectedStencilProperty() { return s_SelectedStencilProperty; }
00032
00033     static GlobalDependencyProperty s_IsProtractorItemVisibleProperty;
00034     static GlobalDependencyProperty s_IsRulerItemVisibleProperty;
00035     static GlobalDependencyProperty s_ProtractorProperty;
00036     static GlobalDependencyProperty s_RulerProperty;
00037     static GlobalDependencyProperty s_SelectedStencilProperty;
00038
00039     static void EnsureProperties();
00040     static void ClearProperties();
00041 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemContainer/ItemContainerInvokedEventArgs.cpp Source File

  • ItemContainer

ItemContainerInvokedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ItemContainerInvokedEventArgs.h"
00007
00008 ItemContainerInvokedEventArgs::ItemContainerInvokedEventArgs(const winrt::ItemContainerInteractionTrigger& interactionTrigger, const winrt::IInspectable& originalSource)
00009 {
00010     m_interactionTrigger = interactionTrigger;
00011     m_originalSource.set(originalSource);
00012 }
00013
00014 #pragma region IItemContainerInvokedEventArgs
00015
00016 winrt::IInspectable ItemContainerInvokedEventArgs::OriginalSource()
00017 {
00018     return m_originalSource.get();
00019 }
00020
00021 winrt::ItemContainerInteractionTrigger ItemContainerInvokedEventArgs::InteractionTrigger()
00022 {
00023     return m_interactionTrigger;
00024 }
00025
00026 bool ItemContainerInvokedEventArgs::Handled()
00027 {
00028     return m_handled;
00029 }
00030
00031 void ItemContainerInvokedEventArgs::Handled(bool value)
00032 {
00033     m_handled = value;
00034 }
00035
00036 #pragma endregion
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InfoBarTemplateSettings Member List

This is the complete list of members for InfoBarTemplateSettings, including all inherited members.
ClearProperties() | InfoBarTemplateSettingsProperties | [static]
EnsureProperties() | InfoBarTemplateSettingsProperties | [static]
IconElement(winrt::IconElement const &value) | InfoBarTemplateSettingsProperties |
IconElement() | InfoBarTemplateSettingsProperties |
IconElementProperty() | InfoBarTemplateSettingsProperties | [inline, static]
InfoBarTemplateSettings() | InfoBarTemplateSettings |
InfoBarTemplateSettingsProperties() | InfoBarTemplateSettingsProperties |
s_IconElementProperty | InfoBarTemplateSettingsProperties | [static]
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/MultipleSelector.h Source File

  • ItemsView

MultipleSelector.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SelectorBase.h"
00007
00008 class MultipleSelector : public SelectorBase
00009 {
00010 public:
00011     MultipleSelector();
00012     ~MultipleSelector();
00013
00014     void OnInteractedAction(winrt::IndexPath const& index, bool ctrl, bool shift) override;
00015     void OnFocusedAction(winrt::IndexPath const& index, bool ctrl, bool shift) override;
00016 };
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/Common/ReadOnlyNotifyPropertyChangedCollection.cs Source File

  • Repeater
  • APITests
  • Common

ReadOnlyNotifyPropertyChangedCollection.cs

Go to the documentation of this file.
00001 ﻿using Microsoft.UI.Xaml.Controls;
00002 using System;
00003 using System.Collections;
00004 using System.Collections.Generic;
00005 using System.Collections.ObjectModel;
00006 using System.Collections.Specialized;
00007 using System.Text;
00008
00009 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common
00010 {
00011     public class ReadOnlyNotifyPropertyChangedCollection<T> : IReadOnlyList<T>, INotifyCollectionChanged, IKeyIndexMapping
00012     {
00013         public ReadOnlyNotifyPropertyChangedCollection() { }
00014
00015         public ReadOnlyNotifyPropertyChangedCollection(IEnumerable<T> data)
00016         {
00017             Data = new ObservableCollection<T>(data);
00018         }
00019
00020         #region IReadOnlyList<T>
00021
00022         public int Count => Data.Count;
00023
00024         public T this[int index] => Data[index];
00025
00026         public IEnumerator<T> GetEnumerator()
00027         {
00028             throw new NotImplementedException("This is not implemented and should not have be used");
00029         }
00030
00031         IEnumerator IEnumerable.GetEnumerator()
00032         {
00033             throw new NotImplementedException("This is not implemented and should not have be used");
00034         }
00035
00036         #endregion
00037
00038         #region INotifyCollectionChanged
00039
00040         public event NotifyCollectionChangedEventHandler CollectionChanged;
00041
00042         protected virtual void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
00043         {
00044             this.CollectionChanged?.Invoke(this, e);
00045         }
00046
00047         #endregion
00048
00049         public string KeyFromIndex(int index)
00050         {
00051             return this[index].GetHashCode().ToString();
00052         }
00053
00054         public int IndexFromKey(string key)
00055         {
00056             throw new Exception();
00057         }
00058
00059         public ObservableCollection<T> Data
00060         {
00061             get
00062             {
00063                 if (_data == null)
00064                 {
00065                     _data = new ObservableCollection<T>();
00066                 }
00067                 return _data;
00068             }
00069
00070             set
00071             {
00072                 if (_data != value)
00073                 {
00074                     // Listen for future changes
00075                     if (_data != null)
00076                         _data.CollectionChanged -= this.OnCollectionChanged;
00077
00078                     _data = value;
00079
00080                     if (_data != null)
00081                         _data.CollectionChanged += this.OnCollectionChanged;
00082                 }
00083
00084                 // Raise a reset event
00085                 this.OnCollectionChanged(
00086                     this,
00087                     new NotifyCollectionChangedEventArgs(
00088                         NotifyCollectionChangedAction.Reset));
00089             }
00090         }
00091
00092         private ObservableCollection<T> _data = null;
00093     }
00094 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InfoBadgeTemplateSettings.properties.cpp Source File

  • Generated

InfoBadgeTemplateSettings.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InfoBadgeTemplateSettings.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(InfoBadgeTemplateSettings)
00012 }
00013
00014 #include "InfoBadgeTemplateSettings.g.cpp"
00015
00016 GlobalDependencyProperty InfoBadgeTemplateSettingsProperties::s_IconElementProperty{ nullptr };
00017 GlobalDependencyProperty InfoBadgeTemplateSettingsProperties::s_InfoBadgeCornerRadiusProperty{ nullptr };
00018
00019 InfoBadgeTemplateSettingsProperties::InfoBadgeTemplateSettingsProperties()
00020 {
00021     EnsureProperties();
00022 }
00023
00024 void InfoBadgeTemplateSettingsProperties::EnsureProperties()
00025 {
00026     if (!s_IconElementProperty)
00027     {
00028         s_IconElementProperty =
00029             InitializeDependencyProperty(
00030                 L"IconElement",
00031                 winrt::name_of<winrt::IconElement>(),
00032                 winrt::name_of<winrt::InfoBadgeTemplateSettings>(),
00033                 false /* isAttached */,
00034                 ValueHelper<winrt::IconElement>::BoxedDefaultValue(),
00035                 nullptr);
00036     }
00037     if (!s_InfoBadgeCornerRadiusProperty)
00038     {
00039         s_InfoBadgeCornerRadiusProperty =
00040             InitializeDependencyProperty(
00041                 L"InfoBadgeCornerRadius",
00042                 winrt::name_of<winrt::CornerRadius>(),
00043                 winrt::name_of<winrt::InfoBadgeTemplateSettings>(),
00044                 false /* isAttached */,
00045                 ValueHelper<winrt::CornerRadius>::BoxedDefaultValue(),
00046                 nullptr);
00047     }
00048 }
00049
00050 void InfoBadgeTemplateSettingsProperties::ClearProperties()
00051 {
00052     s_IconElementProperty = nullptr;
00053     s_InfoBadgeCornerRadiusProperty = nullptr;
00054 }
00055
00056 void InfoBadgeTemplateSettingsProperties::IconElement(winrt::IconElement const& value)
00057 {
00058     [[gsl::suppress(con)]]
00059     {
00060     static_cast<InfoBadgeTemplateSettings*>(this)->SetValue(s_IconElementProperty, ValueHelper<winrt::IconElement>::BoxValueIfNecessary(value));
00061     }
00062 }
00063
00064 winrt::IconElement InfoBadgeTemplateSettingsProperties::IconElement()
00065 {
00066     return ValueHelper<winrt::IconElement>::CastOrUnbox(static_cast<InfoBadgeTemplateSettings*>(this)->GetValue(s_IconElementProperty));
00067 }
00068
00069 void InfoBadgeTemplateSettingsProperties::InfoBadgeCornerRadius(winrt::CornerRadius const& value)
00070 {
00071     [[gsl::suppress(con)]]
00072     {
00073     static_cast<InfoBadgeTemplateSettings*>(this)->SetValue(s_InfoBadgeCornerRadiusProperty, ValueHelper<winrt::CornerRadius>::BoxValueIfNecessary(value));
00074     }
00075 }
00076
00077 winrt::CornerRadius InfoBadgeTemplateSettingsProperties::InfoBadgeCornerRadius()
00078 {
00079     return ValueHelper<winrt::CornerRadius>::CastOrUnbox(static_cast<InfoBadgeTemplateSettings*>(this)->GetValue(s_InfoBadgeCornerRadiusProperty));
00080 }
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ReferenceTrackerStorageHelper< ImplT, T > Member List

This is the complete list of members for ReferenceTrackerStorageHelper< ImplT, T >, including all inherited members.
Impl() const | ReferenceTrackerStorageHelper< ImplT, T > | [inline, private]
unwrap(const tracker_ref< T > &holder) const | ReferenceTrackerStorageHelper< ImplT, T > | [inline]
wrap(const T &value) const | ReferenceTrackerStorageHelper< ImplT, T > | [inline]
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/SpectrumBrush.properties.h Source File

  • Generated

SpectrumBrush.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class SpectrumBrushProperties
00008 {
00009 public:
00010     SpectrumBrushProperties();
00011
00012     void MaxSurface(winrt::LoadedImageSurface const& value);
00013     winrt::LoadedImageSurface MaxSurface();
00014
00015     void MaxSurfaceOpacity(double value);
00016     double MaxSurfaceOpacity();
00017
00018     void MinSurface(winrt::LoadedImageSurface const& value);
00019     winrt::LoadedImageSurface MinSurface();
00020
00021     static winrt::DependencyProperty MaxSurfaceProperty() { return s_MaxSurfaceProperty; }
00022     static winrt::DependencyProperty MaxSurfaceOpacityProperty() { return s_MaxSurfaceOpacityProperty; }
00023     static winrt::DependencyProperty MinSurfaceProperty() { return s_MinSurfaceProperty; }
00024
00025     static GlobalDependencyProperty s_MaxSurfaceProperty;
00026     static GlobalDependencyProperty s_MaxSurfaceOpacityProperty;
00027     static GlobalDependencyProperty s_MinSurfaceProperty;
00028
00029     static void EnsureProperties();
00030     static void ClearProperties();
00031
00032     static void OnMaxSurfacePropertyChanged(
00033         winrt::DependencyObject const& sender,
00034         winrt::DependencyPropertyChangedEventArgs const& args);
00035
00036     static void OnMaxSurfaceOpacityPropertyChanged(
00037         winrt::DependencyObject const& sender,
00038         winrt::DependencyPropertyChangedEventArgs const& args);
00039
00040     static void OnMinSurfacePropertyChanged(
00041         winrt::DependencyObject const& sender,
00042         winrt::DependencyPropertyChangedEventArgs const& args);
00043 };
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/TestUI/ScrollPresentersWithSimpleContentsPage.xaml.cs Source File

  • ScrollPresenter
  • TestUI

ScrollPresentersWithSimpleContentsPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.Generic;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Navigation;
00009
00010 using ScrollPresenter = Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter;
00011 using ScrollingInteractionState = Microsoft.UI.Xaml.Controls.ScrollingInteractionState;
00012 using ScrollingAnimationMode = Microsoft.UI.Xaml.Controls.ScrollingAnimationMode;
00013 using ScrollingSnapPointsMode = Microsoft.UI.Xaml.Controls.ScrollingSnapPointsMode;
00014 using ScrollingScrollOptions = Microsoft.UI.Xaml.Controls.ScrollingScrollOptions;
00015 using ScrollingZoomOptions = Microsoft.UI.Xaml.Controls.ScrollingZoomOptions;
00016 using ScrollingScrollCompletedEventArgs = Microsoft.UI.Xaml.Controls.ScrollingScrollCompletedEventArgs;
00017 using ScrollingZoomCompletedEventArgs = Microsoft.UI.Xaml.Controls.ScrollingZoomCompletedEventArgs;
00018
00019 using ScrollPresenterTestHooks = Microsoft.UI.Private.Controls.ScrollPresenterTestHooks;
00020 using ScrollPresenterViewChangeResult = Microsoft.UI.Private.Controls.ScrollPresenterViewChangeResult;
00021 using MUXControlsTestHooks = Microsoft.UI.Private.Controls.MUXControlsTestHooks;
00022 using MUXControlsTestHooksLoggingMessageEventArgs = Microsoft.UI.Private.Controls.MUXControlsTestHooksLoggingMessageEventArgs;
00023
00024 namespace MUXControlsTestApp
00025 {
00026     public sealed partial class ScrollPresentersWithSimpleContentsPage : TestPage
00027     {
00028         private List<string> fullLogs = new List<string>();
00029         private int scrollPresenter52ZoomFactorChangeCorrelationId = -1;
00030         private bool canScrollPresenter51ContentShrink = true;
00031
00032         public ScrollPresentersWithSimpleContentsPage()
00033         {
00034             this.InitializeComponent();
00035
00036             this.scrollPresenter11.StateChanged += ScrollPresenter_StateChanged;
00037             this.scrollPresenter21.StateChanged += ScrollPresenter_StateChanged;
00038             this.scrollPresenter31.StateChanged += ScrollPresenter_StateChanged;
00039             this.scrollPresenter41.StateChanged += ScrollPresenter_StateChanged;
00040             this.scrollPresenter51.StateChanged += ScrollPresenter_StateChanged;
00041             this.scrollPresenter11.ViewChanged += ScrollPresenter_ViewChanged;
00042             this.scrollPresenter21.ViewChanged += ScrollPresenter_ViewChanged;
00043             this.scrollPresenter31.ViewChanged += ScrollPresenter_ViewChanged;
00044             this.scrollPresenter41.ViewChanged += ScrollPresenter_ViewChanged;
00045             this.scrollPresenter51.ViewChanged += ScrollPresenter_ViewChanged;
00046             this.scrollPresenter11.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00047             this.scrollPresenter21.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00048             this.scrollPresenter31.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00049             this.scrollPresenter41.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00050             this.scrollPresenter51.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00051             this.scrollPresenter11.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00052             this.scrollPresenter21.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00053             this.scrollPresenter31.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00054             this.scrollPresenter41.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00055             this.scrollPresenter51.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00056
00057             this.scrollPresenter12.StateChanged += ScrollPresenter_StateChanged;
00058             this.scrollPresenter22.StateChanged += ScrollPresenter_StateChanged;
00059             this.scrollPresenter32.StateChanged += ScrollPresenter_StateChanged;
00060             this.scrollPresenter42.StateChanged += ScrollPresenter_StateChanged;
00061             this.scrollPresenter52.StateChanged += ScrollPresenter_StateChanged;
00062             this.scrollPresenter12.ViewChanged += ScrollPresenter_ViewChanged;
00063             this.scrollPresenter22.ViewChanged += ScrollPresenter_ViewChanged;
00064             this.scrollPresenter32.ViewChanged += ScrollPresenter_ViewChanged;
00065             this.scrollPresenter42.ViewChanged += ScrollPresenter_ViewChanged;
00066             this.scrollPresenter52.ViewChanged += ScrollPresenter_ViewChanged;
00067             this.scrollPresenter12.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00068             this.scrollPresenter22.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00069             this.scrollPresenter32.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00070             this.scrollPresenter42.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00071             this.scrollPresenter52.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00072             this.scrollPresenter11.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00073             this.scrollPresenter21.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00074             this.scrollPresenter31.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00075             this.scrollPresenter41.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00076             this.scrollPresenter51.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00077
00078             ScrollPresenterTestHooks.ContentLayoutOffsetXChanged += ScrollPresenterTestHooks_ContentLayoutOffsetXChanged;
00079             ScrollPresenterTestHooks.ContentLayoutOffsetYChanged += ScrollPresenterTestHooks_ContentLayoutOffsetYChanged;
00080         }
00081
00082         ~ScrollPresentersWithSimpleContentsPage()
00083         {
00084         }
00085
00086         protected override void OnNavigatedFrom(NavigationEventArgs e)
00087         {
00088             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00089             MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00090
00091             base.OnNavigatedFrom(e);
00092         }
00093
00094         private void ScrollPresenter_StateChanged(ScrollPresenter sender, object args)
00095         {
00096             this.txtScrollPresenterState.Text = sender.Name + " " + sender.State.ToString();
00097             this.fullLogs.Add(sender.Name + " StateChanged S=" + sender.State.ToString());
00098
00099             if (!canScrollPresenter51ContentShrink && sender == scrollPresenter51 && scrollPresenter51.State == ScrollingInteractionState.Idle)
00100             {
00101                 canScrollPresenter51ContentShrink = true;
00102             }
00103         }
00104
00105         private void ScrollPresenter_ViewChanged(ScrollPresenter sender, object args)
00106         {
00107             this.txtScrollPresenterHorizontalOffset.Text = sender.HorizontalOffset.ToString();
00108             this.txtScrollPresenterVerticalOffset.Text = sender.VerticalOffset.ToString();
00109             this.txtScrollPresenterZoomFactor.Text = sender.ZoomFactor.ToString();
00110             this.fullLogs.Add(sender.Name + " ViewChanged H=" + this.txtScrollPresenterHorizontalOffset.Text + ", V=" + this.txtScrollPresenterVerticalOffset.Text + ", S=" + this.txtScrollPresenterZoomFactor.Text);
00111
00112             if (canScrollPresenter51ContentShrink && sender == scrollPresenter51)
00113             {
00114                 FrameworkElement content = scrollPresenter51.Content as FrameworkElement;
00115
00116                 if (scrollPresenter51.HorizontalOffset > scrollPresenter51.ScrollableWidth + 20.0)
00117                 {
00118                     canScrollPresenter51ContentShrink = false;
00119                     content.Width -= 30.0;
00120                 }
00121                 if (scrollPresenter51.VerticalOffset > scrollPresenter51.ScrollableHeight + 25.0)
00122                 {
00123                     canScrollPresenter51ContentShrink = false;
00124                     content.Height -= 40.0;
00125                 }
00126             }
00127         }
00128
00129         private void ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args)
00130         {
00131             ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetScrollCompletedResult(args);
00132
00133             this.fullLogs.Add(sender.Name + " ScrollCompleted OffsetsChangeCorrelationId=" + args.CorrelationId + ", Result=" + result);
00134         }
00135
00136         private void ScrollPresenter_ZoomCompleted(ScrollPresenter sender, ScrollingZoomCompletedEventArgs args)
00137         {
00138             ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetZoomCompletedResult(args);
00139
00140             this.fullLogs.Add(sender.Name + " ZoomCompleted ZoomFactorChangeCorrelationId=" + args.CorrelationId + ", Result=" + result);
00141
00142             if (this.scrollPresenter52ZoomFactorChangeCorrelationId == args.CorrelationId)
00143             {
00144                 this.txtResetStatus.Text = "Views reset";
00145             }
00146         }
00147
00148         private void CmbShowScrollPresenter_SelectionChanged(object sender, SelectionChangedEventArgs e)
00149         {
00150             if (this.scrollPresenter11 != null)
00151             {
00152                 if (cmbShowScrollPresenter.SelectedIndex == 0)
00153                 {
00154                     this.scrollPresenter11.Visibility = Visibility.Visible;
00155                     this.scrollPresenter21.Visibility = Visibility.Visible;
00156                     this.scrollPresenter31.Visibility = Visibility.Visible;
00157                     this.scrollPresenter41.Visibility = Visibility.Visible;
00158                     this.scrollPresenter51.Visibility = Visibility.Visible;
00159                     this.scrollPresenter12.Visibility = Visibility.Visible;
00160                     this.scrollPresenter22.Visibility = Visibility.Visible;
00161                     this.scrollPresenter32.Visibility = Visibility.Visible;
00162                     this.scrollPresenter42.Visibility = Visibility.Visible;
00163                     this.scrollPresenter52.Visibility = Visibility.Visible;
00164
00165                     this.scrollPresenter11.Width = double.NaN;
00166                     this.scrollPresenter21.Width = double.NaN;
00167                     this.scrollPresenter31.Width = double.NaN;
00168                     this.scrollPresenter41.Width = double.NaN;
00169                     this.scrollPresenter51.Width = double.NaN;
00170                     this.scrollPresenter12.Width = double.NaN;
00171                     this.scrollPresenter22.Width = double.NaN;
00172                     this.scrollPresenter32.Width = double.NaN;
00173                     this.scrollPresenter42.Width = double.NaN;
00174                     this.scrollPresenter52.Width = double.NaN;
00175                     this.scrollPresenter11.Height = double.NaN;
00176                     this.scrollPresenter21.Height = double.NaN;
00177                     this.scrollPresenter31.Height = double.NaN;
00178                     this.scrollPresenter41.Height = double.NaN;
00179                     this.scrollPresenter51.Height = double.NaN;
00180                     this.scrollPresenter12.Height = double.NaN;
00181                     this.scrollPresenter22.Height = double.NaN;
00182                     this.scrollPresenter32.Height = double.NaN;
00183                     this.scrollPresenter42.Height = double.NaN;
00184                     this.scrollPresenter52.Height = double.NaN;
00185
00186                     for (int rowIndex = 2; rowIndex < 4; rowIndex++)
00187                         this.rootGrid.RowDefinitions[rowIndex].Height = new GridLength(1, GridUnitType.Star);
00188
00189                     for (int columnIndex = 0; columnIndex < 5; columnIndex++)
00190                         this.rootGrid.ColumnDefinitions[columnIndex].Width = new GridLength(1, GridUnitType.Star);
00191                 }
00192                 else
00193                 {
00194                     this.scrollPresenter11.Visibility = Visibility.Collapsed;
00195                     this.scrollPresenter21.Visibility = Visibility.Collapsed;
00196                     this.scrollPresenter31.Visibility = Visibility.Collapsed;
00197                     this.scrollPresenter41.Visibility = Visibility.Collapsed;
00198                     this.scrollPresenter51.Visibility = Visibility.Collapsed;
00199                     this.scrollPresenter12.Visibility = Visibility.Collapsed;
00200                     this.scrollPresenter22.Visibility = Visibility.Collapsed;
00201                     this.scrollPresenter32.Visibility = Visibility.Collapsed;
00202                     this.scrollPresenter42.Visibility = Visibility.Collapsed;
00203                     this.scrollPresenter52.Visibility = Visibility.Collapsed;
00204
00205                     for (int rowIndex = 2; rowIndex < 4; rowIndex++)
00206                         this.rootGrid.RowDefinitions[rowIndex].Height = GridLength.Auto;
00207
00208                     for (int columnIndex = 0; columnIndex < 5; columnIndex++)
00209                         this.rootGrid.ColumnDefinitions[columnIndex].Width = GridLength.Auto;
00210
00211                     ScrollPresenter scrollPresenter = null;
00212
00213                     switch (cmbShowScrollPresenter.SelectedIndex)
00214                     {
00215                         case 1:
00216                             scrollPresenter = this.scrollPresenter11;
00217                             break;
00218                         case 2:
00219                             scrollPresenter = this.scrollPresenter21;
00220                             break;
00221                         case 3:
00222                             scrollPresenter = this.scrollPresenter31;
00223                             break;
00224                         case 4:
00225                             scrollPresenter = this.scrollPresenter41;
00226                             break;
00227                         case 5:
00228                             scrollPresenter = this.scrollPresenter51;
00229                             break;
00230                         case 6:
00231                             scrollPresenter = this.scrollPresenter12;
00232                             break;
00233                         case 7:
00234                             scrollPresenter = this.scrollPresenter22;
00235                             break;
00236                         case 8:
00237                             scrollPresenter = this.scrollPresenter32;
00238                             break;
00239                         case 9:
00240                             scrollPresenter = this.scrollPresenter42;
00241                             break;
00242                         case 10:
00243                             scrollPresenter = this.scrollPresenter52;
00244                             break;
00245                     }
00246
00247                     scrollPresenter.Visibility = Visibility.Visible;
00248                     scrollPresenter.Width = 300;
00249                     scrollPresenter.Height = 400;
00250                 }
00251             }
00252         }
00253
00254         private void ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e)
00255         {
00256             //Turn on info and verbose logging for the ScrollPresenter type:
00257             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00258
00259             MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00260         }
00261
00262         private void ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e)
00263         {
00264             //Turn off info and verbose logging for the ScrollPresenter type:
00265             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00266
00267             MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00268         }
00269
00270         private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
00271         {
00272             // Cut off the terminating new line.
00273             string msg = args.Message.Substring(0, args.Message.Length - 1);
00274             string senderName = string.Empty;
00275
00276             try
00277             {
00278                 FrameworkElement fe = sender as FrameworkElement;
00279
00280                 if (fe != null)
00281                 {
00282                     senderName = "s:" + fe.Name + ", ";
00283                 }
00284             }
00285             catch
00286             {
00287             }
00288
00289             if (args.IsVerboseLevel)
00290             {
00291                 this.fullLogs.Add("Verbose: " + senderName + "m:" + msg);
00292             }
00293             else
00294             {
00295                 this.fullLogs.Add("Info: " + senderName + "m:" + msg);
00296             }
00297         }
00298
00299         private void ScrollPresenterTestHooks_ContentLayoutOffsetXChanged(ScrollPresenter sender, object args)
00300         {
00301             float contentLayoutOffsetX = 0.0f;
00302
00303             ScrollPresenterTestHooks.GetContentLayoutOffsetX(sender, out contentLayoutOffsetX);
00304
00305             txtScrollPresenterContentLayoutOffsetX.Text = contentLayoutOffsetX.ToString();
00306         }
00307
00308         private void ScrollPresenterTestHooks_ContentLayoutOffsetYChanged(ScrollPresenter sender, object args)
00309         {
00310             float contentLayoutOffsetY = 0.0f;
00311
00312             ScrollPresenterTestHooks.GetContentLayoutOffsetY(sender, out contentLayoutOffsetY);
00313
00314             txtScrollPresenterContentLayoutOffsetY.Text = contentLayoutOffsetY.ToString();
00315         }
00316
00317         private void btnGetFullLog_Click(object sender, RoutedEventArgs e)
00318         {
00319             foreach (string log in this.fullLogs)
00320             {
00321                 this.cmbFullLog.Items.Add(log);
00322             }
00323         }
00324
00325         private void btnClearFullLog_Click(object sender, RoutedEventArgs e)
00326         {
00327             this.fullLogs.Clear();
00328             this.cmbFullLog.Items.Clear();
00329         }
00330
00331         private void btnResetViews_Click(object sender, RoutedEventArgs e)
00332         {
00333             this.txtResetStatus.Text = "Resetting views ...";
00334             ResetView(this.scrollPresenter11);
00335             ResetView(this.scrollPresenter21);
00336             ResetView(this.scrollPresenter31);
00337             ResetView(this.scrollPresenter41);
00338             ResetView(this.scrollPresenter51);
00339             ResetView(this.scrollPresenter12);
00340             ResetView(this.scrollPresenter22);
00341             ResetView(this.scrollPresenter32);
00342             ResetView(this.scrollPresenter42);
00343             ResetView(this.scrollPresenter52);
00344         }
00345
00346         private void ResetView(ScrollPresenter scrollPresenter)
00347         {
00348             int viewChangeCorrelationId = scrollPresenter.ScrollTo(
00349                 0.0,
00350                 0.0,
00351                 new ScrollingScrollOptions(ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore));
00352             this.fullLogs.Add(scrollPresenter.Name + " ScrollTo requested. Id=" + viewChangeCorrelationId);
00353
00354             viewChangeCorrelationId = scrollPresenter.ZoomTo(
00355                 1.0f,
00356                 System.Numerics.Vector2.Zero,
00357                 new ScrollingZoomOptions(ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore));
00358             this.fullLogs.Add(scrollPresenter.Name + " ZoomTo requested. Id=" + viewChangeCorrelationId);
00359             if (this.scrollPresenter52 == scrollPresenter)
00360             {
00361                 scrollPresenter52ZoomFactorChangeCorrelationId = viewChangeCorrelationId;
00362             }
00363         }
00364     }
00365 }
Generated on Sun Dec 1 2024 20:52:16 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Nullsource Member List

This is the complete list of members for Nullsource, including all inherited members.
TryCreateAnimatedVisual(Compositor compositor, out object diagnostics) Nullsource [inline]
Generated on Sun Dec 1 2024 20:53:30 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/BuildMacros.h Source File

  • inc

BuildMacros.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #define MUXCONTROLS_NAMESPACE Microsoft::UI::Xaml::Controls
00007 #define WINRT_MUXC_NAMESPACE winrt::Microsoft::UI::Xaml::Controls
00008 #define WINRT_MUXM_NAMESPACE winrt::Microsoft::UI::Xaml::Media
00009
00010
00011 #define MUXCONTROLSROOT_NAMESPACE_STR L"Microsoft.UI.Xaml"
00012 #define MUXCONTROLSMEDIA_NAMESPACE_STR L"Microsoft.UI.Xaml.Media"
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollViewerAdapterPage Member List

This is the complete list of members for ScrollViewerAdapterPage, including all inherited members.
AdaptOnSVWithoutWaitingForLoaded_Click(object sender, RoutedEventArgs e) | ScrollViewerAdapterPage | [inline, private]
CheckLeaks(Dictionary< string, WeakReference > objects) | ScrollViewerAdapterPage | [inline, private]
CheckLeaks_Click(object sender, RoutedEventArgs e) | ScrollViewerAdapterPage | [inline, private]
GC_Click(object sender, RoutedEventArgs e) | ScrollViewerAdapterPage | [inline, private]
objects | ScrollViewerAdapterPage | [private]
Remove_Click(object sender, RoutedEventArgs e) | ScrollViewerAdapterPage | [inline, private]
ScrollViewerAdapterPage() | ScrollViewerAdapterPage | [inline]
Generated on Sun Dec 1 2024 20:54:34 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ScrollSnapPointBase.properties.cpp Source File

  • Generated

ScrollSnapPointBase.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "ScrollSnapPointBase.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::Primitives
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(ScrollSnapPointBase)
00012 }
00013
00014 #include "ScrollSnapPointBase.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/TestUI/Footer/PaneFooterTestPage.xaml.cs Source File

  • NavigationView
  • TestUI
  • Footer

PaneFooterTestPage.xaml.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using Microsoft.UI.Xaml;
00003 using Microsoft.UI.Xaml.Controls;
00004 using Microsoft.UI.Xaml.Media;
00005 using NavigationViewPaneDisplayMode = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode;
00006
00007 namespace MUXControlsTestApp
00008 {
00009     /// <summary>
00010     /// An empty page that can be used on its own or navigated to within a Frame.
00011     /// </summary>
00012     public sealed partial class PaneFooterTestPage : TestPage
00013     {
00014         public PaneFooterTestPage()
00015         {
00016             this.InitializeComponent();
00017         }
00018
00019         private void FlipOrientation_Click(object sender, RoutedEventArgs e)
00020         {
00021             NavView.PaneDisplayMode = NavView.PaneDisplayMode == NavigationViewPaneDisplayMode.Top ? NavigationViewPaneDisplayMode.Auto : NavigationViewPaneDisplayMode.Top;
00022         }
00023
00024         private void CompactPaneLength_SelectionChanged(object sender, SelectionChangedEventArgs e)
00025         {
00026             var tag = Convert.ToDouble(((sender as ComboBox).SelectedItem as ComboBoxItem).Tag);
00027             NavView.CompactPaneLength = tag;
00028         }
00029
00030         private void GetIconColumnWidth_Click(object sender, RoutedEventArgs e)
00031         {
00032             var NVIRootGrid = VisualTreeHelper.GetChild(PaneFooterNavigationViewItem, 0);
00033             var navigationViewItemPresenter = VisualTreeHelper.GetChild(NVIRootGrid, 0);
00034             var layoutRoot = VisualTreeHelper.GetChild(navigationViewItemPresenter, 0);
00035             var presenterContentRootGrid = VisualTreeHelper.GetChild(layoutRoot, 0);
00036             var contentGrid = VisualTreeHelper.GetChild(presenterContentRootGrid, 1);
00037             var iconColumn = VisualTreeHelper.GetChild(contentGrid, 0);
00038
00039             PaneFooterNavViewItemWidth.Text = (iconColumn as Border).ActualWidth.ToString();
00040         }
00041     }
00042 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressBar/ProgressBarAutomationPeer.cpp Source File

  • ProgressBar

ProgressBarAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "ProgressBar.h"
00008 #include "ProgressBarAutomationPeer.h"
00009 #include "Utils.h"
00010
00011 #include "ProgressBarAutomationPeer.properties.cpp"
00012
00013 ProgressBarAutomationPeer::ProgressBarAutomationPeer(winrt::ProgressBar const& owner)
00014     : ReferenceTracker(owner)
00015 {
00016 }
00017
00018 // IAutomationPeerOverrides
00019 winrt::IInspectable ProgressBarAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00020 {
00021     if (patternInterface == winrt::PatternInterface::RangeValue)
00022     {
00023         if (auto progressBar = Owner().try_as<winrt::ProgressBar>())
00024         {
00025             if (progressBar.IsIndeterminate())
00026             {
00027                 return nullptr;
00028             }
00029         }
00030
00031         return *this;
00032     }
00033
00034     return __super::GetPatternCore(patternInterface);
00035 }
00036
00037 hstring ProgressBarAutomationPeer::GetClassNameCore()
00038 {
00039     return winrt::hstring_name_of<winrt::ProgressBar>();
00040 }
00041
00042 winrt::hstring ProgressBarAutomationPeer::GetNameCore()
00043 {
00044     //Check to see if the item has a defined AutomationProperties.Name
00045     winrt::hstring name = __super::GetNameCore();
00046
00047     if (auto progressBar = Owner().try_as<winrt::ProgressBar>())
00048     {
00049         if (progressBar.ShowError())
00050         {
00051             return winrt::hstring{ ResourceAccessor::GetLocalizedStringResource(SR_ProgressBarErrorStatus) + name };
00052         }
00053         else if (progressBar.ShowPaused())
00054         {
00055             return winrt::hstring{ ResourceAccessor::GetLocalizedStringResource(SR_ProgressBarPausedStatus) + name };
00056         }
00057         else if (progressBar.IsIndeterminate())
00058         {
00059             return winrt::hstring{ ResourceAccessor::GetLocalizedStringResource(SR_ProgressBarIndeterminateStatus) + name };
00060         }
00061     }
00062     return name;
00063 }
00064
00065 winrt::AutomationControlType ProgressBarAutomationPeer::GetAutomationControlTypeCore()
00066 {
00067     return winrt::AutomationControlType::ProgressBar;
00068 }
00069
00070 com_ptr<ProgressBar> ProgressBarAutomationPeer::GetImpl()
00071 {
00072     com_ptr<ProgressBar> impl = nullptr;
00073
00074     if (auto progressBar = Owner().try_as<winrt::ProgressBar>())
00075     {
00076         impl = winrt::get_self<ProgressBar>(progressBar)->get_strong();
00077     }
00078
00079     return impl;
00080 }
00081
00082 // IRangeValueProvider
00083 double ProgressBarAutomationPeer::Value()
00084 {
00085     return GetImpl()->Value();
00086 }
00087
00088 double ProgressBarAutomationPeer::SmallChange()
00089 {
00090     return std::numeric_limits<double>::quiet_NaN();
00091 }
00092
00093 double ProgressBarAutomationPeer::LargeChange()
00094 {
00095     return std::numeric_limits<double>::quiet_NaN();
00096 }
00097
00098 double ProgressBarAutomationPeer::Minimum()
00099 {
00100     return GetImpl()->Minimum();
00101 }
00102
00103 double ProgressBarAutomationPeer::Maximum()
00104 {
00105     return GetImpl()->Maximum();
00106 }
00107
00108 void ProgressBarAutomationPeer::SetValue(double value)
00109 {
00110     GetImpl()->Value(value);
00111 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SwipeControl/SwipeItemInvokedEventArgs.cpp Source File

  • SwipeControl

SwipeItemInvokedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SwipeItem.h"
00007 #include "SwipeControl.h"
00008 #include "SwipeItemInvokedEventArgs.h"
00009
00010 #pragma region ISwipeItemInvokedEventArgs
00011 winrt::SwipeControl SwipeItemInvokedEventArgs::SwipeControl()
00012 {
00013     return m_swipeControl;
00014 }
00015 #pragma endregion
00016
00017 void SwipeItemInvokedEventArgs::SwipeControl(const winrt::SwipeControl& value)
00018 {
00019     m_swipeControl = value;
00020 }
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ToggleSplitButton.properties.h Source File

  • Generated

ToggleSplitButton.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class ToggleSplitButtonProperties
00008 {
00009 public:
00010     ToggleSplitButtonProperties();
00011
00012     void IsChecked(bool value);
00013     bool IsChecked();
00014
00015     static winrt::DependencyProperty IsCheckedProperty() { return s_IsCheckedProperty; }
00016
00017     static GlobalDependencyProperty s_IsCheckedProperty;
00018
00019     winrt::event_token IsCheckedChanged(winrt::TypedEventHandler<winrt::ToggleSplitButton, winrt::ToggleSplitButtonIsCheckedChangedEventArgs> const& value);
00020     void IsCheckedChanged(winrt::event_token const& token);
00021
00022     event_source<winrt::TypedEventHandler<winrt::ToggleSplitButton, winrt::ToggleSplitButtonIsCheckedChangedEventArgs>> m_isCheckedChangedEventSource;
00023
00024     static void EnsureProperties();
00025     static void ClearProperties();
00026
00027     static void OnIsCheckedPropertyChanged(
00028         winrt::DependencyObject const& sender,
00029         winrt::DependencyPropertyChangedEventArgs const& args);
00030 };
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/XamlControlsXamlMetaDataProvider.properties.cpp Source File

  • Generated

XamlControlsXamlMetaDataProvider.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "XamlControlsXamlMetaDataProvider.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::XamlTypeInfo
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(XamlControlsXamlMetaDataProvider)
00012 }
00013
00014 #include "XamlControlsXamlMetaDataProvider.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/TestUI/Common/NavigationViewPageDataContext.xaml.cs Source File

  • NavigationView
  • TestUI
  • Common

NavigationViewPageDataContext.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Navigation;
00010 using Microsoft.UI.Xaml.Automation;
00011 using Windows.ApplicationModel.Core;
00012
00013 using NavigationView = Microsoft.UI.Xaml.Controls.NavigationView;
00014 using NavigationViewSelectionChangedEventArgs = Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs;
00015 using NavigationViewItem = Microsoft.UI.Xaml.Controls.NavigationViewItem;
00016 using System.ComponentModel;
00017 using System.Runtime.CompilerServices;
00018 using System.Collections.Generic;
00019
00020 namespace MUXControlsTestApp
00021 {
00022     public sealed partial class NavigationViewPageDataContext : TestPage, INotifyPropertyChanged
00023     {
00024
00025         public event PropertyChangedEventHandler PropertyChanged;
00026
00027         private void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
00028         {
00029             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
00030         }
00031
00032         private NavViewPageData[] _pages;
00033
00034         public NavViewPageData[] Pages
00035         {
00036             get => _pages;
00037             set
00038             {
00039                 _pages = value;
00040                 NotifyPropertyChanged(nameof(Pages));
00041             }
00042         }
00043
00044         public NavigationViewPageDataContext()
00045         {
00046             this.InitializeComponent();
00047
00048             for (int i = 0; i < 8; i++)
00049             {
00050                 var nvi = new NavigationViewItem();
00051                 var itemString = "Item #" + i;
00052                 nvi.Content = itemString;
00053                 nvi.DataContext = itemString + "_DataContext";
00054                 NavView.MenuItems.Add(nvi);
00055             }
00056
00057             NavView.SelectedItem = NavView.MenuItems[0];
00058
00059             Pages = new[]
00060             {
00061                 new NavViewPageData("FirstInvokeChangeItem"),
00062                 new NavViewPageData("SecondInvokeChangeItem"),
00063                 new NavViewPageData("ThirdInvokeChangeItem"),
00064                 new NavViewPageData("FourthInvokeChangeItem"),
00065                 new NavViewPageData("FifthInvokeChangeItem"),
00066                 new NavViewPageData("SixthInvokeChangeItem"),
00067                 new NavViewPageData("SeventhInvokeChangeItem"),
00068             };
00069         }
00070
00071         private void NavigationView_ItemInvoked(NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args)
00072         {
00073             if (_pages != null && _pages.Length == 0)
00074             {
00075                 return;
00076             }
00077
00078             var page = Pages[0];
00079             var newPages = new List<NavViewPageData>();
00080             newPages.Add(new NavViewPageData($"Clicked {page.Name}"));
00081             newPages.AddRange(Pages);
00082
00083             Pages = newPages.ToArray();
00084         }
00085
00086         private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
00087         {
00088             var nvi = args.SelectedItem as NavigationViewItem;
00089             NavViewSelectedDataContext.Text = nvi.DataContext as string ?? "";
00090         }
00091
00092         private void GetNavViewActiveVisualStates_Click(object sender, RoutedEventArgs e)
00093         {
00094             var visualstates = Utilities.VisualStateHelper.GetCurrentVisualStateName(NavView);
00095             NavViewActiveVisualStatesResult.Text = string.Join(",", visualstates);
00096         }
00097     }
00098
00099     public class NavViewPageData
00100     {
00101         public string Name { get; set; }
00102
00103         public NavViewPageData(string name)
00104         {
00105             Name = name;
00106         }
00107     }
00108 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewList Member List

This is the complete list of members for TreeViewList, including all inherited members.
abi_enter() | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
BuildEffectString(hstring priorString, hstring afterString, hstring dragString, hstring dragOverString) const | TreeViewList | [private]
CheckThread() | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
ContainerFromNode(winrt::TreeViewNode const &node) const | TreeViewList |
DeleteInstanceOnUIThread(std::unique_ptr< TreeViewList > &&self) noexcept | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline, static]
DraggedTreeViewNode() const | TreeViewList |
DraggedTreeViewNode(winrt::TreeViewNode const &node) | TreeViewList |
EnableMultiselect(bool isEnabled) | TreeViewList |
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
final_release(std::unique_ptr< TreeViewList > &&self) | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline, static]
FlatIndex(const winrt::TreeViewNode &node) const | TreeViewList |
GetAutomationName(int index) const | TreeViewList | [private]
GetBase() | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
GetContainerForItemOverride() | TreeViewList |
GetDropTargetDropEffect() | TreeViewList |
GetInner() | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
GetRootOfSelection(const winrt::TreeViewNode &node) const | TreeViewList | [private]
GetRootsOfSelectedSubtrees() const | TreeViewList |
IndexInParent(const winrt::TreeViewNode &node) const | TreeViewList | [private]
IsContentMode() const | TreeViewList |
IsFlatIndexValid(int index) const | TreeViewList |
IsIndexValid(int index) const | TreeViewList | [private]
IsMultiselect() const | TreeViewList |
IsMutiSelectWithSelectedItems() const | TreeViewList |
IsOnThread() | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
IsSelected(const winrt::TreeViewNode &node) const | TreeViewList |
ItemFromNode(winrt::TreeViewNode const &node) const | TreeViewList |
ListViewModel() const | TreeViewList |
ListViewModel(com_ptr< ViewModel > viewModel) | TreeViewList |
m_dropTargetDropEffectString | TreeViewList | [private]
MoveNodeInto(winrt::TreeViewNode const &node, winrt::TreeViewNode const &insertAtNode) const | TreeViewList | [private]
NodeAtFlatIndex(int index) const | TreeViewList | [private]
NodeFromContainer(winrt::DependencyObject const &container) const | TreeViewList |
NodeFromItem(winrt::IInspectable const &item) const | TreeViewList |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
OnApplyTemplate() | TreeViewList |
OnContainerContentChanging(const winrt::IInspectable &sender, const winrt::ContainerContentChangingEventArgs &args) | TreeViewList |
OnCreateAutomationPeer() | TreeViewList |
OnDragEnter(winrt::DragEventArgs const &e) | TreeViewList |
OnDragItemsCompleted(const winrt::IInspectable &sender, const winrt::DragItemsCompletedEventArgs &args) | TreeViewList |
OnDragItemsStarting(const winrt::IInspectable &sender, const winrt::DragItemsStartingEventArgs &args) | TreeViewList |
OnDragLeave(winrt::DragEventArgs const &e) | TreeViewList |
OnDragOver(winrt::DragEventArgs const &e) | TreeViewList |
OnDrop(winrt::DragEventArgs const &e) | TreeViewList |
PrepareContainerForItemOverride(winrt::DependencyObject const &element, winrt::IInspectable const &item) | TreeViewList |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< TreeViewList, winrt::implementation::TreeViewListT > | [inline]
RemoveNodeFromParent(const winrt::TreeViewNode &node) const | TreeViewList |
SetDraggedOverItem(winrt::TreeViewItem newDraggedOverItem) | TreeViewList |
TreeViewList() | TreeViewList |
UpdateDropTargetDropEffect(bool forceUpdate, bool isLeaving, winrt::TreeViewItem keyboardReorderedContainer) | TreeViewList |
Generated on Sun Dec 1 2024 20:53:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarBallpointPenButton.properties.cpp Source File

  • Generated

InkToolBarBallpointPenButton.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InkToolBarBallpointPenButton.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(InkToolBarBallpointPenButton)
00012 }
00013
00014 #include "InkToolBarBallpointPenButton.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PersonPicture/PersonPicture.h Source File

  • PersonPicture

PersonPicture.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "PersonPicture.g.h"
00007 #include "PersonPicture.properties.h"
00008
00009 class PersonPicture :
00010     public ReferenceTracker<PersonPicture, winrt::implementation::PersonPictureT>,
00011     public PersonPictureProperties
00012 {
00013 public:
00014     PersonPicture();
00015
00016     void OnApplyTemplate();
00017     winrt::AutomationPeer OnCreateAutomationPeer();
00018
00019     // Property changed handler.
00020     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args);
00021
00022 private:
00023     /// <summary>
00024     /// Updates Control elements, if available, with the latest values.
00025     /// </summary>
00026     void UpdateIfReady();
00027
00028     /// <summary>
00029     /// Updates the state of the Badging element.
00030     /// </summary>
00031     void UpdateBadge();
00032
00033     /// <summary>
00034     /// Updates Badging Number text element.
00035     /// </summary>
00036     void UpdateBadgeNumber();
00037
00038     /// <summary>
00039     /// Updates Badging Glyph element.
00040     /// </summary>
00041     void UpdateBadgeGlyph();
00042
00043     /// <summary>
00044     /// Updates Badging Image element.
00045     /// </summary>
00046     void UpdateBadgeImageSource();
00047
00048     /// <summary>
00049     /// Helper function to contain the calls to load and display a user's profile picture.
00050     /// </summary>
00051     /// <param name="isNewContact">
00052     /// Specifies if the target contact is to be handled as newContact.
00053     /// </param>
00054     void UpdateControlForContact(bool isNewContact);
00055
00056     /// <summary>
00057     /// Sets the UI Automation name for the control based on contact name and badge state.
00058     /// </summary>
00059     void UpdateAutomationName();
00060
00061     /// <summary>
00062     /// Helper to determine the initials that should be shown.
00063     /// </summary>
00064     winrt::hstring GetInitials();
00065
00066     /// <summary>
00067     /// Helper to determine the image source that should be shown.
00068     /// </summary>
00069     winrt::ImageSource GetImageSource();
00070
00071     // DependencyProperty changed event handlers
00072     void OnDisplayNameChanged(const winrt::DependencyPropertyChangedEventArgs &args);
00073     void OnContactChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00074
00075     // Event handlers
00076     void OnSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &e);
00077     void OnUnloaded(const winrt::IInspectable &sender, const winrt::RoutedEventArgs &e);
00078
00079     // Helper functions
00080     void LoadImageAsync(
00081         std::shared_ptr<winrt::IRandomAccessStreamReference> thumbStreamReference,
00082         std::function<void(winrt::BitmapImage)> completedFunction);
00083
00084     winrt::hstring PersonPicture::GetLocalizedPluralBadgeItemStringResource(unsigned int numericValue);
00085
00086     /// <summary>
00087     /// XAML Element for the first TextBlock matching x:Name of InitialsTextBlock.
00088     /// </summary>
00089     tracker_ref<winrt::TextBlock> m_initialsTextBlock{ this };
00090
00091     /// <summary>
00092     /// XAML Element for the first TextBlock matching x:Name of BadgeNumberTextBlock.
00093     /// </summary>
00094     tracker_ref<winrt::TextBlock> m_badgeNumberTextBlock{ this };
00095
00096     /// <summary>
00097     /// XAML Element for the first TextBlock matching x:Name of BadgeGlyphIcon.
00098     /// </summary>
00099     tracker_ref<winrt::FontIcon> m_badgeGlyphIcon{ this };
00100
00101     /// <summary>
00102     /// XAML Element for the first ImageBrush matching x:Name of BadgeImageBrush.
00103     /// </summary>
00104     tracker_ref<winrt::ImageBrush> m_badgeImageBrush{ this };
00105
00106     /// <summary>
00107     /// XAML Element for the first Ellipse matching x:Name of BadgingBackgroundEllipse.
00108     /// </summary>
00109     tracker_ref<winrt::Ellipse> m_badgingEllipse{ this };
00110
00111     /// <summary>
00112     /// XAML Element for the first Ellipse matching x:Name of BadgingEllipse.
00113     /// </summary>
00114     tracker_ref<winrt::Ellipse> m_badgingBackgroundEllipse{ this };
00115
00116     /// <summary>
00117     /// The async operation object representing the loading and assignment of the Thumbnail.
00118     /// </summary>
00119     tracker_ref<winrt::IAsyncOperation<winrt::IRandomAccessStreamWithContentType>> m_profilePictureReadAsync{ this };
00120
00121     /// <summary>
00122     /// The initials from the DisplayName property.
00123     /// </summary>
00124     tracker_ref<winrt::hstring> m_displayNameInitials{ this };
00125
00126     /// <summary>
00127     /// The initials from the Contact property.
00128     /// </summary>
00129     tracker_ref<winrt::hstring> m_contactDisplayNameInitials{ this };
00130
00131     /// <summary>
00132     /// The ImageSource from the Contact property.
00133     /// </summary>
00134     tracker_ref<winrt::ImageSource> m_contactImageSource{ this };
00135
00136 };
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealBrushTestApi Member List

This is the complete list of members for RevealBrushTestApi, including all inherited members.
abi_enter() | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
CheckThread() | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
CompositionBrush() | RevealBrushTestApi |
DeleteInstanceOnUIThread(std::unique_ptr< RevealBrushTestApi > &&self) noexcept | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
final_release(std::unique_ptr< RevealBrushTestApi > &&self) | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
GetInner() | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
IsAmbientLightSet() | RevealBrushTestApi |
IsBorderLightSet() | RevealBrushTestApi |
IsHoverLightSet() | RevealBrushTestApi |
IsInFallbackMode() | RevealBrushTestApi |
IsOnThread() | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
NoiseBrush() | RevealBrushTestApi |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< RevealBrushTestApi, winrt::implementation::RevealBrushTestApiT, winrt::composable > | [inline]
RevealBrush() | RevealBrushTestApi |
RevealBrush(winrt::RevealBrush const &value) | RevealBrushTestApi |
Generated on Sun Dec 1 2024 20:53:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ViewModel Member List

This is the complete list of members for ViewModel, including all inherited members.
abi_enter() | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
AddNodeDescendantsToView(const winrt::TreeViewNode &value, unsigned int index, int offset) | ViewModel | [private]
AddNodeToView(const winrt::TreeViewNode &value, unsigned int index) | ViewModel | [private]
Append(winrt::IInspectable const &value) | ViewModel |
BeginSelectionChanges() | ViewModel | [private]
CheckThread() | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
Clear() | ViewModel |
ClearEventTokenVectors() | ViewModel | [private]
CollapseNode(const winrt::TreeViewNode &value) | ViewModel | [private]
CountDescendants(const winrt::TreeViewNode &value) | ViewModel | [private]
DeleteInstanceOnUIThread(std::unique_ptr< ViewModel > &&self) noexcept | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline, static]
EndSelectionChanges() | ViewModel | [private]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
ExpandNode(const winrt::TreeViewNode &value) | ViewModel | [private]
final_release(std::unique_ptr< ViewModel > &&self) | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline, static]
GetAssociatedNode(winrt::IInspectable item) | ViewModel |
GetAt(uint32_t index) | ViewModel |
GetBase() | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
GetExpandedDescendantCount(winrt::TreeViewNode const &parentNode) | ViewModel | [private]
GetInner() | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
GetMany(uint32_t const startIndex, winrt::array_view< winrt::IInspectable > values) | ViewModel |
GetNextIndexInFlatTree(winrt::TreeViewNode const &indexNode) | ViewModel | [private]
GetNodeAt(uint32_t index) | ViewModel | [private]
GetRemovedChildTreeViewNodeByIndex(winrt::TreeViewNode const &node, unsigned int childIndex) | ViewModel | [private]
GetSelectedItems() | ViewModel |
GetSelectedNodes() | ViewModel |
GetView() | ViewModel |
IndexOf(winrt::IInspectable const &value, uint32_t &index) | ViewModel |
IndexOfNextSibling(winrt::TreeViewNode const &childNode) | ViewModel | [private]
IndexOfNode(winrt::TreeViewNode const &targetNode, uint32_t &index) | ViewModel | [private]
InsertAt(uint32_t index, winrt::IInspectable const &value) | ViewModel |
IsContentMode(const bool value) | ViewModel | [private]
IsContentMode() | ViewModel | [private]
IsInSingleSelectionMode() | ViewModel |
IsNodeSelected(winrt::TreeViewNode const &targetNode) | ViewModel |
IsOnThread() | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
ListControl() | ViewModel |
m_addedSelectedItems | ViewModel | [private]
m_collectionChangedEventTokenVector | ViewModel | [private]
m_IsExpandedChangedEventTokenVector | ViewModel | [private]
m_removedSelectedItems | ViewModel | [private]
m_rootNodeChildrenChangedEventToken | ViewModel | [private]
m_selectedNodeChildrenChangedEventTokenVector | ViewModel | [private]
NodeCollapsed(const winrt::TypedEventHandler< winrt::TreeViewNode, winrt::IInspectable > &handler) | ViewModel | [private]
NodeCollapsed(const winrt::event_token token) | ViewModel | [private]
NodeExpanding(const winrt::TypedEventHandler< winrt::TreeViewNode, winrt::IInspectable > &handler) | ViewModel | [private]
NodeExpanding(const winrt::event_token token) | ViewModel | [private]
NodeSelectionState(winrt::TreeViewNode const &targetNode) | ViewModel |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
NotifyContainerOfSelectionChange(winrt::TreeViewNode const &targetNode, TreeNodeSelectionState const &selectionState) | ViewModel |
PrepareView(winrt::TreeViewNode const &originNode) | ViewModel |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ViewModel, reference_tracker_implements_t< ViewModelVectorOptions::VectorType >::type, ViewModelVectorOptions::IterableType, ViewModelVectorOptions::ObservableVectorType > | [inline]
RemoveAt(uint32_t index) | ViewModel |
RemoveAtEnd() | ViewModel |
RemoveNodeAndDescendantsFromView(const winrt::TreeViewNode &value) | ViewModel | [private]
RemoveNodesAndDescendentsWithFlatIndexRange(unsigned int startIndex, unsigned int stopIndex) | ViewModel | [private]
ReplaceAll(winrt::array_view< winrt::IInspectable const > items) | ViewModel |
SelectAll() | ViewModel | [private]
SelectByIndex(int index, TreeNodeSelectionState const &state) | ViewModel | [private]
SelectedNodeChildrenChanged(const winrt::TreeViewNode &sender, const winrt::IInspectable &args) | ViewModel |
SelectionStateBasedOnChildren(winrt::TreeViewNode const &node) | ViewModel | [private]
SelectNode(const winrt::TreeViewNode &node, bool isSelected) | ViewModel | [private]
SelectSingleItem(winrt::IInspectable const &item) | ViewModel | [private]
SetAt(uint32_t index, winrt::IInspectable const &value) | ViewModel |
SetOwners(winrt::TreeViewList const &owningList, winrt::TreeView const &owningTreeView) | ViewModel |
Size() | ViewModel |
TrackItemSelected(winrt::IInspectable item) | ViewModel |
TrackItemUnselected(winrt::IInspectable item) | ViewModel |
TreeViewNodeHasChildrenPropertyChanged(winrt::TreeViewNode const &sender, winrt::IDependencyPropertyChangedEventArgs const &args) | ViewModel |
TreeViewNodeIsExpandedPropertyChanged(winrt::TreeViewNode const &sender, winrt::IDependencyPropertyChangedEventArgs const &args) | ViewModel |
TreeViewNodePropertyChanged(winrt::TreeViewNode const &sender, winrt::IDependencyPropertyChangedEventArgs const &args) | ViewModel |
TreeViewNodeVectorChanged(const winrt::TreeViewNode &sender, const winrt::IInspectable &args) | ViewModel |
UpdateNodeSelection(winrt::TreeViewNode const &selectNode, TreeNodeSelectionState const &selectionState) | ViewModel | [private]
UpdateSelection(winrt::TreeViewNode const &selectNode, TreeNodeSelectionState const &selectionState) | ViewModel |
UpdateSelectionStateOfAncestors(winrt::TreeViewNode const &targetNode) | ViewModel | [private]
UpdateSelectionStateOfDescendants(winrt::TreeViewNode const &targetNode, TreeNodeSelectionState const &selectionState) | ViewModel | [private]
~ViewModel() | ViewModel | [private]
Generated on Sun Dec 1 2024 20:53:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CircleLayout Member List

This is the complete list of members for CircleLayout, including all inherited members.
ArrangeOverride(VirtualizingLayoutContext context, Size finalSize) | CircleLayout | [inline, protected]
VirtualizingLayout::ArrangeOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &finalSize) | VirtualizingLayout | [virtual]
GetCircleRadius(Size availableSize) | CircleLayout | [inline, private]
InitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | VirtualizingLayout | [virtual]
ItemSize | CircleLayout |
MeasureOverride(VirtualizingLayoutContext context, Size availableSize) | CircleLayout | [inline, protected]
VirtualizingLayout::MeasureOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &availableSize) | VirtualizingLayout | [virtual]
OnItemsChangedCore(winrt::VirtualizingLayoutContext const &context, winrt::IInspectable const &source, winrt::NotifyCollectionChangedEventArgs const &args) | VirtualizingLayout | [virtual]
UninitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | VirtualizingLayout | [virtual]
VirtualizingLayout() | VirtualizingLayout |
Generated on Sun Dec 1 2024 20:54:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InfoBar.properties.h Source File

  • Generated

InfoBar.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InfoBarProperties
00008 {
00009 public:
00010     InfoBarProperties();
00011
00012     void ActionButton(winrt::ButtonBase const& value);
00013     winrt::ButtonBase ActionButton();
00014
00015     void CloseButtonCommand(winrt::ICommand const& value);
00016     winrt::ICommand CloseButtonCommand();
00017
00018     void CloseButtonCommandParameter(winrt::IInspectable const& value);
00019     winrt::IInspectable CloseButtonCommandParameter();
00020
00021     void CloseButtonStyle(winrt::Style const& value);
00022     winrt::Style CloseButtonStyle();
00023
00024     void Content(winrt::IInspectable const& value);
00025     winrt::IInspectable Content();
00026
00027     void ContentTemplate(winrt::DataTemplate const& value);
00028     winrt::DataTemplate ContentTemplate();
00029
00030     void IconSource(winrt::IconSource const& value);
00031     winrt::IconSource IconSource();
00032
00033     void IsClosable(bool value);
00034     bool IsClosable();
00035
00036     void IsIconVisible(bool value);
00037     bool IsIconVisible();
00038
00039     void IsOpen(bool value);
00040     bool IsOpen();
00041
00042     void Message(winrt::hstring const& value);
00043     winrt::hstring Message();
00044
00045     void Severity(winrt::InfoBarSeverity const& value);
00046     winrt::InfoBarSeverity Severity();
00047
00048     void TemplateSettings(winrt::InfoBarTemplateSettings const& value);
00049     winrt::InfoBarTemplateSettings TemplateSettings();
00050
00051     void Title(winrt::hstring const& value);
00052     winrt::hstring Title();
00053
00054     static winrt::DependencyProperty ActionButtonProperty() { return s_ActionButtonProperty; }
00055     static winrt::DependencyProperty CloseButtonCommandProperty() { return s_CloseButtonCommandProperty; }
00056     static winrt::DependencyProperty CloseButtonCommandParameterProperty() { return s_CloseButtonCommandParameterProperty; }
00057     static winrt::DependencyProperty CloseButtonStyleProperty() { return s_CloseButtonStyleProperty; }
00058     static winrt::DependencyProperty ContentProperty() { return s_ContentProperty; }
00059     static winrt::DependencyProperty ContentTemplateProperty() { return s_ContentTemplateProperty; }
00060     static winrt::DependencyProperty IconSourceProperty() { return s_IconSourceProperty; }
00061     static winrt::DependencyProperty IsClosableProperty() { return s_IsClosableProperty; }
00062     static winrt::DependencyProperty IsIconVisibleProperty() { return s_IsIconVisibleProperty; }
00063     static winrt::DependencyProperty IsOpenProperty() { return s_IsOpenProperty; }
00064     static winrt::DependencyProperty MessageProperty() { return s_MessageProperty; }
00065     static winrt::DependencyProperty SeverityProperty() { return s_SeverityProperty; }
00066     static winrt::DependencyProperty TemplateSettingsProperty() { return s_TemplateSettingsProperty; }
00067     static winrt::DependencyProperty TitleProperty() { return s_TitleProperty; }
00068
00069     static GlobalDependencyProperty s_ActionButtonProperty;
00070     static GlobalDependencyProperty s_CloseButtonCommandProperty;
00071     static GlobalDependencyProperty s_CloseButtonCommandParameterProperty;
00072     static GlobalDependencyProperty s_CloseButtonStyleProperty;
00073     static GlobalDependencyProperty s_ContentProperty;
00074     static GlobalDependencyProperty s_ContentTemplateProperty;
00075     static GlobalDependencyProperty s_IconSourceProperty;
00076     static GlobalDependencyProperty s_IsClosableProperty;
00077     static GlobalDependencyProperty s_IsIconVisibleProperty;
00078     static GlobalDependencyProperty s_IsOpenProperty;
00079     static GlobalDependencyProperty s_MessageProperty;
00080     static GlobalDependencyProperty s_SeverityProperty;
00081     static GlobalDependencyProperty s_TemplateSettingsProperty;
00082     static GlobalDependencyProperty s_TitleProperty;
00083
00084     winrt::event_token CloseButtonClick(winrt::TypedEventHandler<winrt::InfoBar, winrt::IInspectable> const& value);
00085     void CloseButtonClick(winrt::event_token const& token);
00086     winrt::event_token Closed(winrt::TypedEventHandler<winrt::InfoBar, winrt::InfoBarClosedEventArgs> const& value);
00087     void Closed(winrt::event_token const& token);
00088     winrt::event_token Closing(winrt::TypedEventHandler<winrt::InfoBar, winrt::InfoBarClosingEventArgs> const& value);
00089     void Closing(winrt::event_token const& token);
00090
00091     event_source<winrt::TypedEventHandler<winrt::InfoBar, winrt::IInspectable>> m_closeButtonClickEventSource;
00092     event_source<winrt::TypedEventHandler<winrt::InfoBar, winrt::InfoBarClosedEventArgs>> m_closedEventSource;
00093     event_source<winrt::TypedEventHandler<winrt::InfoBar, winrt::InfoBarClosingEventArgs>> m_closingEventSource;
00094
00095     static void EnsureProperties();
00096     static void ClearProperties();
00097
00098     static void OnActionButtonPropertyChanged(
00099         winrt::DependencyObject const& sender,
00100         winrt::DependencyPropertyChangedEventArgs const& args);
00101
00102     static void OnIconSourcePropertyChanged(
00103         winrt::DependencyObject const& sender,
00104         winrt::DependencyPropertyChangedEventArgs const& args);
00105
00106     static void OnIsClosablePropertyChanged(
00107         winrt::DependencyObject const& sender,
00108         winrt::DependencyPropertyChangedEventArgs const& args);
00109
00110     static void OnIsIconVisiblePropertyChanged(
00111         winrt::DependencyObject const& sender,
00112         winrt::DependencyPropertyChangedEventArgs const& args);
00113
00114     static void OnIsOpenPropertyChanged(
00115         winrt::DependencyObject const& sender,
00116         winrt::DependencyPropertyChangedEventArgs const& args);
00117
00118     static void OnMessagePropertyChanged(
00119         winrt::DependencyObject const& sender,
00120         winrt::DependencyPropertyChangedEventArgs const& args);
00121
00122     static void OnSeverityPropertyChanged(
00123         winrt::DependencyObject const& sender,
00124         winrt::DependencyPropertyChangedEventArgs const& args);
00125
00126     static void OnTitlePropertyChanged(
00127         winrt::DependencyObject const& sender,
00128         winrt::DependencyPropertyChangedEventArgs const& args);
00129 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshVisualizer/RefreshVisualizer.cpp Source File

  • PullToRefresh
  • RefreshVisualizer

RefreshVisualizer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006
00007 #include "RefreshVisualizer.h"
00008 #include "RefreshVisualizerEventArgs.h"
00009 #include "RuntimeProfiler.h"
00010 #include "PTRTracing.h"
00011
00012
00013 //The Opacity of the progress indicator in the non-pending non-executing states
00014 #define MINIMUM_INDICATOR_OPACITY 0.4f
00015
00016 //The size of the default progress indicator
00017 #define DEFAULT_INDICATOR_SIZE 30
00018
00019 //The position the progress indicator parallax animation places the indicator during manipulation
00020 #define PARALLAX_POSITION_RATIO 0.5f
00021
00022 //////////////////////////////////////////////////////////
00023 /////////          RefreshVisualizer         /////////////
00024 //////////////////////////////////////////////////////////
00025 RefreshVisualizer::~RefreshVisualizer()
00026 {
00027     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00028     if (auto refreshInfoProvider = m_refreshInfoProvider.safe_get())
00029     {
00030         refreshInfoProvider.IsInteractingForRefreshChanged(m_RefreshInfoProvider_InteractingForRefreshChangedToken);
00031         refreshInfoProvider.InteractionRatioChanged(m_RefreshInfoProvider_InteractionRatioChangedToken);
00032     }
00033 }
00034
00035 RefreshVisualizer::RefreshVisualizer()
00036 {
00037     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00038
00039     __RP_Marker_ClassById(RuntimeProfiler::ProfId_RefreshVisualizer);
00040
00041     SetDefaultStyleKey(this);
00042 }
00043
00044 void RefreshVisualizer::OnApplyTemplate()
00045 {
00046     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00047     // BEGIN: Populate template children
00048     winrt::IControlProtected thisAsControlProtected = *this;
00049     m_root.set(GetTemplateChildT<winrt::Panel>(L"Root", thisAsControlProtected));
00050     // END: Populate template children
00051
00052     // BEGIN: Initialize our private backers to the dependency properties and initialize state.
00053     m_state = State();
00054
00055     m_orientation = Orientation();
00056     OnOrientationChangedImpl();
00057
00058     m_content.set(Content());
00059     if (!m_content)
00060     {
00061         winrt::SymbolIcon defaultContent = winrt::SymbolIcon(winrt::Symbol::Refresh);
00062         defaultContent.Height(DEFAULT_INDICATOR_SIZE);
00063         defaultContent.Width(DEFAULT_INDICATOR_SIZE);
00064
00065         Content(defaultContent);
00066     }
00067     else
00068     {
00069         OnContentChangedImpl();
00070     }
00071     // END: Initialize
00072
00073     UpdateContent();
00074 }
00075
00076 void RefreshVisualizer::RequestRefresh()
00077 {
00078     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00079     UpdateRefreshState(winrt::RefreshVisualizerState::Refreshing);
00080     if (m_refreshInfoProvider.get())
00081     {
00082         m_refreshInfoProvider.get().OnRefreshStarted();
00083     }
00084     RaiseRefreshRequested();
00085 }
00086
00087 //Private Interface methods
00088 winrt::IRefreshInfoProvider RefreshVisualizer::InfoProvider()
00089 {
00090     winrt::IInspectable valueAsII = GetValue(s_InfoProviderProperty);
00091     return valueAsII.as<winrt::IRefreshInfoProvider>();
00092 }
00093
00094 void RefreshVisualizer::InfoProvider(winrt::IRefreshInfoProvider const& value)
00095 {
00096     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_PTR, METH_NAME, this, value);
00097     SetValue(s_InfoProviderProperty, value);
00098 }
00099
00100 void RefreshVisualizer::SetInternalPullDirection(winrt::RefreshPullDirection const& value)
00101 {
00102     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, value);
00103     m_pullDirection = value;
00104     OnOrientationChangedImpl();
00105     UpdateContent();
00106 }
00107
00108 //Privates
00109 void RefreshVisualizer::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00110 {
00111     winrt::IDependencyProperty property = args.Property();
00112     if (property == s_InfoProviderProperty)
00113     {
00114         OnRefreshInfoProviderChanged(args);
00115     }
00116     else if (property == s_OrientationProperty)
00117     {
00118         OnOrientationChanged(args);
00119     }
00120     else if (property == s_StateProperty)
00121     {
00122         OnStateChanged(args);
00123     }
00124     else if (property == s_ContentProperty)
00125     {
00126         OnContentChanged(args);
00127     }
00128 }
00129
00130 void RefreshVisualizer::OnRefreshInfoProviderChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00131 {
00132     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_PTR_PTR, METH_NAME, this, args.OldValue(), args.NewValue());
00133     if (m_refreshInfoProvider)
00134     {
00135         m_refreshInfoProvider.get().IsInteractingForRefreshChanged(m_RefreshInfoProvider_InteractingForRefreshChangedToken);
00136         m_refreshInfoProvider.get().InteractionRatioChanged(m_RefreshInfoProvider_InteractionRatioChangedToken);
00137     }
00138
00139     m_refreshInfoProvider.set(InfoProvider());
00140
00141     if (m_refreshInfoProvider)
00142     {
00143         m_RefreshInfoProvider_InteractingForRefreshChangedToken = m_refreshInfoProvider.get().IsInteractingForRefreshChanged({ this, &RefreshVisualizer::RefreshInfoProvider_InteractingForRefreshChanged });
00144         m_RefreshInfoProvider_InteractionRatioChangedToken = m_refreshInfoProvider.get().InteractionRatioChanged({ this, &RefreshVisualizer::RefreshInfoProvider_InteractionRatioChanged });
00145
00146         m_executionRatio = m_refreshInfoProvider.get().ExecutionRatio();
00147     }
00148     else
00149     {
00150         m_RefreshInfoProvider_InteractingForRefreshChangedToken = {};
00151         m_RefreshInfoProvider_InteractionRatioChangedToken = {};
00152
00153         m_executionRatio = 1.0f;
00154     }
00155 }
00156
00157 void RefreshVisualizer::OnOrientationChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00158 {
00159     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.OldValue(), args.NewValue());
00160     m_orientation = Orientation();
00161     OnOrientationChangedImpl();
00162     UpdateContent();
00163 }
00164
00165 void RefreshVisualizer::OnOrientationChangedImpl()
00166 {
00167     switch (m_orientation)
00168     {
00169     case winrt::RefreshVisualizerOrientation::Auto:
00170         switch (m_pullDirection)
00171         {
00172         case winrt::RefreshPullDirection::TopToBottom:
00173         case winrt::RefreshPullDirection::BottomToTop:
00174             m_startingRotationAngle = 0.0f;
00175             break;
00176         case winrt::RefreshPullDirection::LeftToRight:
00177             m_startingRotationAngle = (float)-M_PI_2;
00178             break;
00179         case winrt::RefreshPullDirection::RightToLeft:
00180             m_startingRotationAngle = (float)M_PI_2;
00181             break;
00182         }
00183         break;
00184     case winrt::RefreshVisualizerOrientation::Normal:
00185         m_startingRotationAngle = 0.0f;
00186         break;
00187     case winrt::RefreshVisualizerOrientation::Rotate270DegreesCounterclockwise:
00188         m_startingRotationAngle = (float)-M_PI_2;
00189         break;
00190     case winrt::RefreshVisualizerOrientation::Rotate90DegreesCounterclockwise:
00191         m_startingRotationAngle = (float)M_PI_2;
00192         break;
00193     default:
00194         MUX_ASSERT(false);
00195     }
00196 }
00197
00198 void RefreshVisualizer::OnStateChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00199 {
00200     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, args.OldValue(), args.NewValue());
00201     const winrt::RefreshVisualizerState oldstate = m_state;
00202     m_state = State();
00203     UpdateContent();
00204     RaiseRefreshStateChanged(oldstate, m_state);
00205 }
00206
00207
00208 void RefreshVisualizer::OnContentChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00209 {
00210     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_PTR_PTR, METH_NAME, this, args.OldValue(), args.NewValue());
00211     m_content.set(Content());
00212     OnContentChangedImpl();
00213     UpdateContent();
00214 }
00215
00216 void RefreshVisualizer::OnContentChangedImpl()
00217 {
00218     if (m_root)
00219     {
00220         // There is a slight parallax animation of the progress indicator as the IRefreshInfoProvider updates
00221         // the interaction ratio. Unfortunately, this composition animation would be clobbered by setting the alignment
00222         // properties of the visual's Xaml object. To get around this we wrap the indicator in a container and set the
00223         // container's alignment properties instead. On RS2+ we can instead animate the Translation XAML property, if
00224         // the progress Indicator is a Framework Element and has the Vertical/Horizontal Alignment properties.
00225         m_root.get().Children().Clear();
00226
00227         if (!m_content)
00228         {
00229             winrt::SymbolIcon defaultContent = winrt::SymbolIcon(winrt::Symbol::Refresh);
00230             defaultContent.Height(DEFAULT_INDICATOR_SIZE);
00231             defaultContent.Width(DEFAULT_INDICATOR_SIZE);
00232
00233             m_content.set(defaultContent);
00234         }
00235
00236         winrt::Panel m_containerPanel = m_root.get();
00237         auto contentAsFrameworkElement = m_content.try_as<winrt::FrameworkElement>();
00238
00239         if (!contentAsFrameworkElement)
00240         {
00241             m_containerPanel = winrt::Grid();
00242             m_root.get().Children().InsertAt(0, m_containerPanel);
00243             m_containerPanel.VerticalAlignment(winrt::VerticalAlignment::Center);
00244             m_containerPanel.HorizontalAlignment(winrt::HorizontalAlignment::Center);
00245         }
00246         else
00247         {
00248             winrt::ElementCompositionPreview::SetIsTranslationEnabled(m_content.get(), true);
00249             contentAsFrameworkElement.VerticalAlignment(winrt::VerticalAlignment::Center);
00250             contentAsFrameworkElement.HorizontalAlignment(winrt::HorizontalAlignment::Center);
00251         }
00252
00253         m_containerPanel.Children().InsertAt(0, m_content.get());
00254     }
00255 }
00256
00257 void RefreshVisualizer::UpdateContent()
00258 {
00259     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00260     if (m_content)
00261     {
00262         const winrt::Visual contentVisual = winrt::ElementCompositionPreview::GetElementVisual(m_content.get());
00263
00264         const winrt::Size contentSize = m_content.get().RenderSize();
00265         contentVisual.CenterPoint({ (float)(contentSize.Height / 2), (float)(contentSize.Width / 2), 0.0f });
00266
00267         switch (m_state)
00268         {
00269         case winrt::RefreshVisualizerState::Idle:
00270             contentVisual.Opacity(MINIMUM_INDICATOR_OPACITY);
00271             contentVisual.RotationAngle(m_startingRotationAngle);
00272             contentVisual.Properties().InsertVector3(L"Translation", { 0.0f, 0.0f, 0.0f });
00273             break;
00274         case winrt::RefreshVisualizerState::Peeking:
00275             contentVisual.Opacity(1.0f);
00276             contentVisual.RotationAngle(m_startingRotationAngle);
00277             break;
00278         case winrt::RefreshVisualizerState::Interacting:
00279             contentVisual.Opacity(MINIMUM_INDICATOR_OPACITY);
00280             ExecuteInteractingAnimations();
00281             break;
00282         case winrt::RefreshVisualizerState::Pending:
00283             ExecuteScaleUpAnimation();
00284             contentVisual.Opacity(1.0f);
00285             contentVisual.RotationAngle(m_startingRotationAngle);
00286             break;
00287         case winrt::RefreshVisualizerState::Refreshing:
00288             ExecuteExecutingRotationAnimation();
00289             contentVisual.Opacity(1.0f);
00290             if (m_root)
00291             {
00292                 float translationRatio = [this]() {
00293                     if (auto&& refreshInfoProvider = m_refreshInfoProvider.get())
00294                     {
00295                         return (1.0f - (float)(refreshInfoProvider.ExecutionRatio())) * PARALLAX_POSITION_RATIO;
00296                     }
00297                     return 1.0f;
00298                 }();
00299                 translationRatio = IsPullDirectionFar() ? -1.0f * translationRatio : translationRatio;
00300                 if (IsPullDirectionVertical())
00301                 {
00302                     contentVisual.Properties().InsertVector3(L"Translation", { 0.0f, translationRatio * (float)m_root.get().ActualHeight(), 0.0f });
00303                 }
00304                 else
00305                 {
00306                     contentVisual.Properties().InsertVector3(L"Translation", { translationRatio * (float)m_root.get().ActualWidth(), 0.0f, 0.0f });
00307                 }
00308             }
00309
00310             break;
00311         default:
00312             MUX_ASSERT(false);
00313         }
00314     }
00315 }
00316
00317 void RefreshVisualizer::ExecuteInteractingAnimations()
00318 {
00319     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00320     if (m_content && m_refreshInfoProvider)
00321     {
00322         winrt::Visual contentVisual = winrt::ElementCompositionPreview::GetElementVisual(m_content.get());
00323         if (!m_compositor)
00324         {
00325             m_compositor.set(contentVisual.Compositor());
00326         }
00327
00328         //Set up the InteractionRatioRotationAnimation
00329         const winrt::Size contentSize = m_content.get().RenderSize();
00330         contentVisual.CenterPoint({ (float)(contentSize.Height / 2), (float)(contentSize.Width / 2), 0.0f });
00331
00332         const winrt::hstring interactionRatioPropertyName = m_refreshInfoProvider.get().InteractionRatioCompositionProperty();
00333         const winrt::CompositionPropertySet interactionRatioPropertySet = m_refreshInfoProvider.get().CompositionProperties();
00334
00335         const winrt::ExpressionAnimation contentInteractionRatioRotationAnimation = m_compositor.get().CreateExpressionAnimation(
00336             L"startingRotationAngle + (Pi * (Clamp(RefreshInteractionRatioPropertySet." +
00337             static_cast<std::wstring>(interactionRatioPropertyName) +
00338             L", 0.0f, contentVisual.DEFAULT_REFRESHINDICATOR_THRESHOLD_RATIO) / contentVisual.DEFAULT_REFRESHINDICATOR_THRESHOLD_RATIO) * 2)");
00339
00340         const auto thresholdRatioName{ L"DEFAULT_REFRESHINDICATOR_THRESHOLD_RATIO"sv };
00341         contentVisual.Properties().InsertScalar(thresholdRatioName, static_cast<float>(m_executionRatio));
00342         contentInteractionRatioRotationAnimation.SetReferenceParameter(L"contentVisual", contentVisual);
00343         contentInteractionRatioRotationAnimation.SetReferenceParameter(L"RefreshInteractionRatioPropertySet", interactionRatioPropertySet);
00344         contentInteractionRatioRotationAnimation.SetScalarParameter(L"startingRotationAngle", m_startingRotationAngle);
00345
00346         contentVisual.StartAnimation(L"RotationAngle", contentInteractionRatioRotationAnimation);
00347
00348         //Set up the InteractionRatioOpacityAnimation
00349         const winrt::ExpressionAnimation contentInteractionRatioOpacityAnimation = m_compositor.get().CreateExpressionAnimation(
00350             L"((1.0f - contentVisual.MINIMUM_INDICATOR_OPACITY) * RefreshInteractionRatioPropertySet."
00351             + static_cast<std::wstring>(interactionRatioPropertyName) +
00352             L") + contentVisual.MINIMUM_INDICATOR_OPACITY");
00353         const auto minOpacityName{ L"MINIMUM_INDICATOR_OPACITY"sv };
00354         contentVisual.Properties().InsertScalar(minOpacityName, MINIMUM_INDICATOR_OPACITY);
00355         contentInteractionRatioOpacityAnimation.SetReferenceParameter(L"contentVisual", contentVisual);
00356         contentInteractionRatioOpacityAnimation.SetReferenceParameter(L"RefreshInteractionRatioPropertySet", interactionRatioPropertySet);
00357
00358         //contentVisual.StartAnimation(L"Opacity", contentInteractionRatioOpacityAnimation);
00359
00360         //Set up the InteractionRatioParallaxAnimation
00361         winrt::ExpressionAnimation contentInteractionRatioParallaxAnimation{ nullptr };
00362         if (IsPullDirectionFar())
00363         {
00364             contentInteractionRatioParallaxAnimation = m_compositor.get().CreateExpressionAnimation(
00365                 L"((1.0f - contentVisual.DEFAULT_REFRESHINDICATOR_THRESHOLD_RATIO) * rootSize * 0.5f * -1.0f) * min((RefreshInteractionRatioPropertySet."
00366                 + static_cast<std::wstring>(interactionRatioPropertyName) +
00367                 L" / contentVisual.DEFAULT_REFRESHINDICATOR_THRESHOLD_RATIO), 1.0f)");
00368         }
00369         else
00370         {
00371             contentInteractionRatioParallaxAnimation = m_compositor.get().CreateExpressionAnimation(
00372                 L"((1.0f - contentVisual.DEFAULT_REFRESHINDICATOR_THRESHOLD_RATIO) * rootSize * 0.5f) * min((RefreshInteractionRatioPropertySet."
00373                 + static_cast<std::wstring>(interactionRatioPropertyName) +
00374                 L" / contentVisual.DEFAULT_REFRESHINDICATOR_THRESHOLD_RATIO), 1.0f)");
00375         }
00376         if (m_root)
00377         {
00378             contentInteractionRatioParallaxAnimation.SetScalarParameter(L"rootSize", (float)(IsPullDirectionVertical() ? m_root.get().ActualHeight() : m_root.get().ActualWidth()));
00379         }
00380         else
00381         {
00382             contentInteractionRatioParallaxAnimation.SetScalarParameter(L"rootSize", 0.0f);
00383         }
00384
00385         contentInteractionRatioParallaxAnimation.SetReferenceParameter(L"contentVisual", contentVisual);
00386         contentInteractionRatioParallaxAnimation.SetReferenceParameter(L"RefreshInteractionRatioPropertySet", interactionRatioPropertySet);
00387
00388         if (IsPullDirectionVertical())
00389         {
00390             contentVisual.StartAnimation(L"Translation.Y", contentInteractionRatioParallaxAnimation);
00391         }
00392         else
00393         {
00394             contentVisual.StartAnimation(L"Translation.X", contentInteractionRatioParallaxAnimation);
00395         }
00396     }
00397 }
00398
00399 void RefreshVisualizer::ExecuteScaleUpAnimation()
00400 {
00401     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00402     if (m_content)
00403     {
00404         const winrt::Visual contentVisual = winrt::ElementCompositionPreview::GetElementVisual(m_content.get());
00405         if (!m_compositor)
00406         {
00407             m_compositor.set(contentVisual.Compositor());
00408         }
00409
00410         const winrt::Vector2KeyFrameAnimation contentScaleAnimation = m_compositor.get().CreateVector2KeyFrameAnimation();
00411         contentScaleAnimation.InsertKeyFrame(0.5f, winrt::float2(1.50f, 1.50f));
00412         contentScaleAnimation.InsertKeyFrame(1.0f, winrt::float2(1.0f, 1.0f));
00413         contentScaleAnimation.Duration(300ms);
00414
00415         const winrt::Size contentSize = m_content.get().RenderSize();
00416         contentVisual.CenterPoint({ (float)(contentSize.Height / 2), (float)(contentSize.Width / 2), 0.0f });
00417
00418         contentVisual.StartAnimation(L"Scale.XY", contentScaleAnimation);
00419     }
00420 }
00421
00422 void RefreshVisualizer::ExecuteExecutingRotationAnimation()
00423 {
00424     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00425     if (m_content)
00426     {
00427         const winrt::Visual contentVisual = winrt::ElementCompositionPreview::GetElementVisual(m_content.get());
00428         if (!m_compositor)
00429         {
00430             m_compositor.set(contentVisual.Compositor());
00431         }
00432
00433         const winrt::ScalarKeyFrameAnimation contentExecutionRotationAnimation = m_compositor.get().CreateScalarKeyFrameAnimation();
00434         contentExecutionRotationAnimation.InsertKeyFrame(0.0f, m_startingRotationAngle, m_compositor.get().CreateLinearEasingFunction());
00435         contentExecutionRotationAnimation.InsertKeyFrame(1.0f, m_startingRotationAngle + (float)(2.0f * M_PI), m_compositor.get().CreateLinearEasingFunction());
00436         contentExecutionRotationAnimation.Duration(500ms);
00437         contentExecutionRotationAnimation.IterationBehavior(winrt::AnimationIterationBehavior::Forever);
00438
00439         const winrt::Size contentSize = m_content.get().RenderSize();
00440         contentVisual.CenterPoint({ (float)(contentSize.Height / 2), (float)(contentSize.Width / 2), 0.0f });
00441
00442         contentVisual.StartAnimation(L"RotationAngle", contentExecutionRotationAnimation);
00443     }
00444 }
00445
00446 void RefreshVisualizer::UpdateRefreshState(const winrt::RefreshVisualizerState& newState)
00447 {
00448     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, newState);
00449     if (newState != m_state)
00450     {
00451         put_State(newState);
00452     }
00453 }
00454
00455 void RefreshVisualizer::RaiseRefreshStateChanged(const winrt::RefreshVisualizerState& oldState, const winrt::RefreshVisualizerState& newState)
00456 {
00457     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, oldState, newState);
00458     const auto e = winrt::make<RefreshStateChangedEventArgs>(oldState, newState);
00459     m_refreshStateChangedEventSource(*this, e);
00460 }
00461
00462 void RefreshVisualizer::RaiseRefreshRequested()
00463 {
00464     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00465     com_ptr<RefreshVisualizer> strongThis = get_strong();
00466
00467     const winrt::Deferral instance{ [strongThis]()
00468         {
00469             strongThis->CheckThread();
00470             strongThis->RefreshCompleted();
00471         }
00472     };
00473
00474     const auto args = winrt::make_self<RefreshRequestedEventArgs>(instance);
00475
00476     //This makes sure that everyone registered for this event can get access to the deferral
00477     //Otherwise someone could complete the deferral before someone else has had a chance to grab it
00478     args->IncrementDeferralCount();
00479     m_refreshRequestedEventSource(*this, *args);
00480     args->DecrementDeferralCount();
00481 }
00482
00483 void RefreshVisualizer::RefreshCompleted()
00484 {
00485     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00486     UpdateRefreshState(winrt::RefreshVisualizerState::Idle);
00487     if (m_refreshInfoProvider)
00488     {
00489         m_refreshInfoProvider.get().OnRefreshCompleted();
00490     }
00491 }
00492
00493 void RefreshVisualizer::RefreshInfoProvider_InteractingForRefreshChanged(const  winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*e*/)
00494 {
00495     if (m_refreshInfoProvider)
00496     {
00497         m_isInteractingForRefresh = m_refreshInfoProvider.get().IsInteractingForRefresh();
00498         PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, m_isInteractingForRefresh);
00499         if (!m_isInteractingForRefresh)
00500         {
00501             switch (m_state)
00502             {
00503             case winrt::RefreshVisualizerState::Pending:
00504                 // User stopped interaction after it hit the Pending state.
00505                 RequestRefresh();
00506                 break;
00507             case winrt::RefreshVisualizerState::Refreshing:
00508                 // We don't want to interrupt a currently executing refresh.
00509                 break;
00510             default:
00511                 //Peeking, interacting, or idle results in idle.
00512                 UpdateRefreshState(winrt::RefreshVisualizerState::Idle);
00513                 break;
00514             }
00515         }
00516     }
00517 }
00518
00519 void RefreshVisualizer::RefreshInfoProvider_InteractionRatioChanged(const winrt::IRefreshInfoProvider& /*sender*/, const winrt::RefreshInteractionRatioChangedEventArgs& e)
00520 {
00521     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_DBL, METH_NAME, this, e.InteractionRatio());
00522     const bool wasAtZero = m_interactionRatio == 0.0f;
00523     m_interactionRatio = e.InteractionRatio();
00524     if (m_isInteractingForRefresh)
00525     {
00526         if (m_state == winrt::RefreshVisualizerState::Idle)
00527         {
00528             if (wasAtZero)
00529             {
00530                 if (m_interactionRatio > m_executionRatio)
00531                 {
00532                     //Sometimes due to missed frames in the interplay of comp and xaml the interaction tracker will 'jump' passed the executionRatio on the first Value changed.
00533                     UpdateRefreshState(winrt::RefreshVisualizerState::Pending);
00534                 }
00535                 else if (m_interactionRatio > 0.0f)
00536                 {
00537                     UpdateRefreshState(winrt::RefreshVisualizerState::Interacting);
00538                 }
00539             }
00540             else if (m_interactionRatio > 0.0f)
00541             {
00542                 // TODO: IRefreshInfoProvider does not raise InteractionRatioChanged yet when DManip is overpanning. Thus we do not yet
00543                 // enter the Peeking state when DManip overpans in inertia.
00544                 UpdateRefreshState(winrt::RefreshVisualizerState::Peeking);
00545             }
00546         }
00547         else if (m_state == winrt::RefreshVisualizerState::Interacting)
00548         {
00549             if (m_interactionRatio <= 0.0f)
00550             {
00551                 UpdateRefreshState(winrt::RefreshVisualizerState::Idle);
00552             }
00553             else if (m_interactionRatio > m_executionRatio)
00554             {
00555                 UpdateRefreshState(winrt::RefreshVisualizerState::Pending);
00556             }
00557         }
00558         else if (m_state == winrt::RefreshVisualizerState::Pending)
00559         {
00560             if (m_interactionRatio <= m_executionRatio)
00561             {
00562                 UpdateRefreshState(winrt::RefreshVisualizerState::Interacting);
00563             }
00564             else if (m_interactionRatio <= 0.0f)
00565             {
00566                 UpdateRefreshState(winrt::RefreshVisualizerState::Idle);
00567             }
00568         }
00569         //If we are in Refreshing or Peeking we want to stay in those states.
00570     }
00571     else
00572     {
00573         //If we are not refreshing or interacting for refresh then the only valid states are Peeking and Idle
00574         if (m_state != winrt::RefreshVisualizerState::Refreshing)
00575         {
00576             if (m_interactionRatio > 0.0f)
00577             {
00578                 UpdateRefreshState(winrt::RefreshVisualizerState::Peeking);
00579             }
00580             else
00581             {
00582                 UpdateRefreshState(winrt::RefreshVisualizerState::Idle);
00583             }
00584         }
00585     }
00586 }
00587
00588 void RefreshVisualizer::put_State(const winrt::RefreshVisualizerState& value)
00589 {
00590     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, value);
00591     SetValue(s_StateProperty, box_value(value));
00592 }
00593
00594 bool RefreshVisualizer::IsPullDirectionVertical()
00595 {
00596     return m_pullDirection == winrt::RefreshPullDirection::TopToBottom || m_pullDirection == winrt::RefreshPullDirection::BottomToTop;
00597 }
00598
00599 bool RefreshVisualizer::IsPullDirectionFar()
00600 {
00601     return m_pullDirection == winrt::RefreshPullDirection::BottomToTop || m_pullDirection == winrt::RefreshPullDirection::RightToLeft;
00602 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Interactions/ButtonInteraction/ButtonInteraction.cpp Source File

  • Interactions
  • ButtonInteraction

ButtonInteraction.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006
00007 #include "ButtonInteraction.h"
00008 #include "ButtonInteractionInvokedEventArgs.h"
00009
00010 #include "ButtonInteraction.properties.cpp"
00011
00012 winrt::ButtonInteractionInvokeMode ButtonInteraction::InvokeMode()
00013 {
00014     return m_invokeMode;
00015 }
00016
00017 void ButtonInteraction::InvokeMode(winrt::ButtonInteractionInvokeMode const& value)
00018 {
00019     const auto invokeMode = value;
00020     if (invokeMode != m_invokeMode)
00021     {
00022         m_invokeMode = value;
00023         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"InvokeMode"));
00024     }
00025 }
00026
00027 bool ButtonInteraction::IsHovering()
00028 {
00029     return m_isHovering;
00030 }
00031
00032 bool ButtonInteraction::IsPressing()
00033 {
00034     return m_isPressing;
00035 }
00036
00037 winrt::event_token ButtonInteraction::PropertyChanged(winrt::PropertyChangedEventHandler const& value)
00038 {
00039     return m_propertyChangedEventSource.add(value);
00040 }
00041
00042 void ButtonInteraction::PropertyChanged(winrt::event_token const& token)
00043 {
00044     m_propertyChangedEventSource.remove(token);
00045 }
00046
00047 winrt::IVectorView<winrt::RoutedEvent> ButtonInteraction::GetSupportedEventsCore()
00048 {
00049     std::vector<winrt::RoutedEvent> supportedEvents;
00050
00051     // Build the list of events that we'll respond to.
00052     supportedEvents.push_back(winrt::UIElement::KeyDownEvent());
00053     supportedEvents.push_back(winrt::UIElement::KeyUpEvent());
00054     supportedEvents.push_back(winrt::UIElement::PointerExitedEvent());
00055     supportedEvents.push_back(winrt::UIElement::PointerEnteredEvent());
00056     supportedEvents.push_back(winrt::UIElement::PointerExitedEvent());
00057     supportedEvents.push_back(winrt::UIElement::PointerPressedEvent());
00058     supportedEvents.push_back(winrt::UIElement::PointerReleasedEvent());
00059     supportedEvents.push_back(winrt::UIElement::PointerCanceledEvent());
00060     supportedEvents.push_back(winrt::UIElement::PointerCaptureLostEvent());
00061
00062     return winrt::single_threaded_vector(std::move(supportedEvents)).GetView();
00063 }
00064
00065 void ButtonInteraction::OnKeyDown(winrt::UIElement const& sender, winrt::KeyRoutedEventArgs const& args)
00066 {
00067     // Only process key events if the pointer is not currently being pressed.
00068     if (!m_hasPointerCapture)
00069     {
00070         auto target = sender;
00071         auto keyArgs = args;
00072
00073         switch (keyArgs.Key())
00074         {
00075         case winrt::VirtualKey::Space:
00076         case winrt::VirtualKey::Enter:
00077             UpdateIsPressing(true);
00078
00079             if (m_invokeMode == winrt::ButtonInteractionInvokeMode::Press)
00080             {
00081                 RaiseInvoked(target);
00082             }
00083             break;
00084         }
00085     }
00086 }
00087
00088 void ButtonInteraction::OnKeyUp(winrt::UIElement const& sender, winrt::KeyRoutedEventArgs const& args)
00089 {
00090     // Only process key events if the pointer is not currently being pressed.
00091     if (!m_hasPointerCapture)
00092     {
00093         auto target = sender;
00094         auto keyArgs = args;
00095
00096         switch (keyArgs.Key())
00097         {
00098         case winrt::VirtualKey::Space:
00099         case winrt::VirtualKey::Enter:
00100             UpdateIsPressing(false);
00101
00102             if (m_invokeMode == winrt::ButtonInteractionInvokeMode::Release)
00103             {
00104                 RaiseInvoked(target);
00105             }
00106
00107             break;
00108         }
00109     }
00110 }
00111
00112 void ButtonInteraction::OnPointerEntered(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00113 {
00114     auto target = sender;
00115     auto pointerArgs = args;
00116
00117     UpdateIsHovering(true);
00118
00119     if (m_invokeMode == winrt::ButtonInteractionInvokeMode::Hover)
00120     {
00121         UpdateIsPressing(true);
00122         RaiseInvoked(target);
00123     }
00124 }
00125
00126 void ButtonInteraction::OnPointerExited(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00127 {
00128     auto target = sender;
00129
00130     UpdateIsHovering(false);
00131
00132     if (m_invokeMode == winrt::ButtonInteractionInvokeMode::Hover || m_hasPointerCapture)
00133     {
00134         UpdateIsPressing(false);
00135     }
00136 }
00137
00138 void ButtonInteraction::OnPointerPressed(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00139 {
00140     auto target = sender;
00141     auto pointerArgs = args;
00142
00143     UpdateIsPressing(true);
00144
00145     if (m_invokeMode == winrt::ButtonInteractionInvokeMode::Press)
00146     {
00147         RaiseInvoked(target);
00148     }
00149
00150     m_hasPointerCapture = target.CapturePointer(pointerArgs.Pointer());
00151 }
00152
00153 void ButtonInteraction::OnPointerReleased(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00154 {
00155     const auto target = sender;
00156     const auto pointerArgs = args;
00157
00158     const bool wasPressing = m_isPressing;
00159
00160     UpdateIsPressing(false);
00161
00162     if (wasPressing && m_invokeMode == winrt::ButtonInteractionInvokeMode::Release)
00163     {
00164         RaiseInvoked(target);
00165     }
00166
00167     if (m_hasPointerCapture)
00168     {
00169         target.ReleasePointerCapture(pointerArgs.Pointer());
00170     }
00171 }
00172
00173 void ButtonInteraction::OnPointerCanceled(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00174 {
00175     auto target = sender;
00176     auto pointerArgs = args;
00177
00178     if (m_hasPointerCapture)
00179     {
00180         target.ReleasePointerCapture(pointerArgs.Pointer());
00181     }
00182
00183     UpdateIsPressing(false);
00184 }
00185
00186 void ButtonInteraction::OnPointerCaptureLost(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00187 {
00188     auto target = sender;
00189
00190     m_hasPointerCapture = false;
00191     UpdateIsPressing(false);
00192 }
00193
00194 void ButtonInteraction::RaiseInvoked(winrt::UIElement target)
00195 {
00196     auto eventArgs = winrt::make_self<ButtonInteractionInvokedEventArgs>(target);
00197     m_invokedEventSource(*this, *eventArgs);
00198 }
00199
00200 void ButtonInteraction::UpdateIsHovering(bool isHovering)
00201 {
00202     if (isHovering != m_isHovering)
00203     {
00204         m_isHovering = isHovering;
00205         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"IsHovering"));
00206     }
00207 }
00208
00209 void ButtonInteraction::UpdateIsPressing(bool isPressing)
00210 {
00211     if (isPressing != m_isPressing)
00212     {
00213         m_isPressing = isPressing;
00214         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"IsPressing"));
00215     }
00216 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/LayoutSamples/NonVirtualLayoutPages/CircleLayout.cs Source File

  • Repeater
  • TestUI
  • Samples
  • LayoutSamples
  • NonVirtualLayoutPages

CircleLayout.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Windows.Foundation;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Controls;
00008
00009 namespace MUXControlsTestApp.Samples
00010 {
00011     class CircleLayout : VirtualizingLayout
00012     {
00013         public double ItemSize { get; set; }
00014
00015         protected override Size MeasureOverride(VirtualizingLayoutContext context, Size availableSize)
00016         {
00017             var itemCount = context.ItemCount;
00018             for(int i=0; i< context.ItemCount; i++)
00019             {
00020                 var container = context.GetOrCreateElementAt(i);
00021                 container.Measure(new Size(ItemSize, ItemSize));
00022             }
00023
00024             return availableSize;
00025         }
00026
00027         protected override Size ArrangeOverride(VirtualizingLayoutContext context, Size finalSize)
00028         {
00029             var itemCount = context.ItemCount;
00030             var radius = GetCircleRadius(finalSize) - ItemSize / 2.0;
00031             var angleIncrement = 2 * Math.PI / itemCount;
00032             var angle = 0.0;
00033
00034             for (int i = 0; i < context.ItemCount; i++)
00035             {
00036                 var container = context.GetOrCreateElementAt(i);
00037                 var x = Math.Sin(angle) * radius - ItemSize / 2.0 + finalSize.Width / 2.0;
00038                 var y = -Math.Cos(angle) * radius - ItemSize / 2.0 + finalSize.Height / 2.0;
00039                 container.Arrange(new Rect(x, y, ItemSize, ItemSize));
00040                 angle += angleIncrement;
00041             }
00042
00043             return finalSize;
00044         }
00045
00046         private double GetCircleRadius(Size availableSize)
00047         {
00048             return Math.Min(availableSize.Width, availableSize.Height) / 2;
00049         }
00050     }
00051 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RepeaterTests Member List

This is the complete list of members for RepeaterTests, including all inherited members.
ClassInitialize(TestContext testContext) | RepeaterTests | [inline, static]
InsertAtStartBehavior() | RepeaterTests | [inline]
TestCleanup() | RepeaterTests | [inline]
VerifyUniformGridLayoutDoesNotCreateHoles() | RepeaterTests | [inline]
VerifyUniformGridLayoutScrolling() | RepeaterTests | [inline]
Generated on Sun Dec 1 2024 20:53:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/PivotPage.xaml.cs Source File

  • CommonStyles
  • TestUI

PivotPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     [TopLevelTestPage(Name = "Pivot", Icon = "Pivot.png")]
00007     public sealed partial class PivotPage : TestPage
00008     {
00009         public PivotPage()
00010         {
00011             this.InitializeComponent();
00012         }
00013     }
00014 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBadge/InfoBadgeTemplateSettings.h Source File

  • InfoBadge

InfoBadgeTemplateSettings.h

Go to the documentation of this file.
00001 ﻿#pragma once
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "InfoBadgeTemplateSettings.g.h"
00008 #include "InfoBadgeTemplateSettings.properties.h"
00009
00010 class InfoBadgeTemplateSettings :
00011     public winrt::implementation::InfoBadgeTemplateSettingsT<InfoBadgeTemplateSettings>,
00012     public InfoBadgeTemplateSettingsProperties
00013 {
00014 public:
00015     InfoBadgeTemplateSettings();
00016 };
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/FlowLayoutAlgorithm.h Source File

  • Repeater

FlowLayoutAlgorithm.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ElementManager.h"
00007 #include "IFlowLayoutAlgorithmDelegates.h"
00008 #include "OrientationBasedMeasures.h"
00009
00010 class FlowLayoutAlgorithm : OrientationBasedMeasures
00011 {
00012 public:
00013     // Types
00014     enum class LineAlignment
00015     {
00016         Start,
00017         Center,
00018         End,
00019         SpaceAround,
00020         SpaceBetween,
00021         SpaceEvenly
00022     };
00023
00024     FlowLayoutAlgorithm(const ITrackerHandleManager* owner) :
00025         m_owner(owner),
00026         m_elementManager(owner),
00027         m_context(owner)
00028     { }
00029
00030     // Methods
00031     winrt::Rect LastExtent() const { return m_lastExtent; }
00032
00033     void InitializeForContext(const winrt::VirtualizingLayoutContext& context, IFlowLayoutAlgorithmDelegates* callbacks);
00034     void UninitializeForContext(const winrt::VirtualizingLayoutContext& context);
00035
00036     winrt::Size Measure(
00037         const winrt::Size& availableSize,
00038         const winrt::VirtualizingLayoutContext& context,
00039         bool isWrapping,
00040         double minItemSpacing,
00041         double lineSpacing,
00042         unsigned int maxItemsPerLine,
00043         const ScrollOrientation& orientation,
00044         const bool isVirtualizationEnabled,
00045         const wstring_view& layoutId);
00046     winrt::Size Arrange(
00047         const winrt::Size& finalSize,
00048         const winrt::VirtualizingLayoutContext& context,
00049         bool isWrapping,
00050         FlowLayoutAlgorithm::LineAlignment lineAlignment,
00051         const wstring_view& layoutId);
00052     void OnItemsSourceChanged(
00053         const winrt::IInspectable& source,
00054         winrt::NotifyCollectionChangedEventArgs const& args,
00055         const winrt::IVirtualizingLayoutContext& context);
00056
00057     winrt::Size MeasureElement(
00058         const winrt::UIElement& element,
00059         int index,
00060         const winrt::Size& availableSize,
00061         const winrt::VirtualizingLayoutContext& context);
00062
00063     winrt::UIElement GetElementIfRealized(int dataindex);
00064
00065 private:
00066     // Types
00067     enum class GenerateDirection
00068     {
00069         Forward,
00070         Backward
00071     };
00072
00073     // Methods
00074 #pragma region Measure related private methods
00075     int GetAnchorIndex(
00076         const winrt::Size& availableSize,
00077         bool isWrapping,
00078         double minItemSpacing,
00079         const bool isVirtualizationEnabled,
00080         const wstring_view& layoutId);
00081     void Generate(
00082         GenerateDirection direction,
00083         int anchorIndex,
00084         const winrt::Size& availableSize,
00085         bool isWrapping,
00086         double minItemSpacing,
00087         double lineSpacing,
00088         unsigned int maxItemsPerLine,
00089         const bool isVirtualizationEnabled,
00090         const wstring_view& layoutId);
00091     void MakeAnchor(
00092         const winrt::VirtualizingLayoutContext& context,
00093         int index,
00094         const winrt::Size& availableSize);
00095     bool IsReflowRequired() const;
00096     bool ShouldContinueFillingUpSpace(
00097         int index,
00098         GenerateDirection direction);
00099     winrt::Rect EstimateExtent(const winrt::Size& availableSize, const wstring_view& layoutId);
00100     void RaiseLineArranged();
00101 #pragma endregion
00102
00103 #pragma region Arrange related private methods
00104     void ArrangeVirtualizingLayout(
00105         const winrt::Size& finalSize,
00106         FlowLayoutAlgorithm::LineAlignment lineAlignment,
00107         bool isWrapping,
00108         const wstring_view& layoutId);
00109     void PerformLineAlignment(
00110         int lineStartIndex,
00111         int countInLine,
00112         float spaceAtLineStart,
00113         float spaceAtLineEnd,
00114         float lineSize,
00115         FlowLayoutAlgorithm::LineAlignment lineAlignment,
00116         bool isWrapping,
00117         const winrt::Size& finalSize,
00118         const wstring_view& layoutId);
00119 #pragma endregion
00120
00121 #pragma region Layout Context Helpers
00122     winrt::Rect RealizationRect();
00123     void SetLayoutOrigin();
00124 #pragma endregion
00125
00126     bool IsVirtualizingContext();
00127
00128     // Fields
00129     const ITrackerHandleManager* m_owner;
00130     ::ElementManager m_elementManager;
00131     winrt::Size m_lastAvailableSize{};
00132     double m_lastItemSpacing{};
00133     bool m_collectionChangePending{};
00134     tracker_ref<winrt::VirtualizingLayoutContext> m_context;
00135     IFlowLayoutAlgorithmDelegates* m_algorithmCallbacks{ nullptr };
00136     winrt::Rect m_lastExtent{};
00137     int m_firstRealizedDataIndexInsideRealizationWindow{ -1 };
00138     int m_lastRealizedDataIndexInsideRealizationWindow{ -1 };
00139
00140     // If the scroll orientation is the same as the folow orientation
00141     // we will only have one line since we will never wrap. In that case
00142     // we do not want to align the line. We could potentially switch the
00143     // meaning of line alignment in this case, but I'll hold off on that
00144     // feature until someone asks for it - This is not a common scenario
00145     // anyway.
00146     bool m_scrollOrientationSameAsFlow{ false };
00147 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/WinEventLogLevels.h Source File

  • inc

WinEventLogLevels.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // From winmeta.h
00005
00006 #define WINEVENT_LEVEL_LOG_ALWAYS 0x0
00007 #define WINEVENT_LEVEL_CRITICAL 0x1
00008 #define WINEVENT_LEVEL_ERROR 0x2
00009 #define WINEVENT_LEVEL_WARNING 0x3
00010 #define WINEVENT_LEVEL_INFO 0x4
00011 #define WINEVENT_LEVEL_VERBOSE 0x5
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemCollectionTransitionProgress.h Source File

  • Repeater

ItemCollectionTransitionProgress.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "ItemCollectionTransitionProgress.g.h"
00010
00011 class ItemCollectionTransitionProgress :
00012     public ReferenceTracker<ItemCollectionTransitionProgress, winrt::implementation::ItemCollectionTransitionProgressT, winrt::composing, winrt::composable>
00013 {
00014 public:
00015     ItemCollectionTransitionProgress(winrt::ItemCollectionTransition transition);
00016
00017     winrt::ItemCollectionTransition Transition() { return m_transition.get(); }
00018     winrt::UIElement Element();
00019
00020     void Complete();
00021
00022 private:
00023     winrt::weak_ref<winrt::ItemCollectionTransition> m_transition{ nullptr };
00024 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnnotatedScrollBar/AnnotatedScrollBar.cpp Source File

  • AnnotatedScrollBar

AnnotatedScrollBar.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "AnnotatedScrollBar.h"
00007 #include "RuntimeProfiler.h"
00008 #include "ResourceAccessor.h"
00009 #include "TypeLogging.h"
00010 #include "ScrollPresenterTypeLogging.h"
00011 #include "ScrollingScrollOptions.h"
00012 #include "ScrollControllerScrollToRequestedEventArgs.h"
00013 #include "ScrollControllerScrollByRequestedEventArgs.h"
00014 #include "ScrollControllerAddScrollVelocityRequestedEventArgs.h"
00015 #include "ScrollControllerPanRequestedEventArgs.h"
00016 #include "AnnotatedScrollBarScrollingEventArgs.h"
00017 #include "AnnotatedScrollBarDetailLabelRequestedEventArgs.h"
00018 #include "Vector.h"
00019
00020 // Change to 'true' to turn on debugging outputs in Output window
00021 bool AnnotatedScrollBarTrace::s_IsDebugOutputEnabled{ false };
00022 bool AnnotatedScrollBarTrace::s_IsVerboseDebugOutputEnabled{ false };
00023
00024 static winrt::Size c_infSize{ std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity() };
00025
00026 AnnotatedScrollBar::AnnotatedScrollBar()
00027 {
00028     ANNOTATEDSCROLLBAR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00029
00030     __RP_Marker_ClassById(RuntimeProfiler::ProfId_AnnotatedScrollBar);
00031
00032     EnsureProperties();
00033     SetDefaultStyleKey(this);
00034
00035     m_sizeChangedRevoker = SizeChanged(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnSizeChanged });
00036 #ifdef DBG
00037     m_loadedRevoker = Loaded(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnLoaded });
00038 #endif
00039     m_isEnabledRevoker = IsEnabledChanged(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnIsEnabledChanged });
00040
00041     SetValue(s_LabelsProperty, winrt::make<ObservableVector<winrt::AnnotatedScrollBarLabel>>());
00042
00043     auto observableVector = Labels().try_as<winrt::IObservableVector<winrt::AnnotatedScrollBarLabel>>();
00044     m_labelsVectorChangedRevoker = observableVector.VectorChanged(winrt::auto_revoke,{ this, &AnnotatedScrollBar::OnLabelsCollectionChanged });
00045
00046     SmallChange(0);
00047 }
00048
00049 AnnotatedScrollBar::~AnnotatedScrollBar()
00050 {
00051     ANNOTATEDSCROLLBAR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00052
00053     UnhookHandlers(true /*isFromDestructor*/);
00054 }
00055
00056 winrt::IScrollController AnnotatedScrollBar::ScrollController()
00057 {
00058     return static_cast<winrt::IScrollController>(*this);
00059 }
00060
00061 void AnnotatedScrollBar::ViewportSize(double viewportSize)
00062 {
00063     if (viewportSize != m_viewportSize)
00064     {
00065         m_viewportSize = viewportSize;
00066         UpdatePositionsOfAnchoredElements();
00067     }
00068 }
00069
00070 double AnnotatedScrollBar::ViewportSize()
00071 {
00072     return m_viewportSize;
00073 }
00074
00075 void AnnotatedScrollBar::Maximum(double maximum)
00076 {
00077     if (maximum != m_maximum)
00078     {
00079         m_maximum = maximum;
00080         UpdatePositionsOfAnchoredElements();
00081     }
00082 }
00083
00084 double AnnotatedScrollBar::Maximum()
00085 {
00086     return m_maximum;
00087 }
00088
00089 void AnnotatedScrollBar::Minimum(double minimum)
00090 {
00091     if (minimum != m_minimum)
00092     {
00093         m_minimum = minimum;
00094         UpdatePositionsOfAnchoredElements();
00095     }
00096 }
00097
00098 double AnnotatedScrollBar::Minimum()
00099 {
00100     return m_minimum;
00101 }
00102
00103 void AnnotatedScrollBar::Value(double value)
00104 {
00105     if (value != m_value)
00106     {
00107         m_value = value;
00108     }
00109 }
00110
00111 double AnnotatedScrollBar::Value()
00112 {
00113     return m_value;
00114 }
00115
00116 void AnnotatedScrollBar::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00117 {
00118     winrt::IDependencyProperty property = args.Property();
00119
00120     if (property == s_LabelTemplateProperty)
00121     {
00122         QueueLayoutLabels(50 /*millisecondWait*/);
00123     }
00124     else if (property == s_DetailLabelTemplateProperty)
00125     {
00126         m_detailLabelTemplateApplied = false;
00127     }
00128     else if (property == s_LabelsProperty)
00129     {
00130         if (auto labelsGrid = m_labelsGrid.get())
00131         {
00132             labelsGrid.Children().Clear();
00133         }
00134         m_labelSizes.clear();
00135         QueueLayoutLabels(50 /*millisecondWait*/);
00136     }
00137 }
00138
00139 void AnnotatedScrollBar::OnSizeChanged(const winrt::IInspectable& sender, const winrt::SizeChangedEventArgs& args)
00140 {
00141     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00142
00143     UpdatePositionsOfAnchoredElements();
00144 }
00145
00146 #ifdef DBG
00147 void AnnotatedScrollBar::OnLoaded(const winrt::IInspectable& sender, const winrt::RoutedEventArgs& args)
00148 {
00149     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00150 }
00151 #endif
00152
00153 void AnnotatedScrollBar::OnIsEnabledChanged(const winrt::IInspectable& sender, const winrt::DependencyPropertyChangedEventArgs& args)
00154 {
00155     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00156
00157     if (!IsEnabled())
00158     {
00159         m_isPressed = false;
00160         m_isPointerOver = false;
00161
00162         if (m_capturedPointer)
00163         {
00164             if (auto verticalGrid = m_verticalGrid.get())
00165             {
00166                 verticalGrid.ReleasePointerCapture(m_capturedPointer);
00167                 m_capturedPointer = nullptr;
00168             }
00169         }
00170         ResetTrackedPointerId();
00171     }
00172     UpdateCanScroll();
00173 }
00174
00175 void AnnotatedScrollBar::OnLabelsCollectionChanged(const winrt::IInspectable&, const winrt::IInspectable&)
00176 {
00177     if (auto labelsGrid = m_labelsGrid.get())
00178     {
00179         labelsGrid.Children().Clear();
00180     }
00181     m_labelSizes.clear();
00182     QueueLayoutLabels(50 /*millisecondWait*/);
00183 }
00184
00185 void AnnotatedScrollBar::OnApplyTemplate()
00186 {
00187     UnhookHandlers(false /*isFromDestructor*/);
00188
00189     __super::OnApplyTemplate();
00190
00191     winrt::IControlProtected controlProtected = *this;
00192
00193     m_verticalThumb.set(GetTemplateChildT<winrt::Border>(s_verticalThumbPartName, controlProtected));
00194     m_verticalThumbGhost.set(GetTemplateChildT<winrt::Border>(s_verticalThumbGhostPartName, controlProtected));
00195     m_verticalDecrementRepeatButton.set(GetTemplateChildT<winrt::RepeatButton>(s_verticalDecrementRepeatButtonPartName, controlProtected));
00196     m_verticalIncrementRepeatButton.set(GetTemplateChildT<winrt::RepeatButton>(s_verticalIncrementRepeatButtonPartName, controlProtected));
00197     m_verticalGrid.set(GetTemplateChildT<winrt::Grid>(s_verticalGridPartName, controlProtected));
00198     m_labelsGrid.set(GetTemplateChildT<winrt::Grid>(s_labelsGridPartName, controlProtected));
00199     m_tooltipContentPresenter.set(GetTemplateChildT<winrt::ContentPresenter>(s_tooltipContentPresenterPartName, controlProtected));
00200     m_detailLabelToolTip.set(GetTemplateChildT<winrt::ToolTip>(s_detailLabelToolTipPartName, controlProtected));
00201
00202     SetUpInteractionElements();
00203     HookInputEvents();
00204 }
00205
00206 void AnnotatedScrollBar::UnhookHandlers(bool isFromDestructor)
00207 {
00208     m_verticalGridPointerEnteredRevoker.revoke();
00209     m_verticalGridPointerMovedRevoker.revoke();
00210     m_verticalGridPointerExitedRevoker.revoke();
00211     m_verticalGridPointerPressedRevoker.revoke();
00212     m_verticalGridPointerReleasedRevoker.revoke();
00213     m_verticalGridPointerCanceledRevoker.revoke();
00214     m_verticalGridPointerCaptureLostRevoker.revoke();
00215     m_verticalIncrementRepeatButtonClickRevoker.revoke();
00216     m_verticalDecrementRepeatButtonClickRevoker.revoke();
00217     m_detailLabelToolTipOpenedRevoker.revoke();
00218
00219     if (isFromDestructor)
00220     {
00221         m_sizeChangedRevoker.revoke();
00222 #ifdef DBG
00223         m_loadedRevoker.revoke();
00224 #endif
00225         m_isEnabledRevoker.revoke();
00226         m_labelsVectorChangedRevoker.revoke();
00227     }
00228 }
00229
00230  void AnnotatedScrollBar::HookInputEvents()
00231 {
00232     if (auto const verticalGrid = m_verticalGrid.get())
00233     {
00234         m_verticalGridPointerEnteredRevoker = verticalGrid.PointerEntered(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnVerticalGridPointerEntered });
00235         m_verticalGridPointerMovedRevoker = verticalGrid.PointerMoved(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnVerticalGridPointerMoved });
00236         m_verticalGridPointerPressedRevoker = verticalGrid.PointerPressed(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnVerticalGridPointerPressed });
00237
00238         m_verticalGridPointerExitedRevoker = AddRoutedEventHandler<RoutedEventType::PointerExited>(
00239         *this,
00240         { this, &AnnotatedScrollBar::OnVerticalGridPointerExited },
00241         true /*handledEventsToo*/);
00242         m_verticalGridPointerReleasedRevoker = AddRoutedEventHandler<RoutedEventType::PointerReleased>(
00243         *this,
00244         { this, &AnnotatedScrollBar::OnVerticalGridPointerReleased },
00245         true /*handledEventsToo*/);
00246         m_verticalGridPointerCanceledRevoker = AddRoutedEventHandler<RoutedEventType::PointerCanceled>(
00247         *this,
00248         { this, &AnnotatedScrollBar::OnVerticalGridPointerCanceled },
00249         true /*handledEventsToo*/);
00250         m_verticalGridPointerCaptureLostRevoker = AddRoutedEventHandler<RoutedEventType::PointerCaptureLost>(
00251         *this,
00252         { this, &AnnotatedScrollBar::OnVerticalGridPointerCaptureLost },
00253         true /*handledEventsToo*/);
00254     }
00255
00256     if (auto detailLabelToolTip = m_detailLabelToolTip.get())
00257     {
00258         m_detailLabelToolTipOpenedRevoker = detailLabelToolTip.Opened(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnDetailLabelToolTipOpened });
00259     }
00260 }
00261
00262 void AnnotatedScrollBar::SetUpInteractionElements()
00263 {
00264     if (auto verticalIncrementRepeatButton = m_verticalIncrementRepeatButton.get())
00265     {
00266         m_verticalIncrementRepeatButtonClickRevoker = verticalIncrementRepeatButton.Click(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnIncrementRepeatButtonClick });
00267     }
00268
00269     if (auto verticalDecrementRepeatButton = m_verticalDecrementRepeatButton.get())
00270     {
00271         m_verticalDecrementRepeatButtonClickRevoker = verticalDecrementRepeatButton.Click(winrt::auto_revoke, { this, &AnnotatedScrollBar::OnDecrementRepeatButtonClick });
00272     }
00273
00274     EnsurePanningInfo();
00275
00276     m_panningInfo.get()->PanningFrameworkElement(m_verticalThumb.get());
00277     m_panningInfo.get()->PanningElementAncestor(m_verticalGrid.get());
00278 }
00279
00280 // This function updates components that rely on Minimum, Maximum, ViewportSize & LabelsGrid.
00281 void AnnotatedScrollBar::UpdatePositionsOfAnchoredElements()
00282 {
00283     ANNOTATEDSCROLLBAR_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00284
00285     // Run the math for the mapping factor again
00286     UpdateScrollOffsetToLabelOffsetFactor();
00287
00288     // Update thumb animation multiplier
00289     EnsurePanningInfo();
00290
00291     m_panningInfo.get()->PanningElementOffsetMultiplier(static_cast<float>(-1.0 / m_scrollOffsetToLabelOffsetFactor));
00292
00293     QueueLayoutLabels(500 /*millisecondWait*/);
00294 }
00295
00296 void AnnotatedScrollBar::QueueLayoutLabels(unsigned int millisecondWait)
00297 {
00298     ANNOTATEDSCROLLBAR_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00299
00300     if (!m_labelsDebounce.test_and_set())
00301     {
00302         auto weakThis = get_weak();
00303         auto runLayoutLabelsAction = [weakThis]()
00304         {
00305             if (winrt::WindowsXamlManager::GetForCurrentThread() == nullptr)
00306             {
00307                 // Exit early if Xaml core has already shut down.
00308                 return;
00309             }
00310
00311             if (auto strongThis = weakThis.get())
00312             {
00313                 strongThis->m_labelsDebounce.clear();
00314                 strongThis->LayoutLabels();
00315             }
00316         };
00317
00318         SharedHelpers::ScheduleActionAfterWait(runLayoutLabelsAction, millisecondWait);
00319     }
00320 }
00321
00322 void AnnotatedScrollBar::LayoutLabels()
00323 {
00324     auto labelsGrid = m_labelsGrid.safe_get();
00325     if (!labelsGrid)
00326     {
00327         return;
00328     }
00329
00330     if (labelsGrid.Children().Size() == 0)
00331     {
00332         CreateLabelContainers();
00333     }
00334     else
00335     {
00336         UpdateLabelContainersOffsets();
00337     }
00338
00339     CollapseCollidingAndOutOfBoundsLabels();
00340 }
00341
00342 void AnnotatedScrollBar::CreateLabelContainers()
00343 {
00344     auto labelsGrid = m_labelsGrid.get();
00345     MUX_ASSERT(labelsGrid);
00346     MUX_ASSERT(m_labelSizes.size() == 0);
00347
00348     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00349
00350     for (auto label : Labels())
00351     {
00352         auto labelContentPresenter = winrt::ContentPresenter();
00353         labelContentPresenter.HorizontalAlignment(winrt::HorizontalAlignment::Right);
00354         labelContentPresenter.Content(label);
00355
00356         if (auto dataElementFactory = LabelTemplate())
00357         {
00358             if (auto dataTemplate = dataElementFactory.try_as<winrt::DataTemplate>())
00359             {
00360                 labelContentPresenter.ContentTemplate(dataTemplate);
00361             }
00362             else if (auto dataTemplateSelector = dataElementFactory.try_as<winrt::DataTemplateSelector>())
00363             {
00364                 labelContentPresenter.ContentTemplateSelector(dataTemplateSelector);
00365             }
00366         }
00367
00368         float const labelHeight = LayoutUtils::MeasureAndGetDesiredHeightFor(labelContentPresenter, c_infSize);
00369         m_labelSizes.push_back(labelHeight);
00370
00371         auto const labelVerticalOffset = GetLabelVerticalOffset(label);
00372         labelContentPresenter.Margin({ 0,labelVerticalOffset,0,0 });
00373         labelsGrid.Children().Append(labelContentPresenter);
00374     }
00375 }
00376
00377 void AnnotatedScrollBar::UpdateLabelContainersOffsets()
00378 {
00379     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00380
00381     auto labelsGrid = m_labelsGrid.get();
00382     MUX_ASSERT(labelsGrid);
00383
00384     for (auto const labelContainer : labelsGrid.Children())
00385     {
00386         auto const labelContentPresenter = labelContainer.as<winrt::ContentPresenter>();
00387         auto const label = labelContentPresenter.Content().as<winrt::AnnotatedScrollBarLabel>();
00388         auto const labelVerticalOffset = GetLabelVerticalOffset(label);
00389         labelContentPresenter.Margin({ 0,labelVerticalOffset,0,0 });
00390     }
00391 }
00392
00393 void AnnotatedScrollBar::CollapseCollidingAndOutOfBoundsLabels()
00394 {
00395     auto const labelsGrid = m_labelsGrid.get();
00396     MUX_ASSERT(labelsGrid);
00397
00398     auto const labelsGridHeight = labelsGrid.ActualSize().y;
00399     auto const labelsSize = Labels().Size();
00400     if (labelsSize == 0 ||
00401         labelsGridHeight == 0)
00402     {
00403         return;
00404     }
00405
00406     MUX_ASSERT(labelsSize == labelsGrid.Children().Size());
00407     MUX_ASSERT(labelsSize == m_labelSizes.size());
00408
00409     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00410
00411     // Collapse colliding or out of bounds labels
00412     double previousLabelTopPosition = -1;
00413     int previousLabelIndex = (int)labelsGrid.Children().Size();
00414     for (int currentLabelIndex = previousLabelIndex - 1; currentLabelIndex >= 0; currentLabelIndex--)
00415     {
00416        auto const currentLabel = labelsGrid.Children().GetAt(currentLabelIndex).as<winrt::FrameworkElement>();
00417        auto const currentLabelTopPosition = currentLabel.Margin().Top;
00418        double const currentLabelBottomPosition = currentLabelTopPosition + m_labelSizes[currentLabelIndex];
00419
00420        auto const isLabelOutOfBounds = currentLabelTopPosition < 0 ||
00421                                        currentLabelBottomPosition > labelsGridHeight;
00422
00423        auto const isLabelColliding = previousLabelTopPosition >= 0 &&
00424                                      previousLabelTopPosition <= currentLabelBottomPosition;
00425
00426        if (isLabelOutOfBounds)
00427        {
00428            currentLabel.Visibility(winrt::Visibility::Collapsed);
00429        }
00430        else if (isLabelColliding)
00431        {
00432            // The bottom item displayed should always stay shown in any collision.
00433            // The first item should also be always displayed with an exception
00434            // in the case that it is colliding with the last item.
00435            int indexToCollapse = currentLabelIndex;
00436            if (currentLabelIndex == 0 &&
00437                previousLabelIndex < (int)labelsGrid.Children().Size() - 1)
00438            {
00439                indexToCollapse = previousLabelIndex;
00440            }
00441
00442            auto const labelToCollapse = labelsGrid.Children().GetAt(indexToCollapse).as<winrt::FrameworkElement>();
00443            labelToCollapse.Visibility(winrt::Visibility::Collapsed);
00444        }
00445        else
00446        {
00447            currentLabel.Visibility(winrt::Visibility::Visible);
00448            previousLabelTopPosition = currentLabelTopPosition;
00449            previousLabelIndex = currentLabelIndex;
00450        }
00451     }
00452 }
00453
00454 double AnnotatedScrollBar::GetLabelVerticalOffset(winrt::AnnotatedScrollBarLabel label)
00455 {
00456     return label.ScrollOffset() * m_scrollOffsetToLabelOffsetFactor;
00457 }
00458
00459 void AnnotatedScrollBar::UpdateScrollOffsetToLabelOffsetFactor()
00460 {
00461     double scrollOffsetToLabelOffsetFactor = 1;
00462     auto labelsGrid = m_labelsGrid.get();
00463     auto interactionFrameworkElement = m_verticalThumb.get();
00464
00465     if (labelsGrid && interactionFrameworkElement)
00466     {
00467         double scrollViewScrollableHeight = Maximum() - Minimum();
00468         scrollViewScrollableHeight = scrollViewScrollableHeight == 0 ? 1 : scrollViewScrollableHeight;
00469         scrollOffsetToLabelOffsetFactor = (labelsGrid.ActualHeight() - interactionFrameworkElement.ActualHeight()) / scrollViewScrollableHeight * (1 - ViewportSize() / (ViewportSize() + scrollViewScrollableHeight));
00470     }
00471     m_scrollOffsetToLabelOffsetFactor = scrollOffsetToLabelOffsetFactor;
00472 }
00473
00474 void AnnotatedScrollBar::EnsurePanningInfo()
00475 {
00476     if (!m_panningInfo)
00477     {
00478         m_panningInfo.set(winrt::make_self<AnnotatedScrollBarPanningInfo>());
00479     }
00480 }
00481
00482 void AnnotatedScrollBar::EnsureSmallChangeValue()
00483 {
00484     if (SmallChange() == 0.0)
00485     {
00486        SmallChange(ViewportSize()/s_defaultViewportToSmallChangeRatio);
00487     }
00488 }
00489
00490 void AnnotatedScrollBar::SetThumbGhostVisibility(winrt::Visibility visibility)
00491 {
00492     if (auto verticalThumbGhost = m_verticalThumbGhost.get())
00493     {
00494         verticalThumbGhost.Visibility(visibility);
00495     }
00496 }
00497
00498 void AnnotatedScrollBar::ShowHoverVisuals(double offsetFromTopToolTip, double offsetFromTopThumbGhost)
00499 {
00500     ShowToolTipAtOffset(offsetFromTopToolTip);
00501     ShowThumbGhostAtOffset(offsetFromTopThumbGhost);
00502 }
00503
00504 void AnnotatedScrollBar::HideHoverVisuals()
00505 {
00506     SetToolTipIsOpen(false);
00507     SetThumbGhostVisibility(winrt::Visibility::Collapsed);
00508 }
00509
00510 void AnnotatedScrollBar::SetToolTipIsOpen(bool isOpen)
00511 {
00512     if (!m_detailLabelRequestedEventSource)
00513     {
00514         return;
00515     }
00516
00517     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00518
00519     if (auto detailLabelToolTip = m_detailLabelToolTip.get())
00520     {
00521         detailLabelToolTip.IsOpen(isOpen);
00522     }
00523 }
00524
00525 void AnnotatedScrollBar::ShowToolTipAtOffset(double offsetFromTop)
00526 {
00527     auto data = RaiseDetailLabelRequested(offsetFromTop);
00528
00529     auto detailLabelToolTip = m_detailLabelToolTip.get();
00530     auto tooltipContentPresenter = m_tooltipContentPresenter.get();
00531     if (data &&
00532         detailLabelToolTip &&
00533         tooltipContentPresenter)
00534     {
00535         tooltipContentPresenter.Content(data);
00536
00537         if (!m_detailLabelTemplateApplied ||
00538             (!tooltipContentPresenter.ContentTemplate() && !tooltipContentPresenter.ContentTemplateSelector()))
00539         {
00540             if (auto dataElementFactory = DetailLabelTemplate())
00541             {
00542                 if (auto dataTemplate = dataElementFactory.try_as<winrt::DataTemplate>())
00543                 {
00544                     tooltipContentPresenter.ContentTemplateSelector(nullptr);
00545                     tooltipContentPresenter.ContentTemplate(dataTemplate);
00546                     m_detailLabelTemplateApplied = true;
00547                 }
00548                 else if (auto dataTemplateSelector = dataElementFactory.try_as<winrt::DataTemplateSelector>())
00549                 {
00550                     tooltipContentPresenter.ContentTemplate(nullptr);
00551                     tooltipContentPresenter.ContentTemplateSelector(dataTemplateSelector);
00552                     m_detailLabelTemplateApplied = true;
00553                 }
00554             }
00555         }
00556
00557         auto const detailLabelToolTipWidth = LayoutUtils::MeasureAndGetDesiredWidthFor(tooltipContentPresenter, c_infSize);
00558         // +2 extra pixels to offset the tooltip border for proper alignment
00559         auto const horizontalPosition = static_cast<float>((-1*detailLabelToolTipWidth/2) + 2);
00560         const winrt::Rect placementRect(horizontalPosition,
00561                                         static_cast<float>(offsetFromTop),
00562                                         0,
00563                                         0);
00564         detailLabelToolTip.PlacementRect(placementRect);
00565         SetToolTipIsOpen(true);
00566     }
00567 }
00568
00569 void AnnotatedScrollBar::ShowThumbGhostAtOffset(double offsetFromTop)
00570 {
00571     if (auto verticalThumbGhost = m_verticalThumbGhost.get())
00572     {
00573         verticalThumbGhost.Margin({verticalThumbGhost.Margin().Left,
00574                                     offsetFromTop,
00575                                     verticalThumbGhost.Margin().Right,
00576                                     verticalThumbGhost.Margin().Bottom});
00577         SetThumbGhostVisibility(winrt::Visibility::Visible);
00578     }
00579 }
00580
00581 void AnnotatedScrollBar::UpdateCanScroll()
00582 {
00583     const bool oldCanScroll = m_canScroll;
00584
00585     m_canScroll = m_isScrollable && IsEnabled();
00586
00587     if (oldCanScroll != m_canScroll)
00588     {
00589         RaiseCanScrollChanged();
00590     }
00591 }
00592
00593 void AnnotatedScrollBar::OnDetailLabelToolTipOpened(const winrt::IInspectable& sender,  const winrt::RoutedEventArgs& args)
00594 {
00595     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00596     // Circumvent tooltip opening after hover delay when it is not in use
00597     if (!m_detailLabelRequestedEventSource)
00598     {
00599         SetToolTipIsOpen(false);
00600     }
00601 }
00602
00603 void AnnotatedScrollBar::OnIncrementRepeatButtonClick(const winrt::IInspectable& sender,  const winrt::RoutedEventArgs& args)
00604 {
00605     // We pass in 0 for offset here because it is determined in ScrollTo()
00606     ScrollTo(0, winrt::AnnotatedScrollBarScrollingEventKind::IncrementButton);
00607 }
00608
00609 void AnnotatedScrollBar::OnDecrementRepeatButtonClick(const winrt::IInspectable& sender,  const winrt::RoutedEventArgs& args)
00610 {
00611     // We pass in 0 for offset here because it is determined in ScrollTo()
00612     ScrollTo(0, winrt::AnnotatedScrollBarScrollingEventKind::DecrementButton);
00613 }
00614
00615 void AnnotatedScrollBar::ResetTrackedPointerId()
00616 {
00617     m_verticalGridTrackedPointerId = 0;
00618 }
00619
00620 bool AnnotatedScrollBar::IgnorePointerId(const winrt::PointerRoutedEventArgs& args)
00621 {
00622     uint32_t pointerId = args.Pointer().PointerId();
00623
00624     if (m_verticalGridTrackedPointerId == 0)
00625     {
00626         m_verticalGridTrackedPointerId = pointerId;
00627     }
00628     else if (m_verticalGridTrackedPointerId != pointerId)
00629     {
00630         return true;
00631     }
00632     return false;
00633 }
00634
00635 void AnnotatedScrollBar::OnVerticalGridPointerEntered(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00636 {
00637     if (IgnorePointerId(args))
00638     {
00639         return;
00640     }
00641
00642     m_isPointerOver = true;
00643
00644     MUX_ASSERT(m_verticalGrid.get() != nullptr);
00645
00646     const auto offsetFromTop = args.GetCurrentPoint(m_verticalGrid.get()).Position().Y;
00647     auto offsetFromTopToolTip = offsetFromTop;
00648     const auto offsetFromTopThumbGhost = offsetFromTop;
00649
00650     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH_DBL, METH_NAME, this, offsetFromTop);
00651
00652     auto const& pointerDeviceType = args.Pointer().PointerDeviceType();
00653     if (pointerDeviceType == winrt::PointerDeviceType::Touch)
00654     {
00655         offsetFromTopToolTip -= s_toolTipTouchOffset;
00656     }
00657
00658     ShowHoverVisuals(offsetFromTopToolTip, offsetFromTopThumbGhost);
00659 }
00660
00661 void AnnotatedScrollBar::OnVerticalGridPointerMoved(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00662 {
00663     if (IgnorePointerId(args))
00664     {
00665         return;
00666     }
00667
00668     m_isPointerOver = true;
00669
00670     auto verticalGrid = m_verticalGrid.get();
00671     MUX_ASSERT(verticalGrid != nullptr);
00672
00673     auto offsetFromTop = args.GetCurrentPoint(verticalGrid).Position().Y;
00674
00675     offsetFromTop = std::max(0.0f, offsetFromTop);
00676     offsetFromTop = std::min((float)verticalGrid.ActualHeight(), offsetFromTop);
00677
00678     auto offsetFromTopToolTip = offsetFromTop;
00679     const auto offsetFromTopThumbGhost = offsetFromTop;
00680
00681     ANNOTATEDSCROLLBAR_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL, METH_NAME, this, offsetFromTop);
00682
00683     // If pointer hasn't moved we do nothing
00684     auto detailLabelToolTip = m_detailLabelToolTip.get();
00685     if (detailLabelToolTip && detailLabelToolTip.IsOpen())
00686     {
00687          if (offsetFromTop == m_lastVerticalGridPointerMovedOffset)
00688          {
00689              return;
00690          }
00691     }
00692     m_lastVerticalGridPointerMovedOffset = offsetFromTop;
00693
00694     auto const& pointerDeviceType = args.Pointer().PointerDeviceType();
00695     if (pointerDeviceType == winrt::PointerDeviceType::Touch)
00696     {
00697         offsetFromTopToolTip -= s_toolTipTouchOffset;
00698     }
00699
00700     ShowHoverVisuals(offsetFromTopToolTip, offsetFromTopThumbGhost);
00701
00702     if (m_isPressed || m_capturedPointer)
00703     {
00704         double const newScrollOffset = offsetFromTop / m_scrollOffsetToLabelOffsetFactor;
00705         ScrollTo(newScrollOffset, winrt::AnnotatedScrollBarScrollingEventKind::Drag);
00706     }
00707 }
00708
00709 void AnnotatedScrollBar::OnVerticalGridPointerExited(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00710 {
00711     if (IgnorePointerId(args))
00712     {
00713         return;
00714     }
00715
00716     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00717
00718     const bool isTouch = args.Pointer().PointerDeviceType() == winrt::PointerDeviceType::Touch;
00719     if (isTouch && !m_capturedPointer)
00720     {
00721         // The hiding of elements for non-mouse input events is handled in OnVerticalGridPointerReleased.
00722         // The PointerReleased and PointerExited events can happen in any order so we need to make sure to reset the tracked pointer id here as well.
00723         ResetTrackedPointerId();
00724     }
00725     if (IsOutOfVerticalGridBounds(args.GetCurrentPoint(m_verticalGrid.get()).Position()) && !isTouch)
00726     {
00727         // We do the vertical bounds check because PointerExited can sometimes happen when the mouse has hovered over the open tooltip.
00728         // In these cases we need to test if the pointer is over the vertical grid to maintain the proper state.
00729         m_isPressed = false;
00730         m_isPointerOver = false;
00731
00732         if (!m_capturedPointer)
00733         {
00734             ResetTrackedPointerId();
00735         }
00736
00737         HideHoverVisuals();
00738     }
00739 }
00740
00741 void AnnotatedScrollBar::OnVerticalGridPointerPressed(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00742 {
00743     if (IgnorePointerId(args))
00744     {
00745         return;
00746     }
00747
00748     m_isPressed = true;
00749
00750     const double newScrollOffset = args.GetCurrentPoint(m_verticalGrid.get()).Position().Y / m_scrollOffsetToLabelOffsetFactor;
00751
00752     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH_DBL, METH_NAME, this, newScrollOffset);
00753
00754     ScrollTo(newScrollOffset, winrt::AnnotatedScrollBarScrollingEventKind::Click);
00755
00756     auto pointer = args.Pointer();
00757     if (auto verticalGrid = m_verticalGrid.get())
00758     {
00759         if (verticalGrid.CapturePointer(pointer))
00760         {
00761             m_capturedPointer = pointer;
00762         }
00763     }
00764
00765     switch (pointer.PointerDeviceType())
00766     {
00767         case winrt::PointerDeviceType::Touch:
00768         case winrt::PointerDeviceType::Pen:
00769         {
00770             if (m_panningInfo)
00771             {
00772                 // Attempt an UI-thread-independent pan.
00773                 //TODO as part of bug fix 45076500. Start an independent pan.
00774                 //m_panningInfo.get()->RaisePanRequested(args.GetCurrentPoint(nullptr));
00775             }
00776             break;
00777         }
00778         case winrt::PointerDeviceType::Mouse:
00779         {
00780             if (!m_isScrollingWithMouse)
00781             {
00782                 m_isScrollingWithMouse = true;
00783                 RaiseIsScrollingWithMouseChanged();
00784             }
00785             break;
00786         }
00787     }
00788 }
00789
00790 void AnnotatedScrollBar::OnVerticalGridPointerReleased(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00791 {
00792     if (IgnorePointerId(args))
00793     {
00794         return;
00795     }
00796
00797     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00798
00799     m_isPressed = false;
00800     auto verticalGrid = m_verticalGrid.get();
00801
00802     if (m_capturedPointer && verticalGrid)
00803     {
00804         verticalGrid.ReleasePointerCapture(m_capturedPointer);
00805         m_capturedPointer = nullptr;
00806
00807         // OnVerticalGridPointerCaptureLost does not get called in the case of Touch.
00808         // In that case we want to make sure to hide the required elements here.
00809         auto const& pointerDeviceType = args.Pointer().PointerDeviceType();
00810
00811         switch (pointerDeviceType)
00812         {
00813             case winrt::PointerDeviceType::Touch:
00814             {
00815                 m_isPointerOver = false;
00816                 HideHoverVisuals();
00817                 ResetTrackedPointerId();
00818                 break;
00819             }
00820             case winrt::PointerDeviceType::Mouse:
00821             {
00822                 if (m_isScrollingWithMouse)
00823                 {
00824                     m_isScrollingWithMouse = false;
00825                     RaiseIsScrollingWithMouseChanged();
00826                 }
00827                 break;
00828             }
00829         }
00830     }
00831 }
00832
00833 void AnnotatedScrollBar::OnVerticalGridPointerCanceled(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00834 {
00835     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00836
00837     ProcessVerticalGridPointerCanceled(args);
00838 }
00839
00840 void AnnotatedScrollBar::OnVerticalGridPointerCaptureLost(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00841 {
00842     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00843
00844     ProcessVerticalGridPointerCanceled(args);
00845 }
00846
00847 void AnnotatedScrollBar::ProcessVerticalGridPointerCanceled(const winrt::PointerRoutedEventArgs& args)
00848 {
00849     if (IgnorePointerId(args))
00850     {
00851         return;
00852     }
00853
00854     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00855
00856     m_isPressed = false;
00857     // We do this check because PointerCaptureLost can sometimes take the place of PointerReleased events.
00858     // In these cases we need to test if the pointer is over the vertical grid to maintain the proper state.
00859     if (IsOutOfVerticalGridBounds(args.GetCurrentPoint(m_verticalGrid.get()).Position()))
00860     {
00861         m_isPointerOver = false;
00862         HideHoverVisuals();
00863     }
00864
00865     if (m_isScrollingWithMouse && args.Pointer().PointerDeviceType() == winrt::PointerDeviceType::Mouse)
00866     {
00867         m_isScrollingWithMouse = false;
00868         RaiseIsScrollingWithMouseChanged();
00869     }
00870
00871     m_capturedPointer = nullptr;
00872     ResetTrackedPointerId();
00873 }
00874
00875 bool AnnotatedScrollBar::IsOutOfVerticalGridBounds(const winrt::Point& point) {
00876
00877     if (auto verticalGrid = m_verticalGrid.get())
00878     {
00879         // This is a conservative check. It is okay to say we are
00880         // out of the bounds when close to the edge to account for rounding.
00881         const auto tolerance = 1.0;
00882         const auto actualWidth = verticalGrid.ActualWidth();
00883         const auto actualHeight = verticalGrid.ActualHeight();
00884         return point.X < tolerance ||
00885             point.X > actualWidth - tolerance ||
00886             point.Y < tolerance ||
00887             point.Y > actualHeight - tolerance;
00888     }
00889     return true;
00890 }
00891
00892 void AnnotatedScrollBar::ScrollTo(double offset, winrt::AnnotatedScrollBarScrollingEventKind scrollingEventKind)
00893 {
00894     ANNOTATEDSCROLLBAR_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL_INT, METH_NAME, this, offset, scrollingEventKind);
00895
00896     auto scrollOffset = offset;
00897     // In the case of increment buttons, calculate the new offset
00898     double changeAmount = 0;
00899
00900     switch (scrollingEventKind)
00901     {
00902         case winrt::AnnotatedScrollBarScrollingEventKind::IncrementButton:
00903         {
00904             EnsureSmallChangeValue();
00905             changeAmount = -1 * SmallChange();
00906             scrollOffset = Value() + changeAmount;
00907             scrollOffset = std::max(scrollOffset, Minimum());
00908             break;
00909         }
00910         case winrt::AnnotatedScrollBarScrollingEventKind::DecrementButton:
00911         {
00912             EnsureSmallChangeValue();
00913             changeAmount = SmallChange();
00914             scrollOffset = Value() + changeAmount;
00915             scrollOffset = std::min(scrollOffset, Maximum());
00916             break;
00917         }
00918     }
00919
00920     if (RaiseScrolling(scrollOffset, scrollingEventKind))
00921     {
00922         return;
00923     }
00924
00925     switch (scrollingEventKind)
00926     {
00927         case winrt::AnnotatedScrollBarScrollingEventKind::Click:
00928         {
00929             RaiseScrollToRequested(scrollOffset);
00930             break;
00931         }
00932         case winrt::AnnotatedScrollBarScrollingEventKind::Drag:
00933         {
00934             // TODO as part of bug fix 45076500.
00935             // RaiseScrollToRequested must not be called during a touch-driven independent pan.
00936             //if (m_isScrollingWithMouse)
00937             {
00938                 RaiseScrollToRequested(scrollOffset);
00939             }
00940             break;
00941         }
00942         case winrt::AnnotatedScrollBarScrollingEventKind::IncrementButton:
00943         case winrt::AnnotatedScrollBarScrollingEventKind::DecrementButton:
00944         {
00945             if (SharedHelpers::IsAnimationsEnabled())
00946             {
00947                 RaiseAddScrollVelocityRequested(changeAmount);
00948             }
00949             else
00950             {
00951                 RaiseScrollByRequested(changeAmount);
00952             }
00953             break;
00954         }
00955     }
00956 }
00957
00958 bool AnnotatedScrollBar::RaiseScrolling(double offset, winrt::AnnotatedScrollBarScrollingEventKind scrollingEventKind)
00959 {
00960     ANNOTATEDSCROLLBAR_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL_INT, METH_NAME, this, offset, scrollingEventKind);
00961
00962     if (!m_scrollingEventSource)
00963     {
00964         return false;
00965     }
00966
00967     auto scrollingEventArgs = winrt::make_self<AnnotatedScrollBarScrollingEventArgs>(offset, scrollingEventKind);
00968
00969     m_scrollingEventSource(*this, *scrollingEventArgs);
00970
00971     return scrollingEventArgs.as<winrt::AnnotatedScrollBarScrollingEventArgs>().Cancel();
00972 }
00973
00974 winrt::IInspectable AnnotatedScrollBar::RaiseDetailLabelRequested(double offsetFromTop)
00975 {
00976     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH_DBL, METH_NAME, this, offsetFromTop);
00977
00978     if (!m_detailLabelRequestedEventSource)
00979     {
00980         return nullptr;
00981     }
00982
00983     const auto value = std::min(offsetFromTop / m_scrollOffsetToLabelOffsetFactor, Maximum() + ViewportSize());
00984     auto detailLabelRequestedEventArgs = winrt::make_self<AnnotatedScrollBarDetailLabelRequestedEventArgs>(value);
00985
00986     m_detailLabelRequestedEventSource(*this, *detailLabelRequestedEventArgs);
00987     return detailLabelRequestedEventArgs.as<winrt::AnnotatedScrollBarDetailLabelRequestedEventArgs>().Content();
00988 }
00989
00990 void AnnotatedScrollBar::RaiseCanScrollChanged()
00991 {
00992     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00993
00994     if (!m_canScrollChanged)
00995     {
00996         return;
00997     }
00998
00999     m_canScrollChanged(*this, nullptr);
01000 }
01001
01002 void AnnotatedScrollBar::RaiseIsScrollingWithMouseChanged()
01003 {
01004     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01005
01006     if (!m_isScrollingWithMouseChanged)
01007     {
01008         return;
01009     }
01010
01011     m_isScrollingWithMouseChanged(*this, nullptr);
01012 }
01013
01014 void AnnotatedScrollBar::RaiseScrollToRequested(double offset)
01015 {
01016     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH_DBL, METH_NAME, this, offset);
01017
01018     if (!m_scrollToRequested)
01019     {
01020         return;
01021     }
01022
01023     auto options = winrt::make_self<ScrollingScrollOptions>(
01024         winrt::ScrollingAnimationMode::Disabled,
01025         winrt::ScrollingSnapPointsMode::Ignore);
01026
01027     auto scrollToRequestedEventArgs = winrt::make_self<ScrollControllerScrollToRequestedEventArgs>(
01028         offset,
01029         *options);
01030
01031     m_scrollToRequested(*this, *scrollToRequestedEventArgs);
01032
01033     int32_t offsetChangeCorrelationId = scrollToRequestedEventArgs.as<winrt::ScrollControllerScrollToRequestedEventArgs>().CorrelationId();
01034
01035     // Only increment m_operationsCount when the returned OffsetsChangeCorrelationId represents a new request that was not coalesced with a pending request.
01036     if (offsetChangeCorrelationId != -1 && offsetChangeCorrelationId != m_lastOffsetChangeCorrelationIdForScrollTo)
01037     {
01038         m_lastOffsetChangeCorrelationIdForScrollTo = offsetChangeCorrelationId;
01039         m_operationsCount++;
01040     }
01041 }
01042
01043 void AnnotatedScrollBar::RaiseScrollByRequested(double offsetDelta)
01044 {
01045     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH_DBL, METH_NAME, this, offsetDelta);
01046
01047     if (!m_scrollByRequested)
01048     {
01049         return;
01050     }
01051
01052     auto options = winrt::make_self<ScrollingScrollOptions>(
01053         winrt::ScrollingAnimationMode::Disabled,
01054         winrt::ScrollingSnapPointsMode::Ignore);
01055
01056     auto scrollByRequestedEventArgs = winrt::make_self<ScrollControllerScrollByRequestedEventArgs>(
01057         offsetDelta,
01058         *options);
01059
01060     m_scrollByRequested(*this, *scrollByRequestedEventArgs);
01061
01062     int32_t offsetChangeCorrelationId = scrollByRequestedEventArgs.as<winrt::ScrollControllerScrollByRequestedEventArgs>().CorrelationId();
01063
01064     // Only increment m_operationsCount when the returned OffsetsChangeCorrelationId represents a new request that was not coalesced with a pending request.
01065     if (offsetChangeCorrelationId != -1 && offsetChangeCorrelationId != m_lastOffsetChangeCorrelationIdForScrollBy)
01066     {
01067         m_lastOffsetChangeCorrelationIdForScrollBy = offsetChangeCorrelationId;
01068         m_operationsCount++;
01069     }
01070 }
01071
01072 void AnnotatedScrollBar::RaiseAddScrollVelocityRequested(double offsetDelta)
01073 {
01074     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH_DBL, METH_NAME, this, offsetDelta);
01075
01076     if (!m_addScrollVelocityRequested)
01077     {
01078         return;
01079     }
01080
01081     double const offsetVelocity = offsetDelta * s_velocityNeededPerPixel;
01082
01083     auto addScrollVelocityRequestedEventArgs = winrt::make_self<ScrollControllerAddScrollVelocityRequestedEventArgs>(
01084         static_cast<float>(offsetVelocity),
01085         s_smallChangeInertiaDecayRate);
01086
01087     m_addScrollVelocityRequested(*this, *addScrollVelocityRequestedEventArgs);
01088
01089     int32_t offsetChangeCorrelationId = addScrollVelocityRequestedEventArgs.as<winrt::ScrollControllerAddScrollVelocityRequestedEventArgs>().CorrelationId();
01090
01091     // Only increment m_operationsCount when the returned OffsetsChangeCorrelationId represents a new request that was not coalesced with a pending request.
01092     if (offsetChangeCorrelationId != -1 && offsetChangeCorrelationId != m_lastOffsetChangeCorrelationIdForAddScrollVelocity)
01093     {
01094         m_lastOffsetChangeCorrelationIdForAddScrollVelocity = offsetChangeCorrelationId;
01095         m_operationsCount++;
01096     }
01097 }
01098
01099
01100 #pragma region IScrollController
01101
01102 winrt::IScrollControllerPanningInfo AnnotatedScrollBar::PanningInfo()
01103 {
01104     EnsurePanningInfo();
01105
01106     return m_panningInfo.try_as<winrt::IScrollControllerPanningInfo>();
01107 }
01108
01109 bool AnnotatedScrollBar::CanScroll()
01110 {
01111     return m_canScroll;
01112 }
01113
01114 bool AnnotatedScrollBar::IsScrollingWithMouse()
01115 {
01116     return m_isScrollingWithMouse;
01117 }
01118
01119 void AnnotatedScrollBar::SetIsScrollable(
01120     bool isScrollable)
01121 {
01122     ANNOTATEDSCROLLBAR_TRACE_INFO(
01123         *this,
01124         TRACE_MSG_METH_INT,
01125         METH_NAME,
01126         this,
01127         isScrollable);
01128
01129     m_isScrollable = isScrollable;
01130     UpdateCanScroll();
01131 }
01132
01133 void AnnotatedScrollBar::SetValues(
01134     double minOffset,
01135     double maxOffset,
01136     double offset,
01137     double viewportLength)
01138 {
01139     ANNOTATEDSCROLLBAR_TRACE_INFO(
01140         *this,
01141         L"%s[0x%p](minOffset:%lf, maxOffset:%lf, offset:%lf, viewportLength:%lf, operationsCount:%d)\n",
01142         METH_NAME,
01143         this,
01144         minOffset,
01145         maxOffset,
01146         offset,
01147         viewportLength,
01148         m_operationsCount);
01149
01150     if (maxOffset < minOffset)
01151     {
01152         throw winrt::hresult_invalid_argument(L"maxOffset cannot be smaller than minOffset.");
01153     }
01154
01155     if (viewportLength < 0.0)
01156     {
01157         throw winrt::hresult_invalid_argument(L"viewportLength cannot be negative.");
01158     }
01159
01160     offset = std::max(minOffset, offset);
01161     offset = std::min(maxOffset, offset);
01162     m_lastOffset = offset;
01163
01164     Minimum(minOffset);
01165     Maximum(maxOffset);
01166     ViewportSize(viewportLength);
01167
01168     if (m_operationsCount == 0)
01169     {
01170         Value(offset);
01171     }
01172 }
01173
01174 winrt::CompositionAnimation AnnotatedScrollBar::GetScrollAnimation(
01175     int correlationId,
01176     winrt::float2 const& startPosition,
01177     winrt::float2 const& endPosition,
01178     winrt::CompositionAnimation const& defaultAnimation)
01179 {
01180     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, correlationId);
01181
01182     // Using the consumer's default animation.
01183     return defaultAnimation;
01184 }
01185
01186 void AnnotatedScrollBar::NotifyRequestedScrollCompleted(
01187     int correlationId)
01188 {
01189     ANNOTATEDSCROLLBAR_TRACE_INFO(
01190         *this,
01191         TRACE_MSG_METH_INT,
01192         METH_NAME,
01193         this,
01194         correlationId);
01195
01196     MUX_ASSERT(m_operationsCount > 0);
01197     m_operationsCount--;
01198
01199     if (m_operationsCount == 0 && Value() != m_lastOffset)
01200     {
01201         Value(m_lastOffset);
01202     }
01203 }
01204
01205 winrt::event_token AnnotatedScrollBar::ScrollToRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollToRequestedEventArgs> const& value)
01206 {
01207     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01208
01209     return m_scrollToRequested.add(value);
01210 }
01211
01212 void AnnotatedScrollBar::ScrollToRequested(winrt::event_token const& token)
01213 {
01214     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01215
01216     m_scrollToRequested.remove(token);
01217 }
01218
01219 winrt::event_token AnnotatedScrollBar::ScrollByRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollByRequestedEventArgs> const& value)
01220 {
01221     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01222
01223     return m_scrollByRequested.add(value);
01224 }
01225
01226 void AnnotatedScrollBar::ScrollByRequested(winrt::event_token const& token)
01227 {
01228     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01229
01230     m_scrollByRequested.remove(token);
01231 }
01232
01233 winrt::event_token AnnotatedScrollBar::AddScrollVelocityRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerAddScrollVelocityRequestedEventArgs> const& value)
01234 {
01235     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01236
01237     return m_addScrollVelocityRequested.add(value);
01238 }
01239
01240 void AnnotatedScrollBar::AddScrollVelocityRequested(winrt::event_token const& token)
01241 {
01242     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01243
01244     m_addScrollVelocityRequested.remove(token);
01245 }
01246
01247 winrt::event_token AnnotatedScrollBar::CanScrollChanged(winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable> const& value)
01248 {
01249     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01250
01251     return m_canScrollChanged.add(value);
01252 }
01253
01254 void AnnotatedScrollBar::CanScrollChanged(winrt::event_token const& token)
01255 {
01256     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01257
01258     m_canScrollChanged.remove(token);
01259 }
01260
01261 winrt::event_token AnnotatedScrollBar::IsScrollingWithMouseChanged(winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable> const& value)
01262 {
01263     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01264
01265     return m_isScrollingWithMouseChanged.add(value);
01266 }
01267
01268 void AnnotatedScrollBar::IsScrollingWithMouseChanged(winrt::event_token const& token)
01269 {
01270     ANNOTATEDSCROLLBAR_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01271
01272     m_isScrollingWithMouseChanged.remove(token);
01273 }
01274
01275 #pragma endregion
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ComboBox/ComboBoxHelper.idl Source File

  • ComboBox

ComboBoxHelper.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XCP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 [default_interface]
00007 runtimeclass ComboBoxHelper
00008 {
00009     [MUX_DEFAULT_VALUE("false")]
00010     [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnKeepInteriorCornersSquarePropertyChanged")]
00011     static Microsoft.UI.Xaml.DependencyProperty KeepInteriorCornersSquareProperty{ get; };
00012     static void SetKeepInteriorCornersSquare(Microsoft.UI.Xaml.Controls.ComboBox comboBox, Boolean value);
00013     static Boolean GetKeepInteriorCornersSquare(Microsoft.UI.Xaml.Controls.ComboBox comboBox);
00014 };
00015
00016 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PTRPage Member List

This is the complete list of members for PTRPage, including all inherited members.
PTRPage() PTRPage [inline]
Generated on Sun Dec 1 2024 20:54:24 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/TestUI/InfoBarPage.xaml.cs Source File

  • InfoBar
  • TestUI

InfoBarPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Windows.UI;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Automation;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Xaml.Media;
00010 using Microsoft.UI.Xaml.Controls.Primitives;
00011
00012 using IconSource = Microsoft.UI.Xaml.Controls.IconSource;
00013 using SymbolIconSource = Microsoft.UI.Xaml.Controls.SymbolIconSource;
00014
00015 namespace MUXControlsTestApp
00016 {
00017     [TopLevelTestPage(Name = "InfoBar")]
00018     public sealed partial class InfoBarPage : TestPage
00019     {
00020         private ButtonBase _actionButton = null;
00021         private DispatcherTimer _timer = new DispatcherTimer();
00022         private int _timerAction = 0;
00023
00024         public InfoBarPage()
00025         {
00026             this.InitializeComponent();
00027
00028             _timer.Interval = new TimeSpan(0, 0, 8 /*sec*/);
00029             _timer.Tick += Timer_Tick;
00030         }
00031
00032         private void SeverityComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00033         {
00034             string severityName = e.AddedItems[0].ToString();
00035
00036             switch (severityName)
00037             {
00038                 case "Error":
00039                     TestInfoBar.Severity = InfoBarSeverity.Error;
00040                     break;
00041
00042                 case "Warning":
00043                     TestInfoBar.Severity = InfoBarSeverity.Warning;
00044                     break;
00045
00046                 case "Success":
00047                     TestInfoBar.Severity = InfoBarSeverity.Success;
00048                     break;
00049
00050                 case "Informational":
00051                 default:
00052                     TestInfoBar.Severity = InfoBarSeverity.Informational;
00053                     break;
00054             }
00055         }
00056
00057         private void ActionButtonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00058         {
00059             if (TestInfoBar == null) return;
00060
00061             DiscardActionButton();
00062
00063             if (ActionButtonComboBox.SelectedIndex == 0)
00064             {
00065                 TestInfoBar.ActionButton = null;
00066             }
00067             else if (ActionButtonComboBox.SelectedIndex == 1)
00068             {
00069                 var button = new Button();
00070                 button.Content = "Action";
00071                 button.Click += ActionButton_Click;
00072                 _actionButton = TestInfoBar.ActionButton = button;
00073             }
00074             else if (ActionButtonComboBox.SelectedIndex == 2)
00075             {
00076                 var link = new HyperlinkButton();
00077                 link.NavigateUri = new Uri("http://www.microsoft.com/");
00078                 link.Content = "Informational link";
00079                 link.Click += ActionButton_Click;
00080                 _actionButton = TestInfoBar.ActionButton = link;
00081             }
00082             else if (ActionButtonComboBox.SelectedIndex == 3)
00083             {
00084                 var button = new Button();
00085                 button.Content = "Action";
00086                 button.HorizontalAlignment = HorizontalAlignment.Right;
00087                 button.Click += ActionButton_Click;
00088                 _actionButton = TestInfoBar.ActionButton = button;
00089             }
00090             else if (ActionButtonComboBox.SelectedIndex == 4)
00091             {
00092                 var link = new HyperlinkButton();
00093                 link.NavigateUri = new Uri("http://www.microsoft.com/");
00094                 link.Content = "Informational link";
00095                 link.HorizontalAlignment = HorizontalAlignment.Right;
00096                 link.Click += ActionButton_Click;
00097                 _actionButton = TestInfoBar.ActionButton = link;
00098             }
00099
00100             if (_actionButton != null)
00101             {
00102                 // Workaround for GitHub Issue #4531.
00103                 _actionButton.TabIndex = 1;
00104             }
00105         }
00106
00107         private void ActionButton_Click(object sender, RoutedEventArgs e)
00108         {
00109             EventListBox.Items.Add("ActionButtonClick");
00110
00111             if (RemoveActionButtonOnInvokeCheckBox.IsChecked.Value)
00112             {
00113                 ResetActionButtonProperty();
00114             }
00115         }
00116
00117         private void CollapseActionButtonProperty()
00118         {
00119             if (_actionButton != null)
00120             {
00121                 _actionButton.Visibility = Visibility.Collapsed;
00122             }
00123         }
00124
00125         private void DisableActionButtonProperty()
00126         {
00127             if (_actionButton != null)
00128             {
00129                 _actionButton.IsEnabled = false;
00130             }
00131         }
00132
00133         private void ResetActionButtonProperty()
00134         {
00135             ActionButtonComboBox.SelectedIndex = 0;
00136         }
00137
00138         private void DiscardActionButton()
00139         {
00140             if (_actionButton != null)
00141             {
00142                 _actionButton.Click -= ActionButton_Click;
00143                 _actionButton = null;
00144             }
00145         }
00146
00147         private void Timer_Tick(object sender, object e)
00148         {
00149             _timer.Stop();
00150
00151             switch (_timerAction)
00152             {
00153                 case 0:
00154                     CollapseActionButtonProperty();
00155                     break;
00156                 case 1:
00157                     DisableActionButtonProperty();
00158                     break;
00159                 case 2:
00160                     ResetActionButtonProperty();
00161                     break;
00162                 case 3:
00163                     InfoBarParent.Children.Remove(TestInfoBar);
00164                     AddInfoBarButton.IsEnabled = true;
00165                     RemoveInfoBarAsynchronouslyButton.IsEnabled = false;
00166                     break;
00167             }
00168
00169             switch (_timerAction)
00170             {
00171                 case 0:
00172                 case 1:
00173                 case 2:
00174                     CollpaseActionButtonAsynchronouslyButton.IsEnabled = true;
00175                     DisableActionButtonAsynchronouslyButton.IsEnabled = true;
00176                     ResetActionButtonAsynchronouslyButton.IsEnabled = true;
00177                     RemoveInfoBarAsynchronouslyButton.IsEnabled = true;
00178                     break;
00179                 case 3:
00180                     AddInfoBarButton.IsEnabled = true;
00181                     break;
00182             }
00183         }
00184
00185         private void IconComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00186         {
00187             if (TestInfoBar == null) return;
00188
00189             switch (e.AddedItems[0].ToString())
00190             {
00191                 case "Custom Icon":
00192                     SymbolIconSource symbolIcon = new SymbolIconSource();
00193                     symbolIcon.Symbol = Symbol.Pin;
00194                     TestInfoBar.IconSource = (IconSource)symbolIcon;
00195                     break;
00196
00197                 case "Default Icon":
00198                 default:
00199                     TestInfoBar.IconSource = null;
00200                     break;
00201             }
00202         }
00203
00204         public void OnCloseButtonClick(object sender, object args)
00205         {
00206             EventListBox.Items.Add("CloseButtonClick");
00207         }
00208
00209         public void OnClosing(object sender, InfoBarClosingEventArgs args)
00210         {
00211             EventListBox.Items.Add("Closing: " + args.Reason);
00212
00213             if (CancelCheckBox.IsChecked.Value)
00214             {
00215                 args.Cancel = true;
00216             }
00217         }
00218
00219         public void OnClosed(object sender, InfoBarClosedEventArgs args)
00220         {
00221             EventListBox.Items.Add("Closed: " + args.Reason);
00222         }
00223
00224         public void ClearButtonClick(object sender, object args)
00225         {
00226             EventListBox.Items.Clear();
00227         }
00228
00229         private void CollapseActionButtonAsynchronouslyClick(object sender, object args)
00230         {
00231             StartAsynchronousAction(0);
00232         }
00233
00234         private void DisableActionButtonAsynchronouslyClick(object sender, object args)
00235         {
00236             StartAsynchronousAction(1);
00237         }
00238
00239         private void ResetActionButtonAsynchronouslyClick(object sender, object args)
00240         {
00241             StartAsynchronousAction(2);
00242         }
00243
00244         private void AddInfoBarClick(object sender, object args)
00245         {
00246             InfoBarParent.Children.Insert(0, TestInfoBar);
00247             AddInfoBarButton.IsEnabled = false;
00248             CollpaseActionButtonAsynchronouslyButton.IsEnabled = true;
00249             DisableActionButtonAsynchronouslyButton.IsEnabled = true;
00250             ResetActionButtonAsynchronouslyButton.IsEnabled = true;
00251             RemoveInfoBarAsynchronouslyButton.IsEnabled = true;
00252         }
00253
00254         private void RemoveInfoBarAsynchronouslyClick(object sender, object args)
00255         {
00256             StartAsynchronousAction(3);
00257         }
00258
00259         private void StartAsynchronousAction(int timerAction)
00260         {
00261             _timer.Start();
00262             _timerAction = timerAction;
00263
00264             CollpaseActionButtonAsynchronouslyButton.IsEnabled = false;
00265             DisableActionButtonAsynchronouslyButton.IsEnabled = false;
00266             ResetActionButtonAsynchronouslyButton.IsEnabled = false;
00267             AddInfoBarButton.IsEnabled = false;
00268             RemoveInfoBarAsynchronouslyButton.IsEnabled = false;
00269         }
00270
00271         public void SetForegroundClick(object sender, object args)
00272         {
00273             TestInfoBar.Foreground = new SolidColorBrush(Microsoft.UI.Colors.Red);
00274         }
00275
00276         public void HasCustomContentChanged(object sender, object args)
00277         {
00278             if (HasCustomContentCheckBox.IsChecked.Value)
00279             {
00280                 var content = new CheckBox();
00281                 content.Content = "Custom Content";
00282                 content.Margin = new Thickness(0, 0, 0, 6);
00283                 AutomationProperties.SetName(content, "CustomContentCheckBox");
00284                 TestInfoBar.Content = content;
00285             }
00286             else
00287             {
00288                 TestInfoBar.Content = null;
00289             }
00290         }
00291
00292         public void CloseStyleChanged(object sender, object args)
00293         {
00294             if (CloseButtonStyleCheckBox.IsChecked.Value)
00295             {
00296                 TestInfoBar.CloseButtonStyle = this.Resources["CustomCloseButtonStyle"] as Style;
00297             }
00298             else
00299             {
00300                 TestInfoBar.CloseButtonStyle = Application.Current.Resources["InfoBarCloseButtonStyle"] as Style;
00301             }
00302         }
00303
00304         public void CustomBackgroundChanged(object sender, object args)
00305         {
00306             if (CustomBackgroundCheckBox.IsChecked.Value)
00307             {
00308                 TestInfoBar.Background = new SolidColorBrush(Microsoft.UI.Colors.Purple);
00309             }
00310             else
00311             {
00312                 TestInfoBar.Background = new SolidColorBrush(Microsoft.UI.Colors.Transparent);
00313             }
00314         }
00315     }
00316 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PaneLayoutTestPage Member List

This is the complete list of members for PaneLayoutTestPage, including all inherited members.
AddFooterItemButton_Click(object sender, RoutedEventArgs e) | PaneLayoutTestPage | [inline, private]
AddMenuItemButton_Click(object sender, RoutedEventArgs e) | PaneLayoutTestPage | [inline, private]
ClearCollectionsButton_Click(object sender, RoutedEventArgs e) | PaneLayoutTestPage | [inline, private]
footerItems | PaneLayoutTestPage | [private]
GetLayoutHeightsButton_Click(object sender, RoutedEventArgs e) | PaneLayoutTestPage | [inline, private]
IsSettingsEnabledCheckbox_Checked(object sender, RoutedEventArgs e) | PaneLayoutTestPage | [inline, private]
IsSettingsEnabledCheckbox_UnChecked(object sender, RoutedEventArgs e) | PaneLayoutTestPage | [inline, private]
menuItems | PaneLayoutTestPage | [private]
PaneLayoutTestPage() | PaneLayoutTestPage | [inline]
ResetCollectionsButton_Click(object sender, RoutedEventArgs e) | PaneLayoutTestPage | [inline, private]
TestCaseSelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) | PaneLayoutTestPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/LayoutSamples/VirtualLayoutPages/FlowLayoutDemoPage.xaml.cs Source File

  • Repeater
  • TestUI
  • Samples
  • LayoutSamples
  • VirtualLayoutPages

FlowLayoutDemoPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Linq;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007
00008 namespace MUXControlsTestApp.Samples
00009 {
00010     public sealed partial class FlowLayoutDemoPage : Page
00011     {
00012         public FlowLayoutDemoPage()
00013         {
00014             this.InitializeComponent();
00015
00016             repeater.ItemsSource = (from i in Enumerable.Range(0, 1000)
00017                                select new MyItem() {
00018                                    Label = i.ToString(),
00019                                    Height = 50 + i % 2 * 50
00020                                }).ToList();
00021         }
00022     }
00023
00024     public class MyItem
00025     {
00026         public string Label { get; set; }
00027         public float Height { get; set; }
00028     }
00029 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > Member List

This is the complete list of members for VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef >, including all inherited members.
Bindable | VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > | [static]
DependencyObjectBase | VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > | [static]
NoTrackRef | VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > | [static]
Observable | VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > | [static]
Generated on Sun Dec 1 2024 20:53:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SelectorBar/SelectorBarItem.cpp Source File

  • SelectorBar

SelectorBarItem.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SelectorBarItem.h"
00007 #include "SelectorBarItemAutomationPeer.h"
00008 #include "SelectorBarTrace.h"
00009
00010 SelectorBarItem::SelectorBarItem()
00011 {
00012     SELECTORBAR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00013
00014     EnsureProperties();
00015     SetDefaultStyleKey(this);
00016 }
00017
00018 SelectorBarItem::~SelectorBarItem()
00019 {
00020     SELECTORBAR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00021 }
00022
00023 winrt::AutomationPeer SelectorBarItem::OnCreateAutomationPeer()
00024 {
00025     return winrt::make<SelectorBarItemAutomationPeer>(*this);
00026 }
00027
00028 void SelectorBarItem::OnApplyTemplate()
00029 {
00030     SELECTORBAR_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00031
00032     ItemContainer::OnApplyTemplate();
00033
00034     winrt::IControlProtected controlProtected{ *this };
00035
00036     m_iconVisual.set(GetTemplateChildT<winrt::ContentPresenter>(s_iconVisualPartName, controlProtected));
00037     m_textVisual.set(GetTemplateChildT<winrt::TextBlock>(s_textVisualPartName, controlProtected));
00038
00039     UpdatePartsVisibility(true /*isForIcon*/, true /*isForText*/);
00040 }
00041
00042 void SelectorBarItem::OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args)
00043 {
00044     const auto dependencyProperty = args.Property();
00045     const bool isForIcon = dependencyProperty == s_IconProperty;
00046     const bool isForText = dependencyProperty == s_TextProperty;
00047
00048 #ifdef DBG
00049     SELECTORBAR_TRACE_VERBOSE(nullptr, L"%s[%p](property: %s)\n", METH_NAME, this, DependencyPropertyToString(dependencyProperty).c_str());
00050 #endif
00051
00052     if (isForIcon || isForText)
00053     {
00054         UpdatePartsVisibility(isForIcon, isForText);
00055     }
00056 }
00057
00058 void SelectorBarItem::UpdatePartsVisibility(bool isForIcon, bool isForText)
00059 {
00060     MUX_ASSERT(isForIcon || isForText);
00061
00062     SELECTORBAR_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, isForIcon, isForText);
00063
00064     winrt::UIElement iconParent{ nullptr }, textParent{ nullptr };
00065     bool hasIcon{}, hasText{};
00066
00067     if (auto&& iconVisual = m_iconVisual.get())
00068     {
00069         iconParent = winrt::VisualTreeHelper::GetParent(iconVisual).as<winrt::UIElement>();
00070         hasIcon = Icon() != nullptr;
00071
00072         if (isForIcon)
00073         {
00074             iconVisual.Visibility(hasIcon ? winrt::Visibility::Visible : winrt::Visibility::Collapsed);
00075         }
00076     }
00077
00078     if (auto&& textVisual = m_textVisual.get())
00079     {
00080         textParent = winrt::VisualTreeHelper::GetParent(textVisual).as<winrt::UIElement>();
00081         hasText = !(Text().empty());
00082
00083         if (isForText)
00084         {
00085             textVisual.Visibility(hasText ? winrt::Visibility::Visible : winrt::Visibility::Collapsed);
00086         }
00087     }
00088
00089     if (iconParent && iconParent == textParent)
00090     {
00091         // When there is no icon and no text, and the PART_IconVisual / PART_TextVisual have a common parent (an unnamed
00092         // StackPanel by default), that common parent is collapsed so it does not take any real estate because of its Margin.
00093         textParent.Visibility((hasIcon || hasText) ? winrt::Visibility::Visible : winrt::Visibility::Collapsed);
00094     }
00095 }
00096
00097 #ifdef DBG
00098
00099 winrt::hstring SelectorBarItem::DependencyPropertyToString(
00100     const winrt::IDependencyProperty& dependencyProperty)
00101 {
00102     if (dependencyProperty == s_IconProperty)
00103     {
00104         return L"Icon";
00105     }
00106     else if (dependencyProperty == s_TextProperty)
00107     {
00108         return L"Text";
00109     }
00110     else
00111     {
00112         return L"UNKNOWN";
00113     }
00114 }
00115
00116 #endif
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewList.cpp Source File

  • TreeView

TreeViewList.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "Utils.h"
00008 #include "TreeViewList.h"
00009 #include "TreeViewListAutomationPeer.h"
00010 #include "TreeViewItem.h"
00011 #include "TreeViewList.properties.cpp"
00012
00013 TreeViewList::TreeViewList()
00014 {
00015     ListViewModel(winrt::make_self<ViewModel>());
00016
00017     DragItemsStarting({ this, &TreeViewList::OnDragItemsStarting });
00018     DragItemsCompleted({ this, &TreeViewList::OnDragItemsCompleted });
00019     ContainerContentChanging({ this, &TreeViewList::OnContainerContentChanging });
00020 }
00021
00022 com_ptr<ViewModel> TreeViewList::ListViewModel() const
00023 {
00024     return m_viewModel.get();
00025 }
00026
00027 void TreeViewList::ListViewModel(com_ptr<ViewModel> viewModel)
00028 {
00029     m_viewModel.set(viewModel);
00030 }
00031
00032 winrt::TreeViewNode TreeViewList::DraggedTreeViewNode() const
00033 {
00034     return m_draggedTreeViewNode.get();
00035 }
00036
00037 void TreeViewList::DraggedTreeViewNode(winrt::TreeViewNode const& node)
00038 {
00039     m_draggedTreeViewNode.set(node);
00040 }
00041
00042 void TreeViewList::OnDragItemsStarting(const winrt::IInspectable& /*sender*/, const winrt::DragItemsStartingEventArgs& args)
00043 {
00044     auto dragItem = args.Items().GetAt(0);
00045     if (dragItem)
00046     {
00047         auto tvItem = ContainerFromItem(dragItem);
00048         m_draggedTreeViewNode.set(NodeFromContainer(tvItem));
00049         bool isMultipleDragging = false;
00050         if (IsMutiSelectWithSelectedItems())
00051         {
00052             int selectedCount = ListViewModel()->GetSelectedNodes().Size();
00053             if (selectedCount > 1)
00054             {
00055                 auto settings = tvItem.as<winrt::TreeViewItem>().TreeViewItemTemplateSettings();
00056                 winrt::get_self<TreeViewItemTemplateSettings>(settings)->DragItemsCount(selectedCount);
00057                 isMultipleDragging = true;
00058
00059                 // TreeView items' selection states are maintained by ViewModel, not by TreeViewList.
00060                 // When TreeView is set to multi-select mode, the underlying TreeViewList's selection mode is set to None (See OnPropertyChanged function in TreeView.cpp).
00061                 // TreeViewList has no knowledge about item selections happened in TreeView, no matter how many items are actually selected, args.Items() always contains only one item that is currently being dragged by cursor.
00062                 // Here, we manually add selected nodes to args.Items in order to expose all selected (and dragged) items to outside handlers.
00063                 args.Items().Clear();
00064
00065                 for (auto const& node : ListViewModel()->GetSelectedNodes())
00066                 {
00067                     if (IsContentMode())
00068                     {
00069                         args.Items().Append(node.Content());
00070                     }
00071                     else
00072                     {
00073                         args.Items().Append(node);
00074                     }
00075                 }
00076             }
00077         }
00078         else
00079         {
00080             // If not in multi-select mode, collapse the dragged node.
00081             m_draggedTreeViewNode.get().IsExpanded(false);
00082         }
00083
00084         winrt::VisualStateManager::GoToState(tvItem.as<winrt::TreeViewItem>(), isMultipleDragging ? L"MultipleDraggingPrimary" : L"Dragging", false);
00085         UpdateDropTargetDropEffect(false, false, nullptr);
00086     }
00087 }
00088
00089 void TreeViewList::OnDragItemsCompleted(const winrt::IInspectable& /*sender*/, const winrt::DragItemsCompletedEventArgs& /*args*/)
00090 {
00091     m_draggedTreeViewNode.set(nullptr);
00092     m_emptySlotIndex = -1;
00093 }
00094
00095 void TreeViewList::OnContainerContentChanging(const winrt::IInspectable& /*sender*/, const winrt::ContainerContentChangingEventArgs& args)
00096 {
00097     // Only need to update unrecycled on screen items.
00098     if (!args.InRecycleQueue())
00099     {
00100         auto targetItem = args.ItemContainer().as<winrt::TreeViewItem>();
00101         auto targetNode = NodeFromContainer(targetItem);
00102
00103         auto treeViewItem = winrt::get_self<TreeViewItem>(targetItem);
00104         auto treeViewNode = winrt::get_self<TreeViewNode>(targetNode);
00105
00106         if (auto itemsSource = targetItem.ItemsSource())
00107         {
00108             if (treeViewNode->ItemsSource() == nullptr)
00109             {
00110                 treeViewItem->SetItemsSource(targetNode, itemsSource);
00111             }
00112         }
00113
00114         treeViewItem->UpdateIndentation(targetNode.Depth());
00115         treeViewItem->UpdateSelectionVisual(winrt::get_self<TreeViewNode>(targetNode)->SelectionState());
00116     }
00117 }
00118
00119 // IControlOverrides
00120 void TreeViewList::OnDrop(winrt::DragEventArgs const& e)
00121 {
00122     winrt::DragEventArgs args = e;
00123
00124     if (args.AcceptedOperation() == winrt::Windows::ApplicationModel::DataTransfer::DataPackageOperation::Move && !args.Handled())
00125     {
00126         if (m_draggedTreeViewNode && IsIndexValid(m_emptySlotIndex))
00127         {
00128             // Get the node at which we will insert
00129             winrt::TreeViewNode insertAtNode = NodeAtFlatIndex(m_emptySlotIndex);
00130
00131             if (IsMutiSelectWithSelectedItems())
00132             {
00133                 // Multiselect drag and drop. In the selected items, find all the selected subtrees
00134                 // and move each of those subtrees.
00135                 const auto selectedRootNodes = GetRootsOfSelectedSubtrees();
00136                 const auto selectionSize = selectedRootNodes.size();
00137
00138                 // Loop through in reverse order because we are inserting above the previous item to get the order correct.
00139                 for (int i = static_cast<int>(selectedRootNodes.size()) - 1; i >= 0; --i)
00140                 {
00141                     MoveNodeInto(selectedRootNodes[i], insertAtNode);
00142                 }
00143             }
00144             else
00145             {
00146                 MoveNodeInto(m_draggedTreeViewNode.get(), insertAtNode);
00147             }
00148
00149             UpdateDropTargetDropEffect(false, false, nullptr);
00150             args.Handled(true);
00151         }
00152     }
00153
00154     __super::OnDrop(e);
00155 }
00156
00157 void TreeViewList::MoveNodeInto(winrt::TreeViewNode const& node, winrt::TreeViewNode const& insertAtNode) const
00158 {
00159     const int nodeFlatIndex = FlatIndex(node);
00160     if (insertAtNode != node && IsFlatIndexValid(nodeFlatIndex))
00161     {
00162         RemoveNodeFromParent(node);
00163
00164         const int insertOffset = nodeFlatIndex < m_emptySlotIndex ? 1 : 0;
00165         // if the insertAtNode is a parent that is expanded
00166         // insert as the first child
00167         if (insertAtNode.IsExpanded() && insertOffset == 1)
00168         {
00169             winrt::get_self<TreeViewNodeVector>(insertAtNode.Children())->InsertAt(0, node);
00170         }
00171         else
00172         {
00173             // Add the item to the new parent (parent of the insertAtNode)
00174             auto children = winrt::get_self<TreeViewNodeVector>(insertAtNode.Parent().Children());
00175             const int insertNodeIndexInParent = IndexInParent(insertAtNode);
00176             children->InsertAt(insertNodeIndexInParent + insertOffset, node);
00177         }
00178     }
00179 }
00180
00181 void TreeViewList::OnDragOver(winrt::DragEventArgs const& args)
00182 {
00183     if (!args.Handled())
00184     {
00185         args.AcceptedOperation(winrt::Windows::ApplicationModel::DataTransfer::DataPackageOperation::None);
00186         winrt::IInsertionPanel insertionPanel = ItemsPanelRoot().as<winrt::IInsertionPanel>();
00187
00188         // reorder is only supported with panels that implement IInsertionPanel
00189         if (insertionPanel && m_draggedTreeViewNode && CanReorderItems())
00190         {
00191             int aboveIndex = -1;
00192             int belowIndex = -1;
00193             auto itemsSource = ListViewModel();
00194             const int size = itemsSource->Size();
00195             const auto point = args.GetPosition(insertionPanel.as<winrt::UIElement>());
00196             insertionPanel.GetInsertionIndexes(point, aboveIndex, belowIndex);
00197
00198             // a value of -1 means we're inserting at the end of the list or before the last item
00199             if (belowIndex == -1)
00200             {
00201                 // this allows the next part of this code to test if we're dropping before or after the last item
00202                 belowIndex = static_cast<int>(size - 1);
00203             }
00204
00205             // if we have an insertion point
00206             // a value of 0 means we're inserting at the beginning
00207             // a value greater than size - 1 means we're inserting at the end as items are collapsing
00208             if (belowIndex > static_cast<int>(size - 1))
00209             {
00210                 // don't go out of bounds
00211                 // since items might be collapsing as we're dragging
00212                 m_emptySlotIndex = static_cast<int>(size - 1);
00213             }
00214             else if (belowIndex > 0 && m_draggedTreeViewNode)
00215             {
00216                 m_emptySlotIndex = -1;
00217                 unsigned int draggedIndex;
00218                 winrt::TreeViewNode tvi = m_draggedTreeViewNode.get();
00219                 if (ListViewModel()->IndexOfNode(tvi, draggedIndex))
00220                 {
00221                     const int indexToUse = (static_cast<int>(draggedIndex) < belowIndex) ? belowIndex : (belowIndex - 1);
00222                     if (auto item = ContainerFromIndex(indexToUse))
00223                     {
00224                         const auto treeViewItem = item.as<winrt::TreeViewItem>();
00225                         const auto pointInsideItem = args.GetPosition(treeViewItem.as<winrt::UIElement>());
00226
00227                         // if the point is in the top half of the item
00228                         // we need to insert before that item
00229                         if (pointInsideItem.Y < treeViewItem.ActualHeight() / 2)
00230                         {
00231                             m_emptySlotIndex = belowIndex - 1;
00232                         }
00233                         else
00234                         {
00235                             m_emptySlotIndex = belowIndex;
00236                         }
00237                     }
00238                 }
00239             }
00240             else
00241             {
00242                 // top of the list
00243                 m_emptySlotIndex = 0;
00244             }
00245
00246             bool allowReorder = true;
00247             if (IsFlatIndexValid(m_emptySlotIndex))
00248             {
00249                 auto insertAtNode = NodeAtFlatIndex(m_emptySlotIndex);
00250                 if (IsMultiselect())
00251                 {
00252                     // If insertAtNode is in the selected items, then we do not want to allow a dropping.
00253                     auto selectedItems = ListViewModel()->GetSelectedNodes();
00254                     for (unsigned int i = 0; i < selectedItems.Size(); i++)
00255                     {
00256                         auto selectedNode = selectedItems.GetAt(i);
00257                         if (selectedNode == insertAtNode)
00258                         {
00259                             allowReorder = false;
00260                             break;
00261                         }
00262                     }
00263                 }
00264                 else
00265                 {
00266                     if (m_draggedTreeViewNode && insertAtNode && insertAtNode.Parent())
00267                     {
00268                         auto insertContainer = ContainerFromNode(insertAtNode.Parent());
00269                         if (insertContainer)
00270                         {
00271                             allowReorder = insertContainer.as<winrt::TreeViewItem>().AllowDrop();
00272                         }
00273                     }
00274                 }
00275             }
00276             else
00277             {
00278                 // m_emptySlotIndex does not exist in the ViewModel - don't allow the reorder.
00279                 allowReorder = false;
00280             }
00281
00282             if (allowReorder)
00283             {
00284                 args.AcceptedOperation(winrt::Windows::ApplicationModel::DataTransfer::DataPackageOperation::Move);
00285             }
00286             else
00287             {
00288                 m_emptySlotIndex = -1;
00289                 args.AcceptedOperation(winrt::Windows::ApplicationModel::DataTransfer::DataPackageOperation::None);
00290                 args.Handled(true);
00291             }
00292         }
00293
00294         UpdateDropTargetDropEffect(false, false, nullptr);
00295     }
00296
00297     __super::OnDragOver(args);
00298 }
00299
00300 void TreeViewList::OnDragEnter(winrt::DragEventArgs const& args)
00301 {
00302     if (!args.Handled())
00303     {
00304         UpdateDropTargetDropEffect(false, false, nullptr);
00305     }
00306     __super::OnDragEnter(args);
00307 }
00308
00309 void TreeViewList::OnDragLeave(winrt::DragEventArgs const& args)
00310 {
00311     m_emptySlotIndex = -1;
00312     __super::OnDragLeave(args);
00313     if (!args.Handled())
00314     {
00315         UpdateDropTargetDropEffect(false, true, nullptr);
00316     }
00317 }
00318
00319 // IItemsControlOverrides
00320 void TreeViewList::PrepareContainerForItemOverride(winrt::DependencyObject const& element, winrt::IInspectable const& item)
00321 {
00322     auto itemNode = NodeFromContainer(element);
00323     TreeViewNode* itemNodeImplNoRef = winrt::get_self<TreeViewNode>(itemNode);
00324     winrt::TreeViewItem itemContainer = element.as<winrt::TreeViewItem>();
00325
00326     const auto selectionState = itemNodeImplNoRef->SelectionState();
00327
00328
00329     //Set the expanded property to match that of the Node, and enable Drop by default
00330     itemContainer.AllowDrop(true);
00331
00332     if (IsContentMode())
00333     {
00334         const bool hasChildren = itemContainer.HasUnrealizedChildren() || itemNode.HasChildren();
00335         itemContainer.GlyphOpacity(hasChildren ? 1.0 : 0.0);
00336         if (itemContainer.IsExpanded() != itemNode.IsExpanded()) {
00337             DispatcherQueue().TryEnqueue(winrt::DispatcherQueueHandler(
00338                 [itemNode, itemContainer]()
00339             {
00340                 if (itemContainer.GetBindingExpression(TreeViewItem::IsExpandedProperty()))
00341                 {
00342                     itemNode.IsExpanded(itemContainer.IsExpanded());
00343                 }
00344                 else
00345                 {
00346                     itemContainer.IsExpanded(itemNode.IsExpanded());
00347                 }
00348             }));
00349         }
00350     }
00351     else
00352     {
00353         itemContainer.IsExpanded(itemNode.IsExpanded());
00354         itemContainer.GlyphOpacity(itemNode.HasChildren() ? 1.0 : 0.0);
00355     }
00356
00357     //Set startup TemplateSettings properties
00358     auto templateSettings = winrt::get_self<TreeViewItemTemplateSettings>(itemContainer.TreeViewItemTemplateSettings());
00359     templateSettings->ExpandedGlyphVisibility(itemNode.IsExpanded() ? winrt::Visibility::Visible : winrt::Visibility::Collapsed);
00360     templateSettings->CollapsedGlyphVisibility(!itemNode.IsExpanded() ? winrt::Visibility::Visible : winrt::Visibility::Collapsed);
00361
00362     __super::PrepareContainerForItemOverride(element, item);
00363
00364
00365
00366     if (selectionState != itemNodeImplNoRef->SelectionState())
00367     {
00368         ListViewModel()->UpdateSelection(*itemNodeImplNoRef, selectionState);
00369     }
00370 }
00371
00372 winrt::DependencyObject TreeViewList::GetContainerForItemOverride()
00373 {
00374     winrt::TreeViewItem targetItem = winrt::TreeViewItem();
00375     return targetItem;
00376 }
00377
00378 // IFrameworkElementOverrides
00379 void TreeViewList::OnApplyTemplate()
00380 {
00381     if (!m_itemsSourceAttached)
00382     {
00383         ItemsSource(*ListViewModel());
00384         IsItemClickEnabled(true);
00385         m_itemsSourceAttached = true;
00386     }
00387
00388     __super::OnApplyTemplate();
00389 }
00390
00391 // IUIElementOverrides
00392 winrt::AutomationPeer TreeViewList::OnCreateAutomationPeer()
00393 {
00394     return winrt::make<TreeViewListAutomationPeer>(*this);
00395 }
00396
00397 winrt::hstring TreeViewList::GetDropTargetDropEffect()
00398 {
00399     if (m_dropTargetDropEffectString.empty())
00400     {
00401         UpdateDropTargetDropEffect(true, false, nullptr);
00402     }
00403     return m_dropTargetDropEffectString;
00404 }
00405
00406 void TreeViewList::SetDraggedOverItem(winrt::TreeViewItem newDraggedOverItem)
00407 {
00408     m_draggedOverItem.set(newDraggedOverItem);
00409 }
00410
00411 void TreeViewList::UpdateDropTargetDropEffect(bool forceUpdate, bool isLeaving, winrt::TreeViewItem keyboardReorderedContainer)
00412 {
00413     //Preserve old value of string in case it's needed.
00414     winrt::hstring oldValue = m_dropTargetDropEffectString;
00415
00416     winrt::TreeViewItem dragItem{ nullptr };
00417     winrt::AutomationPeer dragItemPeer{ nullptr };
00418
00419     if (keyboardReorderedContainer)
00420     {
00421         dragItem = keyboardReorderedContainer;
00422     }
00423     else
00424     {
00425     auto listItem = ContainerFromItem(m_draggedOverItem.get());
00426         if (listItem)
00427         {
00428             dragItem = listItem.as<winrt::TreeViewItem>();
00429         }
00430     }
00431
00432     if (dragItem)
00433     {
00434         winrt::hstring dragItemString = L"";
00435         winrt::hstring itemBeforeInsertPositionString = L"";
00436         winrt::hstring itemAfterInsertPositionString = L"";
00437         winrt::hstring draggedOverString = L"";
00438
00439         dragItemPeer = winrt::FrameworkElementAutomationPeer::FromElement(dragItem);
00440         if (dragItemPeer)
00441         {
00442             dragItemString = dragItemPeer.GetNameCore();
00443         }
00444
00445         if (dragItemString.empty())
00446         {
00447             dragItemString = ResourceAccessor::GetLocalizedStringResource(SR_DefaultItemString);
00448         }
00449
00450         if (isLeaving)
00451         {
00452             m_dropTargetDropEffectString = StringUtil::FormatString(
00453                 ResourceAccessor::GetLocalizedStringResource(SR_CancelDraggingString),
00454                 dragItemString);
00455         }
00456         else
00457         {
00458             winrt::TreeViewItem itemAfterInsertPosition{ nullptr };
00459             winrt::TreeViewItem itemBeforeInsertPosition{ nullptr };
00460
00461             if (m_draggedOverItem)
00462             {
00463                 winrt::AutomationPeer draggedOverItemPeer = winrt::FrameworkElementAutomationPeer::FromElement(m_draggedOverItem.get());
00464                 if (draggedOverItemPeer)
00465                 {
00466                     draggedOverString = draggedOverItemPeer.GetNameCore();
00467                 }
00468             }
00469             else
00470             {
00471                 int insertIndex = -1;
00472                 int afterInsertIndex = -1;
00473                 int beforeInsertIndex = -1;
00474                 auto dragItemIndex = IndexFromContainer(dragItem);
00475
00476                 if (keyboardReorderedContainer)
00477                 {
00478                     insertIndex = dragItemIndex;
00479                 }
00480                 else
00481                 {
00482                     insertIndex = m_emptySlotIndex;
00483                 }
00484
00485                 if (insertIndex != -1)
00486                 {
00487                     afterInsertIndex = insertIndex + 1;
00488                     beforeInsertIndex = insertIndex - 1;
00489                 }
00490
00491                 if (insertIndex > dragItemIndex)
00492                 {
00493                     beforeInsertIndex++;
00494                 }
00495                 else if (insertIndex < dragItemIndex)
00496                 {
00497                     afterInsertIndex--;
00498                 }
00499
00500                 itemBeforeInsertPositionString = GetAutomationName(beforeInsertIndex);
00501                 itemAfterInsertPositionString = GetAutomationName(afterInsertIndex);
00502             }
00503
00504             m_dropTargetDropEffectString = BuildEffectString(itemBeforeInsertPositionString, itemAfterInsertPositionString, dragItemString, draggedOverString);
00505         }
00506
00507         if (!forceUpdate && oldValue != m_dropTargetDropEffectString)
00508         {
00509             winrt::AutomationPeer treePeer = winrt::FrameworkElementAutomationPeer::FromElement(*this);
00510             treePeer.RaisePropertyChangedEvent(winrt::DropTargetPatternIdentifiers::DropTargetEffectProperty(), box_value(oldValue.data()), box_value(m_dropTargetDropEffectString.data()));
00511         }
00512     }
00513 }
00514
00515 void TreeViewList::EnableMultiselect(bool isEnabled)
00516 {
00517     m_isMultiselectEnabled = isEnabled;
00518 }
00519
00520 bool TreeViewList::IsMultiselect() const
00521 {
00522     return m_isMultiselectEnabled;
00523 }
00524
00525
00526 bool TreeViewList::IsMutiSelectWithSelectedItems() const
00527 {
00528     auto selectedItems = ListViewModel()->GetSelectedNodes();
00529     const bool isMutiSelect = m_isMultiselectEnabled &&  selectedItems.Size() > 0;
00530     return isMutiSelect;
00531 }
00532
00533 bool TreeViewList::IsSelected(const winrt::TreeViewNode& node) const
00534 {
00535     bool isSelected = false;
00536     auto selectedItems = ListViewModel()->GetSelectedNodes();
00537     for (unsigned int i = 0; i < selectedItems.Size(); i++)
00538     {
00539         if (selectedItems.GetAt(i) == node)
00540         {
00541             isSelected = true;
00542             break;
00543         }
00544     }
00545
00546     return isSelected;
00547 }
00548
00549 std::vector<winrt::TreeViewNode> TreeViewList::GetRootsOfSelectedSubtrees() const
00550 {
00551     std::vector<winrt::TreeViewNode> roots;
00552     auto selectedItems = ListViewModel()->GetSelectedNodes();
00553     for (unsigned int i = 0; i < selectedItems.Size(); i++)
00554     {
00555         auto item = selectedItems.GetAt(i);
00556         auto selectionRoot = GetRootOfSelection(item);
00557         auto it = std::find(roots.cbegin(), roots.cend(), selectionRoot);
00558         if (it == roots.cend())
00559         {
00560             roots.emplace_back(selectionRoot);
00561         }
00562     }
00563
00564     return roots;
00565 }
00566
00567 int TreeViewList::FlatIndex(const winrt::TreeViewNode& node) const
00568 {
00569     unsigned int flatIndex = 0;
00570     bool found = ListViewModel()->IndexOfNode(node, flatIndex);
00571     flatIndex = found ? flatIndex : -1;
00572     return flatIndex;
00573 }
00574
00575 bool TreeViewList::IsFlatIndexValid(int index) const
00576 {
00577     return index >= 0 && index < static_cast<int>(ListViewModel()->Size());
00578 }
00579
00580 unsigned int TreeViewList::RemoveNodeFromParent(const winrt::TreeViewNode& node) const
00581 {
00582     unsigned int indexInParent = 0;
00583     auto children = winrt::get_self<TreeViewNodeVector>(node.Parent().Children());
00584     if (children->IndexOf(node, indexInParent))
00585     {
00586         children->RemoveAt(indexInParent);
00587     }
00588
00589     return indexInParent;
00590 }
00591
00592 bool TreeViewList::IsIndexValid(int index) const
00593 {
00594     return index >= 0 && index < (int)Items().Size();
00595 }
00596
00597 hstring TreeViewList::GetAutomationName(int index) const
00598 {
00599     winrt::TreeViewItem item{ nullptr };
00600     hstring automationName = L"";
00601
00602     if (IsIndexValid(index))
00603     {
00604         auto interim = ContainerFromIndex(index);
00605         if (interim)
00606         {
00607             item = interim.as<winrt::TreeViewItem>();
00608         }
00609     }
00610
00611     if (item)
00612     {
00613         winrt::AutomationPeer itemPeer = winrt::FrameworkElementAutomationPeer::FromElement(item);
00614         if (itemPeer)
00615         {
00616             automationName = itemPeer.GetNameCore();
00617         }
00618     }
00619
00620     return automationName;
00621 }
00622
00623 hstring TreeViewList::BuildEffectString(hstring priorString, hstring afterString, hstring dragString, hstring dragOverString) const
00624 {
00625     hstring resultString;
00626     if (!priorString.empty() && !afterString.empty())
00627     {
00628         resultString = StringUtil::FormatString(
00629             ResourceAccessor::GetLocalizedStringResource(SR_PlaceBetweenString),
00630             dragString.data(), priorString.data(), afterString.data());
00631     }
00632     else if (!priorString.empty())
00633     {
00634         resultString = StringUtil::FormatString(
00635             ResourceAccessor::GetLocalizedStringResource(SR_PlaceAfterString),
00636             dragString.data(), priorString.data());
00637     }
00638     else if (!afterString.empty())
00639     {
00640         resultString = StringUtil::FormatString(
00641             ResourceAccessor::GetLocalizedStringResource(SR_PlaceBeforeString),
00642             dragString.data(), afterString.data());
00643     }
00644     else if (!dragOverString.empty())
00645     {
00646         resultString = StringUtil::FormatString(
00647             ResourceAccessor::GetLocalizedStringResource(SR_DropIntoNodeString),
00648             dragString.data(), dragOverString.data());
00649     }
00650     else
00651     {
00652         resultString = StringUtil::FormatString(
00653             ResourceAccessor::GetLocalizedStringResource(SR_FallBackPlaceString),
00654             dragString.data());
00655     }
00656
00657     return resultString;
00658 }
00659
00660 unsigned int TreeViewList::IndexInParent(const winrt::TreeViewNode& node) const
00661 {
00662     unsigned int indexInParent;
00663     node.Parent().Children().IndexOf(node, indexInParent);
00664     return indexInParent;
00665 }
00666
00667 winrt::TreeViewNode TreeViewList::NodeAtFlatIndex(int index) const
00668 {
00669     return ListViewModel()->GetNodeAt(index);
00670 }
00671
00672 winrt::TreeViewNode TreeViewList::GetRootOfSelection(const winrt::TreeViewNode& node) const
00673 {
00674     winrt::TreeViewNode current = node;
00675     while (current.Parent() && IsSelected(current.Parent()))
00676     {
00677         current = current.Parent();
00678     }
00679
00680     return current;
00681 }
00682
00683 winrt::TreeViewNode TreeViewList::NodeFromContainer(winrt::DependencyObject const& container) const
00684 {
00685     const int index = container ? IndexFromContainer(container) : -1;
00686     if (index >= 0 && index < static_cast<int32_t>(ListViewModel()->Size()))
00687     {
00688         return NodeAtFlatIndex(index);
00689     }
00690     return nullptr;
00691 }
00692
00693 winrt::DependencyObject TreeViewList::ContainerFromNode(winrt::TreeViewNode const& node) const
00694 {
00695     if (!node)
00696     {
00697         return nullptr;
00698     }
00699
00700     return IsContentMode() ? ContainerFromItem(node.Content()) : ContainerFromItem(node);
00701 }
00702
00703 winrt::TreeViewNode TreeViewList::NodeFromItem(winrt::IInspectable const& item) const
00704 {
00705     return IsContentMode() ?
00706         ListViewModel().get()->GetAssociatedNode(item) :
00707         item.try_as<winrt::TreeViewNode>();
00708 }
00709
00710 winrt::IInspectable TreeViewList::ItemFromNode(winrt::TreeViewNode const& node) const
00711 {
00712     return (IsContentMode() && node) ? node.Content() : static_cast<winrt::IInspectable>(node);
00713 }
00714
00715 bool TreeViewList::IsContentMode() const
00716 {
00717     if (auto viewModel = ListViewModel())
00718     {
00719         return viewModel->IsContentMode();
00720     }
00721
00722     return false;
00723 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PersonPictureProperties Member List

This is the complete list of members for PersonPictureProperties, including all inherited members.
BadgeGlyph(winrt::hstring const &value) | PersonPictureProperties |
BadgeGlyph() | PersonPictureProperties |
BadgeGlyphProperty() | PersonPictureProperties | [inline, static]
BadgeImageSource(winrt::ImageSource const &value) | PersonPictureProperties |
BadgeImageSource() | PersonPictureProperties |
BadgeImageSourceProperty() | PersonPictureProperties | [inline, static]
BadgeNumber(int value) | PersonPictureProperties |
BadgeNumber() | PersonPictureProperties |
BadgeNumberProperty() | PersonPictureProperties | [inline, static]
BadgeText(winrt::hstring const &value) | PersonPictureProperties |
BadgeText() | PersonPictureProperties |
BadgeTextProperty() | PersonPictureProperties | [inline, static]
ClearProperties() | PersonPictureProperties | [static]
Contact(winrt::Contact const &value) | PersonPictureProperties |
Contact() | PersonPictureProperties |
ContactProperty() | PersonPictureProperties | [inline, static]
DisplayName(winrt::hstring const &value) | PersonPictureProperties |
DisplayName() | PersonPictureProperties |
DisplayNameProperty() | PersonPictureProperties | [inline, static]
EnsureProperties() | PersonPictureProperties | [static]
Initials(winrt::hstring const &value) | PersonPictureProperties |
Initials() | PersonPictureProperties |
InitialsProperty() | PersonPictureProperties | [inline, static]
IsGroup(bool value) | PersonPictureProperties |
IsGroup() | PersonPictureProperties |
IsGroupProperty() | PersonPictureProperties | [inline, static]
OnBadgeGlyphPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnBadgeImageSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnBadgeNumberPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnBadgeTextPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnContactPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnDisplayNamePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnInitialsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnIsGroupPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnPreferSmallImagePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnProfilePicturePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnTemplateSettingsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
PersonPictureProperties() | PersonPictureProperties |
PreferSmallImage(bool value) | PersonPictureProperties |
PreferSmallImage() | PersonPictureProperties |
PreferSmallImageProperty() | PersonPictureProperties | [inline, static]
ProfilePicture(winrt::ImageSource const &value) | PersonPictureProperties |
ProfilePicture() | PersonPictureProperties |
ProfilePictureProperty() | PersonPictureProperties | [inline, static]
s_BadgeGlyphProperty | PersonPictureProperties | [static]
s_BadgeImageSourceProperty | PersonPictureProperties | [static]
s_BadgeNumberProperty | PersonPictureProperties | [static]
s_BadgeTextProperty | PersonPictureProperties | [static]
s_ContactProperty | PersonPictureProperties | [static]
s_DisplayNameProperty | PersonPictureProperties | [static]
s_InitialsProperty | PersonPictureProperties | [static]
s_IsGroupProperty | PersonPictureProperties | [static]
s_PreferSmallImageProperty | PersonPictureProperties | [static]
s_ProfilePictureProperty | PersonPictureProperties | [static]
s_TemplateSettingsProperty | PersonPictureProperties | [static]
TemplateSettings(winrt::PersonPictureTemplateSettings const &value) | PersonPictureProperties |
TemplateSettings() | PersonPictureProperties |
TemplateSettingsProperty() | PersonPictureProperties | [inline, static]
Generated on Sun Dec 1 2024 20:53:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewPage Member List

This is the complete list of members for TabViewPage, including all inherited members.
_iconSource | TabViewPage | [private]
_newTabNumber | TabViewPage | [private]
activeTabContentBackgroundBrushCache | TabViewPage | [private]
activeTabSelectedBackgroundPathBrushCache | TabViewPage | [private]
AddButtonClick(object sender, object e) | TabViewPage | [inline]
backgroundColorCache | TabViewPage | [private]
CacheFirstTabSelectedBackgroundPathFill() | TabViewPage | [inline, private]
ChangeShopTextButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
ClearColorsButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
ClearOverlapCheck_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
CloseButtonOverlayModeCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TabViewPage | [inline, private]
CustomTooltipButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
DataIdentifier | TabViewPage | [private]
DataTabView | TabViewPage | [private]
FindFrameworkElementWithName(string name, DependencyObject startNode) | TabViewPage | [inline, private]
FindTabViewItemFromContent(TabView tabView, object content) | TabViewPage | [inline, private]
FirstTab_CloseRequested(object sender, Microsoft.UI.Xaml.Controls.TabViewTabCloseRequestedEventArgs e) | TabViewPage | [inline, private]
GetFirstTabLocationButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
GetScrollButtonsVisible_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
GetScrollDecreaseButtonEnabled_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
GetScrollDecreaseButtonToolTipButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
GetScrollIncreaseButtonEnabled_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
GetScrollIncreaseButtonToolTipButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
GetTab0ToolTipButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
GetTab1ToolTipButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
GetToolTipStringForUIElement(UIElement item, TextBlock textBlock) | TabViewPage | [inline]
HomeTabOverlapCheck_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
IsClosableCheckBox_CheckChanged(object sender, RoutedEventArgs e) | TabViewPage | [inline]
IsDisabledTabVisibleCheckBox_CheckChanged(object sender, RoutedEventArgs e) | TabViewPage | [inline]
MultipleTabViewPageButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
OnNavigatedTo(Microsoft.UI.Xaml.Navigation.NavigationEventArgs args) | TabViewPage | [inline, protected]
OnSecondTabDragStarting(object sender, DragStartingEventArgs e) | TabViewPage | [inline, private]
OnTabDragStarting(object sender, TabViewTabDragStartingEventArgs e) | TabViewPage | [inline, private]
OnTabStripDragOver(object sender, DragEventArgs e) | TabViewPage | [inline, private]
OnTabStripDrop(object sender, DragEventArgs e) | TabViewPage | [inline, private]
RemoveTabButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
SelectIndexButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
SelectItemButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
SetActiveContentTransparent_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
SetActiveTabTransparent_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
SetColorsButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
SetFirstTabSelectedBackgroundPathFill(Brush newBrush) | TabViewPage | [inline, private]
SetTabViewWidth_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
ShortLongTextButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
Tabs_TabItemsChanged(TabView sender, Windows.Foundation.Collections.IVectorChangedEventArgs args) | TabViewPage | [inline, private]
TabViewPage() | TabViewPage | [inline]
TabViewScrollToTheLeftButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
TabViewScrollToTheMiddleButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
TabViewScrollToTheRightButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline]
TabViewSelectionChanged(object sender, SelectionChangedEventArgs e) | TabViewPage | [inline, private]
TabViewSizingPageButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
TabViewTabCloseRequested(object sender, Microsoft.UI.Xaml.Controls.TabViewTabCloseRequestedEventArgs e) | TabViewPage | [inline, private]
TabViewTabClosingBehaviorButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
TabViewTabDroppedOutside(object sender, Microsoft.UI.Xaml.Controls.TabViewTabDroppedOutsideEventArgs e) | TabViewPage | [inline, private]
TabViewTabItemsSourcePageButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
TabViewTearOutWindowWithDataItemsButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
TabViewTearOutWindowWithoutDataItemsButton_Click(object sender, RoutedEventArgs e) | TabViewPage | [inline, private]
TabWidthComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TabViewPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/RevealBrushTestApi.cpp Source File

  • Materials
  • Reveal

RevealBrushTestApi.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "RevealBrushTestApi.h"
00007 #include "RevealBrush.h"
00008
00009 #include "RevealBrushTestApi.properties.cpp"
00010
00011 winrt::RevealBrush RevealBrushTestApi::RevealBrush()
00012 {
00013     return m_revealBrush;
00014 }
00015
00016 void RevealBrushTestApi::RevealBrush(winrt::RevealBrush const& value)
00017 {
00018     m_revealBrush = value;
00019 }
00020
00021 bool RevealBrushTestApi::IsInFallbackMode()
00022 {
00023     return (winrt::get_self<::RevealBrush>(m_revealBrush))->m_isInFallbackMode;
00024 }
00025
00026 bool RevealBrushTestApi::IsAmbientLightSet()
00027 {
00028     return (winrt::get_self<::RevealBrush>(m_revealBrush))->m_isAmbientLightSet;
00029 }
00030
00031 bool RevealBrushTestApi::IsBorderLightSet()
00032 {
00033     return (winrt::get_self<::RevealBrush>(m_revealBrush))->m_isBorderLightSet;
00034 }
00035
00036 bool RevealBrushTestApi::IsHoverLightSet()
00037 {
00038     return (winrt::get_self<::RevealBrush>(m_revealBrush))->m_isHoverLightSet;
00039 }
00040
00041 winrt::CompositionBrush RevealBrushTestApi::CompositionBrush()
00042 {
00043     return (winrt::get_self<::RevealBrush>(m_revealBrush))->m_brush;
00044 }
00045
00046 winrt::CompositionBrush RevealBrushTestApi::NoiseBrush()
00047 {
00048     return (winrt::get_self<::RevealBrush>(m_revealBrush))->m_noiseBrush;
00049 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnimatedAcceptVisualSource_AnimatedVisual Member List

This is the complete list of members for AnimatedAcceptVisualSource_AnimatedVisual, including all inherited members.
_reusableExpressionAnimation(compositor.CreateExpressionAnimation()) | AnimatedAcceptVisualSource_AnimatedVisual | [inline]
AnimatedAcceptVisualSource_AnimatedVisual(Compositor compositor, CompositionPropertySet themeProperties) | AnimatedAcceptVisualSource_AnimatedVisual | [inline]
BindProperty(CompositionObject target, winrt::hstring animatedPropertyName, winrt::hstring expression, winrt::hstring referenceParameterName, CompositionObject referencedObject) | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
CanvasGeometryToIGeometrySource2D(winrt::com_ptr< CanvasGeometry > geo) | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private, static]
Close() | AnimatedAcceptVisualSource_AnimatedVisual | [inline]
ContainerVisual_00() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_01() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_02() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_03() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_04() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_05() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_06() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_07() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_08() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_09() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_10() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_11() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_12() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_13() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_14() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_15() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_16() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_17() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_18() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_19() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_20() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_21() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_22() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_23() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_24() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_25() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_26() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_27() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_28() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_29() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_30() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_31() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_32() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_33() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_34() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_35() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_36() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_37() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_38() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_39() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_40() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ContainerVisual_41() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
CreateBooleanKeyFrameAnimation(float initialProgress, bool initialValue) | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
CreateScalarKeyFrameAnimation(float initialProgress, float initialValue, CompositionEasingFunction initialEasingFunction) | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
CreateSpriteShape(CompositionGeometry geometry, winrt::float3x2 transformMatrix) | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_0() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
CubicBezierEasingFunction_1() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
Duration() const | AnimatedAcceptVisualSource_AnimatedVisual | [inline]
Geometry_0() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
Geometry_1() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
Geometry_2() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
HoldThenStepEasingFunction() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
InsetClip_0() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsRuntimeCompatible() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, static]
IsVisibleBooleanAnimation_00() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_01() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_02() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_03() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_04() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_05() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_06() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_07() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_08() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_09() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_10() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_11() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_12() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_13() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_14() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_15() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_16() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_17() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
IsVisibleBooleanAnimation_18() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
Path() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_00() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_01() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_02() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_03() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_04() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_05() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_06() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_07() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_08() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_09() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_10() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_11() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
PathGeometry_12() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
Root() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
RootProgress() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
RootVisual() const | AnimatedAcceptVisualSource_AnimatedVisual | [inline]
ShapeVisual_00() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_01() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_02() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_03() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_04() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_05() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_06() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_07() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_08() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_09() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_10() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_11() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_12() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_13() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ShapeVisual_14() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
Size() const | AnimatedAcceptVisualSource_AnimatedVisual | [inline]
SpriteShape_00() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_01() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_02() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_03() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_04() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_05() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_06() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_07() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_08() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_09() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_10() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_11() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_12() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_13() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
SpriteShape_14() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
StartProgressBoundAnimation(CompositionObject target, winrt::hstring animatedPropertyName, CompositionAnimation animation, ExpressionAnimation controllerProgressExpression) | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private, static]
StepThenHoldEasingFunction() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
ThemeColor_Foreground() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_1_0() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_1_1() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_1_2() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_1_3() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimEndScalarAnimation_0_to_1_4() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0_to_1_0() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0_to_1_1() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0_to_1_2() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0_to_1_3() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
TrimStartScalarAnimation_0_to_1_4() | AnimatedAcceptVisualSource_AnimatedVisual | [inline, private]
Generated on Sun Dec 1 2024 20:52:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemBase.h Source File

  • NavigationView

NavigationViewItemBase.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "NavigationViewItemBase.g.h"
00007 #include "NavigationViewHelper.h"
00008 #include "NavigationViewItemBase.properties.h"
00009
00010 class NavigationViewItemBase :
00011     public ReferenceTracker<NavigationViewItemBase, winrt::implementation::NavigationViewItemBaseT, winrt::composable>,
00012     public NavigationViewItemBaseProperties
00013 {
00014 public:
00015
00016     NavigationViewItemBase();
00017
00018     // Promote all overrides that our derived classes want into virtual so that our shim will call them.
00019     // IFrameworkElementOverrides
00020     virtual void OnApplyTemplate();
00021     void OnLoaded(winrt::IInspectable const&, winrt::RoutedEventArgs const&);
00022
00023     // IUIElementOverrides
00024     virtual winrt::AutomationPeer OnCreateAutomationPeer()
00025     {
00026         return __super::OnCreateAutomationPeer();
00027     }
00028
00029     // IContentControlOverrides
00030     virtual void OnContentChanged(winrt::IInspectable const& oldContent, winrt::IInspectable const& newContent)
00031     {
00032         __super::OnContentChanged(oldContent, newContent);
00033     }
00034
00035     // IControlOverrides overrides
00036     virtual void OnGotFocus(winrt::RoutedEventArgs const& e)
00037     {
00038         __super::OnGotFocus(e);
00039     }
00040
00041     virtual void OnLostFocus(winrt::RoutedEventArgs const& e)
00042     {
00043         __super::OnLostFocus(e);
00044     }
00045
00046     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00047
00048     NavigationViewRepeaterPosition Position() const;
00049     void Position(NavigationViewRepeaterPosition value);
00050     virtual void OnNavigationViewItemBasePositionChanged() {}
00051
00052     void Depth(int depth);
00053     int Depth() const;
00054     virtual void OnNavigationViewItemBaseDepthChanged() {}
00055
00056     virtual void OnNavigationViewItemBaseIsSelectedChanged() {}
00057
00058     winrt::NavigationView GetNavigationView() const;
00059     winrt::SplitView GetSplitView() const;
00060     void SetNavigationViewParent(winrt::NavigationView const& navigationView);
00061
00062     // TODO: Constant is a temporary measure. Potentially expose using TemplateSettings.
00063     static constexpr int c_itemIndentation = 31;
00064
00065     void IsTopLevelItem(bool isTopLevelItem) { m_isTopLevelItem = isTopLevelItem; };
00066     bool IsTopLevelItem() const { return m_isTopLevelItem; };
00067
00068     void CreatedByNavigationViewItemsFactory(bool createdByNavigationViewItemsFactory) { m_createdByNavigationViewItemsFactory = createdByNavigationViewItemsFactory; };
00069     bool CreatedByNavigationViewItemsFactory() { return m_createdByNavigationViewItemsFactory; };
00070
00071     void IsInNavigationViewOwnedRepeater(bool isInNavigationViewOwnedRepeater) { m_isInNavigationViewOwnedRepeater = isInNavigationViewOwnedRepeater; };
00072     bool IsInNavigationViewOwnedRepeater() const { return m_isInNavigationViewOwnedRepeater; };
00073
00074 protected:
00075
00076     winrt::weak_ref<winrt::NavigationView> m_navigationView{ nullptr };
00077
00078 private:
00079
00080     NavigationViewRepeaterPosition m_position{ NavigationViewRepeaterPosition::LeftNav };
00081     int m_depth{ 0 };
00082     bool m_isTopLevelItem{ false };
00083
00084     // Flag to keep track of whether this item was created by the custom internal NavigationViewItemsFactory.
00085     // This is required in order to achieve proper recycling
00086     bool m_createdByNavigationViewItemsFactory{ false };
00087     bool m_isInNavigationViewOwnedRepeater{ false };
00088 };
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MockItemsSourceWithUniqueIdMapping Member List

This is the complete list of members for MockItemsSourceWithUniqueIdMapping, including all inherited members.
_recordedKeyFromIndexCalls | MockItemsSource | [protected]
Add(object value) | CustomItemsSourceView | [inline]
Clear() | CustomItemsSourceView | [inline]
CollectionChanged | CustomItemsSourceView |
Contains(object value) | CustomItemsSourceView | [inline]
CopyTo(Array array, int index) | CustomItemsSourceView | [inline]
Count | CustomItemsSourceView |
CreateDataSource(WinRTCollection data, bool supportsUniqueIds) | MockItemsSource | [inline, static]
CreateDataSource< T >(ObservableCollection< T > data, bool supportsUniqueIds) | MockItemsSource | [inline, static]
GetAtCore(int index) | MockItemsSource | [inline, protected, virtual]
GetAtFunc | MockItemsSource |
GetEnumerator() | CustomItemsSourceView | [inline]
GetItemIdFunc | MockItemsSource |
GetSizeCore() | MockItemsSource | [inline, protected, virtual]
GetSizeFunc | MockItemsSource |
HasKeyIndexMappingFunc | MockItemsSource |
IndexFromKey(string id) | MockItemsSourceWithUniqueIdMapping | [inline]
IndexOf(object value) | CustomItemsSourceView | [inline]
Insert(int index, object value) | CustomItemsSourceView | [inline]
IsFixedSize | CustomItemsSourceView |
IsReadOnly | CustomItemsSourceView |
IsSynchronized | CustomItemsSourceView |
KeyFromIndex(int index) | MockItemsSourceWithUniqueIdMapping | [inline]
OnItemsSourceChanged(NotifyCollectionChangedEventArgs args) | MockItemsSource | [inline]
Remove(object value) | CustomItemsSourceView | [inline]
RemoveAt(int index) | CustomItemsSourceView | [inline]
SyncRoot | CustomItemsSourceView |
this | CustomItemsSourceView |
ValidateGetAtCalls(params GetAtCallInfo[] expected) | MockItemsSource | [inline]
ValidateGetItemIdCalls(params KeyFromIndexCallInfo[] expected) | MockItemsSource | [inline]
ValidateGetSizeCalls(int expectedCallCount) | MockItemsSource | [inline]
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: dll/MUXControlsFactory.cpp Source File

  • dll

MUXControlsFactory.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "XamlMetadataProvider.h"
00007 #include "MUXControlsFactory.h"
00008
00009 #ifdef MATERIALS_INCLUDED
00010 #ifdef MUX_PRERELEASE
00011 #include "RevealBrush.h"
00012 #endif
00013 #endif
00014
00015 #include "XamlControlsXamlMetaDataProvider.g.cpp"
00016
00017 bool MUXControlsFactory::s_initialized{ false };
00018
00019 void MUXControlsFactory::EnsureInitialized()
00020 {
00021     if (!s_initialized)
00022     {
00023         // Need to register here the DPs of types which are not referenced in our XAML but whose attached properties are.
00024 #ifdef MATERIALS_INCLUDED
00025 #ifdef MUX_PRERELEASE
00026         RevealBrush::EnsureProperties();
00027 #endif
00028 #endif
00029         s_initialized = true;
00030     }
00031 }
00032
00033 void MUXControlsFactory::VerifyInitialized()
00034 {
00035     if (!s_initialized)
00036     {
00037         throw winrt::hresult_error(E_FAIL, L"ERROR: You must put an instance of " MUXCONTROLSROOT_NAMESPACE_STR ".XamlControlsResources in your Application.Resources.MergedDictionaries.");
00038     }
00039 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/RevealBorderLight.cpp Source File

  • Lights

RevealBorderLight.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "RevealBorderLight.h"
00007 #include "IsTargetDPHelper.h"
00008 #include "SpotLightStateHelper.h"
00009 #include "MaterialHelper.h"
00010
00011 // HookupWindowPointerHandlers makes use of CoreWindow's PointerMoved/PointerReleased/PointerCaptureLost events,
00012 // which pass a PointerEventArgs that contains a Windows::UI::Input::PointerPoint, as opposed to a PointerRoutedEventArgs
00013 // that contains a Microsoft::UI::Input::PointerPoint. The wui::PointerPoint still references types in the
00014 // Windows::Device::Input namespace.
00015 #include <winrt/Windows.Devices.Input.h>
00016
00017 #pragma warning(push)
00018 #pragma warning(disable: 6101)  // Returning uninitialized memory '<value>'.  A successful path through the function does not set the named _Out_ parameter.
00019 #include "Microsoft.UI.Private.Composition.Effects_impl.h"
00020 #pragma warning(pop)
00021
00022 #include "RevealBorderLight.properties.cpp"
00023
00024 static constexpr RevealBorderSpotlightStateDesc s_revealBorderSpotlightState
00025 {
00026     // SpotlightProperty, PropertyName, Value
00027     { SpotlightProperty::ConstantAttenuation    , L"ConstantAttenuation"    , 1.f },                     // ConstantAttenuation
00028     { SpotlightProperty::LinearAttenuation      , L"LinearAttenuation"      , 3.f },                     // LinearAttenuation
00029     { SpotlightProperty::InnerConeAngleInDegrees, L"InnerConeAngleInDegrees", 0.f },                     // InnerConeAngleInDegrees
00030     { SpotlightProperty::InnerConeColor         , L"InnerConeColor"         ,{ 255, 255, 255, 255 } },   // InnerConeColor
00031     { SpotlightProperty::OuterConeAngleInDegrees, L"OuterConeAngleInDegrees", 16.94532f },               // OuterConeAngleInDegrees
00032     { SpotlightProperty::OuterConeColor         , L"OuterConeColor"         ,{ 255, 255, 255, 255 } },   // OuterConeColor
00033     { SpotlightProperty::Height                 , L"SpotlightHeight"        , 128.f },                   // Height
00034     { SpotlightProperty::OuterAngleScale        , L"OuterAngleScale"        , 1.f },                     // OuterAngleScale
00035 };
00036
00037 static constexpr RevealBorderSpotlightStateDesc s_revealBorderSpotlightStateWide
00038 {
00039     // SpotlightProperty, PropertyName, Value
00040     { SpotlightProperty::ConstantAttenuation    , L"ConstantAttenuation"    , 1.f },                     // ConstantAttenuation
00041     { SpotlightProperty::LinearAttenuation      , L"LinearAttenuation"      , 0.5f },                    // LinearAttenuation
00042     { SpotlightProperty::InnerConeAngleInDegrees, L"InnerConeAngleInDegrees", 0.f },                     // InnerConeAngleInDegrees
00043     { SpotlightProperty::InnerConeColor         , L"InnerConeColor"         ,{ 255, 255, 255, 255 } },   // InnerConeColor
00044     { SpotlightProperty::OuterConeAngleInDegrees, L"OuterConeAngleInDegrees", 16.7403f },                // OuterConeAngleInDegrees
00045     { SpotlightProperty::OuterConeColor         , L"OuterConeColor"         ,{ 255, 255, 255, 255 } },   // OuterConeColor
00046     { SpotlightProperty::Height                 , L"SpotlightHeight"        , 256.f },                   // Height
00047     { SpotlightProperty::OuterAngleScale        , L"OuterAngleScale"        , 1.f },                     // OuterAngleScale
00048 };
00049
00050 static constexpr auto c_PointerOffsetExpression = L"pointer.Position + Vector3(0,0,props.SpotlightHeight)";
00051
00052 winrt::hstring& RevealBorderLight::GetLightThemeIdStatic()
00053 {
00054     static winrt::hstring s_revealBorderLightLightTheme{ MUXCONTROLSMEDIA_NAMESPACE_STR L".RevealBorderLight_LightTheme" };
00055     return s_revealBorderLightLightTheme;
00056 }
00057
00058 winrt::hstring& RevealBorderLight::GetDarkThemeIdStatic()
00059 {
00060     static winrt::hstring s_revealBorderLightDarkTheme{ MUXCONTROLSMEDIA_NAMESPACE_STR L".RevealBorderLight_DarkTheme" };
00061     return s_revealBorderLightDarkTheme;
00062 }
00063
00064 winrt::hstring RevealBorderLight::GetId()
00065 {
00066     return m_isLightTheme ? GetLightThemeIdStatic() : GetDarkThemeIdStatic();
00067 }
00068
00069 void RevealBorderLight::OnConnected(winrt::UIElement const& newElement)
00070 {
00071     m_materialPolicyChangedToken = MaterialHelper::PolicyChanged([this](auto sender, auto args) { OnMaterialPolicyStatusChanged(sender, args); });
00072
00073     m_targetElement = winrt::make_weak(newElement);
00074     if (!m_isDisabledByMaterialPolicy)
00075     {
00076         EnsureCompositionResources();
00077     }
00078 }
00079
00080 void RevealBorderLight::EnsureCompositionResources()
00081 {
00082     EnsureLocalLight();
00083 }
00084
00085 void RevealBorderLight::EnsureLocalLight()
00086 {
00087     if (!m_compositionSpotLight)
00088     {
00089         auto compositor = winrt::CompositionTarget::GetCompositorForCurrentThread();
00090         m_compositionSpotLight = compositor.CreateSpotLight();
00091         CompositionLight(m_compositionSpotLight);
00092
00093         m_colorsProxy = CreateSpotLightColorsProxy(m_compositionSpotLight);
00094         m_offsetProps = compositor.CreatePropertySet();
00095
00096         m_offsetProps.InsertScalar(L"SpotlightHeight", m_isWideLight ? s_revealBorderSpotlightStateWide.Height.Value : s_revealBorderSpotlightState.Height.Value);
00097         SetSpotLightStateImmediate(m_compositionSpotLight, m_colorsProxy, m_offsetProps, m_isWideLight ? s_revealBorderSpotlightStateWide : s_revealBorderSpotlightState);
00098
00099         HookupWindowPointerHandlers();
00100
00101         // Create an expression animation that combines the PointerPositionPropertySet pointer position and the z-depth of the light
00102         if (auto targetElement = m_targetElement.get())
00103         {
00104             m_offsetAnimation = compositor.CreateExpressionAnimation(c_PointerOffsetExpression);
00105             m_offsetAnimation.SetReferenceParameter(L"props", m_offsetProps);
00106
00107             m_pointer = winrt::ElementCompositionPreview::GetPointerPositionPropertySet(targetElement);
00108             m_offsetAnimation.SetReferenceParameter(L"pointer", m_pointer);
00109
00110             m_compositionSpotLight.StartAnimation(L"Offset", m_offsetAnimation);
00111         }
00112     }
00113 }
00114
00115 void RevealBorderLight::ReleaseCompositionResources()
00116 {
00117     ReleaseLocalLight();
00118     CompositionLight(nullptr);
00119 }
00120
00121 void RevealBorderLight::ReleaseLocalLight()
00122 {
00123     m_colorsProxy = nullptr;
00124     m_shouldLightBeOn = false;
00125     UnhookWindowPointerHandlers();
00126     if (m_compositionSpotLight)
00127     {
00128         m_compositionSpotLight.StopAnimation(L"Offset");
00129     }
00130     if (m_pointer)
00131     {
00132         m_pointer.Close();
00133         m_pointer = nullptr;
00134     }
00135     m_offsetAnimation = nullptr;
00136     m_offsetProps = nullptr;
00137     m_compositionSpotLight = nullptr;
00138 }
00139
00140
00141 void RevealBorderLight::OnDisconnected(winrt::UIElement const& /*oldElement*/)
00142 {
00143     ReleaseCompositionResources();
00144     m_targetElement = nullptr;
00145
00146     MaterialHelper::PolicyChanged(m_materialPolicyChangedToken);
00147     m_materialPolicyChangedToken.value = 0;
00148 }
00149
00150 void RevealBorderLight::OnMaterialPolicyStatusChanged(const com_ptr<MaterialHelperBase>& sender, bool isDisabledByMaterialPolicy)
00151 {
00152     // MaterialHelper::LightPolicyChangedHelper<RevealBorderLight>(this, isDisabledByMaterialPolicy); // Bug 24355584: DCPP: Reveal is disabled
00153     MaterialHelper::LightPolicyChangedHelper<RevealBorderLight>(this, true);
00154 }
00155
00156 bool RevealBorderLight::GetShouldLightBeOn()
00157 {
00158     return m_shouldLightBeOn;
00159 }
00160
00161 // Flip the light switch and toggle the expression animations that correctly size and position it (i.e. stop the animations when light is off).
00162 void RevealBorderLight::SwitchLight(bool turnOn)
00163 {
00164     if ((m_shouldLightBeOn == turnOn) ||
00165         m_isDisabledByMaterialPolicy ||
00166         !m_colorsProxy)
00167     {
00168         return;
00169     }
00170
00171     m_shouldLightBeOn = turnOn;
00172
00173     const auto animateSpotLight = [this, turnOn]()
00174     {
00175         auto animation = m_colorsProxy.Compositor().CreateScalarKeyFrameAnimation();
00176         animation.Duration(250ms);
00177         animation.InsertKeyFrame(1, turnOn ? 1.f : 0.f);
00178         m_colorsProxy.StartAnimation(L"LightIntensity", animation);
00179     };
00180
00181     // Also use the more performanant IsEnabled property if available (RS4+).
00182     auto lightWithEnabledProperty = m_compositionSpotLight.try_as<winrt::ICompositionLight3>();
00183
00184     if (turnOn)
00185     {
00186         if (lightWithEnabledProperty)
00187         {
00188             // If TurnOn animation was started while a TurnOff animation is running, the TurnOff Completed
00189             // event fires after TurnOn starts, causing IsEnabled to end up at False. Set flag to prevent this scenario here.
00190             m_setLightDisabledAfterTurnOffAnimation = false;
00191             lightWithEnabledProperty.IsEnabled(true);
00192         }
00193         animateSpotLight();
00194     }
00195     else
00196     {
00197         winrt::CompositionScopedBatch scopedBatch = winrt::CompositionTarget::GetCompositorForCurrentThread().CreateScopedBatch(winrt::CompositionBatchTypes::Animation);
00198         animateSpotLight();
00199         scopedBatch.End();
00200
00201         if (lightWithEnabledProperty)
00202         {
00203             m_setLightDisabledAfterTurnOffAnimation = true;
00204             auto strongThis = get_strong();
00205
00206             scopedBatch.Completed(
00207                 [strongThis, lightWithEnabledProperty](auto sender, auto args)
00208                 {
00209                     if (strongThis->m_setLightDisabledAfterTurnOffAnimation)
00210                     {
00211                         lightWithEnabledProperty.IsEnabled(false);
00212                         strongThis->m_setLightDisabledAfterTurnOffAnimation = false;
00213                     }
00214                 });
00215         }
00216     }
00217 }
00218
00219 void RevealBorderLight::HookupWindowPointerHandlers()
00220 {
00221     auto coreWindow = winrt::CoreWindow::GetForCurrentThread();
00222     WINRT_ASSERT(coreWindow);       // CoreWindow presence required for Reveal experience
00223     m_coreWindow = coreWindow;
00224
00225     if (m_coreWindow)
00226     {
00227         auto strongThis = get_strong();
00228
00229         // Make sure RevealBorderLight is alive and the token is valid before executing each handler's body.
00230         // Otherwise, it's possible for the handler to get invoked after we've unsubscribed from the event and the object has been destroyed.
00231         // See comments in UnhookWindowPointerHandlers() for more details.
00232         m_PointerEnteredToken = m_coreWindow.PointerEntered(
00233             [strongThis](const winrt::CoreWindow&, const::winrt::Windows::UI::Core::PointerEventArgs&)
00234             {
00235                 if (strongThis->m_PointerEnteredToken.value != 0)
00236                 {
00237                     strongThis->SwitchLight(true);
00238                 }
00239             });
00240
00241         m_PointerExitedToken = m_coreWindow.PointerExited(
00242             [strongThis](const winrt::CoreWindow&, const ::winrt::Windows::UI::Core::PointerEventArgs&)
00243             {
00244                 if (strongThis->m_PointerExitedToken.value != 0)
00245                 {
00246                     strongThis->SwitchLight(false);
00247                 }
00248             });
00249
00250         m_PointerMovedToken = m_coreWindow.PointerMoved(
00251             [strongThis](const winrt::CoreWindow&, const ::winrt::Windows::UI::Core::PointerEventArgs& args)
00252             {
00253                 if (strongThis->m_PointerMovedToken.value != 0)
00254                 {
00255                     // On PointerMoved, make sure that the border light is on, except in the following cases:
00256                     //
00257                     // 1. This is a Touch or Pen PointerMoved. This should not be necessary as we already listen for events that mark when a touch interaction starts
00258                     //    (PointerEntered/Pressed) and ends (PointerExited/Released/CaptureLost. Also, in the case of dragging items in a ListView with CanDragItems = true,
00259                     //    we get a touch PointerMoved after completing the drag, which keeps the light on at the touch point (where DManip first took over).
00260                     //
00261                     // 2. This is the first PointerMoved after a CaptureLost event we got due to DManip taking over touch or pen input (eg pan in ScrollViewer).
00262                     //    In this case, after the touch/pen interaction is complete, we occasionally get a PointerMoved on Mouse for an unknown reason.
00263                     //    Ignore this event, as it will otherwise keep the light on at the touch point (where DManip first took over).
00264                     if (args.CurrentPoint().PointerDevice().PointerDeviceType() == winrt::Devices::Input::PointerDeviceType::Mouse &&
00265                         !strongThis->m_gotPointerCaptureLostDueToDManip)
00266                     {
00267                         strongThis->SwitchLight(true);
00268                     }
00269
00270                     strongThis->m_gotPointerCaptureLostDueToDManip = false;
00271                 }
00272             });
00273
00274         m_PointerPressedToken = m_coreWindow.PointerPressed(
00275             [strongThis](const winrt::CoreWindow&, const ::winrt::Windows::UI::Core::PointerEventArgs&)
00276             {
00277                 if (strongThis->m_PointerPressedToken.value != 0)
00278                 {
00279                     strongThis->SwitchLight(true);
00280                 }
00281             });
00282
00283         m_PointerReleasedToken = m_coreWindow.PointerReleased(
00284             [strongThis](const winrt::CoreWindow&, const ::winrt::Windows::UI::Core::PointerEventArgs& args)
00285             {
00286                 if (strongThis->m_PointerReleasedToken.value != 0)
00287                 {
00288                     if (args.CurrentPoint().PointerDevice().PointerDeviceType() == winrt::Devices::Input::PointerDeviceType::Touch)
00289                     {
00290                         strongThis->SwitchLight(false);
00291                     }
00292                 }
00293             });
00294
00295         m_PointerCaptureLostToken = m_coreWindow.PointerCaptureLost(
00296             [strongThis](const winrt::CoreWindow&, const ::winrt::Windows::UI::Core::PointerEventArgs& args)
00297             {
00298                 if (strongThis->m_PointerCaptureLostToken.value != 0)
00299                 {
00300                     strongThis->SwitchLight(false);
00301
00302                     if (args.CurrentPoint().PointerDevice().PointerDeviceType() == winrt::Devices::Input::PointerDeviceType::Pen ||
00303                         args.CurrentPoint().PointerDevice().PointerDeviceType() == winrt::Devices::Input::PointerDeviceType::Touch)
00304                     {
00305                         strongThis->m_gotPointerCaptureLostDueToDManip = true;
00306                     }
00307                 }
00308             });
00309     }
00310 }
00311
00312 void RevealBorderLight::UnhookWindowPointerHandlers()
00313 {
00314     if (m_coreWindow)
00315     {
00316         // It's possible for UnhookWindowPointerHandlers() to be called while handling another CoreWindow.PointerExited.
00317         // In this case, CoreWindow's list of handlers is locked and the scheduled PointerExited will fire even after beig unsubscribed.
00318         // Clear the token after unregistering so any suuch callbacks can be ignored.
00319         if (m_PointerEnteredToken.value != 0)
00320         {
00321             m_coreWindow.PointerEntered(m_PointerEnteredToken);
00322             m_PointerEnteredToken.value = 0;
00323         }
00324
00325         if (m_PointerExitedToken.value != 0)
00326         {
00327             m_coreWindow.PointerExited(m_PointerExitedToken);
00328             m_PointerExitedToken.value = 0;
00329         }
00330
00331         if (m_PointerMovedToken.value != 0)
00332         {
00333             m_coreWindow.PointerMoved(m_PointerMovedToken);
00334             m_PointerMovedToken.value = 0;
00335         }
00336
00337         if (m_PointerPressedToken.value != 0)
00338         {
00339             m_coreWindow.PointerPressed(m_PointerPressedToken);
00340             m_PointerPressedToken.value = 0;
00341         }
00342
00343         if (m_PointerReleasedToken.value != 0)
00344         {
00345             m_coreWindow.PointerReleased(m_PointerReleasedToken);
00346             m_PointerReleasedToken.value = 0;
00347         }
00348
00349         if (m_PointerCaptureLostToken.value != 0)
00350         {
00351             m_coreWindow.PointerCaptureLost(m_PointerCaptureLostToken);
00352             m_PointerCaptureLostToken.value = 0;
00353         }
00354
00355         m_coreWindow = nullptr;
00356     }
00357 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RadialItemCollectionTransitionProvider Member List

This is the complete list of members for RadialItemCollectionTransitionProvider, including all inherited members.
_animationSlowdownFactor | RadialItemCollectionTransitionProvider | [private, static]
abi_enter() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
AnimateOffset(Visual visual, Compositor compositor, Rect oldBounds, Rect newBounds) | RadialItemCollectionTransitionProvider | [inline, private, static]
AnimationSlowdownFactor | RadialItemCollectionTransitionProvider | [static]
CheckThread() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
ClearProperties() | ItemCollectionTransitionProviderProperties | [static]
DefaultAnimationDurationInMs | RadialItemCollectionTransitionProvider | [private]
DeleteInstanceOnUIThread(std::unique_ptr< ItemCollectionTransitionProvider > &&self) noexcept | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline, static]
EnsureProperties() | ItemCollectionTransitionProviderProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
final_release(std::unique_ptr< ItemCollectionTransitionProvider > &&self) | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
GetInner() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
IsOnThread() | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
ItemCollectionTransitionProviderProperties() | ItemCollectionTransitionProviderProperties |
m_transitionCompletedEventSource | ItemCollectionTransitionProviderProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
NotifyTransitionCompleted(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionProvider |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
QueueTransition(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionProvider |
ReferenceTracker(Args &&...args) | ReferenceTracker< ItemCollectionTransitionProvider, winrt::implementation::ItemCollectionTransitionProviderT, winrt::composing, winrt::composable > | [inline]
ShouldAnimate(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionProvider |
ShouldAnimateCore(ItemCollectionTransition transition) | RadialItemCollectionTransitionProvider | [inline, protected]
ItemCollectionTransitionProvider::ShouldAnimateCore(winrt::ItemCollectionTransition const &transition) | ItemCollectionTransitionProvider | [virtual]
StartAddTransitions(IList< ItemCollectionTransition > transitions) | RadialItemCollectionTransitionProvider | [inline, private, static]
StartMoveTransitions(IList< ItemCollectionTransition > transitions) | RadialItemCollectionTransitionProvider | [inline, private, static]
StartRemoveTransitions(IList< ItemCollectionTransition > transitions) | RadialItemCollectionTransitionProvider | [inline, private, static]
StartTransitions(IList< ItemCollectionTransition > transitions) | RadialItemCollectionTransitionProvider | [inline, protected]
ItemCollectionTransitionProvider::StartTransitions(winrt::IVector< winrt::ItemCollectionTransition > const &transitions) | ItemCollectionTransitionProvider | [virtual]
TransitionCompleted(winrt::TypedEventHandler< winrt::ItemCollectionTransitionProvider, winrt::ItemCollectionTransitionCompletedEventArgs > const &value) | ItemCollectionTransitionProviderProperties |
TransitionCompleted(winrt::event_token const &token) | ItemCollectionTransitionProviderProperties |
~ItemCollectionTransitionProvider() | ItemCollectionTransitionProvider |
Generated on Sun Dec 1 2024 20:54:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioButtons/RadioButtonsPrimitives.idl Source File

  • RadioButtons

RadioButtonsPrimitives.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XCP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 [default_interface]
00007 unsealed runtimeclass ColumnMajorUniformToLargestGridLayout : MU_XC_NAMESPACE.NonVirtualizingLayout
00008 {
00009     ColumnMajorUniformToLargestGridLayout();
00010
00011     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00012     [MUX_PROPERTY_VALIDATION_CALLBACK("ValidateGreaterThanZero")]
00013     Int32 MaxColumns{ get; set; };
00014     static Microsoft.UI.Xaml.DependencyProperty MaxColumnsProperty{ get; };
00015
00016     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00017     Double ColumnSpacing{ get; set; };
00018     static Microsoft.UI.Xaml.DependencyProperty ColumnSpacingProperty{ get; };
00019
00020     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00021     Double RowSpacing{ get; set; };
00022     static Microsoft.UI.Xaml.DependencyProperty RowSpacingProperty{ get; };
00023 }
00024
00025 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemContainer/InteractionTests/ItemContainerTests.cs Source File

  • ItemContainer
  • InteractionTests

ItemContainerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00008 using System.Collections.Generic;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation;
00016 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00017 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00018 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00019 using Windows.Media.Core;
00020
00021 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00022 {
00023     [TestClass]
00024     public class ItemContainerTests
00025     {
00026         [ClassInitialize]
00027         [TestProperty("RunAs", "User")]
00028         [TestProperty("Classification", "Integration")]
00029         [TestProperty("Platform", "Any")]
00030         [TestProperty("MUXControlsTestSuite", "SuiteB")]
00031         public static void ClassInitialize(TestContext testContext)
00032         {
00033             TestEnvironment.Initialize(testContext);
00034         }
00035
00036         public void TestCleanup()
00037         {
00038             TestCleanupHelper.Cleanup();
00039         }
00040
00041 #if MUX_PRERELEASE
00042         [TestMethod]
00043         [TestProperty("Description", "Verify ItemInvoked via mouse")]
00044         [TestProperty("Ignore", "True")] // Bug 45606616
00045         public void ItemContainerSelectionMouse()
00046         {
00047             using (var setup = new TestSetupHelper(new[] { "ItemContainer Tests", "navigateToSummary" }))
00048             {
00049                 Log.Comment("Retrieving RoutedEventsItemContainer");
00050                 var routedEventsItemContainer = FindElement.ById("RoutedEventsItemContainer");
00051                 Verify.IsNotNull(routedEventsItemContainer, "Verifying that RoutedEventsItemContainer was found");
00052
00053                 InputHelper.LeftClick(routedEventsItemContainer);
00054
00055                 Verify.AreEqual(IsItemContainerSelected(), "True");
00056             }
00057         }
00058
00059         [TestMethod]
00060         [TestProperty("Ignore", "True")] // Bug 45606616
00061         [TestProperty("Description", "Verify ItemInvoked via tap")]
00062         public void ItemContainerSelectionTap()
00063         {
00064             using (var setup = new TestSetupHelper(new[] { "ItemContainer Tests", "navigateToSummary" }))
00065             {
00066                 Log.Comment("Retrieving RoutedEventsItemContainer");
00067                 var routedEventsItemContainer = FindElement.ById("RoutedEventsItemContainer");
00068                 Verify.IsNotNull(routedEventsItemContainer, "Verifying that RoutedEventsItemContainer was found");
00069
00070                 InputHelper.Tap(routedEventsItemContainer);
00071
00072                 Verify.AreEqual(IsItemContainerSelected(), "True");
00073             }
00074         }
00075
00076         [TestMethod]
00077         [TestProperty("Description", "Verify ItemInvoked via Enter key")]
00078         [TestProperty("Ignore", "True")] // Bug 45606616
00079         public void ItemContainerSelectionEnterKey()
00080         {
00081             using (var setup = new TestSetupHelper(new[] { "ItemContainer Tests", "navigateToSummary" }))
00082             {
00083                 Log.Comment("Retrieving RoutedEventsItemContainer");
00084                 var routedEventsItemContainer = FindElement.ById("RoutedEventsItemContainer");
00085                 Verify.IsNotNull(routedEventsItemContainer, "Verifying that RoutedEventsItemContainer was found");
00086
00087                 routedEventsItemContainer.SetFocus();
00088
00089                 KeyboardHelper.PressKey(Key.Enter);
00090
00091                 Verify.AreEqual(IsItemContainerSelected(), "True");
00092             }
00093         }
00094
00095         [TestMethod]
00096         [TestProperty("Description", "Verify ItemInvoked via Space key")]
00097         [TestProperty("Ignore", "True")] // Bug 45606616
00098         public void ItemContainerSelectionSpaceKey()
00099         {
00100             using (var setup = new TestSetupHelper(new[] { "ItemContainer Tests", "navigateToSummary" }))
00101             {
00102                 Log.Comment("Retrieving RoutedEventsItemContainer");
00103                 var routedEventsItemContainer = FindElement.ById("RoutedEventsItemContainer");
00104                 Verify.IsNotNull(routedEventsItemContainer, "Verifying that RoutedEventsItemContainer was found");
00105
00106                 routedEventsItemContainer.SetFocus();
00107
00108                 KeyboardHelper.PressKey(Key.Space);
00109
00110                 Verify.AreEqual(IsItemContainerSelected(), "True");
00111             }
00112         }
00113 #endif
00114
00115         [TestMethod]
00116         [TestProperty("Description", "Verify CanUserSelect == UserCannotSelect disabled selection")]
00117         public void ItemContainerCanUserSelect()
00118         {
00119             using (var setup = new TestSetupHelper(new[] { "ItemContainer Tests", "navigateToSummary" }))
00120             {
00121                 Log.Comment("Retrieving RoutedEventsItemContainer");
00122                 var routedEventsItemContainer = FindElement.ById("RoutedEventsItemContainer");
00123                 Verify.IsNotNull(routedEventsItemContainer, "Verifying that RoutedEventsItemContainer was found");
00124
00125                 Log.Comment("Retrieving CanUserSelectComboBox");
00126                 ComboBox canUserSelectComboBox = new ComboBox(FindElement.ById("CanUserSelectComboBox"));
00127                 Verify.IsNotNull(canUserSelectComboBox, "Verifying that CanUserSelectComboBox was found");
00128
00129                 Log.Comment("Changing CanUserSelectComboBox selection to 'UserCannotSelect'");
00130                 canUserSelectComboBox.SelectItemByName("UserCannotSelect");
00131                 Log.Comment("Selection is now {0}", canUserSelectComboBox.Selection[0].Name);
00132
00133                 InputHelper.LeftClick(routedEventsItemContainer);
00134
00135                 Verify.AreEqual(IsItemContainerSelected(), "False");
00136             }
00137         }
00138
00139         private string IsItemContainerSelected()
00140         {
00141             Log.Comment("Retrieving btnGetIsSelected");
00142             Button btnGetIsSelected = new Button(FindElement.ById("btnGetIsSelected"));
00143             Verify.IsNotNull(btnGetIsSelected, "Verifying that btnGetIsSelected was found");
00144
00145             Log.Comment("Retrieving IsSelectedTextBlock");
00146             Edit isSelectedTextBlock = new Edit(FindElement.ById("IsSelectedTextBlock"));
00147             Verify.IsNotNull(isSelectedTextBlock, "Verifying that IsSelectedTextBlock was found");
00148
00149             btnGetIsSelected.Invoke();
00150             Wait.ForIdle();
00151
00152             return isSelectedTextBlock.GetText();
00153         }
00154     }
00155 }
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AnimatedIcon.properties.cpp Source File

  • Generated

AnimatedIcon.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "AnimatedIcon.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(AnimatedIcon)
00012 }
00013
00014 #include "AnimatedIcon.g.cpp"
00015
00016 GlobalDependencyProperty AnimatedIconProperties::s_FallbackIconSourceProperty{ nullptr };
00017 GlobalDependencyProperty AnimatedIconProperties::s_MirroredWhenRightToLeftProperty{ nullptr };
00018 GlobalDependencyProperty AnimatedIconProperties::s_SourceProperty{ nullptr };
00019 GlobalDependencyProperty AnimatedIconProperties::s_StateProperty{ nullptr };
00020
00021 AnimatedIconProperties::AnimatedIconProperties()
00022 {
00023     EnsureProperties();
00024 }
00025
00026 void AnimatedIconProperties::EnsureProperties()
00027 {
00028     if (!s_FallbackIconSourceProperty)
00029     {
00030         s_FallbackIconSourceProperty =
00031             InitializeDependencyProperty(
00032                 L"FallbackIconSource",
00033                 winrt::name_of<winrt::IconSource>(),
00034                 winrt::name_of<winrt::AnimatedIcon>(),
00035                 false /* isAttached */,
00036                 ValueHelper<winrt::IconSource>::BoxedDefaultValue(),
00037                 winrt::PropertyChangedCallback(&OnFallbackIconSourcePropertyChanged));
00038     }
00039     if (!s_MirroredWhenRightToLeftProperty)
00040     {
00041         s_MirroredWhenRightToLeftProperty =
00042             InitializeDependencyProperty(
00043                 L"MirroredWhenRightToLeft",
00044                 winrt::name_of<bool>(),
00045                 winrt::name_of<winrt::AnimatedIcon>(),
00046                 false /* isAttached */,
00047                 ValueHelper<bool>::BoxedDefaultValue(),
00048                 winrt::PropertyChangedCallback(&OnMirroredWhenRightToLeftPropertyChanged));
00049     }
00050     if (!s_SourceProperty)
00051     {
00052         s_SourceProperty =
00053             InitializeDependencyProperty(
00054                 L"Source",
00055                 winrt::name_of<winrt::IAnimatedVisualSource2>(),
00056                 winrt::name_of<winrt::AnimatedIcon>(),
00057                 false /* isAttached */,
00058                 ValueHelper<winrt::IAnimatedVisualSource2>::BoxedDefaultValue(),
00059                 winrt::PropertyChangedCallback(&OnSourcePropertyChanged));
00060     }
00061     if (!s_StateProperty)
00062     {
00063         s_StateProperty =
00064             InitializeDependencyProperty(
00065                 L"State",
00066                 winrt::name_of<winrt::hstring>(),
00067                 winrt::name_of<winrt::AnimatedIcon>(),
00068                 true /* isAttached */,
00069                 ValueHelper<winrt::hstring>::BoxedDefaultValue(),
00070                 &AnimatedIcon::OnAnimatedIconStatePropertyChanged);
00071     }
00072 }
00073
00074 void AnimatedIconProperties::ClearProperties()
00075 {
00076     s_FallbackIconSourceProperty = nullptr;
00077     s_MirroredWhenRightToLeftProperty = nullptr;
00078     s_SourceProperty = nullptr;
00079     s_StateProperty = nullptr;
00080 }
00081
00082 void AnimatedIconProperties::OnFallbackIconSourcePropertyChanged(
00083     winrt::DependencyObject const& sender,
00084     winrt::DependencyPropertyChangedEventArgs const& args)
00085 {
00086     auto owner = sender.as<winrt::AnimatedIcon>();
00087     winrt::get_self<AnimatedIcon>(owner)->OnFallbackIconSourcePropertyChanged(args);
00088 }
00089
00090 void AnimatedIconProperties::OnMirroredWhenRightToLeftPropertyChanged(
00091     winrt::DependencyObject const& sender,
00092     winrt::DependencyPropertyChangedEventArgs const& args)
00093 {
00094     auto owner = sender.as<winrt::AnimatedIcon>();
00095     winrt::get_self<AnimatedIcon>(owner)->OnMirroredWhenRightToLeftPropertyChanged(args);
00096 }
00097
00098 void AnimatedIconProperties::OnSourcePropertyChanged(
00099     winrt::DependencyObject const& sender,
00100     winrt::DependencyPropertyChangedEventArgs const& args)
00101 {
00102     auto owner = sender.as<winrt::AnimatedIcon>();
00103     winrt::get_self<AnimatedIcon>(owner)->OnSourcePropertyChanged(args);
00104 }
00105
00106 void AnimatedIconProperties::FallbackIconSource(winrt::IconSource const& value)
00107 {
00108     [[gsl::suppress(con)]]
00109     {
00110     static_cast<AnimatedIcon*>(this)->SetValue(s_FallbackIconSourceProperty, ValueHelper<winrt::IconSource>::BoxValueIfNecessary(value));
00111     }
00112 }
00113
00114 winrt::IconSource AnimatedIconProperties::FallbackIconSource()
00115 {
00116     return ValueHelper<winrt::IconSource>::CastOrUnbox(static_cast<AnimatedIcon*>(this)->GetValue(s_FallbackIconSourceProperty));
00117 }
00118
00119 void AnimatedIconProperties::MirroredWhenRightToLeft(bool value)
00120 {
00121     [[gsl::suppress(con)]]
00122     {
00123     static_cast<AnimatedIcon*>(this)->SetValue(s_MirroredWhenRightToLeftProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00124     }
00125 }
00126
00127 bool AnimatedIconProperties::MirroredWhenRightToLeft()
00128 {
00129     return ValueHelper<bool>::CastOrUnbox(static_cast<AnimatedIcon*>(this)->GetValue(s_MirroredWhenRightToLeftProperty));
00130 }
00131
00132 void AnimatedIconProperties::Source(winrt::IAnimatedVisualSource2 const& value)
00133 {
00134     [[gsl::suppress(con)]]
00135     {
00136     static_cast<AnimatedIcon*>(this)->SetValue(s_SourceProperty, ValueHelper<winrt::IAnimatedVisualSource2>::BoxValueIfNecessary(value));
00137     }
00138 }
00139
00140 winrt::IAnimatedVisualSource2 AnimatedIconProperties::Source()
00141 {
00142     return ValueHelper<winrt::IAnimatedVisualSource2>::CastOrUnbox(static_cast<AnimatedIcon*>(this)->GetValue(s_SourceProperty));
00143 }
00144
00145
00146 void AnimatedIconProperties::SetState(winrt::DependencyObject const& target, winrt::hstring const& value)
00147 {
00148     target.SetValue(s_StateProperty, ValueHelper<winrt::hstring>::BoxValueIfNecessary(value));
00149 }
00150
00151 winrt::hstring AnimatedIconProperties::GetState(winrt::DependencyObject const& target)
00152 {
00153     return ValueHelper<winrt::hstring>::CastOrUnbox(target.GetValue(s_StateProperty));
00154 }
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PagerControlTests Member List

This is the complete list of members for PagerControlTests, including all inherited members.
VerifyAutomationPeerBehavior() | PagerControlTests | [inline]
VerifyComboBoxItemsInfiniteItems() | PagerControlTests | [inline]
VerifyComboBoxItemsListNormal() | PagerControlTests | [inline]
VerifyEmptyPagerDoesNotCrash() | PagerControlTests | [inline]
VerifyNumberPanelButtonUIABehavior() | PagerControlTests | [inline]
VerifySelectedIndexChangedEventArgs() | PagerControlTests | [inline]
Generated on Sun Dec 1 2024 20:53:35 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemPresenter.cpp Source File

  • NavigationView

NavigationViewItemPresenter.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "NavigationViewItemPresenter.h"
00007 #include "NavigationViewItem.h"
00008 #include "SharedHelpers.h"
00009
00010 static constexpr auto c_contentGrid = L"PresenterContentRootGrid"sv;
00011 static constexpr auto c_infoBadgePresenter = L"InfoBadgePresenter"sv;
00012 static constexpr auto c_expandCollapseChevron = L"ExpandCollapseChevron"sv;
00013 static constexpr auto c_expandCollapseRotateExpandedStoryboard = L"ExpandCollapseRotateExpandedStoryboard"sv;
00014 static constexpr auto c_expandCollapseRotateCollapsedStoryboard = L"ExpandCollapseRotateCollapsedStoryboard"sv;
00015
00016 NavigationViewItemPresenter::NavigationViewItemPresenter()
00017 {
00018     SetValue(s_TemplateSettingsProperty, winrt::make<::NavigationViewItemPresenterTemplateSettings>());
00019     SetDefaultStyleKey(this);
00020 }
00021
00022 void NavigationViewItemPresenter::UnhookEventsAndClearFields()
00023 {
00024     m_expandCollapseChevronPointerPressedRevoker.revoke();
00025     m_expandCollapseChevronPointerReleasedRevoker.revoke();
00026     m_expandCollapseChevronPointerExitedRevoker.revoke();
00027     m_expandCollapseChevronPointerCanceledRevoker.revoke();
00028     m_expandCollapseChevronPointerCaptureLostRevoker.revoke();
00029
00030     m_contentGrid.set(nullptr);
00031     m_infoBadgePresenter.set(nullptr);
00032     m_expandCollapseChevron.set(nullptr);
00033     m_chevronExpandedStoryboard.set(nullptr);
00034     m_chevronCollapsedStoryboard.set(nullptr);
00035
00036     m_isChevronPressed = false;
00037 }
00038
00039 void NavigationViewItemPresenter::OnApplyTemplate()
00040 {
00041     winrt::IControlProtected controlProtected = *this;
00042
00043     // Retrieve pointers to stable controls
00044     m_helper.Init(*this);
00045
00046     UnhookEventsAndClearFields();
00047
00048     if (auto contentGrid = GetTemplateChildT<winrt::Grid>(c_contentGrid, *this))
00049     {
00050         m_contentGrid.set(contentGrid);
00051     }
00052
00053     m_infoBadgePresenter.set(GetTemplateChildT<winrt::ContentPresenter>(c_infoBadgePresenter, controlProtected));
00054
00055     if (auto navigationViewItem = GetNavigationViewItem())
00056     {
00057         if (navigationViewItem->HasPotentialChildren())
00058         {
00059             LoadChevron();
00060         }
00061         navigationViewItem->UpdateVisualStateNoTransition();
00062
00063         // We probably switched displaymode, so restore width now, otherwise the next time we will restore is when the CompactPaneLength changes
00064         if (const auto&& navigationView = navigationViewItem->GetNavigationView())
00065         {
00066             if (navigationView.PaneDisplayMode() != winrt::NavigationViewPaneDisplayMode::Top)
00067             {
00068                 UpdateCompactPaneLength(m_compactPaneLengthValue, true);
00069             }
00070         }
00071     }
00072
00073     m_chevronExpandedStoryboard.set(GetTemplateChildT<winrt::Storyboard>(c_expandCollapseRotateExpandedStoryboard, *this));
00074     m_chevronCollapsedStoryboard.set(GetTemplateChildT<winrt::Storyboard>(c_expandCollapseRotateCollapsedStoryboard, *this));
00075
00076     UpdateMargin();
00077 }
00078
00079 void NavigationViewItemPresenter::LoadChevron()
00080 {
00081     if (!m_expandCollapseChevron)
00082     {
00083         if (auto navigationViewItem = GetNavigationViewItem())
00084         {
00085             if (auto const expandCollapseChevron = GetTemplateChildT<winrt::Grid>(c_expandCollapseChevron, *this))
00086             {
00087                 m_expandCollapseChevron.set(expandCollapseChevron);
00088
00089                 m_expandCollapseChevronPointerPressedRevoker = expandCollapseChevron.PointerPressed(winrt::auto_revoke, { this, &NavigationViewItemPresenter::OnExpandCollapseChevronPointerPressed });
00090                 m_expandCollapseChevronPointerReleasedRevoker = expandCollapseChevron.PointerReleased(winrt::auto_revoke, { this, &NavigationViewItemPresenter::OnExpandCollapseChevronPointerReleased });
00091
00092                 m_expandCollapseChevronPointerCanceledRevoker = AddRoutedEventHandler<RoutedEventType::PointerCanceled>(
00093                     *this,
00094                     { this, &NavigationViewItemPresenter::OnExpandCollapseChevronPointerCanceled },
00095                     true /*handledEventsToo*/);
00096
00097                 m_expandCollapseChevronPointerExitedRevoker = AddRoutedEventHandler<RoutedEventType::PointerExited>(
00098                     *this,
00099                     { this, &NavigationViewItemPresenter::OnExpandCollapseChevronPointerExited },
00100                     true /*handledEventsToo*/);
00101
00102                 m_expandCollapseChevronPointerCaptureLostRevoker = AddRoutedEventHandler<RoutedEventType::PointerCaptureLost>(
00103                     *this,
00104                     { this, &NavigationViewItemPresenter::OnExpandCollapseChevronPointerCaptureLost },
00105                     true /*handledEventsToo*/);
00106             }
00107         }
00108     }
00109 }
00110
00111
00112 void NavigationViewItemPresenter::ResetTrackedPointerId()
00113 {
00114     m_trackedPointerId = 0;
00115 }
00116
00117 // Returns False when the provided pointer Id matches the currently tracked Id.
00118 // When there is no currently tracked Id, sets the tracked Id to the provided Id and returns False.
00119 // Returns True when the provided pointer Id does not match the currently tracked Id.
00120 bool NavigationViewItemPresenter::IgnorePointerId(const winrt::PointerRoutedEventArgs& args)
00121 {
00122     uint32_t pointerId = args.Pointer().PointerId();
00123
00124     if (m_trackedPointerId == 0)
00125     {
00126         m_trackedPointerId = pointerId;
00127     }
00128     else if (m_trackedPointerId != pointerId)
00129     {
00130         return true;
00131     }
00132     return false;
00133 }
00134
00135 void NavigationViewItemPresenter::OnExpandCollapseChevronPointerPressed(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00136 {
00137     const bool ignorePointerId = IgnorePointerId(args);
00138     const auto pointerProperties = args.GetCurrentPoint(*this).Properties();
00139     if (ignorePointerId ||
00140         !pointerProperties.IsLeftButtonPressed() ||
00141         args.Handled())
00142     {
00143         // We are only interested in the primary action of the pointer device
00144         // (e.g. left click of a mouse)
00145     // Despite the name, IsLeftButtonPressed covers the primary action regardless of device.
00146         return;
00147     }
00148
00149     m_isChevronPressed = true;
00150     args.Handled(true);
00151 }
00152
00153 void NavigationViewItemPresenter::OnExpandCollapseChevronPointerReleased(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00154 {
00155     if (IgnorePointerId(args))
00156     {
00157         return;
00158     }
00159
00160     const auto navigationViewItem = GetNavigationViewItem();
00161     const auto pointerProperties = args.GetCurrentPoint(*this).Properties();
00162     if (!args.Handled() &&
00163         m_isChevronPressed &&
00164         pointerProperties.PointerUpdateKind() == winrt::PointerUpdateKind::LeftButtonReleased &&
00165         navigationViewItem)
00166     {
00167         navigationViewItem->OnExpandCollapseChevronPointerReleased();
00168         args.Handled(true);
00169     }
00170
00171     m_isChevronPressed = false;
00172     ResetTrackedPointerId();
00173 }
00174
00175 void NavigationViewItemPresenter::OnExpandCollapseChevronPointerCanceled(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00176 {
00177     if (IgnorePointerId(args))
00178     {
00179         return;
00180     }
00181
00182     m_isChevronPressed = false;
00183     ResetTrackedPointerId();
00184 }
00185
00186 void NavigationViewItemPresenter::OnExpandCollapseChevronPointerExited(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00187 {
00188     if (IgnorePointerId(args))
00189     {
00190         return;
00191     }
00192
00193     m_isChevronPressed = false;
00194     ResetTrackedPointerId();
00195 }
00196
00197 void NavigationViewItemPresenter::OnExpandCollapseChevronPointerCaptureLost(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args)
00198 {
00199     if (IgnorePointerId(args))
00200     {
00201         return;
00202     }
00203
00204     m_isChevronPressed = false;
00205     ResetTrackedPointerId();
00206 }
00207
00208 void NavigationViewItemPresenter::RotateExpandCollapseChevron(bool isExpanded)
00209 {
00210     if (isExpanded)
00211     {
00212         if (auto const openStoryboard = m_chevronExpandedStoryboard.get())
00213         {
00214             openStoryboard.Begin();
00215         }
00216     }
00217     else
00218     {
00219         if (auto const closedStoryboard = m_chevronCollapsedStoryboard.get())
00220         {
00221             closedStoryboard.Begin();
00222         }
00223     }
00224 }
00225
00226 winrt::UIElement NavigationViewItemPresenter::GetSelectionIndicator()
00227 {
00228     return m_helper.GetSelectionIndicator();
00229 }
00230
00231 bool NavigationViewItemPresenter::GoToElementStateCore(winrt::hstring const& state, bool useTransitions)
00232 {
00233     // GoToElementStateCore: Update visualstate for itself.
00234     // VisualStateManager::GoToState: update visualstate for it's first child.
00235
00236     // If NavigationViewItemPresenter is used, two sets of VisualStateGroups are supported. One set is help to switch the style and it's NavigationViewItemPresenter itself and defined in NavigationViewItem
00237     // Another set is defined in style for NavigationViewItemPresenter.
00238     // OnLeftNavigation, OnTopNavigationPrimary, OnTopNavigationOverflow only apply to itself.
00239     if (state == c_OnLeftNavigation || state == c_OnLeftNavigationReveal || state == c_OnTopNavigationPrimary
00240         || state == c_OnTopNavigationPrimaryReveal || state == c_OnTopNavigationOverflow)
00241     {
00242         if (auto const infoBadgePresenter = m_infoBadgePresenter.get())
00243         {
00244             infoBadgePresenter.Content(nullptr);
00245         }
00246         return __super::GoToElementStateCore(state, useTransitions);
00247     }
00248     return winrt::VisualStateManager::GoToState(*this, state, useTransitions);
00249 }
00250
00251 NavigationViewItem* NavigationViewItemPresenter::GetNavigationViewItem()
00252 {
00253     NavigationViewItem* navigationViewItem = nullptr;
00254
00255     winrt::DependencyObject obj = operator winrt::DependencyObject();
00256
00257     if (auto item = SharedHelpers::GetAncestorOfType<winrt::NavigationViewItem>(winrt::VisualTreeHelper::GetParent(obj)))
00258     {
00259         navigationViewItem = winrt::get_self<NavigationViewItem>(item);
00260     }
00261     return navigationViewItem;
00262 }
00263
00264 void NavigationViewItemPresenter::UpdateContentLeftIndentation(double leftIndentation)
00265 {
00266     m_leftIndentation = leftIndentation;
00267     UpdateMargin();
00268 }
00269
00270 void NavigationViewItemPresenter::UpdateMargin()
00271 {
00272     if (auto const grid = m_contentGrid.get())
00273     {
00274         auto const oldGridMargin = grid.Margin();
00275         grid.Margin({ m_leftIndentation, oldGridMargin.Top, oldGridMargin.Right, oldGridMargin.Bottom });
00276     }
00277 }
00278
00279 void NavigationViewItemPresenter::UpdateCompactPaneLength(double compactPaneLength, bool shouldUpdate)
00280 {
00281     m_compactPaneLengthValue = compactPaneLength;
00282
00283     if (shouldUpdate)
00284     {
00285         const auto templateSettings = winrt::get_self<NavigationViewItemPresenterTemplateSettings>(TemplateSettings());
00286         const auto gridLength = compactPaneLength;
00287
00288         templateSettings->IconWidth(gridLength);
00289         templateSettings->SmallerIconWidth(std::max(0.0, gridLength - 8));
00290     }
00291 }
00292
00293 void NavigationViewItemPresenter::UpdateClosedCompactVisualState(bool isTopLevelItem, bool isClosedCompact)
00294 {
00295     // We increased the ContentPresenter margin to align it visually with the expand/collapse chevron. This updated margin is even applied when the
00296     // NavigationView is in a visual state where no expand/collapse chevrons are shown, leading to more content being cut off than necessary.
00297     // This is the case for top-level items when the NavigationView is in a compact mode and the NavigationView pane is closed. To keep the original
00298     // cutoff visual experience intact, we restore  the original ContentPresenter margin for such top-level items only (children shown in a flyout
00299     // will use the updated margin).
00300     const auto stateName = isClosedCompact && isTopLevelItem
00301         ? L"ClosedCompactAndTopLevelItem"
00302         : L"NotClosedCompactAndTopLevelItem";
00303
00304     winrt::VisualStateManager::GoToState(*this, stateName, false /*useTransitions*/);
00305 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/NestedLayoutSamples/StoreDemoPage.xaml.cs Source File

  • Repeater
  • TestUI
  • Samples
  • NestedLayoutSamples

StoreDemoPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.IO;
00007 using System.Linq;
00008 using System.Runtime.InteropServices.WindowsRuntime;
00009 using Windows.Foundation;
00010 using Windows.Foundation.Collections;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Controls;
00013 using Microsoft.UI.Xaml.Controls.Primitives;
00014 using Microsoft.UI.Xaml.Data;
00015 using Microsoft.UI.Xaml.Input;
00016 using Microsoft.UI.Xaml.Media;
00017 using Microsoft.UI.Xaml.Navigation;
00018
00019 using RecyclingElementFactory = Microsoft.UI.Xaml.Controls.RecyclingElementFactory;
00020 using SelectTemplateEventArgs = Microsoft.UI.Xaml.Controls.SelectTemplateEventArgs;
00021
00022 namespace MUXControlsTestApp.Samples
00023 {
00024     public sealed partial class StoreDemoPage : Page
00025     {
00026         public StoreDemoPage()
00027         {
00028             this.InitializeComponent();
00029             var data = StoreMockData.Create(15, 10);
00030             outerRepeater.ItemsSource = data;
00031         }
00032
00033         private void OnSelectTemplateKey(RecyclingElementFactory sender, SelectTemplateEventArgs args)
00034         {
00035             args.TemplateKey = args.DataContext is Category ? "Category" : "Item";
00036         }
00037     }
00038 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TwoPaneView Member List

This is the complete list of members for TwoPaneView, including all inherited members.
abi_enter() | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
CheckThread() | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
ClearProperties() | TwoPaneViewProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< TwoPaneView > &&self) noexcept | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline, static]
EnsureProperties() | TwoPaneViewProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
final_release(std::unique_ptr< TwoPaneView > &&self) | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline, static]
GetBase() | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
GetControlRect() | TwoPaneView | [private]
GetInner() | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
IsInMultipleRegions(DisplayRegionHelperInfo info, winrt::Rect rcControl) | TwoPaneView | [private]
IsOnThread() | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
m_modeChangedEventSource | TwoPaneViewProperties |
MinTallModeHeight(double value) | TwoPaneViewProperties |
MinTallModeHeight() | TwoPaneViewProperties |
MinTallModeHeightProperty() | TwoPaneViewProperties | [inline, static]
MinWideModeWidth(double value) | TwoPaneViewProperties |
MinWideModeWidth() | TwoPaneViewProperties |
MinWideModeWidthProperty() | TwoPaneViewProperties | [inline, static]
Mode(winrt::TwoPaneViewMode const &value) | TwoPaneViewProperties |
Mode() | TwoPaneViewProperties |
ModeChanged(winrt::TypedEventHandler< winrt::TwoPaneView, winrt::IInspectable > const &value) | TwoPaneViewProperties |
ModeChanged(winrt::event_token const &token) | TwoPaneViewProperties |
ModeProperty() | TwoPaneViewProperties | [inline, static]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
OnApplyTemplate() | TwoPaneView |
OnMinTallModeHeightPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnMinWideModeWidthPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnPane1LengthPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnPane1PropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnPane2LengthPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnPane2PropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnPanePriorityPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneView |
OnScrollViewerLoaded(const winrt::IInspectable &sender, const winrt::RoutedEventArgs &args) | TwoPaneView | [private]
OnSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &args) | TwoPaneView | [private]
OnTallModeConfigurationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnWideModeConfigurationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TwoPaneViewProperties | [static]
OnXamlRootChanged(const winrt::IInspectable &sender, const winrt::Microsoft::UI::Xaml::XamlRootChangedEventArgs &args) | TwoPaneView | [private]
Pane1(winrt::UIElement const &value) | TwoPaneViewProperties |
Pane1() | TwoPaneViewProperties |
Pane1Length(winrt::GridLength const &value) | TwoPaneViewProperties |
Pane1Length() | TwoPaneViewProperties |
Pane1LengthProperty() | TwoPaneViewProperties | [inline, static]
Pane1Property() | TwoPaneViewProperties | [inline, static]
Pane2(winrt::UIElement const &value) | TwoPaneViewProperties |
Pane2() | TwoPaneViewProperties |
Pane2Length(winrt::GridLength const &value) | TwoPaneViewProperties |
Pane2Length() | TwoPaneViewProperties |
Pane2LengthProperty() | TwoPaneViewProperties | [inline, static]
Pane2Property() | TwoPaneViewProperties | [inline, static]
PanePriority(winrt::TwoPaneViewPriority const &value) | TwoPaneViewProperties |
PanePriority() | TwoPaneViewProperties |
PanePriorityProperty() | TwoPaneViewProperties | [inline, static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< TwoPaneView, winrt::implementation::TwoPaneViewT > | [inline]
s_MinTallModeHeightProperty | TwoPaneViewProperties | [static]
s_MinWideModeWidthProperty | TwoPaneViewProperties | [static]
s_ModeProperty | TwoPaneViewProperties | [static]
s_Pane1LengthProperty | TwoPaneViewProperties | [static]
s_Pane1Property | TwoPaneViewProperties | [static]
s_Pane2LengthProperty | TwoPaneViewProperties | [static]
s_Pane2Property | TwoPaneViewProperties | [static]
s_PanePriorityProperty | TwoPaneViewProperties | [static]
s_TallModeConfigurationProperty | TwoPaneViewProperties | [static]
s_WideModeConfigurationProperty | TwoPaneViewProperties | [static]
SetScrollViewerProperties(std::wstring_view const &scrollViewerName, winrt::Control::Loaded_revoker &revoker) | TwoPaneView | [private]
TallModeConfiguration(winrt::TwoPaneViewTallModeConfiguration const &value) | TwoPaneViewProperties |
TallModeConfiguration() | TwoPaneViewProperties |
TallModeConfigurationProperty() | TwoPaneViewProperties | [inline, static]
TwoPaneView() | TwoPaneView |
TwoPaneViewProperties() | TwoPaneViewProperties |
UpdateMode() | TwoPaneView | [private]
UpdateRowsColumns(ViewMode newMode, DisplayRegionHelperInfo info, winrt::Rect rcControl) | TwoPaneView | [private]
WideModeConfiguration(winrt::TwoPaneViewWideModeConfiguration const &value) | TwoPaneViewProperties |
WideModeConfiguration() | TwoPaneViewProperties |
WideModeConfigurationProperty() | TwoPaneViewProperties | [inline, static]
Generated on Sun Dec 1 2024 20:53:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LinedFlowLayout Member List

This is the complete list of members for LinedFlowLayout, including all inherited members.
abi_enter() | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
ActualLineHeight(double value) | LinedFlowLayoutProperties |
ActualLineHeight() | LinedFlowLayoutProperties |
ActualLineHeightProperty() | LinedFlowLayoutProperties | [inline, static]
ArrangeConstrainedLines(winrt::VirtualizingLayoutContext const &context) | LinedFlowLayout | [private]
ArrangeOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &finalSize) | LinedFlowLayout |
ArrangeUnconstrainedLine(winrt::VirtualizingLayoutContext const &context) | LinedFlowLayout | [private]
AverageItemAspectRatioDbg() const | LinedFlowLayout | [inline]
CheckThread() | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
ClearItemAspectRatios() | LinedFlowLayout |
ClearProperties() | LinedFlowLayoutProperties | [static]
ComputeFrozenItemsAndLayout(winrt::VirtualizingLayoutContext const &context, std::vector< int > &oldLineItemCounts, std::shared_ptr< std::map< tracker_ref< winrt::UIElement >, float >> oldElementAvailableWidths, std::shared_ptr< std::map< tracker_ref< winrt::UIElement >, float >> oldElementDesiredWidths, double scrollViewport, double scrollOffset, double lineSpacing, double actualLineHeight, float availableWidth, float nearSizedItemsRect, float farSizedItemsRect, float nearRealizationRect, float farRealizationRect, int lineCount, int sizedLineCount, int unsizedNearItemCount, int sizedItemCount, int firstStillSizedLineIndex, int lastStillSizedLineIndex, int firstStillSizedItemIndex, int lastStillSizedItemIndex) | LinedFlowLayout | [private]
ComputeFrozenItemsRange(double scrollViewport, double scrollOffset, double lineSpacing, double actualLineHeight, int lineCount, int beginSizedLineIndex, int endSizedLineIndex, int beginSizedItemIndex, int endSizedItemIndex, int &adjustedBeginSizedItemIndex, int &adjustedEndSizedItemIndex) | LinedFlowLayout | [private]
ComputeItemsLayoutDrawback(double availableWidth, bool isLastSizedLineStretchEnabled, ItemsLayout &itemsLayout) const | LinedFlowLayout | [private]
ComputeItemsLayoutFastPath(float availableWidth, double actualLineHeight) | LinedFlowLayout | [private]
ComputeItemsLayoutRegularPath(float availableWidth, double scrollViewport, double lineSpacing, double actualLineHeight, int beginSizedLineIndex, int endSizedLineIndex, int beginSizedItemIndex, int endSizedItemIndex, int beginLineVectorIndex, bool isLastSizedLineStretchEnabled) | LinedFlowLayout | [private]
ComputeItemsLayoutWithLockedItems(ItemsLayout &itemsLayout, double availableWidth, double minItemSpacing, double actualLineHeight, double averageAspectRatio, int beginSizedLineIndex, int endSizedLineIndex, int beginSizedItemIndex, int endSizedItemIndex, int beginLineVectorIndex, bool isLastSizedLineStretchEnabled) | LinedFlowLayout | [private]
ComputeLineExpandFactor(bool forward, int sizedItemIndex, int lineItemsCount, double lineItemsWidth, double availableWidth, double minItemSpacings, double actualLineHeight, double averageAspectRatio) | LinedFlowLayout | [private]
ComputeLineShrinkFactor(bool forward, int sizedItemIndex, int lineItemsCount, double lineItemsWidth, double availableWidth, double minItemSpacings, double actualLineHeight, double averageAspectRatio) | LinedFlowLayout | [private]
CopyItemsInfo(std::vector< double > const &oldItemsInfoDesiredAspectRatios, std::vector< double > const &oldItemsInfoMinWidths, std::vector< double > const &oldItemsInfoMaxWidths, std::vector< float > const &oldItemsInfoArrangeWidths, int oldStart, int newStart, int copyCount) | LinedFlowLayout | [private]
CreateDefaultItemTransitionProvider() override | LinedFlowLayout |
DeleteInstanceOnUIThread(std::unique_ptr< LinedFlowLayout > &&self) noexcept | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline, static]
EnsureAndMeasureItemRange(winrt::VirtualizingLayoutContext const &context, float availableWidth, double actualLineHeight, bool forward, int beginRealizedItemIndex, int endRealizedItemIndex) | LinedFlowLayout | [private]
EnsureAndResizeItemAspectRatios(double scrollViewport, double actualLineHeight, double lineSpacing) | LinedFlowLayout | [private]
EnsureElementAvailableWidths() | LinedFlowLayout | [private]
EnsureElementDesiredWidths() | LinedFlowLayout | [private]
EnsureElementRealized(bool forward, int itemIndex) | LinedFlowLayout | [private]
EnsureItemAspectRatios() | LinedFlowLayout | [private]
EnsureItemRange(bool forward, int beginRealizedItemIndex, int endRealizedItemIndex) | LinedFlowLayout | [private]
EnsureItemRangeFastPath(winrt::VirtualizingLayoutContext const &context, double actualLineHeight) | LinedFlowLayout | [private]
EnsureItemsInfoArrangeWidths(int itemCount) | LinedFlowLayout | [private]
EnsureItemsInfoDesiredAspectRatios(int itemCount) | LinedFlowLayout | [private]
EnsureItemsInfoMaxWidths(int itemCount) | LinedFlowLayout | [private]
EnsureItemsInfoMinWidths(int itemCount) | LinedFlowLayout | [private]
EnsureLineItemCounts(int lineCount) | LinedFlowLayout | [private]
EnsureProperties() | LinedFlowLayoutProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
ExitRegularPath() | LinedFlowLayout | [private]
final_release(std::unique_ptr< LinedFlowLayout > &&self) | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline, static]
FirstFrozenItemIndexDbg() const | LinedFlowLayout | [inline]
FirstRealizedItemIndexDbg() const | LinedFlowLayout | [inline]
ForcedAverageItemAspectRatioDbg() const | LinedFlowLayout | [inline]
ForcedAverageItemAspectRatioDbg(double forcedAverageItemAspectRatio) | LinedFlowLayout | [inline]
ForcedAverageItemsPerLineDividerDbg() const | LinedFlowLayout | [inline]
ForcedAverageItemsPerLineDividerDbg(double forcedAverageItemsPerLineDivider) | LinedFlowLayout | [inline]
ForcedWrapMultiplierDbg() const | LinedFlowLayout | [inline]
ForcedWrapMultiplierDbg(double forcedWrapMultiplier) | LinedFlowLayout | [inline]
GetArrangeWidth(double desiredAspectRatio, double minWidth, double maxWidth, double actualLineHeight, double scaleFactor) const | LinedFlowLayout | [private]
GetArrangeWidthFromItemsInfo(int sizedItemIndex, double actualLineHeight, double averageAspectRatio, double scaleFactor=1.0) const | LinedFlowLayout | [private]
GetAverageAspectRatio(float availableWidth, double actualLineHeight) const | LinedFlowLayout | [private]
GetAverageAspectRatioFromStorage() const | LinedFlowLayout | [private]
GetAverageItemsPerLine(float availableWidth) | LinedFlowLayout | [private]
GetBase() | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
GetDesiredAspectRatioFromItemsInfo(int itemIndex, bool usesFastPathLayout) const | LinedFlowLayout | [private]
GetDesiredSizeForAvailableSize(int itemIndex, winrt::UIElement const &element, winrt::Size availableSize, double actualLineHeightToRestore) | LinedFlowLayout | [private]
GetFirstAndLastDisplayedLineIndexes(double scrollViewport, double scrollOffset, double padding, double lineSpacing, double actualLineHeight, int lineCount, bool forFullyDisplayedLines, int *firstDisplayedLineIndex, int *lastDisplayedLineIndex) const | LinedFlowLayout | [private]
GetFirstFullyRealizedLineIndex(int *firstFullyRealizedLineIndex, int *firstItemInFullyRealizedLine) const | LinedFlowLayout | [private]
GetFirstItemIndexInLineIndex(int lineVectorIndex) const | LinedFlowLayout | [private]
GetFrozenLineIndexFromFrozenItemIndex(int frozenItemIndex) const | LinedFlowLayout | [private]
GetInner() | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
GetItemDrawbackImprovement(double movingWidth, double availableWidth, double currentLineItemsWidth, double neighborLineItemsWidth, int currentLineIndex, int neighborLineIndex) | LinedFlowLayout | [private]
GetItemLineIndex(winrt::UIElement const &element) | LinedFlowLayout | [private]
GetItemsInfoRequestedRange(winrt::VirtualizingLayoutContext const &context, float availableWidth, double actualLineHeight, int *itemsRangeStartIndex, int *itemsRangeRequestedLength) | LinedFlowLayout | [private]
GetItemsLayout(std::map< int, int > *internalLockedItemIndexes, double scrollViewport, double availableWidth, double adjustedAvailableWidth, double averageLineItemsWidth, double averageAspectRatio, double lineSpacing, double actualLineHeight, int beginSizedLineIndex, int endSizedLineIndex, int beginSizedItemIndex, int endSizedItemIndex, int beginLineVectorIndex, bool isLastSizedLineStretchEnabled) | LinedFlowLayout | [private]
GetItemsRangeArrangeWidth(int beginSizedItemIndex, int endSizedItemIndex, bool usesArrangeWidthInfo) | LinedFlowLayout | [private]
GetItemWidthMultiplierThreshold() const | LinedFlowLayout | [private]
GetLastItemIndexInLineIndex(int lineVectorIndex) const | LinedFlowLayout | [private]
GetLineCount(double averageItemsPerLine) const | LinedFlowLayout | [private]
GetLineIndex(int itemIndex, bool usesFastPathLayout) const | LinedFlowLayout | [private]
GetLineIndexDbg(int itemIndex) const | LinedFlowLayout | [inline]
GetLineIndexFromAverageItemsPerLine(int itemIndex, double averageItemsPerLine) const | LinedFlowLayout | [private]
GetLinesDesiredWidth() | LinedFlowLayout | [private]
GetMaxWidthFromItemsInfo(int itemIndex) const | LinedFlowLayout | [private]
GetMinWidthFromItemsInfo(int itemIndex) const | LinedFlowLayout | [private]
GetNextLockedItem(std::map< int, int > *internalLockedItemIndexes, bool forward, int beginLineIndex, int endLineIndex, int itemIndex, int *lockedItemIndex, int *lockedLineIndex) const | LinedFlowLayout | [private]
GetRealizationRectHeightDeficit(winrt::VirtualizingLayoutContext const &context, double actualLineHeight, double lineSpacing) const | LinedFlowLayout | [private]
GetRealizedItemsFromSizedItems(int realizedLineCount, int lineCount, int *unrealizedNearItemCount, int *realizedItemCount) const | LinedFlowLayout | [private]
GetRoundedDouble(double value) const | LinedFlowLayout | [private]
GetRoundedFloat(float value) const | LinedFlowLayout | [private]
GetSizedItemsRectHeight(winrt::VirtualizingLayoutContext const &context, double actualLineHeight, double lineSpacing) const | LinedFlowLayout | [private]
InitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | LinedFlowLayout |
InitializeForRelayout(int sizedLineCount, int &firstStillSizedLineIndex, int &lastStillSizedLineIndex, int &firstStillSizedItemIndex, int &lastStillSizedItemIndex) | LinedFlowLayout | [private]
InvalidateItemsInfo() | LinedFlowLayout |
InvalidateLayout(bool forceRelayout=true, bool resetItemsInfo=false, bool invalidateMeasure=true) | LinedFlowLayout |
InvalidateMeasureAsync() | LinedFlowLayout | [private]
InvalidateMeasureTimerStart(int tickCount) | LinedFlowLayout | [private]
InvalidateMeasureTimerStop(bool isForDestructor) | LinedFlowLayout | [private]
InvalidateMeasureTimerTick(winrt::IInspectable const &sender, winrt::IInspectable const &args) | LinedFlowLayout | [private]
IsFastPathSupportedDbg() const | LinedFlowLayout | [inline]
IsFastPathSupportedDbg(bool isFastPathSupported) | LinedFlowLayout | [inline]
IsItemsLayoutContractionWorthy(ItemsLayout const &itemsLayout) | LinedFlowLayout | [private]
IsItemsLayoutEqualizationWorthy(ItemsLayout const &itemsLayout, bool withHeadItem) | LinedFlowLayout | [private]
IsItemsLayoutExpansionWorthy(ItemsLayout const &itemsLayout) | LinedFlowLayout | [private]
IsLockedItem(bool forward, int beginLineIndex, int endLineIndex, int itemIndex) | LinedFlowLayout | [private]
IsOnThread() | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
IsVirtualizingContext(winrt::VirtualizingLayoutContext const &context) const | LinedFlowLayout | [private]
ItemRangesHaveNewDesiredWidths(std::shared_ptr< std::map< tracker_ref< winrt::UIElement >, float >> oldElementDesiredWidths, int beginRealizedItemIndex, int endRealizedItemIndex) | LinedFlowLayout | [private]
ItemsInfoRequested(winrt::TypedEventHandler< winrt::LinedFlowLayout, winrt::LinedFlowLayoutItemsInfoRequestedEventArgs > const &value) | LinedFlowLayoutProperties |
ItemsInfoRequested(winrt::event_token const &token) | LinedFlowLayoutProperties |
ItemsJustification(winrt::LinedFlowLayoutItemsJustification const &value) | LinedFlowLayoutProperties |
ItemsJustification() | LinedFlowLayoutProperties |
ItemsJustificationProperty() | LinedFlowLayoutProperties | [inline, static]
ItemsStretch(winrt::LinedFlowLayoutItemsStretch const &value) | LinedFlowLayoutProperties |
ItemsStretch() | LinedFlowLayoutProperties |
ItemsStretchProperty() | LinedFlowLayoutProperties | [inline, static]
ItemsUnlocked(winrt::TypedEventHandler< winrt::LinedFlowLayout, winrt::IInspectable > const &value) | LinedFlowLayoutProperties |
ItemsUnlocked(winrt::event_token const &token) | LinedFlowLayoutProperties |
LastFrozenItemIndexDbg() const | LinedFlowLayout | [inline]
LastRealizedItemIndexDbg() const | LinedFlowLayout | [inline]
LinedFlowLayout() | LinedFlowLayout |
LinedFlowLayoutProperties() | LinedFlowLayoutProperties |
LineHasInternalLockedItem(std::map< int, int > const &internalLockedItemIndexes, int lineIndex, bool before, int itemIndex) const | LinedFlowLayout | [private]
LineHasLockedItem(int lineIndex, bool before, int itemIndex) | LinedFlowLayout | [private]
LineHeight(double value) | LinedFlowLayoutProperties |
LineHeight() | LinedFlowLayoutProperties |
LineHeightProperty() | LinedFlowLayoutProperties | [inline, static]
LineItemsCountTotal(int expectedTotal) | LinedFlowLayout | [private]
LineSpacing(double value) | LinedFlowLayoutProperties |
LineSpacing() | LinedFlowLayoutProperties |
LineSpacingProperty() | LinedFlowLayoutProperties | [inline, static]
LockItemToLine(int32_t itemIndex) | LinedFlowLayout |
LockItemToLineInternal(std::map< int, int > &internalLockedItemIndexes, int beginSizedLineIndex, int endSizedLineIndex, int beginSizedItemIndex, int endSizedItemIndex, int lineIndex, int itemIndex) | LinedFlowLayout | [private]
LogItemIndexDbg() const | LinedFlowLayout | [inline]
LogItemIndexDbg(int logItemIndex) | LinedFlowLayout | [inline]
m_averageItemsPerLine | LinedFlowLayout | [private]
m_elementAvailableWidths | LinedFlowLayout | [private]
m_elementDesiredWidths | LinedFlowLayout | [private]
m_itemsInfoArrangeWidths | LinedFlowLayout | [private]
m_itemsInfoDesiredAspectRatiosForRegularPath | LinedFlowLayout | [private]
m_itemsInfoMaxWidthsForRegularPath | LinedFlowLayout | [private]
m_itemsInfoMinWidthsForRegularPath | LinedFlowLayout | [private]
m_itemsInfoRequestedEventSource | LinedFlowLayoutProperties |
m_itemsUnlockedEventSource | LinedFlowLayoutProperties |
m_lineItemCounts | LinedFlowLayout | [private]
m_lockedItemIndexes | LinedFlowLayout | [private]
MeasureConstrainedLines(winrt::VirtualizingLayoutContext const &context, std::set< double > const &averageItemsPerLineProcessed, ItemsInfo const &itemsInfo, bool forceRelayout, float availableWidth, float nearRealizationRect, float farRealizationRect, double scrollViewport, double scrollOffset, double actualLineHeight, std::pair< double, double > *newAverageItemsPerLine) | LinedFlowLayout | [private]
MeasureConstrainedLinesFastPath(winrt::VirtualizingLayoutContext const &context, float availableWidth, double actualLineHeight, bool forceLayoutWithoutItemsInfoRequest) | LinedFlowLayout | [private]
MeasureConstrainedLinesRegularPath(winrt::VirtualizingLayoutContext const &context, ItemsInfo const &itemsInfo, float availableWidth, double actualLineHeight) | LinedFlowLayout | [private]
MeasureItemRange(double actualLineHeight, int beginRealizedItemIndex, int endRealizedItemIndex) | LinedFlowLayout | [private]
MeasureItemRangeRegularPath(std::shared_ptr< std::map< tracker_ref< winrt::UIElement >, float >> elementAvailableWidths, double actualLineHeight, int beginRealizedItemIndex, int endRealizedItemIndex) | LinedFlowLayout | [private]
MeasureOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &availableSize) | LinedFlowLayout |
MeasureUnconstrainedLine(winrt::VirtualizingLayoutContext const &context) | LinedFlowLayout | [private]
MinItemSpacing(double value) | LinedFlowLayoutProperties |
MinItemSpacing() | LinedFlowLayoutProperties |
MinItemSpacingProperty() | LinedFlowLayoutProperties | [inline, static]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
NotifyLinedFlowLayoutInvalidatedDbg(winrt::LinedFlowLayoutInvalidationTrigger const &invalidationTrigger) | LinedFlowLayout | [private]
NotifyLinedFlowLayoutItemLockedDbg(int itemIndex, int lineIndex) | LinedFlowLayout | [private]
OnActualLineHeightPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | LinedFlowLayoutProperties | [static]
OnItemsChangedCore(winrt::VirtualizingLayoutContext const &context, winrt::IInspectable const &source, winrt::NotifyCollectionChangedEventArgs const &args) | LinedFlowLayout |
OnItemsJustificationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | LinedFlowLayoutProperties | [static]
OnItemsStretchPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | LinedFlowLayoutProperties | [static]
OnLineHeightPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | LinedFlowLayoutProperties | [static]
OnLineSpacingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | LinedFlowLayoutProperties | [static]
OnMinItemSpacingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | LinedFlowLayoutProperties | [static]
OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const &args) | LinedFlowLayout |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
RaiseItemsInfoRequested(int itemsRangeStartIndex, int itemsRangeRequestedLength) | LinedFlowLayout | [private]
RawAverageItemsPerLineDbg() const | LinedFlowLayout | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< LinedFlowLayout, winrt::implementation::LinedFlowLayoutT, VirtualizingLayout > | [inline]
RequestedRangeLength() | LinedFlowLayout |
RequestedRangeStartIndex() | LinedFlowLayout |
RequestItemsInfo(ItemsInfo const &itemsInfo, int beginSizedItemIndex, int endSizedItemIndex) | LinedFlowLayout | [private]
ResetItemsInfo() | LinedFlowLayout | [private]
ResetItemsInfoForFastPath() | LinedFlowLayout | [private]
ResetLinesInfo() | LinedFlowLayout | [private]
ResetSizedLines() | LinedFlowLayout | [private]
s_ActualLineHeightProperty | LinedFlowLayoutProperties | [static]
s_ItemsJustificationProperty | LinedFlowLayoutProperties | [static]
s_ItemsStretchProperty | LinedFlowLayoutProperties | [static]
s_LineHeightProperty | LinedFlowLayoutProperties | [static]
s_LineSpacingProperty | LinedFlowLayoutProperties | [static]
s_MinItemSpacingProperty | LinedFlowLayoutProperties | [static]
SetArrangeWidthFromItemsInfo(int itemIndex, float arrangeWidth) | LinedFlowLayout | [private]
SetAverageItemsPerLine(std::pair< double, double > averageItemsPerLine, bool unlockItems=true) | LinedFlowLayout | [private]
SetDesiredAspectRatioFromItemsInfo(int itemIndex, double desiredAspectRatio) | LinedFlowLayout | [private]
SetDesiredAspectRatios(winrt::array_view< double const > const &values) | LinedFlowLayout | [inline]
SetItemRangeArrangeWidth(int beginItemIndex, int endItemIndex, double actualLineHeight, double averageAspectRatio, double scaleFactor=1.0) | LinedFlowLayout | [private]
SetMaxWidths(winrt::array_view< double const > const &values) | LinedFlowLayout | [inline]
SetMinWidths(winrt::array_view< double const > const &values) | LinedFlowLayout | [inline]
SnapAverageItemsPerLine(double oldAverageItemsPerLineRaw, double newAverageItemsPerLineRaw) const | LinedFlowLayout | [private]
SnappedAverageItemsPerLineDbg() const | LinedFlowLayout | [inline]
SnapToPower(double value, double valuePower) const | LinedFlowLayout | [private]
UninitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | LinedFlowLayout |
UnlockItems() | LinedFlowLayout |
UpdateActualLineHeight(winrt::VirtualizingLayoutContext const &context, winrt::Size const &availableSize) | LinedFlowLayout | [private]
UpdateAspectRatiosWithItemsInfo() | LinedFlowLayout | [private]
UpdateItemsInfo(ItemsInfo const &itemsInfo, int oldFirstItemsInfoIndex, int oldLastItemsInfoIndex) | LinedFlowLayout | [private]
UpdateRoundingScaleFactor(winrt::UIElement const &xamlRootReference) | LinedFlowLayout | [private]
UsesArrangeWidthInfo() const | LinedFlowLayout | [private]
UsesFastPathLayout() const | LinedFlowLayout | [private]
~LinedFlowLayout() | LinedFlowLayout |
Generated on Sun Dec 1 2024 20:52:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewItemsFactory Member List

This is the complete list of members for NavigationViewItemsFactory, including all inherited members.
GetElementCore(winrt::ElementFactoryGetArgs const &args) | NavigationViewItemsFactory |
navigationViewItemPool | NavigationViewItemsFactory | [private]
RecycleElementCore(winrt::ElementFactoryRecycleArgs const &args) | NavigationViewItemsFactory |
SettingsItem(winrt::NavigationViewItemBase const &settingsItem) | NavigationViewItemsFactory |
UnlinkElementFromParent(winrt::ElementFactoryRecycleArgs const &args) | NavigationViewItemsFactory | [private]
UserElementFactory(winrt::IInspectable const &newValue) | NavigationViewItemsFactory |
Generated on Sun Dec 1 2024 20:52:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbItem.properties.h Source File

  • Breadcrumb

BreadcrumbItem.properties.h

Go to the documentation of this file.
00001 #pragma once
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RadioMenuFlyoutItem.properties.cpp Source File

  • Generated

RadioMenuFlyoutItem.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RadioMenuFlyoutItem.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(RadioMenuFlyoutItem)
00012 }
00013
00014 #include "RadioMenuFlyoutItem.g.cpp"
00015
00016 GlobalDependencyProperty RadioMenuFlyoutItemProperties::s_AreCheckStatesEnabledProperty{ nullptr };
00017 GlobalDependencyProperty RadioMenuFlyoutItemProperties::s_GroupNameProperty{ nullptr };
00018 GlobalDependencyProperty RadioMenuFlyoutItemProperties::s_IsCheckedProperty{ nullptr };
00019
00020 RadioMenuFlyoutItemProperties::RadioMenuFlyoutItemProperties()
00021 {
00022     EnsureProperties();
00023 }
00024
00025 void RadioMenuFlyoutItemProperties::EnsureProperties()
00026 {
00027     if (!s_AreCheckStatesEnabledProperty)
00028     {
00029         s_AreCheckStatesEnabledProperty =
00030             InitializeDependencyProperty(
00031                 L"AreCheckStatesEnabled",
00032                 winrt::name_of<bool>(),
00033                 winrt::name_of<winrt::RadioMenuFlyoutItem>(),
00034                 true /* isAttached */,
00035                 ValueHelper<bool>::BoxValueIfNecessary(false),
00036                 &RadioMenuFlyoutItem::OnAreCheckStatesEnabledPropertyChanged);
00037     }
00038     if (!s_GroupNameProperty)
00039     {
00040         s_GroupNameProperty =
00041             InitializeDependencyProperty(
00042                 L"GroupName",
00043                 winrt::name_of<winrt::hstring>(),
00044                 winrt::name_of<winrt::RadioMenuFlyoutItem>(),
00045                 false /* isAttached */,
00046                 ValueHelper<winrt::hstring>::BoxedDefaultValue(),
00047                 winrt::PropertyChangedCallback(&OnGroupNamePropertyChanged));
00048     }
00049     if (!s_IsCheckedProperty)
00050     {
00051         s_IsCheckedProperty =
00052             InitializeDependencyProperty(
00053                 L"IsChecked",
00054                 winrt::name_of<bool>(),
00055                 winrt::name_of<winrt::RadioMenuFlyoutItem>(),
00056                 false /* isAttached */,
00057                 ValueHelper<bool>::BoxedDefaultValue(),
00058                 winrt::PropertyChangedCallback(&OnIsCheckedPropertyChanged));
00059     }
00060 }
00061
00062 void RadioMenuFlyoutItemProperties::ClearProperties()
00063 {
00064     s_AreCheckStatesEnabledProperty = nullptr;
00065     s_GroupNameProperty = nullptr;
00066     s_IsCheckedProperty = nullptr;
00067 }
00068
00069 void RadioMenuFlyoutItemProperties::OnGroupNamePropertyChanged(
00070     winrt::DependencyObject const& sender,
00071     winrt::DependencyPropertyChangedEventArgs const& args)
00072 {
00073     auto owner = sender.as<winrt::RadioMenuFlyoutItem>();
00074     winrt::get_self<RadioMenuFlyoutItem>(owner)->OnPropertyChanged(args);
00075 }
00076
00077 void RadioMenuFlyoutItemProperties::OnIsCheckedPropertyChanged(
00078     winrt::DependencyObject const& sender,
00079     winrt::DependencyPropertyChangedEventArgs const& args)
00080 {
00081     auto owner = sender.as<winrt::RadioMenuFlyoutItem>();
00082     winrt::get_self<RadioMenuFlyoutItem>(owner)->OnPropertyChanged(args);
00083 }
00084
00085
00086 void RadioMenuFlyoutItemProperties::SetAreCheckStatesEnabled(winrt::MenuFlyoutSubItem const& target, bool value)
00087 {
00088     target.SetValue(s_AreCheckStatesEnabledProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00089 }
00090
00091 bool RadioMenuFlyoutItemProperties::GetAreCheckStatesEnabled(winrt::MenuFlyoutSubItem const& target)
00092 {
00093     return ValueHelper<bool>::CastOrUnbox(target.GetValue(s_AreCheckStatesEnabledProperty));
00094 }
00095
00096 void RadioMenuFlyoutItemProperties::GroupName(winrt::hstring const& value)
00097 {
00098     [[gsl::suppress(con)]]
00099     {
00100     static_cast<RadioMenuFlyoutItem*>(this)->SetValue(s_GroupNameProperty, ValueHelper<winrt::hstring>::BoxValueIfNecessary(value));
00101     }
00102 }
00103
00104 winrt::hstring RadioMenuFlyoutItemProperties::GroupName()
00105 {
00106     return ValueHelper<winrt::hstring>::CastOrUnbox(static_cast<RadioMenuFlyoutItem*>(this)->GetValue(s_GroupNameProperty));
00107 }
00108
00109 void RadioMenuFlyoutItemProperties::IsChecked(bool value)
00110 {
00111     [[gsl::suppress(con)]]
00112     {
00113     static_cast<RadioMenuFlyoutItem*>(this)->SetValue(s_IsCheckedProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00114     }
00115 }
00116
00117 bool RadioMenuFlyoutItemProperties::IsChecked()
00118 {
00119     return ValueHelper<bool>::CastOrUnbox(static_cast<RadioMenuFlyoutItem*>(this)->GetValue(s_IsCheckedProperty));
00120 }
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarToolButtonAutomationPeer.properties.cpp Source File

  • Generated

InkToolBarToolButtonAutomationPeer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InkToolBarToolButtonAutomationPeer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Automation::Peers
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(InkToolBarToolButtonAutomationPeer)
00012 }
00013
00014 #include "InkToolBarToolButtonAutomationPeer.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshVisualizer/PullToRefreshHelperTestApi.cpp Source File

  • PullToRefresh
  • RefreshVisualizer

PullToRefreshHelperTestApi.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "PullToRefreshHelperTestApi.h"
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioMenuFlyoutItem/TestUI/RadioMenuFlyoutItemPage.xaml.cs Source File

  • RadioMenuFlyoutItem
  • TestUI

RadioMenuFlyoutItemPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Markup;
00010 using Windows.UI;
00011 using System.Windows.Input;
00012 using Windows.Foundation.Metadata;
00013 using System.Collections.Generic;
00014 using Microsoft.UI.Xaml.Automation;
00015
00016 namespace MUXControlsTestApp
00017 {
00018     [TopLevelTestPage(Name = "RadioMenuFlyoutItem")]
00019     public sealed partial class RadioMenuFlyoutItemPage : TestPage
00020     {
00021         Dictionary<string, TextBlock> itemStates;
00022
00023         public RadioMenuFlyoutItemPage()
00024         {
00025             this.InitializeComponent();
00026
00027             itemStates = new Dictionary<string, TextBlock>();
00028
00029             IconMenuFlyoutItem.Icon = new SymbolIcon(Symbol.Calendar);
00030             IconRadioMenuFlyoutItem.Icon = new SymbolIcon(Symbol.Calculator);
00031             IconRadioMenuFlyoutItem2.Icon = new SymbolIcon(Symbol.Calculator);
00032
00033             ItemNames.Spacing = 4;
00034             ItemStates.Spacing = 4;
00035
00036             // register all RadioMenuFlyoutItems
00037             foreach (MenuFlyoutItemBase item in ButtonMenuFlyout.Items)
00038             {
00039                 RegisterItem(item);
00040             }
00041             foreach(MenuFlyoutItemBase item in ButtonSubMenuFlyout.Items)
00042             {
00043                 RegisterItem(item);
00044             }
00045             foreach (MenuFlyoutItemBase item in RadioSubMenu.Items)
00046             {
00047                 RegisterItem(item);
00048             }
00049         }
00050
00051         private void RegisterItem(MenuFlyoutItemBase item)
00052         {
00053             if (item is RadioMenuFlyoutItem)
00054             {
00055                 RadioMenuFlyoutItem radioItem = item as RadioMenuFlyoutItem;
00056
00057                 radioItem.RegisterPropertyChangedCallback(RadioMenuFlyoutItem.IsCheckedProperty, new DependencyPropertyChangedCallback(IsCheckedChanged));
00058
00059                 TextBlock nameText = new TextBlock();
00060                 nameText.Text = radioItem.Text;
00061                 ItemNames.Children.Add(nameText);
00062
00063                 TextBlock stateText = new TextBlock();
00064                 AutomationProperties.SetName(stateText, radioItem.Text + "State");
00065                 UpdateTextState(radioItem, stateText);
00066                 ItemStates.Children.Add(stateText);
00067
00068                 itemStates.Add(radioItem.Text, stateText);
00069             }
00070         }
00071
00072         private void IsCheckedChanged(DependencyObject o, DependencyProperty p)
00073         {
00074             RadioMenuFlyoutItem radioItem = o as RadioMenuFlyoutItem;
00075             TextBlock stateText;
00076             if (itemStates.TryGetValue(radioItem.Text, out stateText))
00077             {
00078                 UpdateTextState(radioItem, stateText);
00079             }
00080         }
00081
00082         private void UpdateTextState(RadioMenuFlyoutItem item, TextBlock textBlock)
00083         {
00084             textBlock.Text = item.IsChecked ? "Checked" : "Unchecked";
00085         }
00086     }
00087 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealHoverLight Member List

This is the complete list of members for RevealHoverLight, including all inherited members.
abi_enter() | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
AnimationComplete enum value | RevealHoverLight | [private]
AnimToHover enum value | RevealHoverLight | [private]
AnimToOff enum value | RevealHoverLight | [private]
CancelCurrentPressStateContinuation() | RevealHoverLight | [private]
CheckThread() | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< RevealHoverLight > &&self) noexcept | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline, static]
DisableHoverAnimation() | RevealHoverLight | [private]
EnableHoverAnimation() | RevealHoverLight | [private]
EnsureCompositionResources() | RevealHoverLight | [private]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
FastRelease enum value | RevealHoverLight | [private]
final_release(std::unique_ptr< RevealHoverLight > &&self) | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline, static]
GetBase() | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
GetCurrentTheme(const winrt::UIElement &target) | RevealHoverLight | [private]
GetId() | RevealHoverLight |
GetInner() | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
GetIsPressLight() | RevealHoverLight | [inline]
GetLight() | RevealHoverLight | [inline]
GetLightIdStatic() | RevealHoverLight | [static]
GotoLightState(LightEvents e) | RevealHoverLight | [private]
GotoLightStateHelper(LightStates target, bool skipAnimation=false) | RevealHoverLight | [private]
GotoNormal enum value | RevealHoverLight | [private]
GotoPointerOver enum value | RevealHoverLight | [private]
GotoPressed enum value | RevealHoverLight | [private]
GoToState(_In_ winrt::RevealBrushState newState) | RevealHoverLight |
Hover enum value | RevealHoverLight | [private]
InitializeImpl(_In_opt_ IInspectable *outer) | RevealHoverLight | [protected]
IsOnThread() | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
LightEvents enum name | RevealHoverLight | [private]
LightStates enum name | RevealHoverLight | [private]
m_cancelCurrentPressStateContinuation | RevealHoverLight | [private]
MaterialHelper | RevealHoverLight | [private]
MaterialHelperBase | RevealHoverLight | [private]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
Off enum value | RevealHoverLight | [private]
OnConnected(winrt::UIElement const &newElement) | RevealHoverLight |
OnDisconnected(winrt::UIElement const &oldElement) | RevealHoverLight |
OnMaterialPolicyStatusChanged(const com_ptr< MaterialHelperBase > &sender, bool isDisabledByMaterialPolicy) | RevealHoverLight |
OnPointerPressed(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | RevealHoverLight | [private]
Pressing enum value | RevealHoverLight | [private]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< RevealHoverLight, winrt::implementation::RevealHoverLightT > | [inline]
ReleaseCompositionResources() | RevealHoverLight | [private]
RevealTestApi | RevealHoverLight | [private]
s_constantAttenuation | RevealHoverLight | [static]
s_linearAttenuation | RevealHoverLight | [static]
s_pressSpotLightStates | RevealHoverLight | [static]
s_revealHoverSpotlightStates | RevealHoverLight | [static]
SetIsPressLight(bool isPressLight) | RevealHoverLight | [inline]
SlowRelease enum value | RevealHoverLight | [private]
SwitchLight(bool turnOn) | RevealHoverLight | [private]
Generated on Sun Dec 1 2024 20:53:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RadioButtonsPage Member List

This is the complete list of members for RadioButtonsPage, including all inherited members.
ClearRadioButtonsEventsButton_Click(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
FocusSelectedItemButton_Clicked(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
getIndexToSelect() | RadioButtonsPage | [inline, private]
GetItemsCollection() | RadioButtonsPage | [inline, private]
InsertDisplayRadioButtonButton_Click(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
ItemTypeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) | RadioButtonsPage | [inline, private]
m_loaded | RadioButtonsPage | [private]
m_radioButtonItemCollection | RadioButtonsPage | [private]
m_stringItemCollection | RadioButtonsPage | [private]
RadioButtonsPage() | RadioButtonsPage | [inline]
RadioButtonsPage_Loaded(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
RadioButtonsTestHooks_LayoutChanged(RadioButtons sender, object args) | RadioButtonsPage | [inline, private]
RootGotFocus(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
Select5ThenChangeSourceButton_Clicked(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
SelectByIndexButton_Click(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
SelectByItemButton_Click(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
SetBorderWidthButton_Click(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
SetMaxColumnsButton_Click(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
SetNumberOfItemsButton_Click(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
SourceComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) | RadioButtonsPage | [inline, private]
TestRadioButtons_GotFocus(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
TestRadioButtons_LostFocus(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
TestRadioButtons_SelectionChanged(object sender, SelectionChangedEventArgs e) | RadioButtonsPage | [inline, private]
UpdateDisplayRadioButton() | RadioButtonsPage | [inline, private]
UpdateDisplayRadioButtonButton_Click(object sender, RoutedEventArgs e) | RadioButtonsPage | [inline, private]
UpdateRadioButtonsSource() | RadioButtonsPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:24 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

EventTests Member List

This is the complete list of members for EventTests, including all inherited members.
BackRequestedTest() | EventTests | [inline]
ClassInitialize(TestContext testContext) | EventTests | [inline, static]
ClickClearSelectionButton() | NavigationViewTestsBase | [inline, protected]
ComboBoxName enum name | NavigationViewTestsBase | [protected]
compact | NavigationViewTestsBase | [protected]
ControlHeight enum name | NavigationViewTestsBase | [protected]
ControlWidth enum name | NavigationViewTestsBase | [protected]
EnsureNavViewClosed() | NavigationViewTestsBase | [inline, protected]
EnsurePaneHeaderCanBeModifiedHelper(RegressionTestType navviewMode) | NavigationViewTestsBase | [inline, protected]
expanded | NavigationViewTestsBase | [protected]
GetTopNavigationItems(TopNavPosition position) | NavigationViewTestsBase | [inline, protected]
InvokeNavigationViewAccessKeyAndVerifyKeyTipPlacement(string expectedKeyTipTargetElementId) | NavigationViewTestsBase | [inline, protected]
InvokeOverflowButton() | NavigationViewTestsBase | [inline, protected]
IsItemInTopNavPrimaryList(string text) | NavigationViewTestsBase | [inline, protected]
MenuItemInvokedTest() | EventTests | [inline]
minimal | NavigationViewTestsBase | [protected]
OpenOverflowMenuAndInvokeItem(string itemName) | NavigationViewTestsBase | [inline, protected]
PaneOpenCloseTestCaseRetry(int retryNumber, Action action) | NavigationViewTestsBase | [inline, protected]
PaneOpenStatus enum name | NavigationViewTestsBase | [protected]
SetNavViewHeight(ControlHeight height) | NavigationViewTestsBase | [inline, protected]
SetNavViewWidth(ControlWidth width) | NavigationViewTestsBase | [inline, protected]
SetThreshold(Threshold threshold, ComboBoxName name) | NavigationViewTestsBase | [inline, protected]
SettingsItemClickTest() | EventTests | [inline]
TestCleanup() | NavigationViewTestsBase | [inline]
Threshold enum name | NavigationViewTestsBase | [protected]
TopNavPosition enum name | NavigationViewTestsBase | [protected]
UIObjectContains(UIObject uIObject, string itemName) | NavigationViewTestsBase | [inline, protected]
UIObjectToString(UIObject uIObject) | NavigationViewTestsBase | [inline, protected]
VerifyBackAndCloseButtonsVisibility(bool inLeftMinimalPanelDisplayMode) | NavigationViewTestsBase | [inline, protected]
VerifyCorrectNumberOfEventsRaised() | EventTests | [inline]
VerifyEventsReturnExpectedDataTypesItemTemplate() | EventTests | [inline]
VerifyEventsReturnExpectedDataTypesMenuItems() | EventTests | [inline]
VerifyEventsReturnExpectedDataTypesMenuItemsSource() | EventTests | [inline]
VerifyHoldingKeyOnlyInvokesOnce() | EventTests | [inline]
VerifyLightDismissDoesntSendDuplicateEvents() | EventTests | [inline]
VerifyNavigationViewItemResponseToClickAfterBeingMovedBetweenFrames() | EventTests | [inline]
WaitAndAssertPaneStatus(PaneOpenStatus status) | NavigationViewTestsBase | [inline, protected]
Generated on Sun Dec 1 2024 20:53:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/PagerControlTemplateSettings.properties.cpp Source File

  • Generated

PagerControlTemplateSettings.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "PagerControlTemplateSettings.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(PagerControlTemplateSettings)
00012 }
00013
00014 #include "PagerControlTemplateSettings.g.cpp"
00015
00016 GlobalDependencyProperty PagerControlTemplateSettingsProperties::s_NumberPanelItemsProperty{ nullptr };
00017 GlobalDependencyProperty PagerControlTemplateSettingsProperties::s_PagesProperty{ nullptr };
00018
00019 PagerControlTemplateSettingsProperties::PagerControlTemplateSettingsProperties()
00020 {
00021     EnsureProperties();
00022 }
00023
00024 void PagerControlTemplateSettingsProperties::EnsureProperties()
00025 {
00026     if (!s_NumberPanelItemsProperty)
00027     {
00028         s_NumberPanelItemsProperty =
00029             InitializeDependencyProperty(
00030                 L"NumberPanelItems",
00031                 winrt::name_of<winrt::IVector<winrt::IInspectable>>(),
00032                 winrt::name_of<winrt::PagerControlTemplateSettings>(),
00033                 false /* isAttached */,
00034                 ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxedDefaultValue(),
00035                 nullptr);
00036     }
00037     if (!s_PagesProperty)
00038     {
00039         s_PagesProperty =
00040             InitializeDependencyProperty(
00041                 L"Pages",
00042                 winrt::name_of<winrt::IVector<winrt::IInspectable>>(),
00043                 winrt::name_of<winrt::PagerControlTemplateSettings>(),
00044                 false /* isAttached */,
00045                 ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxedDefaultValue(),
00046                 nullptr);
00047     }
00048 }
00049
00050 void PagerControlTemplateSettingsProperties::ClearProperties()
00051 {
00052     s_NumberPanelItemsProperty = nullptr;
00053     s_PagesProperty = nullptr;
00054 }
00055
00056 void PagerControlTemplateSettingsProperties::NumberPanelItems(winrt::IVector<winrt::IInspectable> const& value)
00057 {
00058     [[gsl::suppress(con)]]
00059     {
00060     static_cast<PagerControlTemplateSettings*>(this)->SetValue(s_NumberPanelItemsProperty, ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxValueIfNecessary(value));
00061     }
00062 }
00063
00064 winrt::IVector<winrt::IInspectable> PagerControlTemplateSettingsProperties::NumberPanelItems()
00065 {
00066     return ValueHelper<winrt::IVector<winrt::IInspectable>>::CastOrUnbox(static_cast<PagerControlTemplateSettings*>(this)->GetValue(s_NumberPanelItemsProperty));
00067 }
00068
00069 void PagerControlTemplateSettingsProperties::Pages(winrt::IVector<winrt::IInspectable> const& value)
00070 {
00071     [[gsl::suppress(con)]]
00072     {
00073     static_cast<PagerControlTemplateSettings*>(this)->SetValue(s_PagesProperty, ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxValueIfNecessary(value));
00074     }
00075 }
00076
00077 winrt::IVector<winrt::IInspectable> PagerControlTemplateSettingsProperties::Pages()
00078 {
00079     return ValueHelper<winrt::IVector<winrt::IInspectable>>::CastOrUnbox(static_cast<PagerControlTemplateSettings*>(this)->GetValue(s_PagesProperty));
00080 }
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemPresenterTemplateSettings.h Source File

  • NavigationView

NavigationViewItemPresenterTemplateSettings.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "NavigationViewItemPresenterTemplateSettings.g.h"
00007 #include "NavigationViewItemPresenterTemplateSettings.properties.h"
00008
00009 class NavigationViewItemPresenterTemplateSettings :
00010     public winrt::implementation::NavigationViewItemPresenterTemplateSettingsT<NavigationViewItemPresenterTemplateSettings>,
00011     public NavigationViewItemPresenterTemplateSettingsProperties
00012 {
00013 };
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemsRepeaterElementPreparedEventArgs.cpp Source File

  • Repeater

ItemsRepeaterElementPreparedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ItemsRepeater.common.h"
00007 #include "ItemsRepeaterElementPreparedEventArgs.h"
00008
00009 ItemsRepeaterElementPreparedEventArgs::ItemsRepeaterElementPreparedEventArgs(
00010     const winrt::UIElement& element,
00011     int index)
00012 {
00013     Update(element, index);
00014 }
00015
00016 #pragma region IElementPreparedEventArgs
00017
00018 winrt::UIElement ItemsRepeaterElementPreparedEventArgs::Element()
00019 {
00020     return m_element.get();
00021 }
00022
00023 int32_t ItemsRepeaterElementPreparedEventArgs::Index()
00024 {
00025     return m_index;
00026 }
00027
00028 #pragma endregion
00029
00030 void ItemsRepeaterElementPreparedEventArgs::Update(const winrt::UIElement& element, int index)
00031 {
00032     m_element.set(element);
00033     m_index = index;
00034 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PersonPicturePage Member List

This is the complete list of members for PersonPicturePage, including all inherited members.
BadgeGlyphTextBox_TextChanged(object sender, TextChangedEventArgs e) | PersonPicturePage | [inline, private]
BadgeNumberTextBox_TextChanged(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
ClearContactBtn_Click(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
ClearImageBtn_Click(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
ContactBtn_Click(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
ContactImageBtn_Click(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
DisplayNameTextBox_TextChanged(object sender, TextChangedEventArgs e) | PersonPicturePage | [inline, private]
FindAndGiveAutomationNameToVisualChild(string childName) | PersonPicturePage | [inline, private]
GetGroupedPeople() | PersonPicturePage | [inline, private, static]
GroupCheckBox_Checked(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
GroupCheckBox_Unchecked(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
ImageBtn_Click(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
imageUri | PersonPicturePage | [private]
InitialTextBox_TextChanged(object sender, TextChangedEventArgs e) | PersonPicturePage | [inline, private]
PersonPicture_LayoutUpdated(object sender, object e) | PersonPicturePage | [inline, private]
PersonPicture_Loaded(object sender, RoutedEventArgs e) | PersonPicturePage | [inline, private]
PersonPicturePage() | PersonPicturePage | [inline]
PrimaryEllipseFillChanged(DependencyObject o, DependencyProperty p) | PersonPicturePage | [inline, private]
primaryEllipseLoaded | PersonPicturePage | [private]
TestPersonPicture_SizeChanged(object sender, SizeChangedEventArgs e) | PersonPicturePage | [inline, private]
Generated on Sun Dec 1 2024 20:54:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/CommandingHelpers.h Source File

  • inc

CommandingHelpers.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 namespace CommandingHelpers
00007 {
00008     class IconSourceToIconSourceElementConverter : public winrt::implements<IconSourceToIconSourceElementConverter, winrt::IValueConverter>
00009     {
00010     public:
00011         winrt::IInspectable Convert(
00012             winrt::IInspectable const& value,
00013             winrt::TypeName const& targetType,
00014             winrt::IInspectable const& parameter,
00015             winrt::hstring const& language);
00016
00017         winrt::IInspectable ConvertBack(
00018             winrt::IInspectable const& value,
00019             winrt::TypeName const& targetType,
00020             winrt::IInspectable const& parameter,
00021             winrt::hstring const& language) noexcept;
00022     };
00023
00024     void BindToIconPropertyIfUnset(
00025         winrt::XamlUICommand const& uiCommand,
00026         winrt::DependencyObject const& target,
00027         winrt::DependencyProperty const& iconProperty);
00028
00029     void BindToIconSourcePropertyIfUnset(
00030         winrt::XamlUICommand const& uiCommand,
00031         winrt::DependencyObject const& target,
00032         winrt::DependencyProperty const& iconSourceProperty);
00033
00034     void BindToLabelPropertyIfUnset(
00035         winrt::XamlUICommand const& uiCommand,
00036         winrt::DependencyObject const& target,
00037         winrt::DependencyProperty const& labelProperty);
00038
00039     void BindToKeyboardAcceleratorsIfUnset(
00040         winrt::XamlUICommand const& uiCommand,
00041         winrt::UIElement const& target);
00042
00043     void BindToAccessKeyIfUnset(
00044         winrt::XamlUICommand const& uiCommand,
00045         winrt::UIElement const& target);
00046
00047     void BindToDescriptionPropertiesIfUnset(
00048         winrt::XamlUICommand const& uiCommand,
00049         winrt::DependencyObject const& target);
00050
00051     void ClearBindingIfSet(
00052         winrt::XamlUICommand const& uiCommand,
00053         winrt::FrameworkElement const& target,
00054         winrt::DependencyProperty const& targetProperty);
00055 };
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

enum_array< E, T, N > Member List

This is the complete list of members for enum_array< E, T, N >, including all inherited members.
operator[](E e) | enum_array< E, T, N > | [inline]
operator[](E e) const | enum_array< E, T, N > | [inline]
Generated on Sun Dec 1 2024 20:52:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterWithCompositionScrollControllersPage Member List

This is the complete list of members for ScrollPresenterWithCompositionScrollControllersPage, including all inherited members.
BtnClearLog_Click(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsAnimatingThumbOffset_Checked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsAnimatingThumbOffset_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsHorizontallyScrollable_Checked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsHorizontallyScrollable_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsThumbPannable_Checked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsThumbPannable_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsThumbPositionMirrored_Checked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsThumbPositionMirrored_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsVerticallyScrollable_Checked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsVerticallyScrollable_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsVisible_Checked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ChkIsVisible_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
cmbHorizontalOverriddenOffsetsChangeAnimation_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
CmbHorizontalScrollController_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
cmbVerticalOverriddenOffsetsChangeAnimation_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
CmbVerticalScrollController_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
CompositionScrollController_LogMessage(CompositionScrollController sender, string args) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
LogMessage(string message) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
ScrollPresenterWithCompositionScrollControllersPage() | ScrollPresenterWithCompositionScrollControllersPage | [inline]
txtHorizontalOverriddenOffsetsChangeDuration_TextChanged(object sender, TextChangedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
txtVerticalOverriddenOffsetsChangeDuration_TextChanged(object sender, TextChangedEventArgs e) | ScrollPresenterWithCompositionScrollControllersPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/ColorSpectrumAutomationPeer.h Source File

  • ColorPicker

ColorSpectrumAutomationPeer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ColorSpectrum.h"
00007
00008 #include "ColorSpectrumAutomationPeer.g.h"
00009
00010 class ColorSpectrumAutomationPeer :
00011     public ReferenceTracker<ColorSpectrumAutomationPeer, winrt::implementation::ColorSpectrumAutomationPeerT, winrt::IValueProvider>
00012 {
00013 public:
00014     ColorSpectrumAutomationPeer(winrt::ColorSpectrum const& owner);
00015
00016     // IAutomationPeerOverrides
00017     winrt::IInspectable GetPatternCore(winrt::PatternInterface const& patternInterface);
00018     winrt::AutomationControlType GetAutomationControlTypeCore();
00019     winrt::hstring GetLocalizedControlTypeCore();
00020     winrt::hstring GetNameCore();
00021     winrt::hstring GetClassNameCore();
00022     winrt::hstring GetHelpTextCore();
00023     winrt::Rect GetBoundingRectangleCore();
00024     winrt::Point GetClickablePointCore();
00025
00026     // IValueProvider properties and methods
00027     bool IsReadOnly();
00028     winrt::hstring Value();
00029     void SetValue(winrt::hstring const& value);
00030
00031     void RaisePropertyChangedEvent(winrt::Color oldColor, winrt::Color newColor, winrt::float4 oldHsvColor, winrt::float4 newHsvColor);
00032
00033 private:
00034     static winrt::hstring GetValueString(winrt::Color color, winrt::float4 hsvColor);
00035 };
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewTabCloseRequestedEventArgs Member List

This is the complete list of members for TabViewTabCloseRequestedEventArgs, including all inherited members.
Item() | TabViewTabCloseRequestedEventArgs | [inline]
Tab() | TabViewTabCloseRequestedEventArgs | [inline]
TabViewTabCloseRequestedEventArgs(winrt::IInspectable const &item, winrt::TabViewItem tab) | TabViewTabCloseRequestedEventArgs | [inline]
Generated on Sun Dec 1 2024 20:53:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TwoPaneView/TwoPaneView.cpp Source File

  • TwoPaneView

TwoPaneView.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TwoPaneView.h"
00007 #include "DisplayRegionHelperTestApi.h"
00008 #include "RuntimeProfiler.h"
00009
00010 static constexpr auto c_pane1ScrollViewerName = L"PART_Pane1ScrollViewer";
00011 static constexpr auto c_pane2ScrollViewerName = L"PART_Pane2ScrollViewer";
00012
00013 static constexpr auto c_columnLeftName   = L"PART_ColumnLeft"sv;
00014 static constexpr auto c_columnMiddleName = L"PART_ColumnMiddle"sv;
00015 static constexpr auto c_columnRightName  = L"PART_ColumnRight"sv;
00016 static constexpr auto c_rowTopName       = L"PART_RowTop"sv;
00017 static constexpr auto c_rowMiddleName    = L"PART_RowMiddle"sv;
00018 static constexpr auto c_rowBottomName    = L"PART_RowBottom"sv;
00019
00020 using namespace std;
00021
00022 TwoPaneView::TwoPaneView()
00023 {
00024     __RP_Marker_ClassById(RuntimeProfiler::ProfId_TwoPaneView);
00025
00026     SetDefaultStyleKey(this);
00027
00028     SizeChanged({ this, &TwoPaneView::OnSizeChanged });
00029
00030     EnsureProperties();
00031 }
00032
00033 void TwoPaneView::OnApplyTemplate()
00034 {
00035     m_loaded = true;
00036
00037     m_xamlRootChangedRevoker = XamlRoot().Changed(winrt::auto_revoke, { this, &TwoPaneView::OnXamlRootChanged });
00038
00039     winrt::IControlProtected controlProtected = *this;
00040
00041     SetScrollViewerProperties(c_pane1ScrollViewerName, m_pane1LoadedRevoker);
00042     SetScrollViewerProperties(c_pane2ScrollViewerName, m_pane2LoadedRevoker);
00043
00044     if (auto column = GetTemplateChildT<winrt::ColumnDefinition>(c_columnLeftName, controlProtected))
00045     {
00046         m_columnLeft.set(column);
00047     }
00048     if (auto column = GetTemplateChildT<winrt::ColumnDefinition>(c_columnMiddleName, controlProtected))
00049     {
00050         m_columnMiddle.set(column);
00051     }
00052     if (auto column = GetTemplateChildT<winrt::ColumnDefinition>(c_columnRightName, controlProtected))
00053     {
00054         m_columnRight.set(column);
00055     }
00056     if (auto row = GetTemplateChildT<winrt::RowDefinition>(c_rowTopName, controlProtected))
00057     {
00058         m_rowTop.set(row);
00059     }
00060     if (auto row = GetTemplateChildT<winrt::RowDefinition>(c_rowMiddleName, controlProtected))
00061     {
00062         m_rowMiddle.set(row);
00063     }
00064     if (auto row = GetTemplateChildT<winrt::RowDefinition>(c_rowBottomName, controlProtected))
00065     {
00066         m_rowBottom.set(row);
00067     }
00068 }
00069
00070 void TwoPaneView::SetScrollViewerProperties(std::wstring_view const& scrollViewerName, winrt::Control::Loaded_revoker& revoker)
00071 {
00072     if (auto scrollViewer = GetTemplateChildT<winrt::FxScrollViewer>(scrollViewerName, *this))
00073     {
00074         revoker = scrollViewer.Loaded(winrt::auto_revoke, { this, &TwoPaneView::OnScrollViewerLoaded });
00075     }
00076 }
00077
00078 void TwoPaneView::OnScrollViewerLoaded(const winrt::IInspectable& sender, const winrt::RoutedEventArgs& args)
00079 {
00080     if (auto scrollViewer = sender.as<winrt::FrameworkElement>())
00081     {
00082         auto scrollContentPresenterFE = SharedHelpers::FindInVisualTreeByName(scrollViewer, L"ScrollContentPresenter");
00083         if (scrollContentPresenterFE)
00084         {
00085             if (auto scrollContentPresenter = scrollContentPresenterFE.as<winrt::ScrollContentPresenter>())
00086             {
00087                 scrollContentPresenter.SizesContentToTemplatedParent(true);
00088             }
00089         }
00090     }
00091 }
00092
00093 void TwoPaneView::OnXamlRootChanged(const winrt::IInspectable& sender, const winrt::Microsoft::UI::Xaml::XamlRootChangedEventArgs& args)
00094 {
00095     UpdateMode();
00096 }
00097
00098 void TwoPaneView::OnSizeChanged(const winrt::IInspectable& sender, const winrt::SizeChangedEventArgs& args)
00099 {
00100     UpdateMode();
00101 }
00102
00103 void TwoPaneView::UpdateMode()
00104 {
00105     // Don't bother running this logic until after we hit OnApplyTemplate.
00106     if (!m_loaded) return;
00107
00108     const double controlWidth = ActualWidth();
00109     const double controlHeight = ActualHeight();
00110
00111     ViewMode newMode = (PanePriority() == winrt::TwoPaneViewPriority::Pane1) ? ViewMode::Pane1Only : ViewMode::Pane2Only;
00112
00113     // Calculate new mode
00114     const DisplayRegionHelperInfo info = DisplayRegionHelper::GetRegionInfo();
00115     const winrt::Rect rcControl = GetControlRect();
00116     const bool isInMultipleRegions = IsInMultipleRegions(info, rcControl);
00117
00118     if (isInMultipleRegions)
00119     {
00120         if (info.Mode == winrt::TwoPaneViewMode::Wide)
00121         {
00122             // Regions are laid out horizontally
00123             if (WideModeConfiguration() != winrt::TwoPaneViewWideModeConfiguration::SinglePane)
00124             {
00125                 newMode = (WideModeConfiguration() == winrt::TwoPaneViewWideModeConfiguration::LeftRight) ? ViewMode::LeftRight : ViewMode::RightLeft;
00126             }
00127         }
00128         else if (info.Mode == winrt::TwoPaneViewMode::Tall)
00129         {
00130             // Regions are laid out vertically
00131             if (TallModeConfiguration() != winrt::TwoPaneViewTallModeConfiguration::SinglePane)
00132             {
00133                 newMode = (TallModeConfiguration() == winrt::TwoPaneViewTallModeConfiguration::TopBottom) ? ViewMode::TopBottom : ViewMode::BottomTop;
00134             }
00135         }
00136     }
00137     else
00138     {
00139         // One region
00140         if (controlWidth > MinWideModeWidth() && WideModeConfiguration() != winrt::TwoPaneViewWideModeConfiguration::SinglePane)
00141         {
00142             // Split horizontally
00143             newMode = (WideModeConfiguration() == winrt::TwoPaneViewWideModeConfiguration::LeftRight) ? ViewMode::LeftRight : ViewMode::RightLeft;
00144         }
00145         else if (controlHeight > MinTallModeHeight() && TallModeConfiguration() != winrt::TwoPaneViewTallModeConfiguration::SinglePane)
00146         {
00147             // Split vertically
00148             newMode = (TallModeConfiguration() == winrt::TwoPaneViewTallModeConfiguration::TopBottom) ? ViewMode::TopBottom : ViewMode::BottomTop;
00149         }
00150     }
00151
00152     // Update row/column sizes (this may need to happen even if the mode doesn't change)
00153     UpdateRowsColumns(newMode, info, rcControl);
00154
00155     // Update mode if necessary
00156     if (newMode != m_currentMode)
00157     {
00158         m_currentMode = newMode;
00159
00160         winrt::TwoPaneViewMode newViewMode = winrt::TwoPaneViewMode::SinglePane;
00161
00162         switch (m_currentMode)
00163         {
00164             case ViewMode::Pane1Only: winrt::VisualStateManager::GoToState(*this, L"ViewMode_OneOnly", true); break;
00165             case ViewMode::Pane2Only: winrt::VisualStateManager::GoToState(*this, L"ViewMode_TwoOnly", true); break;
00166             case ViewMode::LeftRight: winrt::VisualStateManager::GoToState(*this, L"ViewMode_LeftRight", true); newViewMode = winrt::TwoPaneViewMode::Wide; break;
00167             case ViewMode::RightLeft: winrt::VisualStateManager::GoToState(*this, L"ViewMode_RightLeft", true); newViewMode = winrt::TwoPaneViewMode::Wide; break;
00168             case ViewMode::TopBottom: winrt::VisualStateManager::GoToState(*this, L"ViewMode_TopBottom", true); newViewMode = winrt::TwoPaneViewMode::Tall; break;
00169             case ViewMode::BottomTop: winrt::VisualStateManager::GoToState(*this, L"ViewMode_BottomTop", true); newViewMode = winrt::TwoPaneViewMode::Tall; break;
00170         }
00171
00172         if (newViewMode != Mode())
00173         {
00174             SetValue(s_ModeProperty, box_value(newViewMode));
00175             m_modeChangedEventSource(*this, *this);
00176         }
00177     }
00178 }
00179
00180 void TwoPaneView::UpdateRowsColumns(ViewMode newMode, DisplayRegionHelperInfo info, winrt::Rect rcControl)
00181 {
00182     if (m_columnLeft && m_columnMiddle && m_columnRight && m_rowTop && m_rowMiddle && m_rowBottom)
00183     {
00184         // Reset split lengths
00185         m_columnMiddle.get().Width({ 0, winrt::GridUnitType::Pixel });
00186         m_rowMiddle.get().Height({ 0, winrt::GridUnitType::Pixel });
00187
00188         // Set columns lengths
00189         if (newMode == ViewMode::LeftRight || newMode == ViewMode::RightLeft)
00190         {
00191             m_columnLeft.get().Width((newMode == ViewMode::LeftRight) ? Pane1Length() : Pane2Length());
00192             m_columnRight.get().Width((newMode == ViewMode::LeftRight) ? Pane2Length() : Pane1Length());
00193         }
00194         else
00195         {
00196             m_columnLeft.get().Width({ 1, winrt::GridUnitType::Star });
00197             m_columnRight.get().Width({ 0, winrt::GridUnitType::Pixel });
00198         }
00199
00200         // Set row lengths
00201         if (newMode == ViewMode::TopBottom || newMode == ViewMode::BottomTop)
00202         {
00203             m_rowTop.get().Height((newMode == ViewMode::TopBottom) ? Pane1Length() : Pane2Length());
00204             m_rowBottom.get().Height((newMode == ViewMode::TopBottom) ? Pane2Length() : Pane1Length());
00205         }
00206         else
00207         {
00208             m_rowTop.get().Height({ 1, winrt::GridUnitType::Star });
00209             m_rowBottom.get().Height({ 0, winrt::GridUnitType::Pixel });
00210         }
00211
00212         // Handle regions
00213         if (IsInMultipleRegions(info, rcControl) && newMode != ViewMode::Pane1Only && newMode != ViewMode::Pane2Only)
00214         {
00215             const winrt::Rect rc1 = info.Regions[0];
00216             const winrt::Rect rc2 = info.Regions[1];
00217             const winrt::Rect rcWindow = DisplayRegionHelper::WindowRect();
00218
00219             if (info.Mode == winrt::TwoPaneViewMode::Wide)
00220             {
00221                 m_columnMiddle.get().Width({ static_cast<double>(rc2.X) - rc1.Width, winrt::GridUnitType::Pixel });
00222
00223                 m_columnLeft.get().Width({ static_cast<double>(rc1.Width) - rcControl.X , winrt::GridUnitType::Pixel });
00224                 m_columnRight.get().Width({ static_cast<double>(rc2.Width) - ((static_cast<double>(rcWindow.Width) - rcControl.Width) - rcControl.X) , winrt::GridUnitType::Pixel });
00225             }
00226             else
00227             {
00228                 m_rowMiddle.get().Height({ static_cast<double>(rc2.Y) - rc1.Height, winrt::GridUnitType::Pixel });
00229
00230                 m_rowTop.get().Height({ static_cast<double>(rc1.Height) - rcControl.Y , winrt::GridUnitType::Pixel });
00231                 m_rowBottom.get().Height({ static_cast<double>(rc2.Height) - ((static_cast<double>(rcWindow.Height) - rcControl.Height) - rcControl.Y) , winrt::GridUnitType::Pixel });
00232             }
00233         }
00234     }
00235 }
00236
00237 winrt::Rect TwoPaneView::GetControlRect()
00238 {
00239     // Find out where this control is in the window
00240     winrt::GeneralTransform transform = TransformToVisual(DisplayRegionHelper::WindowElement());
00241     return transform.TransformBounds({ 0, 0, (float)ActualWidth(), (float)ActualHeight() });
00242 }
00243
00244 bool TwoPaneView::IsInMultipleRegions(DisplayRegionHelperInfo info, winrt::Rect rcControl)
00245 {
00246     bool isInMultipleRegions = false;
00247
00248     if (info.Mode != winrt::TwoPaneViewMode::SinglePane)
00249     {
00250         const winrt::Rect rc1 = info.Regions[0];
00251         const winrt::Rect rc2 = info.Regions[1];
00252
00253         if (info.Mode == winrt::TwoPaneViewMode::Wide)
00254         {
00255             // Check that the control is over the split
00256             if (rcControl.X < rc1.Width && rcControl.X + rcControl.Width > rc2.X)
00257             {
00258                 isInMultipleRegions = true;
00259             }
00260         }
00261         else if (info.Mode == winrt::TwoPaneViewMode::Tall)
00262         {
00263             // Check that the control is over the split
00264             if (rcControl.Y < rc1.Height && rcControl.Y + rcControl.Height > rc2.Y)
00265             {
00266                 isInMultipleRegions = true;
00267             }
00268         }
00269     }
00270
00271     return isInMultipleRegions;
00272 }
00273
00274 void TwoPaneView::OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args)
00275 {
00276     auto property = args.Property();
00277
00278     // Clamp property values -- early return if the values were clamped as we'll come back with the new value.
00279     if (property == s_MinWideModeWidthProperty || property == s_MinTallModeHeightProperty)
00280     {
00281         auto value = winrt::unbox_value<double>(args.NewValue());
00282         auto clampedValue = std::max(0.0, value);
00283         if (clampedValue != value)
00284         {
00285             SetValue(property, winrt::box_value(clampedValue));
00286             return;
00287         }
00288     }
00289
00290     if (property == s_PanePriorityProperty
00291         || property == s_Pane1LengthProperty
00292         || property == s_Pane2LengthProperty
00293         || property == s_WideModeConfigurationProperty
00294         || property == s_TallModeConfigurationProperty
00295         || property == s_MinWideModeWidthProperty
00296         || property == s_MinTallModeHeightProperty)
00297     {
00298         UpdateMode();
00299     }
00300 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/BreadcrumbBarItem.properties.cpp Source File

  • Generated

BreadcrumbBarItem.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "BreadcrumbBarItem.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(BreadcrumbBarItem)
00012 }
00013
00014 #include "BreadcrumbBarItem.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

FlowLayoutCollectionChangeTests Member List

This is the complete list of members for FlowLayoutCollectionChangeTests, including all inherited members.
CanMoveItem() | FlowLayoutCollectionChangeTests | [inline]
CanRemoveAndInsertItemsInRealizedRange() | FlowLayoutCollectionChangeTests | [inline]
CanRemoveItemsAfterRealizedRange() | FlowLayoutCollectionChangeTests | [inline]
CanRemoveItemsStartingBeforeRealizedRange() | FlowLayoutCollectionChangeTests | [inline]
CanRemoveItemsStartingInRealizedRange() | FlowLayoutCollectionChangeTests | [inline]
CanReplaceSingleItem() | FlowLayoutCollectionChangeTests | [inline]
DefaultWaitTime | FlowLayoutCollectionChangeTests | [private]
EnsureReplaceOfAnchorDoesNotResetAllContainers() | FlowLayoutCollectionChangeTests | [inline]
GetElementFactory() | FlowLayoutCollectionChangeTests | [inline, private]
ReplaceMultipleItems() | FlowLayoutCollectionChangeTests | [inline]
SetupRepeater(CustomItemsSource dataSource) | FlowLayoutCollectionChangeTests | [inline, private]
SetupRepeater(CustomItemsSource dataSource, VirtualizingLayout layout) | FlowLayoutCollectionChangeTests | [inline, private]
SetupRepeater(CustomItemsSource dataSource, ElementFactory elementFactory=null) | FlowLayoutCollectionChangeTests | [inline, private]
SetupRepeater(CustomItemsSource dataSource, ref ScrollViewer scrollViewer) | FlowLayoutCollectionChangeTests | [inline, private]
SetupRepeater(CustomItemsSource dataSource, ElementFactory elementFactory, ref ScrollViewer scrollViewer, VirtualizingLayout layout) | FlowLayoutCollectionChangeTests | [inline, private]
ValidateClear() | FlowLayoutCollectionChangeTests | [inline]
ValidateInserts() | FlowLayoutCollectionChangeTests | [inline]
ValidateRegularResets() | FlowLayoutCollectionChangeTests | [inline]
ValidateSentinelsDuringInserts() | FlowLayoutCollectionChangeTests | [inline]
ValidateStableResets() | FlowLayoutCollectionChangeTests | [inline]
VerifyElement0OwnershipInUniformGridLayout() | FlowLayoutCollectionChangeTests | [inline]
VerifyRealizedRange(ItemsRepeater repeater, CustomItemsSource dataSource) | FlowLayoutCollectionChangeTests | [inline, private]
Generated on Sun Dec 1 2024 20:53:39 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InfoBarTemplateSettings.properties.cpp Source File

  • Generated

InfoBarTemplateSettings.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InfoBarTemplateSettings.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(InfoBarTemplateSettings)
00012 }
00013
00014 #include "InfoBarTemplateSettings.g.cpp"
00015
00016 GlobalDependencyProperty InfoBarTemplateSettingsProperties::s_IconElementProperty{ nullptr };
00017
00018 InfoBarTemplateSettingsProperties::InfoBarTemplateSettingsProperties()
00019 {
00020     EnsureProperties();
00021 }
00022
00023 void InfoBarTemplateSettingsProperties::EnsureProperties()
00024 {
00025     if (!s_IconElementProperty)
00026     {
00027         s_IconElementProperty =
00028             InitializeDependencyProperty(
00029                 L"IconElement",
00030                 winrt::name_of<winrt::IconElement>(),
00031                 winrt::name_of<winrt::InfoBarTemplateSettings>(),
00032                 false /* isAttached */,
00033                 ValueHelper<winrt::IconElement>::BoxedDefaultValue(),
00034                 nullptr);
00035     }
00036 }
00037
00038 void InfoBarTemplateSettingsProperties::ClearProperties()
00039 {
00040     s_IconElementProperty = nullptr;
00041 }
00042
00043 void InfoBarTemplateSettingsProperties::IconElement(winrt::IconElement const& value)
00044 {
00045     [[gsl::suppress(con)]]
00046     {
00047     static_cast<InfoBarTemplateSettings*>(this)->SetValue(s_IconElementProperty, ValueHelper<winrt::IconElement>::BoxValueIfNecessary(value));
00048     }
00049 }
00050
00051 winrt::IconElement InfoBarTemplateSettingsProperties::IconElement()
00052 {
00053     return ValueHelper<winrt::IconElement>::CastOrUnbox(static_cast<InfoBarTemplateSettings*>(this)->GetValue(s_IconElementProperty));
00054 }
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/IndexPath.cpp Source File

  • Repeater

IndexPath.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "IndexPath.h"
00008
00009 #include "IndexPath.properties.cpp"
00010
00011 IndexPath::IndexPath(int index)
00012 {
00013     m_path.emplace_back(index);
00014 }
00015
00016 IndexPath::IndexPath(int groupIndex, int itemIndex)
00017 {
00018     m_path.emplace_back(groupIndex);
00019     m_path.emplace_back(itemIndex);
00020 }
00021
00022 IndexPath::IndexPath(const winrt::IVector<int>& indices)
00023 {
00024     if (indices)
00025     {
00026         for (auto i = 0u; i < indices.Size(); i++)
00027         {
00028             m_path.emplace_back(indices.GetAt(i));
00029         }
00030     }
00031 }
00032
00033 IndexPath::IndexPath(const std::vector<int>& indices)
00034 {
00035     for (auto i = 0u; i < indices.size(); i++)
00036     {
00037         m_path.emplace_back(indices[i]);
00038     }
00039 }
00040
00041 #pragma region IIndexPath
00042
00043 int32_t IndexPath::GetSize()
00044 {
00045     return static_cast<int>(m_path.size());
00046 }
00047
00048 int32_t IndexPath::GetAt(int index)
00049 {
00050     return m_path.at(index);
00051 }
00052
00053 int32_t IndexPath::CompareTo(winrt::IndexPath const& rhs)
00054 {
00055     const auto rhsPath = winrt::get_self<IndexPath>(rhs);
00056     int compareResult = 0;
00057     const int lhsCount = static_cast<int>(m_path.size());
00058     const int rhsCount = static_cast<int>(rhsPath->m_path.size());
00059
00060     if (lhsCount == 0 || rhsCount == 0)
00061     {
00062         // one of the paths are empty, compare based on size
00063         compareResult = (lhsCount - rhsCount);
00064     }
00065     else
00066     {
00067         // both paths are non-empty, but can be of different size
00068         for (int i = 0; i < std::min(lhsCount, rhsCount); i++)
00069         {
00070             if (m_path[i] < rhsPath->m_path[i])
00071             {
00072                 compareResult = -1;
00073                 break;
00074             }
00075             else if (m_path[i] > rhsPath->m_path[i])
00076             {
00077                 compareResult = 1;
00078                 break;
00079             }
00080         }
00081
00082         // if both match upto min(lhsCount, rhsCount), compare based on size
00083         compareResult = compareResult == 0 ? (lhsCount - rhsCount) : compareResult;
00084     }
00085
00086     if (compareResult != 0)
00087     {
00088         compareResult = compareResult > 0 ? 1 : -1;
00089     }
00090
00091     return compareResult;
00092 }
00093
00094 #pragma endregion
00095
00096 #pragma region IStringable
00097
00098 hstring IndexPath::ToString()
00099 {
00100     std::wstring result = L"R";
00101     for (const int index : m_path)
00102     {
00103         result.append(L".");
00104         result = result + std::to_wstring(index);
00105     }
00106
00107     return hstring{ result };
00108 }
00109
00110 #pragma endregion
00111
00112 bool IndexPath::IsValid() const
00113 {
00114     bool isValid = true;
00115     for (int i = 0; i < static_cast<int>(m_path.size()); i++)
00116     {
00117         if (m_path[i] < 0)
00118         {
00119             isValid = false;
00120             break;
00121         }
00122     }
00123
00124     return isValid;
00125 }
00126
00127 winrt::IndexPath IndexPath::CloneWithChildIndex(int childIndex) const
00128 {
00129     auto newPath = std::vector<int>(m_path);
00130     newPath.emplace_back(childIndex);
00131     return winrt::make<IndexPath>(newPath);
00132 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PipsPager/PipsPager.h Source File

  • PipsPager

PipsPager.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008 #include "PipsPager.g.h"
00009 #include "PipsPager.properties.h"
00010
00011 class PipsPagerViewItemRevokers : public winrt::implements<PipsPagerViewItemRevokers, winrt::IInspectable>
00012 {
00013 public:
00014     winrt::Button::Click_revoker clickRevoker{};
00015 };
00016
00017 class PipsPager :
00018     public ReferenceTracker<PipsPager, winrt::implementation::PipsPagerT>,
00019     public PipsPagerProperties
00020 {
00021 public:
00022     PipsPager();
00023
00024     /* IFrameworkElement */
00025     void OnApplyTemplate();
00026     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00027
00028     /* Accessibility */
00029     winrt::AutomationPeer OnCreateAutomationPeer();
00030     void UpdateSizeOfSetForElements(const int numberOfPages, const int numberOfItems);
00031
00032     void OnPointerEntered(const winrt::PointerRoutedEventArgs& args);
00033     void OnPointerExited(const winrt::PointerRoutedEventArgs& args);
00034     void OnPointerCanceled(const winrt::PointerRoutedEventArgs& args);
00035     void OnKeyDown(const winrt::KeyRoutedEventArgs& args);
00036     void LosingFocus(const IInspectable& sender, const winrt::LosingFocusEventArgs& args);
00037     void OnLostFocus(const winrt::RoutedEventArgs& args);
00038     void OnGotFocus(const winrt::RoutedEventArgs& args);
00039
00040     /* Property changed handlers */
00041     void OnNumberOfPagesChanged();
00042     void OnSelectedPageIndexChanged(const int oldValue);
00043     void OnMaxVisiblePipsChanged();
00044     void OnNavigationButtonVisibilityChanged(
00045         const winrt::PipsPagerButtonVisibility visibility,
00046         const wstring_view& collapsedStateName,
00047         const wstring_view& disabledStateName);
00048     void OnOrientationChanged();
00049     void OnWrapModeChanged();
00050
00051     winrt::UIElement GetSelectedItem();
00052
00053     /* Dependency property for pip buttons revokers */
00054     GlobalDependencyProperty s_pipButtonHandlersProperty;
00055
00056 private:
00057     /* UI updating */
00058     void UpdateNavigationButtonVisualStates();
00059     void SetScrollViewerMaxSize();
00060     bool IsOutOfControlBounds(const winrt::Point& point);
00061     void UpdateIndividualNavigationButtonVisualState(
00062         const bool hiddenOnEdgeCondition,
00063         const winrt::PipsPagerButtonVisibility visibility,
00064         const wstring_view& visibleStateName,
00065         const wstring_view& hiddenStateName,
00066         const wstring_view& enabledStateName,
00067         const wstring_view& disabledStateName);
00068     winrt::Size GetDesiredPipSize(const winrt::Style& style);
00069     void ScrollToCenterOfViewport(const winrt::UIElement sender, const int index);
00070     double CalculateScrollViewerSize(const double defaultPipSize, const double selectedPipSize, const int numberOfPages, int maxVisualIndicators);
00071     void UpdateSelectedPip(const int index);
00072     void UpdatePipOrientation(const winrt::Control& pip);
00073     void ApplyStyleToPipAndUpdateOrientation(const winrt::FrameworkElement& pip, const winrt::Style& style);
00074     void RestoreLayoutVirtualization();
00075     void UpdateLayoutVirtualization();
00076     bool IsWrapEnabled(){ return WrapMode() == winrt::PipsPagerWrapMode::Wrap; };
00077     /* Eventing */
00078     void RaiseSelectedIndexChanged();
00079
00080     /* Interaction event listeners */
00081     void OnPreviousButtonClicked(const IInspectable& sender, const winrt::RoutedEventArgs& args);
00082     void OnNextButtonClicked(const IInspectable& sender, const winrt::RoutedEventArgs& args);
00083     void OnPipsAreaGettingFocus(const IInspectable& sender, const winrt::GettingFocusEventArgs& args);
00084     void OnPipsAreaBringIntoViewRequested(const IInspectable& sender, const winrt::BringIntoViewRequestedEventArgs& args);
00085     void OnScrollViewerBringIntoViewRequested(const IInspectable& sender, const winrt::BringIntoViewRequestedEventArgs& args);
00086
00087     /* Event listeners */
00088     void OnItemsRepeaterLayoutChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& args);
00089
00090     /* Pips Logic */
00091     void UpdatePipsItems(const int numberOfPages, int maxVisualIndicators);
00092     void OnElementPrepared(winrt::ItemsRepeater sender, winrt::ItemsRepeaterElementPreparedEventArgs args);
00093     void OnElementIndexChanged(const winrt::ItemsRepeater& repeater, const winrt::ItemsRepeaterElementIndexChangedEventArgs& args);
00094
00095     /* Refs */
00096     tracker_ref<winrt::ItemsRepeater> m_pipsPagerRepeater{ this };
00097     tracker_ref<winrt::FxScrollViewer> m_pipsPagerScrollViewer{ this };
00098     tracker_ref<winrt::Button> m_previousPageButton{ this };
00099     tracker_ref<winrt::Button> m_nextPageButton{ this };
00100
00101     /* Revokers */
00102     winrt::Button::Click_revoker m_previousPageButtonClickRevoker{};
00103     winrt::Button::Click_revoker m_nextPageButtonClickRevoker{};
00104     winrt::ItemsRepeater::ElementPrepared_revoker m_pipsPagerElementPreparedRevoker{};
00105     winrt::UIElement::GettingFocus_revoker m_pipsAreaGettingFocusRevoker{};
00106     winrt::ItemsRepeater::BringIntoViewRequested_revoker m_pipsAreaBringIntoViewRequestedRevoker{};
00107     winrt::FxScrollViewer::BringIntoViewRequested_revoker m_scrollViewerBringIntoViewRequestedRevoker{};
00108     PropertyChanged_revoker m_itemsRepeaterStackLayoutChangedRevoker{};
00109     /* Items */
00110     winrt::IObservableVector<int> m_pipsPagerItems{};
00111
00112     /* Additional variables class variables*/
00113     winrt::Size m_defaultPipSize{ 0.0,0.0 };
00114     winrt::Size m_selectedPipSize{ 0.0, 0.0 };
00115     int m_lastSelectedPageIndex{ -1 };
00116     bool m_isPointerOver{ false };
00117     bool m_isFocused{ false };
00118     winrt::weak_ref<winrt::StackLayout> m_itemsRepeaterStackLayout{ nullptr };
00119     bool m_cachedIsVirtualizationEnabledFlag{ true };
00120 };
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LuminanceToAlphaEffect Member List

This is the complete list of members for LuminanceToAlphaEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1LuminanceToAlpha) | LuminanceToAlphaEffect
DECLARE_SINGLE_SOURCE(Source) | LuminanceToAlphaEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewItemTemplateSettings Member List

This is the complete list of members for TabViewItemTemplateSettings, including all inherited members.
ClearProperties() | TabViewItemTemplateSettingsProperties | [static]
EnsureProperties() | TabViewItemTemplateSettingsProperties | [static]
IconElement(winrt::IconElement const &value) | TabViewItemTemplateSettingsProperties |
IconElement() | TabViewItemTemplateSettingsProperties |
IconElementProperty() | TabViewItemTemplateSettingsProperties | [inline, static]
s_IconElementProperty | TabViewItemTemplateSettingsProperties | [static]
s_TabGeometryProperty | TabViewItemTemplateSettingsProperties | [static]
TabGeometry(winrt::Geometry const &value) | TabViewItemTemplateSettingsProperties |
TabGeometry() | TabViewItemTemplateSettingsProperties |
TabGeometryProperty() | TabViewItemTemplateSettingsProperties | [inline, static]
TabViewItemTemplateSettings() | TabViewItemTemplateSettings | [inline]
TabViewItemTemplateSettingsProperties() | TabViewItemTemplateSettingsProperties |
Generated on Sun Dec 1 2024 20:53:14 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/SelectionSample/Common/Data.cs Source File

  • Repeater
  • TestUI
  • Samples
  • SelectionSample
  • Common

Data.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.ObjectModel;
00005 using MUXControlsTestApp.Utilities;
00006
00007 namespace MUXControlsTestApp.Samples.Selection
00008 {
00009     public class Data
00010     {
00011         static int _next = 0;
00012
00013         public static ObservableCollection<object> CreateNested(int levels = 3, int groupsAtLevel = 5, int countAtLeaf = 10)
00014         {
00015             var data = new ObservableCollection<object>();
00016             if (levels != 0)
00017             {
00018                 for (int i = 0; i < groupsAtLevel; i++)
00019                 {
00020                     data.Add(CreateNested(levels - 1, groupsAtLevel, countAtLeaf));
00021                 }
00022             }
00023             else
00024             {
00025                 for (int i = 0; i < countAtLeaf; i++)
00026                 {
00027                     data.Add(_next++);
00028                 }
00029             }
00030
00031             return data;
00032         }
00033     }
00034 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RatingControlProperties Member List

This is the complete list of members for RatingControlProperties, including all inherited members.
Caption(winrt::hstring const &value) | RatingControlProperties |
Caption() | RatingControlProperties |
CaptionProperty() | RatingControlProperties | [inline, static]
ClearProperties() | RatingControlProperties | [static]
EnsureProperties() | RatingControlProperties | [static]
InitialSetValue(int value) | RatingControlProperties |
InitialSetValue() | RatingControlProperties |
InitialSetValueProperty() | RatingControlProperties | [inline, static]
IsClearEnabled(bool value) | RatingControlProperties |
IsClearEnabled() | RatingControlProperties |
IsClearEnabledProperty() | RatingControlProperties | [inline, static]
IsReadOnly(bool value) | RatingControlProperties |
IsReadOnly() | RatingControlProperties |
IsReadOnlyProperty() | RatingControlProperties | [inline, static]
ItemInfo(winrt::RatingItemInfo const &value) | RatingControlProperties |
ItemInfo() | RatingControlProperties |
ItemInfoProperty() | RatingControlProperties | [inline, static]
m_valueChangedEventSource | RatingControlProperties |
MaxRating(int value) | RatingControlProperties |
MaxRating() | RatingControlProperties |
MaxRatingProperty() | RatingControlProperties | [inline, static]
OnCaptionPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnInitialSetValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnIsClearEnabledPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnIsReadOnlyPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnItemInfoPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnMaxRatingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnPlaceholderValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
PlaceholderValue(double value) | RatingControlProperties |
PlaceholderValue() | RatingControlProperties |
PlaceholderValueProperty() | RatingControlProperties | [inline, static]
RatingControlProperties() | RatingControlProperties |
s_CaptionProperty | RatingControlProperties | [static]
s_InitialSetValueProperty | RatingControlProperties | [static]
s_IsClearEnabledProperty | RatingControlProperties | [static]
s_IsReadOnlyProperty | RatingControlProperties | [static]
s_ItemInfoProperty | RatingControlProperties | [static]
s_MaxRatingProperty | RatingControlProperties | [static]
s_PlaceholderValueProperty | RatingControlProperties | [static]
s_ValueProperty | RatingControlProperties | [static]
Value(double value) | RatingControlProperties |
Value() | RatingControlProperties |
ValueChanged(winrt::TypedEventHandler< winrt::RatingControl, winrt::IInspectable > const &value) | RatingControlProperties |
ValueChanged(winrt::event_token const &token) | RatingControlProperties |
ValueProperty() | RatingControlProperties | [inline, static]
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/ColorHelpers.cpp Source File

  • ColorPicker

ColorHelpers.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ColorHelpers.h"
00007 #include "SharedHelpers.h"
00008
00009 const int CheckerSize = 4;
00010
00011 Hsv IncrementColorChannel(
00012     const Hsv &originalHsv,
00013     winrt::ColorPickerHsvChannel channel,
00014     IncrementDirection direction,
00015     IncrementAmount amount,
00016     bool shouldWrap,
00017     double minBound,
00018     double maxBound)
00019 {
00020     Hsv newHsv = originalHsv;
00021
00022     if (amount == IncrementAmount::Small)
00023     {
00024         // In order to avoid working with small values that can incur rounding issues,
00025         // we'll multiple saturation and value by 100 to put them in the range of 0-100 instead of 0-1.
00026         newHsv.s *= 100;
00027         newHsv.v *= 100;
00028
00029         double *valueToIncrement = nullptr;
00030         double incrementAmount = 0;
00031
00032         // If we're adding a small increment, then we'll just add or subtract 1.
00033         // If we're adding a large increment, then we want to snap to the next
00034         // or previous major value - for hue, this is every increment of 30;
00035         // for saturation and value, this is every increment of 10.
00036         switch (channel)
00037         {
00038         case winrt::ColorPickerHsvChannel::Hue:
00039             valueToIncrement = &(newHsv.h);
00040             incrementAmount = amount == IncrementAmount::Small ? 1 : 30;
00041             break;
00042
00043         case winrt::ColorPickerHsvChannel::Saturation:
00044             valueToIncrement = &(newHsv.s);
00045             incrementAmount = amount == IncrementAmount::Small ? 1 : 10;
00046             break;
00047
00048         case winrt::ColorPickerHsvChannel::Value:
00049             valueToIncrement = &(newHsv.v);
00050             incrementAmount = amount == IncrementAmount::Small ? 1 : 10;
00051             break;
00052
00053         default:
00054             throw winrt::hresult_error(E_FAIL);
00055         }
00056
00057         const double previousValue = *valueToIncrement;
00058
00059         *valueToIncrement += (direction == IncrementDirection::Lower ? -incrementAmount : incrementAmount);
00060
00061         // If the value has reached outside the bounds, we were previous at the boundary, and we should wrap,
00062         // then we'll place the selection on the other side of the spectrum.
00063         // Otherwise, we'll place it on the boundary that was exceeded.
00064         if (*valueToIncrement < minBound)
00065         {
00066             *valueToIncrement = (shouldWrap && previousValue == minBound) ? maxBound : minBound;
00067         }
00068
00069         if (*valueToIncrement > maxBound)
00070         {
00071             *valueToIncrement = (shouldWrap && previousValue == maxBound) ? minBound : maxBound;
00072         }
00073
00074         // We multiplied saturation and value by 100 previously, so now we want to put them back in the 0-1 range.
00075         newHsv.s /= 100;
00076         newHsv.v /= 100;
00077     }
00078     else
00079     {
00080         // While working with named colors, we're going to need to be working in actual HSV units,
00081         // so we'll divide the min bound and max bound by 100 in the case of saturation or value,
00082         // since we'll have received units between 0-100 and we need them within 0-1.
00083         if (channel == winrt::ColorPickerHsvChannel::Saturation ||
00084             channel == winrt::ColorPickerHsvChannel::Value)
00085         {
00086             minBound /= 100;
00087             maxBound /= 100;
00088         }
00089
00090         newHsv = FindNextNamedColor(originalHsv, channel, direction, shouldWrap, minBound, maxBound);
00091     }
00092
00093     return newHsv;
00094 }
00095
00096 // Implementation of the signum function, which returns the sign of a number while discarding its value.
00097 template <typename T>
00098 int sgn(T val)
00099 {
00100     const int first = (static_cast<T>(0) < val) ? 1 : 0;
00101     const int second = (static_cast<T>(0) > val) ? 1 : 0;
00102
00103     return first - second;
00104 }
00105
00106 Hsv FindNextNamedColor(
00107     const Hsv &originalHsv,
00108     winrt::ColorPickerHsvChannel channel,
00109     IncrementDirection direction,
00110     bool shouldWrap,
00111     double minBound,
00112     double maxBound)
00113 {
00114     // There's no easy way to directly get the next named color, so what we'll do
00115     // is just iterate in the direction that we want to find it until we find a color
00116     // in that direction that has a color name different than our current color name.
00117     // Once we find a new color name, then we'll iterate across that color name until
00118     // we find its bounds on the other side, and then select the color that is exactly
00119     // in the middle of that color's bounds.
00120     Hsv newHsv = originalHsv;
00121
00122     winrt::hstring originalColorName = winrt::ColorDisplayNameHelper::ToDisplayName(ColorFromRgba(HsvToRgb(originalHsv)));
00123     winrt::hstring newColorName = originalColorName;
00124
00125     double originalValue = 0;
00126     double *newValue = nullptr;
00127     double incrementAmount = 0;
00128
00129     switch (channel)
00130     {
00131     case winrt::ColorPickerHsvChannel::Hue:
00132         originalValue = originalHsv.h;
00133         newValue = &(newHsv.h);
00134         incrementAmount = 1;
00135         break;
00136
00137     case winrt::ColorPickerHsvChannel::Saturation:
00138         originalValue = originalHsv.s;
00139         newValue = &(newHsv.s);
00140         incrementAmount = 0.01;
00141         break;
00142
00143     case winrt::ColorPickerHsvChannel::Value:
00144         originalValue = originalHsv.v;
00145         newValue = &(newHsv.v);
00146         incrementAmount = 0.01;
00147         break;
00148
00149     default:
00150         throw winrt::hresult_error(E_FAIL);
00151     }
00152
00153     bool shouldFindMidPoint = true;
00154
00155     while (newColorName == originalColorName)
00156     {
00157         const double previousValue = *newValue;
00158         *newValue += (direction == IncrementDirection::Lower ? -1 : 1) * incrementAmount;
00159
00160         bool justWrapped = false;
00161
00162         // If we've hit a boundary, then either we should wrap or we shouldn't.
00163         // If we should, then we'll perform that wrapping if we were previously up against
00164         // the boundary that we've now hit.  Otherwise, we'll stop at that boundary.
00165         if (*newValue > maxBound)
00166         {
00167             if (shouldWrap)
00168             {
00169                 *newValue = minBound;
00170                 justWrapped = true;
00171             }
00172             else
00173             {
00174                 *newValue = maxBound;
00175                 shouldFindMidPoint = false;
00176                 newColorName = winrt::ColorDisplayNameHelper::ToDisplayName(ColorFromRgba(HsvToRgb(newHsv)));
00177                 break;
00178             }
00179         }
00180         else if (*newValue < minBound)
00181         {
00182             if (shouldWrap)
00183             {
00184                 *newValue = maxBound;
00185                 justWrapped = true;
00186             }
00187             else
00188             {
00189                 *newValue = minBound;
00190                 shouldFindMidPoint = false;
00191                 newColorName = winrt::ColorDisplayNameHelper::ToDisplayName(ColorFromRgba(HsvToRgb(newHsv)));
00192                 break;
00193             }
00194         }
00195
00196         if (!justWrapped &&
00197             previousValue != originalValue &&
00198             sgn(*newValue - originalValue) != sgn(previousValue - originalValue))
00199         {
00200             // If we've wrapped all the way back to the start and have failed to find a new color name,
00201             // then we'll just quit - there isn't a new color name that we're going to find.
00202             shouldFindMidPoint = false;
00203             break;
00204         }
00205
00206         newColorName = winrt::ColorDisplayNameHelper::ToDisplayName(ColorFromRgba(HsvToRgb(newHsv)));
00207     }
00208
00209     if (shouldFindMidPoint)
00210     {
00211         Hsv startHsv = newHsv;
00212         Hsv currentHsv = startHsv;
00213         double startEndOffset = 0;
00214         winrt::hstring currentColorName = newColorName;
00215
00216         double *startValue = nullptr;
00217         double *currentValue = nullptr;
00218         double wrapIncrement = 0;
00219
00220         switch (channel)
00221         {
00222         case winrt::ColorPickerHsvChannel::Hue:
00223             startValue = &(startHsv.h);
00224             currentValue = &(currentHsv.h);
00225             wrapIncrement = 360.0;
00226             break;
00227
00228         case winrt::ColorPickerHsvChannel::Saturation:
00229             startValue = &(startHsv.s);
00230             currentValue = &(currentHsv.s);
00231             wrapIncrement = 1.0;
00232             break;
00233
00234         case winrt::ColorPickerHsvChannel::Value:
00235             startValue = &(startHsv.v);
00236             currentValue = &(currentHsv.v);
00237             wrapIncrement = 1.0;
00238             break;
00239
00240         default:
00241             throw winrt::hresult_error(E_FAIL);
00242         }
00243
00244         while (newColorName == currentColorName)
00245         {
00246             *currentValue += (direction == IncrementDirection::Lower ? -1 : 1) * incrementAmount;
00247
00248             // If we've hit a boundary, then either we should wrap or we shouldn't.
00249             // If we should, then we'll perform that wrapping if we were previously up against
00250             // the boundary that we've now hit.  Otherwise, we'll stop at that boundary.
00251             if (*currentValue > maxBound)
00252             {
00253                 if (shouldWrap)
00254                 {
00255                     *currentValue = minBound;
00256                     startEndOffset = maxBound - minBound;
00257                 }
00258                 else
00259                 {
00260                     *currentValue = maxBound;
00261                     break;
00262                 }
00263             }
00264             else if (*currentValue < minBound)
00265             {
00266                 if (shouldWrap)
00267                 {
00268                     *currentValue = maxBound;
00269                     startEndOffset = minBound - maxBound;
00270                 }
00271                 else
00272                 {
00273                     *currentValue = minBound;
00274                     break;
00275                 }
00276             }
00277
00278             currentColorName = winrt::ColorDisplayNameHelper::ToDisplayName(ColorFromRgba(HsvToRgb(currentHsv)));
00279         }
00280
00281         *newValue = (*startValue + *currentValue + startEndOffset) / 2;
00282
00283         // Dividing by 2 may have gotten us halfway through a single step, so we'll
00284         // remove that half-step if it exists.
00285         double leftoverValue = abs(*newValue);
00286
00287         while (leftoverValue > incrementAmount)
00288         {
00289             leftoverValue -= incrementAmount;
00290         }
00291
00292         *newValue -= leftoverValue;
00293
00294         while (*newValue < minBound)
00295         {
00296             *newValue += wrapIncrement;
00297         }
00298
00299         while (*newValue > maxBound)
00300         {
00301             *newValue -= wrapIncrement;
00302         }
00303     }
00304
00305     return newHsv;
00306 }
00307
00308 double IncrementAlphaChannel(
00309     double originalAlpha,
00310     IncrementDirection direction,
00311     IncrementAmount amount,
00312     bool shouldWrap,
00313     double minBound,
00314     double maxBound)
00315 {
00316     // In order to avoid working with small values that can incur rounding issues,
00317     // we'll multiple alpha by 100 to put it in the range of 0-100 instead of 0-1.
00318     originalAlpha *= 100;
00319
00320     const double smallIncrementAmount = 1;
00321     const double largeIncrementAmount = 10;
00322
00323     if (amount == IncrementAmount::Small)
00324     {
00325         originalAlpha += (direction == IncrementDirection::Lower ? -1 : 1) * smallIncrementAmount;
00326     }
00327     else
00328     {
00329         if (direction == IncrementDirection::Lower)
00330         {
00331             originalAlpha = ceil((originalAlpha - largeIncrementAmount) / largeIncrementAmount) * largeIncrementAmount;
00332         }
00333         else
00334         {
00335             originalAlpha = floor((originalAlpha + largeIncrementAmount) / largeIncrementAmount) * largeIncrementAmount;
00336         }
00337     }
00338
00339     // If the value has reached outside the bounds and we should wrap, then we'll place the selection
00340     // on the other side of the spectrum.  Otherwise, we'll place it on the boundary that was exceeded.
00341     if (originalAlpha < minBound)
00342     {
00343         originalAlpha = shouldWrap ? maxBound : minBound;
00344     }
00345
00346     if (originalAlpha > maxBound)
00347     {
00348         originalAlpha = shouldWrap ? minBound : maxBound;
00349     }
00350
00351     // We multiplied alpha by 100 previously, so now we want to put it back in the 0-1 range.
00352     return originalAlpha / 100;
00353 }
00354
00355 void CreateCheckeredBackgroundAsync(
00356     int width,
00357     int height,
00358     winrt::Color checkerColor,
00359     std::shared_ptr<std::vector<byte>> const& bgraCheckeredPixelData,
00360     winrt::IAsyncAction &asyncActionToAssign,
00361     winrt::DispatcherQueue &dispatcherQueue,
00362     std::function<void(winrt::WriteableBitmap)> completedFunction)
00363 {
00364     if (width == 0 || height == 0)
00365     {
00366         return;
00367     }
00368
00369     bgraCheckeredPixelData->reserve(static_cast<size_t>(width) * height * 4);
00370
00371     winrt::WorkItemHandler workItemHandler(
00372         [width, height, checkerColor, bgraCheckeredPixelData]
00373     (winrt::IAsyncAction workItem)
00374     {
00375         for (int y = 0; y < height; y++)
00376         {
00377             for (int x = 0; x < width; x++)
00378             {
00379                 if (workItem.Status() == winrt::AsyncStatus::Canceled)
00380                 {
00381                     break;
00382                 }
00383
00384                 // We want the checkered pattern to alternate both vertically and horizontally.
00385                 // In order to achieve that, we'll toggle visibility of the current pixel on or off
00386                 // depending on both its x- and its y-position.  If x == CheckerSize, we'll turn visibility off,
00387                 // but then if y == CheckerSize, we'll turn it back on.
00388                 // The below is a shorthand for the above intent.
00389                 const bool pixelShouldBeBlank = (x / CheckerSize + y / CheckerSize) % 2 == 0 ? 255 : 0;
00390
00391                 if (pixelShouldBeBlank)
00392                 {
00393                     bgraCheckeredPixelData->push_back(0);
00394                     bgraCheckeredPixelData->push_back(0);
00395                     bgraCheckeredPixelData->push_back(0);
00396                     bgraCheckeredPixelData->push_back(0);
00397                 }
00398                 else
00399                 {
00400                     bgraCheckeredPixelData->push_back(checkerColor.B * checkerColor.A / 255);
00401                     bgraCheckeredPixelData->push_back(checkerColor.G * checkerColor.A / 255);
00402                     bgraCheckeredPixelData->push_back(checkerColor.R * checkerColor.A / 255);
00403                     bgraCheckeredPixelData->push_back(checkerColor.A);
00404                 }
00405             }
00406         }
00407     });
00408
00409     if (asyncActionToAssign)
00410     {
00411         asyncActionToAssign.Cancel();
00412     }
00413
00414     asyncActionToAssign = winrt::ThreadPool::RunAsync(workItemHandler);
00415     asyncActionToAssign.Completed(winrt::AsyncActionCompletedHandler(
00416         [width, height, bgraCheckeredPixelData, &asyncActionToAssign, completedFunction, dispatcherQueue]
00417     (winrt::IAsyncAction asyncInfo, winrt::AsyncStatus asyncStatus)
00418     {
00419         if (asyncStatus != winrt::AsyncStatus::Completed)
00420         {
00421             return;
00422         }
00423
00424         asyncActionToAssign = nullptr;
00425
00426         dispatcherQueue.TryEnqueue(winrt::DispatcherQueueHandler([completedFunction, width, height, bgraCheckeredPixelData]()
00427         {
00428             winrt::WriteableBitmap checkeredBackgroundBitmap = CreateBitmapFromPixelData(width, height, bgraCheckeredPixelData);
00429             completedFunction(checkeredBackgroundBitmap);
00430         }));
00431     }));
00432 }
00433
00434 winrt::WriteableBitmap CreateBitmapFromPixelData(
00435     int pixelWidth,
00436     int pixelHeight,
00437     std::shared_ptr<std::vector<byte>> const& bgraPixelData)
00438 {
00439     // IBufferByteAccess isn't included in any WinMD file, because its sole method - Buffer() -
00440     // allows direct pointer access, which isn't applicable to C#.  In C#, there's a separate ToStream()
00441     // method that similarly allows read access.  As a result, we have no C++/WinMD projection for IBufferByteAccess;
00442     // we need to flip to ABI in this circumstance to do what this method requires.
00443     winrt::WriteableBitmap bitmap(pixelWidth, pixelHeight);
00444
00445     byte *pixelBuffer = nullptr;
00446     winrt::check_hresult(bitmap.PixelBuffer().as<::Windows::Storage::Streams::IBufferByteAccess>()->Buffer(&pixelBuffer));
00447
00448     std::memcpy(pixelBuffer, (*bgraPixelData).data(), (*bgraPixelData).size());
00449     bitmap.Invalidate();
00450
00451     return bitmap;
00452 }
00453
00454 winrt::LoadedImageSurface CreateSurfaceFromPixelData(
00455     int pixelWidth,
00456     int pixelHeight,
00457     std::shared_ptr<std::vector<byte>> const& bgraPixelData)
00458 {
00459     // LoadedImageSurface uses WIC to load images, so we need to put the pixel data into an image format.
00460     // We'll use the BMP format, since it stores uncompressed pixel data.
00461     std::vector<byte> bmpData;
00462
00463     // Size is header (14 bytes) + DIB header (40 bytes) + Pixel array (size of bgraPixelData).
00464     const size_t dibHeaderSize = 40;
00465     const size_t headerSize = 14 + dibHeaderSize;
00466     const size_t fileSize = headerSize + (*bgraPixelData).size();
00467
00468     // Header field to identify as BMP.
00469     bmpData.push_back('B');
00470     bmpData.push_back('M');
00471
00472     // File size.  Note that the BMP format is always little-endian.
00473     bmpData.push_back(static_cast<byte>(fileSize & 0x000000FF));
00474     bmpData.push_back(static_cast<byte>((fileSize & 0x0000FF00) >> 8));
00475     bmpData.push_back(static_cast<byte>((fileSize & 0x00FF0000) >> 16));
00476     bmpData.push_back(static_cast<byte>((fileSize & 0xFF000000) >> 24));
00477
00478     // Reserved for application-specific usage.  We don't care about these bytes.
00479     bmpData.push_back(0);
00480     bmpData.push_back(0);
00481     bmpData.push_back(0);
00482     bmpData.push_back(0);
00483
00484     // Offset of the pixel data from the start.  Since our header is 14 + 12 bytes long, it starts after that.
00485     const auto pixelDataOffset = static_cast<uint32_t>(headerSize);
00486     bmpData.push_back(static_cast<byte>(pixelDataOffset & 0x000000FF));
00487     bmpData.push_back(static_cast<byte>((pixelDataOffset & 0x0000FF00) >> 8));
00488     bmpData.push_back(static_cast<byte>((pixelDataOffset & 0x00FF0000) >> 16));
00489     bmpData.push_back(static_cast<byte>((pixelDataOffset & 0xFF000000) >> 24));
00490
00491     // Beginning of DIB header.  First 4 bytes are the size of the header (12 bytes in our case).
00492     bmpData.push_back(static_cast<byte>(dibHeaderSize & 0x000000FF));
00493     bmpData.push_back(static_cast<byte>((dibHeaderSize & 0x0000FF00) >> 8));
00494     bmpData.push_back(static_cast<byte>((dibHeaderSize & 0x00FF0000) >> 16));
00495     bmpData.push_back(static_cast<byte>((dibHeaderSize & 0xFF000000) >> 24));
00496
00497     // Bitmap width in pixels (32-bit).
00498     const auto bitmapWidth = static_cast<uint32_t>(pixelWidth);
00499     bmpData.push_back(static_cast<byte>(bitmapWidth & 0x000000FF));
00500     bmpData.push_back(static_cast<byte>((bitmapWidth & 0x0000FF00) >> 8));
00501     bmpData.push_back(static_cast<byte>((bitmapWidth & 0x00FF0000) >> 16));
00502     bmpData.push_back(static_cast<byte>((bitmapWidth & 0xFF000000) >> 24));
00503
00504     // Bitmap height in pixels (32-bit).
00505     const auto bitmapHeight = static_cast<uint32_t>(pixelHeight);
00506     bmpData.push_back(static_cast<byte>(bitmapHeight & 0x000000FF));
00507     bmpData.push_back(static_cast<byte>((bitmapHeight & 0x0000FF00) >> 8));
00508     bmpData.push_back(static_cast<byte>((bitmapHeight & 0x00FF0000) >> 16));
00509     bmpData.push_back(static_cast<byte>((bitmapHeight & 0xFF000000) >> 24));
00510
00511     // Color plane count.
00512     const uint16_t colorPlaneCount = 1;
00513     bmpData.push_back(static_cast<byte>(colorPlaneCount & 0x00FF));
00514     bmpData.push_back(static_cast<byte>((colorPlaneCount & 0xFF00) >> 8));
00515
00516     // Bits per pixel.
00517     const uint16_t bitsPerPixel = 32;
00518     bmpData.push_back(static_cast<byte>(bitsPerPixel & 0x00FF));
00519     bmpData.push_back(static_cast<byte>((bitsPerPixel & 0xFF00) >> 8));
00520
00521     // Compression method.  0 means uncompressed.
00522     const uint32_t compressionMethod = 0;
00523     bmpData.push_back(static_cast<byte>(compressionMethod & 0x000000FF));
00524     bmpData.push_back(static_cast<byte>((compressionMethod & 0x0000FF00) >> 8));
00525     bmpData.push_back(static_cast<byte>((compressionMethod & 0x00FF0000) >> 16));
00526     bmpData.push_back(static_cast<byte>((compressionMethod & 0xFF000000) >> 24));
00527
00528     // Image size.  Not needed for uncompressed images.
00529     const uint32_t imageSize = 0;
00530     bmpData.push_back(static_cast<byte>(imageSize & 0x000000FF));
00531     bmpData.push_back(static_cast<byte>((imageSize & 0x0000FF00) >> 8));
00532     bmpData.push_back(static_cast<byte>((imageSize & 0x00FF0000) >> 16));
00533     bmpData.push_back(static_cast<byte>((imageSize & 0xFF000000) >> 24));
00534
00535     // Horizontal resolution.  We don't care about this value.
00536     const uint32_t horizontalResolution = 1;
00537     bmpData.push_back(static_cast<byte>(horizontalResolution & 0x000000FF));
00538     bmpData.push_back(static_cast<byte>((horizontalResolution & 0x0000FF00) >> 8));
00539     bmpData.push_back(static_cast<byte>((horizontalResolution & 0x00FF0000) >> 16));
00540     bmpData.push_back(static_cast<byte>((horizontalResolution & 0xFF000000) >> 24));
00541
00542     // Vertical resolution.  We don't care about this value.
00543     const uint32_t verticalResolution = 1;
00544     bmpData.push_back(static_cast<byte>(verticalResolution & 0x000000FF));
00545     bmpData.push_back(static_cast<byte>((verticalResolution & 0x0000FF00) >> 8));
00546     bmpData.push_back(static_cast<byte>((verticalResolution & 0x00FF0000) >> 16));
00547     bmpData.push_back(static_cast<byte>((verticalResolution & 0xFF000000) >> 24));
00548
00549     // Number of colors in the palette.  0 means use the default.
00550     const uint32_t colorsInPalette = 0;
00551     bmpData.push_back(static_cast<byte>(colorsInPalette & 0x000000FF));
00552     bmpData.push_back(static_cast<byte>((colorsInPalette & 0x0000FF00) >> 8));
00553     bmpData.push_back(static_cast<byte>((colorsInPalette & 0x00FF0000) >> 16));
00554     bmpData.push_back(static_cast<byte>((colorsInPalette & 0xFF000000) >> 24));
00555
00556     // Important colors.  0 means all colors are important.
00557     const uint32_t importantColors = 0;
00558     bmpData.push_back(static_cast<byte>(importantColors & 0x000000FF));
00559     bmpData.push_back(static_cast<byte>((importantColors & 0x0000FF00) >> 8));
00560     bmpData.push_back(static_cast<byte>((importantColors & 0x00FF0000) >> 16));
00561     bmpData.push_back(static_cast<byte>((importantColors & 0xFF000000) >> 24));
00562
00563     // Pixel data.  BMP images are stored upside-down, so we need to copy the image data backwards.
00564     bmpData.resize(fileSize);
00565     uint32_t stride = pixelWidth * 4;
00566
00567     for (int y = pixelHeight - 1; y >= 0; y--)
00568     {
00569         memcpy(bmpData.data() + (headerSize + (static_cast<size_t>(pixelHeight) - 1 - y) * stride), (*bgraPixelData).data() + (static_cast<size_t>(y) * stride), stride);
00570     }
00571
00572     winrt::InMemoryRandomAccessStream stream = SharedHelpers::CreateStreamFromBytes(winrt::array_view<const byte>(bmpData));
00573
00574     return winrt::LoadedImageSurface::StartLoadFromStream(stream);
00575 }
00576
00577 void CancelAsyncAction(winrt::IAsyncAction const& action)
00578 {
00579     if (action && action.Status() == winrt::AsyncStatus::Started)
00580     {
00581         action.Cancel();
00582     }
00583 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RatingControl/RatingItemInfo.cpp Source File

  • RatingControl

RatingItemInfo.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include <RatingItemInfo.h>
00007
00008 #include "RatingItemInfo.properties.cpp"
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ImageIconSourceProperties Member List

This is the complete list of members for ImageIconSourceProperties, including all inherited members.
ClearProperties() | ImageIconSourceProperties | [static]
EnsureProperties() | ImageIconSourceProperties | [static]
ImageIconSourceProperties() | ImageIconSourceProperties |
ImageSource(winrt::ImageSource const &value) | ImageIconSourceProperties |
ImageSource() | ImageIconSourceProperties |
ImageSourceProperty() | ImageIconSourceProperties | [inline, static]
s_ImageSourceProperty | ImageIconSourceProperties | [static]
Generated on Sun Dec 1 2024 20:52:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarToolButtonAutomationPeer Member List

This is the complete list of members for InkToolBarToolButtonAutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
CheckThread() | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< InkToolBarToolButtonAutomationPeer > &&self) noexcept | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
final_release(std::unique_ptr< InkToolBarToolButtonAutomationPeer > &&self) | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline, static]
GetBase() | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
GetInner() | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
InkToolBarToolButtonAutomationPeer(winrt::InkToolBarToolButton owner) | InkToolBarToolButtonAutomationPeer | [inline]
IsOnThread() | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT > | [inline]
Generated on Sun Dec 1 2024 20:52:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealBorderBrush Member List

This is the complete list of members for RevealBorderBrush, including all inherited members.
abi_enter() | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
CheckThread() | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< RevealBorderBrush > &&self) noexcept | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
final_release(std::unique_ptr< RevealBorderBrush > &&self) | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline, static]
GetBase() | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
GetInner() | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
IsOnThread() | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< RevealBorderBrush, winrt::implementation::RevealBorderBrushT, RevealBrush > | [inline]
RevealBorderBrush() | RevealBorderBrush |
Generated on Sun Dec 1 2024 20:53:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AcrylicBrushPage Member List

This is the complete list of members for AcrylicBrushPage, including all inherited members.
_acrylicBrush | AcrylicBrushPage | [private]
_acrylicTestApi | AcrylicBrushPage | [private]
_iteration_TintTransitionDuration | AcrylicBrushPage | [private]
AcrylicBrushPage() | AcrylicBrushPage | [inline]
AlwaysUseFallbackButton_Checked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
AlwaysUseFallbackButton_Unchecked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
AnimateBackgroundButton_Checked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
AnimateBackgroundButton_Unchecked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
AutoTintLuminosityOpacity_IsCheckedChanged(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
ColorPicker_ColorChanged(ColorPicker sender, ColorChangedEventArgs args) | AcrylicBrushPage | [inline, private]
FallbackColorButton_Checked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
FallbackColorButton_Unchecked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
OnCreateAutomationPeer() | AcrylicBrushPage | [inline, protected]
OnNavigatedFrom(NavigationEventArgs e) | AcrylicBrushPage | [inline, protected]
OnNavigatedTo(NavigationEventArgs e) | AcrylicBrushPage | [inline, protected]
Overlay_PointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) | AcrylicBrushPage | [inline, private]
PollForEffectBrush() | AcrylicBrushPage | [inline, private]
PollForFallbackBrush() | AcrylicBrushPage | [inline, private]
RunAcrylicAlwaysUseFallback() | AcrylicBrushPage | [inline, private]
RunAcrylicCreatedInFallbackMode() | AcrylicBrushPage | [inline, private]
RunAcrylicNoiseCache() | AcrylicBrushPage | [inline, private]
RunAcrylicPropertyChanges() | AcrylicBrushPage | [inline, private]
RunBasicAcrylicOnRectangle() | AcrylicBrushPage | [inline, private]
RunTestButton_Clicked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
RunTintTransitionDuration() | AcrylicBrushPage | [inline, private]
RunVerifyAcrylicBrushEffect() | AcrylicBrushPage | [inline, private]
RunVerifyDisconnectedState() | AcrylicBrushPage | [inline, private]
RunVerifyDisconnectedState_AnimationCompleted(object sender, object e) | AcrylicBrushPage | [inline, private]
RunVerifyOpaqueTintOptimization() | AcrylicBrushPage | [inline, private]
SetAcrylicBrush() | AcrylicBrushPage | [inline, private]
SetAcrylicBrushButton_Click(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
TintColorButton_Checked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
TintColorButton_Unchecked(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
TintLuminosityOpacity_ValueChanged(object sender, Microsoft.UI.Xaml.Controls.Primitives.RangeBaseValueChangedEventArgs e) | AcrylicBrushPage | [inline, private]
TintOpacity_ValueChanged(object sender, Microsoft.UI.Xaml.Controls.Primitives.RangeBaseValueChangedEventArgs e) | AcrylicBrushPage | [inline, private]
UpdateCompositionBrush() | AcrylicBrushPage | [inline, private]
UpdateIsUsingAcrylicBrush() | AcrylicBrushPage | [inline, private]
UpdateNoiseBrush() | AcrylicBrushPage | [inline, private]
UpdateSharedState() | AcrylicBrushPage | [inline, private]
UpdateStateButton_Click(object sender, RoutedEventArgs e) | AcrylicBrushPage | [inline, private]
VerifyAcrylic() | AcrylicBrushPage | [inline, private]
VerifyAcrylicWithPolling() | AcrylicBrushPage | [inline, private]
VerifyDisconnected() | AcrylicBrushPage | [inline, private]
VerifyFallbackColor() | AcrylicBrushPage | [inline, private]
VerifyFallbackColorWithPolling() | AcrylicBrushPage | [inline, private]
XamlWindow_VisibilityChanged(object sender, Microsoft.UI.Xaml.WindowVisibilityChangedEventArgs e) | AcrylicBrushPage | [inline, private]
Generated on Sun Dec 1 2024 20:53:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SliderInteraction Member List

This is the complete list of members for SliderInteraction, including all inherited members.
abi_enter() | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
CheckThread() | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
ClearProperties() | SliderInteractionProperties | [static]
ConfigureTargetElement(const winrt::UIElement &target) | SliderInteraction | [private]
DeleteInstanceOnUIThread(std::unique_ptr< SliderInteraction > &&self) noexcept | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline, static]
EnsureProperties() | SliderInteractionProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
final_release(std::unique_ptr< SliderInteraction > &&self) | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline, static]
GetBase() | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
GetInner() | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
GetSupportedEventsCore() | SliderInteraction |
IsOnThread() | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
LargeChange() | SliderInteraction |
LargeChange(double value) | SliderInteraction |
m_propertyChangedEventSource | SliderInteractionProperties |
Maximum() | SliderInteraction |
Maximum(double value) | SliderInteraction |
Minimum() | SliderInteraction |
Minimum(double value) | SliderInteraction |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
OnKeyDown(winrt::UIElement const &sender, winrt::KeyRoutedEventArgs const &args) | SliderInteraction |
OnPointerCanceled(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | SliderInteraction |
OnPointerCaptureLost(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | SliderInteraction |
OnPointerMoved(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | SliderInteraction |
OnPointerPressed(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | SliderInteraction |
OnPointerReleased(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | SliderInteraction |
Orientation() | SliderInteraction |
Orientation(winrt::Orientation const &value) | SliderInteraction |
Position() | SliderInteraction |
PropertyChanged(winrt::PropertyChangedEventHandler const &value) | SliderInteraction |
PropertyChanged(winrt::event_token const &token) | SliderInteraction |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< SliderInteraction, winrt::implementation::SliderInteractionT > | [inline]
SliderInteractionProperties() | SliderInteractionProperties |
SmallChange() | SliderInteraction |
SmallChange(double value) | SliderInteraction |
UpdatePosition(double delta) | SliderInteraction | [private]
UpdateTransform() | SliderInteraction | [private]
Generated on Sun Dec 1 2024 20:53:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/StackLayout.cpp Source File

  • Repeater

StackLayout.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include <DoubleUtil.h>
00007 #include "ItemsRepeater.common.h"
00008 #include "FlowLayoutAlgorithm.h"
00009 #include "StackLayoutState.h"
00010 #include "StackLayout.h"
00011 #include "RuntimeProfiler.h"
00012 #include "VirtualizingLayoutContext.h"
00013
00014 #pragma region IStackLayout
00015
00016 StackLayout::StackLayout()
00017 {
00018     __RP_Marker_ClassById(RuntimeProfiler::ProfId_StackLayout);
00019     LayoutId(L"StackLayout");
00020
00021     UpdateIndexBasedLayoutOrientation(winrt::Orientation::Vertical);
00022 }
00023
00024 #pragma endregion
00025
00026 #pragma region IVirtualizingLayoutOverrides
00027
00028 void StackLayout::InitializeForContextCore(winrt::VirtualizingLayoutContext const& context)
00029 {
00030     auto state = context.LayoutState();
00031     winrt::com_ptr<StackLayoutState> stackState = nullptr;
00032     if (state)
00033     {
00034         stackState = GetAsStackState(state);
00035     }
00036
00037     if (!stackState)
00038     {
00039         if (state)
00040         {
00041             throw winrt::hresult_error(E_FAIL, L"LayoutState must derive from StackLayoutState.");
00042         }
00043
00044         // Custom deriving layouts could potentially be stateful.
00045         // If that is the case, we will just create the base state required by UniformGridLayout ourselves.
00046         stackState = winrt::make_self<StackLayoutState>();
00047     }
00048
00049     stackState->InitializeForContext(context, this);
00050 }
00051
00052 void StackLayout::UninitializeForContextCore(winrt::VirtualizingLayoutContext const& context)
00053 {
00054     if (auto stackState = GetAsStackState(context.LayoutState()))
00055     {
00056         stackState->UninitializeForContext(context);
00057     }
00058 }
00059
00060 winrt::Size StackLayout::MeasureOverride(
00061     winrt::VirtualizingLayoutContext const& context,
00062     winrt::Size const& availableSize)
00063 {
00064     if (!context.LayoutState())
00065     {
00066         return {};
00067     }
00068
00069     GetAsStackState(context.LayoutState())->OnMeasureStart();
00070
00071     const auto desiredSize = GetFlowAlgorithm(context).Measure(
00072         availableSize,
00073         context,
00074         false, /* isWrapping*/
00075         0 /* minItemSpacing */,
00076         m_itemSpacing,
00077         MAXUINT /* maxItemsPerLine */,
00078         GetScrollOrientation(),
00079         IsVirtualizationEnabled(),
00080         LayoutId());
00081     return { desiredSize.Width, desiredSize.Height };
00082 }
00083
00084 winrt::Size StackLayout::ArrangeOverride(
00085     winrt::VirtualizingLayoutContext const& context,
00086     winrt::Size const& finalSize)
00087 {
00088     if (!context.LayoutState())
00089     {
00090         return {};
00091     }
00092
00093     const auto value = GetFlowAlgorithm(context).Arrange(
00094         finalSize,
00095         context,
00096         false, /* isWraping */
00097         FlowLayoutAlgorithm::LineAlignment::Start,
00098         LayoutId());
00099
00100     return { value.Width, value.Height };
00101 }
00102
00103 void StackLayout::OnItemsChangedCore(
00104     winrt::VirtualizingLayoutContext const& context,
00105     winrt::IInspectable const& source,
00106     winrt::NotifyCollectionChangedEventArgs const& args)
00107 {
00108     if (auto layoutState = context.LayoutState())
00109     {
00110         auto& flow = GetAsStackState(layoutState)->FlowAlgorithm();
00111         flow.OnItemsSourceChanged(source, args, context);
00112     }
00113
00114     // Always invalidate layout to keep the view accurate.
00115     InvalidateLayout();
00116 }
00117
00118 #pragma endregion
00119
00120 #pragma region IStackLayoutOverrides
00121
00122 winrt::FlowLayoutAnchorInfo StackLayout::GetAnchorForRealizationRect(
00123     winrt::Size const& availableSize,
00124     winrt::VirtualizingLayoutContext const& context)
00125 {
00126
00127     int anchorIndex = -1;
00128     double offset = DoubleUtil::NaN;
00129
00130     // Constants
00131     const int itemsCount = context.ItemCount();
00132     if (itemsCount > 0)
00133     {
00134         const auto realizationRect = context.RealizationRect();
00135         const auto state = GetAsStackState(context.LayoutState());
00136         const auto lastExtent = state->FlowAlgorithm().LastExtent();
00137
00138         const double averageElementSize = GetAverageElementSize(availableSize, context, state) + m_itemSpacing;
00139         const double realizationWindowOffsetInExtent = static_cast<double>(MajorStart(realizationRect)) - static_cast<double>(MajorStart(lastExtent));
00140         const double majorSize = MajorSize(lastExtent) == 0 ? std::max(0.0, averageElementSize * itemsCount - m_itemSpacing) : MajorSize(lastExtent);
00141         if (itemsCount > 0 &&
00142             MajorSize(realizationRect) >= 0 &&
00143             // MajorSize = 0 will account for when a nested repeater is outside the realization rect but still being measured. Also,
00144             // note that if we are measuring this repeater, then we are already realizing an element to figure out the size, so we could
00145             // just keep that element alive. It also helps in XYFocus scenarios to have an element realized for XYFocus to find a candidate
00146             // in the navigating direction.
00147             realizationWindowOffsetInExtent + MajorSize(realizationRect) >= 0 && realizationWindowOffsetInExtent <= majorSize)
00148         {
00149             anchorIndex = (int)(realizationWindowOffsetInExtent / averageElementSize);
00150             offset = anchorIndex * averageElementSize + MajorStart(lastExtent);
00151             anchorIndex = std::max(0, std::min(itemsCount - 1, anchorIndex));
00152         }
00153     }
00154
00155     return { anchorIndex, offset };
00156 }
00157
00158 winrt::Rect StackLayout::GetExtent(
00159     winrt::Size const& availableSize,
00160     winrt::VirtualizingLayoutContext const& context,
00161     winrt::UIElement const& firstRealized,
00162     int firstRealizedItemIndex,
00163     winrt::Rect const& firstRealizedLayoutBounds,
00164     winrt::UIElement const& lastRealized,
00165     int lastRealizedItemIndex,
00166     winrt::Rect const& lastRealizedLayoutBounds)
00167 {
00168     UNREFERENCED_PARAMETER(lastRealized);
00169
00170     auto extent = winrt::Rect{};
00171
00172     // Constants
00173     const int itemsCount = context.ItemCount();
00174     const auto stackState = GetAsStackState(context.LayoutState());
00175     const double averageElementSize = GetAverageElementSize(availableSize, context, stackState) + m_itemSpacing;
00176
00177     MinorSize(extent) = static_cast<float>(stackState->MaxArrangeBounds());
00178     MajorSize(extent) = std::max(0.0f, static_cast<float>(itemsCount * averageElementSize - m_itemSpacing));
00179     if (itemsCount > 0)
00180     {
00181         if (firstRealized)
00182         {
00183             MUX_ASSERT(lastRealized);
00184             MajorStart(extent) = static_cast<float>(MajorStart(firstRealizedLayoutBounds) - firstRealizedItemIndex * averageElementSize);
00185             auto remainingItems = itemsCount - lastRealizedItemIndex - 1;
00186             MajorSize(extent) = MajorEnd(lastRealizedLayoutBounds) - MajorStart(extent) + static_cast<float>(remainingItems* averageElementSize);
00187         }
00188         else
00189         {
00190             ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT_FLT, METH_NAME, this,
00191                 winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), LayoutId().data(),
00192                 L"Estimating extent with no realized elements.");
00193         }
00194     }
00195     else
00196     {
00197         MUX_ASSERT(firstRealizedItemIndex == -1);
00198         MUX_ASSERT(lastRealizedItemIndex == -1);
00199     }
00200
00201 #ifdef DBG
00202     const int indentDbg = winrt::get_self<VirtualizingLayoutContext>(context)->Indent();
00203
00204     ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT_FLT, METH_NAME, this,
00205         indentDbg, LayoutId().data(),
00206         L"Extent:", extent.Width, extent.Height);
00207     ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT, METH_NAME, this,
00208         indentDbg, LayoutId().data(),
00209         L"Based on average:", averageElementSize);
00210 #endif // DBG
00211
00212     return extent;
00213 }
00214
00215 void StackLayout::OnElementMeasured(
00216     winrt::UIElement const& /*element*/,
00217     int index,
00218     winrt::Size const& /*availableSize*/,
00219     winrt::Size const& /*measureSize*/,
00220     winrt::Size const& /*desiredSize*/,
00221     winrt::Size const& provisionalArrangeSize,
00222     winrt::VirtualizingLayoutContext const& context)
00223 {
00224
00225     const auto virtualContext = context.try_as<winrt::VirtualizingLayoutContext>();
00226     if (virtualContext)
00227     {
00228         const auto stackState = GetAsStackState(virtualContext.LayoutState());
00229         const auto provisionalArrangeSizeWinRt = provisionalArrangeSize;
00230         stackState->OnElementMeasured(
00231             index,
00232             Major(provisionalArrangeSizeWinRt),
00233             Minor(provisionalArrangeSizeWinRt));
00234     }
00235 }
00236
00237 #pragma endregion
00238
00239 #pragma region IFlowLayoutAlgorithmDelegates
00240
00241 winrt::Size StackLayout::Algorithm_GetMeasureSize(int /*index*/, const winrt::Size & availableSize, const winrt::VirtualizingLayoutContext& /*context*/)
00242 {
00243     return availableSize;
00244 }
00245
00246 winrt::Size StackLayout::Algorithm_GetProvisionalArrangeSize(int /*index*/, const winrt::Size & measureSize, winrt::Size const& desiredSize, const winrt::VirtualizingLayoutContext& /*context*/)
00247 {
00248     const auto measureSizeMinor = Minor(measureSize);
00249     return MinorMajorSize(
00250         std::isfinite(measureSizeMinor) ?
00251             std::max(measureSizeMinor, Minor(desiredSize)) :
00252             Minor(desiredSize),
00253         Major(desiredSize));
00254 }
00255
00256 bool StackLayout::Algorithm_ShouldBreakLine(int /*index*/, double /*remainingSpace*/)
00257 {
00258     return true;
00259 }
00260
00261 winrt::FlowLayoutAnchorInfo StackLayout::Algorithm_GetAnchorForRealizationRect(
00262     const winrt::Size & availableSize,
00263     const winrt::VirtualizingLayoutContext & context)
00264 {
00265     return GetAnchorForRealizationRect(availableSize, context);
00266 }
00267
00268 winrt::FlowLayoutAnchorInfo StackLayout::Algorithm_GetAnchorForTargetElement(
00269     int targetIndex,
00270     const winrt::Size & availableSize,
00271     const winrt::VirtualizingLayoutContext & context)
00272 {
00273     double offset = DoubleUtil::NaN;
00274     int index = -1;
00275     const int itemsCount = context.ItemCount();
00276
00277     if (targetIndex >= 0 && targetIndex < itemsCount)
00278     {
00279         index = targetIndex;
00280         const auto state = GetAsStackState(context.LayoutState());
00281         const double averageElementSize = GetAverageElementSize(availableSize, context, state) + m_itemSpacing;
00282         offset = index * averageElementSize + MajorStart(state->FlowAlgorithm().LastExtent());
00283     }
00284
00285     return winrt::FlowLayoutAnchorInfo{ index, offset };
00286 }
00287
00288 winrt::Rect StackLayout::Algorithm_GetExtent(
00289     const winrt::Size & availableSize,
00290     const winrt::VirtualizingLayoutContext & context,
00291     const winrt::UIElement & firstRealized,
00292     int firstRealizedItemIndex,
00293     const winrt::Rect & firstRealizedLayoutBounds,
00294     const winrt::UIElement & lastRealized,
00295     int lastRealizedItemIndex,
00296     const winrt::Rect & lastRealizedLayoutBounds)
00297 {
00298     return GetExtent(
00299         availableSize,
00300         context,
00301         firstRealized,
00302         firstRealizedItemIndex,
00303         firstRealizedLayoutBounds,
00304         lastRealized,
00305         lastRealizedItemIndex,
00306         lastRealizedLayoutBounds);
00307 }
00308
00309 void StackLayout::Algorithm_OnElementMeasured(
00310     const winrt::UIElement & element,
00311     int index,
00312     const winrt::Size & availableSize,
00313     const winrt::Size & measureSize,
00314     const winrt::Size & desiredSize,
00315     const winrt::Size & provisionalArrangeSize,
00316     const winrt::VirtualizingLayoutContext & context)
00317 {
00318     OnElementMeasured(
00319         element,
00320         index,
00321         availableSize,
00322         measureSize,
00323         desiredSize,
00324         provisionalArrangeSize,
00325         context);
00326 }
00327
00328 #pragma endregion
00329
00330 void StackLayout::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00331 {
00332     const auto property = args.Property();
00333     if (property == s_OrientationProperty)
00334     {
00335         const auto orientation = unbox_value<winrt::Orientation>(args.NewValue());
00336
00337         //Note: For StackLayout Vertical Orientation means we have a Vertical ScrollOrientation.
00338         //Horizontal Orientation means we have a Horizontal ScrollOrientation.
00339         const ScrollOrientation scrollOrientation = (orientation == winrt::Orientation::Horizontal) ? ScrollOrientation::Horizontal : ScrollOrientation::Vertical;
00340         OrientationBasedMeasures::SetScrollOrientation(scrollOrientation);
00341
00342         UpdateIndexBasedLayoutOrientation(orientation);
00343     }
00344     else if (property == s_SpacingProperty)
00345     {
00346         m_itemSpacing = unbox_value<double>(args.NewValue());
00347     }
00348
00349     InvalidateLayout();
00350 }
00351
00352 #pragma region private helpers
00353
00354 double StackLayout::GetAverageElementSize(
00355     winrt::Size availableSize,
00356     winrt::VirtualizingLayoutContext context,
00357     const winrt::com_ptr<StackLayoutState>& stackLayoutState)
00358 {
00359     double averageElementSize = 0;
00360
00361     if (context.ItemCount() > 0)
00362     {
00363         if (stackLayoutState->TotalElementsMeasured() == 0)
00364         {
00365             const auto tmpElement = context.GetOrCreateElementAt(0, winrt::ElementRealizationOptions::ForceCreate | winrt::ElementRealizationOptions::SuppressAutoRecycle);
00366             stackLayoutState->FlowAlgorithm().MeasureElement(tmpElement, 0, availableSize, context);
00367             context.RecycleElement(tmpElement);
00368         }
00369
00370         MUX_ASSERT(stackLayoutState->TotalElementsMeasured() > 0);
00371         averageElementSize = round(stackLayoutState->TotalElementSize() / stackLayoutState->TotalElementsMeasured());
00372     }
00373
00374     return averageElementSize;
00375 }
00376
00377 void StackLayout::UpdateIndexBasedLayoutOrientation(const winrt::Orientation& orientation)
00378 {
00379     SetIndexBasedLayoutOrientation(orientation == winrt::Orientation::Horizontal ?
00380         winrt::IndexBasedLayoutOrientation::LeftToRight : winrt::IndexBasedLayoutOrientation::TopToBottom);
00381 }
00382
00383 #pragma endregion
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RevealBrushTestApi.properties.cpp Source File

  • Generated

RevealBrushTestApi.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RevealBrushTestApi.h"
00008
00009 namespace winrt::Microsoft::UI::Private::Media
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(RevealBrushTestApi)
00012 }
00013
00014 #include "RevealBrushTestApi.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ViewChange.h Source File

  • ScrollPresenter

ViewChange.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ViewChangeBase.h"
00007
00008 enum class ScrollPresenterViewKind
00009 {
00010     Absolute,
00011     RelativeToCurrentView,
00012 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
00013     RelativeToEndOfInertiaView,
00014 #endif
00015 };
00016
00017 class ViewChange : public ViewChangeBase
00018 {
00019 public:
00020     ViewChange(
00021         ScrollPresenterViewKind viewKind,
00022         winrt::IInspectable const& options);
00023     ~ViewChange();
00024
00025     ScrollPresenterViewKind ViewKind() const
00026     {
00027         return m_viewKind;
00028     }
00029
00030     winrt::IInspectable Options() const
00031     {
00032         return m_options;
00033     }
00034
00035 private:
00036     ScrollPresenterViewKind m_viewKind{ ScrollPresenterViewKind::Absolute };
00037     // ScrollingScrollOptions or ScrollingZoomOptions instance associated with this view change.
00038     winrt::IInspectable m_options{ nullptr };
00039 };
00040
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TStorageWrapperImpl< T, true > Member List

This is the complete list of members for TStorageWrapperImpl< T, true >, including all inherited members.
unwrap(const Holder &holder, bool useSafeGet=false) | TStorageWrapperImpl< T, true > | [inline, static]
wrap(const T &value, ITrackerHandleManager *trackerHandleManager) | TStorageWrapperImpl< T, true > | [inline, static]
Generated on Sun Dec 1 2024 20:53:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenter.cpp Source File

  • ScrollPresenter

ScrollPresenter.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "ResourceAccessor.h"
00009 #include "RuntimeProfiler.h"
00010 #include "InteractionTrackerOwner.h"
00011 #include "ScrollPresenter.h"
00012 #include "ScrollingScrollOptions.h"
00013 #include "ScrollingZoomOptions.h"
00014 #include "ScrollPresenterAutomationPeer.h"
00015 #include "ScrollPresenterTestHooks.h"
00016 #include "Vector.h"
00017 #include "RegUtil.h"
00018 #include "MuxcTraceLogging.h"
00019
00020 // Change to 'true' to turn on debugging outputs in Output window
00021 bool ScrollPresenterTrace::s_IsDebugOutputEnabled{ false };
00022 bool ScrollPresenterTrace::s_IsVerboseDebugOutputEnabled{ false };
00023
00024 // Number of pixels scrolled when the automation peer requests a line-type change.
00025 const double c_scrollPresenterLineDelta = 16.0;
00026
00027 // Default inertia decay rate used when a IScrollController makes a request for
00028 // an offset change with additional velocity.
00029 const float c_scrollPresenterDefaultInertiaDecayRate = 0.95f;
00030
00031 const int32_t ScrollPresenter::s_noOpCorrelationId{ -1 };
00032
00033 ScrollPresenter::~ScrollPresenter()
00034 {
00035     SCROLLPRESENTER_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00036
00037     UnhookCompositionTargetRendering();
00038     UnhookScrollPresenterEvents();
00039 }
00040
00041 ScrollPresenter::ScrollPresenter()
00042 {
00043     SCROLLPRESENTER_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00044
00045     __RP_Marker_ClassById(RuntimeProfiler::ProfId_ScrollPresenter);
00046
00047     EnsureProperties();
00048
00049     winrt::UIElement::RegisterAsScrollPort(*this);
00050
00051     HookScrollPresenterEvents();
00052
00053     // Set the default Transparent background so that hit-testing allows to start a touch manipulation
00054     // outside the boundaries of the Content, when it's smaller than the ScrollPresenter.
00055     Background(winrt::SolidColorBrush(winrt::Colors::Transparent()));
00056 }
00057
00058 #pragma region Automation Peer Helpers
00059
00060 // Public methods accessed by the ScrollPresenterAutomationPeer class
00061
00062 double ScrollPresenter::GetZoomedExtentWidth() const
00063 {
00064     return m_unzoomedExtentWidth * m_zoomFactor;
00065 }
00066
00067 double ScrollPresenter::GetZoomedExtentHeight() const
00068 {
00069     return m_unzoomedExtentHeight * m_zoomFactor;
00070 }
00071
00072 void ScrollPresenter::PageLeft()
00073 {
00074     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00075
00076     ScrollToHorizontalOffset(m_zoomedHorizontalOffset - ViewportWidth());
00077 }
00078
00079 void ScrollPresenter::PageRight()
00080 {
00081     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00082
00083     ScrollToHorizontalOffset(m_zoomedHorizontalOffset + ViewportWidth());
00084 }
00085
00086 void ScrollPresenter::PageUp()
00087 {
00088     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00089
00090     ScrollToVerticalOffset(m_zoomedVerticalOffset - ViewportHeight());
00091 }
00092
00093 void ScrollPresenter::PageDown()
00094 {
00095     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00096
00097     ScrollToVerticalOffset(m_zoomedVerticalOffset + ViewportHeight());
00098 }
00099
00100 void ScrollPresenter::LineLeft()
00101 {
00102     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00103
00104     ScrollToHorizontalOffset(m_zoomedHorizontalOffset - c_scrollPresenterLineDelta);
00105 }
00106
00107 void ScrollPresenter::LineRight()
00108 {
00109     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00110
00111     ScrollToHorizontalOffset(m_zoomedHorizontalOffset + c_scrollPresenterLineDelta);
00112 }
00113
00114 void ScrollPresenter::LineUp()
00115 {
00116     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00117
00118     ScrollToVerticalOffset(m_zoomedVerticalOffset - c_scrollPresenterLineDelta);
00119 }
00120
00121 void ScrollPresenter::LineDown()
00122 {
00123     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00124
00125     ScrollToVerticalOffset(m_zoomedVerticalOffset + c_scrollPresenterLineDelta);
00126 }
00127
00128 void ScrollPresenter::ScrollToHorizontalOffset(double offset)
00129 {
00130     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_DBL, METH_NAME, this, offset);
00131
00132     ScrollToOffsets(offset /*zoomedHorizontalOffset*/, m_zoomedVerticalOffset /*zoomedVerticalOffset*/);
00133 }
00134
00135 void ScrollPresenter::ScrollToVerticalOffset(double offset)
00136 {
00137     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_DBL, METH_NAME, this, offset);
00138
00139     ScrollToOffsets(m_zoomedHorizontalOffset /*zoomedHorizontalOffset*/, offset /*zoomedVerticalOffset*/);
00140 }
00141
00142 void ScrollPresenter::ScrollToOffsets(
00143     double horizontalOffset, double verticalOffset)
00144 {
00145     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, horizontalOffset, verticalOffset);
00146
00147     if (m_interactionTracker)
00148     {
00149         com_ptr<ScrollingScrollOptions> options =
00150             winrt::make_self<ScrollingScrollOptions>(
00151                 winrt::ScrollingAnimationMode::Disabled,
00152                 winrt::ScrollingSnapPointsMode::Ignore);
00153
00154         std::shared_ptr<OffsetsChange> offsetsChange =
00155             std::make_shared<OffsetsChange>(
00156                 horizontalOffset,
00157                 verticalOffset,
00158                 ScrollPresenterViewKind::Absolute,
00159                 winrt::IInspectable{ *options }); // NOTE: Using explicit cast to winrt::IInspectable to work around 17532876
00160
00161         ProcessOffsetsChange(
00162             InteractionTrackerAsyncOperationTrigger::DirectViewChange,
00163             offsetsChange,
00164             s_noOpCorrelationId /*offsetsChangeCorrelationId*/,
00165             false /*isForAsyncOperation*/);
00166     }
00167 }
00168
00169 #pragma endregion
00170
00171 #pragma region IUIElementOverridesHelper
00172
00173 winrt::AutomationPeer ScrollPresenter::OnCreateAutomationPeer()
00174 {
00175     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00176
00177     return winrt::make<ScrollPresenterAutomationPeer>(*this);
00178 }
00179
00180 #pragma endregion
00181
00182 #pragma region IScrollPresenter
00183
00184 winrt::CompositionPropertySet ScrollPresenter::ExpressionAnimationSources()
00185 {
00186     SetupInteractionTrackerBoundaries();
00187     EnsureExpressionAnimationSources();
00188
00189     return m_expressionAnimationSources;
00190 }
00191
00192 double ScrollPresenter::HorizontalOffset() const
00193 {
00194     return m_zoomedHorizontalOffset;
00195 }
00196
00197 double ScrollPresenter::VerticalOffset() const
00198 {
00199     return m_zoomedVerticalOffset;
00200 }
00201
00202 float ScrollPresenter::ZoomFactor() const
00203 {
00204     return m_zoomFactor;
00205 }
00206
00207 double ScrollPresenter::ExtentWidth() const
00208 {
00209     return m_unzoomedExtentWidth;
00210 }
00211
00212 double ScrollPresenter::ExtentHeight() const
00213 {
00214     return m_unzoomedExtentHeight;
00215 }
00216
00217 double ScrollPresenter::ViewportWidth() const
00218 {
00219     return m_viewportWidth;
00220 }
00221
00222 double ScrollPresenter::ViewportHeight() const
00223 {
00224     return m_viewportHeight;
00225 }
00226
00227 double ScrollPresenter::ScrollableWidth() const
00228 {
00229     return std::max(0.0, GetZoomedExtentWidth() - ViewportWidth());
00230 }
00231
00232 double ScrollPresenter::ScrollableHeight() const
00233 {
00234     return std::max(0.0, GetZoomedExtentHeight() - ViewportHeight());
00235 }
00236
00237 // AnticipatedZoomedHorizontalOffset, AnticipatedZoomedVerticalOffset() and AnticipatedZoomFactor() are
00238 // used to evaluate the view for the ScrollStarting/ZoomStarting events raised when a ScrollTo, ScrollBy,
00239 // ZoomTo or ZoomBy request is handed off to the InteractionTracker.
00240
00241 double ScrollPresenter::AnticipatedZoomedHorizontalOffset() const
00242 {
00243     return isnan(m_anticipatedZoomedHorizontalOffset) ? m_zoomedHorizontalOffset : m_anticipatedZoomedHorizontalOffset;
00244 }
00245
00246 double ScrollPresenter::AnticipatedZoomedVerticalOffset() const
00247 {
00248     return isnan(m_anticipatedZoomedVerticalOffset) ? m_zoomedVerticalOffset : m_anticipatedZoomedVerticalOffset;
00249 }
00250
00251 float ScrollPresenter::AnticipatedZoomFactor() const
00252 {
00253     return isnan(m_anticipatedZoomFactor) ? m_zoomFactor : m_anticipatedZoomFactor;
00254 }
00255
00256 double ScrollPresenter::AnticipatedScrollableWidth() const
00257 {
00258     return std::max(0.0, m_unzoomedExtentWidth * AnticipatedZoomFactor() - ViewportWidth());
00259 }
00260
00261 double ScrollPresenter::AnticipatedScrollableHeight() const
00262 {
00263     return std::max(0.0, m_unzoomedExtentHeight * AnticipatedZoomFactor() - ViewportHeight());
00264 }
00265
00266 winrt::IScrollController ScrollPresenter::HorizontalScrollController() const
00267 {
00268     if (m_horizontalScrollController)
00269     {
00270         return m_horizontalScrollController.get();
00271     }
00272
00273     return nullptr;
00274 }
00275
00276 void ScrollPresenter::HorizontalScrollController(winrt::IScrollController const& value)
00277 {
00278     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_PTR, METH_NAME, this, value);
00279
00280     if (m_horizontalScrollController)
00281     {
00282         UnhookHorizontalScrollControllerEvents();
00283
00284         if (m_horizontalScrollControllerPanningInfo)
00285         {
00286             UnhookHorizontalScrollControllerPanningInfoEvents();
00287
00288             if (m_horizontalScrollControllerExpressionAnimationSources)
00289             {
00290                 m_horizontalScrollControllerPanningInfo.get().SetPanningElementExpressionAnimationSources(
00291                     nullptr /*scrollControllerExpressionAnimationSources*/,
00292                     s_minOffsetPropertyName,
00293                     s_maxOffsetPropertyName,
00294                     s_offsetPropertyName,
00295                     s_multiplierPropertyName);
00296             }
00297         }
00298     }
00299
00300     m_horizontalScrollController.set(value);
00301     m_horizontalScrollControllerPanningInfo.set(value ? value.PanningInfo() : nullptr);
00302
00303     if (m_interactionTracker)
00304     {
00305         SetupScrollControllerVisualInterationSource(ScrollPresenterDimension::HorizontalScroll);
00306     }
00307
00308     if (m_horizontalScrollController)
00309     {
00310         HookHorizontalScrollControllerEvents(
00311             m_horizontalScrollController.get());
00312
00313         if (m_horizontalScrollControllerPanningInfo)
00314         {
00315             HookHorizontalScrollControllerPanningInfoEvents(
00316                 m_horizontalScrollControllerPanningInfo.get(),
00317                 m_horizontalScrollControllerVisualInteractionSource != nullptr /*hasInteractionSource*/);
00318         }
00319
00320         UpdateScrollControllerValues(ScrollPresenterDimension::HorizontalScroll);
00321         UpdateScrollControllerIsScrollable(ScrollPresenterDimension::HorizontalScroll);
00322
00323         if (m_horizontalScrollControllerPanningInfo && m_horizontalScrollControllerExpressionAnimationSources)
00324         {
00325             m_horizontalScrollControllerPanningInfo.get().SetPanningElementExpressionAnimationSources(
00326                 m_horizontalScrollControllerExpressionAnimationSources,
00327                 s_minOffsetPropertyName,
00328                 s_maxOffsetPropertyName,
00329                 s_offsetPropertyName,
00330                 s_multiplierPropertyName);
00331         }
00332     }
00333 }
00334
00335 winrt::IScrollController ScrollPresenter::VerticalScrollController() const
00336 {
00337     if (m_verticalScrollController)
00338     {
00339         return m_verticalScrollController.get();
00340     }
00341
00342     return nullptr;
00343 }
00344
00345 void ScrollPresenter::VerticalScrollController(winrt::IScrollController const& value)
00346 {
00347     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_PTR, METH_NAME, this, value);
00348
00349     if (m_verticalScrollController)
00350     {
00351         UnhookVerticalScrollControllerEvents();
00352     }
00353
00354     if (m_verticalScrollControllerPanningInfo)
00355     {
00356         UnhookVerticalScrollControllerPanningInfoEvents();
00357
00358         if (m_verticalScrollControllerExpressionAnimationSources)
00359         {
00360             m_verticalScrollControllerPanningInfo.get().SetPanningElementExpressionAnimationSources(
00361                 nullptr /*scrollControllerExpressionAnimationSources*/,
00362                 s_minOffsetPropertyName,
00363                 s_maxOffsetPropertyName,
00364                 s_offsetPropertyName,
00365                 s_multiplierPropertyName);
00366         }
00367     }
00368
00369     m_verticalScrollController.set(value);
00370     m_verticalScrollControllerPanningInfo.set(value ? value.PanningInfo() : nullptr);
00371
00372     if (m_interactionTracker)
00373     {
00374         SetupScrollControllerVisualInterationSource(ScrollPresenterDimension::VerticalScroll);
00375     }
00376
00377     if (m_verticalScrollController)
00378     {
00379         HookVerticalScrollControllerEvents(
00380             m_verticalScrollController.get());
00381
00382         if (m_verticalScrollControllerPanningInfo)
00383         {
00384             HookVerticalScrollControllerPanningInfoEvents(
00385                 m_verticalScrollControllerPanningInfo.get(),
00386                 m_verticalScrollControllerVisualInteractionSource != nullptr /*hasInteractionSource*/);
00387         }
00388
00389         UpdateScrollControllerValues(ScrollPresenterDimension::VerticalScroll);
00390         UpdateScrollControllerIsScrollable(ScrollPresenterDimension::VerticalScroll);
00391
00392         if (m_verticalScrollControllerPanningInfo && m_verticalScrollControllerExpressionAnimationSources)
00393         {
00394             m_verticalScrollControllerPanningInfo.get().SetPanningElementExpressionAnimationSources(
00395                 m_verticalScrollControllerExpressionAnimationSources,
00396                 s_minOffsetPropertyName,
00397                 s_maxOffsetPropertyName,
00398                 s_offsetPropertyName,
00399                 s_multiplierPropertyName);
00400         }
00401     }
00402 }
00403
00404 winrt::ScrollingInputKinds ScrollPresenter::IgnoredInputKinds() const
00405 {
00406     // Workaround for Bug 17377013: XamlCompiler codegen for Enum CreateFromString always returns boxed int which is wrong for [flags] enums (should be uint)
00407     // Check if the boxed IgnoredInputKinds is an IReference<int> first in which case we unbox as int.
00408     auto boxedKind = GetValue(s_IgnoredInputKindsProperty);
00409     if (auto boxedInt = boxedKind.try_as<winrt::IReference<int32_t>>())
00410     {
00411         return winrt::ScrollingInputKinds{ static_cast<uint32_t>(unbox_value<int32_t>(boxedInt)) };
00412     }
00413
00414     return auto_unbox(boxedKind);
00415 }
00416
00417 void ScrollPresenter::IgnoredInputKinds(winrt::ScrollingInputKinds const& value)
00418 {
00419     SetValue(s_IgnoredInputKindsProperty, box_value(value));
00420 }
00421
00422 winrt::ScrollingInteractionState ScrollPresenter::State() const
00423 {
00424     return m_state;
00425 }
00426
00427 winrt::IVector<winrt::ScrollSnapPointBase> ScrollPresenter::HorizontalSnapPoints()
00428 {
00429     if (!m_horizontalSnapPoints)
00430     {
00431         m_horizontalSnapPoints = winrt::make<Vector<winrt::ScrollSnapPointBase>>();
00432
00433         auto horizontalSnapPointsObservableVector = m_horizontalSnapPoints.try_as<winrt::IObservableVector<winrt::ScrollSnapPointBase>>();
00434         m_horizontalSnapPointsVectorChangedRevoker = horizontalSnapPointsObservableVector.VectorChanged(
00435             winrt::auto_revoke,
00436             { this, &ScrollPresenter::OnHorizontalSnapPointsVectorChanged });
00437     }
00438     return m_horizontalSnapPoints;
00439 }
00440
00441 winrt::IVector<winrt::ScrollSnapPointBase> ScrollPresenter::VerticalSnapPoints()
00442 {
00443     if (!m_verticalSnapPoints)
00444     {
00445         m_verticalSnapPoints = winrt::make<Vector<winrt::ScrollSnapPointBase>>();
00446
00447         auto verticalSnapPointsObservableVector = m_verticalSnapPoints.try_as<winrt::IObservableVector<winrt::ScrollSnapPointBase>>();
00448         m_verticalSnapPointsVectorChangedRevoker = verticalSnapPointsObservableVector.VectorChanged(
00449             winrt::auto_revoke,
00450             { this, &ScrollPresenter::OnVerticalSnapPointsVectorChanged });
00451     }
00452     return m_verticalSnapPoints;
00453 }
00454
00455 winrt::IVector<winrt::ZoomSnapPointBase> ScrollPresenter::ZoomSnapPoints()
00456 {
00457     if (!m_zoomSnapPoints)
00458     {
00459         m_zoomSnapPoints = winrt::make<Vector<winrt::ZoomSnapPointBase>>();
00460
00461         auto zoomSnapPointsObservableVector = m_zoomSnapPoints.try_as<winrt::IObservableVector<winrt::ZoomSnapPointBase>>();
00462         m_zoomSnapPointsVectorChangedRevoker = zoomSnapPointsObservableVector.VectorChanged(
00463             winrt::auto_revoke,
00464             { this, &ScrollPresenter::OnZoomSnapPointsVectorChanged });
00465     }
00466     return m_zoomSnapPoints;
00467 }
00468
00469 int32_t ScrollPresenter::ScrollTo(double horizontalOffset, double verticalOffset)
00470 {
00471     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, horizontalOffset, verticalOffset);
00472
00473     return ScrollTo(horizontalOffset, verticalOffset, nullptr /*options*/);
00474 }
00475
00476 int32_t ScrollPresenter::ScrollTo(double horizontalOffset, double verticalOffset, winrt::ScrollingScrollOptions const& options)
00477 {
00478     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL_STR, METH_NAME, this,
00479         horizontalOffset, verticalOffset, TypeLogging::ScrollOptionsToString(options).c_str());
00480
00481     int32_t viewChangeCorrelationId;
00482     ChangeOffsetsPrivate(
00483         horizontalOffset /*zoomedHorizontalOffset*/,
00484         verticalOffset /*zoomedVerticalOffset*/,
00485         ScrollPresenterViewKind::Absolute,
00486         options,
00487         nullptr /*bringIntoViewRequestedEventArgs*/,
00488         InteractionTrackerAsyncOperationTrigger::DirectViewChange,
00489         s_noOpCorrelationId /*existingViewChangeCorrelationId*/,
00490         &viewChangeCorrelationId);
00491
00492     return viewChangeCorrelationId;
00493 }
00494
00495 int32_t ScrollPresenter::ScrollBy(double horizontalOffsetDelta, double verticalOffsetDelta)
00496 {
00497     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, horizontalOffsetDelta, verticalOffsetDelta);
00498
00499     return ScrollBy(horizontalOffsetDelta, verticalOffsetDelta, nullptr /*options*/);
00500 }
00501
00502 int32_t ScrollPresenter::ScrollBy(double horizontalOffsetDelta, double verticalOffsetDelta, winrt::ScrollingScrollOptions const& options)
00503 {
00504     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL_STR, METH_NAME, this,
00505         horizontalOffsetDelta, verticalOffsetDelta, TypeLogging::ScrollOptionsToString(options).c_str());
00506
00507     int32_t viewChangeCorrelationId;
00508     ChangeOffsetsPrivate(
00509         horizontalOffsetDelta /*zoomedHorizontalOffset*/,
00510         verticalOffsetDelta /*zoomedVerticalOffset*/,
00511         ScrollPresenterViewKind::RelativeToCurrentView,
00512         options,
00513         nullptr /*bringIntoViewRequestedEventArgs*/,
00514         InteractionTrackerAsyncOperationTrigger::DirectViewChange,
00515         s_noOpCorrelationId /*existingViewChangeCorrelationId*/,
00516         &viewChangeCorrelationId);
00517
00518     return viewChangeCorrelationId;
00519 }
00520
00521 int32_t ScrollPresenter::AddScrollVelocity(winrt::float2 offsetsVelocity, winrt::IReference<winrt::float2> inertiaDecayRate)
00522 {
00523     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this,
00524         TypeLogging::Float2ToString(offsetsVelocity).c_str(), TypeLogging::NullableFloat2ToString(inertiaDecayRate).c_str());
00525
00526     int32_t viewChangeCorrelationId;
00527     ChangeOffsetsWithAdditionalVelocityPrivate(
00528         offsetsVelocity,
00529         winrt::float2::zero() /*anticipatedOffsetsChange*/,
00530         inertiaDecayRate,
00531         InteractionTrackerAsyncOperationTrigger::DirectViewChange,
00532         &viewChangeCorrelationId);
00533
00534     return viewChangeCorrelationId;
00535 }
00536
00537 int32_t ScrollPresenter::ZoomTo(float zoomFactor, winrt::IReference<winrt::float2> centerPoint)
00538 {
00539     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
00540         TypeLogging::NullableFloat2ToString(centerPoint).c_str(), zoomFactor);
00541
00542     return ZoomTo(zoomFactor, centerPoint, nullptr /*options*/);
00543 }
00544
00545 int32_t ScrollPresenter::ZoomTo(float zoomFactor, winrt::IReference<winrt::float2> centerPoint, winrt::ScrollingZoomOptions const& options)
00546 {
00547     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR_FLT, METH_NAME, this,
00548         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
00549         TypeLogging::ZoomOptionsToString(options).c_str(),
00550         zoomFactor);
00551
00552     int32_t viewChangeCorrelationId;
00553     ChangeZoomFactorPrivate(
00554         zoomFactor,
00555         centerPoint,
00556         ScrollPresenterViewKind::Absolute,
00557         options,
00558         &viewChangeCorrelationId);
00559
00560     return viewChangeCorrelationId;
00561 }
00562
00563 int32_t ScrollPresenter::ZoomBy(float zoomFactorDelta, winrt::IReference<winrt::float2> centerPoint)
00564 {
00565     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
00566         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
00567         zoomFactorDelta);
00568
00569     return ZoomBy(zoomFactorDelta, centerPoint, nullptr /*options*/);
00570 }
00571
00572 int32_t ScrollPresenter::ZoomBy(float zoomFactorDelta, winrt::IReference<winrt::float2> centerPoint, winrt::ScrollingZoomOptions const& options)
00573 {
00574     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR_FLT, METH_NAME, this,
00575         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
00576         TypeLogging::ZoomOptionsToString(options).c_str(),
00577         zoomFactorDelta);
00578
00579     int32_t viewChangeCorrelationId;
00580     ChangeZoomFactorPrivate(
00581         zoomFactorDelta,
00582         centerPoint,
00583         ScrollPresenterViewKind::RelativeToCurrentView,
00584         options,
00585         &viewChangeCorrelationId);
00586
00587     return viewChangeCorrelationId;
00588 }
00589
00590 int32_t ScrollPresenter::AddZoomVelocity(float zoomFactorVelocity, winrt::IReference<winrt::float2> centerPoint, winrt::IReference<float> inertiaDecayRate)
00591 {
00592     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR_FLT, METH_NAME, this,
00593         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
00594         TypeLogging::NullableFloatToString(inertiaDecayRate).c_str(),
00595         zoomFactorVelocity);
00596
00597     int32_t viewChangeCorrelationId;
00598     ChangeZoomFactorWithAdditionalVelocityPrivate(
00599         zoomFactorVelocity,
00600         0.0f /*anticipatedZoomFactorChange*/,
00601         centerPoint,
00602         inertiaDecayRate,
00603         InteractionTrackerAsyncOperationTrigger::DirectViewChange,
00604         &viewChangeCorrelationId);
00605
00606     return viewChangeCorrelationId;
00607 }
00608
00609 #pragma endregion
00610
00611 #pragma region IFrameworkElementOverridesHelper
00612
00613 winrt::Size ScrollPresenter::MeasureOverride(winrt::Size const& availableSize)
00614 {
00615     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"availableSize:", availableSize.Width, availableSize.Height);
00616
00617     m_availableSize = availableSize;
00618
00619     winrt::Size contentDesiredSize{ 0.0f, 0.0f };
00620     const winrt::UIElement content = Content();
00621
00622     if (content)
00623     {
00624         // The content is measured with infinity in the directions in which it is not constrained, enabling this ScrollPresenter
00625         // to be scrollable in those directions.
00626         winrt::Size contentAvailableSize
00627         {
00628             (m_contentOrientation == winrt::ScrollingContentOrientation::Vertical || m_contentOrientation == winrt::ScrollingContentOrientation::None) ?
00629                 availableSize.Width : std::numeric_limits<float>::infinity(),
00630             (m_contentOrientation == winrt::ScrollingContentOrientation::Horizontal || m_contentOrientation == winrt::ScrollingContentOrientation::None) ?
00631                 availableSize.Height : std::numeric_limits<float>::infinity()
00632         };
00633
00634         if (m_contentOrientation != winrt::ScrollingContentOrientation::Both)
00635         {
00636             const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
00637
00638             if (contentAsFE)
00639             {
00640                 const winrt::Thickness contentMargin = contentAsFE.Margin();
00641
00642                 if (m_contentOrientation == winrt::ScrollingContentOrientation::Vertical || m_contentOrientation == winrt::ScrollingContentOrientation::None)
00643                 {
00644                     // Even though the content's Width is constrained, take into account the MinWidth, Width and MaxWidth values
00645                     // potentially set on the content so it is allowed to grow accordingly.
00646                     contentAvailableSize.Width = static_cast<float>(GetComputedMaxWidth(availableSize.Width, contentAsFE));
00647                 }
00648                 if (m_contentOrientation == winrt::ScrollingContentOrientation::Horizontal || m_contentOrientation == winrt::ScrollingContentOrientation::None)
00649                 {
00650                     // Even though the content's Height is constrained, take into account the MinHeight, Height and MaxHeight values
00651                     // potentially set on the content so it is allowed to grow accordingly.
00652                     contentAvailableSize.Height = static_cast<float>(GetComputedMaxHeight(availableSize.Height, contentAsFE));
00653                 }
00654             }
00655         }
00656
00657         content.Measure(contentAvailableSize);
00658         contentDesiredSize = content.DesiredSize();
00659     }
00660
00661     // The framework determines that this ScrollPresenter is scrollable when unclippedDesiredSize.Width/Height > desiredSize.Width/Height
00662     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"contentDesiredSize:", contentDesiredSize.Width, contentDesiredSize.Height);
00663
00664     return contentDesiredSize;
00665 }
00666
00667 winrt::Size ScrollPresenter::ArrangeOverride(winrt::Size const& finalSize)
00668 {
00669     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"finalSize", finalSize.Width, finalSize.Height);
00670
00671     const winrt::UIElement content = Content();
00672     winrt::Rect finalContentRect{};
00673
00674     // Possible cases:
00675     // 1. m_availableSize is infinite, the ScrollPresenter is not constrained and takes its Content DesiredSize.
00676     //    viewport thus is finalSize.
00677     // 2. m_availableSize > finalSize, the ScrollPresenter is constrained and its Content is smaller than the available size.
00678     //    No matter the ScrollPresenter's alignment, it does not grow larger than finalSize. viewport is finalSize again.
00679     // 3. m_availableSize <= finalSize, the ScrollPresenter is constrained and its Content is larger than or equal to
00680     //    the available size. viewport is the smaller & constrained m_availableSize.
00681     const winrt::Size viewport =
00682     {
00683         std::min(finalSize.Width, m_availableSize.Width),
00684         std::min(finalSize.Height, m_availableSize.Height)
00685     };
00686
00687     bool renderSizeChanged = false;
00688     double newUnzoomedExtentWidth = 0.0;
00689     double newUnzoomedExtentHeight = 0.0;
00690
00691     if (content)
00692     {
00693         float contentLayoutOffsetXDelta = 0.0f;
00694         float contentLayoutOffsetYDelta = 0.0f;
00695         bool isAnchoringElementHorizontally = false;
00696         bool isAnchoringElementVertically = false;
00697         bool isAnchoringFarEdgeHorizontally = false;
00698         bool isAnchoringFarEdgeVertically = false;
00699         const winrt::Size oldRenderSize = content.RenderSize();
00700         winrt::Size contentArrangeSize = content.DesiredSize();
00701
00702         const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
00703
00704         const winrt::Thickness contentMargin = [contentAsFE]()
00705         {
00706             return contentAsFE ? contentAsFE.Margin() : winrt::Thickness{ 0 };
00707         }();
00708
00709         const bool wasContentArrangeWidthStretched = [contentAsFE, contentArrangeSize, viewport]()
00710         {
00711             return contentAsFE &&
00712                 contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch &&
00713                 isnan(contentAsFE.Width()) &&
00714                 contentArrangeSize.Width < viewport.Width;
00715         }();
00716
00717         const bool wasContentArrangeHeightStretched = [contentAsFE, contentArrangeSize, viewport]()
00718         {
00719             return contentAsFE &&
00720                 contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch &&
00721                 isnan(contentAsFE.Height()) &&
00722                 contentArrangeSize.Height < viewport.Height;
00723         }();
00724
00725         if (wasContentArrangeWidthStretched)
00726         {
00727             // Allow the content to stretch up to the larger viewport width.
00728             contentArrangeSize.Width = viewport.Width;
00729         }
00730
00731         if (wasContentArrangeHeightStretched)
00732         {
00733             // Allow the content to stretch up to the larger viewport height.
00734             contentArrangeSize.Height = viewport.Height;
00735         }
00736
00737         finalContentRect =
00738         {
00739             m_contentLayoutOffsetX,
00740             m_contentLayoutOffsetY,
00741             contentArrangeSize.Width,
00742             contentArrangeSize.Height
00743         };
00744
00745         IsAnchoring(&isAnchoringElementHorizontally, &isAnchoringElementVertically, &isAnchoringFarEdgeHorizontally, &isAnchoringFarEdgeVertically);
00746
00747         MUX_ASSERT(!(isAnchoringElementHorizontally && isAnchoringFarEdgeHorizontally));
00748         MUX_ASSERT(!(isAnchoringElementVertically && isAnchoringFarEdgeVertically));
00749
00750         if (isAnchoringElementHorizontally || isAnchoringElementVertically || isAnchoringFarEdgeHorizontally || isAnchoringFarEdgeVertically)
00751         {
00752             MUX_ASSERT(m_interactionTracker);
00753
00754             winrt::Size preArrangeViewportToElementAnchorPointsDistance{ FloatUtil::NaN, FloatUtil::NaN };
00755
00756             if (isAnchoringElementHorizontally || isAnchoringElementVertically)
00757             {
00758                 EnsureAnchorElementSelection();
00759                 preArrangeViewportToElementAnchorPointsDistance = ComputeViewportToElementAnchorPointsDistance(
00760                     m_viewportWidth,
00761                     m_viewportHeight,
00762                     true /*isForPreArrange*/);
00763             }
00764             else
00765             {
00766                 ResetAnchorElement();
00767             }
00768
00769             contentArrangeSize = ArrangeContent(
00770                 content,
00771                 contentMargin,
00772                 finalContentRect,
00773                 wasContentArrangeWidthStretched,
00774                 wasContentArrangeHeightStretched);
00775
00776             if (!isnan(preArrangeViewportToElementAnchorPointsDistance.Width) || !isnan(preArrangeViewportToElementAnchorPointsDistance.Height))
00777             {
00778                 // Using the new viewport sizes to handle the cases where an adjustment needs to be performed because of a ScrollPresenter size change.
00779                 const winrt::Size postArrangeViewportToElementAnchorPointsDistance = ComputeViewportToElementAnchorPointsDistance(
00780                     viewport.Width /*viewportWidth*/,
00781                     viewport.Height /*viewportHeight*/,
00782                     false /*isForPreArrange*/);
00783
00784                 if (isAnchoringElementHorizontally &&
00785                     !isnan(preArrangeViewportToElementAnchorPointsDistance.Width) &&
00786                     !isnan(postArrangeViewportToElementAnchorPointsDistance.Width) &&
00787                     preArrangeViewportToElementAnchorPointsDistance.Width != postArrangeViewportToElementAnchorPointsDistance.Width)
00788                 {
00789                     // Perform horizontal offset adjustment due to element anchoring
00790                     contentLayoutOffsetXDelta = ComputeContentLayoutOffsetDelta(
00791                         ScrollPresenterDimension::HorizontalScroll,
00792                         postArrangeViewportToElementAnchorPointsDistance.Width - preArrangeViewportToElementAnchorPointsDistance.Width /*unzoomedDelta*/);
00793                 }
00794
00795                 if (isAnchoringElementVertically &&
00796                     !isnan(preArrangeViewportToElementAnchorPointsDistance.Height) &&
00797                     !isnan(postArrangeViewportToElementAnchorPointsDistance.Height) &&
00798                     preArrangeViewportToElementAnchorPointsDistance.Height != postArrangeViewportToElementAnchorPointsDistance.Height)
00799                 {
00800                     // Perform vertical offset adjustment due to element anchoring
00801                     contentLayoutOffsetYDelta = ComputeContentLayoutOffsetDelta(
00802                         ScrollPresenterDimension::VerticalScroll,
00803                         postArrangeViewportToElementAnchorPointsDistance.Height - preArrangeViewportToElementAnchorPointsDistance.Height /*unzoomedDelta*/);
00804                 }
00805             }
00806         }
00807         else
00808         {
00809             ResetAnchorElement();
00810
00811             contentArrangeSize = ArrangeContent(
00812                 content,
00813                 contentMargin,
00814                 finalContentRect,
00815                 wasContentArrangeWidthStretched,
00816                 wasContentArrangeHeightStretched);
00817         }
00818
00819         newUnzoomedExtentWidth = contentArrangeSize.Width;
00820         newUnzoomedExtentHeight = contentArrangeSize.Height;
00821
00822         double maxUnzoomedExtentWidth = std::numeric_limits<double>::infinity();
00823         double maxUnzoomedExtentHeight = std::numeric_limits<double>::infinity();
00824
00825         if (contentAsFE)
00826         {
00827             // Determine the maximum size directly set on the content, if any.
00828             maxUnzoomedExtentWidth = GetComputedMaxWidth(maxUnzoomedExtentWidth, contentAsFE);
00829             maxUnzoomedExtentHeight = GetComputedMaxHeight(maxUnzoomedExtentHeight, contentAsFE);
00830         }
00831
00832         // Take into account the actual resulting rendering size, in case it's larger than the desired size.
00833         // But the extent must not exceed the size explicitly set on the content, if any.
00834         newUnzoomedExtentWidth = std::max(
00835             newUnzoomedExtentWidth,
00836             std::max(0.0, content.RenderSize().Width + contentMargin.Left + contentMargin.Right));
00837         newUnzoomedExtentWidth = std::min(
00838             newUnzoomedExtentWidth,
00839             maxUnzoomedExtentWidth);
00840
00841         newUnzoomedExtentHeight = std::max(
00842             newUnzoomedExtentHeight,
00843             std::max(0.0, content.RenderSize().Height + contentMargin.Top + contentMargin.Bottom));
00844         newUnzoomedExtentHeight = std::min(
00845             newUnzoomedExtentHeight,
00846             maxUnzoomedExtentHeight);
00847
00848         if (isAnchoringFarEdgeHorizontally)
00849         {
00850             float unzoomedDelta = 0.0f;
00851
00852             if (newUnzoomedExtentWidth > m_unzoomedExtentWidth ||                                  // ExtentWidth grew
00853                 m_zoomedHorizontalOffset + m_viewportWidth > m_zoomFactor * m_unzoomedExtentWidth) // ExtentWidth shrank while overpanning
00854             {
00855                 // Perform horizontal offset adjustment due to edge anchoring
00856                 unzoomedDelta = static_cast<float>(newUnzoomedExtentWidth - m_unzoomedExtentWidth);
00857             }
00858
00859             if (static_cast<float>(m_viewportWidth) > viewport.Width)
00860             {
00861                 // Viewport width shrank: Perform horizontal offset adjustment due to edge anchoring
00862                 unzoomedDelta += (static_cast<float>(m_viewportWidth) - viewport.Width) / m_zoomFactor;
00863             }
00864
00865             if (unzoomedDelta != 0.0f)
00866             {
00867                 MUX_ASSERT(contentLayoutOffsetXDelta == 0.0f);
00868                 contentLayoutOffsetXDelta = ComputeContentLayoutOffsetDelta(ScrollPresenterDimension::HorizontalScroll, unzoomedDelta);
00869             }
00870         }
00871
00872         if (isAnchoringFarEdgeVertically)
00873         {
00874             float unzoomedDelta = 0.0f;
00875
00876             if (newUnzoomedExtentHeight > m_unzoomedExtentHeight ||                                // ExtentHeight grew
00877                 m_zoomedVerticalOffset + m_viewportHeight > m_zoomFactor * m_unzoomedExtentHeight) // ExtentHeight shrank while overpanning
00878             {
00879                 // Perform vertical offset adjustment due to edge anchoring
00880                 unzoomedDelta = static_cast<float>(newUnzoomedExtentHeight - m_unzoomedExtentHeight);
00881             }
00882
00883             if (static_cast<float>(m_viewportHeight) > viewport.Height)
00884             {
00885                 // Viewport height shrank: Perform vertical offset adjustment due to edge anchoring
00886                 unzoomedDelta += (static_cast<float>(m_viewportHeight) - viewport.Height) / m_zoomFactor;
00887             }
00888
00889             if (unzoomedDelta != 0.0f)
00890             {
00891                 MUX_ASSERT(contentLayoutOffsetYDelta == 0.0f);
00892                 contentLayoutOffsetYDelta = ComputeContentLayoutOffsetDelta(ScrollPresenterDimension::VerticalScroll, unzoomedDelta);
00893             }
00894         }
00895
00896         if (contentLayoutOffsetXDelta != 0.0f || contentLayoutOffsetYDelta != 0.0f)
00897         {
00898             const winrt::Rect contentRectWithDelta =
00899             {
00900                 m_contentLayoutOffsetX + contentLayoutOffsetXDelta,
00901                 m_contentLayoutOffsetY + contentLayoutOffsetYDelta,
00902                 contentArrangeSize.Width,
00903                 contentArrangeSize.Height
00904             };
00905
00906             SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"content Arrange", TypeLogging::RectToString(contentRectWithDelta).c_str());
00907
00908             content.Arrange(contentRectWithDelta);
00909
00910             if (contentLayoutOffsetXDelta != 0.0f)
00911             {
00912                 m_contentLayoutOffsetX += contentLayoutOffsetXDelta;
00913                 UpdateOffset(ScrollPresenterDimension::HorizontalScroll, m_zoomedHorizontalOffset - contentLayoutOffsetXDelta);
00914                 OnContentLayoutOffsetChanged(ScrollPresenterDimension::HorizontalScroll);
00915             }
00916
00917             if (contentLayoutOffsetYDelta != 0.0f)
00918             {
00919                 m_contentLayoutOffsetY += contentLayoutOffsetYDelta;
00920                 UpdateOffset(ScrollPresenterDimension::VerticalScroll, m_zoomedVerticalOffset - contentLayoutOffsetYDelta);
00921                 OnContentLayoutOffsetChanged(ScrollPresenterDimension::VerticalScroll);
00922             }
00923
00924             OnViewChanged(contentLayoutOffsetXDelta != 0.0f /*horizontalOffsetChanged*/, contentLayoutOffsetYDelta != 0.0f /*verticalOffsetChanged*/);
00925         }
00926
00927         renderSizeChanged = content.RenderSize() != oldRenderSize;
00928     }
00929
00930     // Set a rectangular clip on this ScrollPresenter the same size as the arrange
00931     // rectangle so the content does not render beyond it.
00932     auto rectangleGeometry = Clip().as<winrt::RectangleGeometry>();
00933
00934     if (!rectangleGeometry)
00935     {
00936         // Ensure that this ScrollPresenter has a rectangular clip.
00937         winrt::RectangleGeometry newRectangleGeometry;
00938         Clip(newRectangleGeometry);
00939
00940         rectangleGeometry = newRectangleGeometry;
00941     }
00942
00943     const winrt::Rect newClipRect{ 0.0f, 0.0f, viewport.Width, viewport.Height };
00944     rectangleGeometry.Rect(newClipRect);
00945
00946     UpdateUnzoomedExtentAndViewport(
00947         renderSizeChanged,
00948         newUnzoomedExtentWidth  /*unzoomedExtentWidth*/,
00949         newUnzoomedExtentHeight /*unzoomedExtentHeight*/,
00950         viewport.Width          /*viewportWidth*/,
00951         viewport.Height         /*viewportHeight*/);
00952
00953     m_isAnchorElementDirty = true;
00954     return viewport;
00955 }
00956
00957 #pragma endregion
00958
00959 #pragma region IInteractionTrackerOwner
00960
00961 void ScrollPresenter::CustomAnimationStateEntered(
00962     const winrt::InteractionTrackerCustomAnimationStateEnteredArgs& args)
00963 {
00964     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, args.RequestId());
00965
00966     UpdateState(winrt::ScrollingInteractionState::Animation);
00967 }
00968
00969 void ScrollPresenter::IdleStateEntered(
00970     const winrt::InteractionTrackerIdleStateEnteredArgs& args)
00971 {
00972     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, args.RequestId());
00973
00974     UpdateState(winrt::ScrollingInteractionState::Idle);
00975
00976     if (!m_interactionTrackerAsyncOperations.empty())
00977     {
00978         const int32_t requestId = args.RequestId();
00979
00980         // Complete all operations recorded through ChangeOffsetsPrivate/ChangeOffsetsWithAdditionalVelocityPrivate
00981         // and ChangeZoomFactorPrivate/ChangeZoomFactorWithAdditionalVelocityPrivate calls.
00982         if (requestId != 0)
00983         {
00984             CompleteInteractionTrackerOperations(
00985                 requestId,
00986                 ScrollPresenterViewChangeResult::Completed   /*operationResult*/,
00987                 ScrollPresenterViewChangeResult::Completed   /*priorNonAnimatedOperationsResult*/,
00988                 ScrollPresenterViewChangeResult::Interrupted /*priorAnimatedOperationsResult*/,
00989                 true  /*completeNonAnimatedOperation*/,
00990                 true  /*completeAnimatedOperation*/,
00991                 true  /*completePriorNonAnimatedOperations*/,
00992                 true  /*completePriorAnimatedOperations*/);
00993         }
00994     }
00995
00996     // Check if resting position corresponds to a non-unique mandatory snap point, for the three dimensions
00997     UpdateSnapPointsIgnoredValue(&m_sortedConsolidatedHorizontalSnapPoints, ScrollPresenterDimension::HorizontalScroll);
00998     UpdateSnapPointsIgnoredValue(&m_sortedConsolidatedVerticalSnapPoints, ScrollPresenterDimension::VerticalScroll);
00999     UpdateSnapPointsIgnoredValue(&m_sortedConsolidatedZoomSnapPoints, ScrollPresenterDimension::ZoomFactor);
01000
01001     // Stop Translation and Scale animations if needed, to trigger rasterization of Content & avoid fuzzy text rendering for instance.
01002     StopTranslationAndZoomFactorExpressionAnimations();
01003 }
01004
01005 void ScrollPresenter::InertiaStateEntered(
01006     const winrt::InteractionTrackerInertiaStateEnteredArgs& args)
01007 {
01008     winrt::IReference<winrt::float3> modifiedRestingPosition = args.ModifiedRestingPosition();
01009     const winrt::float3 naturalRestingPosition = args.NaturalRestingPosition();
01010     winrt::IReference<float> modifiedRestingScale = args.ModifiedRestingScale();
01011     const float naturalRestingScale = args.NaturalRestingScale();
01012     const bool isTracingEnabled = IsScrollPresenterTracingEnabled() || ScrollPresenterTrace::s_IsDebugOutputEnabled || ScrollPresenterTrace::s_IsVerboseDebugOutputEnabled;
01013     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation = GetInteractionTrackerOperationFromRequestId(args.RequestId());
01014
01015     if (isTracingEnabled)
01016     {
01017         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_PTR_INT, METH_NAME, this, interactionTrackerAsyncOperation.get(), args.RequestId());
01018
01019         const winrt::float3 positionVelocity = args.PositionVelocityInPixelsPerSecond();
01020         const float scaleVelocity = args.ScaleVelocityInPercentPerSecond();
01021
01022         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
01023             TypeLogging::Float2ToString(winrt::float2{ positionVelocity.x, positionVelocity.y }).c_str(),
01024             scaleVelocity);
01025
01026         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
01027             TypeLogging::Float2ToString(winrt::float2{ naturalRestingPosition.x, naturalRestingPosition.y }).c_str(),
01028             naturalRestingScale);
01029
01030         if (modifiedRestingPosition)
01031         {
01032             const winrt::float3 endOfInertiaPosition = modifiedRestingPosition.Value();
01033             SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR, METH_NAME, this,
01034                 TypeLogging::Float2ToString(winrt::float2{ endOfInertiaPosition.x, endOfInertiaPosition.y }).c_str());
01035         }
01036
01037         if (modifiedRestingScale)
01038         {
01039             SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_FLT, METH_NAME, this,
01040                 modifiedRestingScale.Value());
01041         }
01042
01043         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, args.IsInertiaFromImpulse());
01044         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, args.IsFromBinding());
01045     }
01046
01047     // Record the end-of-inertia view for this inertial phase. It may be needed for
01048     // custom pointer wheel processing.
01049
01050     if (modifiedRestingPosition)
01051     {
01052         const winrt::float3 endOfInertiaPosition = modifiedRestingPosition.Value();
01053         m_endOfInertiaPosition = { endOfInertiaPosition.x, endOfInertiaPosition.y };
01054     }
01055     else
01056     {
01057         m_endOfInertiaPosition = { naturalRestingPosition.x, naturalRestingPosition.y };
01058     }
01059
01060     if (modifiedRestingScale)
01061     {
01062         m_endOfInertiaZoomFactor = modifiedRestingScale.Value();
01063     }
01064     else
01065     {
01066         m_endOfInertiaZoomFactor = naturalRestingScale;
01067     }
01068
01069     if (isTracingEnabled)
01070     {
01071         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
01072             TypeLogging::Float2ToString(m_endOfInertiaPosition).c_str(),
01073             m_endOfInertiaZoomFactor);
01074     }
01075
01076     if (interactionTrackerAsyncOperation)
01077     {
01078         std::shared_ptr<ViewChangeBase> viewChangeBase = interactionTrackerAsyncOperation->GetViewChangeBase();
01079
01080         if (viewChangeBase && interactionTrackerAsyncOperation->GetOperationType() == InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity)
01081         {
01082             std::shared_ptr<OffsetsChangeWithAdditionalVelocity> offsetsChangeWithAdditionalVelocity = std::reinterpret_pointer_cast<OffsetsChangeWithAdditionalVelocity>(viewChangeBase);
01083
01084             if (offsetsChangeWithAdditionalVelocity)
01085             {
01086                 offsetsChangeWithAdditionalVelocity->AnticipatedOffsetsChange(winrt::float2::zero());
01087             }
01088         }
01089     }
01090
01091     UpdateState(winrt::ScrollingInteractionState::Inertia);
01092 }
01093
01094 void ScrollPresenter::InteractingStateEntered(
01095     const winrt::InteractionTrackerInteractingStateEnteredArgs& args)
01096 {
01097     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, args.RequestId());
01098
01099     if (m_state == winrt::ScrollingInteractionState::Inertia)
01100     {
01101         // Restore the default 0.95 position inertia decay rate since it may have been overridden by an offset change with additional velocity.
01102         ResetOffsetsInertiaDecayRate();
01103
01104         // Restore the default 0.985 zoomFactor inertia decay rate since it may have been overridden by a zoomFactor change with additional velocity.
01105         ResetZoomFactorInertiaDecayRate();
01106     }
01107
01108     UpdateState(winrt::ScrollingInteractionState::Interaction);
01109
01110     if (!m_interactionTrackerAsyncOperations.empty())
01111     {
01112         // Complete all operations recorded through ChangeOffsetsPrivate/ChangeOffsetsWithAdditionalVelocityPrivate
01113         // and ChangeZoomFactorPrivate/ChangeZoomFactorWithAdditionalVelocityPrivate calls.
01114         CompleteInteractionTrackerOperations(
01115             -1 /*requestId*/,
01116             ScrollPresenterViewChangeResult::Interrupted /*operationResult*/,
01117             ScrollPresenterViewChangeResult::Completed   /*priorNonAnimatedOperationsResult*/,
01118             ScrollPresenterViewChangeResult::Interrupted /*priorAnimatedOperationsResult*/,
01119             true  /*completeNonAnimatedOperation*/,
01120             true  /*completeAnimatedOperation*/,
01121             true  /*completePriorNonAnimatedOperations*/,
01122             true  /*completePriorAnimatedOperations*/);
01123     }
01124 }
01125
01126 void ScrollPresenter::RequestIgnored(
01127     const winrt::InteractionTrackerRequestIgnoredArgs& args)
01128 {
01129     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, args.RequestId());
01130
01131     if (!m_interactionTrackerAsyncOperations.empty())
01132     {
01133         // Complete this request alone.
01134         CompleteInteractionTrackerOperations(
01135             args.RequestId(),
01136             ScrollPresenterViewChangeResult::Ignored /*operationResult*/,
01137             ScrollPresenterViewChangeResult::Ignored /*unused priorNonAnimatedOperationsResult*/,
01138             ScrollPresenterViewChangeResult::Ignored /*unused priorAnimatedOperationsResult*/,
01139             true  /*completeNonAnimatedOperation*/,
01140             true  /*completeAnimatedOperation*/,
01141             false /*completePriorNonAnimatedOperations*/,
01142             false /*completePriorAnimatedOperations*/);
01143     }
01144 }
01145
01146 void ScrollPresenter::ValuesChanged(
01147     const winrt::InteractionTrackerValuesChangedArgs& args)
01148 {
01149     const bool isScrollPresenterTracingEnabled = IsScrollPresenterTracingEnabled();
01150
01151 #ifdef DBG
01152     if (isScrollPresenterTracingEnabled || ScrollPresenterTrace::s_IsDebugOutputEnabled || ScrollPresenterTrace::s_IsVerboseDebugOutputEnabled)
01153     {
01154         SCROLLPRESENTER_TRACE_INFO_ENABLED(isScrollPresenterTracingEnabled /*includeTraceLogging*/, *this, L"%s[0x%p](RequestId: %d, View: %f, %f, %f)\n",
01155             METH_NAME, this, args.RequestId(), args.Position().x, args.Position().y, args.Scale());
01156     }
01157 #endif
01158
01159     const int requestId = args.RequestId();
01160
01161     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation = GetInteractionTrackerOperationFromRequestId(requestId);
01162
01163     const bool isRightToLeftDirection = FlowDirection() == winrt::FlowDirection::RightToLeft;
01164     const double oldZoomedHorizontalOffset = m_zoomedHorizontalOffset;
01165     const double oldZoomedVerticalOffset = m_zoomedVerticalOffset;
01166     const float oldZoomFactor = m_zoomFactor;
01167     winrt::float2 minPosition{};
01168     winrt::float2 maxPosition{};
01169
01170     m_zoomFactor = args.Scale();
01171
01172     ComputeMinMaxPositions(m_zoomFactor, &minPosition, isRightToLeftDirection ? &maxPosition : nullptr);
01173
01174     if (isRightToLeftDirection)
01175     {
01176         UpdateOffset(ScrollPresenterDimension::HorizontalScroll, static_cast<double>(maxPosition.x) - args.Position().x);
01177     }
01178     else
01179     {
01180         UpdateOffset(ScrollPresenterDimension::HorizontalScroll, static_cast<double>(args.Position().x) - minPosition.x);
01181     }
01182
01183     UpdateOffset(ScrollPresenterDimension::VerticalScroll, static_cast<double>(args.Position().y) - minPosition.y);
01184
01185     if (oldZoomFactor != m_zoomFactor || oldZoomedHorizontalOffset != m_zoomedHorizontalOffset || oldZoomedVerticalOffset != m_zoomedVerticalOffset)
01186     {
01187         OnViewChanged(oldZoomedHorizontalOffset != m_zoomedHorizontalOffset /*horizontalOffsetChanged*/,
01188                       oldZoomedVerticalOffset != m_zoomedVerticalOffset /*verticalOffsetChanged*/);
01189     }
01190
01191     TraceLoggingProviderWrite(
01192         XamlTelemetryLogging, "ScrollPresenter_ValuesChanged",
01193         TraceLoggingFloat64(m_zoomedHorizontalOffset, "HorizontalOffset"),
01194         TraceLoggingFloat64(m_zoomedVerticalOffset, "VerticalOffset"),
01195         TraceLoggingFloat32(m_zoomFactor, "ZoomFactor"),
01196         TraceLoggingFloat64(oldZoomedHorizontalOffset, "OldHorizontalOffset"),
01197         TraceLoggingFloat64(oldZoomedVerticalOffset, "OldVerticalOffset"),
01198         TraceLoggingFloat32(oldZoomFactor, "OldZoomFactor"),
01199         TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
01200
01201     if (requestId != 0 && !m_interactionTrackerAsyncOperations.empty())
01202     {
01203         CompleteInteractionTrackerOperations(
01204             requestId,
01205             ScrollPresenterViewChangeResult::Completed   /*operationResult*/,
01206             ScrollPresenterViewChangeResult::Completed   /*priorNonAnimatedOperationsResult*/,
01207             ScrollPresenterViewChangeResult::Interrupted /*priorAnimatedOperationsResult*/,
01208             true  /*completeNonAnimatedOperation*/,
01209             false /*completeAnimatedOperation*/,
01210             true  /*completePriorNonAnimatedOperations*/,
01211             true  /*completePriorAnimatedOperations*/);
01212     }
01213 }
01214
01215 #pragma endregion
01216
01217 // Returns the size used to arrange the provided ScrollPresenter content.
01218 winrt::Size ScrollPresenter::ArrangeContent(
01219     const winrt::UIElement& content,
01220     const winrt::Thickness& contentMargin,
01221     winrt::Rect& finalContentRect,
01222     bool wasContentArrangeWidthStretched,
01223     bool wasContentArrangeHeightStretched)
01224 {
01225     MUX_ASSERT(content);
01226
01227     winrt::Size contentArrangeSize =
01228     {
01229         finalContentRect.Width,
01230         finalContentRect.Height
01231     };
01232
01233     content.Arrange(finalContentRect);
01234
01235     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"content Arrange", TypeLogging::RectToString(finalContentRect).c_str());
01236     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"wasContentArrangeWidthStretched", wasContentArrangeWidthStretched);
01237     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"wasContentArrangeHeightStretched", wasContentArrangeHeightStretched);
01238     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"content RenderSize", content.RenderSize().Width, content.RenderSize().Height);
01239
01240     if (wasContentArrangeWidthStretched || wasContentArrangeHeightStretched)
01241     {
01242         bool reArrangeNeeded = false;
01243         const auto renderWidth = content.RenderSize().Width;
01244         const auto renderHeight = content.RenderSize().Height;
01245         const auto marginWidth = static_cast<float>(contentMargin.Left + contentMargin.Right);
01246         const auto marginHeight = static_cast<float>(contentMargin.Top + contentMargin.Bottom);
01247         const auto scaleFactorRounding = 0.5f / static_cast<float>(XamlRoot().RasterizationScale());
01248
01249         if (wasContentArrangeWidthStretched &&
01250             renderWidth > 0.0f &&
01251             renderWidth + marginWidth < finalContentRect.Width * (1.0f - std::numeric_limits<float>::epsilon()) - scaleFactorRounding)
01252         {
01253             // Content stretched partially horizontally.
01254             contentArrangeSize.Width = finalContentRect.Width = renderWidth + marginWidth;
01255             reArrangeNeeded = true;
01256         }
01257
01258         if (wasContentArrangeHeightStretched &&
01259             renderHeight > 0.0f &&
01260             renderHeight + marginHeight < finalContentRect.Height * (1.0f - std::numeric_limits<float>::epsilon()) - scaleFactorRounding)
01261         {
01262             // Content stretched partially vertically.
01263             contentArrangeSize.Height = finalContentRect.Height = renderHeight + marginHeight;
01264             reArrangeNeeded = true;
01265         }
01266
01267         if (reArrangeNeeded)
01268         {
01269             // Re-arrange the content using the partially stretched size.
01270             SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"content re-Arrange", TypeLogging::RectToString(finalContentRect).c_str());
01271
01272             content.Arrange(finalContentRect);
01273         }
01274     }
01275
01276     return contentArrangeSize;
01277 }
01278
01279 // Used to perform a flickerless change to the Content's XAML Layout Offset. The InteractionTracker's Position is unaffected, but its Min/MaxPosition expressions
01280 // and the ScrollPresenter HorizontalOffset/VerticalOffset property are updated accordingly once the change is incorporated into the XAML layout engine.
01281 float ScrollPresenter::ComputeContentLayoutOffsetDelta(ScrollPresenterDimension dimension, float unzoomedDelta) const
01282 {
01283     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
01284
01285     float zoomedDelta = unzoomedDelta * m_zoomFactor;
01286
01287     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, dimension == ScrollPresenterDimension::HorizontalScroll ? L"HorizontalScroll" : L"VerticalScroll");
01288     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"zoomedDelta", zoomedDelta);
01289
01290     if (dimension == ScrollPresenterDimension::HorizontalScroll)
01291     {
01292         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"m_zoomedHorizontalOffset", m_zoomedHorizontalOffset);
01293
01294         if (zoomedDelta < 0.0f && -zoomedDelta > m_zoomedHorizontalOffset)
01295         {
01296             // Do not let m_zoomedHorizontalOffset step into negative territory.
01297             zoomedDelta = static_cast<float>(-m_zoomedHorizontalOffset);
01298         }
01299     }
01300     else
01301     {
01302         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"m_zoomedVerticalOffset", m_zoomedVerticalOffset);
01303
01304         if (zoomedDelta < 0.0f && -zoomedDelta > m_zoomedVerticalOffset)
01305         {
01306             // Do not let m_zoomedVerticalOffset step into negative territory.
01307             zoomedDelta = static_cast<float>(-m_zoomedVerticalOffset);
01308         }
01309     }
01310
01311     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"returned value", -zoomedDelta);
01312
01313     return -zoomedDelta;
01314 }
01315
01316 float ScrollPresenter::ComputeEndOfInertiaZoomFactor() const
01317 {
01318     if (m_state == winrt::ScrollingInteractionState::Inertia)
01319     {
01320         return std::clamp(m_endOfInertiaZoomFactor, m_interactionTracker.MinScale(), m_interactionTracker.MaxScale());
01321     }
01322     else
01323     {
01324         return m_zoomFactor;
01325     }
01326 }
01327
01328 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
01329 winrt::float2 ScrollPresenter::ComputeEndOfInertiaPosition()
01330 {
01331     if (m_state == winrt::ScrollingInteractionState::Inertia)
01332     {
01333         const float endOfInertiaZoomFactor = ComputeEndOfInertiaZoomFactor();
01334         winrt::float2 minPosition{};
01335         winrt::float2 maxPosition{};
01336         winrt::float2 endOfInertiaPosition = m_endOfInertiaPosition;
01337
01338         ComputeMinMaxPositions(endOfInertiaZoomFactor, &minPosition, &maxPosition);
01339
01340         endOfInertiaPosition = max(endOfInertiaPosition, minPosition);
01341         endOfInertiaPosition = min(endOfInertiaPosition, maxPosition);
01342
01343         return endOfInertiaPosition;
01344     }
01345     else
01346     {
01347         return ComputePositionFromOffsets(m_zoomedHorizontalOffset, m_zoomedVerticalOffset);
01348     }
01349 }
01350 #endif // ScrollPresenterViewKind_RelativeToEndOfInertiaView
01351
01352 // Returns zoomed vectors corresponding to InteractionTracker.MinPosition and InteractionTracker.MaxPosition
01353 // Determines the min and max positions of the ScrollPresenter.Content based on its size and alignment, and the ScrollPresenter size.
01354 void ScrollPresenter::ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* minPosition, _Out_opt_ winrt::float2* maxPosition)
01355 {
01356     MUX_ASSERT(minPosition || maxPosition);
01357
01358     if (minPosition)
01359     {
01360         *minPosition = winrt::float2::zero();
01361     }
01362
01363     if (maxPosition)
01364     {
01365         *maxPosition = winrt::float2::zero();
01366     }
01367
01368     const winrt::UIElement content = Content();
01369
01370     if (!content)
01371     {
01372         return;
01373     }
01374
01375     const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
01376
01377     if (!contentAsFE)
01378     {
01379         return;
01380     }
01381
01382     const bool isRightToLeftDirection = FlowDirection() == winrt::FlowDirection::RightToLeft;
01383     const winrt::Visual scrollPresenterVisual = winrt::ElementCompositionPreview::GetElementVisual(*this);
01384     float minPosX = 0.0f;
01385     float minPosY = 0.0f;
01386     float maxPosX = 0.0f;
01387     float maxPosY = 0.0f;
01388     const float extentWidth = static_cast<float>(m_unzoomedExtentWidth);
01389     const float extentHeight = static_cast<float>(m_unzoomedExtentHeight);
01390
01391     if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center ||
01392         contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch)
01393     {
01394         const float scrollableWidth = extentWidth * zoomFactor - scrollPresenterVisual.Size().x;
01395
01396         if (minPosition || (isRightToLeftDirection && maxPosition))
01397         {
01398             // When the zoomed content is smaller than the viewport, scrollableWidth < 0, minPosX is scrollableWidth / 2 so it is centered at idle.
01399             // When the zoomed content is larger than the viewport, scrollableWidth > 0, minPosX is 0.
01400             minPosX = std::min(0.0f, scrollableWidth / 2.0f);
01401         }
01402
01403         if (maxPosition || (isRightToLeftDirection && minPosition))
01404         {
01405             // When the zoomed content is smaller than the viewport, scrollableWidth < 0, maxPosX is scrollableWidth / 2 so it is centered at idle.
01406             // When the zoomed content is larger than the viewport, scrollableWidth > 0, maxPosX is scrollableWidth.
01407             maxPosX = scrollableWidth;
01408             if (maxPosX < 0.0f)
01409             {
01410                 maxPosX /= 2.0f;
01411             }
01412         }
01413     }
01414     else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right)
01415     {
01416         const float scrollableWidth = extentWidth * zoomFactor - scrollPresenterVisual.Size().x;
01417
01418         if (minPosition || (isRightToLeftDirection && maxPosition))
01419         {
01420             // When the zoomed content is smaller than the viewport, scrollableWidth < 0, minPosX is scrollableWidth so it is right-aligned at idle.
01421             // When the zoomed content is larger than the viewport, scrollableWidth > 0, minPosX is 0.
01422             minPosX = std::min(0.0f, scrollableWidth);
01423         }
01424
01425         if (maxPosition || (isRightToLeftDirection && minPosition))
01426         {
01427             // When the zoomed content is smaller than the viewport, scrollableWidth < 0, maxPosX is -scrollableWidth so it is right-aligned at idle.
01428             // When the zoomed content is larger than the viewport, scrollableWidth > 0, maxPosX is scrollableWidth.
01429             maxPosX = scrollableWidth;
01430             if (maxPosX < 0.0f)
01431             {
01432                 maxPosX *= -1.0f;
01433             }
01434         }
01435     }
01436
01437     if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center ||
01438         contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch)
01439     {
01440         const float scrollableHeight = extentHeight * zoomFactor - scrollPresenterVisual.Size().y;
01441
01442         if (minPosition || (isRightToLeftDirection && maxPosition))
01443         {
01444             // When the zoomed content is smaller than the viewport, scrollableHeight < 0, minPosY is scrollableHeight / 2 so it is centered at idle.
01445             // When the zoomed content is larger than the viewport, scrollableHeight > 0, minPosY is 0.
01446             minPosY = std::min(0.0f, scrollableHeight / 2.0f);
01447         }
01448
01449         if (maxPosition || (isRightToLeftDirection && minPosition))
01450         {
01451             // When the zoomed content is smaller than the viewport, scrollableHeight < 0, maxPosY is scrollableHeight / 2 so it is centered at idle.
01452             // When the zoomed content is larger than the viewport, scrollableHeight > 0, maxPosY is scrollableHeight.
01453             maxPosY = scrollableHeight;
01454             if (maxPosY < 0.0f)
01455             {
01456                 maxPosY /= 2.0f;
01457             }
01458         }
01459     }
01460     else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom)
01461     {
01462         const float scrollableHeight = extentHeight * zoomFactor - scrollPresenterVisual.Size().y;
01463
01464         if (minPosition || (isRightToLeftDirection && maxPosition))
01465         {
01466             // When the zoomed content is smaller than the viewport, scrollableHeight < 0, minPosY is scrollableHeight so it is bottom-aligned at idle.
01467             // When the zoomed content is larger than the viewport, scrollableHeight > 0, minPosY is 0.
01468             minPosY = std::min(0.0f, scrollableHeight);
01469         }
01470
01471         if (maxPosition || (isRightToLeftDirection && minPosition))
01472         {
01473             // When the zoomed content is smaller than the viewport, scrollableHeight < 0, maxPosY is -scrollableHeight so it is bottom-aligned at idle.
01474             // When the zoomed content is larger than the viewport, scrollableHeight > 0, maxPosY is scrollableHeight.
01475             maxPosY = scrollableHeight;
01476             if (maxPosY < 0.0f)
01477             {
01478                 maxPosY *= -1.0f;
01479             }
01480         }
01481     }
01482
01483     if (minPosition)
01484     {
01485         if (isRightToLeftDirection)
01486         {
01487             *minPosition = winrt::float2(-maxPosX - m_contentLayoutOffsetX, minPosY + m_contentLayoutOffsetY);
01488         }
01489         else
01490         {
01491             *minPosition = winrt::float2(minPosX + m_contentLayoutOffsetX, minPosY + m_contentLayoutOffsetY);
01492         }
01493
01494 #ifdef DBG
01495         // Allow ScrollPresenterTestHooks to override the returned value.
01496         if (!isnan(m_minPositionOverrideDbg.x) && !isnan(m_minPositionOverrideDbg.y))
01497         {
01498             *minPosition = m_minPositionOverrideDbg;
01499         }
01500 #endif // DBG
01501     }
01502
01503     if (maxPosition)
01504     {
01505         if (isRightToLeftDirection)
01506         {
01507             *maxPosition = winrt::float2(-minPosX - m_contentLayoutOffsetX, maxPosY + m_contentLayoutOffsetY);
01508         }
01509         else
01510         {
01511             *maxPosition = winrt::float2(maxPosX + m_contentLayoutOffsetX, maxPosY + m_contentLayoutOffsetY);
01512         }
01513
01514 #ifdef DBG
01515         // Allow ScrollPresenterTestHooks to override the returned value.
01516         if (!isnan(m_maxPositionOverrideDbg.x) && !isnan(m_maxPositionOverrideDbg.y))
01517         {
01518             *maxPosition = m_maxPositionOverrideDbg;
01519         }
01520 #endif // DBG
01521     }
01522 }
01523
01524 // Returns an InteractionTracker Position based on the provided offsets
01525 winrt::float2 ScrollPresenter::ComputePositionFromOffsets(double zoomedHorizontalOffset, double zoomedVerticalOffset)
01526 {
01527     const bool isRightToLeftDirection = FlowDirection() == winrt::FlowDirection::RightToLeft;
01528     winrt::float2 minPosition{};
01529     winrt::float2 maxPosition{};
01530
01531     ComputeMinMaxPositions(m_zoomFactor, &minPosition, isRightToLeftDirection ? &maxPosition : nullptr);
01532
01533     if (isRightToLeftDirection)
01534     {
01535         return winrt::float2(static_cast<float>(maxPosition.x - zoomedHorizontalOffset), static_cast<float>(zoomedVerticalOffset + minPosition.y));
01536     }
01537     else
01538     {
01539         return winrt::float2(static_cast<float>(zoomedHorizontalOffset + minPosition.x), static_cast<float>(zoomedVerticalOffset + minPosition.y));
01540     }
01541 }
01542
01543 // Evaluate what the value will be once the snap points have been applied.
01544 template <typename T>
01545 double ScrollPresenter::ComputeValueAfterSnapPoints(
01546     double value,
01547     std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>> const& snapPointsSet)
01548 {
01549     for (std::shared_ptr<SnapPointWrapper<T>> snapPointWrapper : snapPointsSet)
01550     {
01551         if (std::get<0>(snapPointWrapper->ActualApplicableZone()) <= value &&
01552             std::get<1>(snapPointWrapper->ActualApplicableZone()) >= value)
01553         {
01554             return snapPointWrapper->Evaluate(static_cast<float>(value));
01555         }
01556     }
01557     return value;
01558 }
01559
01560 // Called by ScrollPresenter::OnBringIntoViewRequestedHandler to compute the target bring-into-view offsets
01561 // based on the provided BringIntoViewRequestedEventArgs instance.
01562 // The resulting offsets are later updated by ScrollPresenter::ComputeBringIntoViewUpdatedTargetOffsets below.
01563 void ScrollPresenter::ComputeBringIntoViewTargetOffsetsFromRequestEventArgs(
01564     const winrt::UIElement& content,
01565     const winrt::ScrollingSnapPointsMode& snapPointsMode,
01566     const winrt::BringIntoViewRequestedEventArgs& requestEventArgs,
01567     _Out_ double* targetZoomedHorizontalOffset,
01568     _Out_ double* targetZoomedVerticalOffset,
01569     _Out_ double* appliedOffsetX,
01570     _Out_ double* appliedOffsetY,
01571     _Out_ winrt::Rect* targetRect)
01572 {
01573     SCROLLPRESENTER_TRACE_INFO_DBG(*this, L"%s[0x%p](H/V AlignmentRatio:%lf,%lf, H/V Offset:%f,%f, ElementRect:%s, Element:0x%p)\n",
01574         METH_NAME, this,
01575         requestEventArgs.HorizontalAlignmentRatio(), requestEventArgs.VerticalAlignmentRatio(),
01576         requestEventArgs.HorizontalOffset(), requestEventArgs.VerticalOffset(),
01577         TypeLogging::RectToString(requestEventArgs.TargetRect()).c_str(), requestEventArgs.TargetElement());
01578
01579     ComputeBringIntoViewTargetOffsets(
01580         content,
01581         requestEventArgs.TargetElement(),
01582         requestEventArgs.TargetRect(),
01583         snapPointsMode,
01584         requestEventArgs.HorizontalAlignmentRatio(),
01585         requestEventArgs.VerticalAlignmentRatio(),
01586         requestEventArgs.HorizontalOffset(),
01587         requestEventArgs.VerticalOffset(),
01588         targetZoomedHorizontalOffset,
01589         targetZoomedVerticalOffset,
01590         appliedOffsetX,
01591         appliedOffsetY,
01592         targetRect);
01593 }
01594
01595 // Called by ScrollPresenter::ProcessOffsetsChange to potentially update the target bring-into-view offsets
01596 // just before invoking the InteractionTracker's TryUpdatePosition.
01597 void ScrollPresenter::ComputeBringIntoViewUpdatedTargetOffsets(
01598     const winrt::UIElement& content,
01599     const winrt::UIElement& element,
01600     const winrt::Rect& elementRect,
01601     const winrt::ScrollingSnapPointsMode& snapPointsMode,
01602     double horizontalAlignmentRatio,
01603     double verticalAlignmentRatio,
01604     double horizontalOffset,
01605     double verticalOffset,
01606     _Out_ double* targetZoomedHorizontalOffset,
01607     _Out_ double* targetZoomedVerticalOffset)
01608 {
01609     SCROLLPRESENTER_TRACE_INFO_DBG(*this, L"%s[0x%p](H/V AlignmentRatio:%lf,%lf, H/V Offset:%f,%f, ElementRect:%s, Element:0x%p)\n",
01610         METH_NAME, this,
01611         horizontalAlignmentRatio, verticalAlignmentRatio,
01612         horizontalOffset, verticalOffset,
01613         TypeLogging::RectToString(elementRect).c_str(), element);
01614
01615     ComputeBringIntoViewTargetOffsets(
01616         content,
01617         element,
01618         elementRect,
01619         snapPointsMode,
01620         horizontalAlignmentRatio,
01621         verticalAlignmentRatio,
01622         horizontalOffset,
01623         verticalOffset,
01624         targetZoomedHorizontalOffset,
01625         targetZoomedVerticalOffset,
01626         nullptr /*appliedOffsetX*/,
01627         nullptr /*appliedOffsetY*/,
01628         nullptr /*targetRect*/);
01629 }
01630
01631 void ScrollPresenter::ComputeBringIntoViewTargetOffsets(
01632     const winrt::UIElement& content,
01633     const winrt::UIElement& element,
01634     const winrt::Rect& elementRect,
01635     const winrt::ScrollingSnapPointsMode& snapPointsMode,
01636     double horizontalAlignmentRatio,
01637     double verticalAlignmentRatio,
01638     double horizontalOffset,
01639     double verticalOffset,
01640     _Out_ double* targetZoomedHorizontalOffset,
01641     _Out_ double* targetZoomedVerticalOffset,
01642     _Out_opt_ double* appliedOffsetX,
01643     _Out_opt_ double* appliedOffsetY,
01644     _Out_opt_ winrt::Rect* targetRect)
01645 {
01646     MUX_ASSERT(content);
01647     MUX_ASSERT(element);
01648
01649     *targetZoomedHorizontalOffset = 0.0;
01650     *targetZoomedVerticalOffset = 0.0;
01651
01652     if (appliedOffsetX)
01653     {
01654         *appliedOffsetX = 0.0;
01655     }
01656
01657     if (appliedOffsetY)
01658     {
01659         *appliedOffsetY = 0.0;
01660     }
01661
01662     if (targetRect)
01663     {
01664         *targetRect = {};
01665     }
01666
01667     const winrt::Rect transformedRect = GetDescendantBounds(content, element, elementRect);
01668
01669     double targetX = transformedRect.X;
01670     double targetWidth = transformedRect.Width;
01671     double targetY = transformedRect.Y;
01672     double targetHeight = transformedRect.Height;
01673
01674     if (!isnan(horizontalAlignmentRatio))
01675     {
01676         // Account for the horizontal alignment ratio
01677         MUX_ASSERT(horizontalAlignmentRatio >= 0.0 && horizontalAlignmentRatio <= 1.0);
01678
01679         targetX += (targetWidth - m_viewportWidth / m_zoomFactor) * horizontalAlignmentRatio;
01680         targetWidth = m_viewportWidth / m_zoomFactor;
01681     }
01682
01683     if (!isnan(verticalAlignmentRatio))
01684     {
01685         // Account for the vertical alignment ratio
01686         MUX_ASSERT(verticalAlignmentRatio >= 0.0 && verticalAlignmentRatio <= 1.0);
01687
01688         targetY += (targetHeight - m_viewportHeight / m_zoomFactor) * verticalAlignmentRatio;
01689         targetHeight = m_viewportHeight / m_zoomFactor;
01690     }
01691
01692     double targetZoomedHorizontalOffsetTmp = ComputeZoomedOffsetWithMinimalChange(
01693         m_zoomedHorizontalOffset,
01694         m_zoomedHorizontalOffset + m_viewportWidth,
01695         targetX * m_zoomFactor,
01696         (targetX + targetWidth) * m_zoomFactor);
01697     double targetZoomedVerticalOffsetTmp = ComputeZoomedOffsetWithMinimalChange(
01698         m_zoomedVerticalOffset,
01699         m_zoomedVerticalOffset + m_viewportHeight,
01700         targetY * m_zoomFactor,
01701         (targetY + targetHeight) * m_zoomFactor);
01702
01703     const double scrollableWidth = ScrollableWidth();
01704     const double scrollableHeight = ScrollableHeight();
01705
01706     targetZoomedHorizontalOffsetTmp = std::clamp(targetZoomedHorizontalOffsetTmp, 0.0, scrollableWidth);
01707     targetZoomedVerticalOffsetTmp = std::clamp(targetZoomedVerticalOffsetTmp, 0.0, scrollableHeight);
01708
01709     const double offsetX = horizontalOffset;
01710     const double offsetY = verticalOffset;
01711     double appliedOffsetXTmp = 0.0;
01712     double appliedOffsetYTmp = 0.0;
01713
01714     // If the target offset is within bounds and an offset was provided, apply as much of it as possible while remaining within bounds.
01715     if (offsetX != 0.0 && targetZoomedHorizontalOffsetTmp >= 0.0)
01716     {
01717         if (targetZoomedHorizontalOffsetTmp <= scrollableWidth)
01718         {
01719             if (offsetX > 0.0)
01720             {
01721                 appliedOffsetXTmp = std::min(targetZoomedHorizontalOffsetTmp, offsetX);
01722             }
01723             else
01724             {
01725                 appliedOffsetXTmp = -std::min(scrollableWidth - targetZoomedHorizontalOffsetTmp, -offsetX);
01726             }
01727             targetZoomedHorizontalOffsetTmp -= appliedOffsetXTmp;
01728         }
01729     }
01730
01731     if (offsetY != 0.0 && targetZoomedVerticalOffsetTmp >= 0.0)
01732     {
01733         if (targetZoomedVerticalOffsetTmp <= scrollableHeight)
01734         {
01735             if (offsetY > 0.0)
01736             {
01737                 appliedOffsetYTmp = std::min(targetZoomedVerticalOffsetTmp, offsetY);
01738             }
01739             else
01740             {
01741                 appliedOffsetYTmp = -std::min(scrollableHeight - targetZoomedVerticalOffsetTmp, -offsetY);
01742             }
01743             targetZoomedVerticalOffsetTmp -= appliedOffsetYTmp;
01744         }
01745     }
01746
01747     MUX_ASSERT(targetZoomedHorizontalOffsetTmp >= 0.0);
01748     MUX_ASSERT(targetZoomedVerticalOffsetTmp >= 0.0);
01749     MUX_ASSERT(targetZoomedHorizontalOffsetTmp <= scrollableWidth);
01750     MUX_ASSERT(targetZoomedVerticalOffsetTmp <= scrollableHeight);
01751
01752     if (snapPointsMode == winrt::ScrollingSnapPointsMode::Default)
01753     {
01754         // Finally adjust the target offsets based on snap points
01755         targetZoomedHorizontalOffsetTmp = ComputeValueAfterSnapPoints<winrt::ScrollSnapPointBase>(
01756             targetZoomedHorizontalOffsetTmp, m_sortedConsolidatedHorizontalSnapPoints);
01757         targetZoomedVerticalOffsetTmp = ComputeValueAfterSnapPoints<winrt::ScrollSnapPointBase>(
01758             targetZoomedVerticalOffsetTmp, m_sortedConsolidatedVerticalSnapPoints);
01759
01760         // Make sure the target offsets are within the scrollable boundaries
01761         targetZoomedHorizontalOffsetTmp = std::clamp(targetZoomedHorizontalOffsetTmp, 0.0, scrollableWidth);
01762         targetZoomedVerticalOffsetTmp = std::clamp(targetZoomedVerticalOffsetTmp, 0.0, scrollableHeight);
01763
01764         MUX_ASSERT(targetZoomedHorizontalOffsetTmp >= 0.0);
01765         MUX_ASSERT(targetZoomedVerticalOffsetTmp >= 0.0);
01766         MUX_ASSERT(targetZoomedHorizontalOffsetTmp <= scrollableWidth);
01767         MUX_ASSERT(targetZoomedVerticalOffsetTmp <= scrollableHeight);
01768     }
01769
01770     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"targetZoomedHorizontalOffset", targetZoomedHorizontalOffsetTmp);
01771     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"targetZoomedVerticalOffset", targetZoomedVerticalOffsetTmp);
01772
01773     *targetZoomedHorizontalOffset = targetZoomedHorizontalOffsetTmp;
01774     *targetZoomedVerticalOffset = targetZoomedVerticalOffsetTmp;
01775
01776     if (appliedOffsetX)
01777     {
01778         *appliedOffsetX = appliedOffsetXTmp;
01779     }
01780
01781     if (appliedOffsetY)
01782     {
01783         *appliedOffsetY = appliedOffsetYTmp;
01784     }
01785
01786     if (targetRect)
01787     {
01788         *targetRect = {
01789             static_cast<float>(targetX),
01790             static_cast<float>(targetY),
01791             static_cast<float>(targetWidth),
01792             static_cast<float>(targetHeight)
01793         };
01794     }
01795 }
01796
01797 void ScrollPresenter::EnsureExpressionAnimationSources()
01798 {
01799     if (!m_expressionAnimationSources)
01800     {
01801         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01802
01803         const winrt::Compositor compositor = winrt::ElementCompositionPreview::GetElementVisual(*this).Compositor();
01804
01805         m_expressionAnimationSources = compositor.CreatePropertySet();
01806         m_expressionAnimationSources.InsertVector2(s_extentSourcePropertyName, { 0.0f, 0.0f });
01807         m_expressionAnimationSources.InsertVector2(s_viewportSourcePropertyName, { 0.0f, 0.0f });
01808         m_expressionAnimationSources.InsertVector2(s_offsetSourcePropertyName, { m_contentLayoutOffsetX, m_contentLayoutOffsetY });
01809         m_expressionAnimationSources.InsertVector2(s_positionSourcePropertyName, { 0.0f, 0.0f });
01810         m_expressionAnimationSources.InsertVector2(s_minPositionSourcePropertyName, { 0.0f, 0.0f });
01811         m_expressionAnimationSources.InsertVector2(s_maxPositionSourcePropertyName, { 0.0f, 0.0f });
01812         m_expressionAnimationSources.InsertScalar(s_zoomFactorSourcePropertyName, 0.0f);
01813
01814         MUX_ASSERT(m_interactionTracker);
01815         MUX_ASSERT(!m_positionSourceExpressionAnimation);
01816         MUX_ASSERT(!m_minPositionSourceExpressionAnimation);
01817         MUX_ASSERT(!m_maxPositionSourceExpressionAnimation);
01818         MUX_ASSERT(!m_zoomFactorSourceExpressionAnimation);
01819
01820         m_positionSourceExpressionAnimation = compositor.CreateExpressionAnimation(L"Vector2(it.Position.X, it.Position.Y)");
01821         m_positionSourceExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
01822
01823         m_minPositionSourceExpressionAnimation = compositor.CreateExpressionAnimation(L"Vector2(it.MinPosition.X, it.MinPosition.Y)");
01824         m_minPositionSourceExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
01825
01826         m_maxPositionSourceExpressionAnimation = compositor.CreateExpressionAnimation(L"Vector2(it.MaxPosition.X, it.MaxPosition.Y)");
01827         m_maxPositionSourceExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
01828
01829         m_zoomFactorSourceExpressionAnimation = compositor.CreateExpressionAnimation(L"it.Scale");
01830         m_zoomFactorSourceExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
01831
01832         StartExpressionAnimationSourcesAnimations();
01833         UpdateExpressionAnimationSources();
01834     }
01835 }
01836
01837 void ScrollPresenter::EnsureInteractionTracker()
01838 {
01839     if (!m_interactionTracker)
01840     {
01841         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01842
01843         MUX_ASSERT(!m_interactionTrackerOwner);
01844         m_interactionTrackerOwner = winrt::make_self<InteractionTrackerOwner>(*this).try_as<winrt::IInteractionTrackerOwner>();
01845
01846         const winrt::Compositor compositor = winrt::ElementCompositionPreview::GetElementVisual(*this).Compositor();
01847         m_interactionTracker = winrt::InteractionTracker::CreateWithOwner(compositor, m_interactionTrackerOwner);
01848     }
01849 }
01850
01851 void ScrollPresenter::EnsureScrollPresenterVisualInteractionSource()
01852 {
01853     if (!m_scrollPresenterVisualInteractionSource)
01854     {
01855         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01856
01857         EnsureInteractionTracker();
01858
01859         const winrt::Visual scrollPresenterVisual = winrt::ElementCompositionPreview::GetElementVisual(*this);
01860         winrt::VisualInteractionSource scrollPresenterVisualInteractionSource = winrt::VisualInteractionSource::Create(scrollPresenterVisual);
01861         m_interactionTracker.InteractionSources().Add(scrollPresenterVisualInteractionSource);
01862         m_scrollPresenterVisualInteractionSource = scrollPresenterVisualInteractionSource;
01863         UpdateManipulationRedirectionMode();
01864         RaiseInteractionSourcesChanged();
01865     }
01866 }
01867
01868 void ScrollPresenter::EnsureScrollControllerVisualInteractionSource(
01869     const winrt::Visual& panningElementAncestorVisual,
01870     ScrollPresenterDimension dimension)
01871 {
01872     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR_INT, METH_NAME, this, panningElementAncestorVisual, dimension);
01873
01874     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
01875     MUX_ASSERT(m_interactionTracker);
01876
01877     winrt::VisualInteractionSource scrollControllerVisualInteractionSource = winrt::VisualInteractionSource::Create(panningElementAncestorVisual);
01878     scrollControllerVisualInteractionSource.ManipulationRedirectionMode(winrt::VisualInteractionSourceRedirectionMode::CapableTouchpadOnly);
01879     scrollControllerVisualInteractionSource.PositionXChainingMode(winrt::InteractionChainingMode::Never);
01880     scrollControllerVisualInteractionSource.PositionYChainingMode(winrt::InteractionChainingMode::Never);
01881     scrollControllerVisualInteractionSource.ScaleChainingMode(winrt::InteractionChainingMode::Never);
01882     scrollControllerVisualInteractionSource.ScaleSourceMode(winrt::InteractionSourceMode::Disabled);
01883     m_interactionTracker.InteractionSources().Add(scrollControllerVisualInteractionSource);
01884
01885     if (dimension == ScrollPresenterDimension::HorizontalScroll)
01886     {
01887         MUX_ASSERT(m_horizontalScrollController);
01888         MUX_ASSERT(m_horizontalScrollControllerPanningInfo);
01889         MUX_ASSERT(!m_horizontalScrollControllerVisualInteractionSource);
01890         m_horizontalScrollControllerVisualInteractionSource = scrollControllerVisualInteractionSource;
01891
01892         HookHorizontalScrollControllerInteractionSourceEvents(m_horizontalScrollControllerPanningInfo.get());
01893     }
01894     else
01895     {
01896         MUX_ASSERT(m_verticalScrollController);
01897         MUX_ASSERT(m_verticalScrollControllerPanningInfo);
01898         MUX_ASSERT(!m_verticalScrollControllerVisualInteractionSource);
01899         m_verticalScrollControllerVisualInteractionSource = scrollControllerVisualInteractionSource;
01900
01901         HookVerticalScrollControllerInteractionSourceEvents(m_verticalScrollControllerPanningInfo.get());
01902     }
01903
01904     RaiseInteractionSourcesChanged();
01905 }
01906
01907 void ScrollPresenter::EnsureScrollControllerExpressionAnimationSources(
01908     ScrollPresenterDimension dimension)
01909 {
01910     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
01911     MUX_ASSERT(m_interactionTracker);
01912
01913     const winrt::Compositor compositor = winrt::ElementCompositionPreview::GetElementVisual(*this).Compositor();
01914     winrt::CompositionPropertySet scrollControllerExpressionAnimationSources = nullptr;
01915
01916     if (dimension == ScrollPresenterDimension::HorizontalScroll)
01917     {
01918         if (m_horizontalScrollControllerExpressionAnimationSources)
01919         {
01920             return;
01921         }
01922
01923         m_horizontalScrollControllerExpressionAnimationSources = scrollControllerExpressionAnimationSources = compositor.CreatePropertySet();
01924     }
01925     else
01926     {
01927         if (m_verticalScrollControllerExpressionAnimationSources)
01928         {
01929             return;
01930         }
01931
01932         m_verticalScrollControllerExpressionAnimationSources = scrollControllerExpressionAnimationSources = compositor.CreatePropertySet();
01933     }
01934
01935     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, dimension);
01936
01937     scrollControllerExpressionAnimationSources.InsertScalar(s_minOffsetPropertyName, 0.0f);
01938     scrollControllerExpressionAnimationSources.InsertScalar(s_maxOffsetPropertyName, 0.0f);
01939     scrollControllerExpressionAnimationSources.InsertScalar(s_offsetPropertyName, 0.0f);
01940     scrollControllerExpressionAnimationSources.InsertScalar(s_multiplierPropertyName, 1.0f);
01941
01942     if (dimension == ScrollPresenterDimension::HorizontalScroll)
01943     {
01944         MUX_ASSERT(!m_horizontalScrollControllerOffsetExpressionAnimation);
01945         MUX_ASSERT(!m_horizontalScrollControllerMaxOffsetExpressionAnimation);
01946
01947         m_horizontalScrollControllerOffsetExpressionAnimation = compositor.CreateExpressionAnimation(L"it.Position.X - it.MinPosition.X");
01948         m_horizontalScrollControllerOffsetExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
01949         m_horizontalScrollControllerMaxOffsetExpressionAnimation = compositor.CreateExpressionAnimation(L"it.MaxPosition.X - it.MinPosition.X");
01950         m_horizontalScrollControllerMaxOffsetExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
01951     }
01952     else
01953     {
01954         MUX_ASSERT(!m_verticalScrollControllerOffsetExpressionAnimation);
01955         MUX_ASSERT(!m_verticalScrollControllerMaxOffsetExpressionAnimation);
01956
01957         m_verticalScrollControllerOffsetExpressionAnimation = compositor.CreateExpressionAnimation(L"it.Position.Y - it.MinPosition.Y");
01958         m_verticalScrollControllerOffsetExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
01959         m_verticalScrollControllerMaxOffsetExpressionAnimation = compositor.CreateExpressionAnimation(L"it.MaxPosition.Y - it.MinPosition.Y");
01960         m_verticalScrollControllerMaxOffsetExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
01961     }
01962 }
01963
01964 void ScrollPresenter::EnsurePositionBoundariesExpressionAnimations()
01965 {
01966     if (!m_minPositionExpressionAnimation || !m_maxPositionExpressionAnimation)
01967     {
01968         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01969
01970         const winrt::Compositor compositor = winrt::ElementCompositionPreview::GetElementVisual(*this).Compositor();
01971
01972         if (!m_minPositionExpressionAnimation)
01973         {
01974             m_minPositionExpressionAnimation = compositor.CreateExpressionAnimation();
01975         }
01976         if (!m_maxPositionExpressionAnimation)
01977         {
01978             m_maxPositionExpressionAnimation = compositor.CreateExpressionAnimation();
01979         }
01980     }
01981 }
01982
01983 void ScrollPresenter::EnsureTransformExpressionAnimations()
01984 {
01985     if (!m_translationExpressionAnimation || !m_zoomFactorExpressionAnimation)
01986     {
01987         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01988
01989         const winrt::Compositor compositor = winrt::ElementCompositionPreview::GetElementVisual(*this).Compositor();
01990
01991         if (!m_translationExpressionAnimation)
01992         {
01993             m_translationExpressionAnimation = compositor.CreateExpressionAnimation();
01994         }
01995
01996         if (!m_zoomFactorExpressionAnimation)
01997         {
01998             m_zoomFactorExpressionAnimation = compositor.CreateExpressionAnimation();
01999         }
02000     }
02001 }
02002
02003 template <typename T>
02004 void ScrollPresenter::SetupSnapPoints(
02005     std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
02006     ScrollPresenterDimension dimension)
02007 {
02008     MUX_ASSERT(snapPointsSet);
02009
02010     if (!m_interactionTracker)
02011     {
02012         EnsureInteractionTracker();
02013     }
02014
02015     if (m_state == winrt::ScrollingInteractionState::Idle)
02016     {
02017         const double ignoredValue = [this, dimension]()
02018         {
02019             switch (dimension)
02020             {
02021             case ScrollPresenterDimension::VerticalScroll:
02022                 return m_zoomedVerticalOffset / m_zoomFactor;
02023             case ScrollPresenterDimension::HorizontalScroll:
02024                 return m_zoomedHorizontalOffset / m_zoomFactor;
02025             case ScrollPresenterDimension::ZoomFactor:
02026                 return static_cast<double>(m_zoomFactor);
02027             default:
02028                 MUX_ASSERT(false);
02029                 return 0.0;
02030             }
02031         }();
02032
02033         // When snap points are changed while in the Idle State, update
02034         // ignored snapping values for any potential start of an impulse inertia.
02035         UpdateSnapPointsIgnoredValue(snapPointsSet, ignoredValue);
02036     }
02037
02038     // Update the regular and impulse actual applicable ranges.
02039     UpdateSnapPointsRanges(snapPointsSet, false /*forImpulseOnly*/);
02040
02041     winrt::Compositor compositor = m_interactionTracker.Compositor();
02042     winrt::IVector<winrt::InteractionTrackerInertiaModifier> modifiers = winrt::make<Vector<winrt::InteractionTrackerInertiaModifier>>();
02043
02044     winrt::hstring target = L"";
02045     winrt::hstring scale = L"";
02046
02047     switch (dimension)
02048     {
02049     case ScrollPresenterDimension::HorizontalZoomFactor:
02050     case ScrollPresenterDimension::VerticalZoomFactor:
02051     case ScrollPresenterDimension::Scroll:
02052         //these ScrollPresenterDimensions are not expected
02053         MUX_ASSERT(false);
02054         break;
02055     case ScrollPresenterDimension::HorizontalScroll:
02056         target = s_naturalRestingPositionXPropertyName;
02057         scale = s_targetScalePropertyName;
02058         break;
02059     case ScrollPresenterDimension::VerticalScroll:
02060         target = s_naturalRestingPositionYPropertyName;
02061         scale = s_targetScalePropertyName;
02062         break;
02063     case ScrollPresenterDimension::ZoomFactor:
02064         target = s_naturalRestingScalePropertyName;
02065         scale = L"1.0";
02066         break;
02067     default:
02068         MUX_ASSERT(false);
02069     }
02070
02071     // For older versions of windows the interaction tracker cannot accept empty collections of inertia modifiers
02072     if (snapPointsSet->size() == 0)
02073     {
02074         winrt::InteractionTrackerInertiaRestingValue modifier = winrt::InteractionTrackerInertiaRestingValue::Create(compositor);
02075         winrt::ExpressionAnimation conditionExpressionAnimation = compositor.CreateExpressionAnimation(L"false");
02076         winrt::ExpressionAnimation restingPointExpressionAnimation = compositor.CreateExpressionAnimation(L"this.Target." + target);
02077
02078         modifier.Condition(conditionExpressionAnimation);
02079         modifier.RestingValue(restingPointExpressionAnimation);
02080
02081         modifiers.Append(modifier);
02082     }
02083     else
02084     {
02085         for (auto snapPointWrapper : *snapPointsSet)
02086         {
02087             winrt::InteractionTrackerInertiaRestingValue modifier = GetInertiaRestingValue(
02088                 snapPointWrapper,
02089                 compositor,
02090                 target,
02091                 scale);
02092
02093             modifiers.Append(modifier);
02094         }
02095     }
02096
02097     switch (dimension)
02098     {
02099     case ScrollPresenterDimension::HorizontalZoomFactor:
02100     case ScrollPresenterDimension::VerticalZoomFactor:
02101     case ScrollPresenterDimension::Scroll:
02102         //these ScrollPresenterDimensions are not expected
02103         MUX_ASSERT(false);
02104         break;
02105     case ScrollPresenterDimension::HorizontalScroll:
02106         m_interactionTracker.ConfigurePositionXInertiaModifiers(modifiers);
02107         break;
02108     case ScrollPresenterDimension::VerticalScroll:
02109         m_interactionTracker.ConfigurePositionYInertiaModifiers(modifiers);
02110         break;
02111     case ScrollPresenterDimension::ZoomFactor:
02112         m_interactionTracker.ConfigureScaleInertiaModifiers(modifiers);
02113         break;
02114     default:
02115         MUX_ASSERT(false);
02116     }
02117 }
02118
02119 //Snap points which have ApplicableRangeType = Optional are optional snap points, and their ActualApplicableRange should never be expanded beyond their ApplicableRange
02120 //and will only shrink to accommodate other snap points which are positioned such that the midpoint between them is within the specified ApplicableRange.
02121 //Snap points which have ApplicableRangeType = Mandatory are mandatory snap points and their ActualApplicableRange will expand or shrink to ensure that there is no
02122 //space between it and its neighbors. If the neighbors are also mandatory, this point will be the midpoint between them. If the neighbors are optional then this
02123 //point will fall on the midpoint or on the Optional neighbor's edge of ApplicableRange, whichever is furthest.
02124 template <typename T>
02125 void ScrollPresenter::UpdateSnapPointsRanges(
02126     std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
02127     bool forImpulseOnly)
02128 {
02129     MUX_ASSERT(snapPointsSet);
02130
02131     std::shared_ptr<SnapPointWrapper<T>> currentSnapPointWrapper = nullptr;
02132     std::shared_ptr<SnapPointWrapper<T>> previousSnapPointWrapper = nullptr;
02133     std::shared_ptr<SnapPointWrapper<T>> nextSnapPointWrapper = nullptr;
02134
02135     for (auto snapPointWrapper : *snapPointsSet)
02136     {
02137         previousSnapPointWrapper = currentSnapPointWrapper;
02138         currentSnapPointWrapper = nextSnapPointWrapper;
02139         nextSnapPointWrapper = snapPointWrapper;
02140
02141         if (currentSnapPointWrapper)
02142         {
02143             currentSnapPointWrapper->DetermineActualApplicableZone(
02144                 previousSnapPointWrapper ? previousSnapPointWrapper.get() : nullptr,
02145                 nextSnapPointWrapper ? nextSnapPointWrapper.get() : nullptr,
02146                 forImpulseOnly);
02147         }
02148     }
02149
02150     if (nextSnapPointWrapper)
02151     {
02152         nextSnapPointWrapper->DetermineActualApplicableZone(
02153             currentSnapPointWrapper ? currentSnapPointWrapper.get() : nullptr,
02154             nullptr,
02155             forImpulseOnly);
02156     }
02157 }
02158
02159 template <typename T>
02160 void ScrollPresenter::UpdateSnapPointsIgnoredValue(
02161     std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
02162     ScrollPresenterDimension dimension)
02163 {
02164     const double newIgnoredValue = [this, dimension]()
02165     {
02166         switch (dimension)
02167         {
02168         case ScrollPresenterDimension::VerticalScroll:
02169             return m_zoomedVerticalOffset / m_zoomFactor;
02170         case ScrollPresenterDimension::HorizontalScroll:
02171             return m_zoomedHorizontalOffset / m_zoomFactor;
02172         case ScrollPresenterDimension::ZoomFactor:
02173             return static_cast<double>(m_zoomFactor);
02174         default:
02175             MUX_ASSERT(false);
02176             return 0.0;
02177         }
02178     }();
02179
02180     if (UpdateSnapPointsIgnoredValue(snapPointsSet, newIgnoredValue))
02181     {
02182         // The ignored snap point value has changed.
02183         UpdateSnapPointsRanges(snapPointsSet, true /*forImpulseOnly*/);
02184
02185         winrt::Compositor compositor = m_interactionTracker.Compositor();
02186         winrt::IVector<winrt::InteractionTrackerInertiaModifier> modifiers = winrt::make<Vector<winrt::InteractionTrackerInertiaModifier>>();
02187
02188         for (auto snapPointWrapper : *snapPointsSet)
02189         {
02190             auto modifier = winrt::InteractionTrackerInertiaRestingValue::Create(compositor);
02191             auto const [conditionExpressionAnimation, restingValueExpressionAnimation] = snapPointWrapper->GetUpdatedExpressionAnimationsForImpulse();
02192
02193             modifier.Condition(conditionExpressionAnimation);
02194             modifier.RestingValue(restingValueExpressionAnimation);
02195
02196             modifiers.Append(modifier);
02197         }
02198
02199         switch (dimension)
02200         {
02201         case ScrollPresenterDimension::VerticalScroll:
02202             m_interactionTracker.ConfigurePositionYInertiaModifiers(modifiers);
02203             break;
02204         case ScrollPresenterDimension::HorizontalScroll:
02205             m_interactionTracker.ConfigurePositionXInertiaModifiers(modifiers);
02206             break;
02207         case ScrollPresenterDimension::ZoomFactor:
02208             m_interactionTracker.ConfigureScaleInertiaModifiers(modifiers);
02209             break;
02210         }
02211     }
02212 }
02213
02214 // Updates the ignored snapping value of the provided snap points set when inertia is caused by an impulse.
02215 // Returns True when an old ignored value was reset or a new ignored value was set.
02216 template <typename T>
02217 bool ScrollPresenter::UpdateSnapPointsIgnoredValue(
02218     std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
02219     double newIgnoredValue)
02220 {
02221     bool ignoredValueUpdated = false;
02222
02223     for (auto snapPointWrapper : *snapPointsSet)
02224     {
02225         if (snapPointWrapper->ResetIgnoredValue())
02226         {
02227             ignoredValueUpdated = true;
02228             break;
02229         }
02230     }
02231
02232     int snapCount = 0;
02233
02234     for (auto snapPointWrapper : *snapPointsSet)
02235     {
02236         const SnapPointBase* snapPoint = SnapPointWrapper<T>::GetSnapPointFromWrapper(snapPointWrapper);
02237
02238         snapCount += snapPoint->SnapCount();
02239
02240         if (snapCount > 1)
02241         {
02242             break;
02243         }
02244     }
02245
02246     if (snapCount > 1)
02247     {
02248         for (auto snapPointWrapper : *snapPointsSet)
02249         {
02250             if (snapPointWrapper->SnapsAt(newIgnoredValue))
02251             {
02252                 snapPointWrapper->SetIgnoredValue(newIgnoredValue);
02253                 ignoredValueUpdated = true;
02254                 break;
02255             }
02256         }
02257     }
02258
02259     return ignoredValueUpdated;
02260 }
02261
02262 void ScrollPresenter::SetupInteractionTrackerBoundaries()
02263 {
02264     if (!m_interactionTracker)
02265     {
02266         EnsureInteractionTracker();
02267         SetupInteractionTrackerZoomFactorBoundaries(
02268             MinZoomFactor(),
02269             MaxZoomFactor());
02270     }
02271
02272     const winrt::UIElement content = Content();
02273
02274     if (content && (!m_minPositionExpressionAnimation || !m_maxPositionExpressionAnimation))
02275     {
02276         EnsurePositionBoundariesExpressionAnimations();
02277         SetupPositionBoundariesExpressionAnimations(content);
02278     }
02279 }
02280
02281 void ScrollPresenter::SetupInteractionTrackerZoomFactorBoundaries(
02282     double minZoomFactor, double maxZoomFactor)
02283 {
02284     MUX_ASSERT(m_interactionTracker);
02285
02286 #ifdef DBG
02287     const float oldMinZoomFactorDbg = m_interactionTracker.MinScale();
02288 #endif //DBG
02289     const float oldMaxZoomFactor = m_interactionTracker.MaxScale();
02290
02291     minZoomFactor = std::max(0.0, minZoomFactor);
02292     maxZoomFactor = std::max(minZoomFactor, maxZoomFactor);
02293
02294     const float newMinZoomFactor = static_cast<float>(minZoomFactor);
02295     const float newMaxZoomFactor = static_cast<float>(maxZoomFactor);
02296
02297     if (newMinZoomFactor > oldMaxZoomFactor)
02298     {
02299         m_interactionTracker.MaxScale(newMaxZoomFactor);
02300         m_interactionTracker.MinScale(newMinZoomFactor);
02301     }
02302     else
02303     {
02304         m_interactionTracker.MinScale(newMinZoomFactor);
02305         m_interactionTracker.MaxScale(newMaxZoomFactor);
02306     }
02307 }
02308
02309 // Configures the VisualInteractionSource instance associated with ScrollPresenter's Visual.
02310 void ScrollPresenter::SetupScrollPresenterVisualInteractionSource()
02311 {
02312     MUX_ASSERT(m_scrollPresenterVisualInteractionSource);
02313
02314     SetupVisualInteractionSourceRailingMode(
02315         m_scrollPresenterVisualInteractionSource,
02316         ScrollPresenterDimension::HorizontalScroll,
02317         HorizontalScrollRailMode());
02318
02319     SetupVisualInteractionSourceRailingMode(
02320         m_scrollPresenterVisualInteractionSource,
02321         ScrollPresenterDimension::VerticalScroll,
02322         VerticalScrollRailMode());
02323
02324     SetupVisualInteractionSourceChainingMode(
02325         m_scrollPresenterVisualInteractionSource,
02326         ScrollPresenterDimension::HorizontalScroll,
02327         HorizontalScrollChainMode());
02328
02329     SetupVisualInteractionSourceChainingMode(
02330         m_scrollPresenterVisualInteractionSource,
02331         ScrollPresenterDimension::VerticalScroll,
02332         VerticalScrollChainMode());
02333
02334     SetupVisualInteractionSourceChainingMode(
02335         m_scrollPresenterVisualInteractionSource,
02336         ScrollPresenterDimension::ZoomFactor,
02337         ZoomChainMode());
02338
02339     UpdateVisualInteractionSourceMode(
02340         ScrollPresenterDimension::HorizontalScroll);
02341
02342     UpdateVisualInteractionSourceMode(
02343         ScrollPresenterDimension::VerticalScroll);
02344
02345     SetupVisualInteractionSourceMode(
02346         m_scrollPresenterVisualInteractionSource,
02347         ZoomMode());
02348
02349 #ifdef IsMouseWheelZoomDisabled
02350     SetupVisualInteractionSourcePointerWheelConfig(
02351         m_scrollPresenterVisualInteractionSource,
02352         GetMouseWheelZoomMode());
02353 #endif
02354 }
02355
02356 // Configures the VisualInteractionSource instance associated with the Visual handed in
02357 // through IScrollControllerPanningInfo::PanningElementAncestor.
02358 void ScrollPresenter::SetupScrollControllerVisualInterationSource(
02359     ScrollPresenterDimension dimension)
02360 {
02361     MUX_ASSERT(m_interactionTracker);
02362     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
02363
02364     winrt::VisualInteractionSource scrollControllerVisualInteractionSource = nullptr;
02365     winrt::Visual panningElementAncestorVisual = nullptr;
02366
02367     if (dimension == ScrollPresenterDimension::HorizontalScroll)
02368     {
02369         scrollControllerVisualInteractionSource = m_horizontalScrollControllerVisualInteractionSource;
02370         if (m_horizontalScrollControllerPanningInfo)
02371         {
02372             const winrt::UIElement panningElementAncestor = m_horizontalScrollControllerPanningInfo.get().PanningElementAncestor();
02373
02374             if (panningElementAncestor)
02375             {
02376                 panningElementAncestorVisual = winrt::ElementCompositionPreview::GetElementVisual(panningElementAncestor);
02377             }
02378         }
02379     }
02380     else
02381     {
02382         scrollControllerVisualInteractionSource = m_verticalScrollControllerVisualInteractionSource;
02383         if (m_verticalScrollControllerPanningInfo)
02384         {
02385             const winrt::UIElement panningElementAncestor = m_verticalScrollControllerPanningInfo.get().PanningElementAncestor();
02386
02387             if (panningElementAncestor)
02388             {
02389                 panningElementAncestorVisual = winrt::ElementCompositionPreview::GetElementVisual(panningElementAncestor);
02390             }
02391         }
02392     }
02393
02394     if (!panningElementAncestorVisual && scrollControllerVisualInteractionSource)
02395     {
02396         // The IScrollController no longer uses a Visual.
02397         winrt::VisualInteractionSource otherScrollControllerVisualInteractionSource =
02398             dimension == ScrollPresenterDimension::HorizontalScroll ? m_verticalScrollControllerVisualInteractionSource : m_horizontalScrollControllerVisualInteractionSource;
02399
02400         if (otherScrollControllerVisualInteractionSource != scrollControllerVisualInteractionSource)
02401         {
02402             // The horizontal and vertical IScrollController implementations are not using the same Visual,
02403             // so the old VisualInteractionSource can be discarded.
02404             m_interactionTracker.InteractionSources().Remove(scrollControllerVisualInteractionSource);
02405             StopScrollControllerExpressionAnimationSourcesAnimations(dimension);
02406             if (dimension == ScrollPresenterDimension::HorizontalScroll)
02407             {
02408                 m_horizontalScrollControllerVisualInteractionSource = nullptr;
02409                 m_horizontalScrollControllerExpressionAnimationSources = nullptr;
02410                 m_horizontalScrollControllerOffsetExpressionAnimation = nullptr;
02411                 m_horizontalScrollControllerMaxOffsetExpressionAnimation = nullptr;
02412             }
02413             else
02414             {
02415                 m_verticalScrollControllerVisualInteractionSource = nullptr;
02416                 m_verticalScrollControllerExpressionAnimationSources = nullptr;
02417                 m_verticalScrollControllerOffsetExpressionAnimation = nullptr;
02418                 m_verticalScrollControllerMaxOffsetExpressionAnimation = nullptr;
02419             }
02420
02421             RaiseInteractionSourcesChanged();
02422         }
02423         else
02424         {
02425             // The horizontal and vertical IScrollController implementations were using the same Visual,
02426             // so the old VisualInteractionSource cannot be discarded.
02427             if (dimension == ScrollPresenterDimension::HorizontalScroll)
02428             {
02429                 scrollControllerVisualInteractionSource.PositionXSourceMode(winrt::InteractionSourceMode::Disabled);
02430                 scrollControllerVisualInteractionSource.IsPositionXRailsEnabled(false);
02431             }
02432             else
02433             {
02434                 scrollControllerVisualInteractionSource.PositionYSourceMode(winrt::InteractionSourceMode::Disabled);
02435                 scrollControllerVisualInteractionSource.IsPositionYRailsEnabled(false);
02436             }
02437         }
02438         return;
02439     }
02440     else if (panningElementAncestorVisual)
02441     {
02442         if (!scrollControllerVisualInteractionSource)
02443         {
02444             // The IScrollController now uses a Visual.
02445             winrt::VisualInteractionSource otherScrollControllerVisualInteractionSource =
02446                 dimension == ScrollPresenterDimension::HorizontalScroll ? m_verticalScrollControllerVisualInteractionSource : m_horizontalScrollControllerVisualInteractionSource;
02447
02448             if (!otherScrollControllerVisualInteractionSource || otherScrollControllerVisualInteractionSource.Source() != panningElementAncestorVisual)
02449             {
02450                 // That Visual is not shared with the other dimension, so create a new VisualInteractionSource for it.
02451                 EnsureScrollControllerVisualInteractionSource(panningElementAncestorVisual, dimension);
02452             }
02453             else
02454             {
02455                 // That Visual is shared with the other dimension, so share the existing VisualInteractionSource as well.
02456                 if (dimension == ScrollPresenterDimension::HorizontalScroll)
02457                 {
02458                     m_horizontalScrollControllerVisualInteractionSource = otherScrollControllerVisualInteractionSource;
02459                 }
02460                 else
02461                 {
02462                     m_verticalScrollControllerVisualInteractionSource = otherScrollControllerVisualInteractionSource;
02463                 }
02464             }
02465             EnsureScrollControllerExpressionAnimationSources(dimension);
02466             StartScrollControllerExpressionAnimationSourcesAnimations(dimension);
02467         }
02468
02469         winrt::Orientation orientation;
02470         bool isRailEnabled;
02471
02472         // Setup the VisualInteractionSource instance.
02473         if (dimension == ScrollPresenterDimension::HorizontalScroll)
02474         {
02475             orientation = m_horizontalScrollControllerPanningInfo.get().PanOrientation();
02476             isRailEnabled = m_horizontalScrollControllerPanningInfo.get().IsRailEnabled();
02477
02478             if (orientation == winrt::Orientation::Horizontal)
02479             {
02480                 m_horizontalScrollControllerVisualInteractionSource.PositionXSourceMode(winrt::InteractionSourceMode::EnabledWithoutInertia);
02481                 m_horizontalScrollControllerVisualInteractionSource.IsPositionXRailsEnabled(isRailEnabled);
02482             }
02483             else
02484             {
02485                 m_horizontalScrollControllerVisualInteractionSource.PositionYSourceMode(winrt::InteractionSourceMode::EnabledWithoutInertia);
02486                 m_horizontalScrollControllerVisualInteractionSource.IsPositionYRailsEnabled(isRailEnabled);
02487             }
02488         }
02489         else
02490         {
02491             orientation = m_verticalScrollControllerPanningInfo.get().PanOrientation();
02492             isRailEnabled = m_verticalScrollControllerPanningInfo.get().IsRailEnabled();
02493
02494             if (orientation == winrt::Orientation::Horizontal)
02495             {
02496                 m_verticalScrollControllerVisualInteractionSource.PositionXSourceMode(winrt::InteractionSourceMode::EnabledWithoutInertia);
02497                 m_verticalScrollControllerVisualInteractionSource.IsPositionXRailsEnabled(isRailEnabled);
02498             }
02499             else
02500             {
02501                 m_verticalScrollControllerVisualInteractionSource.PositionYSourceMode(winrt::InteractionSourceMode::EnabledWithoutInertia);
02502                 m_verticalScrollControllerVisualInteractionSource.IsPositionYRailsEnabled(isRailEnabled);
02503             }
02504         }
02505
02506         if (!scrollControllerVisualInteractionSource)
02507         {
02508             SetupScrollControllerVisualInterationSourcePositionModifiers(
02509                 dimension,
02510                 orientation);
02511         }
02512     }
02513 }
02514
02515 // Configures the Position input modifiers of the VisualInteractionSource associated
02516 // with an IScrollController Visual.  The scalar called Multiplier from the CompositionPropertySet
02517 // used in IScrollControllerPanningInfo::SetPanningElementExpressionAnimationSources determines the relative
02518 // speed of IScrollControllerPanningInfo panning element compared to the ScrollPresenter.Content element.
02519 // The panning element is clamped based on the Interaction's MinPosition and MaxPosition values.
02520 // Four CompositionConditionalValue instances cover all scenarios:
02521 //  - the Position is moved closer to InteractionTracker.MinPosition while the multiplier is negative.
02522 //  - the Position is moved closer to InteractionTracker.MinPosition while the multiplier is positive.
02523 //  - the Position is moved closer to InteractionTracker.MaxPosition while the multiplier is negative.
02524 //  - the Position is moved closer to InteractionTracker.MaxPosition while the multiplier is positive.
02525 void ScrollPresenter::SetupScrollControllerVisualInterationSourcePositionModifiers(
02526     ScrollPresenterDimension dimension,            // Direction of the ScrollPresenter.Content Visual movement.
02527     const winrt::Orientation& orientation)  // Direction of the IScrollController's Visual movement.
02528 {
02529     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
02530     MUX_ASSERT(m_interactionTracker);
02531
02532     winrt::VisualInteractionSource scrollControllerVisualInteractionSource = dimension == ScrollPresenterDimension::HorizontalScroll ?
02533         m_horizontalScrollControllerVisualInteractionSource : m_verticalScrollControllerVisualInteractionSource;
02534     winrt::CompositionPropertySet scrollControllerExpressionAnimationSources = dimension == ScrollPresenterDimension::HorizontalScroll ?
02535         m_horizontalScrollControllerExpressionAnimationSources : m_verticalScrollControllerExpressionAnimationSources;
02536
02537     MUX_ASSERT(scrollControllerVisualInteractionSource);
02538     MUX_ASSERT(scrollControllerExpressionAnimationSources);
02539
02540     winrt::Compositor compositor = scrollControllerVisualInteractionSource.Compositor();
02541     const winrt::CompositionConditionalValue ccvs[4]{ winrt::CompositionConditionalValue::Create(compositor), winrt::CompositionConditionalValue::Create(compositor), winrt::CompositionConditionalValue::Create(compositor), winrt::CompositionConditionalValue::Create(compositor) };
02542     const winrt::ExpressionAnimation conditions[4]{ compositor.CreateExpressionAnimation(), compositor.CreateExpressionAnimation(), compositor.CreateExpressionAnimation(), compositor.CreateExpressionAnimation() };
02543     const winrt::ExpressionAnimation values[4]{ compositor.CreateExpressionAnimation(), compositor.CreateExpressionAnimation(), compositor.CreateExpressionAnimation(), compositor.CreateExpressionAnimation() };
02544     for (int index = 0; index < 4; index++)
02545     {
02546         ccvs[index].Condition(conditions[index]);
02547         ccvs[index].Value(values[index]);
02548
02549         values[index].SetReferenceParameter(L"sceas", scrollControllerExpressionAnimationSources);
02550         values[index].SetReferenceParameter(L"scvis", scrollControllerVisualInteractionSource);
02551         values[index].SetReferenceParameter(L"it", m_interactionTracker);
02552     }
02553
02554     for (int index = 0; index < 3; index++)
02555     {
02556         conditions[index].SetReferenceParameter(L"scvis", scrollControllerVisualInteractionSource);
02557         conditions[index].SetReferenceParameter(L"sceas", scrollControllerExpressionAnimationSources);
02558     }
02559     conditions[3].Expression(L"true");
02560
02561     const auto modifiersVector = winrt::single_threaded_vector<winrt::CompositionConditionalValue>();
02562
02563     for (int index = 0; index < 4; index++)
02564     {
02565         modifiersVector.Append(ccvs[index]);
02566     }
02567
02568     if (orientation == winrt::Orientation::Horizontal)
02569     {
02570         conditions[0].Expression(L"scvis.DeltaPosition.X < 0.0f && sceas.Multiplier < 0.0f");
02571         conditions[1].Expression(L"scvis.DeltaPosition.X < 0.0f && sceas.Multiplier >= 0.0f");
02572         conditions[2].Expression(L"scvis.DeltaPosition.X >= 0.0f && sceas.Multiplier < 0.0f");
02573         // Case #4 <==> scvis.DeltaPosition.X >= 0.0f && sceas.Multiplier > 0.0f, uses conditions[3].Expression(L"true").
02574         if (dimension == ScrollPresenterDimension::HorizontalScroll)
02575         {
02576             const auto expressionClampToMinPosition = L"min(sceas.Multiplier * scvis.DeltaPosition.X, it.Position.X - it.MinPosition.X)";
02577             const auto expressionClampToMaxPosition = L"max(sceas.Multiplier * scvis.DeltaPosition.X, it.Position.X - it.MaxPosition.X)";
02578
02579             values[0].Expression(expressionClampToMinPosition);
02580             values[1].Expression(expressionClampToMaxPosition);
02581             values[2].Expression(expressionClampToMaxPosition);
02582             values[3].Expression(expressionClampToMinPosition);
02583             scrollControllerVisualInteractionSource.ConfigureDeltaPositionXModifiers(modifiersVector);
02584         }
02585         else
02586         {
02587             const auto expressionClampToMinPosition = L"min(sceas.Multiplier * scvis.DeltaPosition.X, it.Position.Y - it.MinPosition.Y)";
02588             const auto expressionClampToMaxPosition = L"max(sceas.Multiplier * scvis.DeltaPosition.X, it.Position.Y - it.MaxPosition.Y)";
02589
02590             values[0].Expression(expressionClampToMinPosition);
02591             values[1].Expression(expressionClampToMaxPosition);
02592             values[2].Expression(expressionClampToMaxPosition);
02593             values[3].Expression(expressionClampToMinPosition);
02594             scrollControllerVisualInteractionSource.ConfigureDeltaPositionYModifiers(modifiersVector);
02595
02596             // When the IScrollController's Visual moves horizontally and controls the vertical ScrollPresenter.Content movement, make sure that the
02597             // vertical finger movements do not affect the ScrollPresenter.Content vertically. The vertical component of the finger movement is filtered out.
02598             winrt::CompositionConditionalValue ccvOrtho = winrt::CompositionConditionalValue::Create(compositor);
02599             winrt::ExpressionAnimation conditionOrtho = compositor.CreateExpressionAnimation(L"true");
02600             winrt::ExpressionAnimation valueOrtho = compositor.CreateExpressionAnimation(L"0");
02601             ccvOrtho.Condition(conditionOrtho);
02602             ccvOrtho.Value(valueOrtho);
02603
02604             auto modifiersVectorOrtho = winrt::single_threaded_vector<winrt::CompositionConditionalValue>();
02605             modifiersVectorOrtho.Append(ccvOrtho);
02606
02607             scrollControllerVisualInteractionSource.ConfigureDeltaPositionXModifiers(modifiersVectorOrtho);
02608         }
02609     }
02610     else
02611     {
02612         conditions[0].Expression(L"scvis.DeltaPosition.Y < 0.0f && sceas.Multiplier < 0.0f");
02613         conditions[1].Expression(L"scvis.DeltaPosition.Y < 0.0f && sceas.Multiplier >= 0.0f");
02614         conditions[2].Expression(L"scvis.DeltaPosition.Y >= 0.0f && sceas.Multiplier < 0.0f");
02615         // Case #4 <==> scvis.DeltaPosition.Y >= 0.0f && sceas.Multiplier > 0.0f, uses conditions[3].Expression(L"true").
02616         if (dimension == ScrollPresenterDimension::HorizontalScroll)
02617         {
02618             const auto expressionClampToMinPosition = L"min(sceas.Multiplier * scvis.DeltaPosition.Y, it.Position.X - it.MinPosition.X)";
02619             const auto expressionClampToMaxPosition = L"max(sceas.Multiplier * scvis.DeltaPosition.Y, it.Position.X - it.MaxPosition.X)";
02620
02621             values[0].Expression(expressionClampToMinPosition);
02622             values[1].Expression(expressionClampToMaxPosition);
02623             values[2].Expression(expressionClampToMaxPosition);
02624             values[3].Expression(expressionClampToMinPosition);
02625             scrollControllerVisualInteractionSource.ConfigureDeltaPositionXModifiers(modifiersVector);
02626
02627             // When the IScrollController's Visual moves vertically and controls the horizontal ScrollPresenter.Content movement, make sure that the
02628             // horizontal finger movements do not affect the ScrollPresenter.Content horizontally. The horizontal component of the finger movement is filtered out.
02629             winrt::CompositionConditionalValue ccvOrtho = winrt::CompositionConditionalValue::Create(compositor);
02630             winrt::ExpressionAnimation conditionOrtho = compositor.CreateExpressionAnimation(L"true");
02631             winrt::ExpressionAnimation valueOrtho = compositor.CreateExpressionAnimation(L"0");
02632             ccvOrtho.Condition(conditionOrtho);
02633             ccvOrtho.Value(valueOrtho);
02634
02635             auto modifiersVectorOrtho = winrt::single_threaded_vector<winrt::CompositionConditionalValue>();
02636             modifiersVectorOrtho.Append(ccvOrtho);
02637
02638             scrollControllerVisualInteractionSource.ConfigureDeltaPositionYModifiers(modifiersVectorOrtho);
02639         }
02640         else
02641         {
02642             const auto expressionClampToMinPosition = L"min(sceas.Multiplier * scvis.DeltaPosition.Y, it.Position.Y - it.MinPosition.Y)";
02643             const auto expressionClampToMaxPosition = L"max(sceas.Multiplier * scvis.DeltaPosition.Y, it.Position.Y - it.MaxPosition.Y)";
02644
02645             values[0].Expression(expressionClampToMinPosition);
02646             values[1].Expression(expressionClampToMaxPosition);
02647             values[2].Expression(expressionClampToMaxPosition);
02648             values[3].Expression(expressionClampToMinPosition);
02649             scrollControllerVisualInteractionSource.ConfigureDeltaPositionYModifiers(modifiersVector);
02650         }
02651     }
02652 }
02653
02654 void ScrollPresenter::SetupVisualInteractionSourceRailingMode(
02655     const winrt::VisualInteractionSource& visualInteractionSource,
02656     ScrollPresenterDimension dimension,
02657     const winrt::ScrollingRailMode& railingMode)
02658 {
02659     MUX_ASSERT(visualInteractionSource);
02660     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
02661
02662     if (dimension == ScrollPresenterDimension::HorizontalScroll)
02663     {
02664         visualInteractionSource.IsPositionXRailsEnabled(railingMode == winrt::ScrollingRailMode::Enabled);
02665     }
02666     else
02667     {
02668         visualInteractionSource.IsPositionYRailsEnabled(railingMode == winrt::ScrollingRailMode::Enabled);
02669     }
02670 }
02671
02672 void ScrollPresenter::SetupVisualInteractionSourceChainingMode(
02673     const winrt::VisualInteractionSource& visualInteractionSource,
02674     ScrollPresenterDimension dimension,
02675     const winrt::ScrollingChainMode& chainingMode)
02676 {
02677     MUX_ASSERT(visualInteractionSource);
02678
02679     const winrt::InteractionChainingMode interactionChainingMode = InteractionChainingModeFromChainingMode(chainingMode);
02680
02681     switch (dimension)
02682     {
02683     case ScrollPresenterDimension::HorizontalScroll:
02684         visualInteractionSource.PositionXChainingMode(interactionChainingMode);
02685         break;
02686     case ScrollPresenterDimension::VerticalScroll:
02687         visualInteractionSource.PositionYChainingMode(interactionChainingMode);
02688         break;
02689     case ScrollPresenterDimension::ZoomFactor:
02690         visualInteractionSource.ScaleChainingMode(interactionChainingMode);
02691         break;
02692     default:
02693         MUX_ASSERT(false);
02694     }
02695 }
02696
02697 void ScrollPresenter::SetupVisualInteractionSourceMode(
02698     const winrt::VisualInteractionSource& visualInteractionSource,
02699     ScrollPresenterDimension dimension,
02700     const winrt::ScrollingScrollMode& scrollMode)
02701 {
02702     MUX_ASSERT(visualInteractionSource);
02703     MUX_ASSERT(scrollMode == winrt::ScrollingScrollMode::Enabled || scrollMode == winrt::ScrollingScrollMode::Disabled);
02704
02705     const winrt::InteractionSourceMode interactionSourceMode = InteractionSourceModeFromScrollMode(scrollMode);
02706
02707     switch (dimension)
02708     {
02709     case ScrollPresenterDimension::HorizontalScroll:
02710         visualInteractionSource.PositionXSourceMode(interactionSourceMode);
02711         break;
02712     case ScrollPresenterDimension::VerticalScroll:
02713         visualInteractionSource.PositionYSourceMode(interactionSourceMode);
02714         break;
02715     default:
02716         MUX_ASSERT(false);
02717     }
02718 }
02719
02720 void ScrollPresenter::SetupVisualInteractionSourceMode(
02721     const winrt::VisualInteractionSource& visualInteractionSource,
02722     const winrt::ScrollingZoomMode& zoomMode)
02723 {
02724     MUX_ASSERT(visualInteractionSource);
02725
02726     visualInteractionSource.ScaleSourceMode(InteractionSourceModeFromZoomMode(zoomMode));
02727 }
02728
02729 #ifdef IsMouseWheelScrollDisabled
02730 void ScrollPresenter::SetupVisualInteractionSourcePointerWheelConfig(
02731     const winrt::VisualInteractionSource& visualInteractionSource,
02732     ScrollPresenterDimension dimension,
02733     const winrt::ScrollingScrollMode& scrollMode)
02734 {
02735     MUX_ASSERT(visualInteractionSource);
02736     MUX_ASSERT(scrollMode == winrt::ScrollingScrollMode::Enabled || scrollMode == winrt::ScrollingScrollMode::Disabled);
02737
02738     winrt::InteractionSourceRedirectionMode interactionSourceRedirectionMode = InteractionSourceRedirectionModeFromScrollMode(scrollMode);
02739
02740     switch (dimension)
02741     {
02742     case ScrollPresenterDimension::HorizontalScroll:
02743         visualInteractionSource.PointerWheelConfig().PositionXSourceMode(interactionSourceRedirectionMode);
02744         break;
02745     case ScrollPresenterDimension::VerticalScroll:
02746         visualInteractionSource.PointerWheelConfig().PositionYSourceMode(interactionSourceRedirectionMode);
02747         break;
02748     default:
02749         MUX_ASSERT(false);
02750     }
02751 }
02752 #endif
02753
02754 #ifdef IsMouseWheelZoomDisabled
02755 void ScrollPresenter::SetupVisualInteractionSourcePointerWheelConfig(
02756     const winrt::VisualInteractionSource& visualInteractionSource,
02757     const winrt::ScrollingZoomMode& zoomMode)
02758 {
02759     MUX_ASSERT(visualInteractionSource);
02760
02761     visualInteractionSource.PointerWheelConfig().ScaleSourceMode(InteractionSourceRedirectionModeFromZoomMode(zoomMode));
02762 }
02763 #endif
02764
02765 void ScrollPresenter::SetupVisualInteractionSourceRedirectionMode(
02766     const winrt::VisualInteractionSource& visualInteractionSource)
02767 {
02768     MUX_ASSERT(visualInteractionSource);
02769
02770     winrt::VisualInteractionSourceRedirectionMode redirectionMode = winrt::VisualInteractionSourceRedirectionMode::CapableTouchpadOnly;
02771
02772     if (!IsInputKindIgnored(winrt::ScrollingInputKinds::MouseWheel))
02773     {
02774         redirectionMode = winrt::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel;
02775     }
02776
02777     visualInteractionSource.ManipulationRedirectionMode(redirectionMode);
02778 }
02779
02780 void ScrollPresenter::SetupVisualInteractionSourceCenterPointModifier(
02781     const winrt::VisualInteractionSource& visualInteractionSource,
02782     ScrollPresenterDimension dimension,
02783     bool flowDirectionChanged)
02784 {
02785     MUX_ASSERT(visualInteractionSource);
02786     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
02787     MUX_ASSERT(m_interactionTracker);
02788
02789     const bool isHorizontalDimension = dimension == ScrollPresenterDimension::HorizontalScroll;
02790     const bool isRightToLeftDirection = FlowDirection() == winrt::FlowDirection::RightToLeft;
02791     const float xamlLayoutOffset = isHorizontalDimension ? m_contentLayoutOffsetX : m_contentLayoutOffsetY;
02792
02793     // Note that resetting to 'nullptr' when xamlLayoutOffset is 0 and isRightToLeftDirection is False is not working, so the branch below
02794     // is used instead when flowDirectionChanged is True.
02795     if (xamlLayoutOffset == 0.0f && !(isHorizontalDimension && (isRightToLeftDirection || flowDirectionChanged)))
02796     {
02797         if (isHorizontalDimension)
02798         {
02799             visualInteractionSource.ConfigureCenterPointXModifiers(nullptr);
02800             m_interactionTracker.ConfigureCenterPointXInertiaModifiers(nullptr);
02801         }
02802         else
02803         {
02804             visualInteractionSource.ConfigureCenterPointYModifiers(nullptr);
02805             m_interactionTracker.ConfigureCenterPointYInertiaModifiers(nullptr);
02806         }
02807     }
02808     else
02809     {
02810         winrt::Compositor compositor = visualInteractionSource.Compositor();
02811         winrt::ExpressionAnimation conditionCenterPointModifier = compositor.CreateExpressionAnimation(L"true");
02812         winrt::CompositionConditionalValue conditionValueCenterPointModifier = winrt::CompositionConditionalValue::Create(compositor);
02813         winrt::hstring valueCenterPointModifierExpression;
02814
02815         if (isHorizontalDimension)
02816         {
02817             valueCenterPointModifierExpression = isRightToLeftDirection ? L"-visualInteractionSource.CenterPoint.X + xamlLayoutOffset" : L"visualInteractionSource.CenterPoint.X - xamlLayoutOffset";
02818         }
02819         else
02820         {
02821             valueCenterPointModifierExpression = L"visualInteractionSource.CenterPoint.Y - xamlLayoutOffset";
02822         }
02823
02824         winrt::ExpressionAnimation valueCenterPointModifier = compositor.CreateExpressionAnimation(valueCenterPointModifierExpression);
02825
02826         valueCenterPointModifier.SetReferenceParameter(L"visualInteractionSource", visualInteractionSource);
02827         valueCenterPointModifier.SetScalarParameter(L"xamlLayoutOffset", xamlLayoutOffset);
02828
02829         conditionValueCenterPointModifier.Condition(conditionCenterPointModifier);
02830         conditionValueCenterPointModifier.Value(valueCenterPointModifier);
02831
02832         auto centerPointModifiers = winrt::single_threaded_vector<winrt::CompositionConditionalValue>();
02833         centerPointModifiers.Append(conditionValueCenterPointModifier);
02834
02835         if (isHorizontalDimension)
02836         {
02837             visualInteractionSource.ConfigureCenterPointXModifiers(centerPointModifiers);
02838             m_interactionTracker.ConfigureCenterPointXInertiaModifiers(centerPointModifiers);
02839         }
02840         else
02841         {
02842             visualInteractionSource.ConfigureCenterPointYModifiers(centerPointModifiers);
02843             m_interactionTracker.ConfigureCenterPointYInertiaModifiers(centerPointModifiers);
02844         }
02845     }
02846 }
02847
02848 winrt::ScrollingScrollMode ScrollPresenter::GetComputedScrollMode(ScrollPresenterDimension dimension, bool ignoreZoomMode)
02849 {
02850     winrt::ScrollingScrollMode oldComputedScrollMode;
02851     winrt::ScrollingScrollMode newComputedScrollMode;
02852
02853     if (dimension == ScrollPresenterDimension::HorizontalScroll)
02854     {
02855         oldComputedScrollMode = ComputedHorizontalScrollMode();
02856         newComputedScrollMode = HorizontalScrollMode();
02857     }
02858     else
02859     {
02860         MUX_ASSERT(dimension == ScrollPresenterDimension::VerticalScroll);
02861         oldComputedScrollMode = ComputedVerticalScrollMode();
02862         newComputedScrollMode = VerticalScrollMode();
02863     }
02864
02865     if (newComputedScrollMode == winrt::ScrollingScrollMode::Auto)
02866     {
02867         if (!ignoreZoomMode && ZoomMode() == winrt::ScrollingZoomMode::Enabled)
02868         {
02869             // Allow scrolling when zooming is turned on so that the Content does not get stuck in the given dimension
02870             // when it becomes smaller than the viewport.
02871             newComputedScrollMode = winrt::ScrollingScrollMode::Enabled;
02872         }
02873         else
02874         {
02875             if (dimension == ScrollPresenterDimension::HorizontalScroll)
02876             {
02877                 // Enable horizontal scrolling only when the Content's width is larger than the ScrollPresenter's width
02878                 newComputedScrollMode = ScrollableWidth() > 0.0 ? winrt::ScrollingScrollMode::Enabled : winrt::ScrollingScrollMode::Disabled;
02879             }
02880             else
02881             {
02882                 // Enable vertical scrolling only when the Content's height is larger than the ScrollPresenter's height
02883                 newComputedScrollMode = ScrollableHeight() > 0.0 ? winrt::ScrollingScrollMode::Enabled : winrt::ScrollingScrollMode::Disabled;
02884             }
02885         }
02886     }
02887
02888     if (oldComputedScrollMode != newComputedScrollMode)
02889     {
02890         if (dimension == ScrollPresenterDimension::HorizontalScroll)
02891         {
02892             SetValue(s_ComputedHorizontalScrollModeProperty, box_value(newComputedScrollMode));
02893         }
02894         else
02895         {
02896             SetValue(s_ComputedVerticalScrollModeProperty, box_value(newComputedScrollMode));
02897         }
02898     }
02899
02900     return newComputedScrollMode;
02901 }
02902
02903 #ifdef IsMouseWheelScrollDisabled
02904 winrt::ScrollingScrollMode ScrollPresenter::GetComputedMouseWheelScrollMode(ScrollPresenterDimension dimension)
02905 {
02906     // TODO: c.f. Task 18569498 - Consider public IsMouseWheelHorizontalScrollDisabled/IsMouseWheelVerticalScrollDisabled properties
02907     return GetComputedScrollMode(dimension);
02908 }
02909 #endif
02910
02911 #ifdef IsMouseWheelZoomDisabled
02912 winrt::ScrollingZoomMode ScrollPresenter::GetMouseWheelZoomMode()
02913 {
02914     // TODO: c.f. Task 18569498 - Consider public IsMouseWheelZoomDisabled properties
02915     return ZoomMode();
02916 }
02917 #endif
02918
02919 double ScrollPresenter::GetComputedMaxWidth(
02920     double defaultMaxWidth,
02921     const winrt::FrameworkElement& content) const
02922 {
02923     MUX_ASSERT(content);
02924
02925     const winrt::Thickness contentMargin = content.Margin();
02926     const double marginWidth = contentMargin.Left + contentMargin.Right;
02927     double computedMaxWidth = defaultMaxWidth;
02928     double width = content.Width();
02929     double minWidth = content.MinWidth();
02930     double maxWidth = content.MaxWidth();
02931
02932     if (!isnan(width))
02933     {
02934         width = std::max(0.0, width + marginWidth);
02935         computedMaxWidth = width;
02936     }
02937     if (!isnan(minWidth))
02938     {
02939         minWidth = std::max(0.0, minWidth + marginWidth);
02940         computedMaxWidth = std::max(computedMaxWidth, minWidth);
02941     }
02942     if (!isnan(maxWidth))
02943     {
02944         maxWidth = std::max(0.0, maxWidth + marginWidth);
02945         computedMaxWidth = std::min(computedMaxWidth, maxWidth);
02946     }
02947
02948     return computedMaxWidth;
02949 }
02950
02951 double ScrollPresenter::GetComputedMaxHeight(
02952     double defaultMaxHeight,
02953     const winrt::FrameworkElement& content) const
02954 {
02955     MUX_ASSERT(content);
02956
02957     const winrt::Thickness contentMargin = content.Margin();
02958     const double marginHeight = contentMargin.Top + contentMargin.Bottom;
02959     double computedMaxHeight = defaultMaxHeight;
02960     double height = content.Height();
02961     double minHeight = content.MinHeight();
02962     double maxHeight = content.MaxHeight();
02963
02964     if (!isnan(height))
02965     {
02966         height = std::max(0.0, height + marginHeight);
02967         computedMaxHeight = height;
02968     }
02969     if (!isnan(minHeight))
02970     {
02971         minHeight = std::max(0.0, minHeight + marginHeight);
02972         computedMaxHeight = std::max(computedMaxHeight, minHeight);
02973     }
02974     if (!isnan(maxHeight))
02975     {
02976         maxHeight = std::max(0.0, maxHeight + marginHeight);
02977         computedMaxHeight = std::min(computedMaxHeight, maxHeight);
02978     }
02979
02980     return computedMaxHeight;
02981 }
02982
02983 // Computes the content's layout offsets at zoomFactor 1 coming from the Margin property and the difference between the extent and render sizes.
02984 winrt::float2 ScrollPresenter::GetArrangeRenderSizesDelta(
02985     const winrt::UIElement& content) const
02986 {
02987     MUX_ASSERT(content);
02988
02989     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"m_unzoomedExtentWidth", m_unzoomedExtentWidth);
02990     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"m_unzoomedExtentHeight", m_unzoomedExtentHeight);
02991     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"content.RenderSize().Width", content.RenderSize().Width);
02992     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"content.RenderSize().Height", content.RenderSize().Height);
02993
02994     double deltaX = m_unzoomedExtentWidth - content.RenderSize().Width;
02995     double deltaY = m_unzoomedExtentHeight - content.RenderSize().Height;
02996
02997     const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
02998
02999     if (contentAsFE)
03000     {
03001         const winrt::HorizontalAlignment horizontalAlignment = contentAsFE.HorizontalAlignment();
03002         const winrt::VerticalAlignment verticalAlignment = contentAsFE.VerticalAlignment();
03003         const winrt::Thickness contentMargin = contentAsFE.Margin();
03004
03005         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"horizontalAlignment", horizontalAlignment);
03006         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"verticalAlignment", verticalAlignment);
03007         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"contentMargin.Left", contentMargin.Left);
03008         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"contentMargin.Right", contentMargin.Right);
03009         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"contentMargin.Top", contentMargin.Top);
03010         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"contentMargin.Bottom", contentMargin.Bottom);
03011
03012         if (horizontalAlignment == winrt::HorizontalAlignment::Left)
03013         {
03014             deltaX = 0.0f;
03015         }
03016         else
03017         {
03018             deltaX -= contentMargin.Left + contentMargin.Right;
03019         }
03020
03021         if (verticalAlignment == winrt::VerticalAlignment::Top)
03022         {
03023             deltaY = 0.0f;
03024         }
03025         else
03026         {
03027             deltaY -= contentMargin.Top + contentMargin.Bottom;
03028         }
03029
03030         if (horizontalAlignment == winrt::HorizontalAlignment::Center ||
03031             horizontalAlignment == winrt::HorizontalAlignment::Stretch)
03032         {
03033             deltaX /= 2.0f;
03034         }
03035
03036         if (verticalAlignment == winrt::VerticalAlignment::Center ||
03037             verticalAlignment == winrt::VerticalAlignment::Stretch)
03038         {
03039             deltaY /= 2.0f;
03040         }
03041
03042         deltaX += contentMargin.Left;
03043         deltaY += contentMargin.Top;
03044     }
03045
03046     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"deltaX", deltaX);
03047     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"deltaY", deltaY);
03048
03049     return winrt::float2{ static_cast<float>(deltaX), static_cast<float>(deltaY) };
03050 }
03051
03052 // Returns the expression for the m_minPositionExpressionAnimation animation based on the Content.HorizontalAlignment,
03053 // Content.VerticalAlignment, InteractionTracker.Scale, Content arrange size (which takes Content.Margin into account) and
03054 // ScrollPresenterVisual.Size properties.
03055 winrt::hstring ScrollPresenter::GetMinPositionExpression(
03056     const winrt::UIElement& content) const
03057 {
03058     return StringUtil::FormatString(L"Vector3(%1!s!, %2!s!, 0.0f)", GetMinPositionXExpression(content).c_str(), GetMinPositionYExpression(content).c_str());
03059 }
03060
03061 winrt::hstring ScrollPresenter::GetMinPositionXExpression(
03062     const winrt::UIElement& content) const
03063 {
03064     MUX_ASSERT(content);
03065
03066     const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
03067
03068     if (FlowDirection() == winrt::FlowDirection::RightToLeft)
03069     {
03070         if (contentAsFE)
03071         {
03072             const std::wstring_view maxOffset{ L"(contentSizeX * it.Scale - scrollPresenterVisual.Size.X)" };
03073
03074             if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center ||
03075                 contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch)
03076             {
03077                 return StringUtil::FormatString(L"%1!s! >= 0 ? -%1!s! - contentLayoutOffsetX : -%1!s! / 2.0f - contentLayoutOffsetX", maxOffset.data());
03078             }
03079             else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right)
03080             {
03081                 return StringUtil::FormatString(L"-%1!s! - contentLayoutOffsetX", maxOffset.data());
03082             }
03083         }
03084
03085         return winrt::hstring(L"-Max(0.0f, contentSizeX * it.Scale - scrollPresenterVisual.Size.X) - contentLayoutOffsetX");
03086     }
03087
03088     if (contentAsFE)
03089     {
03090         const std::wstring_view maxOffset{ L"contentSizeX * it.Scale - scrollPresenterVisual.Size.X" };
03091
03092         if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center ||
03093             contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch)
03094         {
03095             return StringUtil::FormatString(L"Min(0.0f, (%1!s!) / 2.0f) + contentLayoutOffsetX", maxOffset.data());
03096         }
03097         else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right)
03098         {
03099             return StringUtil::FormatString(L"Min(0.0f, %1!s!) + contentLayoutOffsetX", maxOffset.data());
03100         }
03101     }
03102
03103     return winrt::hstring(L"contentLayoutOffsetX");
03104 }
03105
03106 winrt::hstring ScrollPresenter::GetMinPositionYExpression(
03107     const winrt::UIElement& content) const
03108 {
03109     MUX_ASSERT(content);
03110
03111     const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
03112
03113     if (contentAsFE)
03114     {
03115         const std::wstring_view maxOffset{ L"contentSizeY * it.Scale - scrollPresenterVisual.Size.Y" };
03116
03117         if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center ||
03118             contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch)
03119         {
03120             return StringUtil::FormatString(L"Min(0.0f, (%1!s!) / 2.0f) + contentLayoutOffsetY", maxOffset.data());
03121         }
03122         else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom)
03123         {
03124             return StringUtil::FormatString(L"Min(0.0f, %1!s!) + contentLayoutOffsetY", maxOffset.data());
03125         }
03126     }
03127
03128     return winrt::hstring(L"contentLayoutOffsetY");
03129 }
03130
03131 // Returns the expression for the m_maxPositionExpressionAnimation animation based on the Content.HorizontalAlignment,
03132 // Content.VerticalAlignment, InteractionTracker.Scale, Content arrange size (which takes Content.Margin into account) and
03133 // ScrollPresenterVisual.Size properties.
03134 winrt::hstring ScrollPresenter::GetMaxPositionExpression(
03135     const winrt::UIElement& content) const
03136 {
03137     return StringUtil::FormatString(L"Vector3(%1!s!, %2!s!, 0.0f)", GetMaxPositionXExpression(content).c_str(), GetMaxPositionYExpression(content).c_str());
03138 }
03139
03140 winrt::hstring ScrollPresenter::GetMaxPositionXExpression(
03141     const winrt::UIElement& content) const
03142 {
03143     MUX_ASSERT(content);
03144
03145     const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
03146
03147     if (FlowDirection() == winrt::FlowDirection::RightToLeft)
03148     {
03149         if (contentAsFE)
03150         {
03151             const std::wstring_view maxOffset{ L"contentSizeX * it.Scale - scrollPresenterVisual.Size.X" };
03152
03153             if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center ||
03154                 contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch)
03155             {
03156                 return StringUtil::FormatString(L"-Min(0.0f, (%1!s!) / 2.0f) - contentLayoutOffsetX", maxOffset.data());
03157             }
03158             else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right)
03159             {
03160                 return StringUtil::FormatString(L"-Min(0.0f, %1!s!) - contentLayoutOffsetX", maxOffset.data());
03161             }
03162         }
03163
03164         return winrt::hstring(L"-contentLayoutOffsetX");
03165     }
03166
03167     if (contentAsFE)
03168     {
03169         const std::wstring_view maxOffset{ L"(contentSizeX * it.Scale - scrollPresenterVisual.Size.X)" };
03170
03171         if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center ||
03172             contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch)
03173         {
03174             return StringUtil::FormatString(L"%1!s! >= 0 ? %1!s! + contentLayoutOffsetX : %1!s! / 2.0f + contentLayoutOffsetX", maxOffset.data());
03175         }
03176         else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right)
03177         {
03178             return StringUtil::FormatString(L"%1!s! + contentLayoutOffsetX", maxOffset.data());
03179         }
03180     }
03181
03182     return winrt::hstring(L"Max(0.0f, contentSizeX * it.Scale - scrollPresenterVisual.Size.X) + contentLayoutOffsetX");
03183 }
03184
03185 winrt::hstring ScrollPresenter::GetMaxPositionYExpression(
03186     const winrt::UIElement& content) const
03187 {
03188     MUX_ASSERT(content);
03189
03190     const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
03191
03192     if (contentAsFE)
03193     {
03194         const std::wstring_view maxOffset{ L"(contentSizeY * it.Scale - scrollPresenterVisual.Size.Y)" };
03195
03196         if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center ||
03197             contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch)
03198         {
03199             return StringUtil::FormatString(L"%1!s! >= 0 ? %1!s! + contentLayoutOffsetY : %1!s! / 2.0f + contentLayoutOffsetY", maxOffset.data());
03200         }
03201         else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom)
03202         {
03203             return StringUtil::FormatString(L"%1!s! + contentLayoutOffsetY", maxOffset.data());
03204         }
03205     }
03206
03207     return winrt::hstring(L"Max(0.0f, contentSizeY * it.Scale - scrollPresenterVisual.Size.Y) + contentLayoutOffsetY");
03208 }
03209
03210 winrt::CompositionAnimation ScrollPresenter::GetPositionAnimation(
03211     double zoomedHorizontalOffset,
03212     double zoomedVerticalOffset,
03213     InteractionTrackerAsyncOperationTrigger operationTrigger,
03214     int32_t offsetsChangeCorrelationId)
03215 {
03216     MUX_ASSERT(m_interactionTracker);
03217
03218     int64_t minDuration = s_offsetsChangeMinMs;
03219     int64_t maxDuration = s_offsetsChangeMaxMs;
03220     int64_t unitDuration = s_offsetsChangeMsPerUnit;
03221     const bool isHorizontalScrollControllerRequest = static_cast<char>(operationTrigger) & static_cast<char>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest);
03222     const bool isVerticalScrollControllerRequest = static_cast<char>(operationTrigger) & static_cast<char>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest);
03223     const int64_t distance = static_cast<int64_t>(sqrt(pow(zoomedHorizontalOffset - m_zoomedHorizontalOffset, 2.0) + pow(zoomedVerticalOffset - m_zoomedVerticalOffset, 2.0)));
03224     const winrt::Compositor compositor = winrt::ElementCompositionPreview::GetElementVisual(*this).Compositor();
03225     winrt::Vector3KeyFrameAnimation positionAnimation = compositor.CreateVector3KeyFrameAnimation();
03226     com_ptr<ScrollPresenterTestHooks> globalTestHooks = ScrollPresenterTestHooks::GetGlobalTestHooks();
03227
03228     if (globalTestHooks)
03229     {
03230         int unitDurationTestOverride;
03231         int minDurationTestOverride;
03232         int maxDurationTestOverride;
03233
03234         globalTestHooks->GetOffsetsChangeVelocityParameters(unitDurationTestOverride, minDurationTestOverride, maxDurationTestOverride);
03235
03236         minDuration = minDurationTestOverride;
03237         maxDuration = maxDurationTestOverride;
03238         unitDuration = unitDurationTestOverride;
03239     }
03240
03241     const winrt::float2 endPosition = ComputePositionFromOffsets(zoomedHorizontalOffset, zoomedVerticalOffset);
03242
03243     positionAnimation.InsertKeyFrame(1.0f, winrt::float3(endPosition, 0.0f));
03244     positionAnimation.Duration(winrt::TimeSpan::duration(std::clamp(distance * unitDuration, minDuration, maxDuration) * 10000));
03245
03246     const winrt::float2 startPosition{ m_interactionTracker.Position().x, m_interactionTracker.Position().y };
03247
03248     if (isHorizontalScrollControllerRequest || isVerticalScrollControllerRequest)
03249     {
03250         winrt::CompositionAnimation customAnimation = nullptr;
03251
03252         if (isHorizontalScrollControllerRequest && m_horizontalScrollController)
03253         {
03254             customAnimation = m_horizontalScrollController.get().GetScrollAnimation(
03255                 offsetsChangeCorrelationId,
03256                 startPosition,
03257                 endPosition,
03258                 positionAnimation);
03259         }
03260         if (isVerticalScrollControllerRequest && m_verticalScrollController)
03261         {
03262             customAnimation = m_verticalScrollController.get().GetScrollAnimation(
03263                 offsetsChangeCorrelationId,
03264                 startPosition,
03265                 endPosition,
03266                 customAnimation ? customAnimation : positionAnimation);
03267         }
03268         return customAnimation ? customAnimation : positionAnimation;
03269     }
03270
03271     return RaiseScrollAnimationStarting(positionAnimation, startPosition, endPosition, offsetsChangeCorrelationId);
03272 }
03273
03274 winrt::CompositionAnimation ScrollPresenter::GetZoomFactorAnimation(
03275     float zoomFactor,
03276     const winrt::float2& centerPoint,
03277     int32_t zoomFactorChangeCorrelationId)
03278 {
03279     int64_t minDuration = s_zoomFactorChangeMinMs;
03280     int64_t maxDuration = s_zoomFactorChangeMaxMs;
03281     int64_t unitDuration = s_zoomFactorChangeMsPerUnit;
03282     const int64_t distance = static_cast<int64_t>(abs(zoomFactor - m_zoomFactor));
03283     const winrt::Compositor compositor = winrt::ElementCompositionPreview::GetElementVisual(*this).Compositor();
03284     winrt::ScalarKeyFrameAnimation zoomFactorAnimation = compositor.CreateScalarKeyFrameAnimation();
03285     com_ptr<ScrollPresenterTestHooks> globalTestHooks = ScrollPresenterTestHooks::GetGlobalTestHooks();
03286
03287     if (globalTestHooks)
03288     {
03289         int unitDurationTestOverride;
03290         int minDurationTestOverride;
03291         int maxDurationTestOverride;
03292
03293         globalTestHooks->GetZoomFactorChangeVelocityParameters(unitDurationTestOverride, minDurationTestOverride, maxDurationTestOverride);
03294
03295         minDuration = minDurationTestOverride;
03296         maxDuration = maxDurationTestOverride;
03297         unitDuration = unitDurationTestOverride;
03298     }
03299
03300     zoomFactorAnimation.InsertKeyFrame(1.0f, zoomFactor);
03301     zoomFactorAnimation.Duration(winrt::TimeSpan::duration(std::clamp(distance * unitDuration, minDuration, maxDuration) * 10000));
03302
03303     return RaiseZoomAnimationStarting(zoomFactorAnimation, zoomFactor, centerPoint, zoomFactorChangeCorrelationId);
03304 }
03305
03306 int32_t ScrollPresenter::GetNextViewChangeCorrelationId()
03307 {
03308     return (m_latestViewChangeCorrelationId == std::numeric_limits<int>::max()) ? 0 : m_latestViewChangeCorrelationId + 1;
03309 }
03310
03311 void ScrollPresenter::SetupPositionBoundariesExpressionAnimations(
03312     const winrt::UIElement& content)
03313 {
03314     MUX_ASSERT(content);
03315     MUX_ASSERT(m_minPositionExpressionAnimation);
03316     MUX_ASSERT(m_maxPositionExpressionAnimation);
03317     MUX_ASSERT(m_interactionTracker);
03318
03319     const winrt::Visual scrollPresenterVisual = winrt::ElementCompositionPreview::GetElementVisual(*this);
03320
03321     winrt::hstring s = m_minPositionExpressionAnimation.Expression();
03322
03323     if (s.empty())
03324     {
03325         m_minPositionExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
03326         m_minPositionExpressionAnimation.SetReferenceParameter(L"scrollPresenterVisual", scrollPresenterVisual);
03327     }
03328
03329     m_minPositionExpressionAnimation.Expression(GetMinPositionExpression(content));
03330
03331     s = m_maxPositionExpressionAnimation.Expression();
03332
03333     if (s.empty())
03334     {
03335         m_maxPositionExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
03336         m_maxPositionExpressionAnimation.SetReferenceParameter(L"scrollPresenterVisual", scrollPresenterVisual);
03337     }
03338
03339     m_maxPositionExpressionAnimation.Expression(GetMaxPositionExpression(content));
03340
03341     UpdatePositionBoundaries(content);
03342 }
03343
03344 void ScrollPresenter::SetupTransformExpressionAnimations(
03345     const winrt::UIElement& content)
03346 {
03347     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
03348
03349     MUX_ASSERT(content);
03350     MUX_ASSERT(m_translationExpressionAnimation);
03351     MUX_ASSERT(m_zoomFactorExpressionAnimation);
03352     MUX_ASSERT(m_interactionTracker);
03353
03354     const winrt::float2 arrangeRenderSizesDelta = GetArrangeRenderSizesDelta(content);
03355     const bool isRightToLeftDirection = FlowDirection() == winrt::FlowDirection::RightToLeft;
03356     const bool isContentImage = content.try_as<winrt::Image>() != nullptr;
03357     winrt::hstring translationExpression;
03358
03359     if (isRightToLeftDirection)
03360     {
03361         if (isContentImage)
03362         {
03363             m_translationExpressionAnimation.SetScalarParameter(L"contentSizeX", static_cast<float>(m_unzoomedExtentWidth));
03364             translationExpression = L"Vector3(it.Position.X + (it.Scale - 1.0f) * (adjustment.X + contentSizeX), -it.Position.Y + (it.Scale - 1.0f) * adjustment.Y, 0.0f)";
03365         }
03366         else
03367         {
03368             translationExpression = L"Vector3(it.Position.X + (it.Scale - 1.0f) * adjustment.X, -it.Position.Y + (it.Scale - 1.0f) * adjustment.Y, 0.0f)";
03369         }
03370     }
03371     else
03372     {
03373         translationExpression = L"Vector3(-it.Position.X + (it.Scale - 1.0f) * adjustment.X, -it.Position.Y + (it.Scale - 1.0f) * adjustment.Y, 0.0f)";
03374     }
03375
03376     m_translationExpressionAnimation.Expression(translationExpression);
03377
03378     m_translationExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
03379     m_translationExpressionAnimation.SetVector2Parameter(L"adjustment", arrangeRenderSizesDelta);
03380
03381     m_zoomFactorExpressionAnimation.Expression(L"Vector3(it.Scale, it.Scale, 1.0f)");
03382     m_zoomFactorExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker);
03383
03384     StartTransformExpressionAnimations(content);
03385 }
03386
03387 void ScrollPresenter::StartTransformExpressionAnimations(
03388     const winrt::UIElement& content)
03389 {
03390     if (content)
03391     {
03392         auto const zoomFactorPropertyName = GetVisualTargetedPropertyName(ScrollPresenterDimension::ZoomFactor);
03393         auto const scrollPropertyName = GetVisualTargetedPropertyName(ScrollPresenterDimension::Scroll);
03394
03395         m_translationExpressionAnimation.Target(scrollPropertyName);
03396         m_zoomFactorExpressionAnimation.Target(zoomFactorPropertyName);
03397
03398         content.StartAnimation(m_translationExpressionAnimation);
03399         RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, scrollPropertyName /*propertyName*/);
03400
03401         content.StartAnimation(m_zoomFactorExpressionAnimation);
03402         RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, zoomFactorPropertyName /*propertyName*/);
03403     }
03404 }
03405
03406 void ScrollPresenter::StopTransformExpressionAnimations(
03407     const winrt::UIElement& content)
03408 {
03409     if (content)
03410     {
03411         auto const scrollPropertyName = GetVisualTargetedPropertyName(ScrollPresenterDimension::Scroll);
03412
03413         content.StopAnimation(m_translationExpressionAnimation);
03414         RaiseExpressionAnimationStatusChanged(false /*isExpressionAnimationStarted*/, scrollPropertyName /*propertyName*/);
03415
03416         auto const zoomFactorPropertyName = GetVisualTargetedPropertyName(ScrollPresenterDimension::ZoomFactor);
03417
03418         content.StopAnimation(m_zoomFactorExpressionAnimation);
03419         RaiseExpressionAnimationStatusChanged(false /*isExpressionAnimationStarted*/, zoomFactorPropertyName /*propertyName*/);
03420     }
03421 }
03422
03423 // Returns True when ScrollPresenter::OnCompositionTargetRendering calls are not needed for restarting the Translation and Scale animations.
03424 bool ScrollPresenter::StartTranslationAndZoomFactorExpressionAnimations(bool interruptCountdown)
03425 {
03426     if (m_translationAndZoomFactorAnimationsRestartTicksCountdown > 0)
03427     {
03428         // A Translation and Scale animations restart is pending after the Idle State was reached or a zoom factor change operation completed.
03429         m_translationAndZoomFactorAnimationsRestartTicksCountdown--;
03430
03431         if (m_translationAndZoomFactorAnimationsRestartTicksCountdown == 0 || interruptCountdown)
03432         {
03433             // Countdown is over or state is no longer Idle, restart the Translation and Scale animations.
03434             MUX_ASSERT(m_interactionTracker);
03435
03436             SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, m_animationRestartZoomFactor, m_zoomFactor);
03437
03438             if (m_translationAndZoomFactorAnimationsRestartTicksCountdown > 0)
03439             {
03440                 MUX_ASSERT(interruptCountdown);
03441
03442                 SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, m_translationAndZoomFactorAnimationsRestartTicksCountdown);
03443                 m_translationAndZoomFactorAnimationsRestartTicksCountdown = 0;
03444             }
03445
03446             StartTransformExpressionAnimations(Content());
03447         }
03448         else
03449         {
03450             // Countdown needs to continue.
03451             return false;
03452         }
03453     }
03454
03455     return true;
03456 }
03457
03458 void ScrollPresenter::StopTranslationAndZoomFactorExpressionAnimations()
03459 {
03460     if (m_zoomFactorExpressionAnimation && m_animationRestartZoomFactor != m_zoomFactor)
03461     {
03462         // The zoom factor has changed since the last restart of the Translation and Scale animations.
03463         const winrt::UIElement content = Content();
03464
03465         if (m_translationAndZoomFactorAnimationsRestartTicksCountdown == 0)
03466         {
03467             SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, m_animationRestartZoomFactor, m_zoomFactor);
03468
03469             // Stop Translation and Scale animations to trigger rasterization of Content, to avoid fuzzy text rendering for instance.
03470             StopTransformExpressionAnimations(content);
03471
03472             // Trigger ScrollPresenter::OnCompositionTargetRendering calls in order to re-establish the Translation and Scale animations
03473             // after the Content rasterization was triggered within a few ticks.
03474             HookCompositionTargetRendering();
03475         }
03476
03477         m_animationRestartZoomFactor = m_zoomFactor;
03478         m_translationAndZoomFactorAnimationsRestartTicksCountdown = s_translationAndZoomFactorAnimationsRestartTicks;
03479     }
03480 }
03481
03482 void ScrollPresenter::StartExpressionAnimationSourcesAnimations()
03483 {
03484     MUX_ASSERT(m_interactionTracker);
03485     MUX_ASSERT(m_expressionAnimationSources);
03486     MUX_ASSERT(m_positionSourceExpressionAnimation);
03487     MUX_ASSERT(m_minPositionSourceExpressionAnimation);
03488     MUX_ASSERT(m_maxPositionSourceExpressionAnimation);
03489     MUX_ASSERT(m_zoomFactorSourceExpressionAnimation);
03490
03491     m_expressionAnimationSources.StartAnimation(s_positionSourcePropertyName, m_positionSourceExpressionAnimation);
03492     RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_positionSourcePropertyName /*propertyName*/);
03493
03494     m_expressionAnimationSources.StartAnimation(s_minPositionSourcePropertyName, m_minPositionSourceExpressionAnimation);
03495     RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_minPositionSourcePropertyName /*propertyName*/);
03496
03497     m_expressionAnimationSources.StartAnimation(s_maxPositionSourcePropertyName, m_maxPositionSourceExpressionAnimation);
03498     RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_maxPositionSourcePropertyName /*propertyName*/);
03499
03500     m_expressionAnimationSources.StartAnimation(s_zoomFactorSourcePropertyName, m_zoomFactorSourceExpressionAnimation);
03501     RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_zoomFactorSourcePropertyName /*propertyName*/);
03502 }
03503
03504 void ScrollPresenter::StartScrollControllerExpressionAnimationSourcesAnimations(
03505     ScrollPresenterDimension dimension)
03506 {
03507     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
03508
03509     if (dimension == ScrollPresenterDimension::HorizontalScroll)
03510     {
03511         MUX_ASSERT(m_horizontalScrollControllerExpressionAnimationSources);
03512         MUX_ASSERT(m_horizontalScrollControllerOffsetExpressionAnimation);
03513         MUX_ASSERT(m_horizontalScrollControllerMaxOffsetExpressionAnimation);
03514
03515         m_horizontalScrollControllerExpressionAnimationSources.StartAnimation(s_offsetPropertyName, m_horizontalScrollControllerOffsetExpressionAnimation);
03516         RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_offsetPropertyName /*propertyName*/);
03517
03518         m_horizontalScrollControllerExpressionAnimationSources.StartAnimation(s_maxOffsetPropertyName, m_horizontalScrollControllerMaxOffsetExpressionAnimation);
03519         RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_maxOffsetPropertyName /*propertyName*/);
03520     }
03521     else
03522     {
03523         MUX_ASSERT(m_verticalScrollControllerExpressionAnimationSources);
03524         MUX_ASSERT(m_verticalScrollControllerOffsetExpressionAnimation);
03525         MUX_ASSERT(m_verticalScrollControllerMaxOffsetExpressionAnimation);
03526
03527         m_verticalScrollControllerExpressionAnimationSources.StartAnimation(s_offsetPropertyName, m_verticalScrollControllerOffsetExpressionAnimation);
03528         RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_offsetPropertyName /*propertyName*/);
03529
03530         m_verticalScrollControllerExpressionAnimationSources.StartAnimation(s_maxOffsetPropertyName, m_verticalScrollControllerMaxOffsetExpressionAnimation);
03531         RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_maxOffsetPropertyName /*propertyName*/);
03532     }
03533 }
03534
03535 void ScrollPresenter::StopScrollControllerExpressionAnimationSourcesAnimations(
03536     ScrollPresenterDimension dimension)
03537 {
03538     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
03539
03540     if (dimension == ScrollPresenterDimension::HorizontalScroll)
03541     {
03542         MUX_ASSERT(m_horizontalScrollControllerExpressionAnimationSources);
03543
03544         m_horizontalScrollControllerExpressionAnimationSources.StopAnimation(s_offsetPropertyName);
03545         RaiseExpressionAnimationStatusChanged(false /*isExpressionAnimationStarted*/, s_offsetPropertyName /*propertyName*/);
03546
03547         m_horizontalScrollControllerExpressionAnimationSources.StopAnimation(s_maxOffsetPropertyName);
03548         RaiseExpressionAnimationStatusChanged(false /*isExpressionAnimationStarted*/, s_maxOffsetPropertyName /*propertyName*/);
03549     }
03550     else
03551     {
03552         MUX_ASSERT(m_verticalScrollControllerExpressionAnimationSources);
03553
03554         m_verticalScrollControllerExpressionAnimationSources.StopAnimation(s_offsetPropertyName);
03555         RaiseExpressionAnimationStatusChanged(false /*isExpressionAnimationStarted*/, s_offsetPropertyName /*propertyName*/);
03556
03557         m_verticalScrollControllerExpressionAnimationSources.StopAnimation(s_maxOffsetPropertyName);
03558         RaiseExpressionAnimationStatusChanged(false /*isExpressionAnimationStarted*/, s_maxOffsetPropertyName /*propertyName*/);
03559     }
03560 }
03561
03562 winrt::InteractionChainingMode ScrollPresenter::InteractionChainingModeFromChainingMode(
03563     const winrt::ScrollingChainMode& chainingMode)
03564 {
03565     switch (chainingMode)
03566     {
03567     case winrt::ScrollingChainMode::Always:
03568         return winrt::InteractionChainingMode::Always;
03569     case winrt::ScrollingChainMode::Auto:
03570         return winrt::InteractionChainingMode::Auto;
03571     default:
03572         return winrt::InteractionChainingMode::Never;
03573     }
03574 }
03575
03576 #ifdef IsMouseWheelScrollDisabled
03577 winrt::InteractionSourceRedirectionMode ScrollPresenter::InteractionSourceRedirectionModeFromScrollMode(
03578     const winrt::ScrollingScrollMode& scrollMode)
03579 {
03580     MUX_ASSERT(scrollMode == winrt::ScrollingScrollMode::Enabled || scrollMode == winrt::ScrollingScrollMode::Disabled);
03581
03582     return scrollMode == winrt::ScrollingScrollMode::Enabled ? winrt::InteractionSourceRedirectionMode::Enabled : winrt::InteractionSourceRedirectionMode::Disabled;
03583 }
03584 #endif
03585
03586 #ifdef IsMouseWheelZoomDisabled
03587 winrt::InteractionSourceRedirectionMode ScrollPresenter::InteractionSourceRedirectionModeFromZoomMode(
03588     const winrt::ScrollingZoomMode& zoomMode)
03589 {
03590     return zoomMode == winrt::ScrollingZoomMode::Enabled ? winrt::InteractionSourceRedirectionMode::Enabled : winrt::InteractionSourceRedirectionMode::Disabled;
03591 }
03592 #endif
03593
03594 winrt::InteractionSourceMode ScrollPresenter::InteractionSourceModeFromScrollMode(
03595     const winrt::ScrollingScrollMode& scrollMode)
03596 {
03597     return scrollMode == winrt::ScrollingScrollMode::Enabled ? winrt::InteractionSourceMode::EnabledWithInertia : winrt::InteractionSourceMode::Disabled;
03598 }
03599
03600 winrt::InteractionSourceMode ScrollPresenter::InteractionSourceModeFromZoomMode(
03601     const winrt::ScrollingZoomMode& zoomMode)
03602 {
03603     return zoomMode == winrt::ScrollingZoomMode::Enabled ? winrt::InteractionSourceMode::EnabledWithInertia : winrt::InteractionSourceMode::Disabled;
03604 }
03605
03606 double ScrollPresenter::ComputeZoomedOffsetWithMinimalChange(
03607     double viewportStart,
03608     double viewportEnd,
03609     double childStart,
03610     double childEnd)
03611 {
03612     const bool above = childStart < viewportStart && childEnd < viewportEnd;
03613     const bool below = childEnd > viewportEnd&& childStart > viewportStart;
03614     const bool larger = (childEnd - childStart) > (viewportEnd - viewportStart);
03615
03616     // # CHILD POSITION   CHILD SIZE   SCROLL   REMEDY
03617     // 1 Above viewport   <= viewport  Down     Align top edge of content & viewport
03618     // 2 Above viewport   >  viewport  Down     Align bottom edge of content & viewport
03619     // 3 Below viewport   <= viewport  Up       Align bottom edge of content & viewport
03620     // 4 Below viewport   >  viewport  Up       Align top edge of content & viewport
03621     // 5 Entirely within viewport      NA       No change
03622     // 6 Spanning viewport             NA       No change
03623     if ((above && !larger) || (below && larger))
03624     {
03625         // Cases 1 & 4
03626         return childStart;
03627     }
03628     else if (above || below)
03629     {
03630         // Cases 2 & 3
03631         return childEnd - viewportEnd + viewportStart;
03632     }
03633
03634     // cases 5 & 6
03635     return viewportStart;
03636 }
03637
03638 winrt::Rect ScrollPresenter::GetDescendantBounds(
03639     const winrt::UIElement& content,
03640     const winrt::UIElement& descendant,
03641     const winrt::Rect& descendantRect)
03642 {
03643     MUX_ASSERT(content);
03644
03645     const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
03646     const winrt::GeneralTransform transform = descendant.TransformToVisual(content);
03647     winrt::Thickness contentMargin{};
03648
03649     if (contentAsFE)
03650     {
03651         contentMargin = contentAsFE.Margin();
03652     }
03653
03654     return transform.TransformBounds(winrt::Rect{
03655         static_cast<float>(contentMargin.Left + descendantRect.X),
03656         static_cast<float>(contentMargin.Top + descendantRect.Y),
03657         descendantRect.Width,
03658         descendantRect.Height });
03659 }
03660
03661 winrt::ScrollingAnimationMode ScrollPresenter::GetComputedAnimationMode(
03662     winrt::ScrollingAnimationMode const& animationMode)
03663 {
03664     if (animationMode == winrt::ScrollingAnimationMode::Auto)
03665     {
03666         const bool isAnimationsEnabled = []()
03667         {
03668             auto globalTestHooks = ScrollPresenterTestHooks::GetGlobalTestHooks();
03669
03670             if (globalTestHooks && globalTestHooks->IsAnimationsEnabledOverride())
03671             {
03672                 return globalTestHooks->IsAnimationsEnabledOverride().Value();
03673             }
03674             else
03675             {
03676                 return SharedHelpers::IsAnimationsEnabled();
03677             }
03678         }();
03679
03680         return isAnimationsEnabled ? winrt::ScrollingAnimationMode::Enabled : winrt::ScrollingAnimationMode::Disabled;
03681     }
03682
03683     return animationMode;
03684 }
03685
03686 bool ScrollPresenter::IsZoomFactorBoundaryValid(
03687     double value)
03688 {
03689     return !isnan(value) && isfinite(value);
03690 }
03691
03692 void ScrollPresenter::ValidateZoomFactoryBoundary(double value)
03693 {
03694     if (!IsZoomFactorBoundaryValid(value))
03695     {
03696         throw winrt::hresult_error(E_INVALIDARG);
03697     }
03698 }
03699
03700 // Returns the target property path, according to the availability of the ElementCompositionPreview::SetIsTranslationEnabled method,
03701 // and the provided dimension.
03702 wstring_view ScrollPresenter::GetVisualTargetedPropertyName(ScrollPresenterDimension dimension)
03703 {
03704     switch (dimension)
03705     {
03706         case ScrollPresenterDimension::Scroll:
03707             return s_translationPropertyName;
03708         default:
03709             MUX_ASSERT(dimension == ScrollPresenterDimension::ZoomFactor);
03710             return s_scalePropertyName;
03711     }
03712 }
03713
03714 // Invoked by both ScrollPresenter and ScrollViewer controls
03715 bool ScrollPresenter::IsAnchorRatioValid(
03716     double value)
03717 {
03718     return isnan(value) || (isfinite(value) && value >= 0.0 && value <= 1.0);
03719 }
03720
03721 void ScrollPresenter::ValidateAnchorRatio(double value)
03722 {
03723     if (!IsAnchorRatioValid(value))
03724     {
03725         throw winrt::hresult_error(E_INVALIDARG);
03726     }
03727 }
03728
03729 bool ScrollPresenter::IsElementValidAnchor(
03730     const winrt::UIElement& element)
03731 {
03732     return IsElementValidAnchor(element, Content());
03733 }
03734
03735 // Invoked by ScrollPresenterTestHooks
03736 void ScrollPresenter::SetContentLayoutOffsetXDbg(float contentLayoutOffsetX)
03737 {
03738     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, contentLayoutOffsetX, m_contentLayoutOffsetX);
03739
03740     if (m_contentLayoutOffsetX != contentLayoutOffsetX)
03741     {
03742         UpdateOffset(ScrollPresenterDimension::HorizontalScroll, m_zoomedHorizontalOffset - contentLayoutOffsetX + m_contentLayoutOffsetX);
03743         m_contentLayoutOffsetX = contentLayoutOffsetX;
03744         InvalidateArrange();
03745         OnContentLayoutOffsetChanged(ScrollPresenterDimension::HorizontalScroll);
03746         OnViewChanged(true /*horizontalOffsetChanged*/, false /*verticalOffsetChanged*/);
03747     }
03748 }
03749
03750 void ScrollPresenter::SetContentLayoutOffsetYDbg(float contentLayoutOffsetY)
03751 {
03752     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, contentLayoutOffsetY, m_contentLayoutOffsetY);
03753
03754     if (m_contentLayoutOffsetY != contentLayoutOffsetY)
03755     {
03756         UpdateOffset(ScrollPresenterDimension::VerticalScroll, m_zoomedVerticalOffset - contentLayoutOffsetY + m_contentLayoutOffsetY);
03757         m_contentLayoutOffsetY = contentLayoutOffsetY;
03758         InvalidateArrange();
03759         OnContentLayoutOffsetChanged(ScrollPresenterDimension::VerticalScroll);
03760         OnViewChanged(false /*horizontalOffsetChanged*/, true /*verticalOffsetChanged*/);
03761     }
03762 }
03763
03764 winrt::hstring ScrollPresenter::GetTransformExpressionAnimationExpressionDbg() const
03765 {
03766     if (m_translationExpressionAnimation)
03767     {
03768         return m_translationExpressionAnimation.Expression();
03769     }
03770
03771     return L"";
03772 }
03773
03774 void ScrollPresenter::SetTransformExpressionAnimationExpressionDbg(winrt::hstring const& transformExpressionAnimationExpression)
03775 {
03776     if (m_translationExpressionAnimation)
03777     {
03778         const winrt::UIElement content = Content();
03779
03780         StopTransformExpressionAnimations(content);
03781
03782         m_translationExpressionAnimation.Expression(transformExpressionAnimationExpression);
03783
03784         StartTransformExpressionAnimations(content);
03785     }
03786 }
03787
03788 winrt::hstring ScrollPresenter::GetMinPositionExpressionAnimationExpressionDbg() const
03789 {
03790     if (m_minPositionExpressionAnimation)
03791     {
03792         return m_minPositionExpressionAnimation.Expression();
03793     }
03794
03795     return L"";
03796 }
03797
03798 void ScrollPresenter::SetMinPositionExpressionAnimationExpressionDbg(winrt::hstring const& minPositionExpressionAnimationExpression)
03799 {
03800     if (m_minPositionExpressionAnimation)
03801     {
03802         m_minPositionExpressionAnimation.Expression(minPositionExpressionAnimationExpression);
03803
03804         if (m_interactionTracker)
03805         {
03806             m_interactionTracker.StartAnimation(s_minPositionSourcePropertyName, m_minPositionExpressionAnimation);
03807         }
03808     }
03809 }
03810
03811 winrt::hstring ScrollPresenter::GetMaxPositionExpressionAnimationExpressionDbg() const
03812 {
03813     if (m_maxPositionExpressionAnimation)
03814     {
03815         return m_maxPositionExpressionAnimation.Expression();
03816     }
03817
03818     return L"";
03819 }
03820
03821 void ScrollPresenter::SetMaxPositionExpressionAnimationExpressionDbg(winrt::hstring const& maxPositionExpressionAnimationExpression)
03822 {
03823     if (m_maxPositionExpressionAnimation)
03824     {
03825         m_maxPositionExpressionAnimation.Expression(maxPositionExpressionAnimationExpression);
03826
03827         if (m_interactionTracker)
03828         {
03829             m_interactionTracker.StartAnimation(s_maxPositionSourcePropertyName, m_maxPositionExpressionAnimation);
03830         }
03831     }
03832 }
03833
03834 winrt::float2 ScrollPresenter::GetArrangeRenderSizesDeltaDbg()
03835 {
03836     winrt::float2 arrangeRenderSizesDelta{};
03837     const winrt::UIElement content = Content();
03838
03839     if (content)
03840     {
03841         arrangeRenderSizesDelta = GetArrangeRenderSizesDelta(content);
03842     }
03843
03844     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, arrangeRenderSizesDelta.x, arrangeRenderSizesDelta.y);
03845
03846     return arrangeRenderSizesDelta;
03847 }
03848
03849 winrt::float2 ScrollPresenter::GetPositionDbg()
03850 {
03851     if (m_interactionTracker)
03852     {
03853         const winrt::float2 position{ m_interactionTracker.Position().x, m_interactionTracker.Position().y };
03854
03855         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, position.x, position.y);
03856
03857         return position;
03858     }
03859
03860     return {};
03861 }
03862
03863 winrt::float2 ScrollPresenter::GetMinPositionDbg()
03864 {
03865     winrt::float2 minPosition{};
03866
03867     ComputeMinMaxPositions(m_zoomFactor, &minPosition, nullptr);
03868
03869     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, minPosition.x, minPosition.y);
03870
03871     return minPosition;
03872 }
03873
03874 void ScrollPresenter::SetMinPositionDbg(winrt::float2 minPosition)
03875 {
03876 #ifdef DBG
03877     m_minPositionOverrideDbg = minPosition;
03878 #endif // DBG
03879 }
03880
03881 winrt::float2 ScrollPresenter::GetMaxPositionDbg()
03882 {
03883     winrt::float2 maxPosition{};
03884
03885     ComputeMinMaxPositions(m_zoomFactor, nullptr, &maxPosition);
03886
03887     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, maxPosition.x, maxPosition.y);
03888
03889     return maxPosition;
03890 }
03891
03892 void ScrollPresenter::SetMaxPositionDbg(winrt::float2 maxPosition)
03893 {
03894 #ifdef DBG
03895     m_maxPositionOverrideDbg = maxPosition;
03896 #endif // DBG
03897 }
03898
03899 winrt::IVector<winrt::ScrollSnapPointBase> ScrollPresenter::GetConsolidatedScrollSnapPointsDbg(ScrollPresenterDimension dimension)
03900 {
03901     winrt::IVector<winrt::ScrollSnapPointBase> snapPoints = winrt::make<Vector<winrt::ScrollSnapPointBase>>();
03902     std::set<std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>>, SnapPointWrapperComparator<winrt::ScrollSnapPointBase>> snapPointsSet;
03903
03904     switch (dimension)
03905     {
03906     case ScrollPresenterDimension::VerticalScroll:
03907         snapPointsSet = m_sortedConsolidatedVerticalSnapPoints;
03908         break;
03909     case ScrollPresenterDimension::HorizontalScroll:
03910         snapPointsSet = m_sortedConsolidatedHorizontalSnapPoints;
03911         break;
03912     default:
03913         MUX_ASSERT(false);
03914     }
03915
03916     for (std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>> snapPointWrapper : snapPointsSet)
03917     {
03918         snapPoints.Append(snapPointWrapper->SnapPoint());
03919     }
03920     return snapPoints;
03921 }
03922
03923 winrt::IVector<winrt::ZoomSnapPointBase> ScrollPresenter::GetConsolidatedZoomSnapPointsDbg()
03924 {
03925     winrt::IVector<winrt::ZoomSnapPointBase> snapPoints = winrt::make<Vector<winrt::ZoomSnapPointBase>>();
03926
03927     for (std::shared_ptr<SnapPointWrapper<winrt::ZoomSnapPointBase>> snapPointWrapper : m_sortedConsolidatedZoomSnapPoints)
03928     {
03929         snapPoints.Append(snapPointWrapper->SnapPoint());
03930     }
03931     return snapPoints;
03932 }
03933
03934 std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>> ScrollPresenter::GetScrollSnapPointWrapperDbg(ScrollPresenterDimension dimension, winrt::ScrollSnapPointBase const& scrollSnapPoint)
03935 {
03936     const auto& snapPointsSet = [&]()
03937     {
03938         switch (dimension)
03939         {
03940         case ScrollPresenterDimension::VerticalScroll:
03941             return m_sortedConsolidatedVerticalSnapPoints;
03942             break;
03943         case ScrollPresenterDimension::HorizontalScroll:
03944             return m_sortedConsolidatedHorizontalSnapPoints;
03945             break;
03946         default:
03947             MUX_ASSERT(false);
03948             return m_sortedConsolidatedVerticalSnapPoints;
03949         }
03950     }();
03951
03952     for (std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>> snapPointWrapper : snapPointsSet)
03953     {
03954         winrt::ScrollSnapPointBase winrtScrollSnapPoint = snapPointWrapper->SnapPoint().as<winrt::ScrollSnapPointBase>();
03955
03956         if (winrtScrollSnapPoint == scrollSnapPoint)
03957         {
03958             return snapPointWrapper;
03959         }
03960     }
03961
03962     return nullptr;
03963 }
03964
03965 std::shared_ptr<SnapPointWrapper<winrt::ZoomSnapPointBase>> ScrollPresenter::GetZoomSnapPointWrapperDbg(winrt::ZoomSnapPointBase const& zoomSnapPoint)
03966 {
03967     for (std::shared_ptr<SnapPointWrapper<winrt::ZoomSnapPointBase>> snapPointWrapper : m_sortedConsolidatedZoomSnapPoints)
03968     {
03969         winrt::ZoomSnapPointBase winrtZoomSnapPoint = snapPointWrapper->SnapPoint().as<winrt::ZoomSnapPointBase>();
03970
03971         if (winrtZoomSnapPoint == zoomSnapPoint)
03972         {
03973             return snapPointWrapper;
03974         }
03975     }
03976
03977     return nullptr;
03978 }
03979 // End of ScrollPresenterTestHooks calls
03980
03981 // Invoked when a dependency property of this ScrollPresenter has changed.
03982 void ScrollPresenter::OnPropertyChanged(
03983     const winrt::DependencyPropertyChangedEventArgs& args)
03984 {
03985     const auto dependencyProperty = args.Property();
03986
03987     SCROLLPRESENTER_TRACE_VERBOSE_DBG(nullptr, L"%s(property: %s)\n", METH_NAME, DependencyPropertyToString(dependencyProperty).c_str());
03988
03989     if (dependencyProperty == s_ContentProperty)
03990     {
03991         const winrt::IInspectable oldContent = args.OldValue();
03992         const winrt::IInspectable newContent = args.NewValue();
03993         UpdateContent(oldContent.as<winrt::UIElement>(), newContent.as<winrt::UIElement>());
03994     }
03995     else if (dependencyProperty == s_BackgroundProperty)
03996     {
03997         winrt::Panel thisAsPanel = *this;
03998
03999         thisAsPanel.Background(args.NewValue().as<winrt::Brush>());
04000     }
04001     else if (dependencyProperty == s_MinZoomFactorProperty || dependencyProperty == s_MaxZoomFactorProperty)
04002     {
04003         MUX_ASSERT(IsZoomFactorBoundaryValid(unbox_value<double>(args.OldValue())));
04004
04005         if (m_interactionTracker)
04006         {
04007             SetupInteractionTrackerZoomFactorBoundaries(
04008                 MinZoomFactor(),
04009                 MaxZoomFactor());
04010         }
04011     }
04012     else if (dependencyProperty == s_ContentOrientationProperty)
04013     {
04014         m_contentOrientation = ContentOrientation();
04015
04016         InvalidateMeasure();
04017     }
04018     else if (dependencyProperty == s_HorizontalAnchorRatioProperty ||
04019         dependencyProperty == s_VerticalAnchorRatioProperty)
04020     {
04021         MUX_ASSERT(IsAnchorRatioValid(unbox_value<double>(args.OldValue())));
04022
04023         m_isAnchorElementDirty = true;
04024     }
04025     else if (m_scrollPresenterVisualInteractionSource)
04026     {
04027         if (dependencyProperty == s_HorizontalScrollChainModeProperty)
04028         {
04029             SetupVisualInteractionSourceChainingMode(
04030                 m_scrollPresenterVisualInteractionSource,
04031                 ScrollPresenterDimension::HorizontalScroll,
04032                 HorizontalScrollChainMode());
04033         }
04034         else if (dependencyProperty == s_VerticalScrollChainModeProperty)
04035         {
04036             SetupVisualInteractionSourceChainingMode(
04037                 m_scrollPresenterVisualInteractionSource,
04038                 ScrollPresenterDimension::VerticalScroll,
04039                 VerticalScrollChainMode());
04040         }
04041         else if (dependencyProperty == s_ZoomChainModeProperty)
04042         {
04043             SetupVisualInteractionSourceChainingMode(
04044                 m_scrollPresenterVisualInteractionSource,
04045                 ScrollPresenterDimension::ZoomFactor,
04046                 ZoomChainMode());
04047         }
04048         else if (dependencyProperty == s_HorizontalScrollRailModeProperty)
04049         {
04050             SetupVisualInteractionSourceRailingMode(
04051                 m_scrollPresenterVisualInteractionSource,
04052                 ScrollPresenterDimension::HorizontalScroll,
04053                 HorizontalScrollRailMode());
04054         }
04055         else if (dependencyProperty == s_VerticalScrollRailModeProperty)
04056         {
04057             SetupVisualInteractionSourceRailingMode(
04058                 m_scrollPresenterVisualInteractionSource,
04059                 ScrollPresenterDimension::VerticalScroll,
04060                 VerticalScrollRailMode());
04061         }
04062         else if (dependencyProperty == s_HorizontalScrollModeProperty)
04063         {
04064             UpdateVisualInteractionSourceMode(
04065                 ScrollPresenterDimension::HorizontalScroll);
04066         }
04067         else if (dependencyProperty == s_VerticalScrollModeProperty)
04068         {
04069             UpdateVisualInteractionSourceMode(
04070                 ScrollPresenterDimension::VerticalScroll);
04071         }
04072         else if (dependencyProperty == s_ZoomModeProperty)
04073         {
04074             // Updating the horizontal and vertical scroll modes because GetComputedScrollMode is function of ZoomMode.
04075             UpdateVisualInteractionSourceMode(
04076                 ScrollPresenterDimension::HorizontalScroll);
04077             UpdateVisualInteractionSourceMode(
04078                 ScrollPresenterDimension::VerticalScroll);
04079
04080             SetupVisualInteractionSourceMode(
04081                 m_scrollPresenterVisualInteractionSource,
04082                 ZoomMode());
04083
04084 #ifdef IsMouseWheelZoomDisabled
04085             SetupVisualInteractionSourcePointerWheelConfig(
04086                 m_scrollPresenterVisualInteractionSource,
04087                 GetMouseWheelZoomMode());
04088 #endif
04089         }
04090         else if (dependencyProperty == s_IgnoredInputKindsProperty)
04091         {
04092             UpdateManipulationRedirectionMode();
04093         }
04094     }
04095 }
04096
04097 void ScrollPresenter::OnContentPropertyChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& args)
04098 {
04099     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
04100
04101     const winrt::UIElement content = Content();
04102
04103     if (content)
04104     {
04105         if (args == winrt::FrameworkElement::HorizontalAlignmentProperty() ||
04106             args == winrt::FrameworkElement::VerticalAlignmentProperty())
04107         {
04108             // The ExtentWidth and ExtentHeight may have to be updated because of this alignment change.
04109             InvalidateMeasure();
04110
04111             if (m_interactionTracker)
04112             {
04113                 if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation)
04114                 {
04115                     SetupPositionBoundariesExpressionAnimations(content);
04116                 }
04117
04118                 if (m_translationExpressionAnimation && m_zoomFactorExpressionAnimation)
04119                 {
04120                     SetupTransformExpressionAnimations(content);
04121                 }
04122             }
04123         }
04124         else if (args == winrt::FrameworkElement::MinWidthProperty() ||
04125             args == winrt::FrameworkElement::WidthProperty() ||
04126             args == winrt::FrameworkElement::MaxWidthProperty() ||
04127             args == winrt::FrameworkElement::MinHeightProperty() ||
04128             args == winrt::FrameworkElement::HeightProperty() ||
04129             args == winrt::FrameworkElement::MaxHeightProperty())
04130         {
04131             InvalidateMeasure();
04132         }
04133     }
04134 }
04135
04136 void ScrollPresenter::OnFlowDirectionChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& /*args*/)
04137 {
04138     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
04139
04140     if (m_interactionTracker)
04141     {
04142         if (winrt::UIElement content = Content())
04143         {
04144             if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation)
04145             {
04146                 SetupPositionBoundariesExpressionAnimations(content);
04147             }
04148
04149             if (m_translationExpressionAnimation && m_zoomFactorExpressionAnimation)
04150             {
04151                 SetupTransformExpressionAnimations(content);
04152             }
04153         }
04154
04155         if (m_scrollPresenterVisualInteractionSource)
04156         {
04157             // When the direction is RightToLeft, the center point modifier is function of the ScrollPresenter width, so it needs to be updated.
04158             SetupVisualInteractionSourceCenterPointModifier(
04159                 m_scrollPresenterVisualInteractionSource,
04160                 ScrollPresenterDimension::HorizontalScroll,
04161                 true /*flowDirectionChanged*/);
04162         }
04163
04164         // The updates above reset the horizontal HorizontalOffset is 0, so it is brought back to its original value through a non-animated scroll.
04165         if (m_zoomedHorizontalOffset > 0.0)
04166         {
04167             com_ptr<ScrollingScrollOptions> options = winrt::make_self<ScrollingScrollOptions>(winrt::ScrollingAnimationMode::Disabled, winrt::ScrollingSnapPointsMode::Ignore);
04168
04169             ScrollTo(m_zoomedHorizontalOffset, m_zoomedVerticalOffset, *options);
04170         }
04171     }
04172 }
04173
04174 void ScrollPresenter::OnCompositionTargetRendering(const winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*args*/)
04175 {
04176     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
04177
04178     bool unhookCompositionTargetRendering = StartTranslationAndZoomFactorExpressionAnimations();
04179
04180     if (!m_interactionTrackerAsyncOperations.empty() && IsLoaded())
04181     {
04182         bool delayProcessingViewChanges = false;
04183
04184         for (auto operationsIter = m_interactionTrackerAsyncOperations.begin(); operationsIter != m_interactionTrackerAsyncOperations.end();)
04185         {
04186             auto& interactionTrackerAsyncOperation = *operationsIter;
04187
04188             operationsIter++;
04189
04190             if (interactionTrackerAsyncOperation->IsDelayed())
04191             {
04192                 interactionTrackerAsyncOperation->SetIsDelayed(false);
04193                 unhookCompositionTargetRendering = false;
04194                 MUX_ASSERT(interactionTrackerAsyncOperation->IsQueued());
04195             }
04196             else if (interactionTrackerAsyncOperation->IsQueued())
04197             {
04198                 if (!delayProcessingViewChanges && interactionTrackerAsyncOperation->GetTicksCountdown() == 1)
04199                 {
04200                     // Evaluate whether all remaining queued operations need to be delayed until the completion of a prior required operation.
04201                     std::shared_ptr<InteractionTrackerAsyncOperation> requiredInteractionTrackerAsyncOperation = interactionTrackerAsyncOperation->GetRequiredOperation();
04202
04203                     if (requiredInteractionTrackerAsyncOperation)
04204                     {
04205                         if (!requiredInteractionTrackerAsyncOperation->IsCanceled() && !requiredInteractionTrackerAsyncOperation->IsCompleted())
04206                         {
04207                             // Prior required operation is not canceled or completed yet. All subsequent operations need to be delayed.
04208                             delayProcessingViewChanges = true;
04209                         }
04210                         else
04211                         {
04212                             // Previously set required operation is now canceled or completed. Check if it needs to be replaced with an older one.
04213                             requiredInteractionTrackerAsyncOperation = GetLastNonAnimatedInteractionTrackerOperation(interactionTrackerAsyncOperation);
04214                             interactionTrackerAsyncOperation->SetRequiredOperation(requiredInteractionTrackerAsyncOperation);
04215                             if (requiredInteractionTrackerAsyncOperation)
04216                             {
04217                                 // An older operation is now required. All subsequent operations need to be delayed.
04218                                 delayProcessingViewChanges = true;
04219                             }
04220                         }
04221                     }
04222                 }
04223
04224                 if (delayProcessingViewChanges)
04225                 {
04226                     if (interactionTrackerAsyncOperation->GetTicksCountdown() > 1)
04227                     {
04228                         // Ticking the queued operation without processing it.
04229                         interactionTrackerAsyncOperation->TickQueuedOperation();
04230                     }
04231                     unhookCompositionTargetRendering = false;
04232                 }
04233                 else if (interactionTrackerAsyncOperation->TickQueuedOperation())
04234                 {
04235                     // InteractionTracker is ready for the operation's processing.
04236                     ProcessDequeuedViewChange(interactionTrackerAsyncOperation);
04237                     if (!interactionTrackerAsyncOperation->IsAnimated())
04238                     {
04239                         unhookCompositionTargetRendering = false;
04240                     }
04241                 }
04242                 else
04243                 {
04244                     unhookCompositionTargetRendering = false;
04245                 }
04246             }
04247             else if (!interactionTrackerAsyncOperation->IsAnimated())
04248             {
04249                 if (interactionTrackerAsyncOperation->TickNonAnimatedOperation())
04250                 {
04251                     // The non-animated view change request did not result in a status change or ValuesChanged notification. Consider it completed.
04252                     CompleteViewChange(interactionTrackerAsyncOperation, ScrollPresenterViewChangeResult::Completed);
04253                     if (m_translationAndZoomFactorAnimationsRestartTicksCountdown > 0)
04254                     {
04255                         // Do not unhook the Rendering event when there is a pending restart of the Translation and Scale animations.
04256                         unhookCompositionTargetRendering = false;
04257                     }
04258                     m_interactionTrackerAsyncOperations.remove(interactionTrackerAsyncOperation);
04259
04260                     if (m_interactionTrackerAsyncOperations.empty())
04261                     {
04262                         ResetAnticipatedView();
04263                     }
04264                 }
04265                 else
04266                 {
04267                     unhookCompositionTargetRendering = false;
04268                 }
04269             }
04270         }
04271     }
04272
04273     if (unhookCompositionTargetRendering)
04274     {
04275         UnhookCompositionTargetRendering();
04276     }
04277 }
04278
04279 void ScrollPresenter::OnLoaded(
04280     const winrt::IInspectable& /*sender*/,
04281     const winrt::RoutedEventArgs& /*args*/)
04282 {
04283     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
04284
04285     SetupInteractionTrackerBoundaries();
04286
04287     EnsureScrollPresenterVisualInteractionSource();
04288     SetupScrollPresenterVisualInteractionSource();
04289     SetupScrollControllerVisualInterationSource(ScrollPresenterDimension::HorizontalScroll);
04290     SetupScrollControllerVisualInterationSource(ScrollPresenterDimension::VerticalScroll);
04291
04292     if (m_horizontalScrollControllerExpressionAnimationSources)
04293     {
04294         MUX_ASSERT(m_horizontalScrollControllerPanningInfo);
04295
04296         m_horizontalScrollControllerPanningInfo.get().SetPanningElementExpressionAnimationSources(
04297             m_horizontalScrollControllerExpressionAnimationSources,
04298             s_minOffsetPropertyName,
04299             s_maxOffsetPropertyName,
04300             s_offsetPropertyName,
04301             s_multiplierPropertyName);
04302     }
04303     if (m_verticalScrollControllerExpressionAnimationSources)
04304     {
04305         MUX_ASSERT(m_verticalScrollControllerPanningInfo);
04306
04307         m_verticalScrollControllerPanningInfo.get().SetPanningElementExpressionAnimationSources(
04308             m_verticalScrollControllerExpressionAnimationSources,
04309             s_minOffsetPropertyName,
04310             s_maxOffsetPropertyName,
04311             s_offsetPropertyName,
04312             s_multiplierPropertyName);
04313     }
04314
04315     const winrt::UIElement content = Content();
04316
04317     if (content)
04318     {
04319         if (!m_translationExpressionAnimation || !m_zoomFactorExpressionAnimation)
04320         {
04321             EnsureTransformExpressionAnimations();
04322             SetupTransformExpressionAnimations(content);
04323         }
04324
04325         // Process the potentially delayed operation in the OnCompositionTargetRendering handler.
04326         HookCompositionTargetRendering();
04327     }
04328 }
04329
04330 void ScrollPresenter::OnUnloaded(
04331     const winrt::IInspectable& /*sender*/,
04332     const winrt::RoutedEventArgs& /*args*/)
04333 {
04334     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
04335
04336     if (!IsLoaded())
04337     {
04338         MUX_ASSERT(RenderSize().Width == 0.0);
04339         MUX_ASSERT(RenderSize().Height == 0.0);
04340
04341         // All potential pending operations are interrupted when the ScrollPresenter unloads.
04342         CompleteInteractionTrackerOperations(
04343             -1 /*requestId*/,
04344             ScrollPresenterViewChangeResult::Interrupted /*operationResult*/,
04345             ScrollPresenterViewChangeResult::Ignored     /*unused priorNonAnimatedOperationsResult*/,
04346             ScrollPresenterViewChangeResult::Ignored     /*unused priorAnimatedOperationsResult*/,
04347             true  /*completeNonAnimatedOperation*/,
04348             true  /*completeAnimatedOperation*/,
04349             false /*completePriorNonAnimatedOperations*/,
04350             false /*completePriorAnimatedOperations*/);
04351
04352         // Unhook the potential OnCompositionTargetRendering handler since there are no pending operations.
04353         UnhookCompositionTargetRendering();
04354
04355         const winrt::UIElement content = Content();
04356
04357         UpdateUnzoomedExtentAndViewport(
04358             false /*renderSizeChanged*/,
04359             content ? m_unzoomedExtentWidth : 0.0,
04360             content ? m_unzoomedExtentHeight : 0.0,
04361             0.0 /*viewportWidth*/,
04362             0.0 /*viewportHeight*/);
04363     }
04364 }
04365
04366 // UIElement.BringIntoViewRequested event handler to bring an element into the viewport.
04367 void ScrollPresenter::OnBringIntoViewRequestedHandler(
04368     const winrt::IInspectable& /*sender*/,
04369     const winrt::BringIntoViewRequestedEventArgs& args)
04370 {
04371     SCROLLPRESENTER_TRACE_INFO_DBG(*this, L"%s[0x%p](AnimationDesired:%d, Handled:%d, H/V AlignmentRatio:%lf,%lf, H/V Offset:%f,%f, TargetRect:%s, TargetElement:0x%p)\n",
04372         METH_NAME, this,
04373         args.AnimationDesired(), args.Handled(),
04374         args.HorizontalAlignmentRatio(), args.VerticalAlignmentRatio(),
04375         args.HorizontalOffset(), args.VerticalOffset(),
04376         TypeLogging::RectToString(args.TargetRect()).c_str(), args.TargetElement());
04377
04378     winrt::UIElement content = Content();
04379
04380     if (args.Handled() ||
04381         args.TargetElement() == static_cast<winrt::UIElement>(*this) ||
04382         (args.TargetElement() == content && content.Visibility() == winrt::Visibility::Collapsed) ||
04383         (args.TargetElement() != content && !SharedHelpers::IsAncestor(args.TargetElement(), content, true /*checkVisibility*/)))
04384     {
04385         // Ignore the request when:
04386         // - There is no InteractionTracker to fulfill it.
04387         // - It was handled already.
04388         // - The target element is this ScrollPresenter itself. A parent scrollPresenter may fulfill the request instead then.
04389         // - The target element is effectively collapsed within the ScrollPresenter.
04390         return;
04391     }
04392
04393     winrt::Rect targetRect{};
04394     int32_t offsetsChangeCorrelationId = s_noOpCorrelationId;
04395     double targetZoomedHorizontalOffset = 0.0;
04396     double targetZoomedVerticalOffset = 0.0;
04397     double appliedOffsetX = 0.0;
04398     double appliedOffsetY = 0.0;
04399     winrt::ScrollingSnapPointsMode snapPointsMode = winrt::ScrollingSnapPointsMode::Ignore;
04400
04401     // Compute the target offsets based on the provided BringIntoViewRequestedEventArgs.
04402     ComputeBringIntoViewTargetOffsetsFromRequestEventArgs(
04403         content,
04404         snapPointsMode,
04405         args,
04406         &targetZoomedHorizontalOffset,
04407         &targetZoomedVerticalOffset,
04408         &appliedOffsetX,
04409         &appliedOffsetY,
04410         &targetRect);
04411
04412     if (HasBringingIntoViewListener())
04413     {
04414         // Raise the ScrollPresenter.BringingIntoView event to give the listeners a chance to adjust the operation.
04415
04416         offsetsChangeCorrelationId = m_latestViewChangeCorrelationId = GetNextViewChangeCorrelationId();
04417
04418         if (!RaiseBringingIntoView(
04419             targetZoomedHorizontalOffset,
04420             targetZoomedVerticalOffset,
04421             args,
04422             offsetsChangeCorrelationId,
04423             &snapPointsMode))
04424         {
04425             // A listener canceled the operation in the ScrollPresenter.BringingIntoView event handler before any scrolling was attempted.
04426             RaiseViewChangeCompleted(true /*isForScroll*/, ScrollPresenterViewChangeResult::Completed, offsetsChangeCorrelationId);
04427             return;
04428         }
04429
04430         content = Content();
04431
04432         if (!content ||
04433             args.Handled() ||
04434             args.TargetElement() == static_cast<winrt::UIElement>(*this) ||
04435             (args.TargetElement() == content && content.Visibility() == winrt::Visibility::Collapsed) ||
04436             (args.TargetElement() != content && !SharedHelpers::IsAncestor(args.TargetElement(), content, true /*checkVisibility*/)))
04437         {
04438             // Again, ignore the request when:
04439             // - There is no Content anymore.
04440             // - The request was handled already.
04441             // - The target element is this ScrollPresenter itself. A parent scrollPresenter may fulfill the request instead then.
04442             // - The target element is effectively collapsed within the ScrollPresenter.
04443             return;
04444         }
04445
04446         // Re-evaluate the target offsets based on the potentially modified BringIntoViewRequestedEventArgs.
04447         // Take into account potential SnapPointsMode == Default so that parents contribute accordingly.
04448         ComputeBringIntoViewTargetOffsetsFromRequestEventArgs(
04449             content,
04450             snapPointsMode,
04451             args,
04452             &targetZoomedHorizontalOffset,
04453             &targetZoomedVerticalOffset,
04454             &appliedOffsetX,
04455             &appliedOffsetY,
04456             &targetRect);
04457     }
04458
04459     // Do not include the applied offsets so that potential parent bring-into-view contributors ignore that shift.
04460     const winrt::Rect nextTargetRect{
04461         static_cast<float>(targetRect.X * m_zoomFactor - targetZoomedHorizontalOffset - appliedOffsetX),
04462         static_cast<float>(targetRect.Y * m_zoomFactor - targetZoomedVerticalOffset - appliedOffsetY),
04463         std::min(targetRect.Width * m_zoomFactor, static_cast<float>(m_viewportWidth)),
04464         std::min(targetRect.Height * m_zoomFactor, static_cast<float>(m_viewportHeight))
04465     };
04466
04467     const winrt::Rect viewportRect{
04468         0.0f,
04469         0.0f,
04470         static_cast<float>(m_viewportWidth),
04471         static_cast<float>(m_viewportHeight),
04472     };
04473
04474     if (targetZoomedHorizontalOffset != m_zoomedHorizontalOffset ||
04475         targetZoomedVerticalOffset != m_zoomedVerticalOffset)
04476     {
04477         com_ptr<ScrollingScrollOptions> options =
04478             winrt::make_self<ScrollingScrollOptions>(
04479                 args.AnimationDesired() ? winrt::ScrollingAnimationMode::Auto : winrt::ScrollingAnimationMode::Disabled,
04480                 snapPointsMode);
04481
04482         ChangeOffsetsPrivate(
04483             targetZoomedHorizontalOffset /*zoomedHorizontalOffset*/,
04484             targetZoomedVerticalOffset /*zoomedVerticalOffset*/,
04485             ScrollPresenterViewKind::Absolute,
04486             *options,
04487             args /*bringIntoViewRequestedEventArgs*/,
04488             InteractionTrackerAsyncOperationTrigger::BringIntoViewRequest,
04489             offsetsChangeCorrelationId /*existingViewChangeCorrelationId*/,
04490             nullptr /*viewChangeCorrelationId*/);
04491     }
04492     else
04493     {
04494         // No offset change was triggered because the target offsets are the same as the current ones. Mark the operation as completed immediately.
04495         RaiseViewChangeCompleted(true /*isForScroll*/, ScrollPresenterViewChangeResult::Completed, offsetsChangeCorrelationId);
04496     }
04497
04498     if (SharedHelpers::DoRectsIntersect(nextTargetRect, viewportRect))
04499     {
04500         // Next bring a portion of this ScrollPresenter into view.
04501         args.TargetRect(nextTargetRect);
04502         args.TargetElement(*this);
04503         args.HorizontalOffset(args.HorizontalOffset() - appliedOffsetX);
04504         args.VerticalOffset(args.VerticalOffset() - appliedOffsetY);
04505     }
04506     else
04507     {
04508         // This ScrollPresenter did not even partially bring the TargetRect into its viewport.
04509         // Mark the operation as handled since no portion of this ScrollPresenter needs to be brought into view.
04510         args.Handled(true);
04511     }
04512 }
04513
04514 void ScrollPresenter::OnPointerPressed(
04515     const winrt::IInspectable& /*sender*/,
04516     const winrt::PointerRoutedEventArgs& args)
04517 {
04518     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
04519
04520     MUX_ASSERT(m_interactionTracker);
04521     MUX_ASSERT(m_scrollPresenterVisualInteractionSource);
04522
04523     if (m_horizontalScrollController && m_horizontalScrollController.get().IsScrollingWithMouse())
04524     {
04525         return;
04526     }
04527
04528     if (m_verticalScrollController && m_verticalScrollController.get().IsScrollingWithMouse())
04529     {
04530         return;
04531     }
04532
04533     const winrt::UIElement content = Content();
04534     const winrt::ScrollingScrollMode horizontalScrollMode = GetComputedScrollMode(ScrollPresenterDimension::HorizontalScroll);
04535     const winrt::ScrollingScrollMode verticalScrollMode = GetComputedScrollMode(ScrollPresenterDimension::VerticalScroll);
04536
04537     if (!content ||
04538         (horizontalScrollMode == winrt::ScrollingScrollMode::Disabled &&
04539             verticalScrollMode == winrt::ScrollingScrollMode::Disabled &&
04540             ZoomMode() == winrt::ScrollingZoomMode::Disabled))
04541     {
04542         return;
04543     }
04544
04545     switch (args.Pointer().PointerDeviceType())
04546     {
04547     case winrt::PointerDeviceType::Touch:
04548         if (IsInputKindIgnored(winrt::ScrollingInputKinds::Touch))
04549             return;
04550         break;
04551     case winrt::PointerDeviceType::Pen:
04552         if (IsInputKindIgnored(winrt::ScrollingInputKinds::Pen))
04553             return;
04554         break;
04555     default:
04556         return;
04557     }
04558
04559     // All UIElement instances between the touched one and the ScrollPresenter must include ManipulationModes.System in their
04560     // ManipulationMode property in order to trigger a manipulation. This allows to turn off touch interactions in particular.
04561     winrt::IInspectable source = args.OriginalSource();
04562     MUX_ASSERT(source);
04563
04564     winrt::DependencyObject sourceAsDO = source.try_as<winrt::DependencyObject>();
04565
04566     winrt::IUIElement thisAsUIElement = *this; // Need to have exactly the same interface as we're comparing below for object equality
04567
04568     while (sourceAsDO)
04569     {
04570         winrt::IUIElement sourceAsUIE = sourceAsDO.try_as<winrt::IUIElement>();
04571         if (sourceAsUIE)
04572         {
04573             const winrt::ManipulationModes mm = sourceAsUIE.ManipulationMode();
04574
04575             if ((mm & winrt::ManipulationModes::System) == winrt::ManipulationModes::None)
04576             {
04577                 return;
04578             }
04579
04580             if (sourceAsUIE == thisAsUIElement)
04581             {
04582                 break;
04583             }
04584         }
04585
04586         sourceAsDO = winrt::VisualTreeHelper::GetParent(sourceAsDO);
04587     };
04588
04589 #ifdef DBG
04590     DumpMinMaxPositions();
04591
04592     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_METH_STR, METH_NAME, this, L"TryRedirectForManipulation", TypeLogging::PointerPointToString(args.GetCurrentPoint(nullptr)).c_str());
04593 #endif // DBG
04594
04595     try
04596     {
04597         m_scrollPresenterVisualInteractionSource.TryRedirectForManipulation(args.GetCurrentPoint(nullptr));
04598     }
04599     catch (const winrt::hresult_error & e)
04600     {
04601         // Swallowing Access Denied error because of InteractionTracker bug 17434718 which has been
04602         // causing crashes at least in RS3, RS4 and RS5.
04603         // TODO - Stop eating the error in future OS versions that include a fix for 17434718 if any.
04604         if (e.to_abi() != E_ACCESSDENIED)
04605         {
04606             throw;
04607         }
04608     }
04609 }
04610
04611 // Invoked by an IScrollControllerPanningInfo implementation when a call to InteractionTracker::TryRedirectForManipulation
04612 // is required to track a finger.
04613 void ScrollPresenter::OnScrollControllerPanningInfoPanRequested(
04614     const winrt::IScrollControllerPanningInfo& sender,
04615     const winrt::ScrollControllerPanRequestedEventArgs& args)
04616 {
04617     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, sender);
04618
04619     MUX_ASSERT(sender == m_horizontalScrollControllerPanningInfo.get() || sender == m_verticalScrollControllerPanningInfo.get());
04620
04621     if (args.Handled())
04622     {
04623         return;
04624     }
04625
04626     winrt::VisualInteractionSource scrollControllerVisualInteractionSource = nullptr;
04627
04628     if (sender == m_horizontalScrollControllerPanningInfo.get())
04629     {
04630         scrollControllerVisualInteractionSource = m_horizontalScrollControllerVisualInteractionSource;
04631     }
04632     else
04633     {
04634         scrollControllerVisualInteractionSource = m_verticalScrollControllerVisualInteractionSource;
04635     }
04636
04637     if (scrollControllerVisualInteractionSource)
04638     {
04639         try
04640         {
04641             scrollControllerVisualInteractionSource.TryRedirectForManipulation(args.PointerPoint());
04642         }
04643         catch (const winrt::hresult_error & e)
04644         {
04645             // Swallowing Access Denied error because of InteractionTracker bug 17434718 which has been
04646             // causing crashes at least in RS3, RS4 and RS5.
04647             // TODO - Stop eating the error in future OS versions that include a fix for 17434718 if any.
04648             if (e.to_abi() == E_ACCESSDENIED)
04649             {
04650                 // Do not set the Handled flag. The request is simply ignored.
04651                 return;
04652             }
04653             else
04654             {
04655                 throw;
04656             }
04657         }
04658         args.Handled(true);
04659     }
04660 }
04661
04662 // Invoked by an IScrollControllerPanningInfo implementation when one or more of its characteristics has changed:
04663 // PanningElementAncestor, PanOrientation or IsRailEnabled.
04664 void ScrollPresenter::OnScrollControllerPanningInfoChanged(
04665     const winrt::IScrollControllerPanningInfo& sender,
04666     const winrt::IInspectable& /*args*/)
04667 {
04668     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, sender);
04669
04670     MUX_ASSERT(sender == m_horizontalScrollControllerPanningInfo.get() || sender == m_verticalScrollControllerPanningInfo.get());
04671
04672     if (!m_interactionTracker)
04673     {
04674         return;
04675     }
04676
04677     const bool isFromHorizontalScrollController = sender == m_horizontalScrollControllerPanningInfo.get();
04678
04679     winrt::CompositionPropertySet scrollControllerExpressionAnimationSources =
04680         isFromHorizontalScrollController ? m_horizontalScrollControllerExpressionAnimationSources : m_verticalScrollControllerExpressionAnimationSources;
04681
04682     SetupScrollControllerVisualInterationSource(isFromHorizontalScrollController ? ScrollPresenterDimension::HorizontalScroll : ScrollPresenterDimension::VerticalScroll);
04683
04684     if (isFromHorizontalScrollController)
04685     {
04686         if (scrollControllerExpressionAnimationSources != m_horizontalScrollControllerExpressionAnimationSources)
04687         {
04688             MUX_ASSERT(m_horizontalScrollControllerPanningInfo);
04689
04690             m_horizontalScrollControllerPanningInfo.get().SetPanningElementExpressionAnimationSources(
04691                 m_horizontalScrollControllerExpressionAnimationSources,
04692                 s_minOffsetPropertyName,
04693                 s_maxOffsetPropertyName,
04694                 s_offsetPropertyName,
04695                 s_multiplierPropertyName);
04696         }
04697     }
04698     else
04699     {
04700         if (scrollControllerExpressionAnimationSources != m_verticalScrollControllerExpressionAnimationSources)
04701         {
04702             MUX_ASSERT(m_verticalScrollControllerPanningInfo);
04703
04704             m_verticalScrollControllerPanningInfo.get().SetPanningElementExpressionAnimationSources(
04705                 m_verticalScrollControllerExpressionAnimationSources,
04706                 s_minOffsetPropertyName,
04707                 s_maxOffsetPropertyName,
04708                 s_offsetPropertyName,
04709                 s_multiplierPropertyName);
04710         }
04711     }
04712 }
04713
04714 // Invoked when a IScrollController::ScrollToRequested event is raised in order to perform the
04715 // equivalent of a ScrollPresenter::ScrollTo operation.
04716 void ScrollPresenter::OnScrollControllerScrollToRequested(
04717     const winrt::IScrollController& sender,
04718     const winrt::ScrollControllerScrollToRequestedEventArgs& args)
04719 {
04720     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, sender);
04721     MUX_ASSERT(sender == m_horizontalScrollController.get() || sender == m_verticalScrollController.get());
04722
04723     const bool isFromHorizontalScrollController = sender == m_horizontalScrollController.get();
04724     int32_t viewChangeCorrelationId = s_noOpCorrelationId;
04725
04726     // Attempt to find an offset change request from an IScrollController with the same ScrollPresenterViewKind,
04727     // the same ScrollingScrollOptions settings and same tick.
04728     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation = GetInteractionTrackerOperationFromKinds(
04729         true /*isOperationTypeForOffsetsChange*/,
04730         static_cast<InteractionTrackerAsyncOperationTrigger>(static_cast<int>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest) + static_cast<int>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest)),
04731         ScrollPresenterViewKind::Absolute,
04732         args.Options());
04733
04734     if (!interactionTrackerAsyncOperation)
04735     {
04736         ChangeOffsetsPrivate(
04737             isFromHorizontalScrollController ? args.Offset() : m_zoomedHorizontalOffset,
04738             isFromHorizontalScrollController ? m_zoomedVerticalOffset : args.Offset(),
04739             ScrollPresenterViewKind::Absolute,
04740             args.Options(),
04741             nullptr /*bringIntoViewRequestedEventArgs*/,
04742             isFromHorizontalScrollController ? InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest : InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest,
04743             s_noOpCorrelationId /*existingViewChangeCorrelationId*/,
04744             &viewChangeCorrelationId);
04745     }
04746     else
04747     {
04748         // Coalesce requests
04749         const int32_t existingViewChangeCorrelationId = interactionTrackerAsyncOperation->GetViewChangeCorrelationId();
04750         std::shared_ptr<ViewChangeBase> viewChangeBase = interactionTrackerAsyncOperation->GetViewChangeBase();
04751         std::shared_ptr<OffsetsChange> offsetsChange = std::reinterpret_pointer_cast<OffsetsChange>(viewChangeBase);
04752
04753         interactionTrackerAsyncOperation->SetIsScrollControllerRequest(isFromHorizontalScrollController);
04754
04755         if (isFromHorizontalScrollController)
04756         {
04757             offsetsChange->ZoomedHorizontalOffset(args.Offset());
04758         }
04759         else
04760         {
04761             offsetsChange->ZoomedVerticalOffset(args.Offset());
04762         }
04763
04764         viewChangeCorrelationId = existingViewChangeCorrelationId;
04765     }
04766
04767     if (viewChangeCorrelationId != s_noOpCorrelationId)
04768     {
04769         args.CorrelationId(viewChangeCorrelationId);
04770     }
04771 }
04772
04773 // Invoked when a IScrollController::ScrollByRequested event is raised in order to perform the
04774 // equivalent of a ScrollPresenter::ScrollBy operation.
04775 void ScrollPresenter::OnScrollControllerScrollByRequested(
04776     const winrt::IScrollController& sender,
04777     const winrt::ScrollControllerScrollByRequestedEventArgs& args)
04778 {
04779     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, sender);
04780     MUX_ASSERT(sender == m_horizontalScrollController.get() || sender == m_verticalScrollController.get());
04781
04782     const bool isFromHorizontalScrollController = sender == m_horizontalScrollController.get();
04783     int32_t viewChangeCorrelationId = s_noOpCorrelationId;
04784
04785     // Attempt to find an offset change request from an IScrollController with the same ScrollPresenterViewKind,
04786     // the same ScrollingScrollOptions settings and same tick.
04787     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation = GetInteractionTrackerOperationFromKinds(
04788         true /*isOperationTypeForOffsetsChange*/,
04789         static_cast<InteractionTrackerAsyncOperationTrigger>(static_cast<int>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest) + static_cast<int>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest)),
04790         ScrollPresenterViewKind::RelativeToCurrentView,
04791         args.Options());
04792
04793     if (!interactionTrackerAsyncOperation)
04794     {
04795         ChangeOffsetsPrivate(
04796             isFromHorizontalScrollController ? args.OffsetDelta() : 0.0 /*zoomedHorizontalOffset*/,
04797             isFromHorizontalScrollController ? 0.0 : args.OffsetDelta() /*zoomedVerticalOffset*/,
04798             ScrollPresenterViewKind::RelativeToCurrentView,
04799             args.Options(),
04800             nullptr /*bringIntoViewRequestedEventArgs*/,
04801             isFromHorizontalScrollController ? InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest : InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest,
04802             s_noOpCorrelationId /*existingViewChangeCorrelationId*/,
04803             &viewChangeCorrelationId);
04804     }
04805     else
04806     {
04807         // Coalesce requests
04808         const int32_t existingViewChangeCorrelationId = interactionTrackerAsyncOperation->GetViewChangeCorrelationId();
04809         std::shared_ptr<ViewChangeBase> viewChangeBase = interactionTrackerAsyncOperation->GetViewChangeBase();
04810         std::shared_ptr<OffsetsChange> offsetsChange = std::reinterpret_pointer_cast<OffsetsChange>(viewChangeBase);
04811
04812         interactionTrackerAsyncOperation->SetIsScrollControllerRequest(isFromHorizontalScrollController);
04813
04814         if (isFromHorizontalScrollController)
04815         {
04816             offsetsChange->ZoomedHorizontalOffset(offsetsChange->ZoomedHorizontalOffset() + args.OffsetDelta());
04817         }
04818         else
04819         {
04820             offsetsChange->ZoomedVerticalOffset(offsetsChange->ZoomedVerticalOffset() + args.OffsetDelta());
04821         }
04822
04823         viewChangeCorrelationId = existingViewChangeCorrelationId;
04824     }
04825
04826     if (viewChangeCorrelationId != s_noOpCorrelationId)
04827     {
04828         args.CorrelationId(viewChangeCorrelationId);
04829     }
04830 }
04831
04832 // Invoked when a IScrollController::AddScrollVelocityRequested event is raised in order to perform the
04833 // equivalent of a ScrollPresenter::AddScrollVelocity operation.
04834 void ScrollPresenter::OnScrollControllerAddScrollVelocityRequested(
04835     const winrt::IScrollController& sender,
04836     const winrt::ScrollControllerAddScrollVelocityRequestedEventArgs& args)
04837 {
04838     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, sender);
04839     MUX_ASSERT(sender == m_horizontalScrollController.get() || sender == m_verticalScrollController.get());
04840
04841     const bool isFromHorizontalScrollController = sender == m_horizontalScrollController.get();
04842     int32_t viewChangeCorrelationId = s_noOpCorrelationId;
04843     winrt::IReference<float> horizontalInertiaDecayRate = nullptr;
04844     winrt::IReference<float> verticalInertiaDecayRate = nullptr;
04845
04846     // Attempt to find an offset change with velocity request from an IScrollController and this same tick.
04847     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation = GetInteractionTrackerOperationWithAdditionalVelocity(
04848         true /*isOperationTypeForOffsetsChange*/,
04849         static_cast<InteractionTrackerAsyncOperationTrigger>(static_cast<int>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest) + static_cast<int>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest)));
04850
04851     if (!interactionTrackerAsyncOperation)
04852     {
04853         winrt::IReference<winrt::float2> inertiaDecayRate = nullptr;
04854         winrt::float2 offsetsVelocity{};
04855
04856         if (isFromHorizontalScrollController)
04857         {
04858             offsetsVelocity.x = args.OffsetVelocity();
04859             horizontalInertiaDecayRate = args.InertiaDecayRate();
04860         }
04861         else
04862         {
04863             offsetsVelocity.y = args.OffsetVelocity();
04864             verticalInertiaDecayRate = args.InertiaDecayRate();
04865         }
04866
04867         if (horizontalInertiaDecayRate || verticalInertiaDecayRate)
04868         {
04869             winrt::IInspectable inertiaDecayRateAsInsp = nullptr;
04870
04871             if (horizontalInertiaDecayRate)
04872             {
04873                 inertiaDecayRateAsInsp = box_value(winrt::float2({ horizontalInertiaDecayRate.Value(), c_scrollPresenterDefaultInertiaDecayRate }));
04874             }
04875             else
04876             {
04877                 inertiaDecayRateAsInsp = box_value(winrt::float2({ c_scrollPresenterDefaultInertiaDecayRate, verticalInertiaDecayRate.Value() }));
04878             }
04879
04880             inertiaDecayRate = inertiaDecayRateAsInsp.as<winrt::IReference<winrt::float2>>();
04881         }
04882
04883         ChangeOffsetsWithAdditionalVelocityPrivate(
04884             offsetsVelocity,
04885             winrt::float2::zero() /*anticipatedOffsetsChange*/,
04886             inertiaDecayRate,
04887             isFromHorizontalScrollController ? InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest : InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest,
04888             &viewChangeCorrelationId);
04889     }
04890     else
04891     {
04892         // Coalesce requests
04893         const int32_t existingViewChangeCorrelationId = interactionTrackerAsyncOperation->GetViewChangeCorrelationId();
04894         std::shared_ptr<ViewChangeBase> viewChangeBase = interactionTrackerAsyncOperation->GetViewChangeBase();
04895         std::shared_ptr<OffsetsChangeWithAdditionalVelocity> offsetsChangeWithAdditionalVelocity = std::reinterpret_pointer_cast<OffsetsChangeWithAdditionalVelocity>(viewChangeBase);
04896
04897         winrt::float2 offsetsVelocity = offsetsChangeWithAdditionalVelocity->OffsetsVelocity();
04898         winrt::IReference<winrt::float2> inertiaDecayRate = offsetsChangeWithAdditionalVelocity->InertiaDecayRate();
04899
04900         interactionTrackerAsyncOperation->SetIsScrollControllerRequest(isFromHorizontalScrollController);
04901
04902         if (isFromHorizontalScrollController)
04903         {
04904             offsetsVelocity.x = args.OffsetVelocity();
04905             horizontalInertiaDecayRate = args.InertiaDecayRate();
04906
04907             if (!horizontalInertiaDecayRate)
04908             {
04909                 if (inertiaDecayRate)
04910                 {
04911                     if (inertiaDecayRate.Value().y == c_scrollPresenterDefaultInertiaDecayRate)
04912                     {
04913                         offsetsChangeWithAdditionalVelocity->InertiaDecayRate(nullptr);
04914                     }
04915                     else
04916                     {
04917                         winrt::IInspectable newInertiaDecayRateAsInsp =
04918                             box_value(winrt::float2({ c_scrollPresenterDefaultInertiaDecayRate, inertiaDecayRate.Value().y }));
04919                         winrt::IReference<winrt::float2> newInertiaDecayRate =
04920                             newInertiaDecayRateAsInsp.as<winrt::IReference<winrt::float2>>();
04921
04922                         offsetsChangeWithAdditionalVelocity->InertiaDecayRate(newInertiaDecayRate);
04923                     }
04924                 }
04925             }
04926             else
04927             {
04928                 winrt::IInspectable newInertiaDecayRateAsInsp = nullptr;
04929
04930                 if (!inertiaDecayRate)
04931                 {
04932                     newInertiaDecayRateAsInsp =
04933                         box_value(winrt::float2({ horizontalInertiaDecayRate.Value(), c_scrollPresenterDefaultInertiaDecayRate }));
04934                 }
04935                 else
04936                 {
04937                     newInertiaDecayRateAsInsp =
04938                         box_value(winrt::float2({ horizontalInertiaDecayRate.Value(), inertiaDecayRate.Value().y }));
04939                 }
04940
04941                 winrt::IReference<winrt::float2> newInertiaDecayRate = newInertiaDecayRateAsInsp.as<winrt::IReference<winrt::float2>>();
04942
04943                 offsetsChangeWithAdditionalVelocity->InertiaDecayRate(newInertiaDecayRate);
04944             }
04945         }
04946         else
04947         {
04948             offsetsVelocity.y = args.OffsetVelocity();
04949             verticalInertiaDecayRate = args.InertiaDecayRate();
04950
04951             if (!verticalInertiaDecayRate)
04952             {
04953                 if (inertiaDecayRate)
04954                 {
04955                     if (inertiaDecayRate.Value().x == c_scrollPresenterDefaultInertiaDecayRate)
04956                     {
04957                         offsetsChangeWithAdditionalVelocity->InertiaDecayRate(nullptr);
04958                     }
04959                     else
04960                     {
04961                         winrt::IInspectable newInertiaDecayRateAsInsp =
04962                             box_value(winrt::float2({ inertiaDecayRate.Value().x, c_scrollPresenterDefaultInertiaDecayRate }));
04963                         winrt::IReference<winrt::float2> newInertiaDecayRate =
04964                             newInertiaDecayRateAsInsp.as<winrt::IReference<winrt::float2>>();
04965
04966                         offsetsChangeWithAdditionalVelocity->InertiaDecayRate(newInertiaDecayRate);
04967                     }
04968                 }
04969             }
04970             else
04971             {
04972                 winrt::IInspectable newInertiaDecayRateAsInsp = nullptr;
04973
04974                 if (!inertiaDecayRate)
04975                 {
04976                     newInertiaDecayRateAsInsp =
04977                         box_value(winrt::float2({ c_scrollPresenterDefaultInertiaDecayRate, verticalInertiaDecayRate.Value() }));
04978                 }
04979                 else
04980                 {
04981                     newInertiaDecayRateAsInsp =
04982                         box_value(winrt::float2({ inertiaDecayRate.Value().x, verticalInertiaDecayRate.Value() }));
04983                 }
04984
04985                 winrt::IReference<winrt::float2> newInertiaDecayRate = newInertiaDecayRateAsInsp.as<winrt::IReference<winrt::float2>>();
04986
04987                 offsetsChangeWithAdditionalVelocity->InertiaDecayRate(newInertiaDecayRate);
04988             }
04989         }
04990
04991         offsetsChangeWithAdditionalVelocity->OffsetsVelocity(offsetsVelocity);
04992
04993         viewChangeCorrelationId = existingViewChangeCorrelationId;
04994     }
04995
04996     if (viewChangeCorrelationId != s_noOpCorrelationId)
04997     {
04998         args.CorrelationId(viewChangeCorrelationId);
04999     }
05000 }
05001
05002 void ScrollPresenter::OnHorizontalSnapPointsVectorChanged(const winrt::IObservableVector<winrt::ScrollSnapPointBase>& sender, const winrt::IVectorChangedEventArgs args)
05003 {
05004     SnapPointsVectorChangedHelper(sender, args, &m_sortedConsolidatedHorizontalSnapPoints, ScrollPresenterDimension::HorizontalScroll);
05005 }
05006
05007 void ScrollPresenter::OnVerticalSnapPointsVectorChanged(const winrt::IObservableVector<winrt::ScrollSnapPointBase>& sender, const winrt::IVectorChangedEventArgs args)
05008 {
05009     SnapPointsVectorChangedHelper(sender, args, &m_sortedConsolidatedVerticalSnapPoints, ScrollPresenterDimension::VerticalScroll);
05010 }
05011
05012 void ScrollPresenter::OnZoomSnapPointsVectorChanged(const winrt::IObservableVector<winrt::ZoomSnapPointBase>& sender, const winrt::IVectorChangedEventArgs args)
05013 {
05014     SnapPointsVectorChangedHelper(sender, args, &m_sortedConsolidatedZoomSnapPoints, ScrollPresenterDimension::ZoomFactor);
05015 }
05016
05017 template <typename T>
05018 bool ScrollPresenter::SnapPointsViewportChangedHelper(
05019     winrt::IObservableVector<T> const& snapPoints,
05020     double viewport)
05021 {
05022     bool snapPointsNeedViewportUpdates = false;
05023
05024     for (T snapPoint : snapPoints)
05025     {
05026         winrt::SnapPointBase winrtSnapPointBase = snapPoint.as<winrt::SnapPointBase>();
05027         SnapPointBase* snapPointBase = winrt::get_self<SnapPointBase>(winrtSnapPointBase);
05028
05029         snapPointsNeedViewportUpdates |= snapPointBase->OnUpdateViewport(viewport);
05030     }
05031
05032     return snapPointsNeedViewportUpdates;
05033 }
05034
05035 template <typename T>
05036 void ScrollPresenter::SnapPointsVectorChangedHelper(
05037     winrt::IObservableVector<T> const& snapPoints,
05038     winrt::IVectorChangedEventArgs const& args,
05039     std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
05040     ScrollPresenterDimension dimension)
05041 {
05042     MUX_ASSERT(snapPoints);
05043     MUX_ASSERT(snapPointsSet);
05044
05045     T insertedItem = nullptr;
05046     const winrt::CollectionChange collectionChange = args.CollectionChange();
05047
05048     if (dimension != ScrollPresenterDimension::ZoomFactor)
05049     {
05050         const double viewportSize = dimension == ScrollPresenterDimension::HorizontalScroll ? m_viewportWidth : m_viewportHeight;
05051
05052         if (collectionChange == winrt::CollectionChange::ItemInserted)
05053         {
05054             insertedItem = snapPoints.GetAt(args.Index());
05055
05056             winrt::SnapPointBase winrtSnapPointBase = insertedItem.as<winrt::SnapPointBase>();
05057             SnapPointBase* snapPointBase = winrt::get_self<SnapPointBase>(winrtSnapPointBase);
05058
05059             // Newly inserted scroll snap point is provided the viewport size, for the case it's not near-aligned.
05060             const bool snapPointNeedsViewportUpdates = snapPointBase->OnUpdateViewport(viewportSize);
05061
05062             // When snapPointNeedsViewportUpdates is True, this newly inserted scroll snap point may be the first one
05063             // that requires viewport updates.
05064             if (dimension == ScrollPresenterDimension::HorizontalScroll)
05065             {
05066                 m_horizontalSnapPointsNeedViewportUpdates |= snapPointNeedsViewportUpdates;
05067             }
05068             else
05069             {
05070                 m_verticalSnapPointsNeedViewportUpdates |= snapPointNeedsViewportUpdates;
05071             }
05072         }
05073         else if (collectionChange == winrt::CollectionChange::Reset ||
05074             collectionChange == winrt::CollectionChange::ItemChanged)
05075         {
05076             // Globally reevaluate the need for viewport updates even for CollectionChange::ItemChanged since
05077             // the old item may or may not have been the sole snap point requiring viewport updates.
05078             const bool snapPointsNeedViewportUpdates = SnapPointsViewportChangedHelper(snapPoints, viewportSize);
05079
05080             if (dimension == ScrollPresenterDimension::HorizontalScroll)
05081             {
05082                 m_horizontalSnapPointsNeedViewportUpdates = snapPointsNeedViewportUpdates;
05083             }
05084             else
05085             {
05086                 m_verticalSnapPointsNeedViewportUpdates = snapPointsNeedViewportUpdates;
05087             }
05088         }
05089     }
05090
05091     switch (collectionChange)
05092     {
05093     case winrt::CollectionChange::ItemInserted:
05094     {
05095         if (!insertedItem)
05096         {
05097             insertedItem = snapPoints.GetAt(args.Index());
05098         }
05099
05100         std::shared_ptr<SnapPointWrapper<T>> insertedSnapPointWrapper =
05101             std::make_shared<SnapPointWrapper<T>>(insertedItem);
05102
05103         SnapPointsVectorItemInsertedHelper(insertedSnapPointWrapper, snapPointsSet);
05104         break;
05105     }
05106     case winrt::CollectionChange::Reset:
05107     case winrt::CollectionChange::ItemRemoved:
05108     case winrt::CollectionChange::ItemChanged:
05109     {
05110         RegenerateSnapPointsSet(snapPoints, snapPointsSet);
05111         break;
05112     }
05113     default:
05114         MUX_ASSERT(false);
05115         break;
05116     }
05117
05118     SetupSnapPoints(snapPointsSet, dimension);
05119 }
05120
05121 template <typename T>
05122 void ScrollPresenter::SnapPointsVectorItemInsertedHelper(
05123     std::shared_ptr<SnapPointWrapper<T>> insertedItem,
05124     std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet)
05125 {
05126     if (snapPointsSet->empty())
05127     {
05128         snapPointsSet->insert(insertedItem);
05129         return;
05130     }
05131
05132     winrt::SnapPointBase winrtInsertedItem = insertedItem->SnapPoint().as<winrt::SnapPointBase>();
05133     auto lowerBound = snapPointsSet->lower_bound(insertedItem);
05134
05135     if (lowerBound != snapPointsSet->end())
05136     {
05137         winrt::SnapPointBase winrtSnapPointBase = (*lowerBound)->SnapPoint().as<winrt::SnapPointBase>();
05138         SnapPointBase* lowerSnapPoint = winrt::get_self<SnapPointBase>(winrtSnapPointBase);
05139
05140         if (*lowerSnapPoint == winrt::get_self<SnapPointBase>(winrtInsertedItem))
05141         {
05142             (*lowerBound)->Combine(insertedItem.get());
05143             return;
05144         }
05145         lowerBound++;
05146     }
05147     if (lowerBound != snapPointsSet->end())
05148     {
05149         winrt::SnapPointBase winrtSnapPointBase = (*lowerBound)->SnapPoint().as<winrt::SnapPointBase>();
05150         SnapPointBase* upperSnapPoint = winrt::get_self<SnapPointBase>(winrtSnapPointBase);
05151
05152         if (*upperSnapPoint == winrt::get_self<SnapPointBase>(winrtInsertedItem))
05153         {
05154             (*lowerBound)->Combine(insertedItem.get());
05155             return;
05156         }
05157     }
05158     snapPointsSet->insert(insertedItem);
05159 }
05160
05161 template <typename T>
05162 void ScrollPresenter::RegenerateSnapPointsSet(
05163     winrt::IObservableVector<T> const& userVector,
05164     std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* internalSet)
05165 {
05166     MUX_ASSERT(internalSet);
05167
05168     internalSet->clear();
05169     for (T snapPoint : userVector)
05170     {
05171         std::shared_ptr<SnapPointWrapper<T>> snapPointWrapper =
05172             std::make_shared<SnapPointWrapper<T>>(snapPoint);
05173
05174         SnapPointsVectorItemInsertedHelper(snapPointWrapper, internalSet);
05175     }
05176 }
05177
05178 void ScrollPresenter::UpdateContent(
05179     const winrt::UIElement& oldContent,
05180     const winrt::UIElement& newContent)
05181 {
05182     auto children = Children();
05183     children.Clear();
05184
05185     UnhookContentPropertyChanged(oldContent);
05186
05187     if (newContent)
05188     {
05189         children.Append(newContent);
05190
05191         if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation)
05192         {
05193             UpdatePositionBoundaries(newContent);
05194         }
05195         else if (m_interactionTracker)
05196         {
05197             EnsurePositionBoundariesExpressionAnimations();
05198             SetupPositionBoundariesExpressionAnimations(newContent);
05199         }
05200
05201         if (m_translationExpressionAnimation && m_zoomFactorExpressionAnimation)
05202         {
05203             UpdateTransformSource(oldContent, newContent);
05204         }
05205         else if (m_interactionTracker)
05206         {
05207             EnsureTransformExpressionAnimations();
05208             SetupTransformExpressionAnimations(newContent);
05209         }
05210
05211         HookContentPropertyChanged(newContent);
05212     }
05213     else
05214     {
05215         UpdateUnzoomedExtentAndViewport(
05216             false /*renderSizeChanged*/,
05217             0.0 /*unzoomedExtentWidth*/,
05218             0.0 /*unzoomedExtentHeight*/,
05219             m_viewportWidth,
05220             m_viewportHeight);
05221
05222         if (m_contentLayoutOffsetX != 0.0f)
05223         {
05224             m_contentLayoutOffsetX = 0.0f;
05225             OnContentLayoutOffsetChanged(ScrollPresenterDimension::HorizontalScroll);
05226         }
05227
05228         if (m_contentLayoutOffsetY != 0.0f)
05229         {
05230             m_contentLayoutOffsetY = 0.0f;
05231             OnContentLayoutOffsetChanged(ScrollPresenterDimension::VerticalScroll);
05232         }
05233
05234         if (!m_interactionTracker || (m_zoomedHorizontalOffset == 0.0 && m_zoomedVerticalOffset == 0.0))
05235         {
05236             // Complete all active or delayed operations when there is no InteractionTracker, when the old content
05237             // was already at offsets (0,0). The ScrollToOffsets request below will result in their completion otherwise.
05238             CompleteInteractionTrackerOperations(
05239                 -1 /*requestId*/,
05240                 ScrollPresenterViewChangeResult::Interrupted /*operationResult*/,
05241                 ScrollPresenterViewChangeResult::Ignored     /*unused priorNonAnimatedOperationsResult*/,
05242                 ScrollPresenterViewChangeResult::Ignored     /*unused priorAnimatedOperationsResult*/,
05243                 true  /*completeNonAnimatedOperation*/,
05244                 true  /*completeAnimatedOperation*/,
05245                 false /*completePriorNonAnimatedOperations*/,
05246                 false /*completePriorAnimatedOperations*/);
05247         }
05248
05249         if (m_interactionTracker)
05250         {
05251             if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation)
05252             {
05253                 UpdatePositionBoundaries(nullptr);
05254             }
05255             if (m_translationExpressionAnimation && m_zoomFactorExpressionAnimation)
05256             {
05257                 StopTransformExpressionAnimations(oldContent);
05258             }
05259             ScrollToOffsets(0.0 /*zoomedHorizontalOffset*/, 0.0 /*zoomedVerticalOffset*/);
05260         }
05261     }
05262 }
05263
05264 void ScrollPresenter::UpdatePositionBoundaries(
05265     const winrt::UIElement& content)
05266 {
05267     MUX_ASSERT(m_minPositionExpressionAnimation);
05268     MUX_ASSERT(m_maxPositionExpressionAnimation);
05269     MUX_ASSERT(m_interactionTracker);
05270
05271     if (!content)
05272     {
05273         const winrt::float3 boundaryPosition(0.0f);
05274
05275         m_interactionTracker.MinPosition(boundaryPosition);
05276         m_interactionTracker.MaxPosition(boundaryPosition);
05277     }
05278     else
05279     {
05280         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"contentSizeX", m_unzoomedExtentWidth);
05281         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"contentSizeY", m_unzoomedExtentHeight);
05282         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"contentLayoutOffsetX", m_contentLayoutOffsetX);
05283         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"contentLayoutOffsetY", m_contentLayoutOffsetY);
05284
05285         m_minPositionExpressionAnimation.SetScalarParameter(L"contentSizeX", static_cast<float>(m_unzoomedExtentWidth));
05286         m_maxPositionExpressionAnimation.SetScalarParameter(L"contentSizeX", static_cast<float>(m_unzoomedExtentWidth));
05287         m_minPositionExpressionAnimation.SetScalarParameter(L"contentSizeY", static_cast<float>(m_unzoomedExtentHeight));
05288         m_maxPositionExpressionAnimation.SetScalarParameter(L"contentSizeY", static_cast<float>(m_unzoomedExtentHeight));
05289
05290         m_minPositionExpressionAnimation.SetScalarParameter(L"contentLayoutOffsetX", m_contentLayoutOffsetX);
05291         m_maxPositionExpressionAnimation.SetScalarParameter(L"contentLayoutOffsetX", m_contentLayoutOffsetX);
05292         m_minPositionExpressionAnimation.SetScalarParameter(L"contentLayoutOffsetY", m_contentLayoutOffsetY);
05293         m_maxPositionExpressionAnimation.SetScalarParameter(L"contentLayoutOffsetY", m_contentLayoutOffsetY);
05294
05295         m_interactionTracker.StartAnimation(s_minPositionSourcePropertyName, m_minPositionExpressionAnimation);
05296         RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_minPositionSourcePropertyName /*propertyName*/);
05297
05298         m_interactionTracker.StartAnimation(s_maxPositionSourcePropertyName, m_maxPositionExpressionAnimation);
05299         RaiseExpressionAnimationStatusChanged(true /*isExpressionAnimationStarted*/, s_maxPositionSourcePropertyName /*propertyName*/);
05300     }
05301
05302 #ifdef DBG
05303     DumpMinMaxPositions();
05304 #endif // DBG
05305 }
05306
05307 void ScrollPresenter::UpdateTransformSource(
05308     const winrt::UIElement& oldContent,
05309     const winrt::UIElement& newContent)
05310 {
05311     MUX_ASSERT(m_translationExpressionAnimation && m_zoomFactorExpressionAnimation);
05312     MUX_ASSERT(m_interactionTracker);
05313
05314     StopTransformExpressionAnimations(oldContent);
05315     StartTransformExpressionAnimations(newContent);
05316 }
05317
05318 void ScrollPresenter::UpdateState(
05319     const winrt::ScrollingInteractionState& state)
05320 {
05321     if (state != winrt::ScrollingInteractionState::Idle)
05322     {
05323         // Restart the interrupted expression animations sooner than planned to visualize the new view change immediately.
05324         StartTranslationAndZoomFactorExpressionAnimations(true /*interruptCountdown*/);
05325     }
05326
05327     if (state != m_state)
05328     {
05329         m_state = state;
05330         RaiseStateChanged();
05331     }
05332 }
05333
05334 void ScrollPresenter::UpdateExpressionAnimationSources()
05335 {
05336     MUX_ASSERT(m_interactionTracker);
05337     MUX_ASSERT(m_expressionAnimationSources);
05338
05339     m_expressionAnimationSources.InsertVector2(s_extentSourcePropertyName, { static_cast<float>(m_unzoomedExtentWidth), static_cast<float>(m_unzoomedExtentHeight) });
05340     m_expressionAnimationSources.InsertVector2(s_viewportSourcePropertyName, { static_cast<float>(m_viewportWidth), static_cast<float>(m_viewportHeight) });
05341 }
05342
05343 void ScrollPresenter::UpdateUnzoomedExtentAndViewport(
05344     bool renderSizeChanged,
05345     double unzoomedExtentWidth,
05346     double unzoomedExtentHeight,
05347     double viewportWidth,
05348     double viewportHeight)
05349 {
05350     const winrt::UIElement content = Content();
05351     const winrt::UIElement thisAsUIE = *this;
05352     const double oldUnzoomedExtentWidth = m_unzoomedExtentWidth;
05353     const double oldUnzoomedExtentHeight = m_unzoomedExtentHeight;
05354     const double oldViewportWidth = m_viewportWidth;
05355     const double oldViewportHeight = m_viewportHeight;
05356
05357     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"renderSizeChanged", renderSizeChanged);
05358     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL_DBL, METH_NAME, this, L"old/new unzoomedExtentWidth", oldUnzoomedExtentWidth, unzoomedExtentWidth);
05359     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL_DBL, METH_NAME, this, L"old/new unzoomedExtentHeight", oldUnzoomedExtentHeight, unzoomedExtentHeight);
05360     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL_DBL, METH_NAME, this, L"old/new viewportWidth", oldViewportWidth, viewportWidth);
05361     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL_DBL, METH_NAME, this, L"old/new viewportHeight", oldViewportHeight, viewportHeight);
05362
05363     MUX_ASSERT(!isinf(unzoomedExtentWidth));
05364     MUX_ASSERT(!isnan(unzoomedExtentWidth));
05365     MUX_ASSERT(!isinf(unzoomedExtentHeight));
05366     MUX_ASSERT(!isnan(unzoomedExtentHeight));
05367
05368     MUX_ASSERT(!isinf(viewportWidth));
05369     MUX_ASSERT(!isnan(viewportWidth));
05370     MUX_ASSERT(!isinf(viewportHeight));
05371     MUX_ASSERT(!isnan(viewportHeight));
05372
05373     MUX_ASSERT(unzoomedExtentWidth >= 0.0);
05374     MUX_ASSERT(unzoomedExtentHeight >= 0.0);
05375     MUX_ASSERT(!(!content && unzoomedExtentWidth != 0.0));
05376     MUX_ASSERT(!(!content && unzoomedExtentHeight != 0.0));
05377
05378     const bool horizontalExtentChanged = oldUnzoomedExtentWidth != unzoomedExtentWidth;
05379     const bool verticalExtentChanged = oldUnzoomedExtentHeight != unzoomedExtentHeight;
05380     const bool extentChanged = horizontalExtentChanged || verticalExtentChanged;
05381
05382     const bool horizontalViewportChanged = oldViewportWidth != viewportWidth;
05383     const bool verticalViewportChanged = oldViewportHeight != viewportHeight;
05384     const bool viewportChanged = horizontalViewportChanged || verticalViewportChanged;
05385
05386     m_unzoomedExtentWidth = unzoomedExtentWidth;
05387     m_unzoomedExtentHeight = unzoomedExtentHeight;
05388
05389     m_viewportWidth = viewportWidth;
05390     m_viewportHeight = viewportHeight;
05391
05392     if (m_expressionAnimationSources)
05393     {
05394         UpdateExpressionAnimationSources();
05395     }
05396
05397     if ((extentChanged || renderSizeChanged) && content)
05398     {
05399         OnContentSizeChanged(content);
05400     }
05401
05402     if (extentChanged || viewportChanged)
05403     {
05404         MaximizeInteractionTrackerOperationsTicksCountdown();
05405         UpdateScrollAutomationPatternProperties();
05406     }
05407
05408     if (horizontalExtentChanged || horizontalViewportChanged)
05409     {
05410         // Updating the horizontal scroll mode because GetComputedScrollMode is function of the scrollable width.
05411         UpdateVisualInteractionSourceMode(ScrollPresenterDimension::HorizontalScroll);
05412
05413         UpdateScrollControllerValues(ScrollPresenterDimension::HorizontalScroll);
05414     }
05415
05416     if (verticalExtentChanged || verticalViewportChanged)
05417     {
05418         // Updating the vertical scroll mode because GetComputedScrollMode is function of the scrollable height.
05419         UpdateVisualInteractionSourceMode(ScrollPresenterDimension::VerticalScroll);
05420
05421         UpdateScrollControllerValues(ScrollPresenterDimension::VerticalScroll);
05422     }
05423
05424     if (horizontalViewportChanged && m_horizontalSnapPoints && m_horizontalSnapPointsNeedViewportUpdates)
05425     {
05426         // At least one horizontal scroll snap point is not near-aligned and is thus sensitive to the
05427         // viewport width. Regenerate and set up all horizontal scroll snap points.
05428         const auto horizontalSnapPoints = m_horizontalSnapPoints.try_as<winrt::IObservableVector<winrt::ScrollSnapPointBase>>();
05429         const bool horizontalSnapPointsNeedViewportUpdates = SnapPointsViewportChangedHelper(
05430             horizontalSnapPoints,
05431             m_viewportWidth);
05432         MUX_ASSERT(horizontalSnapPointsNeedViewportUpdates);
05433
05434         RegenerateSnapPointsSet(horizontalSnapPoints, &m_sortedConsolidatedHorizontalSnapPoints);
05435         SetupSnapPoints(&m_sortedConsolidatedHorizontalSnapPoints, ScrollPresenterDimension::HorizontalScroll);
05436     }
05437
05438     if (verticalViewportChanged && m_verticalSnapPoints && m_verticalSnapPointsNeedViewportUpdates)
05439     {
05440         // At least one vertical scroll snap point is not near-aligned and is thus sensitive to the
05441         // viewport height. Regenerate and set up all vertical scroll snap points.
05442         const auto verticalSnapPoints = m_verticalSnapPoints.try_as<winrt::IObservableVector<winrt::ScrollSnapPointBase>>();
05443         const bool verticalSnapPointsNeedViewportUpdates = SnapPointsViewportChangedHelper(
05444             verticalSnapPoints,
05445             m_viewportHeight);
05446         MUX_ASSERT(verticalSnapPointsNeedViewportUpdates);
05447
05448         RegenerateSnapPointsSet(verticalSnapPoints, &m_sortedConsolidatedVerticalSnapPoints);
05449         SetupSnapPoints(&m_sortedConsolidatedVerticalSnapPoints, ScrollPresenterDimension::VerticalScroll);
05450     }
05451
05452     if (extentChanged)
05453     {
05454         RaiseExtentChanged();
05455     }
05456 }
05457
05458 // Raise automation peer property change events
05459 void ScrollPresenter::UpdateScrollAutomationPatternProperties()
05460 {
05461     if (winrt::AutomationPeer automationPeer = winrt::FrameworkElementAutomationPeer::FromElement(*this))
05462     {
05463         winrt::ScrollPresenterAutomationPeer scrollPresenterAutomationPeer = automationPeer.try_as<winrt::ScrollPresenterAutomationPeer>();
05464         if (scrollPresenterAutomationPeer)
05465         {
05466             winrt::get_self<ScrollPresenterAutomationPeer>(scrollPresenterAutomationPeer)->UpdateScrollPatternProperties();
05467         }
05468     }
05469 }
05470
05471 void ScrollPresenter::UpdateAnticipatedOffset(ScrollPresenterDimension dimension, double zoomedOffset)
05472 {
05473     if (dimension == ScrollPresenterDimension::HorizontalScroll)
05474     {
05475         if (m_anticipatedZoomedHorizontalOffset != zoomedOffset)
05476         {
05477             SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL_DBL, METH_NAME, this, L"old/new anticipatedZoomedHorizontalOffset", m_anticipatedZoomedHorizontalOffset, zoomedOffset);
05478
05479             m_anticipatedZoomedHorizontalOffset = zoomedOffset;
05480         }
05481     }
05482     else
05483     {
05484         MUX_ASSERT(dimension == ScrollPresenterDimension::VerticalScroll);
05485         if (m_anticipatedZoomedVerticalOffset != zoomedOffset)
05486         {
05487             SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL_DBL, METH_NAME, this, L"old/new anticipatedZoomedVerticalOffset", m_anticipatedZoomedVerticalOffset, zoomedOffset);
05488
05489             m_anticipatedZoomedVerticalOffset = zoomedOffset;
05490         }
05491     }
05492 }
05493
05494 void ScrollPresenter::UpdateAnticipatedZoomFactor(float zoomFactor)
05495 {
05496     if (m_anticipatedZoomFactor != zoomFactor)
05497     {
05498         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"old/new anticipatedZoomFactor", m_anticipatedZoomFactor, zoomFactor);
05499
05500         m_anticipatedZoomFactor = zoomFactor;
05501     }
05502 }
05503
05504 void ScrollPresenter::UpdateOffset(ScrollPresenterDimension dimension, double zoomedOffset)
05505 {
05506     if (dimension == ScrollPresenterDimension::HorizontalScroll)
05507     {
05508         if (m_zoomedHorizontalOffset != zoomedOffset)
05509         {
05510             SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL_DBL, METH_NAME, this, L"old/new zoomedHorizontalOffset", m_zoomedHorizontalOffset, zoomedOffset);
05511
05512             m_zoomedHorizontalOffset = zoomedOffset;
05513         }
05514     }
05515     else
05516     {
05517         MUX_ASSERT(dimension == ScrollPresenterDimension::VerticalScroll);
05518         if (m_zoomedVerticalOffset != zoomedOffset)
05519         {
05520             SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL_DBL, METH_NAME, this, L"old/new zoomedVerticalOffset", m_zoomedVerticalOffset, zoomedOffset);
05521
05522             m_zoomedVerticalOffset = zoomedOffset;
05523         }
05524     }
05525 }
05526
05527 void ScrollPresenter::UpdateScrollControllerIsScrollable(ScrollPresenterDimension dimension)
05528 {
05529     if (dimension == ScrollPresenterDimension::HorizontalScroll)
05530     {
05531         if (m_horizontalScrollController)
05532         {
05533             m_horizontalScrollController.get().SetIsScrollable(ComputedHorizontalScrollMode() == winrt::ScrollingScrollMode::Enabled);
05534         }
05535     }
05536     else
05537     {
05538         MUX_ASSERT(dimension == ScrollPresenterDimension::VerticalScroll);
05539
05540         if (m_verticalScrollController)
05541         {
05542             m_verticalScrollController.get().SetIsScrollable(ComputedVerticalScrollMode() == winrt::ScrollingScrollMode::Enabled);
05543         }
05544     }
05545 }
05546
05547 void ScrollPresenter::UpdateScrollControllerValues(ScrollPresenterDimension dimension)
05548 {
05549     if (dimension == ScrollPresenterDimension::HorizontalScroll)
05550     {
05551         if (m_horizontalScrollController)
05552         {
05553             m_horizontalScrollController.get().SetValues(
05554                 0.0 /*minOffset*/,
05555                 ScrollableWidth() /*maxOffset*/,
05556                 m_zoomedHorizontalOffset /*offset*/,
05557                 ViewportWidth() /*viewportLength*/);
05558         }
05559     }
05560     else
05561     {
05562         MUX_ASSERT(dimension == ScrollPresenterDimension::VerticalScroll);
05563
05564         if (m_verticalScrollController)
05565         {
05566             m_verticalScrollController.get().SetValues(
05567                 0.0 /*minOffset*/,
05568                 ScrollableHeight() /*maxOffset*/,
05569                 m_zoomedVerticalOffset /*offset*/,
05570                 ViewportHeight() /*viewportLength*/);
05571         }
05572     }
05573 }
05574
05575 void ScrollPresenter::UpdateVisualInteractionSourceMode(ScrollPresenterDimension dimension)
05576 {
05577     const winrt::ScrollingScrollMode scrollMode = GetComputedScrollMode(dimension);
05578
05579     if (m_scrollPresenterVisualInteractionSource)
05580     {
05581         SetupVisualInteractionSourceMode(
05582             m_scrollPresenterVisualInteractionSource,
05583             dimension,
05584             scrollMode);
05585
05586 #ifdef IsMouseWheelScrollDisabled
05587         SetupVisualInteractionSourcePointerWheelConfig(
05588             m_scrollPresenterVisualInteractionSource,
05589             dimension,
05590             GetComputedMouseWheelScrollMode(dimension));
05591 #endif
05592     }
05593
05594     UpdateScrollControllerIsScrollable(dimension);
05595 }
05596
05597 void ScrollPresenter::UpdateManipulationRedirectionMode()
05598 {
05599     if (m_scrollPresenterVisualInteractionSource)
05600     {
05601         SetupVisualInteractionSourceRedirectionMode(m_scrollPresenterVisualInteractionSource);
05602     }
05603 }
05604
05605 void ScrollPresenter::OnContentSizeChanged(const winrt::UIElement& content)
05606 {
05607     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
05608
05609     if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation)
05610     {
05611         UpdatePositionBoundaries(content);
05612     }
05613
05614     if (m_interactionTracker && m_translationExpressionAnimation && m_zoomFactorExpressionAnimation)
05615     {
05616         SetupTransformExpressionAnimations(content);
05617     }
05618 }
05619
05620 void ScrollPresenter::OnViewChanged(bool horizontalOffsetChanged, bool verticalOffsetChanged)
05621 {
05622     //SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, horizontalOffsetChanged, verticalOffsetChanged);
05623     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL_DBL_FLT, METH_NAME, this, m_zoomedHorizontalOffset, m_zoomedVerticalOffset, m_zoomFactor);
05624
05625     if (horizontalOffsetChanged)
05626     {
05627         UpdateScrollControllerValues(ScrollPresenterDimension::HorizontalScroll);
05628     }
05629
05630     if (verticalOffsetChanged)
05631     {
05632         UpdateScrollControllerValues(ScrollPresenterDimension::VerticalScroll);
05633     }
05634
05635     UpdateScrollAutomationPatternProperties();
05636
05637     RaiseViewChanged();
05638 }
05639
05640 void ScrollPresenter::OnContentLayoutOffsetChanged(ScrollPresenterDimension dimension)
05641 {
05642 #ifdef DBG
05643     MUX_ASSERT(dimension == ScrollPresenterDimension::HorizontalScroll || dimension == ScrollPresenterDimension::VerticalScroll);
05644
05645     if (dimension == ScrollPresenterDimension::HorizontalScroll)
05646     {
05647         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"Horizontal", m_contentLayoutOffsetX);
05648     }
05649     else
05650     {
05651         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"Vertical", m_contentLayoutOffsetY);
05652     }
05653 #endif
05654
05655     com_ptr<ScrollPresenterTestHooks> globalTestHooks = ScrollPresenterTestHooks::GetGlobalTestHooks();
05656
05657     if (globalTestHooks)
05658     {
05659         if (dimension == ScrollPresenterDimension::HorizontalScroll)
05660         {
05661             globalTestHooks->NotifyContentLayoutOffsetXChanged(*this);
05662         }
05663         else
05664         {
05665             globalTestHooks->NotifyContentLayoutOffsetYChanged(*this);
05666         }
05667     }
05668
05669     if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation)
05670     {
05671         const winrt::UIElement content = Content();
05672
05673         if (content)
05674         {
05675             UpdatePositionBoundaries(content);
05676         }
05677     }
05678
05679     if (m_expressionAnimationSources)
05680     {
05681         m_expressionAnimationSources.InsertVector2(s_offsetSourcePropertyName, { m_contentLayoutOffsetX, m_contentLayoutOffsetY });
05682     }
05683
05684     if (m_scrollPresenterVisualInteractionSource)
05685     {
05686         SetupVisualInteractionSourceCenterPointModifier(
05687             m_scrollPresenterVisualInteractionSource,
05688             dimension,
05689             false /*flowDirectionChanged*/);
05690     }
05691 }
05692
05693 void ScrollPresenter::ChangeOffsetsPrivate(
05694     double zoomedHorizontalOffset,
05695     double zoomedVerticalOffset,
05696     ScrollPresenterViewKind offsetsKind,
05697     winrt::ScrollingScrollOptions const& options,
05698     winrt::BringIntoViewRequestedEventArgs const& bringIntoViewRequestedEventArgs,
05699     InteractionTrackerAsyncOperationTrigger operationTrigger,
05700     int32_t existingViewChangeCorrelationId,
05701     _Out_opt_ int32_t* viewChangeCorrelationId)
05702 {
05703     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL_DBL_STR, METH_NAME, this,
05704         zoomedHorizontalOffset,
05705         zoomedVerticalOffset,
05706         TypeLogging::ScrollOptionsToString(options).c_str());
05707     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this,
05708         TypeLogging::InteractionTrackerAsyncOperationTriggerToString(operationTrigger).c_str(),
05709         TypeLogging::ScrollPresenterViewKindToString(offsetsKind).c_str());
05710 #ifdef DBG
05711     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
05712         L"existingViewChangeCorrelationId",
05713         existingViewChangeCorrelationId);
05714
05715     if (bringIntoViewRequestedEventArgs)
05716     {
05717         SCROLLPRESENTER_TRACE_VERBOSE(*this, L"%s[0x%p](bringIntoViewRequestedEventArgs: AnimationDesired:%d, H/V AlignmentRatio:%lf,%lf, H/V Offset:%f,%f, TargetRect:%s, TargetElement:0x%p)\n",
05718             METH_NAME, this,
05719             bringIntoViewRequestedEventArgs.AnimationDesired(),
05720             bringIntoViewRequestedEventArgs.HorizontalAlignmentRatio(), bringIntoViewRequestedEventArgs.VerticalAlignmentRatio(),
05721             bringIntoViewRequestedEventArgs.HorizontalOffset(), bringIntoViewRequestedEventArgs.VerticalOffset(),
05722             TypeLogging::RectToString(bringIntoViewRequestedEventArgs.TargetRect()).c_str(),
05723             bringIntoViewRequestedEventArgs.TargetElement());
05724     }
05725 #endif
05726
05727     if (viewChangeCorrelationId)
05728     {
05729         *viewChangeCorrelationId = s_noOpCorrelationId;
05730     }
05731
05732     winrt::ScrollingAnimationMode animationMode = options ? options.AnimationMode() : ScrollingScrollOptions::s_defaultAnimationMode;
05733     winrt::ScrollingSnapPointsMode snapPointsMode = options ? options.SnapPointsMode() : ScrollingScrollOptions::s_defaultSnapPointsMode;
05734     InteractionTrackerAsyncOperationType operationType;
05735
05736     animationMode = GetComputedAnimationMode(animationMode);
05737
05738     switch (animationMode)
05739     {
05740     case winrt::ScrollingAnimationMode::Disabled:
05741     {
05742         switch (offsetsKind)
05743         {
05744         case ScrollPresenterViewKind::Absolute:
05745 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
05746         case ScrollPresenterViewKind::RelativeToEndOfInertiaView:
05747 #endif
05748         {
05749             operationType = InteractionTrackerAsyncOperationType::TryUpdatePosition;
05750             break;
05751         }
05752         case ScrollPresenterViewKind::RelativeToCurrentView:
05753         {
05754             operationType = InteractionTrackerAsyncOperationType::TryUpdatePositionBy;
05755             break;
05756         }
05757         }
05758         break;
05759     }
05760     case winrt::ScrollingAnimationMode::Enabled:
05761     {
05762         switch (offsetsKind)
05763         {
05764         case ScrollPresenterViewKind::Absolute:
05765         case ScrollPresenterViewKind::RelativeToCurrentView:
05766 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
05767         case ScrollPresenterViewKind::RelativeToEndOfInertiaView:
05768 #endif
05769         {
05770             operationType = InteractionTrackerAsyncOperationType::TryUpdatePositionWithAnimation;
05771             break;
05772         }
05773         }
05774         break;
05775     }
05776     }
05777
05778     if (!Content())
05779     {
05780         // When there is no content, skip the view change request and return -1, indicating that no action was taken.
05781         return;
05782     }
05783
05784     // When the ScrollPresenter is not loaded or not set up yet, delay the offsets change request until it gets loaded.
05785     // OnCompositionTargetRendering will launch the delayed changes at that point.
05786     bool delayOperation = !IsLoadedAndSetUp();
05787
05788     com_ptr<ScrollingScrollOptions> optionsClone{ nullptr };
05789
05790     // Clone the options for this request if needed. The clone or original options will be used if the operation ever gets processed.
05791     const bool isScrollControllerRequest =
05792         static_cast<char>(operationTrigger) &
05793         (static_cast<char>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest) |
05794             static_cast<char>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest));
05795
05796     if (options && !isScrollControllerRequest)
05797     {
05798         // Options are cloned so that they can be modified by the caller after this offsets change call without affecting the outcome of the operation.
05799         optionsClone = winrt::make_self<ScrollingScrollOptions>(
05800             animationMode,
05801             snapPointsMode);
05802     }
05803
05804     if (!delayOperation)
05805     {
05806         MUX_ASSERT(m_interactionTracker);
05807
05808         // Prevent any existing delayed operation from being processed after this request and overriding it.
05809         // All delayed operations are completed with the Interrupted result.
05810         CompleteDelayedOperations();
05811
05812         HookCompositionTargetRendering();
05813     }
05814
05815     std::shared_ptr<ViewChange> offsetsChange = nullptr;
05816
05817     if (static_cast<char>(operationTrigger) & static_cast<char>(InteractionTrackerAsyncOperationTrigger::BringIntoViewRequest))
05818     {
05819         // Bring-into-view operations use a richer version of OffsetsChange which includes
05820         // information extracted from the BringIntoViewRequestedEventArgs instance.
05821         // This allows to use ComputeBringIntoViewUpdatedTargetOffsets just before invoking
05822         // the InteractionTracker's TryUpdatePosition.
05823         offsetsChange = std::make_shared<BringIntoViewOffsetsChange>(
05824             this,
05825             zoomedHorizontalOffset,
05826             zoomedVerticalOffset,
05827             offsetsKind,
05828             optionsClone ? static_cast<winrt::IInspectable>(*optionsClone) : static_cast<winrt::IInspectable>(options),
05829             bringIntoViewRequestedEventArgs.TargetElement(),
05830             bringIntoViewRequestedEventArgs.TargetRect(),
05831             bringIntoViewRequestedEventArgs.HorizontalAlignmentRatio(),
05832             bringIntoViewRequestedEventArgs.VerticalAlignmentRatio(),
05833             bringIntoViewRequestedEventArgs.HorizontalOffset(),
05834             bringIntoViewRequestedEventArgs.VerticalOffset());
05835     }
05836     else
05837     {
05838         offsetsChange = std::make_shared<OffsetsChange>(
05839             zoomedHorizontalOffset,
05840             zoomedVerticalOffset,
05841             offsetsKind,
05842             optionsClone ? static_cast<winrt::IInspectable>(*optionsClone) : static_cast<winrt::IInspectable>(options));
05843     }
05844
05845     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation(
05846         std::make_shared<InteractionTrackerAsyncOperation>(
05847             operationType,
05848             operationTrigger,
05849             delayOperation,
05850             offsetsChange));
05851
05852     if (operationTrigger != InteractionTrackerAsyncOperationTrigger::DirectViewChange)
05853     {
05854         // User-triggered or bring-into-view operations are processed as quickly as possible by minimizing their TicksCountDown
05855         const int ticksCountdown = GetInteractionTrackerOperationsTicksCountdown();
05856
05857         interactionTrackerAsyncOperation->SetTicksCountdown(std::max(1, ticksCountdown));
05858     }
05859
05860     m_interactionTrackerAsyncOperations.push_back(interactionTrackerAsyncOperation);
05861
05862     if (viewChangeCorrelationId)
05863     {
05864         if (existingViewChangeCorrelationId != s_noOpCorrelationId)
05865         {
05866             interactionTrackerAsyncOperation->SetViewChangeCorrelationId(existingViewChangeCorrelationId);
05867             *viewChangeCorrelationId = existingViewChangeCorrelationId;
05868         }
05869         else
05870         {
05871             m_latestViewChangeCorrelationId = GetNextViewChangeCorrelationId();
05872             interactionTrackerAsyncOperation->SetViewChangeCorrelationId(m_latestViewChangeCorrelationId);
05873             *viewChangeCorrelationId = m_latestViewChangeCorrelationId;
05874         }
05875     }
05876     else if (existingViewChangeCorrelationId != s_noOpCorrelationId)
05877     {
05878         interactionTrackerAsyncOperation->SetViewChangeCorrelationId(existingViewChangeCorrelationId);
05879     }
05880 }
05881
05882 void ScrollPresenter::ChangeOffsetsWithAdditionalVelocityPrivate(
05883     winrt::float2 offsetsVelocity,
05884     winrt::float2 anticipatedOffsetsChange,
05885     winrt::IReference<winrt::float2> inertiaDecayRate,
05886     InteractionTrackerAsyncOperationTrigger operationTrigger,
05887     _Out_opt_ int32_t* viewChangeCorrelationId)
05888 {
05889     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR_STR, METH_NAME, this,
05890         TypeLogging::Float2ToString(offsetsVelocity).c_str(),
05891         TypeLogging::NullableFloat2ToString(inertiaDecayRate).c_str(),
05892         TypeLogging::InteractionTrackerAsyncOperationTriggerToString(operationTrigger).c_str());
05893
05894     if (viewChangeCorrelationId)
05895     {
05896         *viewChangeCorrelationId = s_noOpCorrelationId;
05897     }
05898
05899     if (!Content())
05900     {
05901         // When there is no content, skip the view change request and return -1, indicating that no action was taken.
05902         return;
05903     }
05904
05905     // When the ScrollPresenter is not loaded or not set up yet, delay the offsets change request until it gets loaded.
05906     // OnCompositionTargetRendering will launch the delayed changes at that point.
05907     bool delayOperation = !IsLoadedAndSetUp();
05908
05909     std::shared_ptr<ViewChangeBase> offsetsChangeWithAdditionalVelocity =
05910         std::make_shared<OffsetsChangeWithAdditionalVelocity>(
05911             offsetsVelocity, anticipatedOffsetsChange, inertiaDecayRate);
05912
05913     if (!delayOperation)
05914     {
05915         MUX_ASSERT(m_interactionTracker);
05916
05917         // Prevent any existing delayed operation from being processed after this request and overriding it.
05918         // All delayed operations are completed with the Interrupted result.
05919         CompleteDelayedOperations();
05920
05921         HookCompositionTargetRendering();
05922     }
05923
05924     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation(
05925         std::make_shared<InteractionTrackerAsyncOperation>(
05926             InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity,
05927             operationTrigger,
05928             delayOperation,
05929             offsetsChangeWithAdditionalVelocity));
05930
05931     if (operationTrigger != InteractionTrackerAsyncOperationTrigger::DirectViewChange)
05932     {
05933         // User-triggered or bring-into-view operations are processed as quickly as possible by minimizing their TicksCountDown
05934         const int ticksCountdown = GetInteractionTrackerOperationsTicksCountdown();
05935
05936         interactionTrackerAsyncOperation->SetTicksCountdown(std::max(1, ticksCountdown));
05937     }
05938
05939     m_interactionTrackerAsyncOperations.push_back(interactionTrackerAsyncOperation);
05940
05941     if (viewChangeCorrelationId)
05942     {
05943         m_latestViewChangeCorrelationId = GetNextViewChangeCorrelationId();
05944         interactionTrackerAsyncOperation->SetViewChangeCorrelationId(m_latestViewChangeCorrelationId);
05945         *viewChangeCorrelationId = m_latestViewChangeCorrelationId;
05946     }
05947 }
05948
05949 void ScrollPresenter::ChangeZoomFactorPrivate(
05950     float zoomFactor,
05951     winrt::IReference<winrt::float2> centerPoint,
05952     ScrollPresenterViewKind zoomFactorKind,
05953     winrt::ScrollingZoomOptions const& options,
05954     _Out_opt_ int32_t* viewChangeCorrelationId)
05955 {
05956     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
05957         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
05958         zoomFactor);
05959     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this,
05960         TypeLogging::ScrollPresenterViewKindToString(zoomFactorKind).c_str(),
05961         TypeLogging::ZoomOptionsToString(options).c_str());
05962
05963     if (viewChangeCorrelationId)
05964     {
05965         *viewChangeCorrelationId = s_noOpCorrelationId;
05966     }
05967
05968     if (!Content())
05969     {
05970         // When there is no content, skip the view change request and return -1, indicating that no action was taken.
05971         return;
05972     }
05973
05974     winrt::ScrollingAnimationMode animationMode = options ? options.AnimationMode() : ScrollingZoomOptions::s_defaultAnimationMode;
05975     winrt::ScrollingSnapPointsMode snapPointsMode = options ? options.SnapPointsMode() : ScrollingZoomOptions::s_defaultSnapPointsMode;
05976     InteractionTrackerAsyncOperationType operationType;
05977
05978     animationMode = GetComputedAnimationMode(animationMode);
05979
05980     switch (animationMode)
05981     {
05982     case winrt::ScrollingAnimationMode::Disabled:
05983     {
05984         switch (zoomFactorKind)
05985         {
05986         case ScrollPresenterViewKind::Absolute:
05987 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
05988         case ScrollPresenterViewKind::RelativeToEndOfInertiaView:
05989 #endif
05990         case ScrollPresenterViewKind::RelativeToCurrentView:
05991         {
05992             operationType = InteractionTrackerAsyncOperationType::TryUpdateScale;
05993             break;
05994         }
05995         }
05996         break;
05997     }
05998     case winrt::ScrollingAnimationMode::Enabled:
05999     {
06000         switch (zoomFactorKind)
06001         {
06002         case ScrollPresenterViewKind::Absolute:
06003 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
06004         case ScrollPresenterViewKind::RelativeToEndOfInertiaView:
06005 #endif
06006         case ScrollPresenterViewKind::RelativeToCurrentView:
06007         {
06008             operationType = InteractionTrackerAsyncOperationType::TryUpdateScaleWithAnimation;
06009             break;
06010         }
06011         }
06012         break;
06013     }
06014     }
06015
06016     // When the ScrollPresenter is not loaded or not set up yet (delayOperation==True), delay the zoomFactor change request until it gets loaded.
06017     // OnCompositionTargetRendering will launch the delayed changes at that point.
06018     bool delayOperation = !IsLoadedAndSetUp();
06019
06020     // Set to True when workaround for RS5 InteractionTracker bug 18827625 was applied (i.e. on-going TryUpdateScaleWithAnimation operation
06021     // is interrupted with TryUpdateScale operation).
06022     bool scaleChangeWithAnimationInterrupted = false;
06023
06024     com_ptr<ScrollingZoomOptions> optionsClone{ nullptr };
06025
06026     // Clone the original options if any. The clone will be used if the operation ever gets processed.
06027     if (options)
06028     {
06029         // Options are cloned so that they can be modified by the caller after this zoom factor change call without affecting the outcome of the operation.
06030         optionsClone = winrt::make_self<ScrollingZoomOptions>(
06031             animationMode,
06032             snapPointsMode);
06033     }
06034
06035     if (!delayOperation)
06036     {
06037         MUX_ASSERT(m_interactionTracker);
06038
06039         // Prevent any existing delayed operation from being processed after this request and overriding it.
06040         // All delayed operations are completed with the Interrupted result.
06041         CompleteDelayedOperations();
06042
06043         HookCompositionTargetRendering();
06044     }
06045
06046     std::shared_ptr<ViewChange> zoomFactorChange =
06047         std::make_shared<ZoomFactorChange>(
06048             zoomFactor,
06049             centerPoint,
06050             zoomFactorKind,
06051             optionsClone ? static_cast<winrt::IInspectable>(*optionsClone) : static_cast<winrt::IInspectable>(options));
06052
06053     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation(
06054         std::make_shared<InteractionTrackerAsyncOperation>(
06055             operationType,
06056             InteractionTrackerAsyncOperationTrigger::DirectViewChange,
06057             delayOperation,
06058             zoomFactorChange));
06059
06060     m_interactionTrackerAsyncOperations.push_back(interactionTrackerAsyncOperation);
06061
06062     // Workaround for InteractionTracker bug 22414894 - calling TryUpdateScale after a non-animated view change during the same tick results in an incorrect position.
06063     // That non-animated view change needs to complete before this TryUpdateScale gets invoked.
06064     interactionTrackerAsyncOperation->SetRequiredOperation(GetLastNonAnimatedInteractionTrackerOperation(interactionTrackerAsyncOperation));
06065
06066     if (viewChangeCorrelationId)
06067     {
06068         m_latestViewChangeCorrelationId = GetNextViewChangeCorrelationId();
06069         interactionTrackerAsyncOperation->SetViewChangeCorrelationId(m_latestViewChangeCorrelationId);
06070         *viewChangeCorrelationId = m_latestViewChangeCorrelationId;
06071     }
06072 }
06073
06074 void ScrollPresenter::ChangeZoomFactorWithAdditionalVelocityPrivate(
06075     float zoomFactorVelocity,
06076     float anticipatedZoomFactorChange,
06077     winrt::IReference<winrt::float2> centerPoint,
06078     winrt::IReference<float> inertiaDecayRate,
06079     InteractionTrackerAsyncOperationTrigger operationTrigger,
06080     _Out_opt_ int32_t* viewChangeCorrelationId)
06081 {
06082     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this,
06083         zoomFactorVelocity,
06084         anticipatedZoomFactorChange);
06085     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_STR_STR, METH_NAME, this,
06086         TypeLogging::NullableFloat2ToString(centerPoint).c_str(),
06087         TypeLogging::NullableFloatToString(inertiaDecayRate).c_str(),
06088         TypeLogging::InteractionTrackerAsyncOperationTriggerToString(operationTrigger).c_str());
06089
06090     if (viewChangeCorrelationId)
06091     {
06092         *viewChangeCorrelationId = s_noOpCorrelationId;
06093     }
06094
06095     if (!Content())
06096     {
06097         // When there is no content, skip the view change request and return -1, indicating that no action was taken.
06098         return;
06099     }
06100
06101     // When the ScrollPresenter is not loaded or not set up yet (delayOperation==True), delay the zoom factor change request until it gets loaded.
06102     // OnCompositionTargetRendering will launch the delayed changes at that point.
06103     bool delayOperation = !IsLoadedAndSetUp();
06104
06105     std::shared_ptr<ViewChangeBase> zoomFactorChangeWithAdditionalVelocity =
06106         std::make_shared<ZoomFactorChangeWithAdditionalVelocity>(
06107             zoomFactorVelocity, anticipatedZoomFactorChange, centerPoint, inertiaDecayRate);
06108
06109     if (!delayOperation)
06110     {
06111         MUX_ASSERT(m_interactionTracker);
06112
06113         // Prevent any existing delayed operation from being processed after this request and overriding it.
06114         // All delayed operations are completed with the Interrupted result.
06115         CompleteDelayedOperations();
06116
06117         HookCompositionTargetRendering();
06118     }
06119
06120     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation(
06121         std::make_shared<InteractionTrackerAsyncOperation>(
06122             InteractionTrackerAsyncOperationType::TryUpdateScaleWithAdditionalVelocity,
06123             operationTrigger,
06124             delayOperation,
06125             zoomFactorChangeWithAdditionalVelocity));
06126
06127     if (operationTrigger != InteractionTrackerAsyncOperationTrigger::DirectViewChange)
06128     {
06129         // User-triggered operations are processed as quickly as possible by minimizing their TicksCountDown
06130         const int ticksCountdown = GetInteractionTrackerOperationsTicksCountdown();
06131
06132         interactionTrackerAsyncOperation->SetTicksCountdown(std::max(1, ticksCountdown));
06133     }
06134
06135     m_interactionTrackerAsyncOperations.push_back(interactionTrackerAsyncOperation);
06136
06137     if (viewChangeCorrelationId)
06138     {
06139         m_latestViewChangeCorrelationId = GetNextViewChangeCorrelationId();
06140         interactionTrackerAsyncOperation->SetViewChangeCorrelationId(m_latestViewChangeCorrelationId);
06141         *viewChangeCorrelationId = m_latestViewChangeCorrelationId;
06142     }
06143 }
06144
06145 void ScrollPresenter::ProcessDequeuedViewChange(std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation)
06146 {
06147     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, interactionTrackerAsyncOperation);
06148
06149     MUX_ASSERT(IsLoadedAndSetUp());
06150     MUX_ASSERT(!interactionTrackerAsyncOperation->IsQueued());
06151
06152     std::shared_ptr<ViewChangeBase> viewChangeBase = interactionTrackerAsyncOperation->GetViewChangeBase();
06153
06154     MUX_ASSERT(viewChangeBase);
06155
06156     switch (interactionTrackerAsyncOperation->GetOperationType())
06157     {
06158         case InteractionTrackerAsyncOperationType::TryUpdatePosition:
06159         case InteractionTrackerAsyncOperationType::TryUpdatePositionBy:
06160         case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAnimation:
06161         {
06162             std::shared_ptr<OffsetsChange> offsetsChange = std::reinterpret_pointer_cast<OffsetsChange>(viewChangeBase);
06163
06164             ProcessOffsetsChange(
06165                 interactionTrackerAsyncOperation->GetOperationTrigger() /*operationTrigger*/,
06166                 offsetsChange,
06167                 interactionTrackerAsyncOperation->GetViewChangeCorrelationId() /*offsetsChangeId*/,
06168                 true /*isForAsyncOperation*/);
06169             break;
06170         }
06171         case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity:
06172         {
06173             std::shared_ptr<OffsetsChangeWithAdditionalVelocity> offsetsChangeWithAdditionalVelocity = std::reinterpret_pointer_cast<OffsetsChangeWithAdditionalVelocity>(viewChangeBase);
06174
06175             ProcessOffsetsChange(
06176                 interactionTrackerAsyncOperation->GetOperationTrigger() /*operationTrigger*/,
06177                 offsetsChangeWithAdditionalVelocity);
06178             break;
06179         }
06180         case InteractionTrackerAsyncOperationType::TryUpdateScale:
06181         case InteractionTrackerAsyncOperationType::TryUpdateScaleWithAnimation:
06182         {
06183             std::shared_ptr<ZoomFactorChange> zoomFactorChange = std::reinterpret_pointer_cast<ZoomFactorChange>(viewChangeBase);
06184
06185             ProcessZoomFactorChange(
06186                 zoomFactorChange,
06187                 interactionTrackerAsyncOperation->GetViewChangeCorrelationId() /*zoomFactorChangeId*/);
06188             break;
06189         }
06190         case InteractionTrackerAsyncOperationType::TryUpdateScaleWithAdditionalVelocity:
06191         {
06192             std::shared_ptr<ZoomFactorChangeWithAdditionalVelocity> zoomFactorChangeWithAdditionalVelocity = std::reinterpret_pointer_cast<ZoomFactorChangeWithAdditionalVelocity>(viewChangeBase);
06193
06194             ProcessZoomFactorChange(
06195                 interactionTrackerAsyncOperation->GetOperationTrigger() /*operationTrigger*/,
06196                 zoomFactorChangeWithAdditionalVelocity);
06197             break;
06198         }
06199         default:
06200         {
06201             MUX_ASSERT(false);
06202             break;
06203         }
06204     }
06205     interactionTrackerAsyncOperation->SetRequestId(m_latestInteractionTrackerRequest);
06206 }
06207
06208 // Launches an InteractionTracker request to change the offsets.
06209 void ScrollPresenter::ProcessOffsetsChange(
06210     InteractionTrackerAsyncOperationTrigger operationTrigger,
06211     std::shared_ptr<OffsetsChange> offsetsChange,
06212     int32_t offsetsChangeCorrelationId,
06213     bool isForAsyncOperation)
06214 {
06215     MUX_ASSERT(m_interactionTracker);
06216     MUX_ASSERT(offsetsChange);
06217
06218     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this,
06219         L"operationTrigger", TypeLogging::InteractionTrackerAsyncOperationTriggerToString(operationTrigger).c_str());
06220     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this,
06221         L"viewKind", TypeLogging::ScrollPresenterViewKindToString(offsetsChange->ViewKind()).c_str());
06222     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
06223         L"offsetsChangeCorrelationId", offsetsChangeCorrelationId);
06224     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
06225         L"isForAsyncOperation", isForAsyncOperation);
06226
06227     double zoomedHorizontalOffset = offsetsChange->ZoomedHorizontalOffset();
06228     double zoomedVerticalOffset = offsetsChange->ZoomedVerticalOffset();
06229     winrt::ScrollingScrollOptions options = offsetsChange->Options().try_as<winrt::ScrollingScrollOptions>();
06230
06231     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this,
06232         L"zoomedHorizontalOffset",
06233         zoomedHorizontalOffset);
06234     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this,
06235         L"zoomedVerticalOffset",
06236         zoomedVerticalOffset);
06237     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this,
06238         L"options",
06239         TypeLogging::ScrollOptionsToString(options).c_str());
06240
06241     winrt::ScrollingAnimationMode animationMode = options ? options.AnimationMode() : ScrollingScrollOptions::s_defaultAnimationMode;
06242     const winrt::ScrollingSnapPointsMode snapPointsMode = options ? options.SnapPointsMode() : ScrollingScrollOptions::s_defaultSnapPointsMode;
06243
06244     animationMode = GetComputedAnimationMode(animationMode);
06245
06246     if (static_cast<char>(operationTrigger) & static_cast<char>(InteractionTrackerAsyncOperationTrigger::BringIntoViewRequest))
06247     {
06248         if (winrt::UIElement content = Content())
06249         {
06250             std::shared_ptr<BringIntoViewOffsetsChange> bringIntoViewOffsetsChange = std::reinterpret_pointer_cast<BringIntoViewOffsetsChange>(offsetsChange);
06251
06252             if (bringIntoViewOffsetsChange)
06253             {
06254                 // The target Element may have moved within the Content since the bring-into-view operation was
06255                 // initiated one or more ticks ago in ScrollPresenter::OnBringIntoViewRequestedHandler.
06256                 // The target offsets are therefore re-evaluated according to the latest Element position and size.
06257                 ComputeBringIntoViewUpdatedTargetOffsets(
06258                     content,
06259                     bringIntoViewOffsetsChange->Element(),
06260                     bringIntoViewOffsetsChange->ElementRect(),
06261                     snapPointsMode,
06262                     bringIntoViewOffsetsChange->HorizontalAlignmentRatio(),
06263                     bringIntoViewOffsetsChange->VerticalAlignmentRatio(),
06264                     bringIntoViewOffsetsChange->HorizontalOffset(),
06265                     bringIntoViewOffsetsChange->VerticalOffset(),
06266                     &zoomedHorizontalOffset,
06267                     &zoomedVerticalOffset);
06268             }
06269         }
06270     }
06271
06272     double anticipatedZoomedHorizontalOffset{ DoubleUtil::NaN };
06273     double anticipatedZoomedVerticalOffset{ DoubleUtil::NaN };
06274
06275     switch (offsetsChange->ViewKind())
06276     {
06277 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
06278     case ScrollPresenterViewKind::RelativeToEndOfInertiaView:
06279     {
06280         const winrt::float2 endOfInertiaPosition = ComputeEndOfInertiaPosition();
06281         zoomedHorizontalOffset += endOfInertiaPosition.x;
06282         zoomedVerticalOffset += endOfInertiaPosition.y;
06283         break;
06284     }
06285 #endif
06286     case ScrollPresenterViewKind::RelativeToCurrentView:
06287     {
06288         anticipatedZoomedHorizontalOffset = AnticipatedZoomedHorizontalOffset();
06289         anticipatedZoomedVerticalOffset = AnticipatedZoomedVerticalOffset();
06290
06291         if (snapPointsMode == winrt::ScrollingSnapPointsMode::Default || animationMode == winrt::ScrollingAnimationMode::Enabled)
06292         {
06293             // The new requested deltas are added to the prior deltas that have not been processed yet.
06294             zoomedHorizontalOffset += anticipatedZoomedHorizontalOffset;
06295             zoomedVerticalOffset += anticipatedZoomedVerticalOffset;
06296         }
06297         break;
06298     }
06299     }
06300
06301     if (snapPointsMode == winrt::ScrollingSnapPointsMode::Default)
06302     {
06303         zoomedHorizontalOffset = ComputeValueAfterSnapPoints<winrt::ScrollSnapPointBase>(zoomedHorizontalOffset, m_sortedConsolidatedHorizontalSnapPoints);
06304         zoomedVerticalOffset = ComputeValueAfterSnapPoints<winrt::ScrollSnapPointBase>(zoomedVerticalOffset, m_sortedConsolidatedVerticalSnapPoints);
06305     }
06306
06307 #ifdef DBG
06308     if (m_contentLayoutOffsetX != 0.0)
06309     {
06310         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"contentLayoutOffsetX", m_contentLayoutOffsetX);
06311     }
06312
06313     if (m_contentLayoutOffsetY != 0.0)
06314     {
06315         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"contentLayoutOffsetY", m_contentLayoutOffsetY);
06316     }
06317 #endif
06318
06319     switch (animationMode)
06320     {
06321     case winrt::ScrollingAnimationMode::Disabled:
06322     {
06323         if (offsetsChange->ViewKind() == ScrollPresenterViewKind::RelativeToCurrentView && snapPointsMode == winrt::ScrollingSnapPointsMode::Ignore)
06324         {
06325             SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_METH_STR, METH_NAME,
06326                 this,
06327                 L"TryUpdatePositionBy",
06328                 TypeLogging::Float2ToString(winrt::float2(static_cast<float>(zoomedHorizontalOffset), static_cast<float>(zoomedVerticalOffset))).c_str());
06329
06330             TraceLoggingProviderWrite(
06331                 XamlTelemetryLogging, "ScrollPresenter_TryUpdatePositionBy",
06332                 TraceLoggingFloat64(zoomedHorizontalOffset, "HorizontalOffset"),
06333                 TraceLoggingFloat64(zoomedVerticalOffset, "VerticalOffset"),
06334                 TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
06335
06336             m_latestInteractionTrackerRequest = m_interactionTracker.TryUpdatePositionBy(
06337                 winrt::float3(static_cast<float>(zoomedHorizontalOffset), static_cast<float>(zoomedVerticalOffset), 0.0f));
06338             m_lastInteractionTrackerAsyncOperationType = InteractionTrackerAsyncOperationType::TryUpdatePositionBy;
06339
06340             if (zoomedHorizontalOffset != 0.0)
06341             {
06342                 double newAnticipatedZoomedHorizontalOffset = zoomedHorizontalOffset + anticipatedZoomedHorizontalOffset;
06343                 newAnticipatedZoomedHorizontalOffset = std::max(0.0, newAnticipatedZoomedHorizontalOffset);
06344                 newAnticipatedZoomedHorizontalOffset = std::min(AnticipatedScrollableWidth(), newAnticipatedZoomedHorizontalOffset);
06345                 UpdateAnticipatedOffset(ScrollPresenterDimension::HorizontalScroll, newAnticipatedZoomedHorizontalOffset);
06346             }
06347
06348             if (zoomedVerticalOffset != 0.0)
06349             {
06350                 double newAnticipatedZoomedVerticalOffset = zoomedVerticalOffset + anticipatedZoomedVerticalOffset;
06351                 newAnticipatedZoomedVerticalOffset = std::max(0.0, newAnticipatedZoomedVerticalOffset);
06352                 newAnticipatedZoomedVerticalOffset = std::min(AnticipatedScrollableHeight(), newAnticipatedZoomedVerticalOffset);
06353                 UpdateAnticipatedOffset(ScrollPresenterDimension::VerticalScroll, newAnticipatedZoomedVerticalOffset);
06354             }
06355         }
06356         else
06357         {
06358             const winrt::float2 targetPosition = ComputePositionFromOffsets(zoomedHorizontalOffset, zoomedVerticalOffset);
06359
06360             SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_METH_STR, METH_NAME, this,
06361                 L"TryUpdatePosition", TypeLogging::Float2ToString(targetPosition).c_str());
06362
06363             TraceLoggingProviderWrite(
06364                 XamlTelemetryLogging, "ScrollPresenter_TryUpdatePosition",
06365                 TraceLoggingFloat64(zoomedHorizontalOffset, "HorizontalOffset"),
06366                 TraceLoggingFloat64(zoomedVerticalOffset, "VerticalOffset"),
06367                 TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
06368
06369             m_latestInteractionTrackerRequest = m_interactionTracker.TryUpdatePosition(
06370                 winrt::float3(targetPosition, 0.0f));
06371             m_lastInteractionTrackerAsyncOperationType = InteractionTrackerAsyncOperationType::TryUpdatePosition;
06372
06373             double newAnticipatedZoomedHorizontalOffset = std::max(0.0, zoomedHorizontalOffset);
06374             newAnticipatedZoomedHorizontalOffset = std::min(AnticipatedScrollableWidth(), newAnticipatedZoomedHorizontalOffset);
06375             UpdateAnticipatedOffset(ScrollPresenterDimension::HorizontalScroll, newAnticipatedZoomedHorizontalOffset);
06376
06377             double newAnticipatedZoomedVerticalOffset = std::max(0.0, zoomedVerticalOffset);
06378             newAnticipatedZoomedVerticalOffset = std::min(AnticipatedScrollableHeight(), newAnticipatedZoomedVerticalOffset);
06379             UpdateAnticipatedOffset(ScrollPresenterDimension::VerticalScroll, newAnticipatedZoomedVerticalOffset);
06380         }
06381
06382         RaiseScrollStarting(
06383             offsetsChangeCorrelationId,
06384             AnticipatedZoomedHorizontalOffset(),
06385             AnticipatedZoomedVerticalOffset(),
06386             AnticipatedZoomFactor());
06387
06388         if (isForAsyncOperation)
06389         {
06390             HookCompositionTargetRendering();
06391         }
06392         break;
06393     }
06394     case winrt::ScrollingAnimationMode::Enabled:
06395     {
06396         SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_METH, METH_NAME, this, L"TryUpdatePositionWithAnimation");
06397
06398         TraceLoggingProviderWrite(
06399             XamlTelemetryLogging, "ScrollPresenter_TryUpdatePositionWithAnimation",
06400             TraceLoggingFloat64(zoomedHorizontalOffset, "HorizontalOffset"),
06401             TraceLoggingFloat64(zoomedVerticalOffset, "VerticalOffset"),
06402             TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
06403
06404         m_latestInteractionTrackerRequest = m_interactionTracker.TryUpdatePositionWithAnimation(
06405             GetPositionAnimation(
06406                 zoomedHorizontalOffset,
06407                 zoomedVerticalOffset,
06408                 operationTrigger,
06409                 offsetsChangeCorrelationId));
06410         m_lastInteractionTrackerAsyncOperationType = InteractionTrackerAsyncOperationType::TryUpdatePositionWithAnimation;
06411
06412         ResetAnticipatedView();
06413         break;
06414     }
06415     }
06416 }
06417
06418 // Launches an InteractionTracker request to change the offsets with an additional velocity and optional scroll inertia decay rate.
06419 void ScrollPresenter::ProcessOffsetsChange(
06420     InteractionTrackerAsyncOperationTrigger operationTrigger,
06421     std::shared_ptr<OffsetsChangeWithAdditionalVelocity> offsetsChangeWithAdditionalVelocity)
06422 {
06423     MUX_ASSERT(m_interactionTracker);
06424     MUX_ASSERT(offsetsChangeWithAdditionalVelocity);
06425
06426     winrt::float2 offsetsVelocity = offsetsChangeWithAdditionalVelocity->OffsetsVelocity();
06427     const winrt::IReference<winrt::float2> inertiaDecayRate = offsetsChangeWithAdditionalVelocity->InertiaDecayRate();
06428
06429     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::NullableFloat2ToString(inertiaDecayRate).c_str());
06430
06431     if (operationTrigger == InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest ||
06432         operationTrigger == InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest)
06433     {
06434         // Requests coming from an IScrollController implementation do not include the 'minimum inertia velocity' value of 30.0f, because that
06435         // concept is InteractionTracker-specific (the IScrollController interface is meant to be InteractionTracker-agnostic).
06436         if (m_state != winrt::ScrollingInteractionState::Inertia)
06437         {
06438             // When there is no current inertia, include that minimum velocity automatically. So the IScrollController-provided velocity is always
06439             // proportional to the resulting offset change.
06440             static constexpr float s_minimumVelocity{ 30.0f };
06441
06442             if (offsetsVelocity.x < 0.0f)
06443             {
06444                 offsetsVelocity = { offsetsVelocity.x - s_minimumVelocity, offsetsVelocity.y };
06445             }
06446             else if (offsetsVelocity.x > 0.0f)
06447             {
06448                 offsetsVelocity = { offsetsVelocity.x + s_minimumVelocity, offsetsVelocity.y };
06449             }
06450
06451             if (offsetsVelocity.y < 0.0f)
06452             {
06453                 offsetsVelocity = { offsetsVelocity.x, offsetsVelocity.y - s_minimumVelocity };
06454             }
06455             else if (offsetsVelocity.y > 0.0f)
06456             {
06457                 offsetsVelocity = { offsetsVelocity.x, offsetsVelocity.y + s_minimumVelocity };
06458             }
06459         }
06460     }
06461
06462     if (inertiaDecayRate)
06463     {
06464         const float horizontalInertiaDecayRate = std::clamp(inertiaDecayRate.Value().x, 0.0f, 1.0f);
06465         const float verticalInertiaDecayRate = std::clamp(inertiaDecayRate.Value().y, 0.0f, 1.0f);
06466
06467         m_interactionTracker.PositionInertiaDecayRate(
06468             winrt::float3(horizontalInertiaDecayRate, verticalInertiaDecayRate, 0.0f));
06469     }
06470     else
06471     {
06472         // Restore the default 0.95 position inertia decay rate since it may have been overridden by a prior offset change with additional velocity.
06473         ResetOffsetsInertiaDecayRate();
06474     }
06475
06476     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_METH_STR, METH_NAME, this,
06477         L"TryUpdatePositionWithAdditionalVelocity", TypeLogging::Float2ToString(winrt::float2(offsetsVelocity)).c_str());
06478
06479     TraceLoggingProviderWrite(
06480         XamlTelemetryLogging, "ScrollPresenter_TryUpdatePositionWithAdditionalVelocity",
06481         TraceLoggingFloat32(offsetsVelocity.x, "Velocity.X"),
06482         TraceLoggingFloat32(offsetsVelocity.y, "Velocity.Y"),
06483         TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
06484
06485     m_latestInteractionTrackerRequest = m_interactionTracker.TryUpdatePositionWithAdditionalVelocity(
06486         winrt::float3(offsetsVelocity, 0.0f));
06487     m_lastInteractionTrackerAsyncOperationType = InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity;
06488
06489     ResetAnticipatedView();
06490 }
06491
06492 // Restores the default scroll inertia decay rate if no offset change with additional velocity operation is in progress.
06493 void ScrollPresenter::PostProcessOffsetsChange(
06494     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation)
06495 {
06496     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, interactionTrackerAsyncOperation);
06497
06498     MUX_ASSERT(m_interactionTracker);
06499
06500     if (interactionTrackerAsyncOperation->GetRequestId() != m_latestInteractionTrackerRequest)
06501     {
06502         std::shared_ptr<InteractionTrackerAsyncOperation> latestInteractionTrackerAsyncOperation = GetInteractionTrackerOperationFromRequestId(
06503             m_latestInteractionTrackerRequest);
06504         if (latestInteractionTrackerAsyncOperation &&
06505             latestInteractionTrackerAsyncOperation->GetOperationType() == InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity)
06506         {
06507             // Do not reset the scroll inertia decay rate when there is a new ongoing offset change with additional velocity
06508             return;
06509         }
06510     }
06511
06512     ResetOffsetsInertiaDecayRate();
06513 }
06514
06515 // Launches an InteractionTracker request to change the zoomFactor.
06516 void ScrollPresenter::ProcessZoomFactorChange(
06517     std::shared_ptr<ZoomFactorChange> zoomFactorChange,
06518     int32_t zoomFactorChangeCorrelationId)
06519 {
06520     MUX_ASSERT(m_interactionTracker);
06521     MUX_ASSERT(zoomFactorChange);
06522
06523     float zoomFactor = zoomFactorChange->ZoomFactor();
06524     const winrt::IReference<winrt::float2> nullableCenterPoint = zoomFactorChange->CenterPoint();
06525     const ScrollPresenterViewKind viewKind = zoomFactorChange->ViewKind();
06526     const winrt::ScrollingZoomOptions options = zoomFactorChange->Options().try_as<winrt::ScrollingZoomOptions>();
06527
06528     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
06529         TypeLogging::ScrollPresenterViewKindToString(viewKind).c_str(),
06530         zoomFactorChangeCorrelationId);
06531     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_STR_FLT, METH_NAME, this,
06532         TypeLogging::NullableFloat2ToString(nullableCenterPoint).c_str(),
06533         TypeLogging::ZoomOptionsToString(options).c_str(),
06534         zoomFactor);
06535
06536     const winrt::float2 centerPoint2D = nullableCenterPoint == nullptr ?
06537         winrt::float2(static_cast<float>(m_viewportWidth / 2.0), static_cast<float>(m_viewportHeight / 2.0)) : nullableCenterPoint.Value();
06538     const winrt::float3 centerPoint(centerPoint2D.x - m_contentLayoutOffsetX, centerPoint2D.y - m_contentLayoutOffsetY, 0.0f);
06539
06540     switch (viewKind)
06541     {
06542 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
06543     case ScrollPresenterViewKind::RelativeToEndOfInertiaView:
06544     {
06545         zoomFactor += ComputeEndOfInertiaZoomFactor();
06546         break;
06547     }
06548 #endif
06549     case ScrollPresenterViewKind::RelativeToCurrentView:
06550     {
06551         // The new requested delta is added to the prior deltas that have not been processed yet.
06552         zoomFactor += AnticipatedZoomFactor();
06553         break;
06554     }
06555     }
06556
06557     winrt::ScrollingAnimationMode animationMode = options ? options.AnimationMode() : ScrollingScrollOptions::s_defaultAnimationMode;
06558     const winrt::ScrollingSnapPointsMode snapPointsMode = options ? options.SnapPointsMode() : ScrollingScrollOptions::s_defaultSnapPointsMode;
06559
06560     animationMode = GetComputedAnimationMode(animationMode);
06561
06562     if (snapPointsMode == winrt::ScrollingSnapPointsMode::Default)
06563     {
06564         zoomFactor = static_cast<float>(ComputeValueAfterSnapPoints<winrt::ZoomSnapPointBase>(zoomFactor, m_sortedConsolidatedZoomSnapPoints));
06565     }
06566
06567     switch (animationMode)
06568     {
06569     case winrt::ScrollingAnimationMode::Disabled:
06570     {
06571         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_METH_FLT_STR, METH_NAME, this,
06572             L"TryUpdateScale", zoomFactor, TypeLogging::Float2ToString(winrt::float2(centerPoint.x, centerPoint.y)).c_str());
06573
06574         TraceLoggingProviderWrite(
06575             XamlTelemetryLogging, "TryUpdateScale",
06576             TraceLoggingFloat32(zoomFactor, "ZoomFactor"),
06577             TraceLoggingFloat32(centerPoint.x, "Center.X"),
06578             TraceLoggingFloat32(centerPoint.y, "Center.Y"),
06579             TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
06580
06581         m_latestInteractionTrackerRequest = m_interactionTracker.TryUpdateScale(zoomFactor, centerPoint);
06582         m_lastInteractionTrackerAsyncOperationType = InteractionTrackerAsyncOperationType::TryUpdateScale;
06583
06584         double newAnticipatedZoomedHorizontalOffset = zoomFactor / AnticipatedZoomFactor() * (AnticipatedZoomedHorizontalOffset() + centerPoint.x) - centerPoint.x;
06585         double newAnticipatedZoomedVerticalOffset = zoomFactor / AnticipatedZoomFactor() * (AnticipatedZoomedVerticalOffset() + centerPoint.y) - centerPoint.y;
06586
06587         UpdateAnticipatedZoomFactor(zoomFactor);
06588
06589         newAnticipatedZoomedHorizontalOffset = std::max(0.0, newAnticipatedZoomedHorizontalOffset);
06590         newAnticipatedZoomedHorizontalOffset = std::min(AnticipatedScrollableWidth(), newAnticipatedZoomedHorizontalOffset);
06591         UpdateAnticipatedOffset(ScrollPresenterDimension::HorizontalScroll, newAnticipatedZoomedHorizontalOffset);
06592
06593         newAnticipatedZoomedVerticalOffset = std::max(0.0, newAnticipatedZoomedVerticalOffset);
06594         newAnticipatedZoomedVerticalOffset = std::min(AnticipatedScrollableHeight(), newAnticipatedZoomedVerticalOffset);
06595         UpdateAnticipatedOffset(ScrollPresenterDimension::VerticalScroll, newAnticipatedZoomedVerticalOffset);
06596
06597         RaiseZoomStarting(
06598             zoomFactorChangeCorrelationId,
06599             newAnticipatedZoomedHorizontalOffset,
06600             newAnticipatedZoomedVerticalOffset,
06601             zoomFactor);
06602
06603         HookCompositionTargetRendering();
06604         break;
06605     }
06606     case winrt::ScrollingAnimationMode::Enabled:
06607     {
06608         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_METH, METH_NAME, this, L"TryUpdateScaleWithAnimation");
06609
06610         TraceLoggingProviderWrite(
06611             XamlTelemetryLogging, "TryUpdateScaleWithAnimation",
06612             TraceLoggingFloat32(zoomFactor, "ZoomFactor"),
06613             TraceLoggingFloat32(centerPoint.x, "Center.X"),
06614             TraceLoggingFloat32(centerPoint.y, "Center.Y"),
06615             TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
06616
06617         m_latestInteractionTrackerRequest = m_interactionTracker.TryUpdateScaleWithAnimation(
06618             GetZoomFactorAnimation(zoomFactor, centerPoint2D, zoomFactorChangeCorrelationId),
06619             centerPoint);
06620         m_lastInteractionTrackerAsyncOperationType = InteractionTrackerAsyncOperationType::TryUpdateScaleWithAnimation;
06621
06622         ResetAnticipatedView();
06623         break;
06624     }
06625     }
06626 }
06627
06628 // Launches an InteractionTracker request to change the zoomFactor with an additional velocity and an optional zoomFactor inertia decay rate.
06629 void ScrollPresenter::ProcessZoomFactorChange(
06630     InteractionTrackerAsyncOperationTrigger operationTrigger,
06631     std::shared_ptr<ZoomFactorChangeWithAdditionalVelocity> zoomFactorChangeWithAdditionalVelocity)
06632 {
06633     MUX_ASSERT(m_interactionTracker);
06634     MUX_ASSERT(zoomFactorChangeWithAdditionalVelocity);
06635
06636     float zoomFactorVelocity = zoomFactorChangeWithAdditionalVelocity->ZoomFactorVelocity();
06637     winrt::IReference<float> inertiaDecayRate = zoomFactorChangeWithAdditionalVelocity->InertiaDecayRate();
06638     winrt::IReference<winrt::float2> nullableCenterPoint = zoomFactorChangeWithAdditionalVelocity->CenterPoint();
06639
06640     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR, METH_NAME, this,
06641         TypeLogging::InteractionTrackerAsyncOperationTriggerToString(operationTrigger).c_str());
06642     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_STR_FLT, METH_NAME, this,
06643         TypeLogging::NullableFloat2ToString(nullableCenterPoint).c_str(),
06644         TypeLogging::NullableFloatToString(inertiaDecayRate).c_str(),
06645         zoomFactorVelocity);
06646
06647     if (inertiaDecayRate)
06648     {
06649         const float scaleInertiaDecayRate = std::clamp(inertiaDecayRate.Value(), 0.0f, 1.0f);
06650
06651         m_interactionTracker.ScaleInertiaDecayRate(scaleInertiaDecayRate);
06652     }
06653     else
06654     {
06655         // Restore the default 0.985 zoomFactor inertia decay rate since it may have been overridden by a prior zoomFactor change with additional velocity.
06656         ResetZoomFactorInertiaDecayRate();
06657     }
06658
06659     const winrt::float2 centerPoint2D = nullableCenterPoint == nullptr ?
06660         winrt::float2(static_cast<float>(m_viewportWidth / 2.0), static_cast<float>(m_viewportHeight / 2.0)) : nullableCenterPoint.Value();
06661     const winrt::float3 centerPoint(centerPoint2D.x - m_contentLayoutOffsetX, centerPoint2D.y - m_contentLayoutOffsetY, 0.0f);
06662
06663     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_METH_FLT_STR, METH_NAME, this,
06664         L"TryUpdateScaleWithAdditionalVelocity", zoomFactorVelocity, TypeLogging::Float2ToString(winrt::float2(centerPoint.x, centerPoint.y)).c_str());
06665
06666     TraceLoggingProviderWrite(
06667         XamlTelemetryLogging, "TryUpdateScaleWithAdditionalVelocity",
06668         TraceLoggingFloat32(zoomFactorVelocity, "Velocity"),
06669         TraceLoggingFloat32(centerPoint.x, "Center.X"),
06670         TraceLoggingFloat32(centerPoint.y, "Center.Y"),
06671         TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
06672
06673     m_latestInteractionTrackerRequest = m_interactionTracker.TryUpdateScaleWithAdditionalVelocity(
06674         zoomFactorVelocity,
06675         centerPoint);
06676     m_lastInteractionTrackerAsyncOperationType = InteractionTrackerAsyncOperationType::TryUpdateScaleWithAdditionalVelocity;
06677
06678     ResetAnticipatedView();
06679 }
06680
06681 // Restores the default zoomFactor inertia decay rate if no zoomFactor change with additional velocity operation is in progress.
06682 void ScrollPresenter::PostProcessZoomFactorChange(
06683     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation)
06684 {
06685     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR, METH_NAME, this, interactionTrackerAsyncOperation);
06686
06687     MUX_ASSERT(m_interactionTracker);
06688
06689     if (interactionTrackerAsyncOperation->GetRequestId() != m_latestInteractionTrackerRequest)
06690     {
06691         std::shared_ptr<InteractionTrackerAsyncOperation> latestInteractionTrackerAsyncOperation = GetInteractionTrackerOperationFromRequestId(
06692             m_latestInteractionTrackerRequest);
06693         if (latestInteractionTrackerAsyncOperation &&
06694             latestInteractionTrackerAsyncOperation->GetOperationType() == InteractionTrackerAsyncOperationType::TryUpdateScaleWithAdditionalVelocity)
06695         {
06696             // Do not reset the zoomFactor inertia decay rate when there is a new ongoing zoomFactor change with additional velocity
06697             return;
06698         }
06699     }
06700
06701     ResetZoomFactorInertiaDecayRate();
06702 }
06703
06704 // Clears the last recorded anticipated view for the ScrollStarting/ZoomStarting events.
06705 // Called in two classes of circumstances:
06706 // - all queued view change requested were completed,
06707 // - an animated view change request is handed off to the InteractionTracker.
06708 void ScrollPresenter::ResetAnticipatedView()
06709 {
06710     UpdateAnticipatedOffset(ScrollPresenterDimension::HorizontalScroll, DoubleUtil::NaN);
06711     UpdateAnticipatedOffset(ScrollPresenterDimension::VerticalScroll, DoubleUtil::NaN);
06712     UpdateAnticipatedZoomFactor(FloatUtil::NaN);
06713 }
06714
06715 // Restores the default scroll offset inertia decay rate.
06716 void ScrollPresenter::ResetOffsetsInertiaDecayRate()
06717 {
06718     MUX_ASSERT(m_interactionTracker);
06719
06720 #ifdef DBG
06721     const winrt::IReference<winrt::float3> inertiaDecayRateDbg = m_interactionTracker.PositionInertiaDecayRate();
06722
06723     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this,
06724         L"PositionInertiaDecayRate",
06725         inertiaDecayRateDbg ? TypeLogging::Float2ToString(winrt::float2{ inertiaDecayRateDbg.Value().x, inertiaDecayRateDbg.Value().y }).c_str() : L"null");
06726 #endif
06727
06728     m_interactionTracker.PositionInertiaDecayRate(nullptr);
06729 }
06730
06731 // Restores the default zoomFactor inertia decay rate.
06732 void ScrollPresenter::ResetZoomFactorInertiaDecayRate()
06733 {
06734     MUX_ASSERT(m_interactionTracker);
06735
06736 #ifdef DBG
06737     const winrt::IReference<float> inertiaDecayRateDbg = m_interactionTracker.ScaleInertiaDecayRate();
06738
06739     if (inertiaDecayRateDbg)
06740     {
06741         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"ScaleInertiaDecayRate", inertiaDecayRateDbg.Value());
06742     }
06743     else
06744     {
06745         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"ScaleInertiaDecayRate", L"null");
06746     }
06747 #endif
06748
06749     m_interactionTracker.ScaleInertiaDecayRate(nullptr);
06750 }
06751
06752 void ScrollPresenter::CompleteViewChange(
06753     std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation,
06754     ScrollPresenterViewChangeResult result)
06755 {
06756     const int32_t viewChangeCorrelationId = interactionTrackerAsyncOperation->GetViewChangeCorrelationId();
06757
06758     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this,
06759         interactionTrackerAsyncOperation.get(), TypeLogging::ScrollPresenterViewChangeResultToString(result).c_str());
06760     SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
06761         L"viewChangeCorrelationId", viewChangeCorrelationId);
06762
06763     interactionTrackerAsyncOperation->SetIsCompleted(true);
06764
06765     bool onHorizontalOffsetChangeCompleted = false;
06766     bool onVerticalOffsetChangeCompleted = false;
06767
06768     switch (static_cast<int>(interactionTrackerAsyncOperation->GetOperationTrigger()))
06769     {
06770         case static_cast<int>(InteractionTrackerAsyncOperationTrigger::DirectViewChange) :
06771         case static_cast<int>(InteractionTrackerAsyncOperationTrigger::BringIntoViewRequest):
06772             switch (interactionTrackerAsyncOperation->GetOperationType())
06773             {
06774             case InteractionTrackerAsyncOperationType::TryUpdatePosition:
06775             case InteractionTrackerAsyncOperationType::TryUpdatePositionBy:
06776             case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAnimation:
06777             case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity:
06778                 RaiseViewChangeCompleted(true /*isForScroll*/, result, viewChangeCorrelationId);
06779                 break;
06780             default:
06781                 // Stop Translation and Scale animations if needed, to trigger rasterization of Content & avoid fuzzy text rendering for instance.
06782                 StopTranslationAndZoomFactorExpressionAnimations();
06783
06784                 RaiseViewChangeCompleted(false /*isForScroll*/, result, viewChangeCorrelationId);
06785                 break;
06786             }
06787         break;
06788         case static_cast<int>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest) :
06789             onHorizontalOffsetChangeCompleted = true;
06790             RaiseViewChangeCompleted(true /*isForScroll*/, result, viewChangeCorrelationId);
06791             break;
06792         case static_cast<int>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest) :
06793             onVerticalOffsetChangeCompleted = true;
06794             RaiseViewChangeCompleted(true /*isForScroll*/, result, viewChangeCorrelationId);
06795             break;
06796         case static_cast<int>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest) |
06797              static_cast<int>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest) :
06798             onHorizontalOffsetChangeCompleted = true;
06799             onVerticalOffsetChangeCompleted = true;
06800             RaiseViewChangeCompleted(true /*isForScroll*/, result, viewChangeCorrelationId);
06801             break;
06802     }
06803
06804     if (onHorizontalOffsetChangeCompleted && m_horizontalScrollController)
06805     {
06806         m_horizontalScrollController.get().NotifyRequestedScrollCompleted(viewChangeCorrelationId);
06807     }
06808
06809     if (onVerticalOffsetChangeCompleted && m_verticalScrollController)
06810     {
06811         m_verticalScrollController.get().NotifyRequestedScrollCompleted(viewChangeCorrelationId);
06812     }
06813 }
06814
06815 void ScrollPresenter::CompleteInteractionTrackerOperations(
06816     int requestId,
06817     ScrollPresenterViewChangeResult operationResult,
06818     ScrollPresenterViewChangeResult priorNonAnimatedOperationsResult,
06819     ScrollPresenterViewChangeResult priorAnimatedOperationsResult,
06820     bool completeNonAnimatedOperation,
06821     bool completeAnimatedOperation,
06822     bool completePriorNonAnimatedOperations,
06823     bool completePriorAnimatedOperations)
06824 {
06825     MUX_ASSERT(requestId != 0);
06826     MUX_ASSERT(completeNonAnimatedOperation || completeAnimatedOperation || completePriorNonAnimatedOperations || completePriorAnimatedOperations);
06827
06828     if (m_interactionTrackerAsyncOperations.empty())
06829     {
06830         return;
06831     }
06832
06833     for (auto operationsIter = m_interactionTrackerAsyncOperations.begin(); operationsIter != m_interactionTrackerAsyncOperations.end();)
06834     {
06835         const auto interactionTrackerAsyncOperation = *operationsIter;
06836
06837         operationsIter++;
06838
06839         const bool isMatch = requestId == -1 || requestId == interactionTrackerAsyncOperation->GetRequestId();
06840         const bool isPriorMatch = requestId > interactionTrackerAsyncOperation->GetRequestId() && -1 != interactionTrackerAsyncOperation->GetRequestId();
06841
06842         if ((isPriorMatch && (completePriorNonAnimatedOperations || completePriorAnimatedOperations)) ||
06843             (isMatch && (completeNonAnimatedOperation || completeAnimatedOperation)))
06844         {
06845             const bool isOperationAnimated = interactionTrackerAsyncOperation->IsAnimated();
06846             const bool complete =
06847                 (isMatch && completeNonAnimatedOperation && !isOperationAnimated) ||
06848                 (isMatch && completeAnimatedOperation && isOperationAnimated) ||
06849                 (isPriorMatch && completePriorNonAnimatedOperations && !isOperationAnimated) ||
06850                 (isPriorMatch && completePriorAnimatedOperations && isOperationAnimated);
06851
06852             if (complete)
06853             {
06854                 CompleteViewChange(
06855                     interactionTrackerAsyncOperation,
06856                     isMatch ? operationResult : (isOperationAnimated ? priorAnimatedOperationsResult : priorNonAnimatedOperationsResult));
06857
06858                 auto interactionTrackerAsyncOperationRemoved = interactionTrackerAsyncOperation;
06859
06860                 m_interactionTrackerAsyncOperations.remove(interactionTrackerAsyncOperationRemoved);
06861
06862                 if (m_interactionTrackerAsyncOperations.empty())
06863                 {
06864                     ResetAnticipatedView();
06865                 }
06866
06867                 switch (interactionTrackerAsyncOperationRemoved->GetOperationType())
06868                 {
06869                 case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity:
06870                     PostProcessOffsetsChange(interactionTrackerAsyncOperationRemoved);
06871                     break;
06872                 case InteractionTrackerAsyncOperationType::TryUpdateScaleWithAdditionalVelocity:
06873                     PostProcessZoomFactorChange(interactionTrackerAsyncOperationRemoved);
06874                     break;
06875                 }
06876             }
06877         }
06878     }
06879 }
06880
06881 void ScrollPresenter::CompleteDelayedOperations()
06882 {
06883     if (m_interactionTrackerAsyncOperations.empty())
06884     {
06885         return;
06886     }
06887
06888     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
06889
06890     for (auto operationsIter = m_interactionTrackerAsyncOperations.begin(); operationsIter != m_interactionTrackerAsyncOperations.end();)
06891     {
06892         auto& interactionTrackerAsyncOperation = *operationsIter;
06893
06894         operationsIter++;
06895
06896         if (interactionTrackerAsyncOperation->IsDelayed())
06897         {
06898             CompleteViewChange(interactionTrackerAsyncOperation, ScrollPresenterViewChangeResult::Interrupted);
06899             m_interactionTrackerAsyncOperations.remove(interactionTrackerAsyncOperation);
06900
06901             if (m_interactionTrackerAsyncOperations.empty())
06902             {
06903                 ResetAnticipatedView();
06904             }
06905         }
06906     }
06907 }
06908
06909 // Sets the ticks countdown of the queued operations to the max value of InteractionTrackerAsyncOperation::c_queuedOperationTicks == 3.
06910 // Invoked when the extent or viewport size changed in order to let it propagate to the Composition thread and thus let the
06911 // InteractionTracker operate on the latest sizes.
06912 void ScrollPresenter::MaximizeInteractionTrackerOperationsTicksCountdown()
06913 {
06914     if (m_interactionTrackerAsyncOperations.empty())
06915     {
06916         return;
06917     }
06918
06919     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
06920
06921     for (auto operationsIter = m_interactionTrackerAsyncOperations.begin(); operationsIter != m_interactionTrackerAsyncOperations.end();)
06922     {
06923         auto& interactionTrackerAsyncOperation = *operationsIter;
06924
06925         operationsIter++;
06926
06927         if (!interactionTrackerAsyncOperation->IsDelayed() &&
06928             !interactionTrackerAsyncOperation->IsCanceled() &&
06929             !interactionTrackerAsyncOperation->IsCompleted() &&
06930             interactionTrackerAsyncOperation->IsQueued())
06931         {
06932             interactionTrackerAsyncOperation->SetMaxTicksCountdown();
06933         }
06934     }
06935 }
06936
06937 // Returns the maximum remaining ticks countdown of all queued operations.
06938 // Used by ScrollPresenter::ChangeOffsetsPrivate, ScrollPresenter::ChangeOffsetsWithAdditionalVelocityPrivate and ScrollPresenter::ChangeZoomFactorWithAdditionalVelocityPrivate
06939 // to make sure newly queued operations do not get processed before existing ones.
06940 int ScrollPresenter::GetInteractionTrackerOperationsTicksCountdown() const
06941 {
06942     int ticksCountdown = 0;
06943
06944     for (auto& interactionTrackerAsyncOperation : m_interactionTrackerAsyncOperations)
06945     {
06946         if (!interactionTrackerAsyncOperation->IsCompleted() &&
06947             !interactionTrackerAsyncOperation->IsCanceled())
06948         {
06949             ticksCountdown = std::max(ticksCountdown, interactionTrackerAsyncOperation->GetTicksCountdown());
06950         }
06951     }
06952
06953     return ticksCountdown;
06954 }
06955
06956 int ScrollPresenter::GetInteractionTrackerOperationsCount(bool includeAnimatedOperations, bool includeNonAnimatedOperations) const
06957 {
06958     MUX_ASSERT(includeAnimatedOperations || includeNonAnimatedOperations);
06959
06960     int operationsCount = 0;
06961
06962     for (auto& interactionTrackerAsyncOperation : m_interactionTrackerAsyncOperations)
06963     {
06964         const bool isOperationAnimated = interactionTrackerAsyncOperation->IsAnimated();
06965
06966         if ((isOperationAnimated && includeAnimatedOperations) || (!isOperationAnimated && includeNonAnimatedOperations))
06967         {
06968             operationsCount++;
06969         }
06970     }
06971
06972     return operationsCount;
06973 }
06974
06975 std::shared_ptr<InteractionTrackerAsyncOperation> ScrollPresenter::GetLastNonAnimatedInteractionTrackerOperation(
06976     std::shared_ptr<InteractionTrackerAsyncOperation> priorToInteractionTrackerOperation) const
06977 {
06978     bool priorInteractionTrackerOperationSeen = false;
06979
06980     for (auto operationsIter = m_interactionTrackerAsyncOperations.end(); operationsIter != m_interactionTrackerAsyncOperations.begin();)
06981     {
06982         operationsIter--;
06983
06984         auto& interactionTrackerAsyncOperation = *operationsIter;
06985
06986         if (!priorInteractionTrackerOperationSeen && priorToInteractionTrackerOperation == interactionTrackerAsyncOperation)
06987         {
06988             priorInteractionTrackerOperationSeen = true;
06989         }
06990         else if (priorInteractionTrackerOperationSeen &&
06991             !interactionTrackerAsyncOperation->IsAnimated() &&
06992             !interactionTrackerAsyncOperation->IsCompleted() &&
06993             !interactionTrackerAsyncOperation->IsCanceled())
06994         {
06995             MUX_ASSERT(interactionTrackerAsyncOperation->IsDelayed() || interactionTrackerAsyncOperation->IsQueued());
06996             return interactionTrackerAsyncOperation;
06997         }
06998     }
06999
07000     return nullptr;
07001 }
07002
07003 std::shared_ptr<InteractionTrackerAsyncOperation> ScrollPresenter::GetInteractionTrackerOperationFromRequestId(int requestId) const
07004 {
07005     MUX_ASSERT(requestId >= 0);
07006
07007     for (auto& interactionTrackerAsyncOperation : m_interactionTrackerAsyncOperations)
07008     {
07009         if (interactionTrackerAsyncOperation->GetRequestId() == requestId)
07010         {
07011             return interactionTrackerAsyncOperation;
07012         }
07013     }
07014
07015     return nullptr;
07016 }
07017
07018 std::shared_ptr<InteractionTrackerAsyncOperation> ScrollPresenter::GetInteractionTrackerOperationFromKinds(
07019     bool isOperationTypeForOffsetsChange,
07020     InteractionTrackerAsyncOperationTrigger operationTrigger,
07021     ScrollPresenterViewKind const& viewKind,
07022     winrt::ScrollingScrollOptions const& options) const
07023 {
07024     // Going through the existing operations from most recent to oldest, trying to find a match for the trigger, kind and options.
07025     for (auto operationsIter = m_interactionTrackerAsyncOperations.end(); operationsIter != m_interactionTrackerAsyncOperations.begin();)
07026     {
07027         operationsIter--;
07028
07029         auto& interactionTrackerAsyncOperation = *operationsIter;
07030
07031         if ((static_cast<int>(interactionTrackerAsyncOperation->GetOperationTrigger()) & static_cast<int>(operationTrigger)) == 0x00 &&
07032             !interactionTrackerAsyncOperation->IsCanceled())
07033         {
07034             // When a non-canceled operation with a different trigger is encountered, we bail out right away.
07035             return nullptr;
07036         }
07037
07038         std::shared_ptr<ViewChangeBase> viewChangeBase = interactionTrackerAsyncOperation->GetViewChangeBase();
07039
07040         if ((static_cast<int>(interactionTrackerAsyncOperation->GetOperationTrigger()) & static_cast<int>(operationTrigger)) == 0x00 ||
07041             !interactionTrackerAsyncOperation->IsQueued() ||
07042             interactionTrackerAsyncOperation->IsUnqueueing() ||
07043             interactionTrackerAsyncOperation->IsCanceled() ||
07044             !viewChangeBase)
07045         {
07046             continue;
07047         }
07048
07049         switch (interactionTrackerAsyncOperation->GetOperationType())
07050         {
07051         case InteractionTrackerAsyncOperationType::TryUpdatePosition:
07052         case InteractionTrackerAsyncOperationType::TryUpdatePositionBy:
07053         case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAnimation:
07054         {
07055             if (!isOperationTypeForOffsetsChange)
07056             {
07057                 continue;
07058             }
07059
07060             std::shared_ptr<ViewChange> viewChange = std::reinterpret_pointer_cast<ViewChange>(viewChangeBase);
07061
07062             if (viewChange->ViewKind() != viewKind)
07063             {
07064                 continue;
07065             }
07066
07067             const winrt::ScrollingScrollOptions optionsClone = viewChange->Options().try_as<winrt::ScrollingScrollOptions>();
07068             const winrt::ScrollingAnimationMode animationMode = options ? options.AnimationMode() : ScrollingScrollOptions::s_defaultAnimationMode;
07069             const winrt::ScrollingAnimationMode animationModeClone = optionsClone ? optionsClone.AnimationMode() : ScrollingScrollOptions::s_defaultAnimationMode;
07070
07071             if (animationModeClone != animationMode)
07072             {
07073                 continue;
07074             }
07075
07076             const winrt::ScrollingSnapPointsMode snapPointsMode = options ? options.SnapPointsMode() : ScrollingScrollOptions::s_defaultSnapPointsMode;
07077             const winrt::ScrollingSnapPointsMode snapPointsModeClone = optionsClone ? optionsClone.SnapPointsMode() : ScrollingScrollOptions::s_defaultSnapPointsMode;
07078
07079             if (snapPointsModeClone != snapPointsMode)
07080             {
07081                 continue;
07082             }
07083             break;
07084         }
07085         case InteractionTrackerAsyncOperationType::TryUpdateScale:
07086         case InteractionTrackerAsyncOperationType::TryUpdateScaleWithAnimation:
07087         {
07088             if (isOperationTypeForOffsetsChange)
07089             {
07090                 continue;
07091             }
07092
07093             const std::shared_ptr<ViewChange> viewChange = std::reinterpret_pointer_cast<ViewChange>(viewChangeBase);
07094
07095             if (viewChange->ViewKind() != viewKind)
07096             {
07097                 continue;
07098             }
07099
07100             const winrt::ScrollingZoomOptions optionsClone = viewChange->Options().try_as<winrt::ScrollingZoomOptions>();
07101             const winrt::ScrollingAnimationMode animationMode = options ? options.AnimationMode() : ScrollingScrollOptions::s_defaultAnimationMode;
07102             const winrt::ScrollingAnimationMode animationModeClone = optionsClone ? optionsClone.AnimationMode() : ScrollingScrollOptions::s_defaultAnimationMode;
07103
07104             if (animationModeClone != animationMode)
07105             {
07106                 continue;
07107             }
07108
07109             const winrt::ScrollingSnapPointsMode snapPointsMode = options ? options.SnapPointsMode() : ScrollingScrollOptions::s_defaultSnapPointsMode;
07110             const winrt::ScrollingSnapPointsMode snapPointsModeClone = optionsClone ? optionsClone.SnapPointsMode() : ScrollingScrollOptions::s_defaultSnapPointsMode;
07111
07112             if (snapPointsModeClone != snapPointsMode)
07113             {
07114                 continue;
07115             }
07116             break;
07117         }
07118         }
07119
07120         return interactionTrackerAsyncOperation;
07121     }
07122
07123     return nullptr;
07124 }
07125
07126 std::shared_ptr<InteractionTrackerAsyncOperation> ScrollPresenter::GetInteractionTrackerOperationWithAdditionalVelocity(
07127     bool isOperationTypeForOffsetsChange,
07128     InteractionTrackerAsyncOperationTrigger operationTrigger) const
07129 {
07130     for (auto& interactionTrackerAsyncOperation : m_interactionTrackerAsyncOperations)
07131     {
07132         std::shared_ptr<ViewChangeBase> viewChangeBase = interactionTrackerAsyncOperation->GetViewChangeBase();
07133
07134         if ((static_cast<int>(interactionTrackerAsyncOperation->GetOperationTrigger()) & static_cast<int>(operationTrigger)) == 0x00 ||
07135             !interactionTrackerAsyncOperation->IsQueued() ||
07136             interactionTrackerAsyncOperation->IsUnqueueing() ||
07137             interactionTrackerAsyncOperation->IsCanceled() ||
07138             !viewChangeBase)
07139         {
07140             continue;
07141         }
07142
07143         switch (interactionTrackerAsyncOperation->GetOperationType())
07144         {
07145         case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity:
07146         {
07147             if (!isOperationTypeForOffsetsChange)
07148             {
07149                 continue;
07150             }
07151             return interactionTrackerAsyncOperation;
07152         }
07153         case InteractionTrackerAsyncOperationType::TryUpdateScaleWithAdditionalVelocity:
07154         {
07155             if (isOperationTypeForOffsetsChange)
07156             {
07157                 continue;
07158             }
07159             return interactionTrackerAsyncOperation;
07160         }
07161         }
07162     }
07163
07164     return nullptr;
07165 }
07166
07167 template <typename T>
07168 winrt::InteractionTrackerInertiaRestingValue ScrollPresenter::GetInertiaRestingValue(
07169     std::shared_ptr<SnapPointWrapper<T>> snapPointWrapper,
07170     winrt::Compositor const& compositor,
07171     winrt::hstring const& target,
07172     winrt::hstring const& scale) const
07173 {
07174     const bool isInertiaFromImpulse = IsInertiaFromImpulse();
07175     const winrt::InteractionTrackerInertiaRestingValue modifier = winrt::InteractionTrackerInertiaRestingValue::Create(compositor);
07176     const winrt::ExpressionAnimation conditionExpressionAnimation = snapPointWrapper->CreateConditionalExpression(m_interactionTracker, target, scale, isInertiaFromImpulse);
07177     const winrt::ExpressionAnimation restingPointExpressionAnimation = snapPointWrapper->CreateRestingPointExpression(m_interactionTracker, target, scale, isInertiaFromImpulse);
07178
07179     modifier.Condition(conditionExpressionAnimation);
07180     modifier.RestingValue(restingPointExpressionAnimation);
07181
07182     return modifier;
07183 }
07184
07185 // Relies on InteractionTracker.IsInertiaFromImpulse starting with RS5,
07186 // returns the replacement field m_isInertiaFromImpulse otherwise.
07187 bool ScrollPresenter::IsInertiaFromImpulse() const
07188 {
07189     if (winrt::IInteractionTracker4 interactionTracker4 = m_interactionTracker)
07190     {
07191         return interactionTracker4.IsInertiaFromImpulse();
07192     }
07193     else
07194     {
07195         return m_isInertiaFromImpulse;
07196     }
07197 }
07198
07199 bool ScrollPresenter::IsLoadedAndSetUp() const
07200 {
07201     return IsLoaded() && m_interactionTracker;
07202 }
07203
07204 bool ScrollPresenter::IsInputKindIgnored(winrt::ScrollingInputKinds const& inputKind)
07205 {
07206     return (IgnoredInputKinds() & inputKind) == inputKind;
07207 }
07208
07209 void ScrollPresenter::HookCompositionTargetRendering()
07210 {
07211     if (!m_renderingRevoker)
07212     {
07213         SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
07214
07215         winrt::Microsoft::UI::Xaml::Media::CompositionTarget compositionTarget{ nullptr };
07216         m_renderingRevoker = compositionTarget.Rendering(winrt::auto_revoke, { this, &ScrollPresenter::OnCompositionTargetRendering });
07217     }
07218 }
07219
07220 void ScrollPresenter::UnhookCompositionTargetRendering()
07221 {
07222     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
07223
07224     m_renderingRevoker.revoke();
07225 }
07226
07227 void ScrollPresenter::HookScrollPresenterEvents()
07228 {
07229     if (!m_flowDirectionChangedRevoker)
07230     {
07231         m_flowDirectionChangedRevoker = RegisterPropertyChanged(*this, winrt::FrameworkElement::FlowDirectionProperty(), { this, &ScrollPresenter::OnFlowDirectionChanged });
07232     }
07233
07234     if (!m_loadedRevoker)
07235     {
07236         m_loadedRevoker = Loaded(winrt::auto_revoke, { this, &ScrollPresenter::OnLoaded });
07237     }
07238
07239     if (!m_unloadedRevoker)
07240     {
07241         m_unloadedRevoker = Unloaded(winrt::auto_revoke, { this, &ScrollPresenter::OnUnloaded });
07242     }
07243
07244     if (!m_bringIntoViewRequestedRevoker)
07245     {
07246         m_bringIntoViewRequestedRevoker = BringIntoViewRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnBringIntoViewRequestedHandler });
07247     }
07248
07249     if (!m_pointerPressedEventHandler)
07250     {
07251         m_pointerPressedEventHandler = winrt::box_value<winrt::PointerEventHandler>({ this, &ScrollPresenter::OnPointerPressed });
07252         MUX_ASSERT(m_pointerPressedEventHandler);
07253         AddHandler(winrt::UIElement::PointerPressedEvent(), m_pointerPressedEventHandler, true /*handledEventsToo*/);
07254     }
07255 }
07256
07257 void ScrollPresenter::UnhookScrollPresenterEvents()
07258 {
07259     m_flowDirectionChangedRevoker.revoke();
07260     m_loadedRevoker.revoke();
07261     m_unloadedRevoker.revoke();
07262     m_bringIntoViewRequestedRevoker.revoke();
07263
07264     if (m_pointerPressedEventHandler)
07265     {
07266         RemoveHandler(winrt::UIElement::PointerPressedEvent(), m_pointerPressedEventHandler);
07267         m_pointerPressedEventHandler = nullptr;
07268     }
07269 }
07270
07271 void ScrollPresenter::HookContentPropertyChanged(
07272     const winrt::UIElement& content)
07273 {
07274     if (content)
07275     {
07276         if (auto contentAsFE = content.try_as<winrt::FrameworkElement>())
07277         {
07278             if (!m_contentMinWidthChangedRevoker)
07279             {
07280                 m_contentMinWidthChangedRevoker = RegisterPropertyChanged(contentAsFE, winrt::FrameworkElement::MinWidthProperty(), { this, &ScrollPresenter::OnContentPropertyChanged });
07281             }
07282             if (!m_contentWidthChangedRevoker)
07283             {
07284                 m_contentWidthChangedRevoker = RegisterPropertyChanged(contentAsFE, winrt::FrameworkElement::WidthProperty(), { this, &ScrollPresenter::OnContentPropertyChanged });
07285             }
07286             if (!m_contentMaxWidthChangedRevoker)
07287             {
07288                 m_contentMaxWidthChangedRevoker = RegisterPropertyChanged(contentAsFE, winrt::FrameworkElement::MaxWidthProperty(), { this, &ScrollPresenter::OnContentPropertyChanged });
07289             }
07290             if (!m_contentMinHeightChangedRevoker)
07291             {
07292                 m_contentMinHeightChangedRevoker = RegisterPropertyChanged(contentAsFE, winrt::FrameworkElement::MinHeightProperty(), { this, &ScrollPresenter::OnContentPropertyChanged });
07293             }
07294             if (!m_contentHeightChangedRevoker)
07295             {
07296                 m_contentHeightChangedRevoker = RegisterPropertyChanged(contentAsFE, winrt::FrameworkElement::HeightProperty(), { this, &ScrollPresenter::OnContentPropertyChanged });
07297             }
07298             if (!m_contentMaxHeightChangedRevoker)
07299             {
07300                 m_contentMaxHeightChangedRevoker = RegisterPropertyChanged(contentAsFE, winrt::FrameworkElement::MaxHeightProperty(), { this, &ScrollPresenter::OnContentPropertyChanged });
07301             }
07302             if (!m_contentHorizontalAlignmentChangedRevoker)
07303             {
07304                 m_contentHorizontalAlignmentChangedRevoker = RegisterPropertyChanged(contentAsFE, winrt::FrameworkElement::HorizontalAlignmentProperty(), { this, &ScrollPresenter::OnContentPropertyChanged });
07305             }
07306             if (!m_contentVerticalAlignmentChangedRevoker)
07307             {
07308                 m_contentVerticalAlignmentChangedRevoker = RegisterPropertyChanged(contentAsFE, winrt::FrameworkElement::VerticalAlignmentProperty(), { this, &ScrollPresenter::OnContentPropertyChanged });
07309             }
07310         }
07311     }
07312 }
07313
07314 void ScrollPresenter::UnhookContentPropertyChanged(
07315     const winrt::UIElement& content)
07316 {
07317     if (content)
07318     {
07319         const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
07320
07321         if (contentAsFE)
07322         {
07323             m_contentMinWidthChangedRevoker.revoke();
07324             m_contentWidthChangedRevoker.revoke();
07325             m_contentMaxWidthChangedRevoker.revoke();
07326             m_contentMinHeightChangedRevoker.revoke();
07327             m_contentHeightChangedRevoker.revoke();
07328             m_contentMaxHeightChangedRevoker.revoke();
07329             m_contentHorizontalAlignmentChangedRevoker.revoke();
07330             m_contentVerticalAlignmentChangedRevoker.revoke();
07331         }
07332     }
07333 }
07334
07335 void ScrollPresenter::HookHorizontalScrollControllerEvents(
07336     const winrt::IScrollController& horizontalScrollController)
07337 {
07338     MUX_ASSERT(horizontalScrollController);
07339
07340     if (!m_horizontalScrollControllerScrollToRequestedRevoker)
07341     {
07342         m_horizontalScrollControllerScrollToRequestedRevoker = horizontalScrollController.ScrollToRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerScrollToRequested });
07343     }
07344
07345     if (!m_horizontalScrollControllerScrollByRequestedRevoker)
07346     {
07347         m_horizontalScrollControllerScrollByRequestedRevoker = horizontalScrollController.ScrollByRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerScrollByRequested });
07348     }
07349
07350     if (!m_horizontalScrollControllerAddScrollVelocityRequestedRevoker)
07351     {
07352         m_horizontalScrollControllerAddScrollVelocityRequestedRevoker = horizontalScrollController.AddScrollVelocityRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerAddScrollVelocityRequested });
07353     }
07354 }
07355
07356 void ScrollPresenter::HookHorizontalScrollControllerPanningInfoEvents(
07357     const winrt::IScrollControllerPanningInfo& horizontalScrollControllerPanningInfo,
07358     bool hasInteractionSource)
07359 {
07360     MUX_ASSERT(horizontalScrollControllerPanningInfo);
07361
07362     if (hasInteractionSource)
07363     {
07364         HookHorizontalScrollControllerInteractionSourceEvents(horizontalScrollControllerPanningInfo);
07365     }
07366
07367     if (!m_horizontalScrollControllerPanningInfoChangedRevoker)
07368     {
07369         m_horizontalScrollControllerPanningInfoChangedRevoker = horizontalScrollControllerPanningInfo.Changed(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerPanningInfoChanged });
07370     }
07371 }
07372
07373 void ScrollPresenter::HookHorizontalScrollControllerInteractionSourceEvents(
07374     const winrt::IScrollControllerPanningInfo& horizontalScrollControllerPanningInfo)
07375 {
07376     MUX_ASSERT(horizontalScrollControllerPanningInfo);
07377
07378     if (!m_horizontalScrollControllerPanningInfoPanRequestedRevoker)
07379     {
07380         m_horizontalScrollControllerPanningInfoPanRequestedRevoker = horizontalScrollControllerPanningInfo.PanRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerPanningInfoPanRequested });
07381     }
07382 }
07383
07384 void ScrollPresenter::HookVerticalScrollControllerEvents(
07385     const winrt::IScrollController& verticalScrollController)
07386 {
07387     MUX_ASSERT(verticalScrollController);
07388
07389     if (!m_verticalScrollControllerScrollToRequestedRevoker)
07390     {
07391         m_verticalScrollControllerScrollToRequestedRevoker = verticalScrollController.ScrollToRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerScrollToRequested });
07392     }
07393
07394     if (!m_verticalScrollControllerScrollByRequestedRevoker)
07395     {
07396         m_verticalScrollControllerScrollByRequestedRevoker = verticalScrollController.ScrollByRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerScrollByRequested });
07397     }
07398
07399     if (!m_verticalScrollControllerAddScrollVelocityRequestedRevoker)
07400     {
07401         m_verticalScrollControllerAddScrollVelocityRequestedRevoker = verticalScrollController.AddScrollVelocityRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerAddScrollVelocityRequested });
07402     }
07403 }
07404
07405 void ScrollPresenter::HookVerticalScrollControllerPanningInfoEvents(
07406     const winrt::IScrollControllerPanningInfo& verticalScrollControllerPanningInfo,
07407     bool hasInteractionSource)
07408 {
07409     MUX_ASSERT(verticalScrollControllerPanningInfo);
07410
07411     if (hasInteractionSource)
07412     {
07413         HookVerticalScrollControllerInteractionSourceEvents(verticalScrollControllerPanningInfo);
07414     }
07415
07416     if (!m_verticalScrollControllerPanningInfoChangedRevoker)
07417     {
07418         m_verticalScrollControllerPanningInfoChangedRevoker = verticalScrollControllerPanningInfo.Changed(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerPanningInfoChanged });
07419     }
07420 }
07421
07422 void ScrollPresenter::HookVerticalScrollControllerInteractionSourceEvents(
07423     const winrt::IScrollControllerPanningInfo& verticalScrollControllerPanningInfo)
07424 {
07425     MUX_ASSERT(verticalScrollControllerPanningInfo);
07426
07427     if (!m_verticalScrollControllerPanningInfoPanRequestedRevoker)
07428     {
07429         m_verticalScrollControllerPanningInfoPanRequestedRevoker = verticalScrollControllerPanningInfo.PanRequested(winrt::auto_revoke, { this, &ScrollPresenter::OnScrollControllerPanningInfoPanRequested });
07430     }
07431 }
07432
07433 void ScrollPresenter::UnhookHorizontalScrollControllerEvents()
07434 {
07435     m_horizontalScrollControllerScrollToRequestedRevoker.revoke();
07436     m_horizontalScrollControllerScrollByRequestedRevoker.revoke();
07437     m_horizontalScrollControllerAddScrollVelocityRequestedRevoker.revoke();
07438 }
07439
07440 void ScrollPresenter::UnhookHorizontalScrollControllerPanningInfoEvents()
07441 {
07442     m_horizontalScrollControllerPanningInfoChangedRevoker.revoke();
07443     m_horizontalScrollControllerPanningInfoPanRequestedRevoker.revoke();
07444 }
07445
07446 void ScrollPresenter::UnhookVerticalScrollControllerEvents()
07447 {
07448     m_verticalScrollControllerScrollToRequestedRevoker.revoke();
07449     m_verticalScrollControllerScrollByRequestedRevoker.revoke();
07450     m_verticalScrollControllerAddScrollVelocityRequestedRevoker.revoke();
07451 }
07452
07453 void ScrollPresenter::UnhookVerticalScrollControllerPanningInfoEvents()
07454 {
07455     m_verticalScrollControllerPanningInfoChangedRevoker.revoke();
07456     m_verticalScrollControllerPanningInfoPanRequestedRevoker.revoke();
07457 }
07458
07459 void ScrollPresenter::RaiseInteractionSourcesChanged()
07460 {
07461     com_ptr<ScrollPresenterTestHooks> globalTestHooks = ScrollPresenterTestHooks::GetGlobalTestHooks();
07462
07463     if (globalTestHooks && globalTestHooks->AreInteractionSourcesNotificationsRaised())
07464     {
07465         globalTestHooks->NotifyInteractionSourcesChanged(*this, m_interactionTracker.InteractionSources());
07466     }
07467 }
07468
07469 void ScrollPresenter::RaiseExpressionAnimationStatusChanged(
07470     bool isExpressionAnimationStarted,
07471     wstring_view const& propertyName)
07472 {
07473     com_ptr<ScrollPresenterTestHooks> globalTestHooks = ScrollPresenterTestHooks::GetGlobalTestHooks();
07474
07475     if (globalTestHooks && globalTestHooks->AreExpressionAnimationStatusNotificationsRaised())
07476     {
07477         globalTestHooks->NotifyExpressionAnimationStatusChanged(*this, isExpressionAnimationStarted, propertyName);
07478     }
07479 }
07480
07481 void ScrollPresenter::RaiseExtentChanged()
07482 {
07483     if (m_extentChangedEventSource)
07484     {
07485         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
07486
07487         m_extentChangedEventSource(*this, nullptr);
07488     }
07489 }
07490
07491 void ScrollPresenter::RaiseStateChanged()
07492 {
07493     if (m_stateChangedEventSource)
07494     {
07495         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
07496
07497         m_stateChangedEventSource(*this, nullptr);
07498     }
07499 }
07500
07501 void ScrollPresenter::RaiseScrollStarting(
07502     int32_t offsetsChangeCorrelationId,
07503     double anticipatedHorizontalOffset,
07504     double anticipatedVerticalOffset,
07505     float anticipatedZoomFactor)
07506 {
07507     if (m_scrollStartingEventSource)
07508     {
07509         auto scrollStartingEventArgs = winrt::make_self<ScrollingScrollStartingEventArgs>();
07510
07511         SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_INT, METH_NAME, this, offsetsChangeCorrelationId);
07512         SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, anticipatedHorizontalOffset, anticipatedVerticalOffset);
07513         SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_FLT, METH_NAME, this, anticipatedZoomFactor);
07514
07515         scrollStartingEventArgs->SetCorrelationId(offsetsChangeCorrelationId);
07516         scrollStartingEventArgs->SetHorizontalOffset(anticipatedHorizontalOffset);
07517         scrollStartingEventArgs->SetVerticalOffset(anticipatedVerticalOffset);
07518         scrollStartingEventArgs->SetZoomFactor(anticipatedZoomFactor);
07519         m_scrollStartingEventSource(*this, *scrollStartingEventArgs);
07520     }
07521 }
07522
07523 void ScrollPresenter::RaiseZoomStarting(
07524     int32_t zoomFactorChangeCorrelationId,
07525     double anticipatedHorizontalOffset,
07526     double anticipatedVerticalOffset,
07527     float anticipatedZoomFactor)
07528 {
07529     if (m_zoomStartingEventSource)
07530     {
07531         auto zoomStartingEventArgs = winrt::make_self<ScrollingZoomStartingEventArgs>();
07532
07533         SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_INT, METH_NAME, this, zoomFactorChangeCorrelationId);
07534         SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, anticipatedHorizontalOffset, anticipatedVerticalOffset);
07535         SCROLLPRESENTER_TRACE_INFO_DBG(*this, TRACE_MSG_METH_FLT, METH_NAME, this, anticipatedZoomFactor);
07536
07537         zoomStartingEventArgs->SetCorrelationId(zoomFactorChangeCorrelationId);
07538         zoomStartingEventArgs->SetHorizontalOffset(anticipatedHorizontalOffset);
07539         zoomStartingEventArgs->SetVerticalOffset(anticipatedVerticalOffset);
07540         zoomStartingEventArgs->SetZoomFactor(anticipatedZoomFactor);
07541         m_zoomStartingEventSource(*this, *zoomStartingEventArgs);
07542     }
07543 }
07544
07545 void ScrollPresenter::RaiseViewChanged()
07546 {
07547     if (m_viewChangedEventSource)
07548     {
07549         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
07550
07551         m_viewChangedEventSource(*this, nullptr);
07552     }
07553
07554     InvalidateViewport();
07555 }
07556
07557 winrt::CompositionAnimation ScrollPresenter::RaiseScrollAnimationStarting(
07558     const winrt::Vector3KeyFrameAnimation& positionAnimation,
07559     const winrt::float2& startPosition,
07560     const winrt::float2& endPosition,
07561     int32_t offsetsChangeCorrelationId)
07562 {
07563     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, offsetsChangeCorrelationId);
07564     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_FLT_FLT_FLT_FLT, METH_NAME, this,
07565         startPosition.x, startPosition.y,
07566         endPosition.x, endPosition.y);
07567
07568     if (m_scrollAnimationStartingEventSource)
07569     {
07570         auto scrollAnimationStartingEventArgs = winrt::make_self<ScrollingScrollAnimationStartingEventArgs>();
07571
07572         if (offsetsChangeCorrelationId != s_noOpCorrelationId)
07573         {
07574             scrollAnimationStartingEventArgs->SetOffsetsChangeCorrelationId(offsetsChangeCorrelationId);
07575         }
07576
07577         scrollAnimationStartingEventArgs->SetAnimation(positionAnimation);
07578         scrollAnimationStartingEventArgs->SetStartPosition(startPosition);
07579         scrollAnimationStartingEventArgs->SetEndPosition(endPosition);
07580         m_scrollAnimationStartingEventSource(*this, *scrollAnimationStartingEventArgs);
07581         return scrollAnimationStartingEventArgs->GetAnimation();
07582     }
07583     else
07584     {
07585         return positionAnimation;
07586     }
07587 }
07588
07589 winrt::CompositionAnimation ScrollPresenter::RaiseZoomAnimationStarting(
07590     const winrt::ScalarKeyFrameAnimation& zoomFactorAnimation,
07591     const float endZoomFactor,
07592     const winrt::float2& centerPoint,
07593     int32_t zoomFactorChangeCorrelationId)
07594 {
07595     SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_FLT_FLT_STR_INT, METH_NAME, this,
07596         m_zoomFactor,
07597         endZoomFactor,
07598         TypeLogging::Float2ToString(centerPoint).c_str(),
07599         zoomFactorChangeCorrelationId);
07600
07601     if (m_zoomAnimationStartingEventSource)
07602     {
07603         auto zoomAnimationStartingEventArgs = winrt::make_self<ScrollingZoomAnimationStartingEventArgs>();
07604
07605         if (zoomFactorChangeCorrelationId != s_noOpCorrelationId)
07606         {
07607             zoomAnimationStartingEventArgs->SetZoomFactorChangeCorrelationId(zoomFactorChangeCorrelationId);
07608         }
07609
07610         zoomAnimationStartingEventArgs->SetAnimation(zoomFactorAnimation);
07611         zoomAnimationStartingEventArgs->SetCenterPoint(centerPoint);
07612         zoomAnimationStartingEventArgs->SetStartZoomFactor(m_zoomFactor);
07613         zoomAnimationStartingEventArgs->SetEndZoomFactor(endZoomFactor);
07614         m_zoomAnimationStartingEventSource(*this, *zoomAnimationStartingEventArgs);
07615         return zoomAnimationStartingEventArgs->GetAnimation();
07616     }
07617     else
07618     {
07619         return zoomFactorAnimation;
07620     }
07621 }
07622
07623 void ScrollPresenter::RaiseViewChangeCompleted(
07624     bool isForScroll,
07625     ScrollPresenterViewChangeResult result,
07626     int32_t viewChangeCorrelationId)
07627 {
07628     if (viewChangeCorrelationId)
07629     {
07630         if (isForScroll && m_scrollCompletedEventSource)
07631         {
07632             SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
07633                 TypeLogging::ScrollPresenterViewChangeResultToString(result).c_str(),
07634                 viewChangeCorrelationId);
07635
07636             auto scrollCompletedEventArgs = winrt::make_self<ScrollingScrollCompletedEventArgs>();
07637
07638             scrollCompletedEventArgs->Result(result);
07639             scrollCompletedEventArgs->OffsetsChangeCorrelationId(viewChangeCorrelationId);
07640             m_scrollCompletedEventSource(*this, *scrollCompletedEventArgs);
07641         }
07642         else if (!isForScroll && m_zoomCompletedEventSource)
07643         {
07644             SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
07645                 TypeLogging::ScrollPresenterViewChangeResultToString(result).c_str(),
07646                 viewChangeCorrelationId);
07647
07648             auto zoomCompletedEventArgs = winrt::make_self<ScrollingZoomCompletedEventArgs>();
07649
07650             zoomCompletedEventArgs->Result(result);
07651             zoomCompletedEventArgs->ZoomFactorChangeCorrelationId(viewChangeCorrelationId);
07652             m_zoomCompletedEventSource(*this, *zoomCompletedEventArgs);
07653         }
07654     }
07655
07656     InvalidateViewport();
07657 }
07658
07659 // Returns False when ScrollingBringingIntoViewEventArgs.Cancel is set to True to skip the operation.
07660 bool ScrollPresenter::RaiseBringingIntoView(
07661     double targetZoomedHorizontalOffset,
07662     double targetZoomedVerticalOffset,
07663     const winrt::BringIntoViewRequestedEventArgs& requestEventArgs,
07664     int32_t offsetsChangeCorrelationId,
07665     _Inout_ winrt::ScrollingSnapPointsMode* snapPointsMode)
07666 {
07667     if (m_bringingIntoViewEventSource)
07668     {
07669         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
07670
07671         auto bringingIntoViewEventArgs = winrt::make_self<ScrollingBringingIntoViewEventArgs>();
07672
07673         bringingIntoViewEventArgs->SnapPointsMode(*snapPointsMode);
07674         bringingIntoViewEventArgs->OffsetsChangeCorrelationId(offsetsChangeCorrelationId);
07675         bringingIntoViewEventArgs->RequestEventArgs(requestEventArgs);
07676         bringingIntoViewEventArgs->TargetOffsets(targetZoomedHorizontalOffset, targetZoomedVerticalOffset);
07677
07678         m_bringingIntoViewEventSource(*this, *bringingIntoViewEventArgs);
07679         *snapPointsMode = bringingIntoViewEventArgs->SnapPointsMode();
07680         return !bringingIntoViewEventArgs->Cancel();
07681     }
07682     return true;
07683 }
07684
07685 #ifdef DBG
07686 void ScrollPresenter::DumpMinMaxPositions()
07687 {
07688     MUX_ASSERT(m_interactionTracker);
07689
07690     const winrt::UIElement content = Content();
07691
07692     if (!content)
07693     {
07694         // Min/MaxPosition == (0, 0)
07695         return;
07696     }
07697
07698     const winrt::Visual scrollPresenterVisual = winrt::ElementCompositionPreview::GetElementVisual(*this);
07699     const winrt::FrameworkElement contentAsFE = content.try_as<winrt::FrameworkElement>();
07700     float minPosX = 0.0f;
07701     float minPosY = 0.0f;
07702     const float extentWidth = static_cast<float>(m_unzoomedExtentWidth);
07703     const float extentHeight = static_cast<float>(m_unzoomedExtentHeight);
07704
07705     if (contentAsFE)
07706     {
07707         if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center ||
07708             contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch)
07709         {
07710             minPosX = std::min(0.0f, (extentWidth * m_interactionTracker.Scale() - scrollPresenterVisual.Size().x) / 2.0f);
07711         }
07712         else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right)
07713         {
07714             minPosX = std::min(0.0f, extentWidth * m_interactionTracker.Scale() - scrollPresenterVisual.Size().x);
07715         }
07716
07717         if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center ||
07718             contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch)
07719         {
07720             minPosY = std::min(0.0f, (extentHeight * m_interactionTracker.Scale() - scrollPresenterVisual.Size().y) / 2.0f);
07721         }
07722         else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom)
07723         {
07724             minPosY = std::min(0.0f, extentHeight * m_interactionTracker.Scale() - scrollPresenterVisual.Size().y);
07725         }
07726     }
07727
07728     float maxPosX = std::max(0.0f, extentWidth * m_interactionTracker.Scale() - scrollPresenterVisual.Size().x);
07729     float maxPosY = std::max(0.0f, extentHeight * m_interactionTracker.Scale() - scrollPresenterVisual.Size().y);
07730
07731     if (contentAsFE)
07732     {
07733         if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center ||
07734             contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch)
07735         {
07736             maxPosX = (extentWidth * m_interactionTracker.Scale() - scrollPresenterVisual.Size().x) >= 0 ?
07737                 (extentWidth * m_interactionTracker.Scale() - scrollPresenterVisual.Size().x) : (extentWidth * m_interactionTracker.Scale() - scrollPresenterVisual.Size().x) / 2.0f;
07738         }
07739         else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right)
07740         {
07741             maxPosX = extentWidth * m_interactionTracker.Scale() - scrollPresenterVisual.Size().x;
07742         }
07743
07744         if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center ||
07745             contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch)
07746         {
07747             maxPosY = (extentHeight * m_interactionTracker.Scale() - scrollPresenterVisual.Size().y) >= 0 ?
07748                 (extentHeight * m_interactionTracker.Scale() - scrollPresenterVisual.Size().y) : (extentHeight * m_interactionTracker.Scale() - scrollPresenterVisual.Size().y) / 2.0f;
07749         }
07750         else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom)
07751         {
07752             maxPosY = extentHeight * m_interactionTracker.Scale() - scrollPresenterVisual.Size().y;
07753         }
07754     }
07755 }
07756 #endif // DBG
07757
07758 #ifdef DBG
07759
07760 winrt::hstring ScrollPresenter::DependencyPropertyToString(const winrt::IDependencyProperty& dependencyProperty)
07761 {
07762     if (dependencyProperty == s_ContentProperty)
07763     {
07764         return L"Content";
07765     }
07766     else if (dependencyProperty == s_BackgroundProperty)
07767     {
07768         return L"Background";
07769     }
07770     else if (dependencyProperty == s_ContentOrientationProperty)
07771     {
07772         return L"ContentOrientation";
07773     }
07774     else if (dependencyProperty == s_VerticalScrollChainModeProperty)
07775     {
07776         return L"VerticalScrollChainMode";
07777     }
07778     else if (dependencyProperty == s_ZoomChainModeProperty)
07779     {
07780         return L"ZoomChainMode";
07781     }
07782     else if (dependencyProperty == s_HorizontalScrollRailModeProperty)
07783     {
07784         return L"HorizontalScrollRailMode";
07785     }
07786     else if (dependencyProperty == s_VerticalScrollRailModeProperty)
07787     {
07788         return L"VerticalScrollRailMode";
07789     }
07790     else if (dependencyProperty == s_HorizontalScrollModeProperty)
07791     {
07792         return L"HorizontalScrollMode";
07793     }
07794     else if (dependencyProperty == s_VerticalScrollModeProperty)
07795     {
07796         return L"VerticalScrollMode";
07797     }
07798     else if (dependencyProperty == s_ComputedHorizontalScrollModeProperty)
07799     {
07800         return L"ComputedHorizontalScrollMode";
07801     }
07802     else if (dependencyProperty == s_ComputedVerticalScrollModeProperty)
07803     {
07804         return L"ComputedVerticalScrollMode";
07805     }
07806     else if (dependencyProperty == s_ZoomModeProperty)
07807     {
07808         return L"ZoomMode";
07809     }
07810     else if (dependencyProperty == s_IgnoredInputKindsProperty)
07811     {
07812         return L"IgnoredInputKinds";
07813     }
07814     else if (dependencyProperty == s_MinZoomFactorProperty)
07815     {
07816         return L"MinZoomFactor";
07817     }
07818     else if (dependencyProperty == s_MaxZoomFactorProperty)
07819     {
07820         return L"MaxZoomFactor";
07821     }
07822     else if (dependencyProperty == s_HorizontalAnchorRatioProperty)
07823     {
07824         return L"HorizontalAnchorRatio";
07825     }
07826     else if (dependencyProperty == s_VerticalAnchorRatioProperty)
07827     {
07828         return L"VerticalAnchorRatio";
07829     }
07830     else
07831     {
07832         return L"UNKNOWN";
07833     }
07834 }
07835
07836 #endif
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SwipeTestHooks Member List

This is the complete list of members for SwipeTestHooks, including all inherited members.
EnsureGlobalTestHooks() | SwipeTestHooks | [static]
GetGlobalTestHooks() | SwipeTestHooks | [inline, static]
GetIsIdle(const winrt::SwipeControl &swipeControl) | SwipeTestHooks | [static]
GetIsOpen(const winrt::SwipeControl &swipeControl) | SwipeTestHooks | [static]
GetLastInteractedWithSwipeControl() | SwipeTestHooks | [static]
IdleStatusChanged(winrt::TypedEventHandler< winrt::SwipeControl, winrt::IInspectable > const &value) | SwipeTestHooks | [static]
IdleStatusChanged(winrt::event_token const &token) | SwipeTestHooks | [static]
LastInteractedWithSwipeControlChanged(winrt::TypedEventHandler< winrt::IInspectable, winrt::IInspectable > const &value) | SwipeTestHooks | [static]
LastInteractedWithSwipeControlChanged(winrt::event_token const &token) | SwipeTestHooks | [static]
m_idleStatusChangedEventSource | SwipeTestHooks | [private]
m_lastInteractedWithSwipeControlChangedEventSource | SwipeTestHooks | [private]
m_openedStatusChangedEventSource | SwipeTestHooks | [private]
NotifyIdleStatusChanged(const winrt::SwipeControl &sender) | SwipeTestHooks | [static]
NotifyLastInteractedWithSwipeControlChanged() | SwipeTestHooks | [static]
NotifyOpenedStatusChanged(const winrt::SwipeControl &sender) | SwipeTestHooks | [static]
OpenedStatusChanged(winrt::TypedEventHandler< winrt::SwipeControl, winrt::IInspectable > const &value) | SwipeTestHooks | [static]
OpenedStatusChanged(winrt::event_token const &token) | SwipeTestHooks | [static]
s_testHooks | SwipeTestHooks | [private, static]
Generated on Sun Dec 1 2024 20:53:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InfoBarProperties Member List

This is the complete list of members for InfoBarProperties, including all inherited members.
ActionButton(winrt::ButtonBase const &value) | InfoBarProperties |
ActionButton() | InfoBarProperties |
ActionButtonProperty() | InfoBarProperties | [inline, static]
ClearProperties() | InfoBarProperties | [static]
CloseButtonClick(winrt::TypedEventHandler< winrt::InfoBar, winrt::IInspectable > const &value) | InfoBarProperties |
CloseButtonClick(winrt::event_token const &token) | InfoBarProperties |
CloseButtonCommand(winrt::ICommand const &value) | InfoBarProperties |
CloseButtonCommand() | InfoBarProperties |
CloseButtonCommandParameter(winrt::IInspectable const &value) | InfoBarProperties |
CloseButtonCommandParameter() | InfoBarProperties |
CloseButtonCommandParameterProperty() | InfoBarProperties | [inline, static]
CloseButtonCommandProperty() | InfoBarProperties | [inline, static]
CloseButtonStyle(winrt::Style const &value) | InfoBarProperties |
CloseButtonStyle() | InfoBarProperties |
CloseButtonStyleProperty() | InfoBarProperties | [inline, static]
Closed(winrt::TypedEventHandler< winrt::InfoBar, winrt::InfoBarClosedEventArgs > const &value) | InfoBarProperties |
Closed(winrt::event_token const &token) | InfoBarProperties |
Closing(winrt::TypedEventHandler< winrt::InfoBar, winrt::InfoBarClosingEventArgs > const &value) | InfoBarProperties |
Closing(winrt::event_token const &token) | InfoBarProperties |
Content(winrt::IInspectable const &value) | InfoBarProperties |
Content() | InfoBarProperties |
ContentProperty() | InfoBarProperties | [inline, static]
ContentTemplate(winrt::DataTemplate const &value) | InfoBarProperties |
ContentTemplate() | InfoBarProperties |
ContentTemplateProperty() | InfoBarProperties | [inline, static]
EnsureProperties() | InfoBarProperties | [static]
IconSource(winrt::IconSource const &value) | InfoBarProperties |
IconSource() | InfoBarProperties |
IconSourceProperty() | InfoBarProperties | [inline, static]
InfoBarProperties() | InfoBarProperties |
IsClosable(bool value) | InfoBarProperties |
IsClosable() | InfoBarProperties |
IsClosableProperty() | InfoBarProperties | [inline, static]
IsIconVisible(bool value) | InfoBarProperties |
IsIconVisible() | InfoBarProperties |
IsIconVisibleProperty() | InfoBarProperties | [inline, static]
IsOpen(bool value) | InfoBarProperties |
IsOpen() | InfoBarProperties |
IsOpenProperty() | InfoBarProperties | [inline, static]
m_closeButtonClickEventSource | InfoBarProperties |
m_closedEventSource | InfoBarProperties |
m_closingEventSource | InfoBarProperties |
Message(winrt::hstring const &value) | InfoBarProperties |
Message() | InfoBarProperties |
MessageProperty() | InfoBarProperties | [inline, static]
OnActionButtonPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBarProperties | [static]
OnIconSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBarProperties | [static]
OnIsClosablePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBarProperties | [static]
OnIsIconVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBarProperties | [static]
OnIsOpenPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBarProperties | [static]
OnMessagePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBarProperties | [static]
OnSeverityPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBarProperties | [static]
OnTitlePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBarProperties | [static]
s_ActionButtonProperty | InfoBarProperties | [static]
s_CloseButtonCommandParameterProperty | InfoBarProperties | [static]
s_CloseButtonCommandProperty | InfoBarProperties | [static]
s_CloseButtonStyleProperty | InfoBarProperties | [static]
s_ContentProperty | InfoBarProperties | [static]
s_ContentTemplateProperty | InfoBarProperties | [static]
s_IconSourceProperty | InfoBarProperties | [static]
s_IsClosableProperty | InfoBarProperties | [static]
s_IsIconVisibleProperty | InfoBarProperties | [static]
s_IsOpenProperty | InfoBarProperties | [static]
s_MessageProperty | InfoBarProperties | [static]
s_SeverityProperty | InfoBarProperties | [static]
s_TemplateSettingsProperty | InfoBarProperties | [static]
s_TitleProperty | InfoBarProperties | [static]
Severity(winrt::InfoBarSeverity const &value) | InfoBarProperties |
Severity() | InfoBarProperties |
SeverityProperty() | InfoBarProperties | [inline, static]
TemplateSettings(winrt::InfoBarTemplateSettings const &value) | InfoBarProperties |
TemplateSettings() | InfoBarProperties |
TemplateSettingsProperty() | InfoBarProperties | [inline, static]
Title(winrt::hstring const &value) | InfoBarProperties |
Title() | InfoBarProperties |
TitleProperty() | InfoBarProperties | [inline, static]
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TabView/TabViewItemAutomationPeer.cpp Source File

  • TabView

TabViewItemAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "TabViewItem.h"
00008 #include "TabViewItemAutomationPeer.h"
00009 #include "Utils.h"
00010 #include "SharedHelpers.h"
00011
00012 #include "TabViewItemAutomationPeer.properties.cpp"
00013
00014 TabViewItemAutomationPeer::TabViewItemAutomationPeer(winrt::TabViewItem const& owner)
00015     : ReferenceTracker(owner)
00016 {
00017 }
00018
00019 // IAutomationPeerOverrides
00020 winrt::IInspectable TabViewItemAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00021 {
00022     // We subclass from ListViewItemAutomationPeer without using everything from it,
00023     // so we need to make sure we are returning TabViewItem's AutomationPeer for selection and drag, and not the parent class version
00024     if (patternInterface == winrt::PatternInterface::SelectionItem || patternInterface == winrt::PatternInterface::Drag)
00025     {
00026         return *this;
00027     }
00028     return __super::GetPatternCore(patternInterface);
00029 }
00030
00031 hstring TabViewItemAutomationPeer::GetClassNameCore()
00032 {
00033     return winrt::hstring_name_of<winrt::TabViewItem>();
00034 }
00035
00036 winrt::AutomationControlType TabViewItemAutomationPeer::GetAutomationControlTypeCore()
00037 {
00038     return winrt::AutomationControlType::TabItem;
00039 }
00040
00041 winrt::hstring TabViewItemAutomationPeer::GetNameCore()
00042 {
00043     winrt::hstring returnHString = __super::GetNameCore();
00044
00045     // If a name hasn't been provided by AutomationProperties.Name in markup:
00046     if (returnHString.empty())
00047     {
00048         if (auto tvi = Owner().try_as<winrt::TabViewItem>())
00049         {
00050             returnHString = SharedHelpers::TryGetStringRepresentationFromObject(tvi.Header());
00051         }
00052     }
00053
00054     return returnHString;
00055 }
00056
00057
00058 bool TabViewItemAutomationPeer::IsSelected()
00059 {
00060     if (auto tvi = Owner().try_as<TabViewItem>())
00061     {
00062         return tvi->IsSelected();
00063     }
00064     return false;
00065 }
00066
00067 winrt::IRawElementProviderSimple TabViewItemAutomationPeer::SelectionContainer()
00068 {
00069     if (const auto parent = GetParentTabView())
00070     {
00071         if (const auto peer = winrt::FrameworkElementAutomationPeer::CreatePeerForElement(parent))
00072         {
00073             return ProviderFromPeer(peer);
00074         }
00075     }
00076     return nullptr;
00077 }
00078
00079 void TabViewItemAutomationPeer::AddToSelection()
00080 {
00081     Select();
00082 }
00083
00084 void TabViewItemAutomationPeer::RemoveFromSelection()
00085 {
00086     // Can't unselect in a TabView without knowing next selection
00087 }
00088
00089 void TabViewItemAutomationPeer::Select()
00090 {
00091     if (auto owner = Owner().try_as<TabViewItem>().get())
00092     {
00093         owner->IsSelected(true);
00094     }
00095 }
00096
00097 winrt::TabView TabViewItemAutomationPeer::GetParentTabView()
00098 {
00099     winrt::TabView parentTabView{ nullptr };
00100
00101     winrt::TabViewItem tabViewItem = Owner().try_as<winrt::TabViewItem>();
00102     if (tabViewItem)
00103     {
00104         parentTabView = winrt::get_self<TabViewItem>(tabViewItem)->GetParentTabView();
00105     }
00106     return parentTabView;
00107 }
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommandBarPage Member List

This is the complete list of members for CommandBarPage, including all inherited members.
BottomAppBarButton_Click(object sender, RoutedEventArgs args) | CommandBarPage | [inline]
CommandBarPage() | CommandBarPage | [inline]
OpenCloseAppBarsButton_Click(object sender, RoutedEventArgs args) | CommandBarPage | [inline]
StickyUnstickyAppBarsButton_Click(object sender, RoutedEventArgs args) | CommandBarPage | [inline]
TopAppBarButton_Click(object sender, RoutedEventArgs args) | CommandBarPage | [inline]
Generated on Sun Dec 1 2024 20:54:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

StackLayout Member List

This is the complete list of members for StackLayout, including all inherited members.
abi_enter() | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
Algorithm_GetAnchorForRealizationRect(const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context) override | StackLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetAnchorForRealizationRect(const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_GetAnchorForTargetElement(int targetIndex, const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context) override | StackLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetAnchorForTargetElement(int targetIndex, const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_GetExtent(const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context, const winrt::UIElement &firstRealized, int firstRealizedItemIndex, const winrt::Rect &firstRealizedLayoutBounds, const winrt::UIElement &lastRealized, int lastRealizedItemIndex, const winrt::Rect &lastRealizedLayoutBounds) override | StackLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetExtent(const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context, const winrt::UIElement &firstRealized, int firstRealizedItemIndex, const winrt::Rect &firstRealizedLayoutBounds, const winrt::UIElement &lastRealized, int lastRealizedItemIndex, const winrt::Rect &lastRealizedLayoutBounds)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_GetMeasureSize(int index, const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context) override | StackLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetMeasureSize(int index, const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_GetProvisionalArrangeSize(int index, const winrt::Size &measureSize, winrt::Size const &desiredSize, const winrt::VirtualizingLayoutContext &context) override | StackLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetProvisionalArrangeSize(int index, const winrt::Size &measureSize, winrt::Size const &desiredSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_OnElementMeasured(const winrt::UIElement &element, int index, const winrt::Size &availableSize, const winrt::Size &measureSize, const winrt::Size &desiredSize, const winrt::Size &provisionalArrangeSize, const winrt::VirtualizingLayoutContext &context) override | StackLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_OnElementMeasured(const winrt::UIElement &element, int index, const winrt::Size &availableSize, const winrt::Size &measureSize, const winrt::Size &desiredSize, const winrt::Size &provisionalArrangeSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_OnLineArranged(int, int, double, const winrt::VirtualizingLayoutContext &) override | StackLayout | [inline]
IFlowLayoutAlgorithmDelegates::Algorithm_OnLineArranged(int startIndex, int countInLine, double lineSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_ShouldBreakLine(int index, double remainingSpace) override | StackLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_ShouldBreakLine(int index, double remainingSpace)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
ArrangeOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &finalSize) | StackLayout |
CheckThread() | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
ClearProperties() | StackLayoutProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< StackLayout > &&self) noexcept | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline, static]
EnsureProperties() | StackLayoutProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
final_release(std::unique_ptr< StackLayout > &&self) | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline, static]
GetAnchorForRealizationRect(winrt::Size const &availableSize, winrt::VirtualizingLayoutContext const &context) | StackLayout |
GetAsStackState(const winrt::IInspectable &state) | StackLayout | [inline, private]
GetAverageElementSize(winrt::Size availableSize, winrt::VirtualizingLayoutContext context, const winrt::com_ptr< StackLayoutState > &layoutState) | StackLayout | [private]
GetBase() | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
GetExtent(winrt::Size const &availableSize, winrt::VirtualizingLayoutContext const &context, winrt::UIElement const &firstRealized, int firstRealizedItemIndex, winrt::Rect const &firstRealizedLayoutBounds, winrt::UIElement const &lastRealized, int lastRealizedItemIndex, winrt::Rect const &lastRealizedLayoutBounds) | StackLayout |
GetFlowAlgorithm(const winrt::VirtualizingLayoutContext &context) | StackLayout | [inline, private]
GetInner() | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
GetScrollOrientation() const | OrientationBasedMeasures | [inline]
InitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | StackLayout |
InvalidateLayout() | StackLayout | [inline, private]
IsOnThread() | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
IsVirtualizationEnabled(bool value) | StackLayoutProperties |
IsVirtualizationEnabled() | StackLayoutProperties |
IsVirtualizationEnabledProperty() | StackLayoutProperties | [inline, static]
Major(const winrt::Size &size) | OrientationBasedMeasures |
MajorEnd(const winrt::Rect &rect) const | OrientationBasedMeasures |
MajorSize(const winrt::Rect &rect) | OrientationBasedMeasures |
MajorStart(const winrt::Rect &rect) | OrientationBasedMeasures |
MeasureOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &availableSize) | StackLayout |
Minor(const winrt::Size &size) | OrientationBasedMeasures |
MinorEnd(const winrt::Rect &rect) const | OrientationBasedMeasures |
MinorMajorPoint(float minor, float major) | OrientationBasedMeasures |
MinorMajorRect(float minor, float major, float minorSize, float majorSize) | OrientationBasedMeasures |
MinorMajorSize(float minor, float major) | OrientationBasedMeasures |
MinorSize(const winrt::Rect &rect) | OrientationBasedMeasures |
MinorStart(const winrt::Rect &rect) | OrientationBasedMeasures |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
OnElementMeasured(winrt::UIElement const &element, int index, winrt::Size const &availableSize, winrt::Size const &measureSize, winrt::Size const &desiredSize, winrt::Size const &provisionalArrangeSize, winrt::VirtualizingLayoutContext const &context) | StackLayout |
OnIsVirtualizationEnabledPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | StackLayoutProperties | [static]
OnItemsChangedCore(winrt::VirtualizingLayoutContext const &context, winrt::IInspectable const &source, winrt::NotifyCollectionChangedEventArgs const &args) | StackLayout |
OnOrientationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | StackLayoutProperties | [static]
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | StackLayout |
OnSpacingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | StackLayoutProperties | [static]
Orientation(winrt::Orientation const &value) | StackLayoutProperties |
Orientation() | StackLayoutProperties |
OrientationProperty() | StackLayoutProperties | [inline, static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< StackLayout, winrt::implementation::StackLayoutT, VirtualizingLayout > | [inline]
s_IsVirtualizationEnabledProperty | StackLayoutProperties | [static]
s_OrientationProperty | StackLayoutProperties | [static]
s_SpacingProperty | StackLayoutProperties | [static]
SetScrollOrientation(ScrollOrientation value) | OrientationBasedMeasures | [inline]
Spacing(double value) | StackLayoutProperties |
Spacing() | StackLayoutProperties |
SpacingProperty() | StackLayoutProperties | [inline, static]
StackLayout() | StackLayout |
StackLayoutProperties() | StackLayoutProperties |
UninitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | StackLayout |
UpdateIndexBasedLayoutOrientation(const winrt::Orientation &orientation) | StackLayout | [private]
~IFlowLayoutAlgorithmDelegates() | IFlowLayoutAlgorithmDelegates | [virtual]
Generated on Sun Dec 1 2024 20:53:12 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectionModelTests Member List

This is the complete list of members for SelectionModelTests, including all inherited members.
_nextData | SelectionModelTests | [private, static]
AlreadyDeselectedDoesNotRaiseEvent() | SelectionModelTests | [inline]
AlreadySelectedDoesNotRaiseEvent() | SelectionModelTests | [inline]
AreEqual(IndexPath a, IndexPath b) | SelectionModelTests | [inline, private]
CanExtendSelectionModelINPC() | SelectionModelTests | [inline]
CanReadSelectedItemViaICustomPropertyProvider() | SelectionModelTests | [inline]
CanReplaceItem() | SelectionModelTests | [inline]
ClearSelection(SelectionModel manager) | SelectionModelTests | [inline, private]
Contains(List< IndexPath > list, IndexPath index) | SelectionModelTests | [inline, private]
CreateNestedData(int levels=3, int groupsAtLevel=5, int countAtLeaf=10) | SelectionModelTests | [inline, static]
GetData(SelectionModel selectionModel, IndexPath indexPath) | SelectionModelTests | [inline, private]
GetIndexPathsInSource(object source) | SelectionModelTests | [inline, private]
Path(params int[] path) | SelectionModelTests | [inline, static]
Select(SelectionModel manager, int index, bool select) | SelectionModelTests | [inline, private]
Select(SelectionModel manager, int groupIndex, int itemIndex, bool select) | SelectionModelTests | [inline, private]
Select(SelectionModel manager, IndexPath index, bool select) | SelectionModelTests | [inline, private]
SelectRangeFromAnchor(SelectionModel manager, int index, bool select) | SelectionModelTests | [inline, private]
SelectRangeFromAnchor(SelectionModel manager, int groupIndex, int itemIndex, bool select) | SelectionModelTests | [inline, private]
SelectRangeFromAnchor(SelectionModel manager, IndexPath index, bool select) | SelectionModelTests | [inline, private]
SelectRangeRegressionTest() | SelectionModelTests | [inline]
SetAnchorIndex(SelectionModel manager, int index) | SelectionModelTests | [inline, private]
SetAnchorIndex(SelectionModel manager, int groupIndex, int itemIndex) | SelectionModelTests | [inline, private]
SetAnchorIndex(SelectionModel manager, IndexPath index) | SelectionModelTests | [inline, private]
Traverse(object root, Action< TreeWalkNodeInfo > nodeAction) | SelectionModelTests | [inline, private, static]
ValidateCanSetSelectedIndex() | SelectionModelTests | [inline]
ValidateClear() | SelectionModelTests | [inline]
ValidateEventWhenInnerNodeChangesSelectionState() | SelectionModelTests | [inline]
ValidateGroupClear() | SelectionModelTests | [inline]
ValidateGroupInserts() | SelectionModelTests | [inline]
ValidateGroupRemoves() | SelectionModelTests | [inline]
ValidateGroupReplaceLosesSelection() | SelectionModelTests | [inline]
ValidateInserts() | SelectionModelTests | [inline]
ValidateNestedMultipleSelection() | SelectionModelTests | [inline]
ValidateNestedMultipleSelection(bool handleChildrenRequested) | SelectionModelTests | [inline, private]
ValidateNestedSingleSelection() | SelectionModelTests | [inline]
ValidateOneLevelMultipleSelection() | SelectionModelTests | [inline]
ValidateOneLevelSingleSelection() | SelectionModelTests | [inline]
ValidateOneLevelSingleSelectionNoSource() | SelectionModelTests | [inline]
ValidatePropertyChangedEventIsRaised() | SelectionModelTests | [inline]
ValidateRemoves() | SelectionModelTests | [inline]
ValidateSelection(SelectionModel selectionModel, List< IndexPath > expectedSelected, List< IndexPath > expectedPartialSelected=null, int selectedInnerNodes=0) | SelectionModelTests | [inline, private]
ValidateSelectionChangedEventMultipleSelection() | SelectionModelTests | [inline]
ValidateSelectionChangedEventSingleSelection() | SelectionModelTests | [inline]
ValidateSelectionModeChangeFromMultipleToSingle() | SelectionModelTests | [inline]
ValidateSelectionModeChangeFromMultipleToSingleSelectionChangedEvent() | SelectionModelTests | [inline]
ValidateTwoLevelMultipleSelection() | SelectionModelTests | [inline]
ValidateTwoLevelSingleSelection() | SelectionModelTests | [inline]
Generated on Sun Dec 1 2024 20:53:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RepeaterItemAutomationPeer Member List

This is the complete list of members for RepeaterItemAutomationPeer, including all inherited members.
_owner | RepeaterItemAutomationPeer | [private]
AddToSelection() | RepeaterItemAutomationPeer | [inline]
GetAutomationControlTypeCore() | RepeaterItemAutomationPeer | [inline, protected]
GetLocalizedControlTypeCore() | RepeaterItemAutomationPeer | [inline, protected]
GetPatternCore(PatternInterface patternInterface) | RepeaterItemAutomationPeer | [inline, protected]
IsSelected | RepeaterItemAutomationPeer |
RemoveFromSelection() | RepeaterItemAutomationPeer | [inline]
RepeaterItemAutomationPeer(FrameworkElement owner) | RepeaterItemAutomationPeer | [inline]
Select() | RepeaterItemAutomationPeer | [inline]
SelectionContainer | RepeaterItemAutomationPeer |
Generated on Sun Dec 1 2024 20:54:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/SelectTemplateEventArgs.h Source File

  • Repeater

SelectTemplateEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SelectTemplateEventArgs.g.h"
00007
00008 class SelectTemplateEventArgs :
00009     public ReferenceTracker<SelectTemplateEventArgs, winrt::implementation::SelectTemplateEventArgsT, winrt::composable, winrt::composing>
00010 {
00011 public:
00012
00013 #pragma region ISelectTemplateEventArgs
00014     winrt::hstring TemplateKey();
00015     void TemplateKey(winrt::hstring const& value);
00016
00017     winrt::IInspectable DataContext();
00018     winrt::UIElement Owner();
00019 #pragma endregion
00020
00021     void DataContext(winrt::IInspectable const& value);
00022     void Owner(const winrt::UIElement& value);
00023
00024 private:
00025     winrt::hstring m_templateKey{};
00026     tracker_ref<winrt::IInspectable> m_dataContext{ this };
00027     tracker_ref<winrt::UIElement> m_owner{ this };
00028 };
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: LayoutPanel/LayoutPanel.cpp Source File

  • LayoutPanel

LayoutPanel.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "LayoutPanel.h"
00007 #include "LayoutPanelLayoutContext.h"
00008
00009 #include "LayoutPanel.properties.cpp"
00010
00011 void LayoutPanel::OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args)
00012 {
00013     const winrt::IDependencyProperty dependencyProperty = args.Property();
00014
00015     if (dependencyProperty == s_LayoutProperty)
00016     {
00017         m_layout.set(args.NewValue().as<winrt::Layout>());
00018         OnLayoutChanged(args.OldValue().as<winrt::Layout>(), m_layout.get());
00019     }
00020 #ifdef USE_INTERNAL_SDK
00021     else if (dependencyProperty == s_borderBrushProperty)
00022     {
00023         if (auto panelProtected = try_as<winrt::Microsoft::UI::Xaml::Controls::IPanelProtectedFeature_WUXCPreviewTypes>())
00024         {
00025             panelProtected.BorderBrushProtected(safe_cast<winrt::Brush>(args.NewValue()));
00026         }
00027     }
00028     else if (dependencyProperty == s_borderThicknessProperty)
00029     {
00030         if (auto panelProtected = try_as<winrt::Microsoft::UI::Xaml::Controls::IPanelProtectedFeature_WUXCPreviewTypes>())
00031         {
00032             panelProtected.BorderThicknessProtected(unbox_value<winrt::Thickness>(args.NewValue()));
00033         }
00034     }
00035     else if (dependencyProperty == s_cornerRadiusProperty)
00036     {
00037         if (auto panelProtected = try_as<winrt::Microsoft::UI::Xaml::Controls::IPanelProtectedFeature_WUXCPreviewTypes>())
00038         {
00039             panelProtected.CornerRadiusProtected(unbox_value<winrt::CornerRadius>(args.NewValue()));
00040         }
00041     }
00042 #endif
00043     else if (dependencyProperty == s_PaddingProperty)
00044     {
00045         InvalidateMeasure();
00046     }
00047 }
00048
00049
00050 winrt::Size LayoutPanel::MeasureOverride(winrt::Size const& availableSize)
00051 {
00052     winrt::Size desiredSize{};
00053
00054     // We adjust availableSize based on our Padding and BorderThickness:
00055     const auto padding = Padding();
00056     const auto borderThickness = BorderThickness();
00057     const auto effectiveHorizontalPadding = static_cast<float>(padding.Left + padding.Right + borderThickness.Left + borderThickness.Right);
00058     const auto effectiveVerticalPadding = static_cast<float>(padding.Top + padding.Bottom + borderThickness.Top + borderThickness.Bottom);
00059
00060     auto adjustedSize = availableSize;
00061     adjustedSize.Width -= effectiveHorizontalPadding;
00062     adjustedSize.Height -= effectiveVerticalPadding;
00063
00064     adjustedSize.Width = std::max(0.0f, adjustedSize.Width);
00065     adjustedSize.Height = std::max(0.0f, adjustedSize.Height);
00066
00067     if (auto layout = Layout())
00068     {
00069         auto layoutDesiredSize = layout.Measure(m_layoutContext, adjustedSize);
00070         layoutDesiredSize.Width += effectiveHorizontalPadding;
00071         layoutDesiredSize.Height += effectiveVerticalPadding;
00072         desiredSize = layoutDesiredSize;
00073     }
00074     else
00075     {
00076         winrt::Size desiredSizeUnpadded{};
00077         for (winrt::UIElement const& child : Children())
00078         {
00079             child.Measure(adjustedSize);
00080             const auto childDesiredSize = child.DesiredSize();
00081             desiredSizeUnpadded.Width = std::max(desiredSizeUnpadded.Width, childDesiredSize.Width);
00082             desiredSizeUnpadded.Height = std::max(desiredSizeUnpadded.Height, childDesiredSize.Height);
00083         }
00084         desiredSize = desiredSizeUnpadded;
00085         desiredSize.Width += effectiveHorizontalPadding;
00086         desiredSize.Height += effectiveVerticalPadding;
00087     }
00088     return desiredSize;
00089 }
00090
00091 winrt::Size LayoutPanel::ArrangeOverride(winrt::Size const& finalSize)
00092 {
00093     winrt::Size result = finalSize;
00094
00095     const auto padding = Padding();
00096     const auto borderThickness = BorderThickness();
00097
00098     const auto effectiveHorizontalPadding = static_cast<float>(padding.Left + padding.Right + borderThickness.Left + borderThickness.Right);
00099     const auto effectiveVerticalPadding = static_cast<float>(padding.Top + padding.Bottom + borderThickness.Top + borderThickness.Bottom);
00100     const auto leftAdjustment = static_cast<float>(padding.Left + borderThickness.Left);
00101     const auto topAdjustment = static_cast<float>(padding.Top + borderThickness.Top);
00102
00103     auto adjustedSize = finalSize;
00104     adjustedSize.Width -= effectiveHorizontalPadding;
00105     adjustedSize.Height -= effectiveVerticalPadding;
00106
00107     adjustedSize.Width = std::max(0.0f, adjustedSize.Width);
00108     adjustedSize.Height = std::max(0.0f, adjustedSize.Height);
00109
00110     if (auto layout = Layout())
00111     {
00112         auto layoutSize = layout.Arrange(m_layoutContext, adjustedSize);
00113         layoutSize.Width += effectiveHorizontalPadding;
00114         layoutSize.Height += effectiveVerticalPadding;
00115
00116         // We need to reposition the child elements if we have top or left padding:
00117         if (leftAdjustment != 0 || topAdjustment != 0)
00118         {
00119             for (winrt::UIElement const& child: Children())
00120             {
00121                 if (auto childAsFe = child.try_as<winrt::FrameworkElement>())
00122                 {
00123                     auto layoutSlot = winrt::LayoutInformation::GetLayoutSlot(childAsFe);
00124                     layoutSlot.X += leftAdjustment;
00125                     layoutSlot.Y += topAdjustment;
00126                     childAsFe.Arrange(layoutSlot);
00127                 }
00128             }
00129         }
00130
00131         result = layoutSize;
00132     }
00133     else
00134     {
00135         const winrt::Rect arrangeRect = { leftAdjustment, topAdjustment, adjustedSize.Width, adjustedSize.Height };
00136         for (winrt::UIElement const& child : Children())
00137         {
00138             child.Arrange(arrangeRect);
00139         }
00140     }
00141
00142     return result;
00143 }
00144
00145 void LayoutPanel::OnLayoutChanged(winrt::Layout const& oldValue, winrt::Layout const& newValue)
00146 {
00147     if (!m_layoutContext)
00148     {
00149         m_layoutContext = winrt::make<LayoutPanelLayoutContext>(*this);
00150     }
00151
00152     if (oldValue)
00153     {
00154         oldValue.UninitializeForContext(m_layoutContext);
00155         m_measureInvalidated.revoke();
00156         m_arrangeInvalidated.revoke();
00157     }
00158
00159     m_layout.set(newValue);
00160
00161     if (newValue)
00162     {
00163         newValue.InitializeForContext(m_layoutContext);
00164         m_measureInvalidated = newValue.MeasureInvalidated(winrt::auto_revoke, { this, &LayoutPanel::InvalidateMeasureForLayout });
00165         m_arrangeInvalidated = newValue.ArrangeInvalidated(winrt::auto_revoke, { this, &LayoutPanel::InvalidateArrangeForLayout });
00166     }
00167
00168     InvalidateMeasure();
00169 }
00170
00171 void LayoutPanel::InvalidateMeasureForLayout(winrt::Layout const& sender, winrt::IInspectable const& args)
00172 {
00173     InvalidateMeasure();
00174 }
00175
00176 void LayoutPanel::InvalidateArrangeForLayout(winrt::Layout const& sender, winrt::IInspectable const& args)
00177 {
00178     InvalidateArrange();
00179 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ParallaxViewTests Member List

This is the complete list of members for ParallaxViewTests, including all inherited members.
ChangeSourceAndTargetProperties(SourceType sourceType) | ParallaxViewTests | [inline, private]
ChangeSourceAndTargetPropertiesUsingScrollPresenter() | ParallaxViewTests | [inline]
ChangeSourceAndTargetPropertiesUsingScrollViewer() | ParallaxViewTests | [inline]
ClassInitialize(TestContext testContext) | ParallaxViewTests | [inline, static]
SelectSource(string sourceName) | ParallaxViewTests | [inline, private]
SelectTarget(string targetName) | ParallaxViewTests | [inline, private]
SourceType enum name | ParallaxViewTests | [private]
TargetListViewBackground() | ParallaxViewTests | [inline]
TargetListViewHeader() | ParallaxViewTests | [inline]
TargetListViewItem() | ParallaxViewTests | [inline]
TestCleanup() | ParallaxViewTests | [inline]
UseTextControlSource() | ParallaxViewTests | [inline]
UseVirtualizingStackPanelSource() | ParallaxViewTests | [inline]
WriteInTextBox(string textBoxName, string text) | ParallaxViewTests | [inline, private]
Generated on Sun Dec 1 2024 20:53:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/Layout.cpp Source File

  • Repeater

Layout.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "Layout.h"
00008 #include "VirtualizingLayoutContext.h"
00009 #include "LayoutContextAdapter.h"
00010
00011 #pragma region ILayout
00012
00013 winrt::hstring Layout::LayoutId()
00014 {
00015     return m_layoutId;
00016 }
00017
00018 void Layout::LayoutId(winrt::hstring const& value)
00019 {
00020     m_layoutId = value;
00021 }
00022
00023 // Invoked by LayoutsTestHooks only for testing purposes
00024 winrt::IndexBasedLayoutOrientation Layout::GetForcedIndexBasedLayoutOrientation()
00025 {
00026     return m_forcedIndexBasedLayoutOrientationDbg;
00027 }
00028
00029 void Layout::SetForcedIndexBasedLayoutOrientation(winrt::IndexBasedLayoutOrientation forcedIndexBasedLayoutOrientation)
00030 {
00031     m_forcedIndexBasedLayoutOrientationDbg = forcedIndexBasedLayoutOrientation;
00032     m_isForcedIndexBasedLayoutOrientationSetDbg = true;
00033 }
00034
00035 void Layout::ResetForcedIndexBasedLayoutOrientation()
00036 {
00037     m_forcedIndexBasedLayoutOrientationDbg = winrt::IndexBasedLayoutOrientation::None;
00038     m_isForcedIndexBasedLayoutOrientationSetDbg = false;
00039 }
00040
00041 winrt::IndexBasedLayoutOrientation Layout::IndexBasedLayoutOrientation()
00042 {
00043     return m_isForcedIndexBasedLayoutOrientationSetDbg ? m_forcedIndexBasedLayoutOrientationDbg : m_indexBasedLayoutOrientation;
00044 }
00045
00046 namespace
00047 {
00048     winrt::VirtualizingLayoutContext GetVirtualizingLayoutContext(winrt::LayoutContext const& context)
00049     {
00050         if (auto virtualizingContext = context.try_as<winrt::VirtualizingLayoutContext>())
00051         {
00052             return virtualizingContext;
00053         }
00054         else if (auto nonVirtualizingContext = context.try_as<winrt::NonVirtualizingLayoutContext>())
00055         {
00056             auto adapter = winrt::get_self<NonVirtualizingLayoutContext>(nonVirtualizingContext)->GetVirtualizingContextAdapter();
00057             return adapter;
00058         }
00059         else
00060         {
00061             throw winrt::hresult_not_implemented();
00062         }
00063     }
00064
00065     winrt::NonVirtualizingLayoutContext GetNonVirtualizingLayoutContext(winrt::LayoutContext const& context)
00066     {
00067         if (auto nonVirtualizingContext = context.try_as<winrt::NonVirtualizingLayoutContext>())
00068         {
00069             return nonVirtualizingContext;
00070         }
00071         else if (auto virtualizingContext = context.try_as<winrt::VirtualizingLayoutContext>())
00072         {
00073             auto adapter = winrt::get_self<VirtualizingLayoutContext>(virtualizingContext)->GetNonVirtualizingContextAdapter();
00074             return adapter;
00075         }
00076         else
00077         {
00078             throw winrt::hresult_not_implemented();
00079         }
00080     }
00081 }
00082
00083
00084 void Layout::InitializeForContext(winrt::LayoutContext const& context)
00085 {
00086     auto spThis = get_strong();
00087     if (auto virtualizingLayout = spThis.try_as<winrt::IVirtualizingLayoutOverrides>())
00088     {
00089         auto virtualizingContext = GetVirtualizingLayoutContext(context);
00090         return virtualizingLayout.InitializeForContextCore(virtualizingContext);
00091     }
00092     else if (auto nonVirtualizingLayout = get_strong().try_as<winrt::INonVirtualizingLayoutOverrides>())
00093     {
00094         auto nonVirtualizingContext = GetNonVirtualizingLayoutContext(context);
00095         return nonVirtualizingLayout.InitializeForContextCore(nonVirtualizingContext);
00096     }
00097     else
00098     {
00099         throw winrt::hresult_not_implemented();
00100     }
00101 }
00102
00103 void Layout::UninitializeForContext(winrt::LayoutContext const& context)
00104 {
00105     auto spThis = get_strong();
00106     if (auto virtualizingLayout = spThis.try_as<winrt::IVirtualizingLayoutOverrides>())
00107     {
00108         auto virtualizingContext = GetVirtualizingLayoutContext(context);
00109         return virtualizingLayout.UninitializeForContextCore(virtualizingContext);
00110     }
00111     else if (auto nonVirtualizingLayout = spThis.try_as<winrt::INonVirtualizingLayoutOverrides>())
00112     {
00113         auto nonVirtualizingContext = GetNonVirtualizingLayoutContext(context);
00114         return nonVirtualizingLayout.UninitializeForContextCore(nonVirtualizingContext);
00115     }
00116     else
00117     {
00118         throw winrt::hresult_not_implemented();
00119     }
00120 }
00121
00122 winrt::Size Layout::Measure(
00123     winrt::LayoutContext const& context,
00124     winrt::Size const& availableSize
00125     )
00126 {
00127     auto spThis = get_strong();
00128     if (auto virtualizingLayout = spThis.try_as<winrt::IVirtualizingLayoutOverrides>())
00129     {
00130         auto virtualizingContext = GetVirtualizingLayoutContext(context);
00131         return virtualizingLayout.MeasureOverride(virtualizingContext, availableSize);
00132     }
00133     else if (auto nonVirtualizingLayout = spThis.try_as<winrt::INonVirtualizingLayoutOverrides>())
00134     {
00135         auto nonVirtualizingContext = GetNonVirtualizingLayoutContext(context);
00136         return nonVirtualizingLayout.MeasureOverride(nonVirtualizingContext, availableSize);
00137     }
00138     else
00139     {
00140         throw winrt::hresult_not_implemented();
00141     }
00142 }
00143
00144 winrt::Size Layout::Arrange(
00145     winrt::LayoutContext const& context,
00146     winrt::Size const& finalSize)
00147 {
00148     auto spThis = get_strong();
00149     if (auto virtualizingLayout = spThis.try_as<winrt::IVirtualizingLayoutOverrides>())
00150     {
00151         auto virtualizingContext = GetVirtualizingLayoutContext(context);
00152         return virtualizingLayout.ArrangeOverride(virtualizingContext, finalSize);
00153     }
00154     else if (auto nonVirtualizingLayout = spThis.try_as<winrt::INonVirtualizingLayoutOverrides>())
00155     {
00156         auto nonVirtualizingContext = GetNonVirtualizingLayoutContext(context);
00157         return nonVirtualizingLayout.ArrangeOverride(nonVirtualizingContext, finalSize);
00158     }
00159     else
00160     {
00161         throw winrt::hresult_not_implemented();
00162     }
00163 }
00164
00165 winrt::event_token Layout::MeasureInvalidated(winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable> const& value)
00166 {
00167     return m_measureInvalidatedEventSource.add(value);
00168 }
00169
00170 void Layout::MeasureInvalidated(winrt::event_token const& token)
00171 {
00172     m_measureInvalidatedEventSource.remove(token);
00173 }
00174
00175 winrt::event_token Layout::ArrangeInvalidated(winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable> const& value)
00176 {
00177     return m_arrangeInvalidatedEventSource.add(value);
00178 }
00179
00180 void Layout::ArrangeInvalidated(winrt::event_token const& token)
00181 {
00182     m_arrangeInvalidatedEventSource.remove(token);
00183 }
00184
00185 #pragma endregion
00186
00187 #pragma region ILayoutProtected
00188
00189 void Layout::InvalidateMeasure()
00190 {
00191     m_measureInvalidatedEventSource(*this, nullptr);
00192 }
00193
00194 void Layout::InvalidateArrange()
00195 {
00196     m_arrangeInvalidatedEventSource(*this, nullptr);
00197 }
00198
00199 void Layout::SetIndexBasedLayoutOrientation(winrt::IndexBasedLayoutOrientation orientation)
00200 {
00201     m_indexBasedLayoutOrientation = orientation;
00202 }
00203
00204 #pragma endregion
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/InfoBar.idl Source File

  • InfoBar

InfoBar.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 enum InfoBarCloseReason
00007 {
00008     CloseButton = 0,
00009     Programmatic = 1
00010 };
00011
00012 [MUX_PUBLIC]
00013 [webhosthidden]
00014 enum InfoBarSeverity
00015 {
00016     Informational = 0,
00017     Success = 1,
00018     Warning = 2,
00019     Error = 3,
00020 };
00021
00022 [MUX_PUBLIC]
00023 [webhosthidden]
00024 unsealed runtimeclass InfoBarClosedEventArgs
00025 {
00026     InfoBarCloseReason Reason { get; };
00027 }
00028
00029 [MUX_PUBLIC]
00030 [webhosthidden]
00031 unsealed runtimeclass InfoBarClosingEventArgs
00032 {
00033     InfoBarCloseReason Reason { get; };
00034     Boolean Cancel { get; set; };
00035 }
00036
00037 [MUX_PUBLIC]
00038 [webhosthidden]
00039 unsealed runtimeclass InfoBarTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00040 {
00041     InfoBarTemplateSettings();
00042
00043     Microsoft.UI.Xaml.Controls.IconElement IconElement;
00044
00045     static Microsoft.UI.Xaml.DependencyProperty IconElementProperty{ get; };
00046 }
00047
00048 [MUX_PUBLIC]
00049 [webhosthidden]
00050 [contentproperty("Content")]
00051 unsealed runtimeclass InfoBar : Microsoft.UI.Xaml.Controls.Control
00052 {
00053     InfoBar();
00054
00055     [MUX_DEFAULT_VALUE("false")]
00056     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00057     Boolean IsOpen{ get; set; };
00058
00059     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00060     String Title{ get; set; };
00061
00062     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00063     String Message{ get; set; };
00064
00065     [MUX_DEFAULT_VALUE("winrt::InfoBarSeverity::Informational")]
00066     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00067     InfoBarSeverity Severity{ get; set; };
00068
00069     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00070     IconSource IconSource{ get; set; };
00071
00072     [MUX_DEFAULT_VALUE("true")]
00073     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00074     Boolean IsIconVisible{ get; set; };
00075
00076     [MUX_DEFAULT_VALUE("true")]
00077     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00078     Boolean IsClosable{ get; set; };
00079
00080     Microsoft.UI.Xaml.Style CloseButtonStyle{ get; set; };
00081     Microsoft.UI.Xaml.Input.ICommand CloseButtonCommand{ get; set; };
00082     Object CloseButtonCommandParameter{ get; set; };
00083
00084     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00085     Microsoft.UI.Xaml.Controls.Primitives.ButtonBase ActionButton{ get; set; };
00086
00087     Object Content{ get; set; };
00088     Microsoft.UI.Xaml.DataTemplate ContentTemplate{ get; set; };
00089
00090     InfoBarTemplateSettings TemplateSettings{ get; };
00091
00092     event Windows.Foundation.TypedEventHandler<InfoBar, Object> CloseButtonClick;
00093     event Windows.Foundation.TypedEventHandler<InfoBar, InfoBarClosingEventArgs> Closing;
00094     event Windows.Foundation.TypedEventHandler<InfoBar, InfoBarClosedEventArgs> Closed;
00095
00096     static Microsoft.UI.Xaml.DependencyProperty IsOpenProperty{ get; };
00097     static Microsoft.UI.Xaml.DependencyProperty TitleProperty{ get; };
00098     static Microsoft.UI.Xaml.DependencyProperty MessageProperty{ get; };
00099     static Microsoft.UI.Xaml.DependencyProperty SeverityProperty{ get; };
00100     static Microsoft.UI.Xaml.DependencyProperty IconSourceProperty{ get; };
00101     static Microsoft.UI.Xaml.DependencyProperty IsIconVisibleProperty{ get; };
00102     static Microsoft.UI.Xaml.DependencyProperty IsClosableProperty{ get; };
00103     static Microsoft.UI.Xaml.DependencyProperty CloseButtonStyleProperty{ get; };
00104     static Microsoft.UI.Xaml.DependencyProperty CloseButtonCommandProperty{ get; };
00105     static Microsoft.UI.Xaml.DependencyProperty CloseButtonCommandParameterProperty{ get; };
00106     static Microsoft.UI.Xaml.DependencyProperty ActionButtonProperty{ get; };
00107     static Microsoft.UI.Xaml.DependencyProperty ContentProperty{ get; };
00108     static Microsoft.UI.Xaml.DependencyProperty ContentTemplateProperty{ get; };
00109
00110     static Microsoft.UI.Xaml.DependencyProperty TemplateSettingsProperty{ get; };
00111 }
00112
00113 }
00114
00115 namespace MU_XCP_NAMESPACE
00116 {
00117
00118 [MUX_PUBLIC]
00119 [webhosthidden]
00120 unsealed runtimeclass InfoBarPanel : Microsoft.UI.Xaml.Controls.Panel
00121 {
00122     InfoBarPanel();
00123
00124     Microsoft.UI.Xaml.Thickness HorizontalOrientationPadding;
00125     static Microsoft.UI.Xaml.DependencyProperty HorizontalOrientationPaddingProperty{ get; };
00126
00127     Microsoft.UI.Xaml.Thickness VerticalOrientationPadding;
00128     static Microsoft.UI.Xaml.DependencyProperty VerticalOrientationPaddingProperty{ get; };
00129
00130     static void SetHorizontalOrientationMargin(Microsoft.UI.Xaml.DependencyObject object, Microsoft.UI.Xaml.Thickness value);
00131     static Microsoft.UI.Xaml.Thickness GetHorizontalOrientationMargin(Microsoft.UI.Xaml.DependencyObject object);
00132     static Microsoft.UI.Xaml.DependencyProperty HorizontalOrientationMarginProperty{ get; };
00133
00134     static void SetVerticalOrientationMargin(Microsoft.UI.Xaml.DependencyObject object, Microsoft.UI.Xaml.Thickness value);
00135     static Microsoft.UI.Xaml.Thickness GetVerticalOrientationMargin(Microsoft.UI.Xaml.DependencyObject object);
00136     static Microsoft.UI.Xaml.DependencyProperty VerticalOrientationMarginProperty{ get; };
00137 }
00138
00139 }
00140
00141
00142 namespace MU_XAP_NAMESPACE
00143 {
00144
00145 [MUX_PUBLIC]
00146 [webhosthidden]
00147 unsealed runtimeclass InfoBarAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer
00148 {
00149     InfoBarAutomationPeer(MU_XC_NAMESPACE.InfoBar owner);
00150 }
00151
00152 }
00153
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/Layout.properties.cpp Source File

  • Generated

Layout.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "Layout.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(Layout)
00012 }
00013
00014 #include "Layout.g.cpp"
00015
00016
00017 LayoutProperties::LayoutProperties()
00018     : m_arrangeInvalidatedEventSource{static_cast<Layout*>(this)}
00019     , m_measureInvalidatedEventSource{static_cast<Layout*>(this)}
00020 {
00021 }
00022
00023 void LayoutProperties::EnsureProperties()
00024 {
00025 }
00026
00027 void LayoutProperties::ClearProperties()
00028 {
00029 }
00030
00031 winrt::event_token LayoutProperties::ArrangeInvalidated(winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable> const& value)
00032 {
00033     return m_arrangeInvalidatedEventSource.add(value);
00034 }
00035
00036 void LayoutProperties::ArrangeInvalidated(winrt::event_token const& token)
00037 {
00038     m_arrangeInvalidatedEventSource.remove(token);
00039 }
00040
00041 winrt::event_token LayoutProperties::MeasureInvalidated(winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable> const& value)
00042 {
00043     return m_measureInvalidatedEventSource.add(value);
00044 }
00045
00046 void LayoutProperties::MeasureInvalidated(winrt::event_token const& token)
00047 {
00048     m_measureInvalidatedEventSource.remove(token);
00049 }
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/MicaBackdrop.properties.cpp Source File

  • Generated

MicaBackdrop.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "MicaBackdrop.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Media
00010 {
00011     CppWinRTActivatableClassWithDPFactory(MicaBackdrop)
00012 }
00013
00014 #include "MicaBackdrop.g.cpp"
00015
00016 GlobalDependencyProperty MicaBackdropProperties::s_KindProperty{ nullptr };
00017
00018 MicaBackdropProperties::MicaBackdropProperties()
00019 {
00020     EnsureProperties();
00021 }
00022
00023 void MicaBackdropProperties::EnsureProperties()
00024 {
00025     if (!s_KindProperty)
00026     {
00027         s_KindProperty =
00028             InitializeDependencyProperty(
00029                 L"Kind",
00030                 winrt::name_of<winrt::MicaKind>(),
00031                 winrt::name_of<winrt::MicaBackdrop>(),
00032                 false /* isAttached */,
00033                 ValueHelper<winrt::MicaKind>::BoxedDefaultValue(),
00034                 winrt::PropertyChangedCallback(&OnKindPropertyChanged));
00035     }
00036 }
00037
00038 void MicaBackdropProperties::ClearProperties()
00039 {
00040     s_KindProperty = nullptr;
00041 }
00042
00043 void MicaBackdropProperties::OnKindPropertyChanged(
00044     winrt::DependencyObject const& sender,
00045     winrt::DependencyPropertyChangedEventArgs const& args)
00046 {
00047     auto owner = sender.as<winrt::MicaBackdrop>();
00048     winrt::get_self<MicaBackdrop>(owner)->OnPropertyChanged(args);
00049 }
00050
00051 void MicaBackdropProperties::Kind(winrt::MicaKind const& value)
00052 {
00053     [[gsl::suppress(con)]]
00054     {
00055     static_cast<MicaBackdrop*>(this)->SetValue(s_KindProperty, ValueHelper<winrt::MicaKind>::BoxValueIfNecessary(value));
00056     }
00057 }
00058
00059 winrt::MicaKind MicaBackdropProperties::Kind()
00060 {
00061     return ValueHelper<winrt::MicaKind>::CastOrUnbox(static_cast<MicaBackdrop*>(this)->GetValue(s_KindProperty));
00062 }
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/AnimationSamples/DefaultElementAnimator.cs Source File

  • Repeater
  • TestUI
  • Samples
  • AnimationSamples

DefaultElementAnimator.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Numerics;
00006 using Windows.Foundation;
00007 using Microsoft.UI.Composition;
00008 using Microsoft.UI.Xaml;
00009 using Microsoft.UI.Xaml.Controls;
00010 using Microsoft.UI.Xaml.Hosting;
00011 using System.Collections.Generic;
00012 using System.Xml.Linq;
00013 using System.Linq;
00014
00015 namespace MUXControlsTestApp.Utils
00016 {
00017     // TODO: port to native.
00018     public class DefaultItemCollectionTransitionProvider : ItemCollectionTransitionProvider
00019     {
00020         private const double DefaultAnimationDurationInMs = 300.0;
00021         public static double AnimationSlowdownFactor { get; set; }
00022
00023         static DefaultItemCollectionTransitionProvider()
00024         {
00025             AnimationSlowdownFactor = 1.0;
00026         }
00027
00028         protected override bool ShouldAnimateCore(ItemCollectionTransition transition)
00029         {
00030             return true;
00031         }
00032
00033         protected override void StartTransitions(IList<ItemCollectionTransition> transitions)
00034         {
00035             var addTransitions = transitions.Where(transition => transition.Operation == ItemCollectionTransitionOperation.Add).ToList();
00036             var removeTransitions = transitions.Where(transition => transition.Operation == ItemCollectionTransitionOperation.Remove).ToList();
00037             var moveTransitions = transitions.Where(transition => transition.Operation == ItemCollectionTransitionOperation.Move).ToList();
00038
00039             StartAddTransitions(addTransitions, removeTransitions.Count > 0, moveTransitions.Count > 0);
00040             StartRemoveTransitions(removeTransitions);
00041             StartMoveTransitions(moveTransitions, removeTransitions.Count > 0);
00042         }
00043
00044         private static void StartAddTransitions(IList<ItemCollectionTransition> transitions, bool hasRemoveTransitions, bool hasMoveTransitions)
00045         {
00046             foreach (var transition in transitions)
00047             {
00048                 var progress = transition.Start();
00049                 var visual = ElementCompositionPreview.GetElementVisual(progress.Element);
00050                 var compositor = visual.Compositor;
00051
00052                 var fadeInAnimation = compositor.CreateScalarKeyFrameAnimation();
00053                 fadeInAnimation.InsertKeyFrame(0.0f, 0.0f);
00054
00055                 if (hasMoveTransitions && hasRemoveTransitions)
00056                 {
00057                     fadeInAnimation.InsertKeyFrame(0.66f, 0.0f);
00058                 }
00059                 else if (hasMoveTransitions || hasRemoveTransitions)
00060                 {
00061                     fadeInAnimation.InsertKeyFrame(0.5f, 0.0f);
00062                 }
00063
00064                 fadeInAnimation.InsertKeyFrame(1.0f, 1.0f);
00065                 fadeInAnimation.Duration = TimeSpan.FromMilliseconds(
00066                     DefaultAnimationDurationInMs * ((hasRemoveTransitions ? 1 : 0) + (hasMoveTransitions ? 1 : 0) + 1) * AnimationSlowdownFactor);
00067
00068                 var batch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
00069                 visual.StartAnimation("Opacity", fadeInAnimation);
00070                 batch.End();
00071                 batch.Completed += delegate { progress.Complete(); };
00072             }
00073         }
00074
00075         private static void StartRemoveTransitions(IList<ItemCollectionTransition> transitions)
00076         {
00077             foreach (var transition in transitions)
00078             {
00079                 var progress = transition.Start();
00080                 var visual = ElementCompositionPreview.GetElementVisual(progress.Element);
00081                 var compositor = visual.Compositor;
00082
00083                 var fadeOutAnimation = compositor.CreateScalarKeyFrameAnimation();
00084                 fadeOutAnimation.InsertExpressionKeyFrame(0.0f, "this.CurrentValue");
00085                 fadeOutAnimation.InsertKeyFrame(1.0f, 0.0f);
00086                 fadeOutAnimation.Duration = TimeSpan.FromMilliseconds(DefaultAnimationDurationInMs * AnimationSlowdownFactor);
00087
00088                 var batch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
00089                 visual.StartAnimation("Opacity", fadeOutAnimation);
00090                 batch.End();
00091                 batch.Completed += delegate {
00092                     visual.Opacity = 1.0f;
00093                     progress.Complete();
00094                 };
00095             }
00096         }
00097
00098         private static void StartMoveTransitions(IList<ItemCollectionTransition> transitions, bool hasRemoveAnimations)
00099         {
00100             foreach (var transition in transitions)
00101             {
00102                 var progress = transition.Start();
00103                 var visual = ElementCompositionPreview.GetElementVisual(progress.Element);
00104                 var compositor = visual.Compositor;
00105                 var batch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
00106
00107                 // Animate offset.
00108                 if (transition.OldBounds.X != transition.NewBounds.X ||
00109                     transition.OldBounds.Y != transition.NewBounds.Y)
00110                 {
00111                     AnimateOffset(visual, compositor, transition.OldBounds, transition.NewBounds, hasRemoveAnimations);
00112                 }
00113
00114                 batch.End();
00115                 batch.Completed += delegate { progress.Complete(); };
00116             }
00117         }
00118
00119         private static void AnimateOffset(Visual visual, Compositor compositor, Rect oldBounds, Rect newBounds, bool hasRemoveAnimations)
00120         {
00121             var offsetAnimation = compositor.CreateVector2KeyFrameAnimation();
00122
00123             offsetAnimation.SetVector2Parameter("delta", new Vector2(
00124                 (float)(oldBounds.X - newBounds.X),
00125                 (float)(oldBounds.Y - newBounds.Y)));
00126             offsetAnimation.SetVector2Parameter("final", new Vector2());
00127             offsetAnimation.InsertExpressionKeyFrame(0.0f, "this.CurrentValue + delta");
00128             if (hasRemoveAnimations)
00129             {
00130                 offsetAnimation.InsertExpressionKeyFrame(0.5f, "delta");
00131             }
00132             offsetAnimation.InsertExpressionKeyFrame(1.0f, "final");
00133             offsetAnimation.Duration = TimeSpan.FromMilliseconds(
00134                 DefaultAnimationDurationInMs * ((hasRemoveAnimations ? 1 : 0) + 1) * AnimationSlowdownFactor);
00135
00136             visual.StartAnimation("TransformMatrix._41_42", offsetAnimation);
00137         }
00138     }
00139 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ImageIcon/TestUI/ImageIconPage.xaml.cs Source File

  • ImageIcon
  • TestUI

ImageIconPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Markup;
00010 using Windows.UI;
00011 using System.Windows.Input;
00012
00013 using ImageIcon = Microsoft.UI.Xaml.Controls.ImageIcon;
00014 using Microsoft.UI.Xaml.Media.Imaging;
00015
00016 namespace MUXControlsTestApp
00017 {
00018     [TopLevelTestPage(Name = "ImageIcon")]
00019     public sealed partial class ImageIconPage : TestPage
00020     {
00021         public ImageIconPage()
00022         {
00023             this.InitializeComponent();
00024         }
00025
00026         private void ToggleButton_Checked(object sender, RoutedEventArgs e)
00027         {
00028             this.ImageIcon.Source = new SvgImageSource(new Uri("ms-appx:///Assets/libre-camera-panorama.svg"));
00029         }
00030         private void ToggleButton_Unchecked(object sender, RoutedEventArgs e)
00031         {
00032             BitmapImage bitmapImage = new BitmapImage();
00033             Uri uri = new Uri("ms-appx:///Assets/ingredient2.png");
00034             bitmapImage.UriSource = uri;
00035
00036             this.ImageIcon.Source = bitmapImage;
00037         }
00038     }
00039 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemsRepeaterElementIndexChangedEventArgs.h Source File

  • Repeater

ItemsRepeaterElementIndexChangedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ItemsRepeaterElementIndexChangedEventArgs.g.h"
00007
00008 class ItemsRepeaterElementIndexChangedEventArgs :
00009     public ReferenceTracker<ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing>
00010 {
00011 public:
00012     ItemsRepeaterElementIndexChangedEventArgs(
00013         const winrt::UIElement& element,
00014         int oldIndex,
00015         int newIndex);
00016
00017 #pragma region IElementPreparedEventArgs
00018     winrt::UIElement Element();
00019     int32_t OldIndex();
00020     int32_t NewIndex();
00021 #pragma endregion
00022
00023     void Update(const winrt::UIElement& element, int oldIndex, int newIndex);
00024
00025 private:
00026     tracker_ref<winrt::UIElement> m_element{ this };
00027     int m_oldIndex;
00028     int m_newIndex;
00029 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PipsPager/PipsPagerTemplateSettings.cpp Source File

  • PipsPager

PipsPagerTemplateSettings.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "PipsPagerTemplateSettings.h"
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterTestHooksHelper Member List

This is the complete list of members for ScrollPresenterTestHooksHelper, including all inherited members.
Dispose() | ScrollPresenterTestHooksHelper | [inline]
GetExpressionAnimationStatusChanges(ScrollPresenter scrollPresenter) | ScrollPresenterTestHooksHelper | [inline]
GetInteractionSources(ScrollPresenter scrollPresenter) | ScrollPresenterTestHooksHelper | [inline]
LogExpressionAnimationStatusChanges(List< ExpressionAnimationStatusChange > expressionAnimationStatusChanges) | ScrollPresenterTestHooksHelper | [inline, static]
LogInteractionSources(CompositionInteractionSourceCollection interactionSources) | ScrollPresenterTestHooksHelper | [inline, static]
m_expressionAnimationStatusChanges | ScrollPresenterTestHooksHelper | [private]
m_interactionSources | ScrollPresenterTestHooksHelper | [private]
ResetExpressionAnimationStatusChanges(ScrollPresenter scrollPresenter) | ScrollPresenterTestHooksHelper | [inline]
ResetIsAnimationsEnabledOverride() | ScrollPresenterTestHooksHelper | [inline]
ScrollPresenterTestHooks_AnchorEvaluated(ScrollPresenter sender, ScrollPresenterTestHooksAnchorEvaluatedEventArgs args) | ScrollPresenterTestHooksHelper | [inline, private]
ScrollPresenterTestHooks_ExpressionAnimationStatusChanged(ScrollPresenter sender, ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs args) | ScrollPresenterTestHooksHelper | [inline, private]
ScrollPresenterTestHooks_InteractionSourcesChanged(ScrollPresenter sender, ScrollPresenterTestHooksInteractionSourcesChangedEventArgs args) | ScrollPresenterTestHooksHelper | [inline, private]
ScrollPresenterTestHooksHelper(bool enableAnchorNotifications=true, bool enableInteractionSourcesNotifications=true, bool enableExpressionAnimationStatusNotifications=true, bool?isAnimationsEnabledOverride=null) | ScrollPresenterTestHooksHelper | [inline]
SetIsAnimationsEnabledOverride(bool isAnimationsEnabledOverride) | ScrollPresenterTestHooksHelper | [inline]
TurnOffAnchorNotifications() | ScrollPresenterTestHooksHelper | [inline]
TurnOffExpressionAnimationStatusNotifications() | ScrollPresenterTestHooksHelper | [inline]
TurnOffInteractionSourcesNotifications() | ScrollPresenterTestHooksHelper | [inline]
TurnOnAnchorNotifications() | ScrollPresenterTestHooksHelper | [inline]
TurnOnExpressionAnimationStatusNotifications() | ScrollPresenterTestHooksHelper | [inline]
TurnOnInteractionSourcesNotifications() | ScrollPresenterTestHooksHelper | [inline]
Generated on Sun Dec 1 2024 20:54:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/ItemsViewAutomationPeer.h Source File

  • ItemsView

ItemsViewAutomationPeer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ItemsView.h"
00007 #include "ItemsViewAutomationPeer.g.h"
00008
00009 class ItemsViewAutomationPeer :
00010     public ReferenceTracker<ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT>
00011 {
00012
00013 public:
00014     ItemsViewAutomationPeer(winrt::ItemsView const& owner);
00015
00016     // IAutomationPeerOverrides
00017     winrt::IInspectable GetPatternCore(winrt::PatternInterface const& patternInterface);
00018     hstring GetClassNameCore();
00019     winrt::AutomationControlType GetAutomationControlTypeCore();
00020
00021     // ISelectionProvider
00022     bool CanSelectMultiple();
00023     bool IsSelectionRequired() { return false; };
00024     winrt::com_array<winrt::IRawElementProviderSimple> GetSelection();
00025
00026     void RaiseSelectionChanged(double oldIndex, double newIndex);
00027
00028 private:
00029     com_ptr<ItemsView> GetImpl();
00030 };
00031
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemContainer/ItemContainerAutomationPeer.cpp Source File

  • ItemContainer

ItemContainerAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "ItemContainer.h"
00008 #include "ItemContainerAutomationPeer.h"
00009 #include "ItemContainerAutomationPeer.properties.cpp"
00010 #include "../ResourceHelper/ResourceAccessor.h"
00011
00012 ItemContainerAutomationPeer::ItemContainerAutomationPeer(winrt::FrameworkElement const& owner)
00013     : ReferenceTracker(owner)
00014 {
00015 }
00016
00017 // IAutomationPeerOverrides
00018 winrt::hstring ItemContainerAutomationPeer::GetNameCore()
00019 {
00020     winrt::hstring returnHString = __super::GetNameCore();
00021
00022     // If a name hasn't been provided by AutomationProperties.Name in markup:
00023     if (returnHString.empty())
00024     {
00025         if (auto itemContainer = Owner().try_as<winrt::ItemContainer>())
00026         {
00027             returnHString = SharedHelpers::TryGetStringRepresentationFromObject(itemContainer.Child());
00028         }
00029     }
00030
00031     if (returnHString.empty())
00032     {
00033         returnHString = ResourceAccessor::GetLocalizedStringResource(SR_ItemContainerDefaultControlName);
00034     }
00035
00036     return returnHString;
00037 }
00038
00039 winrt::IInspectable ItemContainerAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00040 {
00041     if (auto itemContainer = Owner().try_as<winrt::ItemContainer>())
00042     {
00043         if (patternInterface == winrt::PatternInterface::SelectionItem)
00044         {
00045 #ifdef MUX_PRERELEASE
00046             const bool canUserSelect = static_cast<int>(itemContainer.CanUserSelect() & (winrt::ItemContainerUserSelectMode::Auto | winrt::ItemContainerUserSelectMode::UserCanSelect));
00047 #else
00048             const bool canUserSelect = static_cast<int>(GetImpl()->CanUserSelectInternal() & (winrt::ItemContainerUserSelectMode::Auto | winrt::ItemContainerUserSelectMode::UserCanSelect));
00049 #endif
00050
00051             if (canUserSelect)
00052             {
00053                 return *this;
00054             }
00055
00056         }
00057         else if (patternInterface == winrt::PatternInterface::Invoke)
00058         {
00059 #ifdef MUX_PRERELEASE
00060             const bool canUserInvoke = static_cast<int>(itemContainer.CanUserInvoke() & winrt::ItemContainerUserInvokeMode::UserCanInvoke);
00061 #else
00062             const bool canUserInvoke = static_cast<int>(GetImpl()->CanUserInvokeInternal() & winrt::ItemContainerUserInvokeMode::UserCanInvoke);
00063 #endif
00064
00065             if (canUserInvoke)
00066             {
00067                 return *this;
00068             }
00069         }
00070     }
00071
00072     return __super::GetPatternCore(patternInterface);
00073 }
00074
00075 winrt::AutomationControlType ItemContainerAutomationPeer::GetAutomationControlTypeCore()
00076 {
00077     return winrt::AutomationControlType::ListItem;
00078 }
00079
00080 winrt::hstring ItemContainerAutomationPeer::GetLocalizedControlTypeCore()
00081 {
00082     return ResourceAccessor::GetLocalizedStringResource(SR_ItemContainerDefaultControlName);
00083 }
00084
00085 winrt::hstring ItemContainerAutomationPeer::GetClassNameCore()
00086 {
00087     return winrt::hstring_name_of<winrt::ItemContainer>();
00088 }
00089
00090 // IInvokeProvider
00091 void ItemContainerAutomationPeer::Invoke()
00092 {
00093     if (auto itemContainer = GetImpl())
00094     {
00095 #ifdef MUX_PRERELEASE
00096         const bool canUserInvoke = static_cast<int>(itemContainer->CanUserInvoke() & winrt::ItemContainerUserInvokeMode::UserCanInvoke);
00097 #else
00098         const bool canUserInvoke = static_cast<int>(itemContainer->CanUserInvokeInternal() & winrt::ItemContainerUserInvokeMode::UserCanInvoke);
00099 #endif
00100
00101         if (canUserInvoke)
00102         {
00103             itemContainer->RaiseItemInvoked(winrt::ItemContainerInteractionTrigger::AutomationInvoke, nullptr);
00104         }
00105     }
00106 }
00107
00108 //ISelectionItemProvider
00109 bool ItemContainerAutomationPeer::IsSelected()
00110 {
00111     if (auto itemContainer = GetImpl())
00112     {
00113         return itemContainer->IsSelected();
00114     }
00115     return false;
00116 }
00117
00118 winrt::IRawElementProviderSimple ItemContainerAutomationPeer::SelectionContainer()
00119 {
00120     if (auto itemContainer = GetImpl())
00121     {
00122         auto const selectionContainer = [itemContainer]()
00123         {
00124             auto parent = winrt::VisualTreeHelper::GetParent(*itemContainer);
00125
00126             while (parent)
00127             {
00128                 if (auto const parentAsUIElement = parent.try_as<winrt::UIElement>())
00129                 {
00130                     if (auto const peer = winrt::FrameworkElementAutomationPeer::CreatePeerForElement(parentAsUIElement))
00131                     {
00132                         if (auto const selectionProvider = peer.try_as<winrt::ISelectionProvider>())
00133                         {
00134                             return parentAsUIElement;
00135                         }
00136                     }
00137                 }
00138
00139                 parent = winrt::VisualTreeHelper::GetParent(parent);
00140             }
00141
00142             return parent.try_as<winrt::UIElement>();
00143         }();
00144
00145         if (selectionContainer)
00146         {
00147             if (auto const peer = winrt::FrameworkElementAutomationPeer::CreatePeerForElement(selectionContainer))
00148             {
00149                 return ProviderFromPeer(peer);
00150             }
00151         }
00152     }
00153
00154     return nullptr;
00155 }
00156
00157 void ItemContainerAutomationPeer::AddToSelection()
00158 {
00159     UpdateSelection(true);
00160 }
00161
00162 void ItemContainerAutomationPeer::RemoveFromSelection()
00163 {
00164     UpdateSelection(false);
00165 }
00166
00167 void ItemContainerAutomationPeer::Select()
00168 {
00169     UpdateSelection(true);
00170 }
00171
00172 com_ptr<ItemContainer> ItemContainerAutomationPeer::GetImpl()
00173 {
00174     com_ptr<ItemContainer> impl = nullptr;
00175
00176     if (auto itemContainer = Owner().try_as<winrt::ItemContainer>())
00177     {
00178         impl = winrt::get_self<ItemContainer>(itemContainer)->get_strong();
00179     }
00180
00181     return impl;
00182 }
00183
00184 void ItemContainerAutomationPeer::UpdateSelection(bool isSelected)
00185 {
00186     if (auto itemContainer = GetImpl())
00187     {
00188         if (isSelected)
00189         {
00190 #ifdef MUX_PRERELEASE
00191             const bool canUserSelect = static_cast<int>(itemContainer->CanUserSelect() & (winrt::ItemContainerUserSelectMode::Auto | winrt::ItemContainerUserSelectMode::UserCanSelect));
00192 #else
00193             const bool canUserSelect = static_cast<int>(itemContainer->CanUserSelectInternal() & (winrt::ItemContainerUserSelectMode::Auto | winrt::ItemContainerUserSelectMode::UserCanSelect));
00194 #endif
00195
00196             if (canUserSelect)
00197             {
00198                 itemContainer->IsSelected(true);
00199             }
00200         }
00201         else
00202         {
00203             itemContainer->IsSelected(false);
00204         }
00205     }
00206 }
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PagerControl/TestUI/PagerControlPage.xaml.cs Source File

  • PagerControl
  • TestUI

PagerControlPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Controls;
00006 using Microsoft.UI.Xaml.Media;
00007
00008 using System.Collections.ObjectModel;
00009 using Microsoft.UI.Xaml.Controls;
00010 using System.Collections.Specialized;
00011
00012 namespace MUXControlsTestApp
00013 {
00014     [TopLevelTestPage(Name = "PagerControl")]
00015     public sealed partial class PagerControlPage : TestPage
00016     {
00017         ComboBox pagerComboBox;
00018         NumberBox pagerNumberBox;
00019         ItemsRepeater pagerItemsRepeater;
00020
00021         Button firstPageButton;
00022         Button previousPageButton;
00023         Button nextPageButton;
00024         Button lastPageButton;
00025
00026         public PagerControlPage()
00027         {
00028             this.InitializeComponent();
00029             this.Loaded += OnLoad;
00030         }
00031
00032         private void OnLoad(object sender, RoutedEventArgs args)
00033         {
00034             PagerDisplayModeComboBox.SelectionChanged += OnDisplayModeChanged;
00035             FirstPageButtonVisibilityComboBox.SelectionChanged += OnFirstButtonVisibilityChanged;
00036             PreviousPageButtonVisibilityComboBox.SelectionChanged += OnPreviousButtonVisibilityChanged;
00037             NextPageButtonVisibilityComboBox.SelectionChanged += OnNextButtonVisibilityChanged;
00038             LastPageButtonVisibilityComboBox.SelectionChanged += OnLastButtonVisibilityChanged;
00039
00040             var rootGrid = VisualTreeHelper.GetChild(TestPager, 0);
00041             var backButtonsPanel = VisualTreeHelper.GetChild(rootGrid, 0);
00042             firstPageButton = VisualTreeHelper.GetChild(backButtonsPanel, 0) as Button;
00043             previousPageButton = VisualTreeHelper.GetChild(backButtonsPanel, 1) as Button;
00044
00045             var boxPanels = VisualTreeHelper.GetChild(rootGrid, 1);
00046             pagerNumberBox = VisualTreeHelper.GetChild(boxPanels, 1) as NumberBox;
00047             pagerComboBox = VisualTreeHelper.GetChild(boxPanels, 2) as ComboBox;
00048             pagerItemsRepeater = VisualTreeHelper.GetChild(rootGrid, 2) as ItemsRepeater;
00049
00050             var forwardButtonsPanel = VisualTreeHelper.GetChild(rootGrid, 4);
00051             nextPageButton = VisualTreeHelper.GetChild(forwardButtonsPanel, 0) as Button;
00052             lastPageButton = VisualTreeHelper.GetChild(forwardButtonsPanel, 1) as Button;
00053
00054             NumberBoxVisibilityCheckBox.IsChecked = pagerNumberBox.Visibility == Visibility.Visible;
00055             ComboBoxVisibilityCheckBox.IsChecked = pagerComboBox.Visibility == Visibility.Visible;
00056             NumberPanelVisibilityCheckBox.IsChecked = pagerItemsRepeater.Visibility == Visibility.Visible;
00057             NumberBoxIsEnabledCheckBox.IsChecked = pagerNumberBox.IsEnabled;
00058             ComboBoxIsEnabledCheckBox.IsChecked = pagerComboBox.IsEnabled;
00059
00060             FirstPageButtonVisibilityCheckBox.IsChecked = firstPageButton?.Visibility == Visibility.Visible && firstPageButton?.Opacity != 0;
00061             PreviousPageButtonVisibilityCheckBox.IsChecked = previousPageButton?.Visibility == Visibility.Visible && previousPageButton?.Opacity != 0;
00062             NextPageButtonVisibilityCheckBox.IsChecked = nextPageButton?.Visibility == Visibility.Visible && nextPageButton?.Opacity != 0;
00063             LastPageButtonVisibilityCheckBox.IsChecked = lastPageButton?.Visibility == Visibility.Visible && lastPageButton?.Opacity != 0;
00064
00065             FirstPageButtonIsEnabledCheckBox.IsChecked = firstPageButton?.IsEnabled;
00066             PreviousPageButtonIsEnabledCheckBox.IsChecked = previousPageButton?.IsEnabled;
00067             NextPageButtonIsEnabledCheckBox.IsChecked = nextPageButton?.IsEnabled;
00068             LastPageButtonIsEnabledCheckBox.IsChecked = lastPageButton?.IsEnabled;
00069             UpdateNumberPanelContentTextBlock(this, null);
00070         }
00071
00072         private void UpdateNumberPanelContentTextBlock(object sender, NotifyCollectionChangedEventArgs args)
00073         {
00074             NumberPanelContentTextBlock.Text = "";
00075             foreach (var item in TestPager.TemplateSettings.NumberPanelItems)
00076             {
00077                 if (item.GetType() == typeof(SymbolIcon))
00078                 {
00079                     NumberPanelContentTextBlock.Text += (item as SymbolIcon).Symbol;
00080                 }
00081                 else if (item.GetType() == typeof(Button))
00082                 {
00083                     NumberPanelContentTextBlock.Text += (item as Button).Content;
00084                 }
00085             }
00086         }
00087
00088         private void NumberOfPagesSetterButtonClicked(object sender, RoutedEventArgs args)
00089         {
00090             if (TestPager.NumberOfPages == 5)
00091             {
00092                 TestPager.NumberOfPages = 100;
00093                 NumberOfPagesSetterButton.Content = "Set NumberOfPages to 5";
00094             }
00095             else
00096             {
00097                 TestPager.NumberOfPages = 5;
00098                 NumberOfPagesSetterButton.Content = "Set NumberOfPages to 100";
00099             }
00100
00101             NumberBoxVisibilityCheckBox.IsChecked = pagerNumberBox?.Visibility == Visibility.Visible;
00102             ComboBoxVisibilityCheckBox.IsChecked = pagerComboBox?.Visibility == Visibility.Visible;
00103             NumberPanelVisibilityCheckBox.IsChecked = pagerItemsRepeater?.Visibility == Visibility.Visible;
00104             NumberBoxIsEnabledCheckBox.IsChecked = pagerNumberBox?.IsEnabled;
00105             ComboBoxIsEnabledCheckBox.IsChecked = pagerComboBox?.IsEnabled;
00106         }
00107
00108         private void NumberOfPagesInfinityButtonClicked(object sender, RoutedEventArgs args)
00109         {
00110             TestPager.NumberOfPages = -1;
00111
00112             NumberBoxVisibilityCheckBox.IsChecked = pagerNumberBox?.Visibility == Visibility.Visible;
00113             ComboBoxVisibilityCheckBox.IsChecked = pagerComboBox?.Visibility == Visibility.Visible;
00114             NumberPanelVisibilityCheckBox.IsChecked = pagerItemsRepeater?.Visibility == Visibility.Visible;
00115             NumberBoxIsEnabledCheckBox.IsChecked = pagerNumberBox?.IsEnabled;
00116             ComboBoxIsEnabledCheckBox.IsChecked = pagerComboBox?.IsEnabled;
00117         }
00118
00119         private void IncreaseNumberOfPagesButtonClicked(object sender, RoutedEventArgs args)
00120         {
00121             TestPager.NumberOfPages += 1;
00122
00123             NumberBoxVisibilityCheckBox.IsChecked = pagerNumberBox?.Visibility == Visibility.Visible;
00124             ComboBoxVisibilityCheckBox.IsChecked = pagerComboBox?.Visibility == Visibility.Visible;
00125             NumberPanelVisibilityCheckBox.IsChecked = pagerItemsRepeater?.Visibility == Visibility.Visible;
00126             NumberBoxIsEnabledCheckBox.IsChecked = pagerNumberBox?.IsEnabled;
00127             ComboBoxIsEnabledCheckBox.IsChecked = pagerComboBox?.IsEnabled;
00128         }
00129
00130         private void CheckIfButtonsHiddenButtonClicked(object sender, RoutedEventArgs args)
00131         {
00132             var rootGrid = VisualTreeHelper.GetChild(TemplateButtonVisibilitySetPager, 0);
00133             var backButtonsPanel = VisualTreeHelper.GetChild(rootGrid, 0);
00134             var firstPageButtonTemplatePager = VisualTreeHelper.GetChild(backButtonsPanel, 0) as Button;
00135             var previousPageButtonTemplatePager = VisualTreeHelper.GetChild(backButtonsPanel, 1) as Button;
00136
00137             var forwardButtonsPanel = VisualTreeHelper.GetChild(rootGrid, 4);
00138             var nextPageButtonTemplatePager = VisualTreeHelper.GetChild(forwardButtonsPanel, 0) as Button;
00139             var lastPageButtonTemplatePager = VisualTreeHelper.GetChild(forwardButtonsPanel, 1) as Button;
00140
00141             int violationCount = 0;
00142             violationCount += (firstPageButtonTemplatePager?.Visibility == Visibility.Collapsed || firstPageButton?.Opacity == 0) ? 0 : 1;
00143             violationCount += (previousPageButtonTemplatePager?.Visibility == Visibility.Collapsed || previousPageButton?.Opacity == 0) ? 0 : 1;
00144             violationCount += (nextPageButtonTemplatePager?.Visibility == Visibility.Collapsed || nextPageButton?.Opacity == 0) ? 0 : 1;
00145             violationCount += (lastPageButtonTemplatePager?.Visibility == Visibility.Collapsed || lastPageButton?.Opacity == 0) ? 0 : 1;
00146
00147             CheckIfButtonsHiddenLabel.Text = violationCount == 0 ? "Passed" : "Failed";
00148         }
00149
00150         private void OnSelectedIndexChanged(PagerControl sender, PagerControlSelectedIndexChangedEventArgs args)
00151         {
00152             UpdateNumberPanelContentTextBlock(this, null);
00153             PreviousPageTextBlock.Text = args.PreviousPageIndex.ToString();
00154             CurrentPageTextBlock.Text = args.NewPageIndex.ToString();
00155
00156             FirstPageButtonVisibilityCheckBox.IsChecked = firstPageButton?.Visibility == Visibility.Visible && firstPageButton?.Opacity != 0;
00157             PreviousPageButtonVisibilityCheckBox.IsChecked = previousPageButton?.Visibility == Visibility.Visible && previousPageButton?.Opacity != 0;
00158             NextPageButtonVisibilityCheckBox.IsChecked = nextPageButton?.Visibility == Visibility.Visible && nextPageButton?.Opacity != 0;
00159             LastPageButtonVisibilityCheckBox.IsChecked = lastPageButton?.Visibility == Visibility.Visible && lastPageButton?.Opacity != 0;
00160
00161             FirstPageButtonIsEnabledCheckBox.IsChecked = firstPageButton?.IsEnabled;
00162             PreviousPageButtonIsEnabledCheckBox.IsChecked = previousPageButton?.IsEnabled;
00163             NextPageButtonIsEnabledCheckBox.IsChecked = nextPageButton?.IsEnabled;
00164             LastPageButtonIsEnabledCheckBox.IsChecked = lastPageButton?.IsEnabled;
00165         }
00166
00167         private void OnDisplayModeChanged(object sender, SelectionChangedEventArgs e)
00168         {
00169             var item = PagerDisplayModeComboBox.SelectedItem;
00170
00171             if (item == this.AutoDisplayModeItem)
00172             {
00173                 TestPager.DisplayMode = PagerControlDisplayMode.Auto;
00174                 CustomizedPager.DisplayMode = PagerControlDisplayMode.Auto;
00175             }
00176             else if (item == this.NumberBoxDisplayModeItem)
00177             {
00178                 TestPager.DisplayMode = PagerControlDisplayMode.NumberBox;
00179                 CustomizedPager.DisplayMode = PagerControlDisplayMode.NumberBox;
00180             }
00181             else if (item == this.ComboBoxDisplayModeItem)
00182             {
00183                 TestPager.DisplayMode = PagerControlDisplayMode.ComboBox;
00184                 CustomizedPager.DisplayMode = PagerControlDisplayMode.ComboBox;
00185             }
00186             else if (item == this.NumberPanelDisplayModeItem)
00187             {
00188                 TestPager.DisplayMode = PagerControlDisplayMode.ButtonPanel;
00189                 CustomizedPager.DisplayMode = PagerControlDisplayMode.ButtonPanel;
00190             }
00191
00192             NumberBoxVisibilityCheckBox.IsChecked = pagerNumberBox?.Visibility == Visibility.Visible;
00193             ComboBoxVisibilityCheckBox.IsChecked = pagerComboBox?.Visibility == Visibility.Visible;
00194             NumberPanelVisibilityCheckBox.IsChecked = pagerItemsRepeater?.Visibility == Visibility.Visible;
00195             NumberBoxIsEnabledCheckBox.IsChecked = pagerNumberBox?.IsEnabled;
00196             ComboBoxIsEnabledCheckBox.IsChecked = pagerComboBox?.IsEnabled;
00197         }
00198
00199         private void OnFirstButtonVisibilityChanged(object sender, SelectionChangedEventArgs e)
00200         {
00201             var item = FirstPageButtonVisibilityComboBox.SelectedItem;
00202
00203             if (item == this.NoneFirstPageButtonVisibilityItem)
00204             {
00205                 TestPager.FirstButtonVisibility = PagerControlButtonVisibility.Hidden;
00206             }
00207             else if (item == this.AlwaysVisibleFirstPageButtonVisibilityItem)
00208             {
00209                 TestPager.FirstButtonVisibility = PagerControlButtonVisibility.Visible;
00210             }
00211             else if (item == this.HiddenOnEdgeFirstPageButtonVisibilityItem)
00212             {
00213                 TestPager.FirstButtonVisibility = PagerControlButtonVisibility.HiddenOnEdge;
00214             }
00215
00216             FirstPageButtonVisibilityCheckBox.IsChecked = firstPageButton?.Visibility == Visibility.Visible && firstPageButton?.Opacity != 0;
00217         }
00218
00219         private void OnPreviousButtonVisibilityChanged(object sender, SelectionChangedEventArgs e)
00220         {
00221             var item = PreviousPageButtonVisibilityComboBox.SelectedItem;
00222
00223             if (item == this.NonePreviousPageButtonVisibilityItem)
00224             {
00225                 TestPager.PreviousButtonVisibility = PagerControlButtonVisibility.Hidden;
00226             }
00227             else if (item == this.AlwaysVisiblePreviousPageButtonVisibilityItem)
00228             {
00229                 TestPager.PreviousButtonVisibility = PagerControlButtonVisibility.Visible;
00230             }
00231             else if (item == this.HiddenOnEdgePreviousPageButtonVisibilityItem)
00232             {
00233                 TestPager.PreviousButtonVisibility = PagerControlButtonVisibility.HiddenOnEdge;
00234             }
00235
00236             PreviousPageButtonVisibilityCheckBox.IsChecked = previousPageButton?.Visibility == Visibility.Visible && previousPageButton?.Opacity != 0;
00237         }
00238
00239         private void OnNextButtonVisibilityChanged(object sender, SelectionChangedEventArgs e)
00240         {
00241             var item = NextPageButtonVisibilityComboBox.SelectedItem;
00242
00243             if (item == this.NoneNextPageButtonVisibilityItem)
00244             {
00245                 TestPager.NextButtonVisibility = PagerControlButtonVisibility.Hidden;
00246             }
00247             else if (item == this.AlwaysVisibleNextPageButtonVisibilityItem)
00248             {
00249                 TestPager.NextButtonVisibility = PagerControlButtonVisibility.Visible;
00250             }
00251             else if (item == this.HiddenOnEdgeNextPageButtonVisibilityItem)
00252             {
00253                 TestPager.NextButtonVisibility = PagerControlButtonVisibility.HiddenOnEdge;
00254             }
00255
00256             NextPageButtonVisibilityCheckBox.IsChecked = nextPageButton?.Visibility == Visibility.Visible && nextPageButton?.Opacity != 0;
00257         }
00258         private void OnLastButtonVisibilityChanged(object sender, SelectionChangedEventArgs e)
00259         {
00260             var item = LastPageButtonVisibilityComboBox.SelectedItem;
00261
00262             if (item == this.NoneLastPageButtonVisibilityItem)
00263             {
00264                 TestPager.LastButtonVisibility = PagerControlButtonVisibility.Hidden;
00265             }
00266             else if (item == this.AlwaysVisibleLastPageButtonVisibilityItem)
00267             {
00268                 TestPager.LastButtonVisibility = PagerControlButtonVisibility.Visible;
00269             }
00270             else if (item == this.HiddenOnEdgeLastPageButtonVisibilityItem)
00271             {
00272                 TestPager.LastButtonVisibility = PagerControlButtonVisibility.HiddenOnEdge;
00273             }
00274
00275             LastPageButtonVisibilityCheckBox.IsChecked = lastPageButton?.Visibility == Visibility.Visible && lastPageButton?.Opacity != 0;
00276         }
00277     }
00278 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsSourceViewFactory Member List

This is the complete list of members for ItemsSourceViewFactory, including all inherited members.
ActivateInstance() const | ItemsSourceViewFactory | [inline]
CreateInstance(winrt::IInspectable const &source, winrt::IInspectable const &baseInterface, winrt::IInspectable &innerInterface) | ItemsSourceViewFactory | [inline]
GetRuntimeClassName() const | ItemsSourceViewFactory | [inline]
Generated on Sun Dec 1 2024 20:52:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PagerControl/InteractionTests/PagerControlTests.cs Source File

  • PagerControl
  • InteractionTests

PagerControlTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00007 using MUXTestInfra.Shared.Infra;
00008
00009 using WEX.TestExecution;
00010 using WEX.TestExecution.Markup;
00011 using WEX.Logging.Interop;
00012
00013 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00014 {
00015     [TestClass]
00016     public class PagerControlTests : PagerControlTestBase
00017     {
00018
00019         [ClassInitialize]
00020         [TestProperty("RunAs", "User")]
00021         [TestProperty("Classification", "Integration")]
00022         [TestProperty("Platform", "Any")]
00023         [TestProperty("MUXControlsTestSuite", "SuiteB")]
00024         public static void ClassInitialize(TestContext testContext)
00025         {
00026             TestEnvironment.Initialize(testContext);
00027         }
00028
00029         public void TestCleanup()
00030         {
00031             TestCleanupHelper.Cleanup();
00032         }
00033
00034         [TestMethod]
00035         [TestProperty("TestSuite", "A")]
00036         [TestProperty("Ignore", "True")] // Ignored since the PagerControl is not fully accessible yet. See #6495
00037         public void VerifyAxeScanPasses()
00038         {
00039             using (var setup = new TestSetupHelper("PagerControl-Axe"))
00040             {
00041                 AxeTestHelper.TestForAxeIssues();
00042             }
00043         }
00044
00045         [TestMethod]
00046         [TestProperty("TestSuite", "A")]
00047         public void NumberBoxDisplayChangingPageTest()
00048         {
00049             using (var setup = new TestSetupHelper("PagerControl Tests"))
00050             {
00051                 elements = new PagerControlTestPageElements();
00052
00053                 SetNumberBoxDisplayMode();
00054                 VerifyNumberBoxDisplayMode();
00055                 VerifyPageChanged(0);
00056
00057                 SendValueToNumberBox("3"); // Note: PagerControl displays numbers starting at 1 but the page changed event sends 0-based numbers
00058                 VerifyPageChanged(2);
00059
00060                 SendValueToNumberBox("1");
00061                 VerifyPageChanged(0);
00062
00063                 SendValueToNumberBox("5");
00064                 VerifyPageChanged(4);
00065
00066                 SendValueToNumberBox("2");
00067                 VerifyPageChanged(1);
00068
00069                 SendValueToNumberBox("100");
00070                 Verify.AreEqual("5", FindTextBox(elements.GetPagerNumberBox()).GetText()); // If over max, value should be clamped down to the max.
00071                 VerifyPageChanged(4);
00072
00073                 SendValueToNumberBox("-100");
00074                 Verify.AreEqual("1", FindTextBox(elements.GetPagerNumberBox()).GetText()); // If under min, value should be clamped up to the min.
00075                 VerifyPageChanged(0);
00076
00077             }
00078         }
00079
00080         [TestMethod]
00081         [TestProperty("TestSuite", "A")]
00082         public void NumberBoxInfinityModeTest()
00083         {
00084             using (var setup = new TestSetupHelper("PagerControl Tests"))
00085             {
00086                 elements = new PagerControlTestPageElements();
00087
00088                 SetNumberBoxDisplayMode();
00089                 VerifyNumberBoxDisplayMode();
00090                 VerifyPageChanged(0);
00091                 elements.GetEnterInfinityModeButton().Click();
00092
00093                 SendValueToNumberBox("3"); // Note: PagerControl displays numbers starting at 1 but the page changed event sends 0-based numbers
00094                 VerifyPageChanged(2);
00095
00096                 SendValueToNumberBox("1");
00097                 VerifyPageChanged(0);
00098
00099                 SendValueToNumberBox("5");
00100                 VerifyPageChanged(4);
00101
00102                 SendValueToNumberBox("2");
00103                 VerifyPageChanged(1);
00104
00105                 SendValueToNumberBox("100");
00106                 Verify.AreEqual("100", FindTextBox(elements.GetPagerNumberBox()).GetText());
00107                 VerifyPageChanged(99);
00108
00109                 SendValueToNumberBox("10000");
00110                 Verify.AreEqual("10000", FindTextBox(elements.GetPagerNumberBox()).GetText());
00111                 VerifyPageChanged(9999);
00112
00113                 SendValueToNumberBox("-100");
00114                 Verify.AreEqual("1", FindTextBox(elements.GetPagerNumberBox()).GetText());
00115                 VerifyPageChanged(0);
00116             }
00117         }
00118
00119         [TestMethod]
00120         [TestProperty("TestSuite", "A")]
00121         public void ComboBoxDisplayChangingPageTest()
00122         {
00123             using (var setup = new TestSetupHelper("PagerControl Tests"))
00124             {
00125                 elements = new PagerControlTestPageElements();
00126                 VerifyPageChanged(0);
00127
00128                 SetComboBoxDisplayMode();
00129                 VerifyComboBoxDisplayMode();
00130
00131                 SelectValueInPagerComboBox(2);
00132                 VerifyPageChanged(2);
00133
00134                 SelectValueInPagerComboBox(4);
00135                 VerifyPageChanged(4);
00136
00137                 SelectValueInPagerComboBox(0);
00138                 VerifyPageChanged(0);
00139             }
00140         }
00141
00142         [TestMethod]
00143         [TestProperty("TestSuite", "B")]
00144         public void AutoDisplayChangingPageTest()
00145         {
00146             using (var setup = new TestSetupHelper("PagerControl Tests"))
00147             {
00148                 elements = new PagerControlTestPageElements();
00149                 VerifyPageChanged(0);
00150
00151                 SetAutoDisplayMode();
00152                 VerifyAutoDisplayMode();
00153
00154                 SelectValueInPagerComboBox(2);
00155                 VerifyPageChanged(2);
00156
00157                 SelectValueInPagerComboBox(4);
00158                 VerifyPageChanged(4);
00159
00160                 SelectValueInPagerComboBox(0);
00161                 VerifyPageChanged(0);
00162             }
00163         }
00164
00165         [TestMethod]
00166         [TestProperty("TestSuite", "D")]
00167         public void NumberPanelChangingPageTest()
00168         {
00169             using (var setup = new TestSetupHelper("PagerControl Tests"))
00170             {
00171                 elements = new PagerControlTestPageElements();
00172
00173                 VerifyPageChanged(0);
00174
00175                 SetNumberPanelDisplayMode();
00176                 VerifyNumberPanelDisplayMode();
00177
00178                 SelectPageInNumberPanel(2);
00179                 VerifyPageChanged(1);
00180                 VerifyNumberPanelContent("12345");
00181
00182                 SelectPageInNumberPanel(5);
00183                 VerifyPageChanged(4);
00184                 VerifyNumberPanelContent("12345");
00185
00186                 SelectPageInNumberPanel(4);
00187                 VerifyPageChanged(3);
00188                 VerifyNumberPanelContent("12345");
00189
00190                 SelectPageInNumberPanel(3);
00191                 VerifyPageChanged(2);
00192                 VerifyNumberPanelContent("12345");
00193
00194                 ChangeNumberOfPages();
00195                 VerifyNumberOfPages("100");
00196
00197
00198                 SelectPageInNumberPanel(1);
00199                 VerifyPageChanged(0);
00200                 VerifyNumberPanelContent("12345More100");
00201
00202                 SelectPageInNumberPanel(2);
00203                 VerifyPageChanged(1);
00204                 VerifyNumberPanelContent("12345More100");
00205
00206                 SelectPageInNumberPanel(3);
00207                 VerifyPageChanged(2);
00208                 VerifyNumberPanelContent("12345More100");
00209
00210                 SelectPageInNumberPanel(4);
00211                 VerifyPageChanged(3);
00212                 VerifyNumberPanelContent("12345More100");
00213
00214                 SelectPageInNumberPanel(5);
00215                 VerifyPageChanged(4);
00216                 VerifyNumberPanelContent("1More456More100");
00217
00218                 SelectPageInNumberPanel(6);
00219                 VerifyPageChanged(5);
00220                 VerifyNumberPanelContent("1More567More100");
00221
00222                 SelectPageInNumberPanel(100);
00223                 VerifyPageChanged(99);
00224
00225                 VerifyNumberPanelContent("1More96979899100");
00226
00227                 SelectPageInNumberPanel(99);
00228                 VerifyPageChanged(98);
00229                 VerifyNumberPanelContent("1More96979899100");
00230
00231                 SelectPageInNumberPanel(98);
00232                 VerifyPageChanged(97);
00233                 VerifyNumberPanelContent("1More96979899100");
00234
00235                 SelectPageInNumberPanel(97);
00236                 VerifyPageChanged(96);
00237                 VerifyNumberPanelContent("1More96979899100");
00238
00239                 SelectPageInNumberPanel(96);
00240                 VerifyPageChanged(95);
00241                 VerifyNumberPanelContent("1More959697More100");
00242             }
00243         }
00244
00245         [TestMethod]
00246         [TestProperty("TestSuite", "C")]
00247         public void NumberPanelChangingPageTest2()
00248         {
00249             using (var setup = new TestSetupHelper("PagerControl Tests"))
00250             {
00251                 elements = new PagerControlTestPageElements();
00252
00253                 VerifyPageChanged(0);
00254
00255                 SetNumberPanelDisplayMode();
00256                 VerifyNumberPanelDisplayMode();
00257
00258                 InputHelper.LeftClick(elements.GetNextPageButton());
00259                 VerifyPageChanged(1);
00260                 VerifyNumberPanelContent("12345");
00261
00262                 InputHelper.LeftClick(elements.GetLastPageButton());
00263                 VerifyPageChanged(4);
00264                 VerifyNumberPanelContent("12345");
00265
00266                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00267                 VerifyPageChanged(3);
00268                 VerifyNumberPanelContent("12345");
00269
00270                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00271                 VerifyPageChanged(2);
00272                 VerifyNumberPanelContent("12345");
00273
00274                 ChangeNumberOfPages();
00275                 VerifyNumberOfPages("100");
00276
00277                 InputHelper.LeftClick(elements.GetFirstPageButton());
00278                 VerifyPageChanged(0);
00279                 VerifyNumberPanelContent("12345More100");
00280
00281                 InputHelper.LeftClick(elements.GetNextPageButton());
00282                 VerifyPageChanged(1);
00283                 VerifyNumberPanelContent("12345More100");
00284
00285                 InputHelper.LeftClick(elements.GetNextPageButton());
00286                 VerifyPageChanged(2);
00287                 VerifyNumberPanelContent("12345More100");
00288
00289                 InputHelper.LeftClick(elements.GetNextPageButton());
00290                 VerifyPageChanged(3);
00291                 VerifyNumberPanelContent("12345More100");
00292
00293                 InputHelper.LeftClick(elements.GetNextPageButton());
00294                 VerifyPageChanged(4);
00295                 VerifyNumberPanelContent("1More456More100");
00296
00297                 InputHelper.LeftClick(elements.GetNextPageButton());
00298                 VerifyPageChanged(5);
00299                 VerifyNumberPanelContent("1More567More100");
00300
00301                 InputHelper.LeftClick(elements.GetLastPageButton());
00302                 VerifyPageChanged(99);
00303
00304                 VerifyNumberPanelContent("1More96979899100");
00305
00306                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00307                 VerifyPageChanged(98);
00308                 VerifyNumberPanelContent("1More96979899100");
00309
00310                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00311                 VerifyPageChanged(97);
00312                 VerifyNumberPanelContent("1More96979899100");
00313
00314                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00315                 VerifyPageChanged(96);
00316                 VerifyNumberPanelContent("1More96979899100");
00317
00318                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00319                 VerifyPageChanged(95);
00320                 VerifyNumberPanelContent("1More959697More100");
00321             }
00322         }
00323
00324         [TestMethod]
00325         [TestProperty("TestSuite","D")]
00326         public void NumberPanelInfiniteItemsTest()
00327         {
00328             using (var setup = new TestSetupHelper("PagerControl Tests"))
00329             {
00330                 elements = new PagerControlTestPageElements();
00331
00332                 VerifyPageChanged(0);
00333
00334                 SetNumberPanelDisplayMode();
00335                 VerifyNumberPanelDisplayMode();
00336
00337                 elements.GetEnterInfinityModeButton().Click();
00338
00339                 InputHelper.LeftClick(elements.GetNextPageButton());
00340                 VerifyPageChanged(1);
00341                 VerifyNumberPanelContent("12345");
00342
00343                 InputHelper.LeftClick(elements.GetNextPageButton());
00344                 VerifyPageChanged(2);
00345                 VerifyNumberPanelContent("12345");
00346
00347                 InputHelper.LeftClick(elements.GetNextPageButton());
00348                 VerifyPageChanged(3);
00349                 VerifyNumberPanelContent("1More345");
00350
00351                 InputHelper.LeftClick(elements.GetNextPageButton());
00352                 VerifyPageChanged(4);
00353                 VerifyNumberPanelContent("1More456");
00354
00355                 InputHelper.LeftClick(elements.GetNextPageButton());
00356                 VerifyPageChanged(5);
00357                 VerifyNumberPanelContent("1More567");
00358
00359                 InputHelper.LeftClick(elements.GetNextPageButton());
00360                 VerifyPageChanged(6);
00361                 VerifyNumberPanelContent("1More678");
00362
00363                 InputHelper.LeftClick(elements.GetNextPageButton());
00364                 VerifyPageChanged(7);
00365                 VerifyNumberPanelContent("1More789");
00366
00367                 InputHelper.LeftClick(elements.GetNextPageButton());
00368                 VerifyPageChanged(8);
00369                 VerifyNumberPanelContent("1More8910");
00370
00371                 InputHelper.LeftClick(elements.GetNextPageButton());
00372                 VerifyPageChanged(9);
00373                 VerifyNumberPanelContent("1More91011");
00374
00375                 InputHelper.LeftClick(elements.GetNextPageButton());
00376                 VerifyPageChanged(10);
00377                 VerifyNumberPanelContent("1More101112");
00378
00379             }
00380         }
00381
00382         [TestMethod]
00383         [TestProperty("TestSuite", "C")]
00384         public void FirstPageButtonChangingPageTest()
00385         {
00386             using (var setup = new TestSetupHelper("PagerControl Tests"))
00387             {
00388                 elements = new PagerControlTestPageElements();
00389                 VerifyPageChanged(0);
00390                 InputHelper.LeftClick(elements.GetLastPageButton());
00391
00392                 InputHelper.LeftClick(elements.GetFirstPageButton());
00393                 VerifyPageChanged(0);
00394
00395                 InputHelper.LeftClick(elements.GetNextPageButton());
00396
00397                 InputHelper.LeftClick(elements.GetFirstPageButton());
00398                 VerifyPageChanged(0);
00399             }
00400         }
00401
00402         [TestMethod]
00403         [TestProperty("TestSuite", "B")]
00404         public void PreviousPageButtonChangingPageTest()
00405         {
00406             using (var setup = new TestSetupHelper("PagerControl Tests"))
00407             {
00408                 elements = new PagerControlTestPageElements();
00409                 VerifyPageChanged(0);
00410                 InputHelper.LeftClick(elements.GetNextPageButton());
00411
00412                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00413                 VerifyPageChanged(0);
00414
00415                 InputHelper.LeftClick(elements.GetLastPageButton());
00416
00417                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00418                 VerifyPageChanged(3);
00419
00420                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00421                 VerifyPageChanged(2);
00422
00423                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00424                 VerifyPageChanged(1);
00425
00426                 InputHelper.LeftClick(elements.GetPreviousPageButton());
00427                 VerifyPageChanged(0);
00428
00429             }
00430         }
00431
00432         [TestMethod]
00433         [TestProperty("TestSuite", "B")]
00434         public void NextPageButtonChangingPageTest()
00435         {
00436             using (var setup = new TestSetupHelper("PagerControl Tests"))
00437             {
00438                 elements = new PagerControlTestPageElements();
00439                 VerifyPageChanged(0);
00440                 InputHelper.LeftClick(elements.GetNextPageButton());
00441                 VerifyPageChanged(1);
00442
00443                 InputHelper.LeftClick(elements.GetNextPageButton());
00444                 VerifyPageChanged(2);
00445
00446                 InputHelper.LeftClick(elements.GetNextPageButton());
00447                 VerifyPageChanged(3);
00448
00449                 InputHelper.LeftClick(elements.GetNextPageButton());
00450                 VerifyPageChanged(4);
00451             }
00452         }
00453
00454         [TestMethod]
00455         [TestProperty("TestSuite", "A")]
00456         public void LastPageButtonChangingPageTest()
00457         {
00458             using (var setup = new TestSetupHelper("PagerControl Tests"))
00459             {
00460                 elements = new PagerControlTestPageElements();
00461                 VerifyPageChanged(0);
00462                 InputHelper.LeftClick(elements.GetLastPageButton());
00463                 VerifyPageChanged(4);
00464
00465                 InputHelper.LeftClick(elements.GetFirstPageButton());
00466                 InputHelper.LeftClick(elements.GetNextPageButton());
00467
00468                 InputHelper.LeftClick(elements.GetLastPageButton());
00469                 VerifyPageChanged(4);
00470             }
00471         }
00472
00473         [TestMethod]
00474         [TestProperty("TestSuite", "D")]
00475         public void FirstPageButtonVisibilityOptionsTest()
00476         {
00477             ButtonVisibilityOptionsTest(buttonNamePrefix: "First");
00478         }
00479
00480         [TestMethod]
00481         [TestProperty("TestSuite", "E")]
00482         public void PreviousPageButtonVisibilityOptionsTest()
00483         {
00484             ButtonVisibilityOptionsTest(buttonNamePrefix: "Previous");
00485         }
00486
00487         [TestMethod]
00488         [TestProperty("TestSuite", "F")]
00489         public void NextPageButtonVisibilityOptionsTest()
00490         {
00491             ButtonVisibilityOptionsTest(buttonNamePrefix: "Next");
00492         }
00493
00494         [TestMethod]
00495         [TestProperty("TestSuite", "G")]
00496         public void LastPageButtonVisibilityOptionsTest()
00497         {
00498             ButtonVisibilityOptionsTest(buttonNamePrefix: "Last");
00499         }
00500
00501         [TestMethod]
00502         [TestProperty("TestSuite", "C")]
00503         public void ChangingDisplayModeTest()
00504         {
00505             using (var setup = new TestSetupHelper("PagerControl Tests"))
00506             {
00507                 elements = new PagerControlTestPageElements();
00508                 SetAutoDisplayMode();
00509                 VerifyAutoDisplayMode();
00510
00511                 SetComboBoxDisplayMode();
00512                 VerifyComboBoxDisplayMode();
00513
00514                 SetNumberBoxDisplayMode();
00515                 VerifyNumberBoxDisplayMode();
00516
00517                 SetNumberPanelDisplayMode();
00518                 VerifyNumberPanelDisplayMode();
00519
00520                 SetAutoDisplayMode();
00521                 VerifyAutoDisplayMode();
00522
00523                 SetNumberBoxDisplayMode();
00524                 VerifyNumberBoxDisplayMode();
00525
00526                 SetNumberPanelDisplayMode();
00527                 VerifyNumberPanelDisplayMode();
00528
00529                 SetComboBoxDisplayMode();
00530                 VerifyComboBoxDisplayMode();
00531
00532                 SetAutoDisplayMode();
00533                 VerifyAutoDisplayMode();
00534
00535                 SetNumberPanelDisplayMode();
00536                 VerifyNumberPanelDisplayMode();
00537
00538                 ChangeNumberOfPages();
00539                 VerifyNumberOfPages("100");
00540
00541                 SetAutoDisplayMode();
00542                 VerifyAutoDisplayMode();
00543
00544                 ChangeNumberOfPages();
00545                 VerifyNumberOfPages("5");
00546
00547                 VerifyAutoDisplayMode();
00548
00549                 IncrementNumberOfPages(4);
00550                 VerifyNumberOfPages("9");
00551
00552                 VerifyAutoDisplayMode();
00553
00554                 IncrementNumberOfPages(1);
00555                 VerifyNumberOfPages("10");
00556
00557                 VerifyAutoDisplayMode();
00558
00559                 IncrementNumberOfPages(1);
00560                 VerifyNumberOfPages("11");
00561
00562                 VerifyAutoDisplayMode();
00563             }
00564         }
00565
00566         [TestMethod]
00567         [TestProperty("TestSuite", "C")]
00568         public void VerifyButtonVisibilitySetInXAMLApplied()
00569         {
00570             using (var setup = new TestSetupHelper("PagerControl Tests"))
00571             {
00572                 elements = new PagerControlTestPageElements();
00573
00574                 // Invoke button
00575                 elements.GetCheckIfButtonsHiddenButton().Click();
00576
00577                 Wait.ForIdle();
00578
00579                 // Check result
00580                 Verify.AreEqual("Passed", elements.GetCheckIfButtonsHiddenLabel().GetText(), "Not all buttons where hidden and as such, the test result was not 'Passed'");
00581             }
00582         }
00583     }
00584 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TwoPaneView/DisplayRegionHelper.cpp Source File

  • TwoPaneView

DisplayRegionHelper.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SharedHelpers.h"
00007 #include "Vector.h"
00008 #include "DisplayRegionHelper.h"
00009 #include "LifetimeHandler.h"
00010
00011 // TODO: Remove once ApplicationViewMode::Spanning is available in the SDK
00012 const int c_ApplicationViewModeSpanning = 2;
00013
00014 /* static */
00015 DisplayRegionHelperInfo DisplayRegionHelper::GetRegionInfo()
00016 {
00017     auto instance = LifetimeHandler::GetDisplayRegionHelperInstance();
00018
00019     DisplayRegionHelperInfo info;
00020     info.Mode = winrt::TwoPaneViewMode::SinglePane;
00021
00022     if (instance->m_simulateDisplayRegions)
00023     {
00024         // Create fake rectangles for test app
00025         if (instance->m_simulateMode == winrt::TwoPaneViewMode::Wide)
00026         {
00027             info.Regions[0] = m_simulateWide0;
00028             info.Regions[1] = m_simulateWide1;
00029             info.Mode = winrt::TwoPaneViewMode::Wide;
00030         }
00031         else if (instance->m_simulateMode == winrt::TwoPaneViewMode::Tall)
00032         {
00033             info.Regions[0] = m_simulateTall0;
00034             info.Regions[1] = m_simulateTall1;
00035             info.Mode = winrt::TwoPaneViewMode::Tall;
00036         }
00037         else
00038         {
00039             info.Regions[0] = m_simulateWide0;
00040         }
00041     }
00042     else
00043     {
00044         // ApplicationView::GetForCurrentView throws on failure; in that case we just won't do anything.
00045         winrt::ApplicationView view{ nullptr };
00046         if (winrt::CoreWindow::GetForCurrentThread())
00047         {
00048             try
00049             {
00050                 view = winrt::ApplicationView::GetForCurrentView();
00051             }
00052             catch (...) {}
00053         }
00054
00055         if (view && view.ViewMode() == (winrt::Windows::UI::ViewManagement::ApplicationViewMode)c_ApplicationViewModeSpanning)
00056         {
00057             if (const auto appView = view.try_as<winrt::IApplicationViewSpanningRects>())
00058             {
00059                 winrt::IVectorView<winrt::Rect> rects = appView.GetSpanningRects();
00060
00061                 if (rects.Size() == 2)
00062                 {
00063                     info.Regions[0] = rects.GetAt(0);
00064                     info.Regions[1] = rects.GetAt(1);
00065
00066                     // Determine orientation. If neither of these are true, default to doing nothing.
00067                     if (info.Regions[0].X < info.Regions[1].X && info.Regions[0].Y == info.Regions[1].Y)
00068                     {
00069                         // Double portrait
00070                         info.Mode = winrt::TwoPaneViewMode::Wide;
00071                     }
00072                     else if (info.Regions[0].X == info.Regions[1].X && info.Regions[0].Y < info.Regions[1].Y)
00073                     {
00074                         // Double landscape
00075                         info.Mode = winrt::TwoPaneViewMode::Tall;
00076                     }
00077                 }
00078             }
00079         }
00080     }
00081
00082     return info;
00083 }
00084
00085 /* static */
00086 winrt::UIElement DisplayRegionHelper::WindowElement()
00087 {
00088     auto instance = LifetimeHandler::GetDisplayRegionHelperInstance();
00089     auto content = winrt::Window::Current() ? winrt::Window::Current().Content() : nullptr;
00090
00091     if (instance->m_simulateDisplayRegions)
00092     {
00093         // Instead of returning the actual window, find the SimulatedWindow element
00094         winrt::UIElement window = nullptr;
00095
00096         if (auto fe = content.as<winrt::FrameworkElement>())
00097         {
00098             window = SharedHelpers::FindInVisualTreeByName(fe, L"SimulatedWindow");
00099         }
00100
00101         return window;
00102     }
00103     else
00104     {
00105         return content;
00106     }
00107 }
00108
00109 /* static */
00110 winrt::Rect DisplayRegionHelper::WindowRect()
00111 {
00112     auto instance = LifetimeHandler::GetDisplayRegionHelperInstance();
00113
00114     if (instance->m_simulateDisplayRegions)
00115     {
00116         // Return the bounds of the simulated window
00117         winrt::FrameworkElement window = DisplayRegionHelper::WindowElement().as<winrt::FrameworkElement>();
00118         const winrt::Rect rc = {
00119             0, 0,
00120             (float)window.ActualWidth(),
00121             (float)window.ActualHeight() };
00122         return rc;
00123     }
00124     else
00125     {
00126         return winrt::Window::Current() ? winrt::Window::Current().Bounds() : winrt::Rect();
00127     }
00128 }
00129
00130 /* static */
00131 void DisplayRegionHelper::SimulateDisplayRegions(bool value)
00132 {
00133     auto instance = LifetimeHandler::GetDisplayRegionHelperInstance();
00134     instance->m_simulateDisplayRegions = value;
00135 }
00136
00137 /* static */
00138 bool DisplayRegionHelper::SimulateDisplayRegions()
00139 {
00140     auto instance = LifetimeHandler::GetDisplayRegionHelperInstance();
00141     return instance->m_simulateDisplayRegions;
00142 }
00143
00144 /* static */
00145 void DisplayRegionHelper::SimulateMode(winrt::TwoPaneViewMode value)
00146 {
00147     auto instance = LifetimeHandler::GetDisplayRegionHelperInstance();
00148     instance->m_simulateMode = value;
00149 }
00150
00151 /* static */
00152 winrt::TwoPaneViewMode DisplayRegionHelper::SimulateMode()
00153 {
00154     auto instance = LifetimeHandler::GetDisplayRegionHelperInstance();
00155     return instance->m_simulateMode;
00156 }
00157
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnnotatedScrollBar/AnnotatedScrollBarDetailLabelRequestedEventArgs.h Source File

  • AnnotatedScrollBar

AnnotatedScrollBarDetailLabelRequestedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "AnnotatedScrollBarDetailLabelRequestedEventArgs.g.h"
00007
00008 class AnnotatedScrollBarDetailLabelRequestedEventArgs :
00009     public ReferenceTracker<AnnotatedScrollBarDetailLabelRequestedEventArgs, winrt::implementation::AnnotatedScrollBarDetailLabelRequestedEventArgsT, winrt::composable, winrt::composing>
00010 {
00011 public:
00012     AnnotatedScrollBarDetailLabelRequestedEventArgs(double scrollOffset);
00013
00014 #pragma region IAnnotatedScrollBarDetailLabelRequestedEventArgs
00015     winrt::IInspectable Content();
00016     void Content(const winrt::IInspectable& content);
00017     double ScrollOffset();
00018 #pragma endregion
00019
00020 private:
00021     tracker_ref<winrt::IInspectable> m_content{ this };
00022     double m_scrollOffset{ 0.0 };
00023 };
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SelectorBar/SelectorBarItemAutomationPeer.cpp Source File

  • SelectorBar

SelectorBarItemAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "SelectorBarItem.h"
00008 #include "SelectorBarItemAutomationPeer.h"
00009 #include "SelectorBarItemAutomationPeer.properties.cpp"
00010 #include "../ResourceHelper/ResourceAccessor.h"
00011
00012 SelectorBarItemAutomationPeer::SelectorBarItemAutomationPeer(winrt::FrameworkElement const& owner)
00013     : base_type(owner)
00014 {
00015 }
00016
00017 // IAutomationPeerOverrides
00018 winrt::hstring SelectorBarItemAutomationPeer::GetNameCore()
00019 {
00020     // First choice given to the AutomationProperties.Name.
00021     winrt::hstring returnHString = winrt::AutomationProperties::GetName(Owner());
00022
00023     if (returnHString.empty())
00024     {
00025         // Second choice given to the SelectorBarItem.Text property.
00026         if (const auto selectorBarItem = Owner().try_as<winrt::SelectorBarItem>())
00027         {
00028             returnHString = selectorBarItem.Text();
00029         }
00030     }
00031
00032     if (returnHString.empty())
00033     {
00034         // Third choice given to the ItemContainer.Child property.
00035         if (const auto itemContainer = Owner().try_as<winrt::ItemContainer>())
00036         {
00037             returnHString = SharedHelpers::TryGetStringRepresentationFromObject(itemContainer.Child());
00038         }
00039     }
00040
00041     if (returnHString.empty())
00042     {
00043         // Fourth choice given to the localized control name.
00044         returnHString = ResourceAccessor::GetLocalizedStringResource(SR_SelectorBarItemDefaultControlName);
00045     }
00046
00047     return returnHString;
00048 }
00049
00050 winrt::hstring SelectorBarItemAutomationPeer::GetLocalizedControlTypeCore()
00051 {
00052     return ResourceAccessor::GetLocalizedStringResource(SR_SelectorBarItemDefaultControlName);
00053 }
00054
00055 winrt::hstring SelectorBarItemAutomationPeer::GetClassNameCore()
00056 {
00057     return winrt::hstring_name_of<winrt::SelectorBarItem>();
00058 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TwoPaneView/DisplayRegionHelper.h Source File

  • TwoPaneView

DisplayRegionHelper.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 const uint32_t c_maxRegions = 2;
00007
00008 struct DisplayRegionHelperInfo
00009 {
00010     winrt::TwoPaneViewMode Mode{ winrt::TwoPaneViewMode::SinglePane };
00011     std::array<winrt::Rect, c_maxRegions> Regions{};
00012 };
00013
00014 class DisplayRegionHelper:
00015     public winrt::implements<DisplayRegionHelper, winrt::IInspectable>
00016 {
00017 public:
00018     static DisplayRegionHelperInfo GetRegionInfo();
00019
00020     static winrt::Rect WindowRect();
00021     static winrt::UIElement WindowElement();
00022
00023     static void SimulateDisplayRegions(bool value);
00024     static bool SimulateDisplayRegions();
00025
00026     static void SimulateMode(winrt::TwoPaneViewMode value);
00027     static winrt::TwoPaneViewMode SimulateMode();
00028
00029 private:
00030
00031     void OnDisplayModeChanged(const winrt::IInspectable& sender, const winrt::IInspectable& args);
00032
00033     bool m_simulateDisplayRegions{ false };
00034     winrt::TwoPaneViewMode m_simulateMode{ winrt::TwoPaneViewMode::SinglePane };
00035
00036     static constexpr winrt::Rect m_simulateWide0{ 0, 0, 300, 400 };
00037     static constexpr winrt::Rect m_simulateWide1{ 312, 0, 300, 400 };
00038     static constexpr winrt::Rect m_simulateTall0{ 0, 0, 400, 300 };
00039     static constexpr winrt::Rect m_simulateTall1{ 0, 312, 400, 300 };
00040 };
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectionTreeHelper Member List

This is the complete list of members for SelectionTreeHelper, including all inherited members.
IsSubSet(const winrt::IndexPath &path, const winrt::IndexPath &subset) | SelectionTreeHelper | [private, static]
StartPath(const winrt::IndexPath &path, int length) | SelectionTreeHelper | [private, static]
Traverse(std::shared_ptr< SelectionNode > root, bool realizeChildren, std::function< void(const TreeWalkNodeInfo &)> nodeAction) | SelectionTreeHelper | [static]
TraverseIndexPath(std::shared_ptr< SelectionNode > root, const winrt::IndexPath &path, bool realizeChildren, std::function< void(std::shared_ptr< SelectionNode >, const winrt::IndexPath &, int, int)> nodeAction) | SelectionTreeHelper | [static]
TraverseRangeRealizeChildren(std::shared_ptr< SelectionNode > root, const winrt::IndexPath &start, const winrt::IndexPath &end, std::function< void(const TreeWalkNodeInfo &)> nodeAction) | SelectionTreeHelper | [static]
Generated on Sun Dec 1 2024 20:53:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RadioButtonsTests Member List

This is the complete list of members for RadioButtonsTests, including all inherited members.
AccessKeys() | RadioButtonsTests | [inline]
BackupTap(int index) | RadioButtonsTests | [inline, private]
BasicKeyboardTest() | RadioButtonsTests | [inline]
ClassInitialize(TestContext testContext) | RadioButtonsTests | [inline, static]
ClickOnItem(int index) | RadioButtonsTests | [inline, private]
ColumnsTest() | RadioButtonsTests | [inline]
ControlKeyKeyboardTest() | RadioButtonsTests | [inline]
DisabledItemsAtTopOfColumnKeyboardTest() | RadioButtonsTests | [inline]
DisabledItemsKeyboardTest() | RadioButtonsTests | [inline]
elements | RadioButtonsTests | [private]
FocusComingFromAnotherRepeaterTest() | RadioButtonsTests | [inline]
GamepadCanEscapeAndDoesNotSelectWithFocus() | RadioButtonsTests | [inline]
GetFocusedIndex() | RadioButtonsTests | [inline, private]
GetFocusedItem() | RadioButtonsTests | [inline, private]
GetLayoutData() | RadioButtonsTests | [inline, private]
GetSelectedIndex() | RadioButtonsTests | [inline, private]
GetSelectedItem() | RadioButtonsTests | [inline, private]
InsertDisabledRadioButton(int index, bool isChecked=false, string content="Custom") | RadioButtonsTests | [inline, private]
InsertedCheckedRadioButtonGetsSelection() | RadioButtonsTests | [inline]
InsertEnabledRadioButton(int index, bool isChecked=false, string content="Custom") | RadioButtonsTests | [inline, private]
InsertRadioButton(int index, bool disabled, bool isChecked=false, string content="Custom") | RadioButtonsTests | [inline, private]
MultiColumnKeyboardTest() | RadioButtonsTests | [inline]
RS2MultiColumnKeyboardTest() | RadioButtonsTests | [inline]
ScrollViewerSettingSelectionDoesNotMoveFocus() | RadioButtonsTests | [inline]
SelectByIndex(int index) | RadioButtonsTests | [inline, private]
SelectByItem() | RadioButtonsTests | [inline]
SelectByItem(int index) | RadioButtonsTests | [inline, private]
SelectionTest() | RadioButtonsTests | [inline]
SetBorderWidth(float width) | RadioButtonsTests | [inline, private]
SetBorderWidthToInf() | RadioButtonsTests | [inline, private]
SetIndexToSelect(int index) | RadioButtonsTests | [inline, private]
SetItemType(RadioButtonsSourceType type) | RadioButtonsTests | [inline, private]
SetNumberOfColumns(int columns) | RadioButtonsTests | [inline, private]
SetNumberOfItems(int items) | RadioButtonsTests | [inline, private]
SetSource(RadioButtonsSourceLocation location) | RadioButtonsTests | [inline, private]
SingleRowKeyboardTest() | RadioButtonsTests | [inline]
TapOnItem(int index, bool useBackup=false) | RadioButtonsTests | [inline, private]
TestCleanup() | RadioButtonsTests | [inline]
UIAProperties() | RadioButtonsTests | [inline]
UseAccessKey() | RadioButtonsTests | [inline, private]
VerifyFocusedIndex(int index) | RadioButtonsTests | [inline, private]
VerifyLayoutData(int rows, int columns, int largerColumns) | RadioButtonsTests | [inline, private]
VerifyRadioButtonsHasFocus(bool hasFocus) | RadioButtonsTests | [inline, private]
VerifySelectedFocusedIndex(int index) | RadioButtonsTests | [inline, private]
VerifySelectedIndex(int index) | RadioButtonsTests | [inline, private]
VerifySelectedPositionInSet(int index) | RadioButtonsTests | [inline, private]
VerifySelectedSizeOfSet(int index) | RadioButtonsTests | [inline, private]
Generated on Sun Dec 1 2024 20:53:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/InfoBar.cpp Source File

  • InfoBar

InfoBar.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "InfoBar.h"
00007 #include "InfoBarClosingEventArgs.h"
00008 #include "InfoBarClosedEventArgs.h"
00009 #include "InfoBarTemplateSettings.h"
00010 #include "InfoBarAutomationPeer.h"
00011 #include "RuntimeProfiler.h"
00012 #include "ResourceAccessor.h"
00013 #include "../ResourceHelper/Utils.h"
00014
00015 static constexpr wstring_view c_closeButtonName{ L"CloseButton"sv };
00016 static constexpr wstring_view c_iconTextBlockName{ L"StandardIcon"sv };
00017 static constexpr wstring_view c_contentRootName{ L"ContentRoot"sv };
00018
00019 InfoBar::InfoBar()
00020 {
00021     __RP_Marker_ClassById(RuntimeProfiler::ProfId_InfoBar);
00022
00023     SetValue(s_TemplateSettingsProperty, winrt::make<::InfoBarTemplateSettings>());
00024
00025     RegisterPropertyChangedCallback(winrt::Control::ForegroundProperty(), { this, &InfoBar::OnForegroundChanged });
00026
00027     SetDefaultStyleKey(this);
00028 }
00029
00030 winrt::AutomationPeer InfoBar::OnCreateAutomationPeer()
00031 {
00032     return winrt::make<InfoBarAutomationPeer>(*this);
00033 }
00034
00035 void InfoBar::OnApplyTemplate()
00036 {
00037     m_applyTemplateCalled = true;
00038
00039     winrt::IControlProtected controlProtected{ *this };
00040
00041     if (const auto closeButton = GetTemplateChildT<winrt::Button>(c_closeButtonName, controlProtected))
00042     {
00043         m_closeButtonClickRevoker = closeButton.Click(winrt::auto_revoke, { this, &InfoBar::OnCloseButtonClick });
00044
00045         // Do localization for the close button
00046         if (winrt::AutomationProperties::GetName(closeButton).empty())
00047         {
00048             const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(SR_InfoBarCloseButtonName);
00049             winrt::AutomationProperties::SetName(closeButton, closeButtonName);
00050         }
00051         // Setup the tooltip for the close button
00052         auto tooltip = winrt::ToolTip();
00053         const auto closeButtonTooltipText = ResourceAccessor::GetLocalizedStringResource(SR_InfoBarCloseButtonTooltip);
00054         tooltip.Content(box_value(closeButtonTooltipText));
00055         winrt::ToolTipService::SetToolTip(closeButton, tooltip);
00056     }
00057
00058     if (const auto iconTextblock = GetTemplateChildT<winrt::FrameworkElement>(c_iconTextBlockName, controlProtected))
00059     {
00060         m_standardIconTextBlock.set(iconTextblock);
00061         winrt::AutomationProperties::SetName(iconTextblock, ResourceAccessor::GetLocalizedStringResource(GetIconSeverityLevelResourceName(Severity())));
00062     }
00063
00064     winrt::AutomationProperties::SetLocalizedLandmarkType(*this, ResourceAccessor::GetLocalizedStringResource(SR_InfoBarCustomLandmarkName));
00065
00066     UpdateVisibility(m_notifyOpen, true);
00067     m_notifyOpen = false;
00068
00069     UpdateSeverity();
00070     UpdateIcon();
00071     UpdateIconVisibility();
00072     UpdateCloseButton();
00073     UpdateForeground();
00074     UpdateContentPosition();
00075 }
00076
00077 void InfoBar::OnCloseButtonClick(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args)
00078 {
00079     m_closeButtonClickEventSource(*this, nullptr);
00080     m_lastCloseReason = winrt::InfoBarCloseReason::CloseButton;
00081     IsOpen(false);
00082 }
00083
00084 void InfoBar::RaiseClosingEvent()
00085 {
00086     auto const args = winrt::make_self<InfoBarClosingEventArgs>();
00087     args->Reason(m_lastCloseReason);
00088
00089     m_closingEventSource(*this, *args);
00090
00091     if (!args->Cancel())
00092     {
00093         UpdateVisibility();
00094         RaiseClosedEvent();
00095     }
00096     else
00097     {
00098         // The developer has changed the Cancel property to true,
00099         // so we need to revert the IsOpen property to true.
00100         IsOpen(true);
00101     }
00102 }
00103
00104 void InfoBar::RaiseClosedEvent()
00105 {
00106     auto const args = winrt::make_self<InfoBarClosedEventArgs>();
00107     args->Reason(m_lastCloseReason);
00108     m_closedEventSource(*this, *args);
00109 }
00110
00111 void InfoBar::OnIsOpenPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00112 {
00113     if (IsOpen())
00114     {
00115         //Reset the close reason to the default value of programmatic.
00116         m_lastCloseReason = winrt::InfoBarCloseReason::Programmatic;
00117
00118         UpdateVisibility();
00119     }
00120     else
00121     {
00122         RaiseClosingEvent();
00123     }
00124 }
00125
00126 void InfoBar::OnTitlePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00127 {
00128     UpdateContentPosition();
00129 }
00130
00131 void InfoBar::OnMessagePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00132 {
00133     UpdateContentPosition();
00134 }
00135
00136 void InfoBar::OnActionButtonPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00137 {
00138     UpdateContentPosition();
00139 }
00140
00141 void InfoBar::OnSeverityPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00142 {
00143     UpdateSeverity();
00144 }
00145
00146 void InfoBar::OnIconSourcePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00147 {
00148     UpdateIcon();
00149     UpdateIconVisibility();
00150 }
00151
00152 void InfoBar::OnIsIconVisiblePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00153 {
00154     UpdateIconVisibility();
00155 }
00156
00157 void InfoBar::OnIsClosablePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00158 {
00159     UpdateCloseButton();
00160 }
00161
00162 void InfoBar::UpdateVisibility(bool notify, bool force)
00163 {
00164     auto const peer = winrt::FrameworkElementAutomationPeer::FromElement(*this).try_as<winrt::InfoBarAutomationPeer>();
00165     if (!m_applyTemplateCalled)
00166     {
00167         // ApplyTemplate() hasn't been called yet but IsOpen has already been set.
00168         // Since this method will be called again shortly from ApplyTemplate, we'll just wait and send a notification then.
00169         m_notifyOpen = true;
00170     }
00171     else
00172     {
00173         // Don't do any work if nothing has changed (unless we are forcing a update)
00174         if (force || IsOpen() != m_isVisible)
00175         {
00176             if (IsOpen())
00177             {
00178                 if (notify && peer)
00179                 {
00180                     auto const notificationString = StringUtil::FormatString(
00181                         ResourceAccessor::GetLocalizedStringResource(SR_InfoBarOpenedNotification),
00182                         ResourceAccessor::GetLocalizedStringResource(GetIconSeverityLevelResourceName(Severity())).data(),
00183                         Title().data(),
00184                         Message().data());
00185
00186                     winrt::get_self<InfoBarAutomationPeer>(peer)->RaiseOpenedEvent(Severity(), notificationString);
00187                 }
00188
00189                 winrt::VisualStateManager::GoToState(*this, L"InfoBarVisible", false);
00190                 winrt::AutomationProperties::SetAccessibilityView(*this, winrt::AccessibilityView::Control);
00191                 m_isVisible = true;
00192             }
00193             else
00194             {
00195                 if (notify && peer)
00196                 {
00197                     auto const notificationString = ResourceAccessor::GetLocalizedStringResource(SR_InfoBarClosedNotification);
00198
00199                     winrt::get_self<InfoBarAutomationPeer>(peer)->RaiseClosedEvent(Severity(), notificationString);
00200                 }
00201
00202                 winrt::VisualStateManager::GoToState(*this, L"InfoBarCollapsed", false);
00203                 winrt::AutomationProperties::SetAccessibilityView(*this, winrt::AccessibilityView::Raw);
00204                 m_isVisible = false;
00205             }
00206         }
00207     }
00208 }
00209
00210 void InfoBar::UpdateSeverity()
00211 {
00212     auto severityState = L"Informational";
00213
00214     switch (Severity())
00215     {
00216         case winrt::InfoBarSeverity::Success:
00217             severityState = L"Success";
00218             break;
00219         case winrt::InfoBarSeverity::Warning:
00220             severityState = L"Warning";
00221             break;
00222         case winrt::InfoBarSeverity::Error:
00223             severityState = L"Error";
00224             break;
00225     };
00226
00227     if (const auto iconTextblock = m_standardIconTextBlock.get())
00228     {
00229         winrt::AutomationProperties::SetName(iconTextblock, ResourceAccessor::GetLocalizedStringResource(GetIconSeverityLevelResourceName(Severity())));
00230     }
00231
00232     winrt::VisualStateManager::GoToState(*this, severityState, false);
00233 }
00234
00235 void InfoBar::UpdateIcon()
00236 {
00237     auto const templateSettings = winrt::get_self<::InfoBarTemplateSettings>(TemplateSettings());
00238     if (auto const source = IconSource())
00239     {
00240         templateSettings->IconElement(SharedHelpers::MakeIconElementFrom(source));
00241     }
00242     else
00243     {
00244         templateSettings->IconElement(nullptr);
00245     }
00246 }
00247
00248 void InfoBar::UpdateIconVisibility()
00249 {
00250     winrt::VisualStateManager::GoToState(*this, IsIconVisible() ? (IconSource() ? L"UserIconVisible" : L"StandardIconVisible") : L"NoIconVisible", false);
00251 }
00252
00253 void InfoBar::UpdateCloseButton()
00254 {
00255     winrt::VisualStateManager::GoToState(*this, IsClosable() ? L"CloseButtonVisible" : L"CloseButtonCollapsed", false);
00256 }
00257
00258 void InfoBar::OnForegroundChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args)
00259 {
00260     UpdateForeground();
00261 }
00262
00263 void InfoBar::UpdateForeground()
00264 {
00265     // If Foreground is set, then change Title and Message Foreground to match.
00266     winrt::VisualStateManager::GoToState(*this, ReadLocalValue(winrt::Control::ForegroundProperty()) == winrt::DependencyProperty::UnsetValue() ? L"ForegroundNotSet" : L"ForegroundSet", false);
00267 }
00268
00269 void InfoBar::UpdateContentPosition()
00270 {
00271     // If we don't have either a title or a message, then the content should move up
00272     winrt::VisualStateManager::GoToState(*this, Title().empty() && Message().empty() && !ActionButton() ? L"NoBannerContent" : L"BannerContent", false);
00273 }
00274 const winrt::hstring InfoBar::GetSeverityLevelResourceName(winrt::InfoBarSeverity severity)
00275 {
00276     switch (severity)
00277     {
00278     case winrt::InfoBarSeverity::Success: return SR_InfoBarSeveritySuccessName;
00279     case winrt::InfoBarSeverity::Warning: return SR_InfoBarSeverityWarningName;
00280     case winrt::InfoBarSeverity::Error: return SR_InfoBarSeverityErrorName;
00281     };
00282     return SR_InfoBarSeverityInformationalName;
00283 }
00284
00285 const winrt::hstring InfoBar::GetIconSeverityLevelResourceName(winrt::InfoBarSeverity severity)
00286 {
00287     switch (severity)
00288     {
00289     case winrt::InfoBarSeverity::Success: return SR_InfoBarIconSeveritySuccessName;
00290     case winrt::InfoBarSeverity::Warning: return SR_InfoBarIconSeverityWarningName;
00291     case winrt::InfoBarSeverity::Error: return SR_InfoBarIconSeverityErrorName;
00292     };
00293     return SR_InfoBarIconSeverityInformationalName;
00294 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

FlowLayoutDemoPage Member List

This is the complete list of members for FlowLayoutDemoPage, including all inherited members.
FlowLayoutDemoPage() FlowLayoutDemoPage [inline]
Generated on Sun Dec 1 2024 20:54:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollControllerScrollToRequestedEventArgs.cpp Source File

  • ScrollPresenter

ScrollControllerScrollToRequestedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "ScrollPresenter.h"
00009 #include "ScrollControllerScrollToRequestedEventArgs.h"
00010
00011 #include "ScrollControllerScrollToRequestedEventArgs.properties.cpp"
00012
00013 ScrollControllerScrollToRequestedEventArgs::ScrollControllerScrollToRequestedEventArgs(
00014     double offset,
00015     winrt::ScrollingScrollOptions const& options)
00016 {
00017     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR_DBL, METH_NAME, this,
00018         TypeLogging::ScrollOptionsToString(options).c_str(), offset);
00019
00020     m_offset = offset;
00021     m_options = options;
00022 }
00023
00024 double ScrollControllerScrollToRequestedEventArgs::Offset() const
00025 {
00026     return m_offset;
00027 }
00028
00029 winrt::ScrollingScrollOptions ScrollControllerScrollToRequestedEventArgs::Options() const
00030 {
00031     return m_options;
00032 }
00033
00034 int32_t ScrollControllerScrollToRequestedEventArgs::CorrelationId() const
00035 {
00036     return m_correlationId;
00037 }
00038
00039 void ScrollControllerScrollToRequestedEventArgs::CorrelationId(int32_t correlationId)
00040 {
00041     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, correlationId);
00042
00043     m_correlationId = correlationId;
00044 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewItem.h Source File

  • TreeView

TreeViewItem.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "TreeViewItemTemplateSettings.h"
00006 #include "TreeView.h"
00007 #include "TreeViewNode.h"
00008
00009 #include "TreeViewItem.g.h"
00010 #include "TreeViewItem.properties.h"
00011
00012 using TreeNodeSelectionState = TreeViewNode::TreeNodeSelectionState;
00013
00014 // When dragging an item over a collapsed folder, we expand the folder after 1s hovering.
00015 static int64_t const c_dragOverInterval = 1000 * 10000;
00016
00017 class TreeViewItem :
00018     public ReferenceTracker<TreeViewItem, winrt::implementation::TreeViewItemT>,
00019     public TreeViewItemProperties
00020 {
00021 public:
00022     TreeViewItem();
00023     ~TreeViewItem();
00024
00025     void UpdateMultipleSelection(TreeNodeSelectionState const& state);
00026     void UpdateIndentation(int depth);
00027     bool IsSelectedInternal();
00028
00029     // IControlOverrides
00030     void OnKeyDown(winrt::KeyRoutedEventArgs const& e);
00031     void OnDrop(winrt::DragEventArgs const& e);
00032     void OnDragOver(winrt::DragEventArgs const& e);
00033     void OnDragEnter(winrt::DragEventArgs const& e);
00034     void OnDragLeave(winrt::DragEventArgs const& e);
00035
00036     // IUIElementOverrides
00037     winrt::AutomationPeer OnCreateAutomationPeer();
00038
00039     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00040
00041     void SetItemsSource(winrt::TreeViewNode const& node, winrt::IInspectable const& value);
00042
00043 public:
00044     // IFrameworkElementOverrides
00045     void OnApplyTemplate();
00046     void UpdateSelection(bool isSelected);
00047     void UpdateSelectionVisual(TreeNodeSelectionState const& state);
00048
00049 private:
00050     template <typename T> T GetAncestorView();
00051     com_ptr<TreeView> AncestorTreeView();
00052     winrt::weak_ref<winrt::TreeView> m_ancestorTreeView{ nullptr };
00053     tracker_ref<winrt::CheckBox> m_selectionBox{ this };
00054     winrt::DispatcherTimer m_expandContentTimer{ nullptr };
00055     winrt::CheckBox::Checked_revoker m_checkedEventRevoker{};
00056     winrt::CheckBox::Unchecked_revoker m_uncheckedEventRevoker{};
00057     bool m_expansionCycled{ false };
00058     tracker_ref<winrt::UIElement> m_expandCollapseChevron{ this };
00059     winrt::event_token m_expandCollapseChevronPointerPressedToken{};
00060
00061     static constexpr PCWSTR c_multiSelectCheckBoxName = L"MultiSelectCheckBox";
00062     static constexpr PCWSTR c_expandCollapseChevronName = L"ExpandCollapseChevron";
00063
00064     void OnExpandContentTimerTick(const winrt::IInspectable& sender, const winrt::IInspectable& e);
00065     void RaiseExpandCollapseAutomationEvent(bool isExpanded);
00066     void OnCheckToggle(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00067     void OnIsSelectedChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& /*args*/);
00068     bool IsInReorderMode(winrt::VirtualKey keys);
00069     bool IsExpandCollapse(winrt::VirtualKey key);
00070     void ReorderItems(const winrt::ListView& listControl, const winrt::TreeViewNode& targetNode, int position, int childIndex, bool isForwards);
00071     void HandleReorder(winrt::VirtualKey key);
00072     bool HandleExpandCollapse(winrt::VirtualKey key);
00073     void HandleGamepadAInMultiselectMode(const winrt::TreeViewNode& node);
00074     bool TreeViewItem::ToggleSelection();
00075     void OnExpandCollapseChevronPointerPressed(
00076         const winrt::IInspectable& /*sender*/,
00077         const winrt::PointerRoutedEventArgs& args);
00078     void RecycleEvents(bool useSafeGet = false);
00079     winrt::TreeViewNode TreeNode();
00080     void UpdateNodeIsExpandedAsync(winrt::TreeViewNode const& node, bool isExpanded);
00081     bool IsInContentMode();
00082     TreeNodeSelectionState CheckBoxSelectionState(winrt::CheckBox const& checkBox);
00083     void UpdateTreeViewItemVisualState(TreeNodeSelectionState const& state);
00084     void RaiseSelectionChangeEvents(bool isSelected);
00085
00086     static bool constexpr IsDirectionalKey(winrt::VirtualKey key);
00087 };
00088
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PhasingTests Member List

This is the complete list of members for PhasingTests, including all inherited members.
expectedLastRealizedIndex | PhasingTests | [private]
ValidatePhaseInvokeAndOrdering() | PhasingTests | [inline]
ValidateXBindWithoutPhasing() | PhasingTests | [inline]
Generated on Sun Dec 1 2024 20:53:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommandBarFlyout/TextCommandBarFlyout.h Source File

  • CommandBarFlyout

TextCommandBarFlyout.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "TextCommandBarFlyout.g.h"
00007 #include "CommandBarFlyout.h"
00008
00009 enum class TextControlButtons
00010 {
00011     None = 0x0000,
00012     Cut = 0x0001,
00013     Copy = 0x0002,
00014     Paste = 0x0004,
00015     Bold = 0x0008,
00016     Italic = 0x0010,
00017     Underline = 0x0020,
00018     Undo = 0x0040,
00019     Redo = 0x0080,
00020     SelectAll = 0x0100,
00021 };
00022
00023 DECLARE_FLAG_ENUM_OPERATOR_OVERLOADS(TextControlButtons);
00024
00025 class TextCommandBarFlyout :
00026     public winrt::implementation::TextCommandBarFlyoutT<TextCommandBarFlyout, CommandBarFlyout>
00027 {
00028 public:
00029     ForwardRefToBaseReferenceTracker(CommandBarFlyout)
00030
00031     TextCommandBarFlyout();
00032
00033 private:
00034     void UpdateButtons();
00035
00036     TextControlButtons GetButtonsToAdd();
00037     static TextControlButtons GetTextBoxButtonsToAdd(winrt::TextBox const& textBox);
00038     static TextControlButtons GetTextBlockButtonsToAdd(winrt::TextBlock const& textBlock);
00039     static TextControlButtons GetRichEditBoxButtonsToAdd(winrt::RichEditBox const& richEditBox);
00040     static TextControlButtons GetRichTextBlockButtonsToAdd(winrt::RichTextBlock const& richTextBlock);
00041     static TextControlButtons GetPasswordBoxButtonsToAdd(winrt::PasswordBox const& passwordBox);
00042
00043     bool IsButtonInPrimaryCommands(TextControlButtons button);
00044
00045     void InitializeButtonWithUICommand(
00046         winrt::ButtonBase const& button,
00047         winrt::XamlUICommand const& uiCommand,
00048         std::function<void()> const& executeFunc);
00049
00050     void InitializeButtonWithProperties(
00051         winrt::ButtonBase const& button,
00052         ResourceIdType labelResourceId,
00053         ResourceIdType acceleratorKeyResourceId,
00054         ResourceIdType descriptionResourceId,
00055         std::function<void()> const& executeFunc);
00056
00057     void InitializeButtonWithProperties(
00058         winrt::ButtonBase const& button,
00059         ResourceIdType labelResourceId,
00060         winrt::Symbol const& symbol,
00061         ResourceIdType acceleratorKeyResourceId,
00062         ResourceIdType descriptionResourceId,
00063         std::function<void()> const& executeFunc);
00064
00065     void ExecuteCutCommand();
00066     void ExecuteCopyCommand();
00067     void ExecutePasteCommand();
00068     void ExecuteBoldCommand();
00069     void ExecuteItalicCommand();
00070     void ExecuteUnderlineCommand();
00071     void ExecuteUndoCommand();
00072     void ExecuteRedoCommand();
00073     void ExecuteSelectAllCommand();
00074
00075     winrt::ICommandBarElement GetButton(TextControlButtons button);
00076
00077     std::map<TextControlButtons, winrt::ICommandBarElement> m_buttons;
00078     winrt::AppBarButton m_proofingButton{ nullptr };
00079
00080     std::vector<winrt::XamlUICommand::ExecuteRequested_revoker> m_buttonCommandRevokers;
00081     std::vector<winrt::ButtonBase::Click_revoker> m_buttonClickRevokers;
00082     std::vector<winrt::ToggleButton::Checked_revoker> m_toggleButtonCheckedRevokers;
00083     std::vector<winrt::ToggleButton::Unchecked_revoker> m_toggleButtonUncheckedRevokers;
00084
00085     winrt::FrameworkElement::Loaded_revoker m_proofingButtonLoadedRevoker{};
00086
00087     std::vector<winrt::MenuFlyoutItem::Click_revoker> m_proofingMenuItemClickRevokers;
00088     std::vector<winrt::ToggleMenuFlyoutItem::Click_revoker> m_proofingMenuToggleItemClickRevokers;
00089
00090     bool m_isSettingToggleButtonState = false;
00091 };
00092
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ItemsView.properties.cpp Source File

  • Generated

ItemsView.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "ItemsView.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(ItemsView)
00012 }
00013
00014 #include "ItemsView.g.cpp"
00015
00016 GlobalDependencyProperty ItemsViewProperties::s_CurrentItemIndexProperty{ nullptr };
00017 GlobalDependencyProperty ItemsViewProperties::s_IsItemInvokedEnabledProperty{ nullptr };
00018 GlobalDependencyProperty ItemsViewProperties::s_ItemsSourceProperty{ nullptr };
00019 GlobalDependencyProperty ItemsViewProperties::s_ItemTemplateProperty{ nullptr };
00020 GlobalDependencyProperty ItemsViewProperties::s_ItemTransitionProviderProperty{ nullptr };
00021 GlobalDependencyProperty ItemsViewProperties::s_LayoutProperty{ nullptr };
00022 GlobalDependencyProperty ItemsViewProperties::s_ScrollViewProperty{ nullptr };
00023 GlobalDependencyProperty ItemsViewProperties::s_SelectedItemProperty{ nullptr };
00024 GlobalDependencyProperty ItemsViewProperties::s_SelectionModeProperty{ nullptr };
00025 GlobalDependencyProperty ItemsViewProperties::s_VerticalScrollControllerProperty{ nullptr };
00026
00027 ItemsViewProperties::ItemsViewProperties()
00028     : m_itemInvokedEventSource{static_cast<ItemsView*>(this)}
00029     , m_selectionChangedEventSource{static_cast<ItemsView*>(this)}
00030 {
00031     EnsureProperties();
00032 }
00033
00034 void ItemsViewProperties::EnsureProperties()
00035 {
00036     if (!s_CurrentItemIndexProperty)
00037     {
00038         s_CurrentItemIndexProperty =
00039             InitializeDependencyProperty(
00040                 L"CurrentItemIndex",
00041                 winrt::name_of<int>(),
00042                 winrt::name_of<winrt::ItemsView>(),
00043                 false /* isAttached */,
00044                 ValueHelper<int>::BoxValueIfNecessary(-1),
00045                 winrt::PropertyChangedCallback(&OnCurrentItemIndexPropertyChanged));
00046     }
00047     if (!s_IsItemInvokedEnabledProperty)
00048     {
00049         s_IsItemInvokedEnabledProperty =
00050             InitializeDependencyProperty(
00051                 L"IsItemInvokedEnabled",
00052                 winrt::name_of<bool>(),
00053                 winrt::name_of<winrt::ItemsView>(),
00054                 false /* isAttached */,
00055                 ValueHelper<bool>::BoxValueIfNecessary(false),
00056                 winrt::PropertyChangedCallback(&OnIsItemInvokedEnabledPropertyChanged));
00057     }
00058     if (!s_ItemsSourceProperty)
00059     {
00060         s_ItemsSourceProperty =
00061             InitializeDependencyProperty(
00062                 L"ItemsSource",
00063                 winrt::name_of<winrt::IInspectable>(),
00064                 winrt::name_of<winrt::ItemsView>(),
00065                 false /* isAttached */,
00066                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00067                 winrt::PropertyChangedCallback(&OnItemsSourcePropertyChanged));
00068     }
00069     if (!s_ItemTemplateProperty)
00070     {
00071         s_ItemTemplateProperty =
00072             InitializeDependencyProperty(
00073                 L"ItemTemplate",
00074                 winrt::name_of<winrt::IElementFactory>(),
00075                 winrt::name_of<winrt::ItemsView>(),
00076                 false /* isAttached */,
00077                 ValueHelper<winrt::IElementFactory>::BoxedDefaultValue(),
00078                 winrt::PropertyChangedCallback(&OnItemTemplatePropertyChanged));
00079     }
00080     if (!s_ItemTransitionProviderProperty)
00081     {
00082         s_ItemTransitionProviderProperty =
00083             InitializeDependencyProperty(
00084                 L"ItemTransitionProvider",
00085                 winrt::name_of<winrt::ItemCollectionTransitionProvider>(),
00086                 winrt::name_of<winrt::ItemsView>(),
00087                 false /* isAttached */,
00088                 ValueHelper<winrt::ItemCollectionTransitionProvider>::BoxedDefaultValue(),
00089                 winrt::PropertyChangedCallback(&OnItemTransitionProviderPropertyChanged));
00090     }
00091     if (!s_LayoutProperty)
00092     {
00093         s_LayoutProperty =
00094             InitializeDependencyProperty(
00095                 L"Layout",
00096                 winrt::name_of<winrt::Layout>(),
00097                 winrt::name_of<winrt::ItemsView>(),
00098                 false /* isAttached */,
00099                 ValueHelper<winrt::Layout>::BoxedDefaultValue(),
00100                 winrt::PropertyChangedCallback(&OnLayoutPropertyChanged));
00101     }
00102     if (!s_ScrollViewProperty)
00103     {
00104         s_ScrollViewProperty =
00105             InitializeDependencyProperty(
00106                 L"ScrollView",
00107                 winrt::name_of<winrt::ScrollView>(),
00108                 winrt::name_of<winrt::ItemsView>(),
00109                 false /* isAttached */,
00110                 ValueHelper<winrt::ScrollView>::BoxedDefaultValue(),
00111                 winrt::PropertyChangedCallback(&OnScrollViewPropertyChanged));
00112     }
00113     if (!s_SelectedItemProperty)
00114     {
00115         s_SelectedItemProperty =
00116             InitializeDependencyProperty(
00117                 L"SelectedItem",
00118                 winrt::name_of<winrt::IInspectable>(),
00119                 winrt::name_of<winrt::ItemsView>(),
00120                 false /* isAttached */,
00121                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00122                 winrt::PropertyChangedCallback(&OnSelectedItemPropertyChanged));
00123     }
00124     if (!s_SelectionModeProperty)
00125     {
00126         s_SelectionModeProperty =
00127             InitializeDependencyProperty(
00128                 L"SelectionMode",
00129                 winrt::name_of<winrt::ItemsViewSelectionMode>(),
00130                 winrt::name_of<winrt::ItemsView>(),
00131                 false /* isAttached */,
00132                 ValueHelper<winrt::ItemsViewSelectionMode>::BoxValueIfNecessary(ItemsView::s_defaultSelectionMode),
00133                 winrt::PropertyChangedCallback(&OnSelectionModePropertyChanged));
00134     }
00135     if (!s_VerticalScrollControllerProperty)
00136     {
00137         s_VerticalScrollControllerProperty =
00138             InitializeDependencyProperty(
00139                 L"VerticalScrollController",
00140                 winrt::name_of<winrt::IScrollController>(),
00141                 winrt::name_of<winrt::ItemsView>(),
00142                 false /* isAttached */,
00143                 ValueHelper<winrt::IScrollController>::BoxedDefaultValue(),
00144                 winrt::PropertyChangedCallback(&OnVerticalScrollControllerPropertyChanged));
00145     }
00146 }
00147
00148 void ItemsViewProperties::ClearProperties()
00149 {
00150     s_CurrentItemIndexProperty = nullptr;
00151     s_IsItemInvokedEnabledProperty = nullptr;
00152     s_ItemsSourceProperty = nullptr;
00153     s_ItemTemplateProperty = nullptr;
00154     s_ItemTransitionProviderProperty = nullptr;
00155     s_LayoutProperty = nullptr;
00156     s_ScrollViewProperty = nullptr;
00157     s_SelectedItemProperty = nullptr;
00158     s_SelectionModeProperty = nullptr;
00159     s_VerticalScrollControllerProperty = nullptr;
00160 }
00161
00162 void ItemsViewProperties::OnCurrentItemIndexPropertyChanged(
00163     winrt::DependencyObject const& sender,
00164     winrt::DependencyPropertyChangedEventArgs const& args)
00165 {
00166     auto owner = sender.as<winrt::ItemsView>();
00167     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00168 }
00169
00170 void ItemsViewProperties::OnIsItemInvokedEnabledPropertyChanged(
00171     winrt::DependencyObject const& sender,
00172     winrt::DependencyPropertyChangedEventArgs const& args)
00173 {
00174     auto owner = sender.as<winrt::ItemsView>();
00175     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00176 }
00177
00178 void ItemsViewProperties::OnItemsSourcePropertyChanged(
00179     winrt::DependencyObject const& sender,
00180     winrt::DependencyPropertyChangedEventArgs const& args)
00181 {
00182     auto owner = sender.as<winrt::ItemsView>();
00183     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00184 }
00185
00186 void ItemsViewProperties::OnItemTemplatePropertyChanged(
00187     winrt::DependencyObject const& sender,
00188     winrt::DependencyPropertyChangedEventArgs const& args)
00189 {
00190     auto owner = sender.as<winrt::ItemsView>();
00191     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00192 }
00193
00194 void ItemsViewProperties::OnItemTransitionProviderPropertyChanged(
00195     winrt::DependencyObject const& sender,
00196     winrt::DependencyPropertyChangedEventArgs const& args)
00197 {
00198     auto owner = sender.as<winrt::ItemsView>();
00199     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00200 }
00201
00202 void ItemsViewProperties::OnLayoutPropertyChanged(
00203     winrt::DependencyObject const& sender,
00204     winrt::DependencyPropertyChangedEventArgs const& args)
00205 {
00206     auto owner = sender.as<winrt::ItemsView>();
00207     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00208 }
00209
00210 void ItemsViewProperties::OnScrollViewPropertyChanged(
00211     winrt::DependencyObject const& sender,
00212     winrt::DependencyPropertyChangedEventArgs const& args)
00213 {
00214     auto owner = sender.as<winrt::ItemsView>();
00215     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00216 }
00217
00218 void ItemsViewProperties::OnSelectedItemPropertyChanged(
00219     winrt::DependencyObject const& sender,
00220     winrt::DependencyPropertyChangedEventArgs const& args)
00221 {
00222     auto owner = sender.as<winrt::ItemsView>();
00223     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00224 }
00225
00226 void ItemsViewProperties::OnSelectionModePropertyChanged(
00227     winrt::DependencyObject const& sender,
00228     winrt::DependencyPropertyChangedEventArgs const& args)
00229 {
00230     auto owner = sender.as<winrt::ItemsView>();
00231     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00232 }
00233
00234 void ItemsViewProperties::OnVerticalScrollControllerPropertyChanged(
00235     winrt::DependencyObject const& sender,
00236     winrt::DependencyPropertyChangedEventArgs const& args)
00237 {
00238     auto owner = sender.as<winrt::ItemsView>();
00239     winrt::get_self<ItemsView>(owner)->OnPropertyChanged(args);
00240 }
00241
00242 void ItemsViewProperties::CurrentItemIndex(int value)
00243 {
00244     [[gsl::suppress(con)]]
00245     {
00246     static_cast<ItemsView*>(this)->SetValue(s_CurrentItemIndexProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00247     }
00248 }
00249
00250 int ItemsViewProperties::CurrentItemIndex()
00251 {
00252     return ValueHelper<int>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_CurrentItemIndexProperty));
00253 }
00254
00255 void ItemsViewProperties::IsItemInvokedEnabled(bool value)
00256 {
00257     [[gsl::suppress(con)]]
00258     {
00259     static_cast<ItemsView*>(this)->SetValue(s_IsItemInvokedEnabledProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00260     }
00261 }
00262
00263 bool ItemsViewProperties::IsItemInvokedEnabled()
00264 {
00265     return ValueHelper<bool>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_IsItemInvokedEnabledProperty));
00266 }
00267
00268 void ItemsViewProperties::ItemsSource(winrt::IInspectable const& value)
00269 {
00270     [[gsl::suppress(con)]]
00271     {
00272     static_cast<ItemsView*>(this)->SetValue(s_ItemsSourceProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00273     }
00274 }
00275
00276 winrt::IInspectable ItemsViewProperties::ItemsSource()
00277 {
00278     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_ItemsSourceProperty));
00279 }
00280
00281 void ItemsViewProperties::ItemTemplate(winrt::IElementFactory const& value)
00282 {
00283     [[gsl::suppress(con)]]
00284     {
00285     static_cast<ItemsView*>(this)->SetValue(s_ItemTemplateProperty, ValueHelper<winrt::IElementFactory>::BoxValueIfNecessary(value));
00286     }
00287 }
00288
00289 winrt::IElementFactory ItemsViewProperties::ItemTemplate()
00290 {
00291     return ValueHelper<winrt::IElementFactory>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_ItemTemplateProperty));
00292 }
00293
00294 void ItemsViewProperties::ItemTransitionProvider(winrt::ItemCollectionTransitionProvider const& value)
00295 {
00296     [[gsl::suppress(con)]]
00297     {
00298     static_cast<ItemsView*>(this)->SetValue(s_ItemTransitionProviderProperty, ValueHelper<winrt::ItemCollectionTransitionProvider>::BoxValueIfNecessary(value));
00299     }
00300 }
00301
00302 winrt::ItemCollectionTransitionProvider ItemsViewProperties::ItemTransitionProvider()
00303 {
00304     return ValueHelper<winrt::ItemCollectionTransitionProvider>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_ItemTransitionProviderProperty));
00305 }
00306
00307 void ItemsViewProperties::Layout(winrt::Layout const& value)
00308 {
00309     [[gsl::suppress(con)]]
00310     {
00311     static_cast<ItemsView*>(this)->SetValue(s_LayoutProperty, ValueHelper<winrt::Layout>::BoxValueIfNecessary(value));
00312     }
00313 }
00314
00315 winrt::Layout ItemsViewProperties::Layout()
00316 {
00317     return ValueHelper<winrt::Layout>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_LayoutProperty));
00318 }
00319
00320 void ItemsViewProperties::ScrollView(winrt::ScrollView const& value)
00321 {
00322     [[gsl::suppress(con)]]
00323     {
00324     static_cast<ItemsView*>(this)->SetValue(s_ScrollViewProperty, ValueHelper<winrt::ScrollView>::BoxValueIfNecessary(value));
00325     }
00326 }
00327
00328 winrt::ScrollView ItemsViewProperties::ScrollView()
00329 {
00330     return ValueHelper<winrt::ScrollView>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_ScrollViewProperty));
00331 }
00332
00333 void ItemsViewProperties::SelectedItem(winrt::IInspectable const& value)
00334 {
00335     [[gsl::suppress(con)]]
00336     {
00337     static_cast<ItemsView*>(this)->SetValue(s_SelectedItemProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00338     }
00339 }
00340
00341 winrt::IInspectable ItemsViewProperties::SelectedItem()
00342 {
00343     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_SelectedItemProperty));
00344 }
00345
00346 void ItemsViewProperties::SelectionMode(winrt::ItemsViewSelectionMode const& value)
00347 {
00348     [[gsl::suppress(con)]]
00349     {
00350     static_cast<ItemsView*>(this)->SetValue(s_SelectionModeProperty, ValueHelper<winrt::ItemsViewSelectionMode>::BoxValueIfNecessary(value));
00351     }
00352 }
00353
00354 winrt::ItemsViewSelectionMode ItemsViewProperties::SelectionMode()
00355 {
00356     return ValueHelper<winrt::ItemsViewSelectionMode>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_SelectionModeProperty));
00357 }
00358
00359 void ItemsViewProperties::VerticalScrollController(winrt::IScrollController const& value)
00360 {
00361     [[gsl::suppress(con)]]
00362     {
00363     static_cast<ItemsView*>(this)->SetValue(s_VerticalScrollControllerProperty, ValueHelper<winrt::IScrollController>::BoxValueIfNecessary(value));
00364     }
00365 }
00366
00367 winrt::IScrollController ItemsViewProperties::VerticalScrollController()
00368 {
00369     return ValueHelper<winrt::IScrollController>::CastOrUnbox(static_cast<ItemsView*>(this)->GetValue(s_VerticalScrollControllerProperty));
00370 }
00371
00372 winrt::event_token ItemsViewProperties::ItemInvoked(winrt::TypedEventHandler<winrt::ItemsView, winrt::ItemsViewItemInvokedEventArgs> const& value)
00373 {
00374     return m_itemInvokedEventSource.add(value);
00375 }
00376
00377 void ItemsViewProperties::ItemInvoked(winrt::event_token const& token)
00378 {
00379     m_itemInvokedEventSource.remove(token);
00380 }
00381
00382 winrt::event_token ItemsViewProperties::SelectionChanged(winrt::TypedEventHandler<winrt::ItemsView, winrt::ItemsViewSelectionChangedEventArgs> const& value)
00383 {
00384     return m_selectionChangedEventSource.add(value);
00385 }
00386
00387 void ItemsViewProperties::SelectionChanged(winrt::event_token const& token)
00388 {
00389     m_selectionChangedEventSource.remove(token);
00390 }
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

XamlControlsResources Member List

This is the complete list of members for XamlControlsResources, including all inherited members.
abi_enter() | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
CheckThread() | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
ClearProperties() | XamlControlsResourcesProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< XamlControlsResources > &&self) noexcept | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline, static]
EnsureProperties() | XamlControlsResourcesProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
EnsureRevealLights(winrt::UIElement const &element) | XamlControlsResources | [static]
final_release(std::unique_ptr< XamlControlsResources > &&self) | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
GetInner() | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
IsOnThread() | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | XamlControlsResources |
OnUseCompactResourcesPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | XamlControlsResourcesProperties | [static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable > | [inline]
s_UseCompactResourcesProperty | XamlControlsResourcesProperties | [static]
UpdateAcrylicBrushesDarkTheme(const winrt::IInspectable themeDictionary) | XamlControlsResources |
UpdateAcrylicBrushesLightTheme(const winrt::IInspectable themeDictionary) | XamlControlsResources |
UpdateSource() | XamlControlsResources | [private]
UpdateTintLuminosityOpacity(winrt::Microsoft::UI::Xaml::Media::AcrylicBrush brush, double luminosityValue) | XamlControlsResources | [private]
UseCompactResources(bool value) | XamlControlsResourcesProperties |
UseCompactResources() | XamlControlsResourcesProperties |
UseCompactResourcesProperty() | XamlControlsResourcesProperties | [inline, static]
XamlControlsResources() | XamlControlsResources |
XamlControlsResourcesProperties() | XamlControlsResourcesProperties |
Generated on Sun Dec 1 2024 20:53:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/TestUI/PullToRefreshPage.xaml.cs Source File

  • PullToRefresh
  • TestUI

PullToRefreshPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.IO;
00007 using System.Linq;
00008 using System.Runtime.InteropServices.WindowsRuntime;
00009 using Windows.Foundation;
00010 using Windows.Foundation.Collections;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Controls;
00013 using Microsoft.UI.Xaml.Controls.Primitives;
00014 using Microsoft.UI.Xaml.Data;
00015 using Microsoft.UI.Xaml.Input;
00016 using Microsoft.UI.Xaml.Media;
00017 using Microsoft.UI.Xaml.Navigation;
00018
00019 // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
00020
00021 namespace PTR_TestUI
00022 {
00023     /// <summary>
00024     /// An empty page that can be used on its own or navigated to within a Frame.
00025     /// </summary>
00026     public sealed partial class PullToRefreshPage : Page
00027     {
00028         public PullToRefreshPage()
00029         {
00030             this.InitializeComponent();
00031         }
00032     }
00033 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MapIconProperties Member List

This is the complete list of members for MapIconProperties, including all inherited members.
ClearProperties() | MapIconProperties | [static]
EnsureProperties() | MapIconProperties | [static]
Location(winrt::Geopoint const &value) | MapIconProperties |
Location() | MapIconProperties |
LocationProperty() | MapIconProperties | [inline, static]
MapIconProperties() | MapIconProperties |
OnLocationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | MapIconProperties | [static]
s_LocationProperty | MapIconProperties | [static]
Generated on Sun Dec 1 2024 20:52:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshContainer/TestUI/AnimationHandler.cs Source File

  • PullToRefresh
  • RefreshContainer
  • TestUI

AnimationHandler.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using System;
00006 using System.Collections.Generic;
00007 using System.Numerics;
00008 using System.Text;
00009 using Microsoft.UI.Composition;
00010 using Microsoft.UI.Composition.Interactions;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Controls;
00013 using Microsoft.UI.Xaml.Hosting;
00014 using Microsoft.UI.Private.Controls;
00015
00016 namespace MUXControlsTestApp
00017 {
00018     class AnimationHandler : IAdapterAnimationHandler
00019     {
00020         Compositor compositor;
00021         RefreshPullDirection refreshPullDirection;
00022         UIElement refreshVisualizer;
00023         Visual refreshVisualizerVisual;
00024         UIElement infoProvider;
00025         Visual infoProviderVisual;
00026         InteractionTracker interactionTracker;
00027
00028         bool interactionAnimationNeedsUpdating = true;
00029         bool refreshRequestedAnimationNeedsUpdating = true;
00030         bool refreshCompletedAnimationNeedsUpdating = true;
00031
00032         ExpressionAnimation refreshVisualizerVisualOffsetAnimation;
00033         ExpressionAnimation infoProviderOffsetAnimation;
00034         ScalarKeyFrameAnimation refreshVisualizerRefreshRequestedAnimation;
00035         ScalarKeyFrameAnimation infoProviderRefreshRequestedAnimation;
00036         ScalarKeyFrameAnimation refreshVisualizerRefreshCompletedAnimation;
00037         ScalarKeyFrameAnimation infoProviderRefreshCompletedAnimation;
00038
00039         CompositionScopedBatch refreshCompletedScopedBatch;
00040
00041         public AnimationHandler(UIElement container, RefreshPullDirection pullDirection)
00042         {
00043             if (container != null)
00044             {
00045                 var vis = ElementCompositionPreview.GetElementVisual(container);
00046                 compositor = vis.Compositor;
00047             }
00048             refreshPullDirection = pullDirection;
00049         }
00050
00051         public void InteractionTrackerAnimation(UIElement refreshVisualizer, UIElement infoProvider, InteractionTracker interactionTracker)
00052         {
00053             ValidateAndStoreParameters(refreshVisualizer, infoProvider, interactionTracker);
00054
00055             if (interactionTracker == null)
00056             {
00057                 this.interactionTracker = null;
00058                 return;
00059             }
00060
00061             if ((refreshVisualizerVisualOffsetAnimation == null || infoProviderOffsetAnimation == null || interactionAnimationNeedsUpdating) && compositor != null)
00062             {
00063                 switch (refreshPullDirection)
00064                 {
00065                     case RefreshPullDirection.TopToBottom:
00066                         refreshVisualizerVisualOffsetAnimation = compositor.CreateExpressionAnimation(
00067                             "-refreshVisualizerVisual.Size.Y + min(refreshVisualizerVisual.Size.Y, -interactionTracker.Position.Y)");
00068
00069                         infoProviderOffsetAnimation = compositor.CreateExpressionAnimation(
00070                             "min(refreshVisualizerVisual.Size.Y, max(-interactionTracker.Position.Y, 0))");
00071
00072                         break;
00073                     case RefreshPullDirection.BottomToTop:
00074                         refreshVisualizerVisualOffsetAnimation = compositor.CreateExpressionAnimation(
00075                             "refreshVisualizerVisual.Size.Y - min(refreshVisualizerVisual.Size.Y, interactionTracker.Position.Y)");
00076
00077                         infoProviderOffsetAnimation = compositor.CreateExpressionAnimation(
00078                             "max(-refreshVisualizerVisual.Size.Y, min(-interactionTracker.Position.Y, 0))");
00079
00080                         break;
00081                     case RefreshPullDirection.LeftToRight:
00082                         refreshVisualizerVisualOffsetAnimation = compositor.CreateExpressionAnimation(
00083                             "-refreshVisualizerVisual.Size.X + min(refreshVisualizerVisual.Size.X, -interactionTracker.Position.X)");
00084
00085                         infoProviderOffsetAnimation = compositor.CreateExpressionAnimation(
00086                             "min(refreshVisualizerVisual.Size.X, max(-interactionTracker.Position.X, 0))");
00087
00088                         break;
00089                     case RefreshPullDirection.RightToLeft:
00090                         refreshVisualizerVisualOffsetAnimation = compositor.CreateExpressionAnimation(
00091                             "refreshVisualizerVisual.Size.X - min(refreshVisualizerVisual.Size.X, interactionTracker.Position.X)");
00092
00093                         infoProviderOffsetAnimation = compositor.CreateExpressionAnimation(
00094                             "max(-refreshVisualizerVisual.Size.X, min(-interactionTracker.Position.X, 0))");
00095
00096                         break;
00097                 }
00098
00099                 refreshVisualizerVisualOffsetAnimation.SetReferenceParameter("refreshVisualizerVisual", refreshVisualizerVisual);
00100                 refreshVisualizerVisualOffsetAnimation.SetReferenceParameter("interactionTracker", this.interactionTracker);
00101
00102                 infoProviderOffsetAnimation.SetReferenceParameter("refreshVisualizerVisual", refreshVisualizerVisual);
00103                 infoProviderOffsetAnimation.SetReferenceParameter("infoProviderVisual", infoProviderVisual);
00104                 infoProviderOffsetAnimation.SetReferenceParameter("interactionTracker", this.interactionTracker);
00105
00106                 interactionAnimationNeedsUpdating = false;
00107             }
00108
00109             if (refreshVisualizerVisualOffsetAnimation != null && infoProviderOffsetAnimation != null)
00110             {
00111                 refreshVisualizerVisual.Properties.InsertVector3("Translation", new Vector3(0.0f, 0.0f, 0.0f));
00112                 infoProviderVisual.Properties.InsertVector3("Translation", new Vector3(0.0f, 0.0f, 0.0f));
00113
00114                 string animatedProperty = GetAnimatedPropertyName();
00115                 refreshVisualizerVisual.StartAnimation(animatedProperty, refreshVisualizerVisualOffsetAnimation);
00116                 infoProviderVisual.StartAnimation(animatedProperty, infoProviderOffsetAnimation);
00117             }
00118         }
00119
00120         public void RefreshRequestedAnimation(UIElement refreshVisualizer, UIElement infoProvider, double executionRatio)
00121         {
00122             ValidateAndStoreParameters(refreshVisualizer, infoProvider, null);
00123
00124             if ((refreshVisualizerRefreshRequestedAnimation == null || infoProviderRefreshRequestedAnimation == null || refreshRequestedAnimationNeedsUpdating) && compositor != null)
00125             {
00126                 refreshVisualizerRefreshRequestedAnimation = compositor.CreateScalarKeyFrameAnimation();
00127                 refreshVisualizerRefreshRequestedAnimation.Duration = TimeSpan.FromMilliseconds(100);
00128                 infoProviderRefreshRequestedAnimation = compositor.CreateScalarKeyFrameAnimation();
00129                 infoProviderRefreshRequestedAnimation.Duration = TimeSpan.FromMilliseconds(100);
00130                 switch (refreshPullDirection)
00131                 {
00132                     case RefreshPullDirection.TopToBottom:
00133                         refreshVisualizerRefreshRequestedAnimation.InsertKeyFrame(1.0f, -(refreshVisualizerVisual.Size.Y * (1 - (float)executionRatio)));
00134                         infoProviderRefreshRequestedAnimation.InsertKeyFrame(1.0f, refreshVisualizerVisual.Size.Y * (float)executionRatio);
00135                         break;
00136                     case RefreshPullDirection.BottomToTop:
00137                         refreshVisualizerRefreshRequestedAnimation.InsertKeyFrame(1.0f, refreshVisualizerVisual.Size.Y * (1 - (float)executionRatio));
00138                         infoProviderRefreshRequestedAnimation.InsertKeyFrame(1.0f, -refreshVisualizerVisual.Size.Y * (float)executionRatio);
00139                         break;
00140                     case RefreshPullDirection.LeftToRight:
00141                         refreshVisualizerRefreshRequestedAnimation.InsertKeyFrame(1.0f, -(refreshVisualizerVisual.Size.X * (1 - (float)executionRatio)));
00142                         infoProviderRefreshRequestedAnimation.InsertKeyFrame(1.0f, refreshVisualizerVisual.Size.X * (float)executionRatio);
00143                         break;
00144                     case RefreshPullDirection.RightToLeft:
00145                         refreshVisualizerRefreshRequestedAnimation.InsertKeyFrame(1.0f, refreshVisualizerVisual.Size.X * (1 - (float)executionRatio));
00146                         infoProviderRefreshRequestedAnimation.InsertKeyFrame(1.0f, -refreshVisualizerVisual.Size.X * (float)executionRatio);
00147                         break;
00148                 }
00149                 refreshRequestedAnimationNeedsUpdating = false;
00150             }
00151
00152             if (refreshVisualizerRefreshRequestedAnimation != null && infoProviderRefreshRequestedAnimation != null)
00153             {
00154                 string animatedProperty = GetAnimatedPropertyName();
00155                 refreshVisualizerVisual.StartAnimation(animatedProperty, refreshVisualizerRefreshRequestedAnimation);
00156                 infoProviderVisual.StartAnimation(animatedProperty, infoProviderRefreshRequestedAnimation);
00157             }
00158         }
00159
00160         public void RefreshCompletedAnimation(UIElement refreshVisualizer, UIElement infoProvider)
00161         {
00162             ValidateAndStoreParameters(refreshVisualizer, infoProvider, null);
00163
00164             if ((refreshVisualizerRefreshCompletedAnimation == null || infoProviderRefreshCompletedAnimation == null || refreshCompletedAnimationNeedsUpdating) && compositor != null)
00165             {
00166                 refreshVisualizerRefreshCompletedAnimation = compositor.CreateScalarKeyFrameAnimation();
00167                 refreshVisualizerRefreshCompletedAnimation.Duration = TimeSpan.FromMilliseconds(100);
00168                 infoProviderRefreshCompletedAnimation = compositor.CreateScalarKeyFrameAnimation();
00169                 infoProviderRefreshCompletedAnimation.Duration = TimeSpan.FromMilliseconds(100);
00170                 infoProviderRefreshCompletedAnimation.InsertKeyFrame(1.0f, 0.0f);
00171
00172                 switch (refreshPullDirection)
00173                 {
00174                     case RefreshPullDirection.TopToBottom:
00175                         refreshVisualizerRefreshCompletedAnimation.InsertKeyFrame(1.0f, -(refreshVisualizerVisual.Size.Y));
00176                         break;
00177                     case RefreshPullDirection.BottomToTop:
00178                         refreshVisualizerRefreshCompletedAnimation.InsertKeyFrame(1.0f, refreshVisualizerVisual.Size.Y);
00179                         break;
00180                     case RefreshPullDirection.LeftToRight:
00181                         refreshVisualizerRefreshCompletedAnimation.InsertKeyFrame(1.0f, -(refreshVisualizerVisual.Size.X));
00182                         break;
00183                     case RefreshPullDirection.RightToLeft:
00184                         refreshVisualizerRefreshCompletedAnimation.InsertKeyFrame(1.0f, refreshVisualizerVisual.Size.X);
00185                         break;
00186                 }
00187                 refreshCompletedAnimationNeedsUpdating = false;
00188             }
00189
00190             if (compositor != null)
00191             {
00192                 refreshCompletedScopedBatch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
00193                 refreshCompletedScopedBatch.Completed += RefreshCompletedBatchCompleted;
00194             }
00195
00196             if (refreshVisualizerRefreshCompletedAnimation != null && infoProviderRefreshCompletedAnimation != null)
00197             {
00198                 string animatedProperty = GetAnimatedPropertyName();
00199                 refreshVisualizerVisual.StartAnimation(animatedProperty, refreshVisualizerRefreshCompletedAnimation);
00200                 infoProviderVisual.StartAnimation(animatedProperty, infoProviderRefreshCompletedAnimation);
00201             }
00202
00203             if (refreshCompletedScopedBatch != null)
00204             {
00205                 refreshCompletedScopedBatch.End();
00206             }
00207         }
00208
00209         //PrivateHelpers
00210         private void ValidateAndStoreParameters(UIElement refreshVisualizer, UIElement infoProvider, InteractionTracker interactionTracker)
00211         {
00212             if (refreshVisualizer != null && this.refreshVisualizer != refreshVisualizer)
00213             {
00214                 refreshVisualizerVisual = ElementCompositionPreview.GetElementVisual(refreshVisualizer);
00215                 this.refreshVisualizer = refreshVisualizer;
00216                 interactionAnimationNeedsUpdating = true;
00217                 refreshRequestedAnimationNeedsUpdating = true;
00218                 refreshCompletedAnimationNeedsUpdating = true;
00219
00220                 if (compositor == null)
00221                 {
00222                     compositor = refreshVisualizerVisual.Compositor;
00223                 }
00224
00225                 ElementCompositionPreview.SetIsTranslationEnabled(refreshVisualizer, true);
00226             }
00227
00228             if (infoProvider != null && this.infoProvider != infoProvider)
00229             {
00230                 infoProviderVisual = ElementCompositionPreview.GetElementVisual(infoProvider);
00231                 this.infoProvider = infoProvider;
00232                 interactionAnimationNeedsUpdating = true;
00233                 refreshRequestedAnimationNeedsUpdating = true;
00234                 refreshCompletedAnimationNeedsUpdating = true;
00235
00236                 if (compositor == null)
00237                 {
00238                     compositor = infoProviderVisual.Compositor;
00239                 }
00240
00241                 ElementCompositionPreview.SetIsTranslationEnabled(infoProvider, true);
00242             }
00243
00244             if (interactionTracker != null && this.interactionTracker != interactionTracker)
00245             {
00246                 this.interactionTracker = interactionTracker;
00247                 interactionAnimationNeedsUpdating = true;
00248                 refreshRequestedAnimationNeedsUpdating = true;
00249                 refreshCompletedAnimationNeedsUpdating = true;
00250             }
00251         }
00252
00253         private void RefreshCompletedBatchCompleted(Object sender, CompositionBatchCompletedEventArgs args)
00254         {
00255             InteractionTrackerAnimation(refreshVisualizer, infoProvider, interactionTracker);
00256         }
00257
00258         private bool IsOrientationVertical()
00259         {
00260             return (refreshPullDirection == RefreshPullDirection.TopToBottom || refreshPullDirection == RefreshPullDirection.BottomToTop);
00261         }
00262
00263         String GetAnimatedPropertyName()
00264         {
00265             String animatedProperty = "Translation";
00266
00267             if (IsOrientationVertical())
00268             {
00269                 animatedProperty += ".Y";
00270             }
00271             else
00272             {
00273                 animatedProperty += ".X";
00274             }
00275
00276             return animatedProperty;
00277         }
00278     }
00279 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DropDownButton::DropDownButtonFactory Member List

This is the complete list of members for DropDownButton::DropDownButtonFactory, including all inherited members.
Create(UIObject element) DropDownButton::DropDownButtonFactory [inline]
Generated on Sun Dec 1 2024 20:53:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnnotatedScrollBar/InteractionTests/AnnotatedScrollBarInteractionTests.cs Source File

  • AnnotatedScrollBar
  • InteractionTests

AnnotatedScrollBarInteractionTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00008 using System.Collections.Generic;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation;
00016 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00017 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00018 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00019
00020 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00021 {
00022     [TestClass]
00023     public class AnnotatedScrollBarInteractionTests
00024     {
00025         [ClassInitialize]
00026         [TestProperty("RunAs", "User")]
00027         [TestProperty("Classification", "Integration")]
00028         [TestProperty("Platform", "Any")]
00029         [TestProperty("MUXControlsTestSuite", "SuiteB")]
00030         public static void ClassInitialize(TestContext testContext)
00031         {
00032             TestEnvironment.Initialize(testContext);
00033             Context.RawContext.Activate();
00034         }
00035
00036         public void TestCleanup()
00037         {
00038             TestCleanupHelper.Cleanup();
00039         }
00040
00041         [TestMethod]
00042         public void ScrollUsingArrowButtons()
00043         {
00044             Log.Comment("AnnotatedScrollBar ScrollUsingDecrementArrowButton Test");
00045
00046             using (var setup = new TestSetupHelper(new[] { "AnnotatedScrollBar Tests", "navigateToSummary" }))
00047             {
00048                 Log.Comment("Retrieving txtValue");
00049                 TextBlock txtValue = new TextBlock(FindElement.ById("txtValue"));
00050                 Verify.IsNotNull(txtValue, "Verifying that txtValue was found");
00051
00052                 Log.Comment("Retrieving btnGetValue");
00053                 Button btnGetValue = new Button(FindElement.ById("btnGetValue"));
00054                 Verify.IsNotNull(btnGetValue, "Verifying that btnGetValue was found");
00055
00056                 Log.Comment("Retrieving VerticalDecrementRepeatButton");
00057                 Button VerticalDecrementRepeatButton = new Button(FindElement.ById("PART_VerticalDecrementRepeatButton"));
00058                 Verify.IsNotNull(VerticalDecrementRepeatButton, "Verifying that VerticalDecrementRepeatButton was found");
00059
00060                 Log.Comment("Retrieving VerticalIncrementRepeatButton");
00061                 Button VerticalIncrementRepeatButton = new Button(FindElement.ById("PART_VerticalIncrementRepeatButton"));
00062                 Verify.IsNotNull(VerticalIncrementRepeatButton, "Verifying that VerticalIncrementRepeatButton was found");
00063
00064                 Log.Comment("Verify Value is set to 0.");
00065                 btnGetValue.Click();
00066                 Verify.AreEqual(0.0, Convert.ToDouble(txtValue.DocumentText));
00067
00068                 Log.Comment("Click VerticalDecrementRepeatButton.");
00069                 VerticalDecrementRepeatButton.Click();
00070
00071                 Log.Comment("Verify Value is more than 0.");
00072                 btnGetValue.Click();
00073                 var newOffsetValue = Convert.ToDouble(txtValue.DocumentText);
00074                 Verify.IsTrue(newOffsetValue > 0.0);
00075
00076                 Log.Comment("Click VerticalIncrementRepeatButton.");
00077                 VerticalIncrementRepeatButton.Click();
00078
00079                 Log.Comment("Verify Value is back at 0.");
00080                 btnGetValue.Click();
00081                 Verify.AreEqual(0.0, Convert.ToDouble(txtValue.DocumentText));
00082             }
00083
00084         }
00085
00086         [TestMethod]
00087         public void ScrollUsingClick()
00088         {
00089             Log.Comment("AnnotatedScrollBar ScrollUsingClick Test");
00090
00091             using (var setup = new TestSetupHelper(new[] { "AnnotatedScrollBar Tests", "navigateToSummary" }))
00092             {
00093                 Log.Comment("Retrieving txtValue");
00094                 TextBlock txtValue = new TextBlock(FindElement.ById("txtValue"));
00095                 Verify.IsNotNull(txtValue, "Verifying that txtValue was found");
00096
00097                 Log.Comment("Retrieving btnGetValue");
00098                 Button btnGetValue = new Button(FindElement.ById("btnGetValue"));
00099                 Verify.IsNotNull(btnGetValue, "Verifying that btnGetValue was found");
00100
00101                 Log.Comment("Retrieving VerticalIncrementRepeatButton");
00102                 Button VerticalIncrementRepeatButton = new Button(FindElement.ById("PART_VerticalIncrementRepeatButton"));
00103                 Verify.IsNotNull(VerticalIncrementRepeatButton, "Verifying that VerticalIncrementRepeatButton was found");
00104
00105                 Log.Comment("Verify Value is set to 0.");
00106                 btnGetValue.Click();
00107                 Verify.AreEqual(0.0, Convert.ToDouble(txtValue.DocumentText));
00108
00109                 Log.Comment("Click on the AnnotatedScrollBar");
00110                 InputHelper.LeftClick(VerticalIncrementRepeatButton, 0, 100);
00111                 Wait.ForIdle();
00112
00113                 Log.Comment("Verify Value is more than 0.");
00114                 btnGetValue.Click();
00115                 var newOffsetValue = Convert.ToDouble(txtValue.DocumentText);
00116                 Verify.IsTrue(newOffsetValue > 0.0);
00117             }
00118
00119         }
00120
00121
00122         [TestMethod]
00123         public void ScrollUsingTouchAndDrag()
00124         {
00125             Log.Comment("AnnotatedScrollBar ScrollUsingTouchAndDrag Test");
00126
00127             using (var setup = new TestSetupHelper(new[] { "AnnotatedScrollBar Tests", "navigateToSummary" }))
00128             {
00129                 Log.Comment("Retrieving txtValue");
00130                 TextBlock txtValue = new TextBlock(FindElement.ById("txtValue"));
00131                 Verify.IsNotNull(txtValue, "Verifying that txtValue was found");
00132
00133                 Log.Comment("Retrieving btnGetValue");
00134                 Button btnGetValue = new Button(FindElement.ById("btnGetValue"));
00135                 Verify.IsNotNull(btnGetValue, "Verifying that btnGetValue was found");
00136
00137                 Log.Comment("Retrieving VerticalIncrementRepeatButton");
00138                 Button VerticalIncrementRepeatButton = new Button(FindElement.ById("PART_VerticalIncrementRepeatButton"));
00139                 Verify.IsNotNull(VerticalIncrementRepeatButton, "Verifying that VerticalIncrementRepeatButton was found");
00140
00141                 Log.Comment("Verify Value is set to 0.");
00142                 btnGetValue.Click();
00143                 Verify.AreEqual(0.0, Convert.ToDouble(txtValue.DocumentText));
00144
00145                 Log.Comment("Tap on the AnnotatedScrollBar");
00146                 InputHelper.Tap(VerticalIncrementRepeatButton, 0, 100);
00147                 Wait.ForIdle();
00148
00149                 Log.Comment("Verify Value is more than 0.");
00150                 btnGetValue.Click();
00151                 var firstOffsetValue = Convert.ToDouble(txtValue.DocumentText);
00152                 Verify.IsTrue(firstOffsetValue > 0.0);
00153
00154                 Log.Comment("TapAndDrag on the AnnotatedScrollBar");
00155                 var incrementButtonPoint = VerticalIncrementRepeatButton.GetClickablePoint();
00156                 incrementButtonPoint.Y = incrementButtonPoint.Y + 100;
00157                 InputHelper.Pan(VerticalIncrementRepeatButton, incrementButtonPoint, 200, Direction.South, 2000);
00158                 Wait.ForIdle();
00159
00160                 Log.Comment("Verify Value is more than firstOffsetValue.");
00161                 btnGetValue.Click();
00162                 var secondOffsetValue = Convert.ToDouble(txtValue.DocumentText);
00163                 Verify.IsTrue(secondOffsetValue > firstOffsetValue);
00164             }
00165
00166         }
00167
00168         [TestMethod]
00169         public void DetailLabelRequestedOffsetDoesNotExceedMaxPossibleValue()
00170         {
00171             Log.Comment("AnnotatedScrollBar DetailLabelRequestedOffset Test");
00172
00173             using (var setup = new TestSetupHelper(new[] { "AnnotatedScrollBar Tests", "navigateToSummary" }))
00174             {
00175                 Log.Comment("Retrieving isDetailLabelEnabled checkbox");
00176                 CheckBox isDetailLabelEnabled = new CheckBox(FindElement.ById("isDetailLabelEnabled"));
00177                 Verify.IsNotNull(isDetailLabelEnabled, "Verifying that isDetailLabelEnabled checkbox was found");
00178
00179                 Log.Comment("Retrieving btnGetMaximum");
00180                 Button btnGetMaximum = new Button(FindElement.ById("btnGetMaximum"));
00181                 Verify.IsNotNull(btnGetMaximum, "Verifying that btnGetMaximum was found");
00182
00183                 Log.Comment("Retrieving txtMaximum");
00184                 TextBlock txtMaximum = new TextBlock(FindElement.ById("txtMaximum"));
00185                 Verify.IsNotNull(txtMaximum, "Verifying that txtMaximum was found");
00186
00187                 Log.Comment("Retrieving btnGetViewportSize");
00188                 Button btnGetViewportSize = new Button(FindElement.ById("btnGetViewportSize"));
00189                 Verify.IsNotNull(btnGetViewportSize, "Verifying that btnGetViewportSize was found");
00190
00191                 Log.Comment("Retrieving txtViewportSize");
00192                 TextBlock txtViewportSize = new TextBlock(FindElement.ById("txtViewportSize"));
00193                 Verify.IsNotNull(txtViewportSize, "Verifying that txtViewportSize was found");
00194
00195                 Log.Comment("Retrieving btnGetLastRequestedDetailLabelOffset");
00196                 Button btnGetLastRequestedDetailLabelOffset = new Button(FindElement.ById("btnGetLastRequestedDetailLabelOffset"));
00197                 Verify.IsNotNull(btnGetLastRequestedDetailLabelOffset, "Verifying that btnGetLastRequestedDetailLabelOffset was found");
00198
00199                 Log.Comment("Retrieving txtLastRequestedDetailLabelOffset");
00200                 TextBlock txtLastRequestedDetailLabelOffset = new TextBlock(FindElement.ById("txtLastRequestedDetailLabelOffset"));
00201                 Verify.IsNotNull(txtLastRequestedDetailLabelOffset, "Verifying that txtLastRequestedDetailLabelOffset was found");
00202
00203                 Log.Comment("Retrieving VerticalIncrementRepeatButton");
00204                 Button VerticalIncrementRepeatButton = new Button(FindElement.ById("PART_VerticalIncrementRepeatButton"));
00205                 Verify.IsNotNull(VerticalIncrementRepeatButton, "Verifying that VerticalIncrementRepeatButton was found");
00206
00207                 Log.Comment("Retrieving VerticalDecrementRepeatButton");
00208                 Button VerticalDecrementRepeatButton = new Button(FindElement.ById("PART_VerticalDecrementRepeatButton"));
00209                 Verify.IsNotNull(VerticalDecrementRepeatButton, "Verifying that VerticalDecrementRepeatButton was found");
00210
00211                 Log.Comment("Check isDetailLabelEnabled");
00212                 isDetailLabelEnabled.Toggle();
00213                 Wait.ForIdle();
00214
00215                 Log.Comment("Get ScrollView.Maximum value.");
00216                 btnGetMaximum.Click();
00217                 var maximum = Convert.ToDouble(txtMaximum.GetText());
00218
00219                 Log.Comment("Get ScrollView.ViewportSize value.");
00220                 btnGetViewportSize.Click();
00221                 var viewportSize = Convert.ToDouble(txtViewportSize.GetText());
00222
00223                 var maxAllowableOffset = maximum + viewportSize;
00224
00225                 Log.Comment("Move mouse over AnnotatedScrollBar.");
00226                 InputHelper.MoveMouse(VerticalIncrementRepeatButton, 0, VerticalIncrementRepeatButton.BoundingRectangle.Height / 2);
00227                 Wait.ForIdle();
00228
00229                 Log.Comment("Move mouse to the end of the tooltip rail.");
00230                 InputHelper.MoveMouse(VerticalDecrementRepeatButton, 0, -1*VerticalDecrementRepeatButton.BoundingRectangle.Height / 2 - 1);
00231                 Wait.ForIdle();
00232
00233                 Log.Comment("Move mouse just past the end of tooltip rail.");
00234                 InputHelper.MoveMouse(VerticalDecrementRepeatButton, 0, -1*VerticalDecrementRepeatButton.BoundingRectangle.Height / 2);
00235                 Wait.ForIdle();
00236
00237                 Log.Comment("Get lastRequestedDetailLabelOffset.");
00238                 btnGetLastRequestedDetailLabelOffset.Click();
00239                 var lastRequestedDetailLabelOffset = Convert.ToDouble(txtLastRequestedDetailLabelOffset.GetText());
00240
00241                 Log.Comment("Verify lastRequestedDetailLabelOffset is more than 0.");
00242                 Verify.IsTrue(lastRequestedDetailLabelOffset > 0);
00243
00244                 Log.Comment("Verify lastRequestedDetailLabelOffset did not exceed Maximum + ViewportSize.");
00245                 Verify.IsTrue(lastRequestedDetailLabelOffset <= maxAllowableOffset);
00246             }
00247
00248         }
00249
00250         [TestMethod]
00251         public void DetailLabelDoesNotShowWhenDataFieldIsEmpty()
00252         {
00253             Log.Comment("AnnotatedScrollBar DetailLabelDoesNotShowWhenDataFieldIsEmpty Test");
00254
00255             using (var setup = new TestSetupHelper(new[] { "AnnotatedScrollBar Tests", "navigateToSummary" }))
00256             {
00257                 Log.Comment("Retrieving isDetailLabelEnabled checkbox");
00258                 CheckBox isDetailLabelEnabled = new CheckBox(FindElement.ById("isDetailLabelEnabled"));
00259                 Verify.IsNotNull(isDetailLabelEnabled, "Verifying that isDetailLabelEnabled checkbox was found");
00260
00261                 Log.Comment("Retrieving VerticalIncrementRepeatButton");
00262                 Button VerticalIncrementRepeatButton = new Button(FindElement.ById("PART_VerticalIncrementRepeatButton"));
00263                 Verify.IsNotNull(VerticalIncrementRepeatButton, "Verifying that VerticalIncrementRepeatButton was found");
00264
00265                 Log.Comment("Check isDetailLabelEnabled");
00266                 isDetailLabelEnabled.Toggle();
00267                 Wait.ForIdle();
00268
00269                 Log.Comment("Move mouse over AnnotatedScrollBar.");
00270                 InputHelper.MoveMouse(VerticalIncrementRepeatButton, 0, 200);
00271                 Wait.ForIdle();
00272
00273                 var toolTip = FindElement.ById("PART_DetailLabelToolTip");
00274                 Verify.IsNull(toolTip);
00275             }
00276
00277         }
00278
00279         [TestMethod]
00280         public void LabelsGrowToAccomodateLongText()
00281         {
00282             Log.Comment("AnnotatedScrollBar ScrollUsingTouchAndDrag Test");
00283
00284             using (var setup = new TestSetupHelper(new[] { "AnnotatedScrollBar Tests", "navigateToSummary" }))
00285             {
00286                 Log.Comment("Retrieving PART_ScrollPresenter");
00287                 Button scrollPresenter = new Button(FindElement.ById("PART_ScrollPresenter"));
00288                 Verify.IsNotNull(scrollPresenter, "Verifying that PART_ScrollPresenter was found");
00289
00290                 Log.Comment("Retrieving useLongLabelContent checkbox");
00291                 CheckBox useLongLabelContent = new CheckBox(FindElement.ById("useLongLabelContent"));
00292                 Verify.IsNotNull(useLongLabelContent, "Verifying that useLongLabelContent checkbox was found");
00293
00294                 Log.Comment("Verify scrollPresenter starting width.");
00295                 Verify.AreEqual(376, scrollPresenter.BoundingRectangle.Width);
00296
00297                 Log.Comment("Check useLongLabelContent");
00298                 useLongLabelContent.Toggle();
00299                 Wait.ForMilliseconds(500);
00300
00301                 Log.Comment("Verify scrollPresenter ending width.");
00302                 Verify.AreEqual(150, scrollPresenter.BoundingRectangle.Width);
00303             }
00304
00305         }
00306
00307         [TestMethod]
00308         public void CollidingLabelsAreRemoved()
00309         {
00310             Log.Comment("AnnotatedScrollBar CollidingLabelsAreRemoved Test");
00311
00312             using (var setup = new TestSetupHelper(new[] { "AnnotatedScrollBar Tests", "navigateToSummary" }))
00313             {
00314                 Log.Comment("Retrieving btnPrePopulateLabels");
00315                 Button btnPrePopulateLabels = new Button(FindElement.ById("btnPrePopulateLabels"));
00316                 Verify.IsNotNull(btnPrePopulateLabels, "Verifying that btnPrePopulateLabels was found");
00317
00318                 Log.Comment("Clicking btnPrePopulateLabels.");
00319                 btnPrePopulateLabels.Click();
00320
00321                 Log.Comment("First item should be visible.");
00322                 var label0 = ElementCache.TryGetObjectByName("Num 0", false);
00323                 Verify.IsNotNull(label0);
00324
00325                 Log.Comment("Last item should be visible.");
00326                 var label19 = ElementCache.TryGetObjectByName("Num 19", false);
00327                 Verify.IsNotNull(label19);
00328
00329                 Log.Comment("Some intermediate items not removed by collision logic should be visible.");
00330                 var label3 = ElementCache.TryGetObjectByName("Num 3", false);
00331                 Verify.IsNotNull(label3);
00332
00333                 var label15 = ElementCache.TryGetObjectByName("Num 15", false);
00334                 Verify.IsNotNull(label15);
00335
00336                 Log.Comment("Some intermediate items removed by collision logic should not be visible.");
00337                 var label1 = ElementCache.TryGetObjectByName("Num 1", false);
00338                 Verify.IsNull(label1);
00339             }
00340         }
00341
00342         [TestMethod]
00343         public void VerifyCanCancelScrolling()
00344         {
00345             Log.Comment("AnnotatedScrollBar Cancel Scrolling via AnnotatedScrollBarScrollingEventArgs Test");
00346
00347             using (var setup = new TestSetupHelper(new[] { "AnnotatedScrollBar Tests", "navigateToSummary" }))
00348             {
00349                 Log.Comment("Retrieving txtValue");
00350                 TextBlock txtValue = new TextBlock(FindElement.ById("txtValue"));
00351                 Verify.IsNotNull(txtValue, "Verifying that txtValue was found");
00352
00353                 Log.Comment("Retrieving btnGetValue");
00354                 Button btnGetValue = new Button(FindElement.ById("btnGetValue"));
00355                 Verify.IsNotNull(btnGetValue, "Verifying that btnGetValue was found");
00356
00357                 Log.Comment("Retrieving VerticalDecrementRepeatButton");
00358                 Button VerticalDecrementRepeatButton = new Button(FindElement.ById("PART_VerticalDecrementRepeatButton"));
00359                 Verify.IsNotNull(VerticalDecrementRepeatButton, "Verifying that VerticalDecrementRepeatButton was found");
00360
00361                 Log.Comment("Retrieving CancelScrollingEvent checkbox");
00362                 CheckBox cancelScrollingEvent = new CheckBox(FindElement.ById("cancelScrollingEvent"));
00363                 Verify.IsNotNull(cancelScrollingEvent, "Verifying that cancelScrollingEvent checkbox was found");
00364
00365                 Log.Comment("Verify Value is set to 0.");
00366                 btnGetValue.Click();
00367                 Verify.AreEqual(0.0, Convert.ToDouble(txtValue.DocumentText));
00368
00369                 Log.Comment("Check cancelScrollingEvent.");
00370                 cancelScrollingEvent.Toggle();
00371                 Wait.ForIdle();
00372
00373                 Log.Comment("Click VerticalDecrementRepeatButton.");
00374                 VerticalDecrementRepeatButton.Click();
00375
00376                 Log.Comment("Uncheck cancelScrollingEvent.");
00377                 cancelScrollingEvent.Toggle();
00378                 Wait.ForIdle();
00379
00380                 Log.Comment("Click VerticalDecrementRepeatButton.");
00381                 VerticalDecrementRepeatButton.Click();
00382
00383                 Log.Comment("Verify Value is more than 0.");
00384                 btnGetValue.Click();
00385                 var newOffsetValue = Convert.ToDouble(txtValue.DocumentText);
00386                 Verify.AreEqual(83, newOffsetValue);
00387             }
00388
00389         }
00390     }
00391 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemsFactory.cpp Source File

  • NavigationView

NavigationViewItemsFactory.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "NavigationViewItemsFactory.h"
00006 #include "NavigationViewItemBase.h"
00007 #include "NavigationViewItem.h"
00008 #include "ItemTemplateWrapper.h"
00009
00010 void NavigationViewItemsFactory::UserElementFactory(winrt::IInspectable const& newValue)
00011 {
00012     if (auto dataTemplate = newValue.try_as<winrt::DataTemplate>())
00013     {
00014         m_itemTemplateWrapper = winrt::make<ItemTemplateWrapper>(dataTemplate);
00015     }
00016     else if (auto selector = newValue.try_as<winrt::DataTemplateSelector>())
00017     {
00018         m_itemTemplateWrapper = winrt::make<ItemTemplateWrapper>(selector);
00019     }
00020     else if (auto customElementFactory = newValue.try_as<winrt::IElementFactory>())
00021     {
00022         m_itemTemplateWrapper = customElementFactory;
00023     }
00024
00025     navigationViewItemPool = std::vector<winrt::NavigationViewItem>();
00026 }
00027
00028 void NavigationViewItemsFactory::SettingsItem(winrt::NavigationViewItemBase const& settingsItem)
00029 {
00030     m_settingsItem = settingsItem;
00031 }
00032
00033
00034 // Retrieve the element that will be displayed for a specific data item.
00035 // If the resolved element is not derived from NavigationViewItemBase, wrap in a NavigationViewItem before returning.
00036 winrt::UIElement NavigationViewItemsFactory::GetElementCore(winrt::ElementFactoryGetArgs const& args)
00037 {
00038     auto const newContent = [itemTemplateWrapper = m_itemTemplateWrapper, settingsItem = m_settingsItem, args]() {
00039         // Do not template SettingsItem
00040         if (settingsItem && settingsItem == args.Data())
00041         {
00042             return args.Data();
00043         }
00044
00045         if (itemTemplateWrapper)
00046         {
00047             return itemTemplateWrapper.GetElement(args).as<winrt::IInspectable>();
00048         }
00049         return args.Data();
00050     }();
00051
00052     // Element is already of expected type, just return it
00053     if (auto const newItem = newContent.try_as<winrt::NavigationViewItemBase>())
00054     {
00055         return newItem;
00056     }
00057
00058     // Get or create a wrapping container for the data
00059     auto const nvi = [this]() {
00060         if (navigationViewItemPool.size() > 0)
00061         {
00062             auto nvi = navigationViewItemPool.back();
00063             navigationViewItemPool.pop_back();
00064             return nvi;
00065         }
00066         return winrt::make<NavigationViewItem>();
00067     }();
00068     auto const nviImpl = winrt::get_self<NavigationViewItem>(nvi);
00069     nviImpl->CreatedByNavigationViewItemsFactory(true);
00070
00071     // If a user provided item template exists, just pass the template and data down to the ContentPresenter of the NavigationViewItem
00072     if (m_itemTemplateWrapper)
00073     {
00074         if (auto itemTemplateWrapper = m_itemTemplateWrapper.try_as<ItemTemplateWrapper>())
00075         {
00076             // Recycle newContent
00077             auto const tempArgs = winrt::ElementFactoryRecycleArgs();
00078             tempArgs.Element(newContent.try_as<winrt::UIElement>());
00079             m_itemTemplateWrapper.RecycleElement(tempArgs);
00080
00081
00082             nviImpl->Content(args.Data());
00083             nviImpl->ContentTemplate(itemTemplateWrapper->Template());
00084             nviImpl->ContentTemplateSelector(itemTemplateWrapper->TemplateSelector());
00085             return *nviImpl;
00086         }
00087     }
00088
00089     nviImpl->Content(newContent);
00090     return *nviImpl;
00091 }
00092
00093 void NavigationViewItemsFactory::RecycleElementCore(winrt::ElementFactoryRecycleArgs const& args)
00094 {
00095     if (auto element = args.Element())
00096     {
00097         if (auto nvi = element.try_as<winrt::NavigationViewItem>())
00098         {
00099             auto const nviImpl = winrt::get_self<NavigationViewItem>(nvi);
00100             // Check whether we wrapped the element in a NavigationViewItem ourselves.
00101             // If yes, we are responsible for recycling it.
00102             if (nviImpl->CreatedByNavigationViewItemsFactory())
00103             {
00104                 nviImpl->CreatedByNavigationViewItemsFactory(false);
00105                 UnlinkElementFromParent(args);
00106                 args.Element(nullptr);
00107
00108                 // Retain the NVI that we created for future re-use
00109                 navigationViewItemPool.push_back(nvi);
00110
00111                 // Retrieve the proper element that requires recycling for a user defined item template
00112                 // and update the args correspondingly
00113                 if (m_itemTemplateWrapper)
00114                 {
00115                     // TODO: Retrieve the element and add to the args
00116                 }
00117             }
00118         }
00119
00120         // Do not recycle SettingsItem
00121         bool isSettingsItem = m_settingsItem && m_settingsItem == args.Element();
00122
00123         UnlinkElementFromParent(args);
00124         if (m_itemTemplateWrapper && !isSettingsItem)
00125         {
00126             m_itemTemplateWrapper.RecycleElement(args);
00127         }
00128     }
00129 }
00130
00131 void NavigationViewItemsFactory::UnlinkElementFromParent(winrt::ElementFactoryRecycleArgs const& args)
00132 {
00133     // We want to unlink the containers from the parent repeater
00134     // in case we are required to move it to a different repeater.
00135     if (auto panel = args.Parent().try_as<winrt::Panel>())
00136     {
00137         auto children = panel.Children();
00138         unsigned int childIndex = 0;
00139         if (children.IndexOf(args.Element(), childIndex))
00140         {
00141             children.RemoveAt(childIndex);
00142             args.Parent(nullptr);
00143         }
00144     }
00145 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshContainer/RefreshContainerPrivate.idl Source File

  • PullToRefresh
  • RefreshContainer

RefreshContainerPrivate.idl

Go to the documentation of this file.
00001 ﻿namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003 interface IRefreshInfoProviderAdapter;
00004
00005 [MUX_INTERNAL]
00006 [webhosthidden]
00007 interface IRefreshContainerPrivate
00008 {
00009     IRefreshInfoProviderAdapter RefreshInfoProviderAdapter { get; set; };
00010 }
00011
00012 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/AnimationUtility.h Source File

  • Lights

AnimationUtility.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "SpotLightStateHelper.h"
00006
00007 template <typename ValueType>
00008 inline auto MakeAnimation(const winrt::Compositor &compositor);
00009
00010 template <>
00011 inline auto MakeAnimation<float>(const winrt::Compositor &compositor)
00012 {
00013     return compositor.CreateScalarKeyFrameAnimation();
00014 }
00015
00016 template <>
00017 inline auto MakeAnimation<winrt::Color>(const winrt::Compositor &compositor)
00018 {
00019     return compositor.CreateColorKeyFrameAnimation();
00020 }
00021
00022 void SetValueDirect(const winrt::CompositionPropertySet& target, std::wstring_view const& propName, const float value);
00023 void SetValueDirect(const winrt::CompositionPropertySet& target, std::wstring_view const& propName, const winrt::Color& value);
00024 void SetValueDirect(const winrt::SpotLight& target, const SpotlightProperty prop, const winrt::float3& value);
00025 void SetValueDirect(const winrt::SpotLight& target, const SpotlightProperty prop, const float value);
00026 void SetValueDirect(const winrt::SpotLight& target, const SpotlightProperty prop, const winrt::Color& value);
00027 void SetValueDirect(const winrt::CompositionPropertySet& target, const SpotlightProperty prop, const winrt::Color& value);
00028
00029 template <typename ValueType>
00030 inline void AnimateTo(
00031     const winrt::SpotLight& target,
00032     const RevealHoverSpotlightAnimationInfo<ValueType>& targetFrame)
00033 {
00034     if (IsIgnored(targetFrame))
00035     {
00036         return;
00037     }
00038
00039     target.StopAnimation(targetFrame.PropertyName);
00040     if (!IsAnimated(targetFrame))
00041     {
00042         SetValueDirect(target, targetFrame.SpotlightProperty, targetFrame.Value);
00043     }
00044     else
00045     {
00046         SetupAnimationAndStart(target, targetFrame);
00047     }
00048 }
00049
00050 template <typename ValueType>
00051 inline void AnimateTo(
00052     const winrt::CompositionPropertySet& target,
00053     const RevealHoverSpotlightAnimationInfo<ValueType>& targetFrame)
00054 {
00055     if (IsIgnored(targetFrame))
00056     {
00057         return;
00058     }
00059
00060     target.StopAnimation(targetFrame.PropertyName);
00061     if (!IsAnimated(targetFrame))
00062     {
00063         SetValueDirect(target, targetFrame.PropertyName, targetFrame.Value);
00064     }
00065     else
00066     {
00067         SetupAnimationAndStart(target, targetFrame);
00068     }
00069 }
00070
00071 template <typename ValueType>
00072 inline void SetupAnimationAndStart(
00073     const winrt::CompositionObject& target,
00074     const RevealHoverSpotlightAnimationInfo<ValueType>& targetFrame)
00075 {
00076     auto compositor = target.Compositor();
00077     auto animation = MakeAnimation<ValueType>(compositor);
00078
00079     animation.Duration(targetFrame.Duration);
00080     animation.StopBehavior(winrt::AnimationStopBehavior::LeaveCurrentValue);
00081
00082     if (targetFrame.EasingInfo.EasingType == EasingTypes::CubicBezier)
00083     {
00084         animation.InsertKeyFrame(1, targetFrame.Value, compositor.CreateCubicBezierEasingFunction(targetFrame.EasingInfo.EasingControlPoint1, targetFrame.EasingInfo.EasingControlPoint2));
00085     }
00086     else if (targetFrame.EasingInfo.EasingType == EasingTypes::Linear)
00087     {
00088         animation.InsertKeyFrame(1, targetFrame.Value, compositor.CreateLinearEasingFunction());
00089     }
00090     else
00091     {
00092         animation.InsertKeyFrame(1, targetFrame.Value);
00093     }
00094
00095     target.StartAnimation(targetFrame.PropertyName, animation);
00096 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DoubleUtil Member List

This is the complete list of members for DoubleUtil, including all inherited members.
NaN DoubleUtil [static]
Generated on Sun Dec 1 2024 20:52:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DropDownButton Member List

This is the complete list of members for DropDownButton, including all inherited members.
_expandCollapsePattern | DropDownButton | [private]
_factory | DropDownButton | [private, static]
Collapse() | DropDownButton | [inline]
CollapseAndWait() | DropDownButton | [inline]
DropDownButton(UIObject uiObject) | DropDownButton | [inline]
Expand() | DropDownButton | [inline]
ExpandAndWait() | DropDownButton | [inline]
ExpandCollapseState | DropDownButton |
Factory | DropDownButton | [static]
GetCollapsedWaiter() | DropDownButton | [inline]
GetExpandedWaiter() | DropDownButton | [inline]
Initialize() | DropDownButton | [inline, private]
Generated on Sun Dec 1 2024 20:53:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

VirtualizingLayoutContext Member List

This is the complete list of members for VirtualizingLayoutContext, including all inherited members.
GetItemAt(int index) | VirtualizingLayoutContext |
GetItemAtCore(int index) | VirtualizingLayoutContext | [virtual]
GetNonVirtualizingContextAdapter() | VirtualizingLayoutContext |
GetOrCreateElementAt(int index) | VirtualizingLayoutContext |
GetOrCreateElementAt(int index, winrt::ElementRealizationOptions const &options) | VirtualizingLayoutContext |
GetOrCreateElementAtCore(int index, winrt::ElementRealizationOptions const &options) | VirtualizingLayoutContext | [virtual]
ItemCount() | VirtualizingLayoutContext |
ItemCountCore() | VirtualizingLayoutContext | [virtual]
LayoutOrigin() | VirtualizingLayoutContext |
LayoutOrigin(winrt::Point const &result) | VirtualizingLayoutContext |
LayoutOriginCore() | VirtualizingLayoutContext | [virtual]
LayoutOriginCore(winrt::Point const &value) | VirtualizingLayoutContext | [virtual]
RealizationRect() | VirtualizingLayoutContext |
RealizationRectCore() | VirtualizingLayoutContext | [virtual]
RecommendedAnchorIndex() | VirtualizingLayoutContext |
RecommendedAnchorIndexCore() | VirtualizingLayoutContext | [virtual]
RecycleElement(winrt::UIElement const &element) | VirtualizingLayoutContext |
RecycleElementCore(winrt::UIElement const &element) | VirtualizingLayoutContext | [virtual]
VisibleRect() | VirtualizingLayoutContext |
VisibleRectCore() | VirtualizingLayoutContext | [virtual]
Generated on Sun Dec 1 2024 20:53:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RefreshContainer.properties.cpp Source File

  • Generated

RefreshContainer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RefreshContainer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(RefreshContainer)
00012 }
00013
00014 #include "RefreshContainer.g.cpp"
00015
00016 GlobalDependencyProperty RefreshContainerProperties::s_PullDirectionProperty{ nullptr };
00017 GlobalDependencyProperty RefreshContainerProperties::s_VisualizerProperty{ nullptr };
00018
00019 RefreshContainerProperties::RefreshContainerProperties()
00020     : m_refreshRequestedEventSource{static_cast<RefreshContainer*>(this)}
00021 {
00022     EnsureProperties();
00023 }
00024
00025 void RefreshContainerProperties::EnsureProperties()
00026 {
00027     if (!s_PullDirectionProperty)
00028     {
00029         s_PullDirectionProperty =
00030             InitializeDependencyProperty(
00031                 L"PullDirection",
00032                 winrt::name_of<winrt::RefreshPullDirection>(),
00033                 winrt::name_of<winrt::RefreshContainer>(),
00034                 false /* isAttached */,
00035                 ValueHelper<winrt::RefreshPullDirection>::BoxValueIfNecessary(winrt::RefreshPullDirection::TopToBottom),
00036                 winrt::PropertyChangedCallback(&OnPullDirectionPropertyChanged));
00037     }
00038     if (!s_VisualizerProperty)
00039     {
00040         s_VisualizerProperty =
00041             InitializeDependencyProperty(
00042                 L"Visualizer",
00043                 winrt::name_of<winrt::RefreshVisualizer>(),
00044                 winrt::name_of<winrt::RefreshContainer>(),
00045                 false /* isAttached */,
00046                 ValueHelper<winrt::RefreshVisualizer>::BoxedDefaultValue(),
00047                 winrt::PropertyChangedCallback(&OnVisualizerPropertyChanged));
00048     }
00049 }
00050
00051 void RefreshContainerProperties::ClearProperties()
00052 {
00053     s_PullDirectionProperty = nullptr;
00054     s_VisualizerProperty = nullptr;
00055 }
00056
00057 void RefreshContainerProperties::OnPullDirectionPropertyChanged(
00058     winrt::DependencyObject const& sender,
00059     winrt::DependencyPropertyChangedEventArgs const& args)
00060 {
00061     auto owner = sender.as<winrt::RefreshContainer>();
00062     winrt::get_self<RefreshContainer>(owner)->OnPropertyChanged(args);
00063 }
00064
00065 void RefreshContainerProperties::OnVisualizerPropertyChanged(
00066     winrt::DependencyObject const& sender,
00067     winrt::DependencyPropertyChangedEventArgs const& args)
00068 {
00069     auto owner = sender.as<winrt::RefreshContainer>();
00070     winrt::get_self<RefreshContainer>(owner)->OnPropertyChanged(args);
00071 }
00072
00073 void RefreshContainerProperties::PullDirection(winrt::RefreshPullDirection const& value)
00074 {
00075     [[gsl::suppress(con)]]
00076     {
00077     static_cast<RefreshContainer*>(this)->SetValue(s_PullDirectionProperty, ValueHelper<winrt::RefreshPullDirection>::BoxValueIfNecessary(value));
00078     }
00079 }
00080
00081 winrt::RefreshPullDirection RefreshContainerProperties::PullDirection()
00082 {
00083     return ValueHelper<winrt::RefreshPullDirection>::CastOrUnbox(static_cast<RefreshContainer*>(this)->GetValue(s_PullDirectionProperty));
00084 }
00085
00086 void RefreshContainerProperties::Visualizer(winrt::RefreshVisualizer const& value)
00087 {
00088     [[gsl::suppress(con)]]
00089     {
00090     static_cast<RefreshContainer*>(this)->SetValue(s_VisualizerProperty, ValueHelper<winrt::RefreshVisualizer>::BoxValueIfNecessary(value));
00091     }
00092 }
00093
00094 winrt::RefreshVisualizer RefreshContainerProperties::Visualizer()
00095 {
00096     return ValueHelper<winrt::RefreshVisualizer>::CastOrUnbox(static_cast<RefreshContainer*>(this)->GetValue(s_VisualizerProperty));
00097 }
00098
00099 winrt::event_token RefreshContainerProperties::RefreshRequested(winrt::TypedEventHandler<winrt::RefreshContainer, winrt::RefreshRequestedEventArgs> const& value)
00100 {
00101     return m_refreshRequestedEventSource.add(value);
00102 }
00103
00104 void RefreshContainerProperties::RefreshRequested(winrt::event_token const& token)
00105 {
00106     m_refreshRequestedEventSource.remove(token);
00107 }
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InfoBadgeProperties Member List

This is the complete list of members for InfoBadgeProperties, including all inherited members.
ClearProperties() | InfoBadgeProperties | [static]
EnsureProperties() | InfoBadgeProperties | [static]
IconSource(winrt::IconSource const &value) | InfoBadgeProperties |
IconSource() | InfoBadgeProperties |
IconSourceProperty() | InfoBadgeProperties | [inline, static]
InfoBadgeProperties() | InfoBadgeProperties |
OnIconSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBadgeProperties | [static]
OnTemplateSettingsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBadgeProperties | [static]
OnValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | InfoBadgeProperties | [static]
s_IconSourceProperty | InfoBadgeProperties | [static]
s_TemplateSettingsProperty | InfoBadgeProperties | [static]
s_ValueProperty | InfoBadgeProperties | [static]
TemplateSettings(winrt::InfoBadgeTemplateSettings const &value) | InfoBadgeProperties |
TemplateSettings() | InfoBadgeProperties |
TemplateSettingsProperty() | InfoBadgeProperties | [inline, static]
Value(int value) | InfoBadgeProperties |
Value() | InfoBadgeProperties |
ValueProperty() | InfoBadgeProperties | [inline, static]
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Telemetry/RuntimeProfiler.h Source File

  • Telemetry

RuntimeProfiler.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004
00005 namespace RuntimeProfiler
00006 {
00007     typedef enum
00008     {
00009         PG_Class = 0
00010     } ProfileGroup;
00011
00012     //  We use these id's on reports so please don't remove or move these
00013     //  definitions.  Add any new id's immediately preceding ProfId_Size
00014     //  since it's used to determine the size of this list.
00015     typedef enum
00016     {
00017         ProfId_ColorPicker = 0,
00018         ProfId_NavigationView,
00019         ProfId_ParallaxView,
00020         ProfId_PersonPicture,
00021         ProfId_RefreshContainer,
00022         ProfId_RefreshVisualizer,
00023         ProfId_RatingControl,
00024         ProfId_SwipeControl,
00025         ProfId_SwipeItem,
00026         ProfId_TreeView,
00027         ProfId_TwoPaneView,
00028         ProfId_Reveal,
00029         ProfId_Acrylic,
00030         ProfId_SplitButton,
00031         ProfId_DropDownButton,
00032         ProfId_CommandBarFlyout,
00033         ProfId_TextCommandBarFlyout,
00034         ProfId_RadioButtons,
00035         ProfId_RadioMenuFlyoutItem,
00036         ProfId_ItemsRepeater,
00037         ProfId_TeachingTip,
00038         ProfId_AnimatedVisualPlayer,
00039         ProfId_NonVirtualizingLayout,
00040         ProfId_StackLayout,
00041         ProfId_UniformGridLayout,
00042         ProfId_VirtualizingLayout,
00043         ProfId_ItemsRepeaterScrollHost,
00044         ProfId_TabView,
00045         ProfId_TabViewItem,
00046         ProfId_ProgressBar,
00047         ProfId_ProgressRing,
00048         ProfId_NumberBox,
00049         ProfId_RadialGradientBrush,
00050         ProfId_InfoBar,
00051         ProfId_Expander,
00052         ProfId_PagerControl,
00053         ProfId_BreadcrumbBar,
00054         ProfId_BreadcrumbBarItem,
00055         ProfId_PipsPager,
00056         ProfId_ImageIcon,
00057         ProfId_AnimatedIcon,
00058         ProfId_InfoBadge,
00059         ProfId_WebView2,
00060         ProfId_MicaController,
00061         ProfId_ScrollPresenter,
00062         ProfId_ScrollView,
00063         ProfId_ItemsView,
00064         ProfId_ItemContainer,
00065         ProfId_LinedFlowLayout,
00066         ProfId_AnnotatedScrollBar,
00067         ProfId_MapControl,
00068         ProfId_SelectorBar,
00069         ProfId_TitleBar,
00070         ProfId_InkCanvas,
00071         ProfId_Size // ProfId_Size is the last always.
00072     } ProfilerClassId;
00073
00074     //  Ditto above...
00075     typedef enum
00076     {
00077         ProfMemberId_Acrylic_TintLuminosityOpacity_Changed = 0,
00078         ProfMemberId_TeachingTip_F6AccessKey_FirstInvocation,
00079         ProfMemberId_TeachingTip_F6AccessKey_SubsequentInvocation,
00080         ProfMemberId_TeachingTip_TipDidNotOpenDueToSize,
00081         ProfMemberId_Size
00082     } ProfilerMemberId;
00083
00084     void FireEvent(bool Suspend) noexcept;
00085     void RegisterMethod(ProfileGroup group, UINT16 TypeIndex, UINT16 MethodIndex, volatile LONG *Count) noexcept;
00086     void UninitializeRuntimeProfiler();
00087 }
00088
00089 #define __RP_Marker_ClassById(typeindex) \
00090     { \
00091         __pragma (warning ( suppress : 28112)) \
00092         static volatile LONG __RuntimeProfiler_Counter = -1; \
00093         if (0 == ::InterlockedIncrement(&__RuntimeProfiler_Counter)) \
00094         { \
00095             RuntimeProfiler::RegisterMethod(RuntimeProfiler::PG_Class, (UINT16)typeindex, 9999, &__RuntimeProfiler_Counter); \
00096         } \
00097     }
00098
00099 #define __RP_Marker_ClassMemberById(typeindex, memberindex) \
00100     { \
00101         __pragma (warning ( suppress : 28112)) \
00102         static volatile LONG __RuntimeProfiler_Counter = -1; \
00103         if (0 == ::InterlockedIncrement(&__RuntimeProfiler_Counter)) \
00104         { \
00105             RuntimeProfiler::RegisterMethod(RuntimeProfiler::PG_Class, (UINT16)typeindex, (UINT16)memberindex, &__RuntimeProfiler_Counter); \
00106         } \
00107     }
00108
00109
00110
00111
00112
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RoutedEventTraits< RoutedEventType::DragEnter > Member List

This is the complete list of members for RoutedEventTraits< RoutedEventType::DragEnter >, including all inherited members.
Event() RoutedEventTraits< RoutedEventType::DragEnter > [inline, static]
Generated on Sun Dec 1 2024 20:53:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > Member List

This is the complete list of members for SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize >, including all inherited members.
AttachedData(int index) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
AttachedData(int index, typename AttachedDataType attachedData) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
Clear() | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
DefaultAttachedData()=0 | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [protected, pure virtual]
DefaultVectorIDOnInsert()=0 | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [protected, pure virtual]
GetAt(int index)=0 | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [protected, pure virtual]
GetPreferIndex(int index, SplitVectorID vectorID) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, private]
GetVector(SplitVectorID vectorID) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
GetVectorForItem(int index) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
GetVectorIDForItem(int index) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
IndexOf(const typename T &value)=0 | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [protected, pure virtual]
IndexOfImpl(const typename T &value, typename SplitVectorID vectorID) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
InitializeSplitVectors(std::vector< std::shared_ptr< SplitVectorType >> vectors) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
MoveItemsToVector(typename SplitVectorID newVectorID) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
MoveItemsToVector(int start, int end, typename SplitVectorID newVectorID) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
MoveItemToVector(int index, typename SplitVectorID newVectorID) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
OnClear() | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
OnInsertAt(int startIndex, int count) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
OnInsertAt(int index) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, private]
OnRemoveAt(int startIndex, int count) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
OnRemoveAt(int index) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, private]
OnReplace(int index) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, private]
RangeCount(int start, int end, SplitVectorID vectorID) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, private]
RawDataSize() | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
ResetAttachedData() | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
ResetAttachedData(typename AttachedDataType attachedData) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline]
Size()=0 | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [protected, pure virtual]
SyncAndInitVectorFlagsWithID(SplitVectorID defaultID, typename AttachedDataType defaultAttachedData) | SplitDataSourceBase< T, SplitVectorID, AttachedDataType, SplitVectorSize > | [inline, protected]
Generated on Sun Dec 1 2024 20:53:12 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PipsPagerPage Member List

This is the complete list of members for PipsPagerPage, including all inherited members.
ConvertComboBoxItemToNumberOfPages(ComboBoxItem item) | PipsPagerPage | [inline, private]
ConvertComboBoxItemToVisibilityEnum(ComboBoxItem item, PipsPagerButtonVisibility defaultValue) | PipsPagerPage | [inline, private]
GetCurrentOrientation() | PipsPagerPage | [inline, private]
GetNumberOfPages() | PipsPagerPage | [inline, private]
GoToExamplesPage(object sender, RoutedEventArgs args) | PipsPagerPage | [inline, private]
IsButtonVisible(Button btn) | PipsPagerPage | [inline, private]
nextPageButton | PipsPagerPage | [private]
OnButtonEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) | PipsPagerPage | [inline, private]
OnGetPipsPagerButtonSizesClicked(object sender, RoutedEventArgs args) | PipsPagerPage | [inline, private]
OnLoad(object sender, RoutedEventArgs args) | PipsPagerPage | [inline, private]
OnMaxVisiblePipsChanged(object sender, SelectionChangedEventArgs e) | PipsPagerPage | [inline]
OnNextPageButtonVisibilityChanged(object sender, SelectionChangedEventArgs e) | PipsPagerPage | [inline]
OnNumberOfPagesChanged(object sender, SelectionChangedEventArgs e) | PipsPagerPage | [inline]
OnOrientationChanged(object sender, SelectionChangedEventArgs e) | PipsPagerPage | [inline]
OnPreviousPageButtonVisibilityChanged(object sender, SelectionChangedEventArgs e) | PipsPagerPage | [inline]
OnRepeaterGotFocus(object sender, RoutedEventArgs e) | PipsPagerPage | [inline, private]
OnSelectedIndexChanged(PipsPager sender, PipsPagerSelectedIndexChangedEventArgs args) | PipsPagerPage | [inline]
OnWrapModeChanged(object sender, SelectionChangedEventArgs e) | PipsPagerPage | [inline]
Pictures | PipsPagerPage |
PipsPagerPage() | PipsPagerPage | [inline]
previousPageButton | PipsPagerPage | [private]
repeater | PipsPagerPage | [private]
SkipToFirstPage(object sender, RoutedEventArgs args) | PipsPagerPage | [inline, private]
SkipToLastPage(object sender, RoutedEventArgs args) | PipsPagerPage | [inline, private]
TestPipsPager_GotFocus(object sender, RoutedEventArgs e) | PipsPagerPage | [inline, private]
TestPipsPager_LostFocus(object sender, RoutedEventArgs e) | PipsPagerPage | [inline, private]
TestPipsPager_PointerCanceled(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) | PipsPagerPage | [inline, private]
TestPipsPager_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) | PipsPagerPage | [inline, private]
TestPipsPager_PointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) | PipsPagerPage | [inline, private]
UpdateButtonVisibilityCheckboxes() | PipsPagerPage | [inline, private]
verticalOrientationPipsPagerRepeater | PipsPagerPage | [private]
Generated on Sun Dec 1 2024 20:54:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshVisualizer/PullToRefreshHelperTestAPI.idl Source File

  • PullToRefresh
  • RefreshVisualizer

PullToRefreshHelperTestAPI.idl

Go to the documentation of this file.
00001 namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [webhosthidden]
00006 [default_interface]
00007 runtimeclass PullToRefreshHelperTestApi
00008 {
00009     static MU_XC_NAMESPACE.RefreshInteractionRatioChangedEventArgs CreateRefreshInteractionRatioChangedEventArgsInstance(Double value);
00010     static MU_XC_NAMESPACE.RefreshStateChangedEventArgs CreateRefreshStateChangedEventArgsInstance(MU_XC_NAMESPACE.RefreshVisualizerState oldValue, MU_XC_NAMESPACE.RefreshVisualizerState newValue);
00011     static MU_XC_NAMESPACE.RefreshRequestedEventArgs CreateRefreshRequestedEventArgsInstance(Windows.Foundation.Deferral handler);
00012 }
00013
00014 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SwipeControl/SwipeControl_TestUI/SwipePage.xaml.cs Source File

  • SwipeControl
  • SwipeControl_TestUI

SwipePage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Private.Controls;
00008 using Common;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 namespace MUXControlsTestApp
00015 {
00016     [TopLevelTestPage(Name = "SwipeControl", Icon = "Swipe.png")]
00017     public sealed partial class SwipePage : TestPage
00018     {
00019         public SwipePage()
00020         {
00021             LogController.InitializeLogging();
00022
00023             this.InitializeComponent();
00024
00025             navigateToSimpleContents.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SwipeControlPage), 0); };
00026             navigateToDynamic.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SwipeControlPage2), 0); };
00027             navigateToClear.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SwipeControlClearPage), 0); };
00028         }
00029
00030         private void CmbSwipeControlOutputDebugStringLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
00031         {
00032             MUXControlsTestHooks.SetOutputDebugStringLevelForType(
00033                 "SwipeControl",
00034                 cmbSwipeControlOutputDebugStringLevel.SelectedIndex == 1 || cmbSwipeControlOutputDebugStringLevel.SelectedIndex == 2,
00035                 cmbSwipeControlOutputDebugStringLevel.SelectedIndex == 2);
00036         }
00037     }
00038 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MapControl/MapLayer.h Source File

  • MapControl

MapLayer.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "MapLayer.g.h"
00010
00011 class MapLayer :
00012     public winrt::implementation::MapLayerT<MapLayer, winrt::composable>
00013 {
00014 public:
00015     MapLayer();
00016     winrt::hstring Id;
00017 };
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RepeaterItem Member List

This is the complete list of members for RepeaterItem, including all inherited members.
IsSelected | RepeaterItem |
IsSelectedProperty | RepeaterItem | [static]
OnCreateAutomationPeer() | RepeaterItem | [inline, protected]
OnKeyUp(KeyRoutedEventArgs e) | RepeaterItem | [inline, protected]
OnPointerPressed(PointerRoutedEventArgs e) | RepeaterItem | [inline, protected]
OnPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) | RepeaterItem | [inline, private, static]
OnselectionModelChanged(object sender, PropertyChangedEventArgs e) | RepeaterItem | [inline, private]
RepeatedIndex | RepeaterItem |
RepeatedIndexProperty | RepeaterItem | [static]
RepeaterItem() | RepeaterItem | [inline]
SelectionModel | RepeaterItem |
SelectionModelProperty | RepeaterItem | [static]
Generated on Sun Dec 1 2024 20:54:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/TestUI/DialogWithNavView.xaml.cs Source File

  • NavigationView
  • TestUI

DialogWithNavView.xaml.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using System.Collections.Generic;
00003 using System.IO;
00004 using System.Linq;
00005 using System.Runtime.InteropServices.WindowsRuntime;
00006 using Windows.Foundation;
00007 using Windows.Foundation.Collections;
00008 using Microsoft.UI.Xaml;
00009 using Microsoft.UI.Xaml.Controls;
00010 using Microsoft.UI.Xaml.Controls.Primitives;
00011 using Microsoft.UI.Xaml.Data;
00012 using Microsoft.UI.Xaml.Input;
00013 using Microsoft.UI.Xaml.Media;
00014 using Microsoft.UI.Xaml.Navigation;
00015
00016 // The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
00017
00018 namespace MUXControlsTestApp
00019 {
00020     public sealed partial class DialogWithNavView : ContentDialog
00021     {
00022         public DialogWithNavView()
00023         {
00024             this.InitializeComponent();
00025         }
00026
00027         private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
00028         {
00029             Hide();
00030         }
00031
00032         private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
00033         {
00034             Hide();
00035         }
00036     }
00037 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NumberBox/NumberBoxAutomationPeer.cpp Source File

  • NumberBox

NumberBoxAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "NumberBox.h"
00008 #include "NumberBoxAutomationPeer.h"
00009 #include "Utils.h"
00010
00011 #include "NumberBoxAutomationPeer.properties.cpp"
00012
00013 NumberBoxAutomationPeer::NumberBoxAutomationPeer(winrt::NumberBox const& owner)
00014     : ReferenceTracker(owner)
00015 {
00016 }
00017
00018 // IAutomationPeerOverrides
00019 winrt::IInspectable NumberBoxAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00020 {
00021     if (patternInterface == winrt::PatternInterface::RangeValue)
00022     {
00023         return *this;
00024     }
00025
00026     return __super::GetPatternCore(patternInterface);
00027 }
00028
00029 hstring NumberBoxAutomationPeer::GetClassNameCore()
00030 {
00031     return winrt::hstring_name_of<winrt::NumberBox>();
00032 }
00033
00034 hstring NumberBoxAutomationPeer::GetNameCore()
00035 {
00036     winrt::hstring name = __super::GetNameCore();
00037
00038     if (name.empty())
00039     {
00040         if (auto numberBox = Owner().try_as<winrt::NumberBox>())
00041         {
00042             name = SharedHelpers::TryGetStringRepresentationFromObject(numberBox.Header());
00043         }
00044     }
00045
00046     return name;
00047 }
00048
00049 winrt::AutomationControlType NumberBoxAutomationPeer::GetAutomationControlTypeCore()
00050 {
00051     return winrt::AutomationControlType::Spinner;
00052 }
00053
00054 com_ptr<NumberBox> NumberBoxAutomationPeer::GetImpl()
00055 {
00056     com_ptr<NumberBox> impl = nullptr;
00057
00058     if (auto numberBox = Owner().try_as<winrt::NumberBox>())
00059     {
00060         impl = winrt::get_self<NumberBox>(numberBox)->get_strong();
00061     }
00062
00063     return impl;
00064 }
00065
00066 // IRangeValueProvider
00067 double NumberBoxAutomationPeer::Minimum()
00068 {
00069     return GetImpl()->Minimum();
00070 }
00071
00072 double NumberBoxAutomationPeer::Maximum()
00073 {
00074     return GetImpl()->Maximum();
00075 }
00076
00077 double NumberBoxAutomationPeer::Value()
00078 {
00079     return GetImpl()->Value();
00080 }
00081
00082 double NumberBoxAutomationPeer::SmallChange()
00083 {
00084     return GetImpl()->SmallChange();
00085 }
00086
00087 double NumberBoxAutomationPeer::LargeChange()
00088 {
00089     return GetImpl()->LargeChange();
00090 }
00091
00092 void NumberBoxAutomationPeer::SetValue(double value)
00093 {
00094     GetImpl()->Value(value);
00095 }
00096
00097 void NumberBoxAutomationPeer::RaiseValueChangedEvent(double oldValue, double newValue)
00098 {
00099     __super::RaisePropertyChangedEvent(winrt::RangeValuePatternIdentifiers::ValueProperty(),
00100         winrt::PropertyValue::CreateDouble(oldValue),
00101         winrt::PropertyValue::CreateDouble(newValue));
00102 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Interactions/SliderInteraction/InteractionTests/SliderInteractionTests.cs Source File

  • Interactions
  • SliderInteraction
  • InteractionTests

SliderInteractionTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Threading;
00007
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00009 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00010 using Windows.Foundation.Metadata;
00011 using Common;
00012
00013 using WEX.TestExecution;
00014 using WEX.TestExecution.Markup;
00015 using WEX.Logging.Interop;
00016
00017 using Microsoft.Windows.Apps.Test.Automation;
00018 using Microsoft.Windows.Apps.Test.Foundation;
00019 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00020 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00021 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00022
00023 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00024 {
00025     //[TestClass] This feature requires the Xaml2018 feature, which is currently disabled by Velocity
00026     public class SliderInteractionTests
00027     {
00028         public const string HorizontalElementAutomationId = "HorizontalElement";
00029         public const string VerticalElementAutomationId = "VerticalElement";
00030         public const string HorizontalPositionTextBlockAutomationId = "HorizontalElementPositionTextBlock";
00031         public const string HorizontalMinimumTextBlockAutomationId = "HorizontalElementMinimumTextBlock";
00032         public const string HorizontalMaximumTextBlockAutomationId = "HorizontalElementMaximumTextBlock";
00033         public const string HorizontalSmallChangeTextBlockAutomationId = "HorizontalElementSmallChangeTextBlock";
00034         public const string HorizontalLargeChangeTextBlockAutomationId = "HorizontalElementLargeChangeTextBlock";
00035         public const string VerticalPositionTextBlockAutomationId = "VerticalElementPositionTextBlock";
00036         public const string VerticalMinimumTextBlockAutomationId = "VerticalElementMinimumTextBlock";
00037         public const string VerticalMaximumTextBlockAutomationId = "VerticalElementMaximumTextBlock";
00038         public const string VerticalSmallChangeTextBlockAutomationId = "VerticalElementSmallChangeTextBlock";
00039         public const string VerticalLargeChangeTextBlockAutomationId = "VerticalElementLargeChangeTextBlock";
00040
00041         [ClassInitialize]
00042         [TestProperty("RunAs", "User")]
00043         [TestProperty("Classification", "Integration")]
00044         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00045         public static void ClassInitialize(TestContext testContext)
00046         {
00047             TestEnvironment.Initialize(testContext);
00048         }
00049
00050         [TestCleanup]
00051         public void TestCleanup()
00052         {
00053             TestCleanupHelper.Cleanup();
00054         }
00055
00056         [TestMethod]
00057         public void CanSlideHorizontally()
00058         {
00059             using (var setup = new TestSetupHelper("SliderInteraction Tests"))
00060             {
00061                 var targetElement = FindElement.ById(HorizontalElementAutomationId);
00062                 var positionTextBlock = new TextBlock(FindElement.ById(HorizontalPositionTextBlockAutomationId));
00063
00064                 const int dragDistance = 200;
00065                 var startPosition = targetElement.BoundingRectangle;
00066
00067                 Log.Comment("Drag the target element diagonally.");
00068                 InputHelper.Pan(targetElement, dragDistance, Direction.SouthEast);
00069
00070                 var endPosition = targetElement.BoundingRectangle;
00071
00072                 Log.Comment("Validate that the target element only moved horizontally.");
00073                 Verify.IsGreaterThan(endPosition.X, startPosition.X);
00074                 Verify.AreEqual((int)(double.Parse(positionTextBlock.DocumentText)), endPosition.X - startPosition.X);
00075
00076                 Log.Comment("Validate that the target element didn't move vertically.");
00077                 Verify.AreEqual(startPosition.Y, endPosition.Y);
00078             }
00079         }
00080
00081         [TestMethod]
00082         public void CanSlideVertically()
00083         {
00084             using (var setup = new TestSetupHelper("SliderInteraction Tests"))
00085             {
00086                 var targetElement = FindElement.ById(VerticalElementAutomationId);
00087                 var positionTextBlock = new TextBlock(FindElement.ById(VerticalPositionTextBlockAutomationId));
00088
00089                 const int dragDistance = 200;
00090                 var startPosition = targetElement.BoundingRectangle;
00091
00092                 Log.Comment("Drag the target element diagonally.");
00093                 InputHelper.Pan(targetElement, dragDistance, Direction.SouthEast);
00094
00095                 var endPosition = targetElement.BoundingRectangle;
00096
00097                 Log.Comment("Validate that the target element only moved vertically.");
00098                 Verify.IsGreaterThan(endPosition.Y, startPosition.Y);
00099                 Verify.AreEqual((int)(double.Parse(positionTextBlock.DocumentText)), endPosition.Y - startPosition.Y);
00100
00101                 Log.Comment("Validate that the target element didn't move horizontally.");
00102                 Verify.AreEqual(startPosition.X, endPosition.X);
00103             }
00104         }
00105
00106         [TestMethod]
00107         public void DoesNotSlidePastMinimum()
00108         {
00109             using (var setup = new TestSetupHelper("SliderInteraction Tests"))
00110             {
00111                 var targetElement = FindElement.ById(HorizontalElementAutomationId);
00112                 var positionTextBlock = new TextBlock(FindElement.ById(HorizontalPositionTextBlockAutomationId));
00113                 var minimumTextBlock = new TextBlock(FindElement.ById(HorizontalMinimumTextBlockAutomationId));
00114
00115                 const int dragDistance = 300;
00116
00117                 Verify.AreEqual(minimumTextBlock.DocumentText, positionTextBlock.DocumentText);
00118
00119                 Log.Comment("Drag the target element far to the left.");
00120                 InputHelper.Pan(targetElement, dragDistance, Direction.West);
00121
00122                 var endPosition = targetElement.BoundingRectangle;
00123
00124                 Log.Comment("Validate that the target element didn't move after the second drag.");
00125                 Verify.AreEqual(minimumTextBlock.DocumentText, positionTextBlock.DocumentText);
00126             }
00127         }
00128
00129         [TestMethod]
00130         public void DoesNotSlidePastMaximum()
00131         {
00132             using (var setup = new TestSetupHelper("SliderInteraction Tests"))
00133             {
00134                 var targetElement = FindElement.ById(HorizontalElementAutomationId);
00135                 var positionTextBlock = new TextBlock(FindElement.ById(HorizontalPositionTextBlockAutomationId));
00136                 var maximumTextBlock = new TextBlock(FindElement.ById(HorizontalMaximumTextBlockAutomationId));
00137
00138                 const int dragDistance = 300;
00139
00140                 Log.Comment("Drag the target element far to the right.");
00141                 InputHelper.Pan(targetElement, dragDistance, Direction.East);
00142
00143                 Verify.AreEqual(maximumTextBlock.DocumentText, positionTextBlock.DocumentText);
00144
00145                 Log.Comment("Drag the target element to the right again.");
00146                 InputHelper.Pan(targetElement, dragDistance, Direction.East);
00147
00148                 Log.Comment("Validate that the target element didn't move after the second drag.");
00149                 Verify.AreEqual(maximumTextBlock.DocumentText, positionTextBlock.DocumentText);
00150             }
00151         }
00152
00153         [TestMethod]
00154         public void CanSlideHorizontallyWithKeyboard()
00155         {
00156             using (var setup = new TestSetupHelper("SliderInteraction Tests"))
00157             {
00158                 var targetElement = FindElement.ById(HorizontalElementAutomationId);
00159                 var positionTextBlock = new TextBlock(FindElement.ById(HorizontalPositionTextBlockAutomationId));
00160                 var smallIncrTextBlock = new TextBlock(FindElement.ById(HorizontalSmallChangeTextBlockAutomationId));
00161                 var largeChangeTextBlock = new TextBlock(FindElement.ById(HorizontalLargeChangeTextBlockAutomationId));
00162                 var minimumTextBlock = new TextBlock(FindElement.ById(HorizontalMinimumTextBlockAutomationId));
00163                 var maximumTextBlock = new TextBlock(FindElement.ById(HorizontalMaximumTextBlockAutomationId));
00164
00165                 var minimum = (int)(double.Parse(minimumTextBlock.DocumentText));
00166                 var maximum = (int)(double.Parse(maximumTextBlock.DocumentText));
00167                 var smallIncr = (int)(double.Parse(smallIncrTextBlock.DocumentText));
00168                 var largeIncr = (int)(double.Parse(largeChangeTextBlock.DocumentText));
00169
00170                 Log.Comment("Focus the target element.");
00171                 targetElement.SetFocus();
00172                 Wait.ForIdle();
00173
00174                 var startPosition = targetElement.BoundingRectangle;
00175
00176                 Log.Comment("Inject RIGHT to move the element right.");
00177                 targetElement.SendKeys("{RIGHT}");
00178                 Wait.ForIdle();
00179
00180                 var endPosition = targetElement.BoundingRectangle;
00181
00182                 Verify.AreEqual(smallIncr, endPosition.X - startPosition.X);
00183                 Verify.AreEqual(smallIncr, (int)(double.Parse(positionTextBlock.DocumentText)));
00184
00185                 startPosition = endPosition;
00186
00187                 Log.Comment("Inject PAGE DOWN to move the element right.");
00188                 targetElement.SendKeys("{PGDN}");
00189                 Wait.ForIdle();
00190
00191                 endPosition = targetElement.BoundingRectangle;
00192
00193                 Verify.AreEqual(largeIncr, endPosition.X - startPosition.X);
00194                 Verify.AreEqual(smallIncr + largeIncr, (int)(double.Parse(positionTextBlock.DocumentText)));
00195
00196                 startPosition = endPosition;
00197
00198                 Log.Comment("Inject LEFT to move the element left.");
00199                 targetElement.SendKeys("{LEFT}");
00200                 Wait.ForIdle();
00201
00202                 endPosition = targetElement.BoundingRectangle;
00203
00204                 Verify.AreEqual(-smallIncr, endPosition.X - startPosition.X);
00205                 Verify.AreEqual(largeIncr, (int)(double.Parse(positionTextBlock.DocumentText)));
00206
00207                 startPosition = endPosition;
00208
00209                 Log.Comment("Inject PAGE UP to move the element left.");
00210                 targetElement.SendKeys("{PGUP}");
00211                 Wait.ForIdle();
00212
00213                 endPosition = targetElement.BoundingRectangle;
00214
00215                 Verify.AreEqual(-largeIncr, endPosition.X - startPosition.X);
00216                 Verify.AreEqual(0, (int)(double.Parse(positionTextBlock.DocumentText)));
00217
00218                 startPosition = endPosition;
00219
00220                 Log.Comment("Inject END to move the element to the maximum position.");
00221                 targetElement.SendKeys("{END}");
00222                 Wait.ForIdle();
00223
00224                 endPosition = targetElement.BoundingRectangle;
00225
00226                 Verify.AreEqual(maximum - minimum, endPosition.X - startPosition.X);
00227                 Verify.AreEqual(maximum, (int)(double.Parse(positionTextBlock.DocumentText)));
00228
00229                 startPosition = endPosition;
00230
00231                 Log.Comment("Inject HOME to move the element to the minimum position.");
00232                 targetElement.SendKeys("{HOME}");
00233                 Wait.ForIdle();
00234
00235                 endPosition = targetElement.BoundingRectangle;
00236
00237                 Verify.AreEqual(minimum - maximum, endPosition.X - startPosition.X);
00238                 Verify.AreEqual(minimum, (int)(double.Parse(positionTextBlock.DocumentText)));
00239             }
00240         }
00241
00242         [TestMethod]
00243         public void CanSlideVerticallyWithKeyboard()
00244         {
00245             using (var setup = new TestSetupHelper("SliderInteraction Tests"))
00246             {
00247                 var targetElement = FindElement.ById(VerticalElementAutomationId);
00248                 var positionTextBlock = new TextBlock(FindElement.ById(VerticalPositionTextBlockAutomationId));
00249                 var smallIncrTextBlock = new TextBlock(FindElement.ById(VerticalSmallChangeTextBlockAutomationId));
00250                 var largeChangeTextBlock = new TextBlock(FindElement.ById(VerticalLargeChangeTextBlockAutomationId));
00251                 var minimumTextBlock = new TextBlock(FindElement.ById(VerticalMinimumTextBlockAutomationId));
00252                 var maximumTextBlock = new TextBlock(FindElement.ById(VerticalMaximumTextBlockAutomationId));
00253
00254                 var minimum = (int)(double.Parse(minimumTextBlock.DocumentText));
00255                 var maximum = (int)(double.Parse(maximumTextBlock.DocumentText));
00256                 var smallIncr = (int)(double.Parse(smallIncrTextBlock.DocumentText));
00257                 var largeIncr = (int)(double.Parse(largeChangeTextBlock.DocumentText));
00258
00259                 Log.Comment("Focus the target element.");
00260                 targetElement.SetFocus();
00261                 Wait.ForIdle();
00262
00263                 var startPosition = targetElement.BoundingRectangle;
00264
00265                 Log.Comment("Inject DOWN to move the element right.");
00266                 targetElement.SendKeys("{DOWN}");
00267                 Wait.ForIdle();
00268
00269                 var endPosition = targetElement.BoundingRectangle;
00270
00271                 Verify.AreEqual(smallIncr, endPosition.Y - startPosition.Y);
00272                 Verify.AreEqual(smallIncr, (int)(double.Parse(positionTextBlock.DocumentText)));
00273
00274                 startPosition = endPosition;
00275
00276                 Log.Comment("Inject PAGE DOWN to move the element right.");
00277                 targetElement.SendKeys("{PGDN}");
00278                 Wait.ForIdle();
00279
00280                 endPosition = targetElement.BoundingRectangle;
00281
00282                 Verify.AreEqual(largeIncr, endPosition.Y - startPosition.Y);
00283                 Verify.AreEqual(smallIncr + largeIncr, (int)(double.Parse(positionTextBlock.DocumentText)));
00284
00285                 startPosition = endPosition;
00286
00287                 Log.Comment("Inject UP to move the element left.");
00288                 targetElement.SendKeys("{UP}");
00289                 Wait.ForIdle();
00290
00291                 endPosition = targetElement.BoundingRectangle;
00292
00293                 Verify.AreEqual(-smallIncr, endPosition.Y - startPosition.Y);
00294                 Verify.AreEqual(largeIncr, (int)(double.Parse(positionTextBlock.DocumentText)));
00295
00296                 startPosition = endPosition;
00297
00298                 Log.Comment("Inject PAGE UP to move the element left.");
00299                 targetElement.SendKeys("{PGUP}");
00300                 Wait.ForIdle();
00301
00302                 endPosition = targetElement.BoundingRectangle;
00303
00304                 Verify.AreEqual(-largeIncr, endPosition.Y - startPosition.Y);
00305                 Verify.AreEqual(0, (int)(double.Parse(positionTextBlock.DocumentText)));
00306
00307                 startPosition = endPosition;
00308
00309                 Log.Comment("Inject END to move the element to the maximum position.");
00310                 targetElement.SendKeys("{END}");
00311                 Wait.ForIdle();
00312
00313                 endPosition = targetElement.BoundingRectangle;
00314
00315                 Verify.AreEqual(maximum - minimum, endPosition.Y - startPosition.Y);
00316                 Verify.AreEqual(maximum, (int)(double.Parse(positionTextBlock.DocumentText)));
00317
00318                 startPosition = endPosition;
00319
00320                 Log.Comment("Inject HOME to move the element to the minimum position.");
00321                 targetElement.SendKeys("{HOME}");
00322                 Wait.ForIdle();
00323
00324                 endPosition = targetElement.BoundingRectangle;
00325
00326                 Verify.AreEqual(minimum - maximum, endPosition.Y - startPosition.Y);
00327                 Verify.AreEqual(minimum, (int)(double.Parse(positionTextBlock.DocumentText)));
00328             }
00329         }
00330     }
00331 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

WebView2 Member List

This is the complete list of members for WebView2, including all inherited members.
abi_enter() | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
AreAllAncestorsVisible() | WebView2 | [private]
ArrangeOverride(winrt::Size const &finalSize) | WebView2 |
CanGoBack(bool value) | WebView2Properties |
CanGoBack() | WebView2Properties |
CanGoBackProperty() | WebView2Properties | [inline, static]
CanGoForward(bool value) | WebView2Properties |
CanGoForward() | WebView2Properties |
CanGoForwardProperty() | WebView2Properties | [inline, static]
CheckAndUpdateVisibility(bool force=false) | WebView2 | [private]
CheckAndUpdateWebViewPosition() | WebView2 | [private]
CheckAndUpdateWindowPosition() | WebView2 | [private]
CheckThread() | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
ClearProperties() | WebView2Properties | [static]
Close() | WebView2 |
CloseInternal(bool inShutdownPath) | WebView2 | [private]
ConvertXamlArgsToOle32Args(const winrt::DragEventArgs &args, DWORD &keyState, POINT &cursorPosition, DWORD &dropEffect, IDataObject **dataObject) | WebView2 | [private]
CoreProcessFailed(winrt::TypedEventHandler< winrt::WebView2, winrt::CoreWebView2ProcessFailedEventArgs > const &value) | WebView2Properties |
CoreProcessFailed(winrt::event_token const &token) | WebView2Properties |
CoreWebView2() | WebView2 |
CoreWebView2HasInvalidState() | WebView2 | [private]
CoreWebView2Initialized(winrt::TypedEventHandler< winrt::WebView2, winrt::CoreWebView2InitializedEventArgs > const &value) | WebView2Properties |
CoreWebView2Initialized(winrt::event_token const &token) | WebView2Properties |
CoreWebView2RunIgnoreInvalidStateSync(Delegate delegate) | WebView2 | [private]
CoreWebView2RunIgnoreInvalidStateSync(Delegate delegate) | WebView2 |
CreateAndSetVisual() | WebView2 | [private]
CreateCoreObjects(winrt::CoreWebView2Environment environment=nullptr, winrt::CoreWebView2ControllerOptions controllerOptions=nullptr) | WebView2 | [private]
CreateCoreWebViewFromEnvironment(HWND hwndParent, winrt::CoreWebView2ControllerOptions controllerOptions=nullptr) | WebView2 | [private]
CreateDefaultCoreEnvironment() noexcept | WebView2 | [private]
CreateMissingAnaheimWarning() | WebView2 | [private]
DataPackageOperationFromDropEffect(DWORD dropEffect) | WebView2 | [private]
DefaultBackgroundColor(winrt::Color const &value) | WebView2Properties |
DefaultBackgroundColor() | WebView2Properties |
DefaultBackgroundColorProperty() | WebView2Properties | [inline, static]
DeleteInstanceOnUIThread(std::unique_ptr< WebView2 > &&self) noexcept | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline, static]
DisconnectFromRootVisualTarget() | WebView2 | [private]
EnsureCoreWebView2Async() | WebView2 |
EnsureCoreWebView2Async(winrt::CoreWebView2Environment environment) | WebView2 |
EnsureCoreWebView2Async(winrt::CoreWebView2Environment environment, winrt::CoreWebView2ControllerOptions controllerOptions) | WebView2 |
EnsureProperties() | WebView2Properties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
EnsureTemporaryHostHwnd() | WebView2 | [private]
ExecuteScriptAsync(winrt::hstring javascriptCode) | WebView2 |
FillPointerInfo(const winrt::PointerPoint &inputPt, winrt::CoreWebView2PointerInfo outputPt, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
FillPointerPenInfo(const winrt::PointerPoint &inputPt, winrt::CoreWebView2PointerInfo outputPt) | WebView2 | [private]
FillPointerTouchInfo(const winrt::PointerPoint &inputPt, winrt::CoreWebView2PointerInfo outputPt) | WebView2 | [private]
final_release(std::unique_ptr< WebView2 > &&self) | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline, static]
FireCoreProcessFailedEvent(const winrt::CoreWebView2ProcessFailedEventArgs &args) | WebView2 | [private]
FireCoreWebView2Initialized(winrt::hresult exception) | WebView2 | [private]
FireNavigationCompleted(const winrt::CoreWebView2NavigationCompletedEventArgs &args) | WebView2 | [private]
FireNavigationStarting(const winrt::CoreWebView2NavigationStartingEventArgs &args) | WebView2 | [private]
FireWebMessageReceived(const winrt::CoreWebView2WebMessageReceivedEventArgs &args) | WebView2 | [private]
GetAccessibilitySettings() | WebView2 | [private]
GetBase() | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
GetComponentHwnd() | WebView2 | [private]
GetHostHwnd() noexcept | WebView2 | [private]
GetInner() | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
GetPointerFlags(const winrt::PointerPoint &inputPt) | WebView2 | [private]
GetProviderForHwnd(HWND hwnd) | WebView2 |
GetThemeBackgroundColor() | WebView2 | [private]
GetUISettings() | WebView2 | [private]
GetWebView2Provider() | WebView2 |
GoBack() | WebView2 |
GoForward() | WebView2 |
HandleGettingFocus(const winrt::Windows::Foundation::IInspectable &, const winrt::GettingFocusEventArgs &args) noexcept | WebView2 | [private]
HandleGotFocus(const winrt::Windows::Foundation::IInspectable &, const winrt::RoutedEventArgs &) noexcept | WebView2 | [private]
HandleLosingFocus(const winrt::Windows::Foundation::IInspectable &, const winrt::RoutedEventArgs &) noexcept | WebView2 | [private]
HandlePointerCanceled(const winrt::Windows::Foundation::IInspectable &, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
HandlePointerCaptureLost(const winrt::Windows::Foundation::IInspectable &, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
HandlePointerEntered(const winrt::Windows::Foundation::IInspectable &, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
HandlePointerExited(const winrt::Windows::Foundation::IInspectable &, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
HandlePointerMoved(const winrt::Windows::Foundation::IInspectable &, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
HandlePointerPressed(const winrt::Windows::Foundation::IInspectable &, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
HandlePointerReleased(const winrt::Windows::Foundation::IInspectable &, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
HandlePointerWheelChanged(const winrt::Windows::Foundation::IInspectable &, const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
HandleRendered(const winrt::IInspectable &, const winrt::IInspectable &) | WebView2 | [private]
HandleSizeChanged(const winrt::IInspectable &, const winrt::SizeChangedEventArgs &args) | WebView2 | [private]
HandleXamlRootChanged() | WebView2 | [private]
IsOnThread() | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
m_acceleratorKeyActivatedRevoker | WebView2 | [private]
m_accessibilitySettings | WebView2 | [private]
m_coreMoveFocusRequestedRevoker | WebView2 | [private]
m_coreNavigationCompletedRevoker | WebView2 | [private]
m_coreNavigationStartingRevoker | WebView2 | [private]
m_coreProcessFailedEventSource | WebView2Properties |
m_coreProcessFailedRevoker | WebView2 | [private]
m_coreSourceChangedRevoker | WebView2 | [private]
m_coreWebMessageReceivedRevoker | WebView2 | [private]
m_coreWebView2InitializedEventSource | WebView2Properties |
m_cursorChangedRevoker | WebView2 | [private]
m_gettingFocusRevoker | WebView2 | [private]
m_gotFocusRevoker | WebView2 | [private]
m_isExplicitControllerOptions | WebView2 | [private]
m_isExplicitEnvironment | WebView2 | [private]
m_keyDownRevoker | WebView2 | [private]
m_losingFocusRevoker | WebView2 | [private]
m_navigationCompletedEventSource | WebView2Properties |
m_navigationStartingEventSource | WebView2Properties |
m_pointerCanceledRevoker | WebView2 | [private]
m_pointerCaptureLostRevoker | WebView2 | [private]
m_pointerEnteredRevoker | WebView2 | [private]
m_pointerExitedRevoker | WebView2 | [private]
m_pointerMovedRevoker | WebView2 | [private]
m_pointerPressedRevoker | WebView2 | [private]
m_pointerReleasedRevoker | WebView2 | [private]
m_pointerWheelChangedRevoker | WebView2 | [private]
m_sizeChangedRevoker | WebView2 | [private]
m_systemVisualBridge | WebView2 | [private]
m_uiSettings | WebView2 | [private]
m_webMessageReceivedEventSource | WebView2Properties |
MeasureOverride(winrt::Size const &availableSize) | WebView2 |
MoveFocusIntoCoreWebView2(winrt::CoreWebView2MoveFocusReason reason) | WebView2 | [private]
NavigateToString(winrt::hstring htmlContent) | WebView2 |
NavigationCompleted(winrt::TypedEventHandler< winrt::WebView2, winrt::CoreWebView2NavigationCompletedEventArgs > const &value) | WebView2Properties |
NavigationCompleted(winrt::event_token const &token) | WebView2Properties |
NavigationStarting(winrt::TypedEventHandler< winrt::WebView2, winrt::CoreWebView2NavigationStartingEventArgs > const &value) | WebView2Properties |
NavigationStarting(winrt::event_token const &token) | WebView2Properties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
OnAppWindowPositionChanged(const winrt::Microsoft::UI::Windowing::AppWindow &sender, const winrt::Microsoft::UI::Windowing::AppWindowChangedEventArgs &args) | WebView2 | [private]
OnCanGoBackPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | WebView2Properties | [static]
OnCanGoForwardPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | WebView2Properties | [static]
OnCreateAutomationPeer() | WebView2 |
OnDefaultBackgroundColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | WebView2Properties | [static]
OnDragEnter(const winrt::IInspectable &sender, const winrt::DragEventArgs &args) | WebView2 | [private]
OnDragLeave(const winrt::IInspectable &sender, const winrt::DragEventArgs &args) | WebView2 | [private]
OnDragOver(const winrt::IInspectable &sender, const winrt::DragEventArgs &args) | WebView2 | [private]
OnDrop(const winrt::IInspectable &sender, const winrt::DragEventArgs &args) | WebView2 | [private]
OnLoaded(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | WebView2 |
OnManipulationModePropertyChanged(const winrt::DependencyObject &, const winrt::DependencyProperty &) | WebView2 | [private]
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | WebView2 |
OnSourceChanged(winrt::Uri providedUri) | WebView2 | [private]
OnSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | WebView2Properties | [static]
OnUnloaded(winrt::IInspectable const &sender, winrt::RoutedEventArgs const &args) | WebView2 |
OnVisibilityPropertyChanged(const winrt::DependencyObject &, const winrt::DependencyProperty &) | WebView2 | [private]
OnXamlPointerMessage(UINT message, const winrt::PointerRoutedEventArgs &args) noexcept | WebView2 | [private]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost > | [inline]
RegisterCoreEventHandlers() | WebView2 | [private]
RegisterXamlEventHandlers() | WebView2 | [private]
Reload() | WebView2 |
ResetMouseInputState() | WebView2 | [private]
ResetPointerHelper(const winrt::PointerRoutedEventArgs &args) | WebView2 | [private]
ResetProperties() | WebView2 | [private]
s_CanGoBackProperty | WebView2Properties | [static]
s_CanGoForwardProperty | WebView2Properties | [static]
s_DefaultBackgroundColorProperty | WebView2Properties | [static]
s_SourceProperty | WebView2Properties | [static]
sc_controllerDefaultBackgroundColor | WebView2 | [static]
ScalePointToPhysicalPixels(winrt::Point inputPoint) | WebView2 | [private]
ScaleRectToPhysicalPixels(winrt::Rect inputRect) | WebView2 | [private]
SendMouseLeave() | WebView2 | [private]
SetCanGoBack(bool canGoBack) | WebView2 | [private]
SetCanGoForward(bool canGoForward) | WebView2 | [private]
SetControllerDefaultBackgroundColor() | WebView2 | [private]
SetCoreWebViewAndVisualSize(const float width, const float height) | WebView2 | [private]
ShouldNavigate(const winrt::Uri &uri) | WebView2 | [private]
Source(winrt::Uri const &value) | WebView2Properties |
Source() | WebView2Properties |
SourceProperty() | WebView2Properties | [inline, static]
TryCompleteInitialization() | WebView2 | [private]
UnregisterCoreEventHandlers() | WebView2 | [private]
UnregisterXamlEventHandlers() | WebView2 | [private]
UpdateCoreWebViewScale() | WebView2 |
UpdateCoreWebViewVisibility() | WebView2 | [private]
UpdateDefaultVisualBackgroundColor() | WebView2 | [private]
UpdateParentWindow(HWND newParentWindow) | WebView2 | [private]
UpdateRenderedSubscriptionAndVisibility() | WebView2 | [private]
UpdateSourceInternal() | WebView2 | [private]
WebMessageReceived(winrt::TypedEventHandler< winrt::WebView2, winrt::CoreWebView2WebMessageReceivedEventArgs > const &value) | WebView2Properties |
WebMessageReceived(winrt::event_token const &token) | WebView2Properties |
WebView2() | WebView2 |
WebView2Properties() | WebView2Properties |
XamlRootChangedHelper(bool forceUpdate) | WebView2 | [private]
~WebView2() | WebView2 | [virtual]
Generated on Sun Dec 1 2024 20:53:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PTRTrace Member List

This is the complete list of members for PTRTrace, including all inherited members.
s_IsDebugOutputEnabled | PTRTrace | [static]
s_IsVerboseDebugOutputEnabled | PTRTrace | [static]
TraceInfo(bool includeTraceLogging, const winrt::IInspectable &sender, PCWSTR message,...) noexcept | PTRTrace | [inline, static]
TracePerfInfo(PCWSTR info) noexcept | PTRTrace | [inline, static]
TraceVerbose(bool includeTraceLogging, const winrt::IInspectable &sender, PCWSTR message,...) noexcept | PTRTrace | [inline, static]
Generated on Sun Dec 1 2024 20:53:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SelectorBar/SelectorBar.idl Source File

  • SelectorBar

SelectorBar.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC_V6]
00005 [default_interface]
00006 [webhosthidden]
00007 runtimeclass SelectorBarSelectionChangedEventArgs
00008 {
00009 }
00010
00011 [MUX_PUBLIC_V6]
00012 [webhosthidden]
00013 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00014 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00015 unsealed runtimeclass SelectorBarItem : ItemContainer
00016 {
00017     SelectorBarItem();
00018
00019     String Text{ get; set; };
00020     IconElement Icon{ get; set; };
00021
00022     static Microsoft.UI.Xaml.DependencyProperty TextProperty{ get; };
00023     static Microsoft.UI.Xaml.DependencyProperty IconProperty{ get; };
00024 }
00025
00026 [MUX_PUBLIC_V6]
00027 [webhosthidden]
00028 [contentproperty("Items")]
00029 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00030 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00031 unsealed runtimeclass SelectorBar : Microsoft.UI.Xaml.Controls.Control
00032 {
00033     SelectorBar();
00034
00035     Windows.Foundation.Collections.IVector<SelectorBarItem> Items{ get; };
00036     SelectorBarItem SelectedItem{ get; set; };
00037
00038     event Windows.Foundation.TypedEventHandler<SelectorBar, SelectorBarSelectionChangedEventArgs> SelectionChanged;
00039
00040     static Microsoft.UI.Xaml.DependencyProperty ItemsProperty{ get; };
00041     static Microsoft.UI.Xaml.DependencyProperty SelectedItemProperty{ get; };
00042 }
00043
00044 }
00045
00046 namespace MU_XAP_NAMESPACE
00047 {
00048
00049 [MUX_PUBLIC_V6]
00050 [webhosthidden]
00051 unsealed runtimeclass SelectorBarItemAutomationPeer : MU_XAP_NAMESPACE.ItemContainerAutomationPeer
00052 {
00053     [method_name("CreateInstanceWithOwner")]
00054     SelectorBarItemAutomationPeer(MU_XC_NAMESPACE.SelectorBarItem owner);
00055 }
00056
00057 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DynamicPage Member List

This is the complete list of members for DynamicPage, including all inherited members.
AnimatedValuesSpy | DynamicPage | [private]
btnCreateParallaxView_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetHorizontalOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetHorizontalShift_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetHorizontalSourceEndOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetHorizontalSourceStartOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetMaxHorizontalShiftRatio_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetMaxVerticalShiftRatio_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetSCHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetSCWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetTEActualHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetTEActualWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetTEHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetTEMargin_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetTEMaxHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetTEMaxWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetTEWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetVerticalOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetVerticalShift_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetVerticalSourceEndOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetVerticalSourceStartOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnGetZoomFactor_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnRefreshAutomaticHorizontalOffsets_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnRefreshAutomaticVerticalOffsets_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnReleaseParallaxView_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnReparentSource_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetHorizontalOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetHorizontalShift_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetHorizontalSourceEndOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetHorizontalSourceStartOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetMaxHorizontalShiftRatio_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetMaxVerticalShiftRatio_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetSCHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetSCWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetTEHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetTEMargin_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetTEMaxHeight_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetTEMaxWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetTEWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetVerticalOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetVerticalShift_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetVerticalSourceEndOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetVerticalSourceStartOffset_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetWidth_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnSetZoomFactor_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
btnUnparentSource_Click(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
CheckSpyingTicksRequirement() | DynamicPage | [inline, private]
chkAreHorizontalSourceOffsetsRelative_Checked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkAreHorizontalSourceOffsetsRelative_Unchecked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkAreVerticalSourceOffsetsRelative_Checked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkAreVerticalSourceOffsetsRelative_Unchecked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkIsHorizontalShiftClamped_Checked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkIsHorizontalShiftClamped_Unchecked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkIsRTL_Checked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkIsRTL_Unchecked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkIsVerticalShiftClamped_Checked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
chkIsVerticalShiftClamped_Unchecked(object sender, RoutedEventArgs e) | DynamicPage | [inline, private]
cmbHorizontalContentAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbHorizontalScrollMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbParallaxView_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbSCHorizontalAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbSCVerticalAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbSource_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbSourceContent_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbTargetElement_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbTEHorizontalAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbTEVerticalAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbVerticalContentAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbVerticalScrollMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
cmbZoomMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | DynamicPage | [inline, private]
CompositionTarget_Rendering(object sender, object e) | DynamicPage | [inline, private]
DynamicPage() | DynamicPage | [inline]
DynamicParallaxView | DynamicPage | [private]
HasDirectManipulation | DynamicPage | [private]
HorizontalOffsetAnimation | DynamicPage | [private]
IsRenderingHooked | DynamicPage | [private]
ParallaxView | DynamicPage | [private]
rectSC | DynamicPage | [private]
RefreshContentAlignments() | DynamicPage | [inline, private]
RefreshHorizontalScrollMode() | DynamicPage | [inline, private]
RefreshSourceContent() | DynamicPage | [inline, private]
RefreshSourceContentSizes() | DynamicPage | [inline, private]
RefreshSVCAlignments() | DynamicPage | [inline, private]
RefreshTEAlignments() | DynamicPage | [inline, private]
RefreshTESizes() | DynamicPage | [inline, private]
RefreshVerticalScrollMode() | DynamicPage | [inline, private]
RefreshZoomMode() | DynamicPage | [inline, private]
ResetSpyOutput() | DynamicPage | [inline, private]
scrollPresenter | DynamicPage | [private]
ScrollPresenter | DynamicPage | [private]
ScrollPresenter_ViewChanged(ScrollPresenter sender, object args) | DynamicPage | [inline, private]
ScrollViewer | DynamicPage | [private]
ScrollViewer_DirectManipulationCompleted(object sender, object e) | DynamicPage | [inline, private]
ScrollViewer_DirectManipulationStarted(object sender, object e) | DynamicPage | [inline, private]
ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e) | DynamicPage | [inline, private]
SetupAnimatedValuesSpy() | DynamicPage | [inline, private]
SetupScrollPresenter() | DynamicPage | [inline, private]
SpyAnimatedValues() | DynamicPage | [inline, private]
StartAnimatedValuesSpy() | DynamicPage | [inline, private]
StopAnimatedValuesSpy() | DynamicPage | [inline, private]
TargetElement | DynamicPage | [private]
TickForValuesSpy() | DynamicPage | [inline, private]
UIThreadTicksForValuesSpy | DynamicPage | [private]
VerticalOffsetAnimation | DynamicPage | [private]
Generated on Sun Dec 1 2024 20:54:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/CheckBoxPage.xaml.cs Source File

  • CommonStyles
  • TestUI

CheckBoxPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     [TopLevelTestPage(Name = "CheckBox", Icon = "CheckBox.png")]
00007     public sealed partial class CheckBoxPage : TestPage
00008     {
00009         public CheckBoxPage()
00010         {
00011             this.InitializeComponent();
00012         }
00013         public void OnReverseButtonClicked(object sender, object args)
00014         {
00015             var isChecked = ThreeStateCheckbox.IsChecked;
00016             if (isChecked.HasValue && isChecked.Value)
00017             {
00018                 ThreeStateCheckbox.IsChecked = false;
00019             }
00020             else if(isChecked.HasValue && !isChecked.Value)
00021             {
00022                 ThreeStateCheckbox.IsChecked = null;
00023             }
00024             else if(!isChecked.HasValue)
00025             {
00026                 ThreeStateCheckbox.IsChecked = true;
00027             }
00028         }
00029     }
00030 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ChildrenInTabFocusOrderIterable.cpp Source File

  • Repeater

ChildrenInTabFocusOrderIterable.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "ChildrenInTabFocusOrderIterable.h"
00008 #include "ItemsRepeater.h"
00009
00010 ChildrenInTabFocusOrderIterable::ChildrenInTabFocusOrderIterable(const winrt::ItemsRepeater& repeater)
00011 {
00012     m_repeater.set(repeater);
00013 }
00014
00015 winrt::IIterator<winrt::DependencyObject>
00016 ChildrenInTabFocusOrderIterable::First()
00017 {
00018     return winrt::make<ChildrenInTabFocusOrderIterable::ChildrenInTabFocusOrderIterator>(m_repeater.get());
00019 }
00020
00021 ChildrenInTabFocusOrderIterable::ChildrenInTabFocusOrderIterator::ChildrenInTabFocusOrderIterator(const winrt::ItemsRepeater& repeater)
00022 {
00023     auto children = repeater.as<winrt::Panel>().Children();
00024     m_realizedChildren.reserve(children.Size());
00025
00026     // Filter out unrealized children.
00027     for (unsigned i = 0u; i < children.Size(); ++i)
00028     {
00029         auto element = children.GetAt(i);
00030         auto virtInfo = ItemsRepeater::GetVirtualizationInfo(element);
00031         if (virtInfo->IsRealized())
00032         {
00033             m_realizedChildren.push_back(std::make_pair(virtInfo->Index(), element));
00034         }
00035     }
00036
00037     // Sort children by index.
00038     std::sort(m_realizedChildren.begin(), m_realizedChildren.end(), [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; });
00039 }
00040
00041 winrt::DependencyObject
00042 ChildrenInTabFocusOrderIterable::ChildrenInTabFocusOrderIterator::Current()
00043 {
00044     if (m_index < static_cast<int>(m_realizedChildren.size()))
00045     {
00046         return m_realizedChildren[m_index].second.as<winrt::DependencyObject>();
00047     }
00048     else
00049     {
00050         throw winrt::hresult_out_of_bounds();
00051     }
00052
00053     return nullptr;
00054 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterTestHooks.idl Source File

  • ScrollPresenter

ScrollPresenterTestHooks.idl

Go to the documentation of this file.
00001 ﻿namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [webhosthidden]
00006 enum ScrollPresenterViewChangeResult
00007 {
00008     Completed = 0,
00009     Interrupted = 1,
00010     Ignored = 2,
00011 };
00012
00013 [MUX_INTERNAL]
00014 [webhosthidden]
00015 runtimeclass ScrollPresenterTestHooksAnchorEvaluatedEventArgs
00016 {
00017     Double ViewportAnchorPointHorizontalOffset { get; };
00018     Double ViewportAnchorPointVerticalOffset { get; };
00019     Microsoft.UI.Xaml.UIElement AnchorElement { get; };
00020 }
00021
00022 [MUX_INTERNAL]
00023 [webhosthidden]
00024 runtimeclass ScrollPresenterTestHooksInteractionSourcesChangedEventArgs
00025 {
00026     Microsoft.UI.Composition.Interactions.CompositionInteractionSourceCollection InteractionSources { get; };
00027 }
00028
00029 [MUX_INTERNAL]
00030 [webhosthidden]
00031 runtimeclass ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs
00032 {
00033     Boolean IsExpressionAnimationStarted { get; };
00034     String PropertyName{ get; };
00035 }
00036
00037 [MUX_INTERNAL]
00038 [default_interface]
00039 [webhosthidden]
00040 runtimeclass ScrollPresenterTestHooks
00041 {
00042     static Boolean AreAnchorNotificationsRaised { get; set; };
00043     static Boolean AreInteractionSourcesNotificationsRaised { get; set; };
00044     static Boolean AreExpressionAnimationStatusNotificationsRaised { get; set; };
00045     static Windows.Foundation.IReference<Boolean> IsAnimationsEnabledOverride { get; set; };
00046     static void GetOffsetsChangeVelocityParameters(out Int32 millisecondsPerUnit, out Int32 minMilliseconds, out Int32 maxMilliseconds);
00047     static void SetOffsetsChangeVelocityParameters(Int32 millisecondsPerUnit, Int32 minMilliseconds, Int32 maxMilliseconds);
00048     static void GetZoomFactorChangeVelocityParameters(out Int32 millisecondsPerUnit, out Int32 minMilliseconds, out Int32 maxMilliseconds);
00049     static void SetZoomFactorChangeVelocityParameters(Int32 millisecondsPerUnit, Int32 minMilliseconds, Int32 maxMilliseconds);
00050     static void GetContentLayoutOffsetX(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, out Single contentLayoutOffsetX);
00051     static void SetContentLayoutOffsetX(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, Single contentLayoutOffsetX);
00052     static void GetContentLayoutOffsetY(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, out Single contentLayoutOffsetY);
00053     static void SetContentLayoutOffsetY(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, Single contentLayoutOffsetY);
00054     static String GetTransformExpressionAnimationExpression(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00055     static void SetTransformExpressionAnimationExpression(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, String transformExpressionAnimationExpression);
00056     static String GetMinPositionExpressionAnimationExpression(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00057     static void SetMinPositionExpressionAnimationExpression(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, String minPositionExpressionAnimationExpression);
00058     static String GetMaxPositionExpressionAnimationExpression(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00059     static void SetMaxPositionExpressionAnimationExpression(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, String maxPositionExpressionAnimationExpression);
00060     static Windows.Foundation.Numerics.Vector2 GetArrangeRenderSizesDelta(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00061     static Windows.Foundation.Numerics.Vector2 GetPosition(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00062     static Windows.Foundation.Numerics.Vector2 GetMinPosition(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00063     static void SetMinPosition(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, Windows.Foundation.Numerics.Vector2 minPosition);
00064     static Windows.Foundation.Numerics.Vector2 GetMaxPosition(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00065     static void SetMaxPosition(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, Windows.Foundation.Numerics.Vector2 maxPosition);
00066     static ScrollPresenterViewChangeResult GetScrollCompletedResult(MU_XC_NAMESPACE.ScrollingScrollCompletedEventArgs scrollCompletedEventArgs);
00067     static ScrollPresenterViewChangeResult GetZoomCompletedResult(MU_XC_NAMESPACE.ScrollingZoomCompletedEventArgs zoomCompletedEventArgs);
00068     static Windows.Foundation.Collections.IVector<MU_XCP_NAMESPACE.ScrollSnapPointBase> GetConsolidatedHorizontalScrollSnapPoints(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00069     static Windows.Foundation.Collections.IVector<MU_XCP_NAMESPACE.ScrollSnapPointBase> GetConsolidatedVerticalScrollSnapPoints(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00070     static Windows.Foundation.Collections.IVector<MU_XCP_NAMESPACE.ZoomSnapPointBase> GetConsolidatedZoomSnapPoints(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter);
00071     static Windows.Foundation.Numerics.Vector2 GetHorizontalSnapPointActualApplicableZone(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, MU_XCP_NAMESPACE.ScrollSnapPointBase scrollSnapPoint);
00072     static Windows.Foundation.Numerics.Vector2 GetVerticalSnapPointActualApplicableZone(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, MU_XCP_NAMESPACE.ScrollSnapPointBase scrollSnapPoint);
00073     static Windows.Foundation.Numerics.Vector2 GetZoomSnapPointActualApplicableZone(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, MU_XCP_NAMESPACE.ZoomSnapPointBase zoomSnapPoint);
00074     static Int32 GetHorizontalSnapPointCombinationCount(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, MU_XCP_NAMESPACE.ScrollSnapPointBase scrollSnapPoint);
00075     static Int32 GetVerticalSnapPointCombinationCount(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, MU_XCP_NAMESPACE.ScrollSnapPointBase scrollSnapPoint);
00076     static Int32 GetZoomSnapPointCombinationCount(MU_XCP_NAMESPACE.ScrollPresenter scrollPresenter, MU_XCP_NAMESPACE.ZoomSnapPointBase zoomSnapPoint);
00077     static Windows.UI.Color GetSnapPointVisualizationColor(MU_XCP_NAMESPACE.SnapPointBase snapPoint);
00078     static void SetSnapPointVisualizationColor(MU_XCP_NAMESPACE.SnapPointBase snapPoint, Windows.UI.Color color);
00079     static event Windows.Foundation.TypedEventHandler<MU_XCP_NAMESPACE.ScrollPresenter, ScrollPresenterTestHooksAnchorEvaluatedEventArgs> AnchorEvaluated;
00080     static event Windows.Foundation.TypedEventHandler<MU_XCP_NAMESPACE.ScrollPresenter, ScrollPresenterTestHooksInteractionSourcesChangedEventArgs> InteractionSourcesChanged;
00081     static event Windows.Foundation.TypedEventHandler<MU_XCP_NAMESPACE.ScrollPresenter, ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs> ExpressionAnimationStatusChanged;
00082     static event Windows.Foundation.TypedEventHandler<MU_XCP_NAMESPACE.ScrollPresenter, Object> ContentLayoutOffsetXChanged;
00083     static event Windows.Foundation.TypedEventHandler<MU_XCP_NAMESPACE.ScrollPresenter, Object> ContentLayoutOffsetYChanged;
00084 }
00085
00086 }
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/SpectrumBrush.idl Source File

  • ColorPicker

SpectrumBrush.idl

Go to the documentation of this file.
00001 ﻿namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [webhosthidden]
00006 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00007 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00008 runtimeclass SpectrumBrush : Microsoft.UI.Xaml.Media.XamlCompositionBrushBase
00009 {
00010     SpectrumBrush();
00011
00012     Microsoft.UI.Xaml.Media.LoadedImageSurface MinSurface { get; set; };
00013     Microsoft.UI.Xaml.Media.LoadedImageSurface MaxSurface { get; set; };
00014     [MUX_DEFAULT_VALUE("1.0")]
00015     Double MaxSurfaceOpacity { get; set; };
00016
00017     static Microsoft.UI.Xaml.DependencyProperty MinSurfaceProperty { get; };
00018     static Microsoft.UI.Xaml.DependencyProperty MaxSurfaceProperty { get; };
00019     static Microsoft.UI.Xaml.DependencyProperty MaxSurfaceOpacityProperty { get; };
00020 }
00021
00022 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AcrylicTestApi.properties.cpp Source File

  • Generated

AcrylicTestApi.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "AcrylicTestApi.h"
00008
00009 namespace winrt::Microsoft::UI::Private::Media
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(AcrylicTestApi)
00012 }
00013
00014 #include "AcrylicTestApi.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/ScrollViewBringIntoViewOperation.h Source File

  • ScrollView

ScrollViewBringIntoViewOperation.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007
00008 class ScrollViewBringIntoViewOperation
00009 {
00010 public:
00011     ScrollViewBringIntoViewOperation(winrt::UIElement const& targetElement, bool cancelBringIntoView);
00012     ~ScrollViewBringIntoViewOperation();
00013
00014     bool HasMaxTicksCount() const;
00015     winrt::UIElement TargetElement() const;
00016     int8_t TicksCount() const;
00017     int8_t TickOperation();
00018
00019     bool ShouldCancelBringIntoView()
00020     {
00021         return m_cancelBringIntoView;
00022     }
00023
00024 private:
00025     // Number of UI thread ticks allowed before this expected bring-into-view operation is no
00026     // longer expected and removed from the ScrollView's m_bringIntoViewOperations list.
00027     static constexpr int8_t s_maxTicksCount{ 3 };
00028
00029     int8_t m_ticksCount{ 0 };
00030     weak_ref<winrt::UIElement> m_targetElement;
00031     bool m_cancelBringIntoView;
00032 };
00033
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommonTests Member List

This is the complete list of members for CommonTests, including all inherited members.
AccTypeTest() | CommonTests | [inline]
AddRemoveFooterItemTest() | CommonTests | [inline]
AddRemoveItemTest() | CommonTests | [inline]
AddRemoveOriginalItemTest() | CommonTests | [inline]
AlwaysShowHeaderTest() | CommonTests | [inline]
AutoSuggestBoxOnTopNavTest() | CommonTests | [inline]
AutoSuggestBoxTest() | CommonTests | [inline]
BackButtonPlaceHolderOnTopNavTest() | CommonTests | [inline]
BackToolTipTest() | CommonTests | [inline]
ClassInitialize(TestContext testContext) | CommonTests | [inline, static]
ClickClearSelectionButton() | NavigationViewTestsBase | [inline, protected]
CloseToolTipTest() | CommonTests | [inline]
ComboBoxName enum name | NavigationViewTestsBase | [protected]
compact | NavigationViewTestsBase | [protected]
ContentOverlayTest() | CommonTests | [inline]
ControlHeight enum name | NavigationViewTestsBase | [protected]
ControlWidth enum name | NavigationViewTestsBase | [protected]
DisabledItemTest() | CommonTests | [inline]
DisplayModeTest() | CommonTests | [inline]
EnsureClearingListIsSafe() | CommonTests | [inline]
EnsureDisplayModeGroupUpdatesOnPaneClosedToMinimalWithBackButton() | CommonTests | [inline]
EnsureDisplayModeGroupUpdatesWhenBackButtonVisibilityChanged() | CommonTests | [inline]
EnsureNavViewClosed() | NavigationViewTestsBase | [inline, protected]
EnsurePaneHeaderCanBeModifiedForLeftNav() | CommonTests | [inline]
EnsurePaneHeaderCanBeModifiedForTopNav() | CommonTests | [inline]
EnsurePaneHeaderCanBeModifiedHelper(RegressionTestType navviewMode) | NavigationViewTestsBase | [inline, protected]
expanded | NavigationViewTestsBase | [protected]
GetTopNavigationItems(TopNavPosition position) | NavigationViewTestsBase | [inline, protected]
HierarchyItemsAccessibilitySetAndLevelTest() | CommonTests | [inline]
InvokeNavigationViewAccessKeyAndVerifyKeyTipPlacement(string expectedKeyTipTargetElementId) | NavigationViewTestsBase | [inline, protected]
InvokeOverflowButton() | NavigationViewTestsBase | [inline, protected]
IsItemInTopNavPrimaryList(string text) | NavigationViewTestsBase | [inline, protected]
IsPaneToggleButtonVisibleTest() | CommonTests | [inline]
IsSettingsVisibleTest() | CommonTests | [inline]
ItemsAccessibilitySetTest() | CommonTests | [inline]
ItemSourceTest() | CommonTests | [inline]
ItemsSourceAccessibilitySetTest() | CommonTests | [inline]
KeyboardFocusToolTipTest() | CommonTests | [inline]
LeftNavigationFocusKindRevealTest() | CommonTests | [inline]
LeftNavigationWithAccessKeysTest() | CommonTests | [inline]
MenuItemKeyboardInvokeTest() | CommonTests | [inline]
minimal | NavigationViewTestsBase | [protected]
NavigationViewDensityChange() | CommonTests | [inline]
OpenOverflowMenuAndInvokeItem(string itemName) | NavigationViewTestsBase | [inline, protected]
PaneOpenCloseTestCaseRetry(int retryNumber, Action action) | NavigationViewTestsBase | [inline, protected]
PaneOpenStatus enum name | NavigationViewTestsBase | [protected]
ScrollToMenuItemTest() | CommonTests | [inline]
SetNavViewHeight(ControlHeight height) | NavigationViewTestsBase | [inline, protected]
SetNavViewWidth(ControlWidth width) | NavigationViewTestsBase | [inline, protected]
SetThreshold(Threshold threshold, ComboBoxName name) | NavigationViewTestsBase | [inline, protected]
SettingsAccessibilitySetTest() | CommonTests | [inline]
SettingsItemGamepadTest() | CommonTests | [inline]
SystemBackTest() | CommonTests | [inline]
TestCleanup() | NavigationViewTestsBase | [inline]
Threshold enum name | NavigationViewTestsBase | [protected]
TitleBarTest() | CommonTests | [inline]
ToolTipCustomContentTest() | CommonTests | [inline]
ToolTipTest() | CommonTests | [inline]
TopNavPosition enum name | NavigationViewTestsBase | [protected]
UIObjectContains(UIObject uIObject, string itemName) | NavigationViewTestsBase | [inline, protected]
UIObjectToString(UIObject uIObject) | NavigationViewTestsBase | [inline, protected]
VerifyAddingChildItemsToNavigationViewItem() | CommonTests | [inline]
VerifyAddingNewItemsFromIndexZero() | CommonTests | [inline]
VerifyAxeScanPasses() | CommonTests | [inline]
VerifyBackAndCloseButtonsVisibility(bool inLeftMinimalPanelDisplayMode) | NavigationViewTestsBase | [inline, protected]
VerifyBackButtonHidesWhenInMinimalOpenState() | CommonTests | [inline]
VerifyCanCancelClosing() | CommonTests | [inline]
VerifyClickingNavigationViewItemInPaneFooterDoesNotCrash() | CommonTests | [inline]
VerifyCustomHeaderContentTest() | CommonTests | [inline]
VerifyExpandCollapseFunctionality() | CommonTests | [inline]
VerifyExpandCollapseFunctionalityUsingChevron() | CommonTests | [inline]
VerifyNavigationViewItemChildrenFlyoutMenuCornerRadius() | CommonTests | [inline]
VerifyNavigationViewItemContentPresenterMargin() | CommonTests | [inline]
VerifyNavigationViewItemInPaneFooterHasTemplateSettingBindings() | CommonTests | [inline]
VerifyNoCrashWhenNavViewInContentDialog() | CommonTests | [inline]
VerifyNoCrashWhenSwitchingPaneDisplayModeWithAutoWrappedElements() | CommonTests | [inline]
VerifyNotShouldPreserveNavigationViewRS3Behavior() | CommonTests | [inline]
VerifyShouldPreserveNavigationViewRS3Behavior() | CommonTests | [inline]
WaitAndAssertPaneStatus(PaneOpenStatus status) | NavigationViewTestsBase | [inline, protected]
Generated on Sun Dec 1 2024 20:53:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnnotatedScrollBar/AnnotatedScrollBarDetailLabelRequestedEventArgs.cpp Source File

  • AnnotatedScrollBar

AnnotatedScrollBarDetailLabelRequestedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "AnnotatedScrollBarDetailLabelRequestedEventArgs.h"
00007
00008 AnnotatedScrollBarDetailLabelRequestedEventArgs::AnnotatedScrollBarDetailLabelRequestedEventArgs(double scrollOffset)
00009 {
00010     m_scrollOffset = scrollOffset;
00011 }
00012
00013 #pragma region IAnnotatedScrollBarDetailLabelRequestedEventArgs
00014
00015 winrt::IInspectable AnnotatedScrollBarDetailLabelRequestedEventArgs::Content()
00016 {
00017     return m_content.get();
00018 }
00019
00020 void AnnotatedScrollBarDetailLabelRequestedEventArgs::Content(const winrt::IInspectable& content)
00021 {
00022     m_content.set(content);
00023 }
00024
00025 double AnnotatedScrollBarDetailLabelRequestedEventArgs::ScrollOffset()
00026 {
00027     return m_scrollOffset;
00028 }
00029
00030 #pragma endregion
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TabView/InteractionTests/TabViewTests.cs Source File

  • TabView
  • InteractionTests

TabViewTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Drawing;
00006 using Common;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00009 using System.Collections.Generic;
00010
00011 using WEX.TestExecution;
00012 using WEX.TestExecution.Markup;
00013 using WEX.Logging.Interop;
00014
00015 using Microsoft.Windows.Apps.Test.Automation;
00016 using Microsoft.Windows.Apps.Test.Foundation;
00017 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00018 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00019 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00020 using Windows.Devices.Input;
00021 using MUXTestInfra.Shared.Infra;
00022 using System.Linq;
00023
00024 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00025 {
00026     [TestClass]
00027     public class TabViewTests
00028     {
00029         [ClassInitialize]
00030         [TestProperty("RunAs", "User")]
00031         [TestProperty("Classification", "Integration")]
00032         [TestProperty("Platform", "Any")]
00033         public static void ClassInitialize(TestContext testContext)
00034         {
00035             TestEnvironment.Initialize(testContext);
00036         }
00037
00038         public void TestCleanup()
00039         {
00040             TestCleanupHelper.Cleanup();
00041         }
00042
00043         [TestMethod]
00044         public void VerifyAxeScanPasses()
00045         {
00046             using (var setup = new TestSetupHelper("TabView-Axe"))
00047             {
00048                 AxeTestHelper.TestForAxeIssues();
00049             }
00050         }
00051
00052         [TestMethod]
00053         public void SelectionTest()
00054         {
00055             using (var setup = new TestSetupHelper("TabView Tests"))
00056             {
00057                 Log.Comment("Verify content is displayed for initially selected tab.");
00058                 UIObject tabContent = FindElement.ByName("FirstTabContent");
00059                 Verify.IsNotNull(tabContent);
00060
00061                 Log.Comment("Changing selection.");
00062                 UIObject lastTab = FindElement.ByName("LastTab");
00063                 lastTab.Click();
00064                 Wait.ForIdle();
00065
00066                 Log.Comment("Verify content is displayed for newly selected tab.");
00067                 tabContent = FindElement.ByName("LastTabContent");
00068                 Verify.IsNotNull(tabContent);
00069
00070                 Log.Comment("Verify that setting SelectedItem changes selection.");
00071                 Button selectItemButton = FindElement.ByName<Button>("SelectItemButton");
00072                 selectItemButton.InvokeAndWait();
00073
00074                 TextBlock selectedIndexTextBlock = FindElement.ByName<TextBlock>("SelectedIndexTextBlock");
00075                 Verify.AreEqual("1", selectedIndexTextBlock.DocumentText);
00076
00077                 Log.Comment("Verify that setting SelectedIndex changes selection.");
00078                 Button selectIndexButton = FindElement.ByName<Button>("SelectIndexButton");
00079                 selectIndexButton.InvokeAndWait();
00080                 Verify.AreEqual("2", selectedIndexTextBlock.DocumentText);
00081
00082                 Log.Comment("Verify that ctrl-click on tab selects it.");
00083                 UIObject firstTab = FindElement.ByName("FirstTab");
00084                 KeyboardHelper.PressDownModifierKey(ModifierKey.Control);
00085                 firstTab.Click();
00086                 KeyboardHelper.ReleaseModifierKey(ModifierKey.Control);
00087                 Wait.ForIdle();
00088                 Verify.AreEqual("0", selectedIndexTextBlock.DocumentText);
00089
00090                 Log.Comment("Verify that ctrl-click on tab does not deselect.");
00091                 KeyboardHelper.PressDownModifierKey(ModifierKey.Control);
00092                 firstTab.Click();
00093                 KeyboardHelper.ReleaseModifierKey(ModifierKey.Control);
00094                 Wait.ForIdle();
00095                 Verify.AreEqual("0", selectedIndexTextBlock.DocumentText);
00096             }
00097         }
00098
00099         // Added test coverage for Tabview crashes when using touch (Bug 26320442).
00100         [TestMethod]
00101         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00102         public void TouchSelectionTest()
00103         {
00104             using (var setup = new TestSetupHelper("TabView Tests"))
00105             {
00106                 Log.Comment("Verify content is displayed for initially selected tab.");
00107                 UIObject tabContent = FindElement.ByName("FirstTabContent");
00108                 Verify.IsNotNull(tabContent);
00109
00110                 Log.Comment("Changing selection to Last Tab.");
00111                 UIObject lastTab = FindElement.ByName("LastTab");
00112                 lastTab.Tap();
00113                 Wait.ForIdle();
00114
00115                 Log.Comment("Verify content is displayed for newly selected tab.");
00116                 tabContent = FindElement.ByName("LastTabContent");
00117                 Verify.IsNotNull(tabContent);
00118
00119                 // Toggle between tabs to reproduce crash before merged commit 0028e6b9
00120                 Log.Comment("Changing selection to SecondTab.");
00121                 UIObject SecondTab = FindElement.ByName("SecondTab");
00122                 SecondTab.Tap();
00123                 Wait.ForIdle();
00124
00125                 Log.Comment("Changing selection to LastTab.");
00126                 lastTab.Tap();
00127                 Wait.ForIdle();
00128
00129                 Log.Comment("Changing selection to SecondTab again.");
00130                 SecondTab.Tap();
00131                 lastTab.Tap();
00132             }
00133         }
00134
00135         [TestMethod]
00136         public void AddRemoveTest()
00137         {
00138             using (var setup = new TestSetupHelper("TabView Tests"))
00139             {
00140                 Log.Comment("Adding tab.");
00141                 Button addTabButton = FindElement.ByName<Button>("Add New Tab");
00142                 addTabButton.InvokeAndWait();
00143
00144                 ElementCache.Refresh();
00145                 UIObject newTab = FindElement.ByName("New Tab 1");
00146                 Verify.IsNotNull(newTab);
00147
00148                 Log.Comment("Removing tab.");
00149                 Button removeTabButton = FindElement.ByName<Button>("RemoveTabButton");
00150                 removeTabButton.InvokeAndWait();
00151
00152                 VerifyElement.NotFound("New Tab 1", FindBy.Name);
00153             }
00154         }
00155
00156         [TestMethod]
00157         public void TabSizeAndScrollButtonsTest()
00158         {
00159             using (var setup = new TestSetupHelper("TabView Tests"))
00160             {
00161                 UIObject smallerTab = FindElement.ByName("SecondTab");
00162                 UIObject largerTab = FindElement.ByName("LongHeaderTab");
00163
00164                 FindElement.ByName<Button>("SetTabViewWidth").InvokeAndWait();
00165
00166                 Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible");
00167
00168                 Log.Comment("Equal size tabs should all be the same size.");
00169                 int diff = Math.Abs(largerTab.BoundingRectangle.Width - smallerTab.BoundingRectangle.Width);
00170                 Verify.IsLessThanOrEqual(diff, 1);
00171
00172                 Log.Comment("Changing tab width mode to SizeToContent.");
00173                 ComboBox tabWidthComboBox = FindElement.ByName<ComboBox>("TabWidthComboBox");
00174                 tabWidthComboBox.SelectItemByName("SizeToContent");
00175                 Wait.ForIdle();
00176
00177                 Log.Comment("Tab with larger content should be wider.");
00178                 Verify.IsGreaterThan(largerTab.BoundingRectangle.Width, smallerTab.BoundingRectangle.Width);
00179
00180                 // With largerTab now rendering wider, the scroll buttons should appear:
00181                 Verify.IsTrue(AreScrollButtonsVisible(), "Scroll buttons should appear");
00182
00183                 // Scroll all the way to the left and verify decrease/increase button visual state
00184                 FindElement.ByName<Button>("ScrollTabViewToTheLeft").InvokeAndWait();
00185                 Wait.ForIdle();
00186                 Verify.IsFalse(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be disabled");
00187                 Verify.IsTrue(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be enabled");
00188
00189                 // Scroll to the middle position and verify decrease/increase button visual state
00190                 FindElement.ByName<Button>("ScrollTabViewToTheMiddle").InvokeAndWait();
00191                 Wait.ForIdle();
00192                 Verify.IsTrue(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be enabled");
00193                 Verify.IsTrue(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be enabled");
00194
00195                 // Scroll all the way to the right and verify decrease/increase button visual state
00196                 FindElement.ByName<Button>("ScrollTabViewToTheRight").InvokeAndWait();
00197                 Wait.ForIdle();
00198                 Verify.IsTrue(IsScrollDecreaseButtonEnabled(), "Scroll decrease button should be enabled");
00199                 Verify.IsFalse(IsScrollIncreaseButtonEnabled(), "Scroll increase button should be disabled");
00200
00201                 // Close a tab to make room. The scroll buttons should disappear:
00202                 Log.Comment("Closing a tab:");
00203                 Button closeButton = FindCloseButton(FindElement.ByName("LongHeaderTab"));
00204                 closeButton.MovePointer(0, 0);
00205                 closeButton.InvokeAndWait();
00206                 VerifyElement.NotFound("LongHeaderTab", FindBy.Name);
00207
00208                 Log.Comment("Scroll buttons should disappear");
00209                 // Leaving tabstrip with this so the tabs update their width
00210                 FindElement.ByName<Button>("IsClosableCheckBox").MovePointer(0,0);
00211                 Wait.ForIdle();
00212                 Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should disappear");
00213
00214                 // Make sure the scroll buttons can show up in 'Equal' sizing mode.
00215                 Log.Comment("Changing tab width mode to Equal");
00216                 tabWidthComboBox.SelectItemByName("Equal");
00217                 Wait.ForIdle();
00218                 Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible");
00219
00220                 var addButton = FindElement.ByName<Button>("Add New Tab");
00221                 Verify.IsNotNull(addButton, "addButton should be available");
00222                 Log.Comment("Adding a tab");
00223                 addButton.InvokeAndWait();
00224                 Verify.IsFalse(AreScrollButtonsVisible(), "Scroll buttons should not be visible");
00225                 Log.Comment("Adding another tab");
00226                 addButton.InvokeAndWait();
00227
00228                 Verify.IsTrue(AreScrollButtonsVisible(), "Scroll buttons should appear");
00229             }
00230         }
00231
00232         private bool AreScrollButtonsVisible()
00233         {
00234             FindElement.ByName<Button>("GetScrollButtonsVisible").InvokeAndWait();
00235             var scrollButtonsVisible = FindElement.ByName<TextBlock>("ScrollButtonsVisible").DocumentText;
00236             if(scrollButtonsVisible == "True")
00237             {
00238                 return true;
00239             }
00240             else if(scrollButtonsVisible == "False")
00241             {
00242                 return false;
00243             }
00244             else
00245             {
00246                 Verify.Fail(string.Format("Unexpected value for ScrollButtonsVisible: '{0}'", scrollButtonsVisible));
00247                 return false;
00248             }
00249         }
00250
00251         private bool IsScrollIncreaseButtonEnabled()
00252         {
00253             FindElement.ByName<Button>("GetScrollIncreaseButtonEnabled").InvokeAndWait();
00254             var scrollIncreaseButtonEnabled = FindElement.ByName<TextBlock>("ScrollIncreaseButtonEnabled").DocumentText;
00255             return scrollIncreaseButtonEnabled == "True";
00256         }
00257
00258         private bool IsScrollDecreaseButtonEnabled()
00259         {
00260             FindElement.ByName<Button>("GetScrollDecreaseButtonEnabled").InvokeAndWait();
00261             var scrollDecreaseButtonEnabled = FindElement.ByName<TextBlock>("ScrollDecreaseButtonEnabled").DocumentText;
00262             return scrollDecreaseButtonEnabled == "True";
00263         }
00264
00265         [TestMethod]
00266         public void CloseSelectionTest()
00267         {
00268             using (var setup = new TestSetupHelper("TabView Tests"))
00269             {
00270                 Log.Comment("Hiding the disabled tab");
00271                 var disabledTabCheckBox = FindElement.ByName<CheckBox>("IsDisabledTabVisibleCheckBox");
00272                 Verify.IsNotNull(disabledTabCheckBox);
00273                 disabledTabCheckBox.Uncheck();
00274
00275                 Log.Comment("Finding the first tab");
00276                 UIObject firstTab = FindElement.ByName("FirstTab");
00277                 Button closeButton = FindCloseButton(firstTab);
00278                 Verify.IsNotNull(closeButton);
00279
00280                 TextBlock selectedIndexTextBlock = FindElement.ByName<TextBlock>("SelectedIndexTextBlock");
00281                 Verify.AreEqual("0", selectedIndexTextBlock.DocumentText);
00282
00283                 Log.Comment("When the selected tab is closed, selection should move to the next one.");
00284                 // Use Tab's close button:
00285                 closeButton.InvokeAndWait();
00286                 VerifyElement.NotFound("FirstTab", FindBy.Name);
00287                 Verify.AreEqual("0", selectedIndexTextBlock.DocumentText);
00288
00289                 Log.Comment("Select last tab.");
00290                 UIObject lastTab = FindElement.ByName("LastTab");
00291                 lastTab.Click();
00292                 Wait.ForIdle();
00293                 Verify.AreEqual("3", selectedIndexTextBlock.DocumentText);
00294
00295                 Log.Comment("When the selected tab is last and is closed, selection should move to the previous item.");
00296
00297                 // Use Middle Click to close the tab:
00298                 lastTab.Click(PointerButtons.Middle);
00299                 Wait.ForIdle();
00300                 VerifyElement.NotFound("LastTab", FindBy.Name);
00301                 Verify.AreEqual("2", selectedIndexTextBlock.DocumentText);
00302             }
00303         }
00304
00305         [TestMethod]
00306         public void IsClosableTest()
00307         {
00308             using (var setup = new TestSetupHelper("TabView Tests"))
00309             {
00310                 UIObject firstTab = FindElement.ByName("FirstTab");
00311                 Button closeButton = FindCloseButton(firstTab);
00312                 Verify.IsNotNull(closeButton);
00313
00314                 Log.Comment("Setting IsClosable=false on the first tab.");
00315                 CheckBox isClosableCheckBox = FindElement.ByName<CheckBox>("IsClosableCheckBox");
00316                 isClosableCheckBox.Uncheck();
00317                 Wait.ForIdle();
00318
00319                 ElementCache.Refresh();
00320                 closeButton = FindCloseButton(firstTab);
00321                 Verify.IsNull(closeButton);
00322
00323                 Log.Comment("Setting IsClosable=true on the first tab.");
00324                 isClosableCheckBox.Check();
00325                 Wait.ForIdle();
00326
00327                 ElementCache.Refresh();
00328                 closeButton = FindCloseButton(firstTab);
00329                 Verify.IsNotNull(closeButton);
00330             }
00331         }
00332
00333         [TestMethod]
00334         public void HandleItemCloseRequestedTest()
00335         {
00336             using (var setup = new TestSetupHelper("TabView Tests"))
00337             {
00338                 UIObject firstTab = FindElement.ByName("FirstTab");
00339                 Button closeButton = FindCloseButton(firstTab);
00340                 Verify.IsNotNull(closeButton);
00341
00342                 CheckBox tabCloseRequestedCheckBox = FindElement.ByName<CheckBox>("HandleTabCloseRequestedCheckBox");
00343                 tabCloseRequestedCheckBox.Uncheck();
00344                 CheckBox tabItemCloseRequestedCheckBox = FindElement.ByName<CheckBox>("HandleTabItemCloseRequestedCheckBox");
00345                 tabItemCloseRequestedCheckBox.Check();
00346                 Wait.ForIdle();
00347
00348                 Log.Comment("TabViewItem.CloseRequested should be raised when the close button is pressed.");
00349                 closeButton.InvokeAndWait();
00350
00351                 ElementCache.Refresh();
00352                 firstTab = TryFindElement.ByName("FirstTab");
00353                 Verify.IsNull(firstTab);
00354             }
00355         }
00356
00357         [TestMethod]
00358         [TestProperty("Ignore", "True")] //Task 24429465: DCPP: Multiple MUXControls interaction tests failing after IXP integration.
00359         public void DragBetweenTabViewsTest()
00360         {
00361             using (var setup = new TestSetupHelper("TabView Tests"))
00362             {
00363                 UIObject firstTab = FindElement.ByName("FirstTab");
00364                 Verify.IsNotNull(firstTab);
00365
00366                 UIObject dropTarget = FindElement.ByName("TabInSecondTabView");
00367                 Verify.IsNotNull(dropTarget);
00368
00369                 Log.Comment("Home tab should be in the first tab view.");
00370                 PressButtonAndVerifyText("GetFirstTabLocationButton", "FirstTabLocationTextBlock", "FirstTabView");
00371
00372                 InputHelper.DragToTarget(firstTab, dropTarget);
00373                 Wait.ForIdle();
00374                 ElementCache.Refresh();
00375
00376                 Log.Comment("Home tab should now be in the second tab view.");
00377                 PressButtonAndVerifyText("GetFirstTabLocationButton", "FirstTabLocationTextBlock", "SecondTabView");
00378
00379                 Log.Comment("Home tab content should be visible.");
00380                 UIObject tabContent = FindElement.ByName("FirstTabContent");
00381                 Verify.IsNotNull(tabContent);
00382             }
00383         }
00384
00385         [TestMethod]
00386         public void ReorderItemsTest()
00387         {
00388             using (var setup = new TestSetupHelper("TabView Tests"))
00389             {
00390                 Button tabItemsSourcePageButton = FindElement.ByName<Button>("TabViewTabItemsSourcePageButton");
00391                 tabItemsSourcePageButton.InvokeAndWait();
00392
00393                 UIObject sourceTab = null;
00394                 int attempts = 0;
00395
00396                 do
00397                 {
00398                     Wait.ForMilliseconds(100);
00399                     ElementCache.Refresh();
00400
00401                     sourceTab = FindElement.ByName("tabViewItem0");
00402                     attempts++;
00403                 }
00404                 while (sourceTab == null && attempts < 4);
00405
00406                 Verify.IsNotNull(sourceTab);
00407
00408                 UIObject dropTab = FindElement.ByName("tabViewItem2");
00409                 Verify.IsNotNull(dropTab);
00410
00411                 Log.Comment("Reordering tabs with drag-drop operation...");
00412                 InputHelper.DragToTarget(sourceTab, dropTab, -5);
00413                 Wait.ForIdle();
00414                 ElementCache.Refresh();
00415                 Log.Comment("...reordering done. Expecting a TabView.TabItemsChanged event was raised with CollectionChange=ItemInserted and Index=1.");
00416
00417                 TextBlock tblIVectorChangedEventArgsCollectionChange = FindElement.ByName<TextBlock>("tblIVectorChangedEventArgsCollectionChange");
00418                 Verify.AreEqual("ItemInserted", tblIVectorChangedEventArgsCollectionChange.DocumentText);
00419
00420                 TextBlock tblIVectorChangedEventArgsIndex = FindElement.ByName<TextBlock>("tblIVectorChangedEventArgsIndex");
00421                 Verify.AreEqual("1", tblIVectorChangedEventArgsIndex.DocumentText);
00422             }
00423         }
00424
00425         [TestMethod]
00426         public void ItemChangedEventOnDragTest()
00427         {
00428             using (var setup = new TestSetupHelper("TabView Tests"))
00429             {
00430                 Button addButton = FindElement.ByName<Button>("Add New Tab");
00431                 Verify.IsNotNull(addButton);
00432
00433                 Log.Comment("Add tab so scroll buttons appear.");
00434                 addButton.InvokeAndWait();
00435
00436                 Verify.IsTrue(AreScrollButtonsVisible(), "Scroll buttons should appear");
00437
00438                 UIObject sourceTab = FindElement.ByName("FirstTab");
00439
00440                 Verify.IsNotNull(sourceTab);
00441
00442                 UIObject dropTab = FindElement.ByName("LastTab");
00443                 Verify.IsNotNull(dropTab);
00444
00445                 Log.Comment("Dragging tab to the last overflow tab...");
00446                 InputHelper.DragToTarget(sourceTab, dropTab, 40);
00447                 Wait.ForIdle();
00448                 ElementCache.Refresh();
00449
00450                 Log.Comment("...reordering done. Expecting a TabView.TabItemsChanged event to be raised with CollectionChange=ItemInserted.");
00451
00452                 TextBlock tabsItemChangedEventArgsTextBlock = FindElement.ByName<TextBlock>("TabsItemChangedEventArgsTextBlock");
00453                 Verify.AreEqual("ItemInserted", tabsItemChangedEventArgsTextBlock.DocumentText);
00454             }
00455         }
00456
00457         [TestMethod]
00458         public void AddButtonTest()
00459         {
00460             using (var setup = new TestSetupHelper("TabView Tests"))
00461             {
00462                 Log.Comment("Add new tab button should be visible.");
00463                 var addButton = FindElement.ByName("Add New Tab");
00464                 Verify.IsNotNull(addButton);
00465
00466                 CheckBox isAddButtonVisibleCheckBox = FindElement.ByName<CheckBox>("IsAddButtonVisibleCheckBox");
00467                 isAddButtonVisibleCheckBox.Uncheck();
00468                 Wait.ForIdle();
00469
00470                 ElementCache.Refresh();
00471                 Log.Comment("Add new tab button should not be visible.");
00472                 addButton = TryFindElement.ByName("Add New Tab");
00473                 Verify.IsNull(addButton);
00474             }
00475         }
00476
00477         [TestMethod]
00478         [TestProperty("Ignore", "True")] // TabViewTests.KeyboardTest fails in the lab #7546
00479         public void KeyboardTest()
00480         {
00481             using (var setup = new TestSetupHelper("TabView Tests"))
00482             {
00483                 Log.Comment("Set focus inside the TabView");
00484                 UIObject tabContent = FindElement.ByName("FirstTabContent");
00485                 tabContent.SetFocus();
00486
00487                 TabItem firstTab = FindElement.ByName<TabItem>("FirstTab");
00488                 Button firstTabCloseButton = new Button(firstTab.Descendants.Find(UICondition.CreateFromName("Close Tab")));
00489                 TabItem secondTab = FindElement.ByName<TabItem>("SecondTab");
00490                 Button secondTabCloseButton = new Button(secondTab.Descendants.Find(UICondition.CreateFromName("Close Tab")));
00491                 TabItem lastTab = FindElement.ByName<TabItem>("LastTab");
00492                 Button lastTabCloseButton = new Button(lastTab.Descendants.Find(UICondition.CreateFromName("Close Tab")));
00493                 TabItem notCloseableTab = FindElement.ByName<TabItem>("NotCloseableTab");
00494
00495                 Button addButton = FindElement.ById<Button>("AddButton");
00496
00497                 Verify.IsTrue(firstTab.IsSelected, "First Tab should be selected initially");
00498                 Button firstTabButton = FindElement.ByName<Button>("FirstTabButton");
00499                 Verify.IsTrue(firstTabButton.HasKeyboardFocus, "Focus should start in the First Tab");
00500
00501                 // Ctrl+Tab to the second tab:
00502                 KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control);
00503                 Verify.IsTrue(secondTab.IsSelected, "Ctrl+Tab should move selection to Second Tab");
00504                 Button secondTabButton = FindElement.ByName<Button>("SecondTabButton");
00505                 Verify.IsTrue(secondTabButton.HasKeyboardFocus, "Focus should move to the content of the Second Tab");
00506
00507                 // Ctrl+Shift+Tab to the first tab:
00508                 KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift);
00509                 Verify.IsTrue(firstTab.IsSelected, "Ctrl+Shift+Tab should move selection to First Tab");
00510                 Verify.IsTrue(firstTabButton.HasKeyboardFocus, "Focus should move to the content of the First Tab");
00511
00512                 // Ctrl+Shift+Tab to the last tab:
00513                 KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift);
00514                 Verify.IsTrue(lastTab.IsSelected, "Ctrl+Shift+Tab should move selection to Last Tab");
00515                 Verify.IsTrue(lastTab.HasKeyboardFocus, "Focus should move to the last tab (since it has no focusable content)");
00516
00517                 // Ctrl+Shift+Tab to the not-closable tab:
00518                 KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift);
00519                 Verify.IsTrue(notCloseableTab.IsSelected, "Ctrl+Shift+Tab should move selection to the not-closable tab, past the disabled tab");
00520                 Verify.IsTrue(notCloseableTab.HasKeyboardFocus, "Focus should move to the not-closable tab (since it has no focusable content)");
00521
00522                 // Ctrl+Tab to the first tab:
00523                 KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control);
00524                 Verify.IsTrue(lastTab.IsSelected, "Ctrl+Tab should move selection to the last tab");
00525                 Verify.IsTrue(lastTab.HasKeyboardFocus, "Focus should move to the last tab");
00526
00527                 // Ctrl+Tab to the first tab:
00528                 KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control);
00529                 Verify.IsTrue(firstTab.IsSelected, "Ctrl+Tab should move selection to first tab");
00530                 Verify.IsTrue(firstTab.HasKeyboardFocus, "Focus should move to the first tab");
00531
00532                 KeyboardHelper.PressKey(Key.Up);
00533                 Verify.IsTrue(firstTab.HasKeyboardFocus, "Up key should not move focus");
00534
00535                 KeyboardHelper.PressKey(Key.Down);
00536                 Verify.IsTrue(firstTab.HasKeyboardFocus, "Down key should not move focus");
00537
00538                 KeyboardHelper.PressKey(Key.Right);
00539                 Verify.IsTrue(firstTabCloseButton.HasKeyboardFocus, "Right Key should move focus to the first tab close button");
00540
00541                 KeyboardHelper.PressKey(Key.Right);
00542                 Verify.IsTrue(secondTab.HasKeyboardFocus, "Right Key should move focus to the second tab");
00543
00544                 KeyboardHelper.PressKey(Key.Space);
00545                 Verify.IsTrue(secondTab.IsSelected, "Space should select the second tab");
00546
00547                 KeyboardHelper.PressKey(Key.Left);
00548                 Verify.IsTrue(firstTabCloseButton.HasKeyboardFocus, "Left Key should move focus to the first tab close button");
00549
00550                 KeyboardHelper.PressKey(Key.Space);
00551                 Verify.IsTrue(secondTab.IsSelected, "Space should close the first tab and focus the next tab");
00552                 VerifyElement.NotFound("FirstTab", FindBy.Name);
00553
00554                 KeyboardHelper.PressKey(Key.Left);
00555                 Verify.IsTrue(addButton.HasKeyboardFocus, "Left Key should move focus to the add button");
00556
00557                 KeyboardHelper.PressKey(Key.Left);
00558                 Verify.IsTrue(lastTabCloseButton.HasKeyboardFocus, "Left Key from AddButton should move focus to last tab close button");
00559
00560                 KeyboardHelper.PressKey(Key.Left);
00561                 Verify.IsTrue(lastTab.HasKeyboardFocus, "Left Key from last tab close button should move focus to last tab");
00562
00563                 KeyboardHelper.PressKey(Key.Right);
00564                 Verify.IsTrue(lastTabCloseButton.HasKeyboardFocus, "Right Key from last tab should move focus to the last tab close button");
00565
00566                 KeyboardHelper.PressKey(Key.Right);
00567                 Verify.IsTrue(addButton.HasKeyboardFocus, "Right Key from last tab close button should move focus to the add button");
00568
00569                 KeyboardHelper.PressKey(Key.Left);
00570                 Verify.IsTrue(lastTabCloseButton.HasKeyboardFocus, "Left Key from AddButton should move focus to last tab close button");
00571
00572                 KeyboardHelper.PressKey(Key.Space);
00573                 Verify.IsTrue(notCloseableTab.HasKeyboardFocus, "Space should close the last tab and focus the previous focusable tab");
00574                 VerifyElement.NotFound("LastTab", FindBy.Name);
00575
00576                 secondTab.SetFocus();
00577
00578                 // Ctrl+f4 to close the tab:
00579                 Log.Comment("Verify that pressing ctrl-f4 closes the tab");
00580                 KeyboardHelper.PressKey(Key.F4, ModifierKey.Control);
00581                 Wait.ForIdle();
00582
00583                 VerifyElement.NotFound("SecondTab", FindBy.Name);
00584                 Wait.ForIdle();
00585             }
00586         }
00587
00588         [TestMethod]
00589         public void CloseButtonOverlayModeTests()
00590         {
00591             using(var setup = new TestSetupHelper("TabView Tests"))
00592             {
00593                 ComboBox closeButtonOverlayModeComboBox = FindElement.ByName<ComboBox>("CloseButtonOverlayModeCombobox");
00594                 closeButtonOverlayModeComboBox.SelectItemByName("OnPointerOver");
00595                 Wait.ForIdle();
00596
00597                 Button closeUnselectedButton = FindCloseButton(FindElement.ByName("LongHeaderTab"));
00598                 Button closeSelectedButton = FindCloseButton(FindElement.ByName("FirstTab"));
00599                 Verify.IsNull(closeUnselectedButton);
00600                 Verify.IsNotNull(closeSelectedButton);
00601
00602                 closeButtonOverlayModeComboBox.SelectItemByName("Always");
00603                 Wait.ForIdle();
00604
00605                 // Verifiying "Always" works correctly
00606                 closeSelectedButton = FindCloseButton(FindElement.ByName("FirstTab"));
00607                 closeUnselectedButton = FindCloseButton(FindElement.ByName("LongHeaderTab"));
00608                 Verify.IsNotNull(closeUnselectedButton);
00609                 Verify.IsNotNull(closeSelectedButton);
00610
00611                 // Verifiying "OnPointerOver" works correctly
00612                 closeButtonOverlayModeComboBox.SelectItemByName("OnPointerOver");
00613                 Wait.ForIdle();
00614
00615                 closeSelectedButton = FindCloseButton(FindElement.ByName("FirstTab"));
00616                 closeUnselectedButton = FindCloseButton(FindElement.ByName("LongHeaderTab"));
00617                 Verify.IsNull(closeUnselectedButton);
00618                 Verify.IsNotNull(closeSelectedButton);
00619
00620                 // Verifiying "Auto" works correctly
00621                 closeButtonOverlayModeComboBox.SelectItemByName("Auto");
00622                 Wait.ForIdle();
00623
00624                 closeSelectedButton = FindCloseButton(FindElement.ByName("FirstTab"));
00625                 closeUnselectedButton = FindCloseButton(FindElement.ByName("LongHeaderTab"));
00626                 Verify.IsNotNull(closeUnselectedButton);
00627                 Verify.IsNotNull(closeSelectedButton);
00628             }
00629         }
00630
00631         [TestMethod]
00632         [TestProperty("Ignore", "True")] // TODO 29556980: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00633         public void GamePadTest()
00634         {
00635             using (var setup = new TestSetupHelper("TabView Tests"))
00636             {
00637                 Button tabContent = FindElement.ByName<Button>("FirstTabButton");
00638                 ToggleButton toggleInnerFrameDimensions = FindElement.ById<ToggleButton>("__InnerFrameInLabDimensions");
00639                 TabItem firstTab = FindElement.ByName<TabItem>("FirstTab");
00640                 TabItem secondTab = FindElement.ByName<TabItem>("SecondTab");
00641                 TabItem lastTab = FindElement.ByName<TabItem>("LastTab");
00642                 Button addButton = FindElement.ById<Button>("AddButton");
00643
00644                 firstTab.SetFocus();
00645
00646                 GamepadHelper.PressButton(null, GamepadButton.LeftThumbstickRight);
00647                 Wait.ForIdle();
00648                 Verify.IsTrue(secondTab.HasKeyboardFocus, "GamePad Right should move focus to second tab");
00649
00650                 GamepadHelper.PressButton(null, GamepadButton.LeftThumbstickLeft);
00651                 Wait.ForIdle();
00652                 Verify.IsTrue(firstTab.HasKeyboardFocus, "GamePad Left should move focus to first tab");
00653
00654                 GamepadHelper.PressButton(null, GamepadButton.LeftThumbstickDown);
00655                 Wait.ForIdle();
00656                 Verify.IsTrue(tabContent.HasKeyboardFocus, "GamePad Down should move focus to tab content");
00657
00658                 GamepadHelper.PressButton(null, GamepadButton.LeftThumbstickUp);
00659                 Wait.ForIdle();
00660                 Verify.IsTrue(firstTab.HasKeyboardFocus, "GamePad Up should move focus to tabs");
00661
00662                 GamepadHelper.PressButton(null, GamepadButton.LeftThumbstickUp);
00663                 Wait.ForIdle();
00664                 Verify.IsTrue(toggleInnerFrameDimensions.HasKeyboardFocus, "GamePad Up should move to toggle inner frame dimensions button");
00665             }
00666         }
00667
00668         [TestMethod]
00669         [TestProperty("Ignore", "True")] // TODO 29556980: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00670         public void DragOutsideTest()
00671         {
00672             using (var setup = new TestSetupHelper("TabView Tests"))
00673             {
00674                 TextBlock dragOutsideTextBlock = FindElement.ByName<TextBlock>("TabDroppedOutsideTextBlock");
00675                 Verify.AreEqual("", dragOutsideTextBlock.DocumentText);
00676
00677                 Log.Comment("Drag tab out");
00678                 UIObject firstTab = TryFindElement.ByName("FirstTab");
00679                 InputHelper.DragDistance(firstTab, 50, Direction.South);
00680                 Wait.ForIdle();
00681
00682                 Log.Comment("Verify event fired");
00683                 Verify.AreEqual("Home", dragOutsideTextBlock.DocumentText);
00684             }
00685         }
00686
00687         [TestMethod]
00688         public void ToolTipDefaultTest()
00689         {
00690             using (var setup = new TestSetupHelper("TabView Tests"))
00691             {
00692                 Log.Comment("If the app sets custom tooltip text, it should be preserved.");
00693                 PressButtonAndVerifyText("GetTab0ToolTipButton", "Tab0ToolTipTextBlock", "Custom Tooltip");
00694
00695                 Log.Comment("If the app does not set a custom tooltip, it should be the same as the header text.");
00696                 PressButtonAndVerifyText("GetTab1ToolTipButton", "Tab1ToolTipTextBlock", "SecondTab");
00697
00698                 Button changeShopTextButton = FindElement.ByName<Button>("ChangeShopTextButton");
00699                 changeShopTextButton.InvokeAndWait();
00700
00701                 Log.Comment("If the tab's header changes, the tooltip should update.");
00702                 PressButtonAndVerifyText("GetTab1ToolTipButton", "Tab1ToolTipTextBlock", "Changed");
00703             }
00704         }
00705
00706         [TestMethod]
00707         public void ToolTipUpdateTest()
00708         {
00709             using (var setup = new TestSetupHelper("TabView Tests"))
00710             {
00711                 Button customTooltipButton = FindElement.ByName<Button>("CustomTooltipButton");
00712                 customTooltipButton.InvokeAndWait();
00713
00714                 Log.Comment("If the app updates the tooltip, it should change to their custom one.");
00715                 PressButtonAndVerifyText("GetTab1ToolTipButton", "Tab1ToolTipTextBlock", "Custom");
00716
00717                 Button changeShopTextButton = FindElement.ByName<Button>("ChangeShopTextButton");
00718                 changeShopTextButton.InvokeAndWait();
00719
00720                 Log.Comment("The tooltip should not update if the header changes.");
00721                 PressButtonAndVerifyText("GetTab1ToolTipButton", "Tab1ToolTipTextBlock", "Custom");
00722             }
00723         }
00724
00725         [TestMethod]
00726         public void CloseButtonDoesNotShowWhenVisibilityIsToggled()
00727         {
00728             using (var setup = new TestSetupHelper("TabView Tests"))
00729             {
00730                 // Wait for the test page's timer to set visibility to the close button to visible
00731                 Wait.ForMilliseconds(2);
00732                 Wait.ForIdle();
00733
00734                 UIObject notCloseableTab = FindElement.ByName("NotCloseableTab");
00735                 var closeButton = FindCloseButton(notCloseableTab);
00736                 Verify.IsNull(closeButton);
00737             }
00738         }
00739
00740         [TestMethod]
00741         public void SizingTest()
00742         {
00743             using (var setup = new TestSetupHelper("TabView Tests"))
00744             {
00745                 Button sizingPageButton = FindElement.ByName<Button>("TabViewSizingPageButton");
00746                 sizingPageButton.InvokeAndWait();
00747                 Wait.ForMilliseconds(200);
00748                 ElementCache.Refresh();
00749
00750                 Button setSmallWidthButton = FindElement.ByName<Button>("SetSmallWidth");
00751                 setSmallWidthButton.InvokeAndWait();
00752
00753                 Button getWidthsButton = FindElement.ByName<Button>("GetWidthsButton");
00754                 getWidthsButton.InvokeAndWait();
00755
00756                 TextBlock widthEqualText = FindElement.ByName<TextBlock>("WidthEqualText");
00757                 TextBlock widthSizeToContentText = FindElement.ByName<TextBlock>("WidthSizeToContentText");
00758
00759                 Verify.AreEqual("400", widthEqualText.DocumentText);
00760                 Verify.AreEqual("400", widthSizeToContentText.DocumentText);
00761
00762                 Button setLargeWidthButton = FindElement.ByName<Button>("SetLargeWidth");
00763                 setLargeWidthButton.InvokeAndWait();
00764
00765                 getWidthsButton.InvokeAndWait();
00766
00767                 Verify.AreEqual("700", widthEqualText.DocumentText);
00768                 Verify.AreEqual("700", widthSizeToContentText.DocumentText);
00769             }
00770         }
00771
00772         [TestMethod]
00773         public void VerifyDragStartedCalledOnItemDrag()
00774         {
00775             using (var setup = new TestSetupHelper("TabView Tests"))
00776             {
00777                 InputHelper.MouseDragDistance(FindElement.ByName("SecondTab"), 200, Direction.East, 4000);
00778                 Verify.AreEqual("SecondTab dragged", FindElement.ByName<TextBlock>("TabDraggedResultsTextBlock").DocumentText);
00779             }
00780         }
00781
00782         [TestMethod]
00783         public void ScrollButtonToolTipTest()
00784         {
00785             using (var setup = new TestSetupHelper("TabView Tests"))
00786             {
00787                 PressButtonAndVerifyText("GetScrollDecreaseButtonToolTipButton", "ScrollDecreaseButtonToolTipTextBlock", "Scroll tab list backward");
00788                 PressButtonAndVerifyText("GetScrollIncreaseButtonToolTipButton", "ScrollIncreaseButtonToolTipTextBlock", "Scroll tab list forward");
00789             }
00790         }
00791
00792         [TestMethod]
00793         public void VerifySizingBehaviorOnTabCloseComingFromScroll()
00794         {
00795             int pixelTolerance = 10;
00796
00797             using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTabClosingBehaviorButton" }))
00798             {
00799
00800                 Log.Comment("Verifying sizing behavior when closing a tab");
00801                 CloseTabAndVerifyWidth("Tab 1", 500, "True;False;");
00802
00803                 CloseTabAndVerifyWidth("Tab 2", 500, "True;False;");
00804
00805                 CloseTabAndVerifyWidth("Tab 3", 500, "False;False;");
00806
00807                 CloseTabAndVerifyWidth("Tab 5", 430, "False;False;");
00808
00809                 CloseTabAndVerifyWidth("Tab 4", 450, "False;False;");
00810
00811                 Log.Comment("Leaving the pointer exited area");
00812                 var readTabViewWidthButton = new Button(FindElement.ByName("GetActualWidthButton"));
00813                 readTabViewWidthButton.Click();
00814                 Wait.ForIdle();
00815
00816                 readTabViewWidthButton.Click();
00817                 Wait.ForIdle();
00818
00819                 Log.Comment("Verify correct TabView width");
00820                 Verify.IsTrue(Math.Abs(GetActualTabViewWidth() - 283) < pixelTolerance);
00821             }
00822
00823             void CloseTabAndVerifyWidth(string tabName, int expectedValue, string expectedScrollbuttonStates)
00824             {
00825                 Log.Comment("Closing tab:" + tabName);
00826                 FindCloseButton(FindElement.ByName(tabName)).Click();
00827                 Wait.ForIdle();
00828                 Log.Comment("Verifying TabView width -- expected " + expectedValue + ", actual " + GetActualTabViewWidth());
00829                 Verify.IsTrue(Math.Abs(GetActualTabViewWidth() - expectedValue) < pixelTolerance);
00830                 Verify.AreEqual(expectedScrollbuttonStates, FindElement.ByName("ScrollButtonStatus").GetText());
00831
00832             }
00833
00834             double GetActualTabViewWidth()
00835             {
00836                 var tabviewWidth = new TextBlock(FindElement.ByName("TabViewWidth"));
00837
00838                 Log.Comment("TabView width:" + tabviewWidth.GetText());
00839                 return Double.Parse(tabviewWidth.GetText());
00840             }
00841         }
00842
00843         [TestMethod]
00844         public void VerifySizingBehaviorOnTabCloseComingFromNonScroll()
00845         {
00846             int pixelTolerance = 10;
00847
00848             using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTabClosingBehaviorButton" }))
00849             {
00850
00851                 Log.Comment("Verifying sizing behavior when closing a tab");
00852                 CloseTabAndVerifyWidth("Tab 1", 500, "True;False;");
00853
00854                 CloseTabAndVerifyWidth("Tab 2", 500, "True;False;");
00855
00856                 CloseTabAndVerifyWidth("Tab 3", 500, "False;False;");
00857
00858                 var readTabViewWidthButton = new Button(FindElement.ByName("GetActualWidthButton"));
00859                 readTabViewWidthButton.Click();
00860                 Wait.ForIdle();
00861
00862                 CloseTabAndVerifyWidth("Tab 5", 500, "False;False;");
00863
00864                 readTabViewWidthButton.Click();
00865                 Wait.ForIdle();
00866
00867                 CloseTabAndVerifyWidth("Tab 4", 500, "False;False;");
00868
00869                 Log.Comment("Leaving the pointer exited area");
00870
00871                 readTabViewWidthButton.Click();
00872                 Wait.ForIdle();
00873
00874                 Log.Comment("Verify correct TabView width");
00875                 Verify.IsTrue(Math.Abs(GetActualTabViewWidth() - 283) < pixelTolerance);
00876             }
00877
00878             void CloseTabAndVerifyWidth(string tabName, int expectedValue, string expectedScrollbuttonStates)
00879             {
00880                 Log.Comment("Closing tab:" + tabName);
00881                 FindCloseButton(FindElement.ByName(tabName)).Click();
00882                 Wait.ForIdle();
00883                 Log.Comment("Verifying TabView width");
00884                 Verify.IsTrue(Math.Abs(GetActualTabViewWidth() - expectedValue) < pixelTolerance);
00885                 Verify.AreEqual(expectedScrollbuttonStates, FindElement.ByName("ScrollButtonStatus").GetText());
00886
00887             }
00888
00889             double GetActualTabViewWidth()
00890             {
00891                 var tabviewWidth = new TextBlock(FindElement.ByName("TabViewWidth"));
00892
00893                 return Double.Parse(tabviewWidth.GetText());
00894             }
00895         }
00896
00897         [TestMethod]
00898         public void VerifySizingBehaviorModifyingCollectionRemovingLastItem()
00899         {
00900             int pixelTolerance = 5;
00901
00902             using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTabClosingBehaviorButton" }))
00903             {
00904
00905                 Log.Comment("Verifying sizing behavior when removing the last tab from tab collection");
00906                 CloseTabAndVerifyWidth("Tab 5", 500, 100);
00907
00908                 CloseTabAndVerifyWidth("Tab 4", 500, 100);
00909
00910                 CloseTabAndVerifyWidth("Tab 3", 500, 140);
00911
00912                 CloseTabAndVerifyWidth("Tab 2", 500, 225);
00913             }
00914
00915             void CloseTabAndVerifyWidth(string tabName, int expectedWidth, int expectedItemWidth)
00916             {
00917                 Log.Comment("Closing tab:" + tabName);
00918                 new Button(FindElement.ByName("RemoveLastItemButton")).Click();
00919                 Wait.ForIdle();
00920                 new Button(FindElement.ByName("GetActualWidthButton")).Click();
00921                 Log.Comment("Verifying TabView width");
00922                 Verify.IsTrue(Math.Abs(GetActualTabViewWidth() - expectedWidth) < pixelTolerance);
00923                 var firstTabItemWidth = GetFirstTabItemWidth();
00924                 Verify.IsTrue(Math.Abs(firstTabItemWidth - expectedItemWidth) < pixelTolerance);
00925             }
00926
00927             double GetActualTabViewWidth()
00928             {
00929                 var tabviewWidth = new TextBlock(FindElement.ByName("TabViewWidth"));
00930
00931                 return double.Parse(tabviewWidth.GetText());
00932             }
00933
00934             double GetFirstTabItemWidth()
00935             {
00936                 var tabviewWidth = new TextBlock(FindElement.ByName("TabViewHeaderWidth"));
00937
00938                 return double.Parse(tabviewWidth.GetText().Split(".")[0]);
00939             }
00940         }
00941
00942         [TestMethod]
00943         public void VerifySizingBehaviorModifyingCollectionRemovingSecondItem()
00944         {
00945             int pixelTolerance = 5;
00946
00947             using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTabClosingBehaviorButton" }))
00948             {
00949
00950                 Log.Comment("Verifying sizing behavior when removing the second tab from tab collection");
00951                 CloseTabAndVerifyWidth("Tab 5", 500, 100);
00952
00953                 CloseTabAndVerifyWidth("Tab 4", 500, 100);
00954
00955                 CloseTabAndVerifyWidth("Tab 3", 500, 140);
00956
00957                 CloseTabAndVerifyWidth("Tab 2", 500, 225);
00958             }
00959
00960             void CloseTabAndVerifyWidth(string tabName, int expectedWidth, int expectedItemWidth)
00961             {
00962                 Log.Comment("Closing tab:" + tabName);
00963                 new Button(FindElement.ByName("RemoveMiddleItemButton")).Click();
00964                 Wait.ForIdle();
00965                 new Button(FindElement.ByName("GetActualWidthButton")).Click();
00966                 Log.Comment("Verifying TabView width");
00967                 Verify.IsTrue(Math.Abs(GetActualTabViewWidth() - expectedWidth) < pixelTolerance);
00968                 Verify.IsTrue(Math.Abs(GetFirstTabItemWidth() - expectedItemWidth) < pixelTolerance);
00969             }
00970
00971             double GetActualTabViewWidth()
00972             {
00973                 var tabviewWidth = new TextBlock(FindElement.ByName("TabViewWidth"));
00974
00975                 return double.Parse(tabviewWidth.GetText());
00976             }
00977
00978             double GetFirstTabItemWidth()
00979             {
00980                 var tabviewWidth = new TextBlock(FindElement.ByName("TabViewHeaderWidth"));
00981
00982                 return double.Parse(tabviewWidth.GetText().Split(".")[0]);
00983             }
00984         }
00985
00986         [TestMethod]
00987         public void VerifySizingBehaviorOnTabCloseComingFromCtrlF4()
00988         {
00989             int pixelTolerance = 10;
00990
00991             using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTabClosingBehaviorButton" }))
00992             {
00993
00994                 Log.Comment("Verifying sizing behavior when closing a tab using Ctrl+F4");
00995                 CloseTabAndVerifyWidth("Tab 1", 500, "True;False;");
00996
00997                 CloseTabAndVerifyWidth("Tab 2", 500, "True;False;");
00998             }
00999
01000             void CloseTabAndVerifyWidth(string tabName, int expectedValue, string expectedScrollbuttonStates)
01001             {
01002                 Log.Comment("Closing tab:" + tabName);
01003                 FindElement.ByName(tabName).Click();
01004                 KeyboardHelper.PressKey(Key.F4,ModifierKey.Control);
01005                 Wait.ForIdle();
01006                 Log.Comment("Verifying TabView width");
01007                 Verify.IsTrue(Math.Abs(GetActualTabViewWidth() - expectedValue) < pixelTolerance);
01008                 Verify.AreEqual(expectedScrollbuttonStates, FindElement.ByName("ScrollButtonStatus").GetText());
01009
01010             }
01011
01012             double GetActualTabViewWidth()
01013             {
01014                 var tabviewWidth = new TextBlock(FindElement.ByName("TabViewWidth"));
01015
01016                 return Double.Parse(tabviewWidth.GetText());
01017             }
01018         }
01019
01020         [TestMethod]
01021         public void VerifyHeaderSizeWhenClosingLastTab()
01022         {
01023             using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTabClosingBehaviorButton" }))
01024             {
01025                 var increaseScrollButton = FindElement.ByName<Button>("IncreaseScrollButton");
01026                 increaseScrollButton.Click();
01027                 Wait.ForIdle();
01028                 increaseScrollButton.Click();
01029                 Wait.ForIdle();
01030                 var readTabViewWidthButton = new Button(FindElement.ByName("GetActualWidthButton"));
01031                 readTabViewWidthButton.Click();
01032                 Wait.ForIdle();
01033
01034                 var initialWidth = GetTabViewHeaderWidth();
01035                 Verify.AreEqual(100, initialWidth);
01036
01037                 var lastTab = FindElement.ByName("Tab 5");
01038                 FindCloseButton(lastTab).Click();
01039                 Wait.ForIdle();
01040
01041                 var widthAfterClose = GetTabViewHeaderWidth();
01042                 Verify.AreEqual(100, widthAfterClose);
01043                 Verify.AreEqual("False;True;", FindElement.ByName("ScrollButtonStatus").GetText());
01044
01045                 var newLastTab = FindElement.ByName("Tab 4");
01046                 FindCloseButton(newLastTab).Click();
01047                 Wait.ForIdle();
01048
01049                 var widthAfterSecondClose = GetTabViewHeaderWidth();
01050                 Verify.AreEqual(100, widthAfterSecondClose);
01051
01052                 double GetTabViewHeaderWidth()
01053                 {
01054                     var tabViewHeaderWidth = new TextBlock(FindElement.ByName("TabViewHeaderWidth"));
01055                     return double.Parse(tabViewHeaderWidth.GetText());
01056                 }
01057             }
01058         }
01059
01060         [TestMethod]
01061         [TestProperty("Ignore", "True")] // Bug 44710757: TabViewTests.VerifySpaceAllocatedWhenDraggingFromOutsideTabView is unreliable and has been disabled.
01062         public void VerifySpaceAllocatedWhenDraggingFromOutsideTabView()
01063         {
01064             using (var setup = new TestSetupHelper(new[] { "TabView Tests", "MultipleTabViewPageButton" }))
01065             {
01066                 static void VerifyAddButtonMoves(UIObject tabToDrag, UIObject tabToDragTo, UIObject addButton)
01067                 {
01068                     Log.Comment($"Drag {tabToDrag.Name} over {tabToDragTo.Name} and confirm that the add button moves to make room.");
01069                     var initialPoint = addButton.GetClickablePoint();
01070
01071                     InputHelper.LeftMouseButtonDown(tabToDrag);
01072                     InputHelper.MoveMouse(tabToDragTo.GetClickablePoint());
01073
01074                     Verify.IsGreaterThan(addButton.GetClickablePoint().X, initialPoint.X);
01075
01076                     InputHelper.LeftMouseButtonUp();
01077                 }
01078
01079                 var firstTabView = FindElement.ByName("FirstTabView");
01080                 var firstTabViewFirstTab = FindElement.ByName("Item0");
01081                 var firstTabViewSecondTab = FindElement.ByName("Item1");
01082                 var firstTabViewThirdTab = FindElement.ByName("Item2");
01083                 var secondTabView = FindElement.ByName("SecondTabView");
01084                 var secondTabViewTab = FindElement.ByName("Item4");
01085                 var secondTabViewAddButton = secondTabView.Descendants.Find("AddButton");
01086                 var compactTabView = FindElement.ByName("CompactTabView");
01087                 var compactTabViewTab = FindElement.ByName("Item5");
01088                 var compactTabViewAddButton = compactTabView.Descendants.Find("AddButton");
01089                 var sizeToContentTabView = FindElement.ByName("SizeToContentTabView");
01090                 var sizeToContentTabViewTab = FindElement.ByName("Item6");
01091                 var sizeToContentTabViewAddButton = sizeToContentTabView.Descendants.Find("AddButton");
01092
01093                 VerifyAddButtonMoves(firstTabViewFirstTab, secondTabViewTab, secondTabViewAddButton);
01094                 VerifyAddButtonMoves(firstTabViewSecondTab, compactTabViewTab, compactTabViewAddButton);
01095                 VerifyAddButtonMoves(firstTabViewThirdTab, sizeToContentTabViewTab, sizeToContentTabViewAddButton);
01096             }
01097         }
01098
01099         [TestMethod]
01100         [TestProperty("Description", "Verifies the tapping the scroll increase repeat button once causes an incremental scroll.")]
01101         [TestProperty("RegressionBug", "46527670")]
01102         public void VerifyScrollRepeatButtons()
01103         {
01104             using (var setup = new TestSetupHelper("TabView Tests"))
01105             {
01106                 Log.Comment("Enumerating TabView's children:");
01107                 UIObject tabView = FindElement.ByName("Tabs");
01108                 Verify.IsNotNull(tabView);
01109
01110                 EnumerateChildren(tabView);
01111
01112                 Verify.IsFalse(AreScrollButtonsVisible(), "Scroll repeat buttons should not be visible");
01113
01114                 Log.Comment("Adding 10 new tabs to show the scroll repeat buttons.");
01115                 Button addTabButton = FindElement.ByName<Button>("Add New Tab");
01116
01117                 for (int i = 0; i < 10; i++)
01118                 {
01119                     addTabButton.InvokeAndWait();
01120                 }
01121
01122                 ElementCache.Refresh();
01123
01124                 Log.Comment("Enumerating TabView's children again:");
01125                 EnumerateChildren(tabView);
01126
01127                 Verify.IsTrue(AreScrollButtonsVisible(), "Scroll repeat buttons should be visible now");
01128                 Verify.IsFalse(IsScrollDecreaseButtonEnabled(), "Scroll decrease repeat button should be disabled");
01129                 Verify.IsTrue(IsScrollIncreaseButtonEnabled(), "Scroll increase repeat button should be enabled");
01130
01131                 Log.Comment("Add Button Bounding Rect: X=" + addTabButton.BoundingRectangle.X + ", Y=" + addTabButton.BoundingRectangle.Y + ", W=" + addTabButton.BoundingRectangle.Width + ", H=" + addTabButton.BoundingRectangle.Height);
01132
01133                 // Since the scroll repeat buttons have no accessibility visibility, the neighboring Add Tab button is used, with a negative horizontal offset to reach the scroll increase repeat button.
01134                 addTabButton.Tap(-addTabButton.BoundingRectangle.Width, addTabButton.BoundingRectangle.Height * 0.5);
01135                 Wait.ForIdle();
01136
01137                 bool newIsScrollDecreaseButtonEnabled = IsScrollDecreaseButtonEnabled();
01138                 bool newIsScrollIncreaseButtonEnabled = IsScrollIncreaseButtonEnabled();
01139
01140                 Log.Comment("New scroll decrease repeat button status: " + newIsScrollDecreaseButtonEnabled);
01141                 Log.Comment("New scroll increase repeat button status: " + newIsScrollIncreaseButtonEnabled);
01142
01143                 Verify.IsTrue(newIsScrollDecreaseButtonEnabled, "Scroll decrease repeat button should be enabled");
01144                 Verify.IsTrue(newIsScrollIncreaseButtonEnabled, "Scroll increase repeat button should be enabled");
01145             }
01146         }
01147
01148         [TestMethod]
01149         [TestProperty("Description", "Verifies that CanTearOutTabs enables the tearing out of tabs created for data items into new windows, and the rejoining of those tabs into existing windows.")]
01150         [TestProperty("IsolationLevel", "Method")] // These tests create and destroy windows, so we'll isolate each test to ensure we start with a known good state each time.
01151         public void CanTearOutAndRejoinTabsWithDataItems()
01152         {
01153             using (var windowOpenedWaiter = new WindowOpenedWaiter(_secondaryWindowCondition))
01154             {
01155                 using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTearOutWindowWithDataItemsButton" }))
01156                 {
01157                     windowOpenedWaiter.Wait();
01158                     ClosePrimaryWindow(setup);
01159                     TabViewTearOutTestHelpers.CanTearOutAndRejoinTabs(GetTabViewTearOutAppWindows, GetTabViewFromWindow, GetTabsFromTabView);
01160                 }
01161             }
01162         }
01163
01164         [TestMethod]
01165         [TestProperty("Description", "Verifies that CanTearOutTabs does not prevent internally reordering tabs created for items.")]
01166         [TestProperty("IsolationLevel", "Method")] // These tests create and destroy windows, so we'll isolate each test to ensure we start with a known good state each time.
01167         [TestProperty("Ignore", "True")] // Bug 52324246: Re-enable TabViewTests.CanReorderTabsWithTabTearOutWithDataItems after determining what is failing in the lab
01168         public void CanReorderTabsWithTabTearOutWithDataItems()
01169         {
01170             using (var windowOpenedWaiter = new WindowOpenedWaiter(_secondaryWindowCondition))
01171             {
01172                 using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTearOutWindowWithDataItemsButton" }))
01173                 {
01174                     windowOpenedWaiter.Wait();
01175                     ClosePrimaryWindow(setup);
01176                     TabViewTearOutTestHelpers.CanReorderTabs(GetTabViewTearOutAppWindows, GetTabViewFromWindow, GetTabsFromTabView);
01177                 }
01178             }
01179         }
01180
01181         [TestMethod]
01182         [TestProperty("Description", "Verifies that CanTearOutTabs does not prevent selecting tabs created for data items.")]
01183         [TestProperty("IsolationLevel", "Method")] // These tests create and destroy windows, so we'll isolate each test to ensure we start with a known good state each time.
01184         public void CanSelectTabsWithTabTearOutWithDataItems()
01185         {
01186             using (var windowOpenedWaiter = new WindowOpenedWaiter(_secondaryWindowCondition))
01187             {
01188                 using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTearOutWindowWithDataItemsButton" }))
01189                 {
01190                     windowOpenedWaiter.Wait();
01191                     ClosePrimaryWindow(setup);
01192                     TabViewTearOutTestHelpers.CanSelectTabs(GetTabViewTearOutAppWindows, GetTabViewFromWindow, GetTabsFromTabView);
01193                 }
01194             }
01195         }
01196
01197         [TestMethod]
01198         [TestProperty("Description", "Verifies that CanTearOutTabs enables the tearing out of tabs not created for data items into new windows, and the rejoining of those tabs into existing windows.")]
01199         [TestProperty("IsolationLevel", "Method")] // These tests create and destroy windows, so we'll isolate each test to ensure we start with a known good state each time.
01200         public void CanTearOutAndRejoinTabsWithoutDataItems()
01201         {
01202             using (var windowOpenedWaiter = new WindowOpenedWaiter(_secondaryWindowCondition))
01203             {
01204                 using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTearOutWindowWithoutDataItemsButton" }))
01205                 {
01206                     windowOpenedWaiter.Wait();
01207                     ClosePrimaryWindow(setup);
01208                     TabViewTearOutTestHelpers.CanTearOutAndRejoinTabs(GetTabViewTearOutAppWindows, GetTabViewFromWindow, GetTabsFromTabView);
01209                 }
01210             }
01211         }
01212
01213         [TestMethod]
01214         [TestProperty("Description", "Verifies that CanTearOutTabs does not prevent internally reordering tabs not created for data items.")]
01215         [TestProperty("IsolationLevel", "Method")] // These tests create and destroy windows, so we'll isolate each test to ensure we start with a known good state each time.
01216         public void CanReorderTabsWithTabTearOutWithoutDataItems()
01217         {
01218             using (var windowOpenedWaiter = new WindowOpenedWaiter(_secondaryWindowCondition))
01219             {
01220                 using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTearOutWindowWithoutDataItemsButton" }))
01221                 {
01222                     windowOpenedWaiter.Wait();
01223                     ClosePrimaryWindow(setup);
01224                     TabViewTearOutTestHelpers.CanReorderTabs(GetTabViewTearOutAppWindows, GetTabViewFromWindow, GetTabsFromTabView);
01225                 }
01226             }
01227         }
01228
01229         [TestMethod]
01230         [TestProperty("Description", "Verifies that CanTearOutTabs does not prevent selecting tabs backed not created for.")]
01231         [TestProperty("IsolationLevel", "Method")] // These tests create and destroy windows, so we'll isolate each test to ensure we start with a known good state each time.
01232         public void CanSelectTabsWithTabTearOutWithoutDataItems()
01233         {
01234             using (var windowOpenedWaiter = new WindowOpenedWaiter(_secondaryWindowCondition))
01235             {
01236                 using (var setup = new TestSetupHelper(new[] { "TabView Tests", "TabViewTearOutWindowWithoutDataItemsButton" }))
01237                 {
01238                     windowOpenedWaiter.Wait();
01239                     ClosePrimaryWindow(setup);
01240                     TabViewTearOutTestHelpers.CanSelectTabs(GetTabViewTearOutAppWindows, GetTabViewFromWindow, GetTabsFromTabView);
01241                 }
01242             }
01243         }
01244
01245         [TestMethod]
01246         [TestProperty("Description", "Verifies that right-clicking on a TabView tab does not select it.")]
01247         [TestProperty("RegressionBug", "52129006")]
01248         public void VerifyRightClickDoesNotSelectTab()
01249         {
01250             using (var setup = new TestSetupHelper("TabView Tests"))
01251             {
01252                 Log.Comment("We should begin on the first tab.");
01253                 UIObject tabContent = FindElement.ByName("FirstTabContent");
01254                 Verify.IsNotNull(tabContent);
01255
01256                 Log.Comment("Now we'll right-click on the last tab.");
01257                 UIObject lastTab = FindElement.ByName("LastTab");
01258                 InputHelper.RightClick(lastTab);
01259
01260                 Log.Comment("We should still be on the first tab.");
01261                 ElementCache.Clear();
01262                 tabContent = FindElement.ByName("FirstTabContent");
01263                 Verify.IsNotNull(tabContent);
01264             }
01265         }
01266
01267         private void PressButtonAndVerifyText(String buttonName, String textBlockName, String expectedText)
01268         {
01269             Button button = FindElement.ByName<Button>(buttonName);
01270             button.InvokeAndWait();
01271
01272             TextBlock textBlock = FindElement.ByName<TextBlock>(textBlockName);
01273             Verify.AreEqual(expectedText, textBlock.DocumentText);
01274         }
01275
01276         private Button FindCloseButton(UIObject tabItem)
01277         {
01278             foreach (UIObject elem in tabItem.Children)
01279             {
01280                 if (elem.ClassName.Equals("Button"))
01281                 {
01282                     Log.Comment("Found close button for object " + tabItem.Name);
01283                     return new Button(elem);
01284                 }
01285             }
01286             Log.Comment("Did not find close button for object " + tabItem.Name);
01287             return null;
01288         }
01289
01290         private void EnumerateChildren(UIObject root)
01291         {
01292             foreach (UIObject child in root.Children)
01293             {
01294                 Log.Comment("Children Enumeration: Name=" + child.Name + ", ClassName=" + child.ClassName);
01295                 EnumerateChildren(child);
01296             }
01297         }
01298
01299         private static readonly UICondition _primaryWindowCondition =
01300             UICondition.CreateFromName("MUXControlsTestApp.Desktop");
01301
01302         private static readonly UICondition _secondaryWindowCondition =
01303             UICondition.CreateFromName("MUXControlsTestApp.Desktop - Secondary TabViewTearOutWindow");
01304
01305         private static readonly UICondition _tabViewCondition =
01306             UICondition.CreateFromName("TearOutTabsTabView");
01307
01308         private static readonly UICondition _tabCondition =
01309             UICondition.CreateFromClassName("ListViewItem");
01310
01311         private static void ClosePrimaryWindow(TestSetupHelper setup)
01312         {
01313             Log.Comment("We won't be needing the primary window, so we'll close it now in order to avoid it stealing focus.");
01314
01315             var primaryWindow = GetPrimaryWindow();
01316             Window tabTearOutWindow = GetTabViewTearOutAppWindows().Single();
01317             TestEnvironment.Application.SetNewApplicationFrameWindow(tabTearOutWindow);
01318
01319             using (var waiter = new WindowClosedWaiter(primaryWindow))
01320             {
01321                 primaryWindow.Close();
01322                 waiter.Wait();
01323             }
01324
01325             setup.ClearOpenedPages();
01326             Wait.ForIdle();
01327         }
01328
01329         private static Window GetPrimaryWindow()
01330         {
01331             return new Window(UIObject.Root.Children.Find(_primaryWindowCondition));
01332         }
01333
01334         private static List<Window> GetTabViewTearOutAppWindows()
01335         {
01336             return UIObject.Root.Children.FindMultiple(_secondaryWindowCondition).Select(o => new Window(o)).ToList();
01337         }
01338
01339         private static Tab GetTabViewFromWindow(Window window)
01340         {
01341             return new Tab(window.Descendants.Find(_tabViewCondition));
01342         }
01343
01344         private static List<TabItem> GetTabsFromTabView(Tab tabView)
01345         {
01346             return tabView.Descendants.FindMultiple(_tabCondition).Select(o => new TabItem(o)).ToList();
01347         }
01348     }
01349 }
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TwoPaneView/InteractionTests/TwoPaneViewTests.cs Source File

  • TwoPaneView
  • InteractionTests

TwoPaneViewTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005
00006 using Common;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00009 using Windows.Foundation.Metadata;
00010
00011 using WEX.TestExecution;
00012 using WEX.TestExecution.Markup;
00013 using WEX.Logging.Interop;
00014
00015 using Microsoft.Windows.Apps.Test.Automation;
00016 using Microsoft.Windows.Apps.Test.Foundation;
00017 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00018 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00019 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00020
00021 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00022 {
00023     [TestClass]
00024     public class TwoPaneViewTests
00025     {
00026         // Need to be the same as c_defaultMinWideModeWidth/c_defaultMinTallModeHeight in TwoPaneViewFactory.cpp
00027         private const double c_defaultMinWideModeWidth = 641.0;
00028         private const double c_defaultMinTallModeHeight = 641.0;
00029
00030         // Need to be the same as c_simulatedPaneWidth/c_simulatedPaneHeight/c_simulatedMiddle in TwoPaneViewPage.xaml.cs
00031         private const double c_simulatedPaneWidth = 300.0;
00032         private const double c_simulatedPaneHeight = 400.0;
00033         private const double c_simulatedMiddle = 12.0;
00034
00035         // Need to be the same as c_controlMargin in TwoPaneViewPage.xaml.cs
00036         private const double c_controlMargin_left = 40.0;
00037         private const double c_controlMargin_top = 10.0;
00038         private const double c_controlMargin_right = 30.0;
00039         private const double c_controlMargin_bottom = 20.0;
00040
00041         enum ControlWidth { Default, Wide, Narrow }
00042         enum ControlHeight { Default, Tall, Short }
00043         enum WideModeConfiguration { LeftRight, RightLeft, SinglePane }
00044         enum TallModeConfiguration { TopBottom, BottomTop, SinglePane }
00045         enum PanePriority { Pane1, Pane2 }
00046         enum TwoPaneViewMode { SinglePane, Wide, Tall }
00047
00048         enum ViewMode { Pane1Only, Pane2Only, LeftRight, RightLeft, TopBottom, BottomTop }
00049
00050         [ClassInitialize]
00051         [TestProperty("RunAs", "User")]
00052         [TestProperty("Classification", "Integration")]
00053         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00054         public static void ClassInitialize(TestContext testContext)
00055         {
00056             TestEnvironment.Initialize(testContext);
00057         }
00058
00059         [TestCleanup]
00060         public void TestCleanup()
00061         {
00062             TestCleanupHelper.Cleanup();
00063         }
00064
00065         [TestMethod]
00066         public void ViewModeTest()
00067         {
00068             using (var setup = new TestSetupHelper("TwoPaneView Tests")) // This clicks the button corresponding to the test page.
00069             {
00070                 SetControlWidth(ControlWidth.Wide);
00071                 SetControlHeight(ControlHeight.Tall);
00072
00073                 Wait.ForSeconds(5);
00074
00075                 VerifyViewMode(ViewMode.LeftRight);
00076
00077                 Log.Comment("Verify changing wide behavior splits right/left");
00078                 SetWideModeConfiguration(WideModeConfiguration.RightLeft);
00079                 VerifyViewMode(ViewMode.RightLeft);
00080
00081                 Log.Comment("Verify narrow width splits top/bottom");
00082                 SetControlWidth(ControlWidth.Narrow);
00083                 VerifyViewMode(ViewMode.TopBottom);
00084
00085                 Log.Comment("Verify changing tall behavior splits bottom/top");
00086                 SetTallModeConfiguration(TallModeConfiguration.BottomTop);
00087                 VerifyViewMode(ViewMode.BottomTop);
00088
00089                 Log.Comment("Verify short height shows only priority pane");
00090                 SetControlHeight(ControlHeight.Short);
00091                 VerifyViewMode(ViewMode.Pane1Only);
00092
00093                 Log.Comment("Verify changing priority switches panes");
00094                 SetPanePriority(PanePriority.Pane2);
00095                 VerifyViewMode(ViewMode.Pane2Only);
00096
00097                 Log.Comment("Verify tall height with span shows only priority pane");
00098                 SetControlHeight(ControlHeight.Tall);
00099                 VerifyViewMode(ViewMode.BottomTop);
00100                 SetTallModeConfiguration(TallModeConfiguration.SinglePane);
00101                 VerifyViewMode(ViewMode.Pane2Only);
00102
00103                 Log.Comment("Verify wide width with span shows only priority pane");
00104                 SetControlWidth(ControlWidth.Wide);
00105                 VerifyViewMode(ViewMode.RightLeft);
00106                 SetWideModeConfiguration(WideModeConfiguration.SinglePane);
00107                 VerifyViewMode(ViewMode.Pane2Only);
00108
00109                 Log.Comment("Verify changing priority switches panes");
00110                 SetPanePriority(PanePriority.Pane1);
00111                 VerifyViewMode(ViewMode.Pane1Only);
00112             }
00113         }
00114
00115         [TestMethod]
00116         public void ThresholdTest()
00117         {
00118             using (var setup = new TestSetupHelper("TwoPaneView Tests")) // This clicks the button corresponding to the test page.
00119             {
00120                 SetControlWidth(ControlWidth.Wide);
00121                 SetControlHeight(ControlHeight.Tall);
00122
00123                 Log.Comment("Verify changing min wide width updates view mode");
00124                 SetMinWideModeWidth(c_defaultMinWideModeWidth + 100);
00125                 VerifyViewMode(ViewMode.TopBottom);
00126
00127                 Log.Comment("Verify changing min tall height updates view mode");
00128                 SetMinTallModeHeight(c_defaultMinTallModeHeight + 100);
00129                 VerifyViewMode(ViewMode.Pane1Only);
00130
00131                 Log.Comment("Verify changing min wide width updates view mode");
00132                 SetMinWideModeWidth(c_defaultMinWideModeWidth - 100);
00133                 VerifyViewMode(ViewMode.LeftRight);
00134             }
00135         }
00136
00137         [TestMethod]
00138         [TestProperty("Ignore", "True")] // TODO 29555335: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00139         public void RegionTest()
00140         {
00141             using (var setup = new TestSetupHelper("TwoPaneView Tests")) // This clicks the button corresponding to the test page.
00142             {
00143                 Log.Comment("Verify horizontal split regions");
00144                 SetComboBox("SimulateComboBox", "LeftRight");
00145
00146                 VerifyViewMode(ViewMode.LeftRight);
00147                 VerifyPaneSize(1, c_simulatedPaneWidth, c_simulatedPaneHeight);
00148                 VerifyPaneSize(2, c_simulatedPaneWidth, c_simulatedPaneHeight);
00149                 VerifyPaneSpacing(c_simulatedMiddle);
00150
00151                 Log.Comment("Verify vertical split regions");
00152                 SetComboBox("SimulateComboBox", "TopBottom");
00153
00154                 VerifyViewMode(ViewMode.TopBottom);
00155                 VerifyPaneSize(1, c_simulatedPaneHeight, c_simulatedPaneWidth);
00156                 VerifyPaneSize(2, c_simulatedPaneHeight, c_simulatedPaneWidth);
00157                 VerifyPaneSpacing(c_simulatedMiddle);
00158             }
00159         }
00160
00161         [TestMethod]
00162         [TestProperty("Ignore", "True")] // TODO 29555335: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00163         public void RegionOffsetTest()
00164         {
00165             using (var setup = new TestSetupHelper("TwoPaneView Tests")) // This clicks the button corresponding to the test page.
00166             {
00167                 Log.Comment("Verify horizontal split regions with control offset from simulated window");
00168                 SetComboBox("SimulateComboBox", "LeftRight");
00169
00170                 CheckBox marginCheckbox = new CheckBox(FindElement.ByName("AddMarginCheckBox"));
00171                 marginCheckbox.Check();
00172                 Wait.ForIdle();
00173
00174                 VerifyViewMode(ViewMode.LeftRight);
00175                 VerifyPaneSize(1, c_simulatedPaneWidth - c_controlMargin_left,  c_simulatedPaneHeight - (c_controlMargin_top + c_controlMargin_bottom));
00176                 VerifyPaneSize(2, c_simulatedPaneWidth - c_controlMargin_right, c_simulatedPaneHeight - (c_controlMargin_top + c_controlMargin_bottom));
00177                 VerifyPaneSpacing(c_simulatedMiddle);
00178
00179                 Log.Comment("Verify vertical split regions with control offset from simulated window");
00180                 SetComboBox("SimulateComboBox", "TopBottom");
00181
00182                 VerifyViewMode(ViewMode.TopBottom);
00183                 VerifyPaneSize(1, c_simulatedPaneHeight - (c_controlMargin_left + c_controlMargin_right), c_simulatedPaneWidth - c_controlMargin_top);
00184                 VerifyPaneSize(2, c_simulatedPaneHeight - (c_controlMargin_left + c_controlMargin_right), c_simulatedPaneWidth - c_controlMargin_bottom);
00185                 VerifyPaneSpacing(c_simulatedMiddle);
00186             }
00187         }
00188
00189         [TestMethod]
00190         public void SingleRegionTest()
00191         {
00192             using (var setup = new TestSetupHelper("TwoPaneView Tests")) // This clicks the button corresponding to the test page.
00193             {
00194                 Log.Comment("Verify control acts appropriately when there are multiple regions but the control is only in one of them");
00195
00196                 SetComboBox("SimulateComboBox", "LeftRight");
00197
00198                 CheckBox marginCheckbox = new CheckBox(FindElement.ByName("OneSideCheckBox"));
00199                 marginCheckbox.Check();
00200                 Wait.ForIdle();
00201
00202                 VerifyViewMode(ViewMode.Pane1Only);
00203                 VerifyPaneSize(1, c_simulatedPaneWidth, c_simulatedPaneHeight);
00204
00205                 Log.Comment("Verify vertical split when control is in a single region");
00206                 SetMinTallModeHeight(c_simulatedPaneHeight - 10);
00207
00208                 VerifyViewMode(ViewMode.TopBottom);
00209                 VerifyPaneSpacing(0);
00210             }
00211         }
00212
00213         [TestMethod]
00214         public void InitialPanePriorityTest()
00215         {
00216             using (var setup = new TestSetupHelper("TwoPaneView Tests")) // This clicks the button corresponding to the test page.
00217             {
00218                 Log.Comment("Verify when pane priority is set to pane 2 on the small split panel, it only loads pane 2 (bug 14486142)");
00219
00220                 UIObject paneContent1 = TryFindElement.ByName("SmallContent1");
00221                 UIObject paneContent2 = TryFindElement.ByName("SmallContent2");
00222
00223                 Verify.IsNull(paneContent1, "Expected not to find small pane 1");
00224                 Verify.IsNotNull(paneContent2, "Expected to find small pane2");
00225             }
00226         }
00227
00228         [TestMethod]
00229         public void PaneLengthTest()
00230         {
00231             using (var setup = new TestSetupHelper("TwoPaneView Tests")) // This clicks the button corresponding to the test page.
00232             {
00233                 SetControlWidth(ControlWidth.Wide);
00234                 SetControlHeight(ControlHeight.Tall);
00235
00236                 int controlWidth = GetInt("ControlWidthText");
00237                 int controlHeight = GetInt("ControlHeightText");
00238                 Log.Comment("TwoPaneView size is " + controlWidth + ", " + controlHeight);
00239
00240                 Log.Comment("Verify changing pane 1 length to star sizing");
00241                 SetLength(1, 1, "Star");
00242
00243                 VerifyPaneSize(1, controlWidth / 2.0, 0);
00244                 VerifyPaneSize(2, controlWidth / 2.0, 0);
00245
00246                 Log.Comment("Verify changing pane 2 length to pixel sizing");
00247                 SetLength(2, 199, "Pixel");
00248
00249                 VerifyPaneSize(1, controlWidth - 199, 0);
00250                 VerifyPaneSize(2, 199, 0);
00251
00252                 Log.Comment("Verify column sizes stay the same when switching pane order");
00253                 SetWideModeConfiguration(WideModeConfiguration.RightLeft);
00254
00255                 VerifyPaneSize(1, controlWidth - 199, 0);
00256                 VerifyPaneSize(2, 199, 0);
00257
00258                 Log.Comment("Verify lengths apply to top/bottom configuration");
00259                 SetControlWidth(ControlWidth.Narrow);
00260
00261                 VerifyPaneSize(1, 0, controlHeight - 199);
00262                 VerifyPaneSize(2, 0, 199);
00263             }
00264         }
00265
00266
00267         // Verify that tabbing around puts us where we expect
00268         [TestMethod]
00269         public void VerifyTabKeyWorks()
00270         {
00271             using (var setup = new TestSetupHelper("TwoPaneView Tests")) // This clicks the button corresponding to the test page.
00272             {
00273                 UIObject twoPaneView = TryFindElement.ByName("TwoPaneViewLarge");
00274                 Verify.IsNotNull(twoPaneView, "TwoPaneView is present");
00275                 twoPaneView.SetFocus();
00276                 Wait.ForIdle();
00277                 Verify.AreNotEqual(UIObject.Focused, twoPaneView, "TwoPaneView should not be focused");
00278                 KeyboardHelper.PressKey(Key.Tab);
00279                 Verify.AreNotEqual(UIObject.Focused, twoPaneView, "TwoPaneView should not be focused");
00280                 KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift);
00281                 Verify.AreNotEqual(UIObject.Focused, twoPaneView, "TwoPaneView should not be focused");
00282             }
00283         }
00284
00285         private void VerifyViewMode(ViewMode mode)
00286         {
00287             // Verify configuration is correct for mode
00288             TwoPaneViewMode expectedConfiguration = TwoPaneViewMode.SinglePane;
00289             switch (mode)
00290             {
00291                 case ViewMode.LeftRight:
00292                 case ViewMode.RightLeft:
00293                     expectedConfiguration = TwoPaneViewMode.Wide;
00294                     break;
00295
00296                 case ViewMode.TopBottom:
00297                 case ViewMode.BottomTop:
00298                     expectedConfiguration = TwoPaneViewMode.Tall;
00299                     break;
00300             }
00301
00302             TextBlock configurationTextBlock = new TextBlock(FindElement.ByName("ConfigurationTextBlock"));
00303             Verify.AreEqual(expectedConfiguration.ToString(), configurationTextBlock.DocumentText);
00304
00305             // Verify panes are actually being shown correctly
00306             ElementCache.Clear();
00307             UIObject paneContent1 = TryFindElement.ByName("Content1");
00308             UIObject paneContent2 = TryFindElement.ByName("Content2");
00309
00310             if (mode != ViewMode.Pane2Only)
00311             {
00312                 Verify.IsNotNull(paneContent1, "Expected to find pane1");
00313                 Log.Comment("Content 1 dimensions: " + paneContent1.BoundingRectangle.ToString());
00314             }
00315
00316             if (mode != ViewMode.Pane1Only)
00317             {
00318                 Verify.IsNotNull(paneContent2, "Expected to find pane2");
00319                 Log.Comment("Content 2 dimensions: " + paneContent2.BoundingRectangle.ToString());
00320             }
00321
00322             if (mode == ViewMode.Pane2Only)
00323             {
00324                 Verify.IsNull(paneContent1, "Expected not to find pane1");
00325             }
00326
00327             if (mode == ViewMode.Pane1Only)
00328             {
00329                 Verify.IsNull(paneContent2, "Expected not to find pane2");
00330             }
00331
00332             switch (mode)
00333             {
00334                 case ViewMode.LeftRight:
00335                 case ViewMode.RightLeft:
00336                     Verify.AreEqual(paneContent1.BoundingRectangle.Top, paneContent2.BoundingRectangle.Top, "Verify panes are horizontally aligned");
00337                     if (mode == ViewMode.LeftRight) Verify.IsGreaterThanOrEqual(paneContent2.BoundingRectangle.Left, paneContent1.BoundingRectangle.Right, "Verify left/right pane placement");
00338                     else Verify.IsGreaterThanOrEqual(paneContent1.BoundingRectangle.Left, paneContent2.BoundingRectangle.Right, "Verify right/left pane placement");
00339                     break;
00340
00341                 case ViewMode.TopBottom:
00342                 case ViewMode.BottomTop:
00343                     Verify.AreEqual(paneContent1.BoundingRectangle.Left, paneContent2.BoundingRectangle.Left, "Verify panes are vertically aligned");
00344                     if (mode == ViewMode.TopBottom) Verify.IsGreaterThanOrEqual(paneContent2.BoundingRectangle.Top, paneContent1.BoundingRectangle.Bottom, "Verify top/bottom pane placement");
00345                     else Verify.IsGreaterThanOrEqual(paneContent1.BoundingRectangle.Top, paneContent2.BoundingRectangle.Bottom, "Verify bottom/top pane placement");
00346                     break;
00347             }
00348         }
00349
00350         private void VerifyPaneSize(int paneIndex, double width, double height)
00351         {
00352             if (width > 0)
00353             {
00354                 VerifyIsPrettyClose((int)width, GetInt("WidthText" + paneIndex), "Verify pane" + paneIndex + " width");
00355             }
00356             if (height > 0)
00357             {
00358                 VerifyIsPrettyClose((int)height, GetInt("HeightText" + paneIndex), "Verify pane" + paneIndex + " height");
00359             }
00360         }
00361
00362         private void VerifyPaneSpacing(double spacing)
00363         {
00364             VerifyIsPrettyClose((int)spacing, GetInt("SpacingTextBox" ), "Verify spacing");
00365         }
00366
00367         private void VerifyIsPrettyClose(int a, int b, string info)
00368         {
00369             // Due to MITA only reporting whole numbers, and some rounding on phone builds, just make sure widths/heights are pretty close.
00370             Verify.IsTrue(a <= b + 1 && a >= b - 1, info + ": expected " + a + ", actual " + b);
00371         }
00372
00373         private int GetInt(string textBlockName)
00374         {
00375             TextBlock tb = new TextBlock(FindElement.ByName(textBlockName));
00376             Log.Comment("Parsing string '" + tb.DocumentText + "' into an int");
00377             return int.Parse(tb.DocumentText);
00378         }
00379
00380         private void SetControlWidth(ControlWidth width)
00381         {
00382             SetComboBox("WidthComboBox", width.ToString());
00383         }
00384
00385         private void SetControlHeight(ControlHeight height)
00386         {
00387             SetComboBox("HeightComboBox", height.ToString());
00388         }
00389
00390         private void SetWideModeConfiguration(WideModeConfiguration behavior)
00391         {
00392             SetComboBox("WideModeConfigurationComboBox", behavior.ToString());
00393         }
00394
00395         private void SetTallModeConfiguration(TallModeConfiguration behavior)
00396         {
00397             SetComboBox("TallModeConfigurationComboBox", behavior.ToString());
00398         }
00399
00400         private void SetPanePriority(PanePriority priority)
00401         {
00402             SetComboBox("PanePriorityComboBox", priority.ToString());
00403         }
00404
00405         private void SetMinWideModeWidth(double width)
00406         {
00407             Log.Comment("Setting min wide width to " + width);
00408             Edit widthTextBox = new Edit(FindElement.ByName("MinWideModeWidthTextBox"));
00409             widthTextBox.SetValue(width.ToString());
00410             Wait.ForIdle();
00411         }
00412
00413         private void SetMinTallModeHeight(double height)
00414         {
00415             Log.Comment("Setting min tall height to " + height);
00416             Edit heightTextBox = new Edit(FindElement.ByName("MinTallModeHeightTextBox"));
00417             heightTextBox.SetValue(height.ToString());
00418             Wait.ForIdle();
00419         }
00420
00421         private void SetComboBox(string comboBoxName, string item)
00422         {
00423             Log.Comment("Setting '" + comboBoxName + "' to '" + item + "'");
00424             ComboBox comboBox = new ComboBox(FindElement.ByName(comboBoxName));
00425             comboBox.SelectItemByName(item);
00426             Wait.ForIdle();
00427         }
00428
00429         private void SetLength(int pane, double value, string type)
00430         {
00431             Log.Comment("Setting pane " + pane + " length to " + value + ", " + type.ToString());
00432
00433             Edit valueTextBox = new Edit(FindElement.ByName("Pane" + pane + "LengthTextBox"));
00434             valueTextBox.SetValue(value.ToString());
00435
00436             SetComboBox("Pane" + pane + "LengthComboBox", type);
00437
00438             Wait.ForIdle();
00439         }
00440     }
00441 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RoutedEventTraits< RoutedEventType::PointerCaptureLost > Member List

This is the complete list of members for RoutedEventTraits< RoutedEventType::PointerCaptureLost >, including all inherited members.
Event() RoutedEventTraits< RoutedEventType::PointerCaptureLost > [inline, static]
Generated on Sun Dec 1 2024 20:53:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

GroupedListViewBaseGroupItem Member List

This is the complete list of members for GroupedListViewBaseGroupItem, including all inherited members.
GroupedListViewBaseGroupItem() | GroupedListViewBaseGroupItem | [inline]
GroupedListViewBaseGroupItem(string name) | GroupedListViewBaseGroupItem | [inline]
Items | GroupedListViewBaseGroupItem |
Name | GroupedListViewBaseGroupItem |
Generated on Sun Dec 1 2024 20:54:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ExtendedSelector Member List

This is the complete list of members for ExtendedSelector, including all inherited members.
CanSelect(winrt::IndexPath const &index) | SelectorBase | [protected, virtual]
Clear() | SelectorBase | [virtual]
DeselectWithAnchorPreservation(int index) | SelectorBase |
ExtendedSelector() | ExtendedSelector |
GetSelectionModel() | SelectorBase | [inline, protected]
IsSelected(winrt::IndexPath const &index) | SelectorBase | [protected]
OnFocusedAction(winrt::IndexPath const &index, bool ctrl, bool shift) override | ExtendedSelector | [virtual]
OnInteractedAction(winrt::IndexPath const &index, bool ctrl, bool shift) override | ExtendedSelector | [virtual]
SelectAll() | SelectorBase | [virtual]
SelectorBase() | SelectorBase |
SetSelectionModel(winrt::SelectionModel const &selectionModel) | SelectorBase |
~ExtendedSelector() | ExtendedSelector |
~SelectorBase() | SelectorBase |
Generated on Sun Dec 1 2024 20:52:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ExposureEffect Member List

This is the complete list of members for ExposureEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1Exposure) | ExposureEffect |
DECLARE_NAMED_PROPERTY_MAPPING({L"Exposure", D2D1_EXPOSURE_PROP_EXPOSURE_VALUE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT}) | ExposureEffect |
DECLARE_POD_PROPERTY(Exposure, float, 0.0f, value >=-2.0f &&value<=2.0f) | ExposureEffect |
DECLARE_SINGLE_SOURCE(Source) | ExposureEffect |
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | ExposureEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | ExposureEffect | [inline]
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InfoBarClosingEventArgs Member List

This is the complete list of members for InfoBarClosingEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
Cancel() | InfoBarClosingEventArgs |
Cancel(const bool cancel) | InfoBarClosingEventArgs |
CheckThread() | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< InfoBarClosingEventArgs > &&self) noexcept | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
final_release(std::unique_ptr< InfoBarClosingEventArgs > &&self) | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline, static]
GetBase() | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
GetInner() | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
IsOnThread() | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
Reason() | InfoBarClosingEventArgs |
Reason(const winrt::InfoBarCloseReason &reason) | InfoBarClosingEventArgs |
ReferenceTracker(Args &&...args) | ReferenceTracker< InfoBarClosingEventArgs, winrt::implementation::InfoBarClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/DesktopAcrylicBackdrop/DesktopAcrylicBackdrop.h Source File

  • Materials
  • DesktopAcrylicBackdrop

DesktopAcrylicBackdrop.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "winrt/Microsoft.UI.Composition.SystemBackdrops.h"
00006 #include <winrt/windows.system.h>
00007
00008 #include "DesktopAcrylicBackdrop.g.h"
00009
00010 using namespace winrt::Microsoft::UI::Composition;
00011 using namespace winrt::Microsoft::UI::Composition::SystemBackdrops;
00012
00013 class DesktopAcrylicBackdrop :
00014     public ReferenceTracker<DesktopAcrylicBackdrop, winrt::implementation::DesktopAcrylicBackdropT>
00015 {
00016 public:
00017     DesktopAcrylicBackdrop() = default;
00018     virtual ~DesktopAcrylicBackdrop() = default;
00019
00020     void OnTargetConnected(ICompositionSupportsSystemBackdrop connectedTarget, winrt::Microsoft::UI::Xaml::XamlRoot xamlRoot);
00021     void OnTargetDisconnected(ICompositionSupportsSystemBackdrop disconnectedTarget);
00022
00023 private:
00024     class ControllerEntry
00025     {
00026     public:
00027         ControllerEntry(ICompositionSupportsSystemBackdrop target, DesktopAcrylicController controller, SystemBackdropConfiguration configuration);
00028         ~ControllerEntry();
00029
00030         // Block copy and assignment. This class is meant to be constructed in-place in the list.
00031         ControllerEntry(const ControllerEntry& other) = delete;
00032         ControllerEntry& operator=(const ControllerEntry& other) = delete;
00033
00034         ICompositionSupportsSystemBackdrop m_target;
00035         DesktopAcrylicController m_controller;
00036     };
00037
00038     std::vector<std::unique_ptr<ControllerEntry>> m_controllers;
00039 };
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/RepeaterTestHooks.h Source File

  • Repeater

RepeaterTestHooks.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ItemsRepeater.h"
00007 #include "WinEventLogLevels.h"
00008 #include "RepeaterTestHooks.g.h"
00009
00010 class RepeaterTestHooks :
00011     public winrt::implementation::RepeaterTestHooksT<RepeaterTestHooks>
00012 {
00013 public:
00014     winrt::event_token BuildTreeCompletedImpl(winrt::TypedEventHandler<winrt::IInspectable, winrt::IInspectable> const& value); // subscribe
00015     void BuildTreeCompletedImpl(winrt::event_token const& token); // unsubscribe
00016     void NotifyBuildTreeCompletedImpl();
00017
00018     static com_ptr<RepeaterTestHooks> GetGlobalTestHooks()
00019     {
00020         return s_testHooks->get_strong();
00021     }
00022
00023     static winrt::event_token BuildTreeCompleted(winrt::TypedEventHandler<winrt::IInspectable, winrt::IInspectable> const& value); // subscribe
00024     static void BuildTreeCompleted(winrt::event_token const& token); // unsubscribe
00025     static void NotifyBuildTreeCompleted();
00026     static hstring GetLayoutId(winrt::IInspectable const& layout);
00027     static void SetLayoutId(winrt::IInspectable const& layout, const hstring& id);
00028
00029     static int GetElementFactoryElementIndex();
00030     static void SetElementFactoryElementIndex(int index);
00031     static int GetLogItemIndex();
00032     static void SetLogItemIndex(int logItemIndex);
00033
00034 private:
00035     static int s_elementFactoryElementIndex;
00036     static RepeaterTestHooks* s_testHooks;
00037     static void EnsureHooks();
00038     winrt::event<winrt::TypedEventHandler<winrt::IInspectable, winrt::IInspectable>> m_buildTreeCompleted;
00039 };
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: dll/XamlMetadataProvider.cpp Source File

  • dll

XamlMetadataProvider.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "XamlMetadataProvider.h"
00007 #include "XamlMetadataProviderGenerated.h"
00008 #include "XamlType.h"
00009 #include "MUXControlsFactory.h"
00010
00011 std::recursive_mutex XamlMetadataProvider::s_typeEntriesMutex{};
00012
00013 /*static */
00014 void XamlMetadataProvider::Initialize()
00015 {
00016     MUXControlsFactory::EnsureInitialized();
00017 }
00018
00019 /*static */
00020 void XamlMetadataProvider::ClearTypes()
00021 {
00022     std::lock_guard<std::recursive_mutex> lock(s_typeEntriesMutex);
00023
00024     ClearTypeProperties();
00025
00026     for (auto& entry : c_typeEntries)
00027     {
00028         entry.xamlType = nullptr;
00029     }
00030 }
00031
00032 /* static */
00033 winrt::IXamlType XamlMetadataProvider::LookupXamlType(
00034     const wstring_view& typeName)
00035 {
00036     // Only typenames with a matching known namespace prefix, or those without
00037     // a namespace at all, are going to be found inside our type table.
00038     bool hasKnownNamespacePrefix = false;
00039     for (auto& knownNamespacePrefix : c_knownNamespacePrefixes)
00040     {
00041         if (typeName.starts_with(knownNamespacePrefix))
00042         {
00043             hasKnownNamespacePrefix = true;
00044             break;
00045         }
00046     }
00047     if (!hasKnownNamespacePrefix && typeName.find(L'.') == std::wstring::npos)
00048     {
00049         hasKnownNamespacePrefix = true;
00050     }
00051
00052     if (hasKnownNamespacePrefix)
00053     {
00054         for (auto& entry : c_typeEntries)
00055         {
00056             if (typeName == entry.typeName)
00057             {
00058                 std::lock_guard<std::recursive_mutex> lock(s_typeEntriesMutex);
00059
00060                 if (!entry.xamlType)
00061                 {
00062                     entry.xamlType = entry.createXamlTypeCallback();
00063                 }
00064                 return entry.xamlType;
00065             }
00066         }
00067     }
00068
00069     return nullptr;
00070 }
00071
00072 winrt::IXamlType XamlMetadataProvider::GetXamlType(winrt::TypeName const& type)
00073 {
00074     return LookupXamlType(type.Name);
00075 }
00076
00077 winrt::IXamlType XamlMetadataProvider::GetXamlType(winrt::hstring const& fullName)
00078 {
00079     return LookupXamlType(fullName);
00080 }
00081
00082 winrt::com_array<winrt::XmlnsDefinition> XamlMetadataProvider::GetXmlnsDefinitions()
00083 {
00084     return {};
00085 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewExternalTornOutTabsDroppingEventArgs Member List

This is the complete list of members for TabViewExternalTornOutTabsDroppingEventArgs, including all inherited members.
AllowDrop() const | TabViewExternalTornOutTabsDroppingEventArgs | [inline]
AllowDrop(bool value) | TabViewExternalTornOutTabsDroppingEventArgs | [inline]
DropIndex() const | TabViewExternalTornOutTabsDroppingEventArgs | [inline]
Items() const | TabViewExternalTornOutTabsDroppingEventArgs | [inline]
m_items | TabViewExternalTornOutTabsDroppingEventArgs | [private]
m_tabs | TabViewExternalTornOutTabsDroppingEventArgs | [private]
Tabs() const | TabViewExternalTornOutTabsDroppingEventArgs | [inline]
TabViewExternalTornOutTabsDroppingEventArgs(winrt::IInspectable const &item, winrt::UIElement const &tab, int dropIndex) | TabViewExternalTornOutTabsDroppingEventArgs |
Generated on Sun Dec 1 2024 20:53:14 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/RepeaterFocusTests.cs Source File

  • Repeater
  • APITests

RepeaterFocusTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using MUXControlsTestApp.Utilities;
00006 using System.Collections.ObjectModel;
00007 using System.Linq;
00008 using System.Threading;
00009 using Microsoft.UI.Xaml;
00010 using Microsoft.UI.Xaml.Controls;
00011 using Microsoft.UI.Xaml.Controls.Primitives;
00012 using Microsoft.UI.Xaml.Input;
00013 using Microsoft.UI.Xaml.Markup;
00014 using Microsoft.UI.Xaml.Media;
00015 using System;
00016
00017 using WEX.TestExecution;
00018 using WEX.TestExecution.Markup;
00019 using WEX.Logging.Interop;
00020
00021 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests
00022 {
00023     [TestClass]
00024     public class RepeaterFocusTests : ApiTestBase
00025     {
00026         [TestMethod]
00027         [TestProperty("Ignore", "True")] // TODO 33633693: RepeaterFocusTests.ValidateTabNavigation fails on pipeline
00028         public void ValidateTabNavigation()
00029         {
00030             ItemsRepeater repeater = null;
00031             ScrollViewer scrollViewer = null;
00032             var data = new ObservableCollection<string>(Enumerable.Range(0, 50).Select(i => "Item #" + i));
00033             var viewChangedEvent = new AutoResetEvent(false);
00034
00035             RunOnUIThread.Execute(() =>
00036             {
00037                 var itemTemplate = (DataTemplate)XamlReader.Load(
00038                         @"<DataTemplate  xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00039                             <Button Content='{Binding}' Height='100' />
00040                         </DataTemplate>");
00041
00042                 var elementFactory = new RecyclingElementFactory()
00043                 {
00044                     RecyclePool = new RecyclePool(),
00045                     Templates =
00046                     {
00047                         { "itemTemplate", itemTemplate },
00048                     }
00049                 };
00050
00051                 Content = CreateAndInitializeRepeater
00052                 (
00053                    data,
00054                    new StackLayout(),
00055                    elementFactory,
00056                    ref repeater,
00057                    ref scrollViewer
00058                 );
00059
00060                 scrollViewer.ViewChanged += (s, e) =>
00061                 {
00062                     if (!e.IsIntermediate)
00063                     {
00064                         viewChangedEvent.Set();
00065                     }
00066                 };
00067
00068                 repeater.TabFocusNavigation = KeyboardNavigationMode.Local;
00069                 Content.UpdateLayout();
00070                 ValidateTabNavigationOrder(repeater);
00071             });
00072
00073             IdleSynchronizer.Wait();
00074
00075             RunOnUIThread.Execute(() =>
00076             {
00077                 // Move window - disconnected
00078                 scrollViewer.ChangeView(null, 2000, null, true);
00079             });
00080
00081             Verify.IsTrue(viewChangedEvent.WaitOne(DefaultWaitTimeInMS), "Waiting for final ViewChanged event.");
00082             IdleSynchronizer.Wait();
00083
00084             RunOnUIThread.Execute(() =>
00085             {
00086                 ValidateTabNavigationOrder(repeater);
00087
00088                 // Delete a couple of elements and validate we
00089                 // ignore unrealized elements.
00090                 // First visible element is expected to be index 20.
00091                 while (data.Count > 21) { data.RemoveAt(21); }
00092
00093                 repeater.UpdateLayout();
00094                 ValidateTabNavigationOrder(repeater);
00095             });
00096         }
00097
00098         private static void ValidateTabNavigationOrder(ItemsRepeater repeater)
00099         {
00100             var expectedSequence = GetRealizedRange(repeater);
00101
00102             expectedSequence.Last().Focus(FocusState.Keyboard);
00103             Log.Comment("\n\nStart point: " + expectedSequence.Last().Content);
00104
00105             Log.Comment("Validating forward tab navigation...");
00106
00107             FindNextElementOptions options = new FindNextElementOptions {
00108                 SearchRoot = repeater.XamlRoot.Content
00109             };
00110
00111             foreach(var expectedElement in expectedSequence)
00112             {
00113                 var actualElement = FocusManager.FindNextElement(FocusNavigationDirection.Next, options);
00114                 var actualElementAsbutton = FocusManager.FindNextElement(FocusNavigationDirection.Next, options) as Button;
00115                 var actualElementAsToggleButton = FocusManager.FindNextElement(FocusNavigationDirection.Next, options) as ToggleButton;
00116
00117                 string content = actualElementAsbutton != null ? (string)actualElementAsbutton.Content : (string)actualElementAsToggleButton.Content;
00118                 // We need to ignore the toggle theme button, so lets set its tabstop to false and get next element.
00119                 if (content == "Toggle theme")
00120                 {
00121                     actualElementAsbutton.IsTabStop = false;
00122                     actualElement = FocusManager.FindNextElement(FocusNavigationDirection.Next, options);
00123                 }
00124                 actualElementAsbutton = FocusManager.FindNextElement(FocusNavigationDirection.Next, options) as Button;
00125                 actualElementAsToggleButton = FocusManager.FindNextElement(FocusNavigationDirection.Next, options) as ToggleButton;
00126
00127                 content = actualElementAsbutton != null ? (string)actualElementAsbutton.Content : (string)actualElementAsToggleButton.Content;
00128                 // We need to ignore the lab dimensions button, so lets set its tabstop to false and get next element.
00129                 if (content== "Render innerframe in lab dimensions")
00130                 {
00131                     actualElementAsToggleButton.IsTabStop = false;
00132                     actualElement = FocusManager.FindNextElement(FocusNavigationDirection.Next, options);
00133                 }
00134                 Log.Comment("Expected: " + expectedElement.Content);
00135                 Log.Comment("Actual: " + content);
00136                 Verify.AreEqual(expectedElement, actualElement);
00137                 expectedElement.Focus(FocusState.Keyboard);
00138             }
00139
00140             Log.Comment("Validating backward tab navigation...");
00141
00142             foreach (var expectedElement in expectedSequence.Reverse().Skip(1))
00143             {
00144                 var actualElement = (Button)FocusManager.FindNextElement(FocusNavigationDirection.Previous, options);
00145                 Log.Comment("Expected: " + expectedElement.Content);
00146                 Log.Comment("Actual: " + actualElement.Content);
00147                 Verify.AreEqual(expectedElement, actualElement);
00148                 expectedElement.Focus(FocusState.Keyboard);
00149             }
00150         }
00151
00152         private static Button[] GetRealizedRange(ItemsRepeater repeater)
00153         {
00154             return Enumerable.Range(0, VisualTreeHelper.GetChildrenCount(repeater))
00155                 .Select(i => (Button)VisualTreeHelper.GetChild(repeater, i))
00156                 .Where(e => repeater.GetElementIndex(e) >= 0)
00157                 .OrderBy(e => repeater.GetElementIndex(e))
00158                 .ToArray();
00159         }
00160
00161         private static ItemsRepeaterScrollHost CreateAndInitializeRepeater(
00162            object itemsSource,
00163            VirtualizingLayout layout,
00164            ElementFactory elementFactory,
00165            ref ItemsRepeater repeater,
00166            ref ScrollViewer scrollViewer)
00167         {
00168             repeater = new ItemsRepeater()
00169             {
00170                 ItemsSource = itemsSource,
00171                 Layout = layout,
00172                 ItemTemplate = elementFactory,
00173                 VerticalCacheLength = 0
00174             };
00175
00176             scrollViewer = new ScrollViewer()
00177             {
00178                 Content = repeater
00179             };
00180
00181             return new ItemsRepeaterScrollHost()
00182             {
00183                 Width = 400,
00184                 Height = 400,
00185                 ScrollViewer = scrollViewer
00186             };
00187         }
00188     }
00189 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBadge/InfoBadge.h Source File

  • InfoBadge

InfoBadge.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "InfoBadgeTemplateSettings.h"
00010
00011 #include "InfoBadge.g.h"
00012 #include "InfoBadge.properties.h"
00013
00014 class InfoBadge :
00015     public ReferenceTracker<InfoBadge, winrt::implementation::InfoBadgeT>,
00016     public InfoBadgeProperties
00017 {
00018
00019 public:
00020     InfoBadge();
00021     ~InfoBadge() {}
00022
00023     // IFrameworkElement
00024     void OnApplyTemplate();
00025     winrt::Size MeasureOverride(winrt::Size const& availableSize);
00026
00027     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00028 private:
00029     void OnDisplayKindPropertiesChanged();
00030     void OnSizeChanged(const winrt::IInspectable&, const winrt::SizeChangedEventArgs& args);
00031 };
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TabView/APITests/TabViewTests.cs Source File

  • TabView
  • APITests

TabViewTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using MUXControlsTestApp.Utilities;
00005 using System;
00006 using System.Threading;
00007 using Microsoft.UI.Xaml;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Xaml.Markup;
00010 using Microsoft.UI.Xaml.Media;
00011 using Common;
00012 using Microsoft.UI.Xaml.Controls;
00013 using System.Collections.Generic;
00014 using Microsoft.UI.Xaml.Automation.Peers;
00015 using Microsoft.UI.Xaml.Automation;
00016 using Microsoft.UI.Xaml.Automation.Provider;
00017 using System.Collections.ObjectModel;
00018 using Microsoft.UI.Xaml.Controls.Primitives;
00019 using Microsoft.UI.Xaml.Controls;
00020
00021 using WEX.TestExecution;
00022 using WEX.TestExecution.Markup;
00023 using WEX.Logging.Interop;
00024
00025 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00026 {
00027
00028     [TestClass]
00029     [TestProperty("Ignore", "True")] // Disabled due to #40853867
00030     public class TabViewTests : ApiTestBase
00031     {
00032         [TestMethod]
00033         public void VerifyCompactTabWidthVisualStates_ItemsMode()
00034         {
00035             VerifyCompactTabWidthVisualStates();
00036         }
00037
00038         [TestMethod]
00039         public void VerifyCompactTabWidthVisualStates_ItemsSourceMode()
00040         {
00041             VerifyCompactTabWidthVisualStates(isItemsSourceMode: true);
00042         }
00043
00044         private void VerifyCompactTabWidthVisualStates(bool isItemsSourceMode = false)
00045         {
00046             TabView tabView = null;
00047             RunOnUIThread.Execute(() =>
00048             {
00049                 tabView = new TabView();
00050                 SetupTabViewItems();
00051
00052                 Log.Comment("Set TabWidthMode to compact");
00053                 tabView.TabWidthMode = TabViewWidthMode.Compact;
00054
00055                 Log.Comment("Select a tab. In TabWidthMode compact, a selected tab will not be in compact state. We verify that behavior in this test");
00056                 tabView.SelectedIndex = 0;
00057
00058                 Content = tabView;
00059             });
00060
00061             IdleSynchronizer.Wait();
00062
00063             RunOnUIThread.Execute(() =>
00064             {
00065                 Log.Comment("Verify a selected tab exists");
00066                 VerifySelectedItem("Tab 0");
00067
00068                 Log.Comment("Verify the created TabView displays every tab in compact mode");
00069                 VerifyTabWidthVisualStates(tabView, tabView.TabItems, true);
00070
00071                 Log.Comment("Verify that adding a new item creates a tab in compact mode");
00072                 AddItem("Tab 3");
00073                 Content.UpdateLayout();
00074
00075                 VerifyTabWidthVisualStates(tabView, new List<object>() { tabView.TabItems[tabView.TabItems.Count - 1] }, true);
00076
00077                 Log.Comment("Change the TabWidthMode to non compact and verify that every tab is no longer in compact mode");
00078                 tabView.TabWidthMode = TabViewWidthMode.Equal;
00079                 Content.UpdateLayout();
00080
00081                 VerifyTabWidthVisualStates(tabView, tabView.TabItems, false);
00082
00083                 Log.Comment("Change the TabWidthMode to compact and verify that every tab is now in compact mode");
00084                 tabView.TabWidthMode = TabViewWidthMode.Compact;
00085                 Content.UpdateLayout();
00086
00087                 VerifyTabWidthVisualStates(tabView, tabView.TabItems, true);
00088             });
00089
00090             void SetupTabViewItems()
00091             {
00092                 if (isItemsSourceMode)
00093                 {
00094                     var tabItemsSource = new ObservableCollection<string>() { "Tab 0", "Tab 1", "Tab 2" };
00095                     tabView.TabItemsSource = tabItemsSource;
00096                 }
00097                 else
00098                 {
00099                     tabView.TabItems.Add(CreateTabViewItem("Tab 0", Symbol.Add));
00100                     tabView.TabItems.Add(CreateTabViewItem("Tab 1", Symbol.AddFriend));
00101                     tabView.TabItems.Add(CreateTabViewItem("Tab 2"));
00102                 }
00103             }
00104
00105             void VerifySelectedItem(string expectedHeader)
00106             {
00107                 object selectedItemHeader = isItemsSourceMode
00108                     ? tabView.SelectedItem
00109                     : (tabView.SelectedItem as TabViewItem).Header;
00110
00111                 Verify.AreEqual(expectedHeader, selectedItemHeader);
00112             }
00113
00114             void AddItem(string header)
00115             {
00116                 if (isItemsSourceMode)
00117                 {
00118                     ((ObservableCollection<string>)tabView.TabItemsSource).Add(header);
00119                 }
00120                 else
00121                 {
00122                     tabView.TabItems.Add(CreateTabViewItem(header));
00123                 }
00124             }
00125         }
00126
00127         [TestMethod]
00128         public void VerifyTabViewUIABehavior()
00129         {
00130             RunOnUIThread.Execute(() =>
00131             {
00132                 TabView tabView = new TabView();
00133                 Content = tabView;
00134
00135                 tabView.TabItems.Add(CreateTabViewItem("Item 0", Symbol.Add));
00136                 tabView.TabItems.Add(CreateTabViewItem("Item 1", Symbol.AddFriend));
00137                 tabView.TabItems.Add(CreateTabViewItem("Item 2"));
00138
00139                 Content.UpdateLayout();
00140
00141                 var tabViewPeer = FrameworkElementAutomationPeer.CreatePeerForElement(tabView);
00142                 Verify.IsNotNull(tabViewPeer);
00143                 var tabViewSelectionPattern = tabViewPeer.GetPattern(PatternInterface.Selection);
00144                 Verify.IsNotNull(tabViewSelectionPattern);
00145                 var selectionProvider = tabViewSelectionPattern as ISelectionProvider;
00146                 // Tab controls must require selection
00147                 Verify.IsTrue(selectionProvider.IsSelectionRequired);
00148             });
00149         }
00150
00151         [TestMethod]
00152         public void VerifyTabViewItemUIABehavior()
00153         {
00154             TabView tabView = null;
00155
00156             TabViewItem tvi0 = null;
00157             TabViewItem tvi1 = null;
00158             TabViewItem tvi2 = null;
00159             RunOnUIThread.Execute(() =>
00160             {
00161                 tabView = new TabView();
00162                 Content = tabView;
00163
00164                 tvi0 = CreateTabViewItem("Item 0", Symbol.Add);
00165                 tvi1 = CreateTabViewItem("Item 1", Symbol.AddFriend);
00166                 tvi2 = CreateTabViewItem("Item 2");
00167
00168                 tabView.TabItems.Add(tvi0);
00169                 tabView.TabItems.Add(tvi1);
00170                 tabView.TabItems.Add(tvi2);
00171
00172                 tabView.SelectedIndex = 0;
00173                 tabView.SelectedItem = tvi0;
00174                 Content.UpdateLayout();
00175             });
00176
00177             IdleSynchronizer.Wait();
00178
00179             RunOnUIThread.Execute(() =>
00180             {
00181                 var selectionItemProvider = GetProviderFromTVI(tvi0);
00182                 Verify.IsTrue(selectionItemProvider.IsSelected, "Item should be selected");
00183
00184                 selectionItemProvider = GetProviderFromTVI(tvi1);
00185                 Verify.IsFalse(selectionItemProvider.IsSelected, "Item should not be selected");
00186
00187                 Log.Comment("Change selection through automationpeer");
00188                 selectionItemProvider.Select();
00189                 Verify.IsTrue(selectionItemProvider.IsSelected, "Item should have been selected");
00190
00191                 selectionItemProvider = GetProviderFromTVI(tvi0);
00192                 Verify.IsFalse(selectionItemProvider.IsSelected, "Item should not be selected anymore");
00193
00194                 Verify.IsNotNull(selectionItemProvider.SelectionContainer);
00195             });
00196
00197             static ISelectionItemProvider GetProviderFromTVI(TabViewItem item)
00198             {
00199                 var peer = FrameworkElementAutomationPeer.CreatePeerForElement(item);
00200                 var provider = peer.GetPattern(PatternInterface.SelectionItem)
00201                                 as ISelectionItemProvider;
00202                 Verify.IsNotNull(provider);
00203                 return provider;
00204             }
00205         }
00206
00207         [TestMethod]
00208         public void VerifyTabViewWithoutTabsDoesNotCrash()
00209         {
00210             RunOnUIThread.Execute(() =>
00211             {
00212                 TabView tabView = new TabView();
00213                 Content = tabView;
00214
00215                 // Creating a TabView without tabs should not crash the app.
00216                 Content.UpdateLayout();
00217
00218                 var tabItemsSource = new ObservableCollection<string>() { "Tab 1", "Tab 2" };
00219                 tabView.TabItemsSource = tabItemsSource;
00220
00221                 // Clearing the ItemsSource should not crash the app.
00222                 Log.Comment("Clear the specified tab items source");
00223                 tabItemsSource.Clear();
00224             });
00225         }
00226
00227         [TestMethod]
00228         public void TabViewItemBackgroundTest()
00229         {
00230             TabView tabView = null;
00231             TabViewItem tvi1 = null;
00232             TabViewItem tvi2 = null;
00233             RunOnUIThread.Execute(() =>
00234             {
00235                 tabView = new TabView();
00236
00237                 tvi1 = CreateTabViewItem("Tab1", Symbol.Home);
00238                 tvi2 = CreateTabViewItem("Tab2", Symbol.Document);
00239                 tabView.TabItems.Add(tvi1);
00240                 tabView.TabItems.Add(tvi2);
00241
00242                 Content = tabView;
00243                 Content.UpdateLayout();
00244             });
00245
00246             IdleSynchronizer.Wait();
00247
00248             RunOnUIThread.Execute(() =>
00249             {
00250                 var headerBackground = Application.Current.Resources["TabViewItemHeaderBackground"] as Brush;
00251                 var tabContainer = tvi2.FindVisualChildByName("TabContainer") as Grid;
00252
00253                 // Verify that the TabViewItem we use for Background API testing is unselected.
00254                 Verify.IsFalse(tvi2.IsSelected, "TabViewItem should have been unselected");
00255
00256                 Log.Comment("Verify that the default background brush is set by the [TabViewItemHeaderBackground] theme resource.");
00257                 Verify.IsTrue(ReferenceEquals(tvi2.Background, headerBackground), "TabViewItem's default header background brush should have been [TabViewItemHeaderBackground]");
00258                 Verify.IsTrue(ReferenceEquals(tabContainer.Background, headerBackground), "TabViewItem's [TabContainer] background brush should have been [TabViewItemHeaderBackground]");
00259
00260                 var testBrush = new SolidColorBrush(Colors.Blue);
00261                 Verify.IsFalse(ReferenceEquals(testBrush, headerBackground), "Our test brush should have not been [TabViewItemHeaderBackground]");
00262
00263                 Log.Comment("Set the TabViewItem's background using the Background API.");
00264                 tvi2.Background = testBrush;
00265
00266                 // Verify that the background brushes have been updated correctly.
00267                 Verify.IsTrue(ReferenceEquals(tvi2.Background, testBrush), "TabViewItem's Background brush should have been [testBrush]");
00268                 Verify.IsTrue(ReferenceEquals(tabContainer.Background, testBrush), "TabViewItem's [TabContainer] background brush should have been [testBrush]");
00269             });
00270         }
00271
00272         [TestMethod]
00273         [TestProperty("Ignore", "True")] // Bug 39523845: [WinUI3]TabViewTests.TabViewItemHeaderTest fails in WinUI 3
00274         public void TabViewItemHeaderTest()
00275         {
00276             TabViewItem tvi0 = null;
00277             TabViewItem tvi1 = null;
00278             TabViewItem tvi2 = null;
00279             RunOnUIThread.Execute(() =>
00280             {
00281                 var tabView = new TabView();
00282
00283                 tvi0 = CreateTabViewItem(null, "tab0Content");
00284                 tvi1 = CreateTabViewItem("", "tab1Content");
00285                 tvi2 = CreateTabViewItem("tab2", "tab2Content");
00286
00287                 tabView.TabItems.Add(tvi0);
00288                 tabView.TabItems.Add(tvi1);
00289                 tabView.TabItems.Add(tvi2);
00290
00291                 Content = tabView;
00292                 Content.UpdateLayout();
00293             });
00294
00295             IdleSynchronizer.Wait();
00296
00297             RunOnUIThread.Execute(() =>
00298             {
00299                 // Verify headers
00300                 var headerContentPresenter1 = VisualTreeUtils.FindVisualChildByName(tvi0, "ContentPresenter") as ContentPresenter;
00301                 var headerContentPresenter2 = VisualTreeUtils.FindVisualChildByName(tvi1, "ContentPresenter") as ContentPresenter;
00302                 var headerContentPresenter3 = VisualTreeUtils.FindVisualChildByName(tvi2, "ContentPresenter") as ContentPresenter;
00303
00304                 Verify.AreEqual(null, headerContentPresenter1.Content, "tvi0's header should have been [null]");
00305                 Verify.AreEqual("", headerContentPresenter2.Content, "tvi1's header should have been the empty string");
00306                 Verify.AreEqual("tab2", headerContentPresenter3.Content, "tvi2's header should have been \"tab2\"");
00307
00308                 // Verify ToolTips
00309                 var toolTip0 = ToolTipService.GetToolTip(tvi0) as ToolTip;
00310                 var toolTip1 = ToolTipService.GetToolTip(tvi1) as ToolTip;
00311                 var toolTip2 = ToolTipService.GetToolTip(tvi2) as ToolTip;
00312
00313                 bool testCondition = toolTip0.IsEnabled == false && toolTip0.Content == null;
00314                 Verify.IsTrue(testCondition, "tvi0's ToolTip should have been disabled with [null] as content");
00315
00316                 testCondition = toolTip1.IsEnabled == false && toolTip1.Content == null;
00317                 Verify.IsTrue(testCondition, "tvi1's ToolTip should have been disabled with [null] as content");
00318
00319                 testCondition = toolTip2.IsEnabled == true && toolTip2.Content is string s && s == "tab2";
00320                 Verify.IsTrue(testCondition, "tvi2's ToolTip should have been enabled with \"tab2\" as content");
00321             });
00322         }
00323
00324         [TestMethod]
00325         public void TabViewItemForegroundTest()
00326         {
00327             TabView tabView = null;
00328             TabViewItem tvi1 = null;
00329             TabViewItem tvi2 = null;
00330             RunOnUIThread.Execute(() =>
00331             {
00332                 tabView = new TabView();
00333
00334                 tvi1 = CreateTabViewItem("Tab1", Symbol.Home);
00335                 tvi2 = CreateTabViewItem("Tab2", Symbol.Document);
00336
00337                 tabView.TabItems.Add(tvi1);
00338                 tabView.TabItems.Add(tvi2);
00339
00340                 Content = tabView;
00341                 Content.UpdateLayout();
00342             });
00343
00344             IdleSynchronizer.Wait();
00345
00346             RunOnUIThread.Execute(() =>
00347             {
00348                 var iconForeground = Application.Current.Resources["TabViewItemIconForeground"] as Brush;
00349                 var headerForeground = Application.Current.Resources["TabViewItemHeaderForeground"] as Brush;
00350
00351                 var iconControl = tvi2.FindVisualChildByName("IconControl") as ContentControl;
00352                 var headerPresenter = tvi2.FindVisualChildByName("ContentPresenter") as ContentPresenter;
00353
00354                 // Verify that the TabViewItem we use for Foreground API testing is unselected.
00355                 Verify.IsFalse(tvi2.IsSelected, "TabViewItem should have been unselected");
00356
00357                 Log.Comment("Verify that theme resource brushes are used when no foreground was set using the Foreground API.");
00358                 Verify.IsTrue(ReferenceEquals(iconControl.Foreground, iconForeground), "TabViewItem's icon foreground brush should have been [TabViewItemIconForeground]");
00359                 Verify.IsTrue(ReferenceEquals(headerPresenter.Foreground, headerForeground), "TabViewItem's header foreground brush should have been [TabViewItemHeaderForeground]");
00360
00361                 var testBrush = new SolidColorBrush(Colors.Blue);
00362                 Verify.IsFalse(ReferenceEquals(testBrush, iconForeground), "Our test brush should have not been [TabViewItemIconForeground]");
00363                 Verify.IsFalse(ReferenceEquals(testBrush, headerForeground), "Our test brush should have not been [TabViewItemHeaderForeground]");
00364
00365                 Log.Comment("Set the TabViewItem's foreground (icon + header) using the Foreground API.");
00366                 tvi2.Foreground = testBrush;
00367
00368                 Verify.IsTrue(ReferenceEquals(tvi2.Foreground, testBrush), "TabViewItem's Foreground brush should have been [testBrush]");
00369
00370                 // Verify that the icon and header foreground brushes have been updated correctly.
00371                 Verify.IsTrue(ReferenceEquals(iconControl.Foreground, testBrush), "TabViewItem's icon foreground brush should have been [testBrush]");
00372                 Verify.IsTrue(ReferenceEquals(headerPresenter.Foreground, testBrush), "TabViewItem's header foreground brush should have been [testBrush]");
00373
00374                 Log.Comment("Unset TabViewItem.Foreground to apply the theme resource brushes again.");
00375                 tvi2.ClearValue(Control.ForegroundProperty);
00376
00377                 Verify.IsTrue(ReferenceEquals(iconControl.Foreground, iconForeground), "TabViewItem's icon foreground brush should have been [TabViewItemIconForeground]");
00378                 Verify.IsTrue(ReferenceEquals(headerPresenter.Foreground, headerForeground), "TabViewItem's header foreground brush should have been [TabViewItemHeaderForeground]");
00379             });
00380         }
00381
00382         private static void VerifyTabWidthVisualStates(TabView tabView, IList<object> items, bool isCompact)
00383         {
00384             var listView = VisualTreeUtils.FindVisualChildByName(tabView, "TabListView") as TabViewListView;
00385
00386             foreach (var item in items)
00387             {
00388                 var tabItem = item is TabViewItem
00389                     ? (TabViewItem)item
00390                     : listView.ContainerFromItem(item) as TabViewItem;
00391
00392                 var rootGrid = VisualTreeHelper.GetChild(tabItem, 0) as FrameworkElement;
00393
00394                 foreach (var group in VisualStateManager.GetVisualStateGroups(rootGrid))
00395                 {
00396                     if (group.Name == "TabWidthModes")
00397                     {
00398                         if (tabItem.IsSelected || !isCompact)
00399                         {
00400                             Verify.AreEqual("StandardWidth", group.CurrentState.Name, "Verify that this tab item is rendering in standard width");
00401                         }
00402                         else
00403                         {
00404                             Verify.AreEqual("Compact", group.CurrentState.Name, "Verify that this tab item is rendering in compact width");
00405                         }
00406                     }
00407                 }
00408             }
00409         }
00410
00411         private static TabViewItem CreateTabViewItem(string name, Symbol icon, bool closable = true, bool enabled = true)
00412         {
00413             var tabViewItem = new TabViewItem();
00414
00415             tabViewItem.Header = name;
00416             tabViewItem.IconSource = new Microsoft.UI.Xaml.Controls.SymbolIconSource() { Symbol = icon };
00417             tabViewItem.IsClosable = closable;
00418             tabViewItem.IsEnabled = enabled;
00419
00420             return tabViewItem;
00421         }
00422
00423         private static TabViewItem CreateTabViewItem(string name, object content, bool closable = true, bool enabled = true)
00424         {
00425             var tabViewItem = new TabViewItem();
00426
00427             tabViewItem.Header = name;
00428             tabViewItem.Content = content;
00429             tabViewItem.IsClosable = closable;
00430             tabViewItem.IsEnabled = enabled;
00431
00432             return tabViewItem;
00433         }
00434
00435         private static TabViewItem CreateTabViewItem(string name, bool closable = true, bool enabled = true)
00436         {
00437             var tabViewItem = new TabViewItem();
00438
00439             tabViewItem.Header = name;
00440             tabViewItem.IsClosable = closable;
00441             tabViewItem.IsEnabled = enabled;
00442
00443             return tabViewItem;
00444         }
00445     }
00446 }
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CalendarViewPage Member List

This is the complete list of members for CalendarViewPage, including all inherited members.
_defaultBrushColors | CalendarViewPage | [private]
CalendarView_CalendarViewDayItemChanging(CalendarView sender, CalendarViewDayItemChangingEventArgs args) | CalendarViewPage | [inline, private]
CalendarViewPage() | CalendarViewPage | [inline]
FirstDayOfWeek_SelectionChanged(object sender, SelectionChangedEventArgs e) | CalendarViewPage | [inline, private]
GetBrushColor(Brush brush) | CalendarViewPage | [inline, private]
GetBrushColor_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
GetBrushColorString(Brush brush) | CalendarViewPage | [inline, private]
GetBrushFromIndex() | CalendarViewPage | [inline, private]
GetCalendarItemBorderThickness_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
GetCalendarSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
GetDayItemFontSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
GetFirstOfMonthLabelFontSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
GetFirstOfYearDecadeLabelFontSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
GetMonthYearItemFontSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
GetNumberOfWeeksInView_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
GetSolidColorBrush() | CalendarViewPage | [inline, private]
HasDensityBars_Checked(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
HasDensityBars_Unchecked(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
IsSundayBlackedOut_Checked(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
IsSundayBlackedOut_Unchecked(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
IsTodayBlackedOut_Checked(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
IsTodayBlackedOut_Unchecked(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
Language_SelectionChanged(object sender, SelectionChangedEventArgs e) | CalendarViewPage | [inline, private]
ResetCalendarItemCornerRadius_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SelectionMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | CalendarViewPage | [inline, private]
SetBackgrounds(CalendarView cv, Brush brush) | CalendarViewPage | [inline, private]
SetBlackout(CalendarViewDayItem dayItem) | CalendarViewPage | [inline, private]
SetBlackouts(CalendarView cv) | CalendarViewPage | [inline, private]
SetBrushColor_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetCalendarItemBorderThickness_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetCalendarItemCornerRadius_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetCalendarSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetDayItemFontSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetDayItemMargin_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetDensityColors(CalendarViewDayItem dayItem) | CalendarViewPage | [inline, private]
SetDensityColors(CalendarView cv) | CalendarViewPage | [inline, private]
SetFirstOfMonthLabelFontSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetFirstOfMonthLabelMargin_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetFirstOfYearDecadeLabelFontSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetFirstOfYearDecadeLabelMargin_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetMonthYearItemFontSize_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetMonthYearItemMargin_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
SetNumberOfWeeksInView_Click(object sender, RoutedEventArgs e) | CalendarViewPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/NestedLayoutSamples/ItemsViewWithDataPage.xaml.cs Source File

  • Repeater
  • TestUI
  • Samples
  • NestedLayoutSamples

ItemsViewWithDataPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using MUXControlsTestApp.Utils;
00005 using MUXControlsTestApp.Samples.Model;
00006 using System;
00007 using System.Collections.ObjectModel;
00008 using System.Linq;
00009 using Microsoft.UI.Xaml;
00010 using Microsoft.UI.Xaml.Controls;
00011 using Microsoft.UI.Xaml.Controls.Primitives;
00012 using Microsoft.UI.Xaml.Navigation;
00013 using Microsoft.UI.Private.Controls;
00014 using MUXControlsTestApp.Utilities;
00015
00016 namespace MUXControlsTestApp.Samples
00017 {
00018     public sealed partial class ItemsViewWithDataPage : Page
00019     {
00020         private string _lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam laoreet erat vel massa rutrum, eget mollis massa vulputate. Vivamus semper augue leo, eget faucibus nulla mattis nec. Donec scelerisque lacus at dui ultricies, eget auctor ipsum placerat. Integer aliquet libero sed nisi eleifend, nec rutrum arcu lacinia. Sed a sem et ante gravida congue sit amet ut augue. Donec quis pellentesque urna, non finibus metus. Proin sed ornare tellus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam laoreet erat vel massa rutrum, eget mollis massa vulputate. Vivamus semper augue leo, eget faucibus nulla mattis nec. Donec scelerisque lacus at dui ultricies, eget auctor ipsum placerat. Integer aliquet libero sed nisi eleifend, nec rutrum arcu lacinia. Sed a sem et ante gravida congue sit amet ut augue. Donec quis pellentesque urna, non finibus metus. Proin sed ornare tellus.";
00021
00022         TestObservableCollection<Recipe> _flatData;
00023         TestObservableCollection<RecipeGroup> _oneLevelNestedData;
00024         TestObservableCollection<Year> _twoLevelNestedData;
00025         PageInfo _pageInfo;
00026
00027         public ItemsViewWithDataPage()
00028         {
00029             this.InitializeComponent();
00030
00031             goBackButton.Click += delegate
00032             {
00033                 Frame.GoBack();
00034             };
00035
00036             //this.LayoutUpdated += OnLayoutUpdated;
00037             //CompositionTarget.Rendering += OnRendering;
00038             lineAlignmentComboBox.SelectionChanged += LineAlignmentComboBox_SelectionChanged;
00039             itemsStretchComboBox.SelectionChanged += ItemsStretchComboBox_SelectionChanged;
00040
00041             scrollButton.Click += OnScrollButtonClicked;
00042         }
00043
00044         protected override void OnNavigatedTo(NavigationEventArgs e)
00045         {
00046             _pageInfo = e.Parameter as PageInfo;
00047             if (_pageInfo != null)
00048             {
00049                 int levels = _pageInfo.NumLevels;
00050                 var level0Layout = _pageInfo.Level0Layout;
00051                 var level1Layout = _pageInfo.Level1Layout;
00052                 var level2Layout = _pageInfo.Level2Layout;
00053                 var rnd = new Random(12345);
00054
00055                 if (_pageInfo.Orientation == Orientation.Horizontal)
00056                 {
00057                     scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
00058                     scrollViewer.VerticalScrollMode = ScrollMode.Disabled;
00059                     scrollViewer.HorizontalScrollMode = ScrollMode.Enabled;
00060                     scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
00061                 }
00062
00063                 var generator = _pageInfo.Orientation == Orientation.Vertical ?
00064                     new RecipeElementFactory(
00065                         (DataTemplate)Resources["RecipeTemplate"],
00066                         (DataTemplate)Resources["RecipeGroupTemplate"],
00067                         (DataTemplate)Resources["YearTemplate"], _pageInfo) :
00068                     new RecipeElementFactory(
00069                         (DataTemplate)Resources["RecipeTemplateHorizontal"],
00070                         (DataTemplate)Resources["RecipeGroupTemplateHorizontal"],
00071                         (DataTemplate)Resources["YearTemplateHorizontal"], _pageInfo);
00072
00073                 generator.RecyclePool = new RecyclePool();
00074                 rootRepeater.ItemTemplate = generator;
00075                 rootRepeater.Layout = _pageInfo.Level0Layout;
00076                 RepeaterTestHooks.SetLayoutId(rootRepeater.Layout, "Root");
00077
00078                 switch (levels)
00079                 {
00080                     case 0:
00081                         _flatData = new TestObservableCollection<Recipe>(Enumerable.Range(0, 300).Select(k =>
00082                             new Recipe
00083                             {
00084                                 ImageUri = new Uri(string.Format("ms-appx:///Images/recipe{0}.png", k % 8 + 1)),
00085                                 Description = k + " - " + _lorem.Substring(0, level0Layout is StackLayout ? rnd.Next(200, 650) : level0Layout is UniformGridLayout ? 0 : rnd.Next(10, 30))
00086                                 //Description = k.ToString()
00087                             }));
00088                         rootRepeater.ItemsSource = _flatData;
00089                         break;
00090                     case 1:
00091                         _oneLevelNestedData = new TestObservableCollection<RecipeGroup>(Enumerable.Range(0, 10).Select(j =>
00092                             new RecipeGroup(
00093                                 Enumerable.Range(0, rnd.Next(5, 16)).Select(k =>
00094                                          new Recipe
00095                                          {
00096                                              ImageUri = new Uri(string.Format("ms-appx:///Images/recipe{0}.png", k % 8 + 1)),
00097                                              Description = string.Format("{0}.{1} - {2}", j, k, _lorem.Substring(0, level1Layout is StackLayout ? rnd.Next(200, 650) : level1Layout is UniformGridLayout ? 0 : rnd.Next(10, 30)))
00098                                          }))
00099                             {
00100                                 Name = "Group #" + j
00101                             }));
00102                         rootRepeater.ItemsSource = _oneLevelNestedData;
00103                         break;
00104                     case 2:
00105                         _twoLevelNestedData = new TestObservableCollection<Year>(Enumerable.Range(0, 3).Select(i => new Year(
00106                             new TestObservableCollection<RecipeGroup>(Enumerable.Range(0, rnd.Next(2, 5)).Select(j => new RecipeGroup(
00107                                 Enumerable.Range(0, rnd.Next(5, 16)).Select(k =>
00108                                          new Recipe
00109                                          {
00110                                              ImageUri = new Uri(string.Format("ms-appx:///Images/recipe{0}.png", k % 8 + 1)),
00111                                              Description = string.Format("{0}.{1}.{2} - {3}", 2016 - i, j, k, _lorem.Substring(0, level2Layout is StackLayout ? rnd.Next(200, 650) : level2Layout is UniformGridLayout ? 0 : rnd.Next(10, 30)))
00112                                          }))
00113                             {
00114                                 Name = "Group #" + j
00115                             })))
00116                         {
00117                             Value = 2016 - i
00118                         }));
00119                         rootRepeater.ItemsSource = _twoLevelNestedData;
00120                         break;
00121                 }
00122             }
00123         }
00124
00125         private void OnResizeMeButtonClick(object sender, RoutedEventArgs e)
00126         {
00127             var button = (Button)sender;
00128             button.Height = 5000 - button.Height;
00129         }
00130
00131         private void OnMaintainViewportSliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
00132         {
00133             tracker.HorizontalAnchorRatio = maintainViewportSlider.Value;
00134         }
00135
00136         private void OnRowSpacingSliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
00137         {
00138             if (_pageInfo.Level0Layout != null)
00139             {
00140                 LayoutHelper.SetMinRowSpacing(_pageInfo.Level0Layout, rowSpacingSlider.Value); ;
00141             }
00142
00143             if (_pageInfo.Level1Layout != null)
00144             {
00145                 LayoutHelper.SetMinRowSpacing(_pageInfo.Level1Layout, rowSpacingSlider.Value);
00146             }
00147
00148             if (_pageInfo.Level2Layout != null)
00149             {
00150                 LayoutHelper.SetMinRowSpacing(_pageInfo.Level2Layout, rowSpacingSlider.Value);
00151             }
00152         }
00153         private void OnMaxRowsOrColumnsSliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
00154         {
00155             if (_pageInfo.Level0Layout != null)
00156             {
00157                 LayoutHelper.SetMaxRowsOrColumns(_pageInfo.Level0Layout, (int)(maxRowsOrColumnsSlider.Value));
00158             }
00159         }
00160
00161         private void OnColumnSpacingSliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
00162         {
00163             if (_pageInfo.Level0Layout != null)
00164             {
00165                 LayoutHelper.SetMinColumnSpacing(_pageInfo.Level0Layout, colSpacingSlider.Value);
00166             }
00167
00168             if (_pageInfo.Level1Layout != null)
00169             {
00170                 LayoutHelper.SetMinColumnSpacing(_pageInfo.Level1Layout, colSpacingSlider.Value);
00171             }
00172
00173             if (_pageInfo.Level2Layout != null)
00174             {
00175                 LayoutHelper.SetMinColumnSpacing(_pageInfo.Level2Layout, colSpacingSlider.Value);
00176             }
00177         }
00178
00179         private void LineAlignmentComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00180         {
00181             var alignment = (lineAlignmentComboBox.SelectedItem as ComboBoxItem).Content.ToString();
00182             if (_pageInfo.Level0Layout != null)
00183             {
00184                 LayoutHelper.SetLineAlignment(_pageInfo.Level0Layout, alignment);
00185             }
00186
00187             if (_pageInfo.Level1Layout != null)
00188             {
00189                 LayoutHelper.SetLineAlignment(_pageInfo.Level1Layout, alignment);
00190             }
00191
00192             if (_pageInfo.Level2Layout != null)
00193             {
00194                 LayoutHelper.SetLineAlignment(_pageInfo.Level2Layout, alignment);
00195             }
00196         }
00197
00198         private void ItemsStretchComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00199         {
00200             var alignment = (itemsStretchComboBox.SelectedItem as ComboBoxItem).Content.ToString();
00201             if (_pageInfo.Level0Layout != null)
00202             {
00203                 LayoutHelper.SetItemsStretch(_pageInfo.Level0Layout, alignment);
00204             }
00205
00206             if (_pageInfo.Level1Layout != null)
00207             {
00208                 LayoutHelper.SetItemsStretch(_pageInfo.Level1Layout, alignment);
00209             }
00210
00211             if (_pageInfo.Level2Layout != null)
00212             {
00213                 LayoutHelper.SetItemsStretch(_pageInfo.Level2Layout, alignment);
00214             }
00215         }
00216
00217         private void OnLayoutUpdated(object sender, object e)
00218         {
00219             //Logger.WriteLine("---------------------- layout updated ---------------------");
00220         }
00221
00222         private void OnRendering(object sender, object e)
00223         {
00224             //Logger.WriteLine("----------------------- on rendering ----------------------");
00225         }
00226
00227         private void OnScrollButtonClicked(object sender, RoutedEventArgs e)
00228         {
00229             var indexPath = scrollIndex.Text.Split('.').Select(i => int.Parse(i)).ToArray();
00230             var repeater = rootRepeater;
00231
00232             for (int i = 0; i < indexPath.Length; ++i)
00233             {
00234                 var container = repeater.GetOrCreateElement(indexPath[i]);
00235
00236                 if (i < indexPath.Length - 1)
00237                 {
00238                     repeater = container.FindElementOfTypeInSubtree<ItemsRepeater>();
00239                 }
00240                 else
00241                 {
00242                     container.StartBringIntoView(new BringIntoViewOptions()
00243                     {
00244                         HorizontalAlignmentRatio = 0.5,
00245                         VerticalAlignmentRatio = maintainViewportSlider.Value,
00246                         HorizontalOffset = 0.0,
00247                         VerticalOffset = scrollOffset.Value,
00248                         AnimationDesired = scrollAnimate.IsChecked.GetValueOrDefault()
00249                     });
00250                 }
00251             }
00252
00253         }
00254
00255         private void OnRecipeDeleted(object sender, RoutedEventArgs e)
00256         {
00257             if (_flatData != null)
00258             {
00259                 // walk up the tree to find the container and repeater.
00260                 var container = (FrameworkElement)sender;
00261                 while (!(container.Parent is ItemsRepeater))
00262                 {
00263                     container = (FrameworkElement)container.Parent;
00264                 }
00265
00266                 ItemsRepeater repeater = (ItemsRepeater)container.Parent;
00267                 int index = repeater.GetElementIndex(container);
00268                 _flatData.RemoveAt(index);
00269             }
00270         }
00271
00272         private void OnRecipeInserted(object sender, RoutedEventArgs e)
00273         {
00274             if (_flatData != null)
00275             {
00276                 // walk up the tree to find the container and repeater.
00277                 var container = (FrameworkElement)sender;
00278                 while (!(container.Parent is ItemsRepeater))
00279                 {
00280                     container = (FrameworkElement)container.Parent;
00281                 }
00282
00283                 ItemsRepeater repeater = (ItemsRepeater)container.Parent;
00284                 int index = repeater.GetElementIndex(container) + 1;
00285                 _flatData.Insert(index, new Recipe()
00286                 {
00287                     ImageUri = new Uri("ms-appx:///Images/recipe0.png"),
00288                     Description = "added recipe",
00289                 });
00290             }
00291         }
00292     }
00293 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressRing/ProgressRingAutomationPeer.h Source File

  • ProgressRing

ProgressRingAutomationPeer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ProgressRing.h"
00007 #include "ProgressRingAutomationPeer.g.h"
00008
00009 class ProgressRingAutomationPeer :
00010     public ReferenceTracker<ProgressRingAutomationPeer, winrt::implementation::ProgressRingAutomationPeerT>
00011 {
00012
00013 public:
00014     ProgressRingAutomationPeer(winrt::ProgressRing const& owner);
00015
00016     winrt::IInspectable GetPatternCore(winrt::PatternInterface const& patternInterface);
00017     winrt::hstring GetClassNameCore();
00018     winrt::hstring GetNameCore();
00019     winrt::AutomationControlType GetAutomationControlTypeCore();
00020     winrt::hstring GetLocalizedControlTypeCore();
00021
00022     // IRangeValueProvider
00023     bool IsReadOnly() { return true; }
00024     double Minimum();
00025     double Maximum();
00026     double Value();
00027     double SmallChange();
00028     double LargeChange();
00029     void SetValue(double value);
00030
00031 private:
00032     com_ptr<ProgressRing> GetImpl();
00033 };
00034
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommandBarFlyoutTests Member List

This is the complete list of members for CommandBarFlyoutTests, including all inherited members.
CloseFlyout(CommandBarFlyout flyout) | CommandBarFlyoutTests | [inline, private]
CommandBarSizingOptions enum name | CommandBarFlyoutTests | [private]
OpenFlyout(CommandBarFlyout flyout, Button flyoutTarget) | CommandBarFlyoutTests | [inline, private]
SetupCommandBarFlyoutTest(out CommandBarFlyout flyout, out Button flyoutTarget) | CommandBarFlyoutTests | [inline, private]
VerifyCommandBarSizing(CommandBarSizingOptions sizingOptions) | CommandBarFlyoutTests | [inline, private]
VerifyCommandBarSizingPrimaryItemsLarger() | CommandBarFlyoutTests | [inline]
VerifyCommandBarSizingSecondaryItemsLarger() | CommandBarFlyoutTests | [inline]
VerifyCommandBarSizingSecondaryItemsMaxHeight() | CommandBarFlyoutTests | [inline]
VerifyCommandBarSizingSecondaryItemsMaxWidth() | CommandBarFlyoutTests | [inline]
VerifyDisconnectedFlyoutCommandBar() | CommandBarFlyoutTests | [inline]
VerifyFlyoutCommandsArePropagatedToTheCommandBar() | CommandBarFlyoutTests | [inline]
VerifyFlyoutDefaultPropertyValues() | CommandBarFlyoutTests | [inline]
VerifyPrimaryCommandLabelsAffectLayout() | CommandBarFlyoutTests | [inline]
VerifyPrimaryCommandsCanOverflowToSecondaryItemsControl() | CommandBarFlyoutTests | [inline]
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/UniformGridLayout.properties.cpp Source File

  • Generated

UniformGridLayout.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "UniformGridLayout.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(UniformGridLayout)
00012 }
00013
00014 #include "UniformGridLayout.g.cpp"
00015
00016 GlobalDependencyProperty UniformGridLayoutProperties::s_ItemsJustificationProperty{ nullptr };
00017 GlobalDependencyProperty UniformGridLayoutProperties::s_ItemsStretchProperty{ nullptr };
00018 GlobalDependencyProperty UniformGridLayoutProperties::s_MaximumRowsOrColumnsProperty{ nullptr };
00019 GlobalDependencyProperty UniformGridLayoutProperties::s_MinColumnSpacingProperty{ nullptr };
00020 GlobalDependencyProperty UniformGridLayoutProperties::s_MinItemHeightProperty{ nullptr };
00021 GlobalDependencyProperty UniformGridLayoutProperties::s_MinItemWidthProperty{ nullptr };
00022 GlobalDependencyProperty UniformGridLayoutProperties::s_MinRowSpacingProperty{ nullptr };
00023 GlobalDependencyProperty UniformGridLayoutProperties::s_OrientationProperty{ nullptr };
00024
00025 UniformGridLayoutProperties::UniformGridLayoutProperties()
00026 {
00027     EnsureProperties();
00028 }
00029
00030 void UniformGridLayoutProperties::EnsureProperties()
00031 {
00032     if (!s_ItemsJustificationProperty)
00033     {
00034         s_ItemsJustificationProperty =
00035             InitializeDependencyProperty(
00036                 L"ItemsJustification",
00037                 winrt::name_of<winrt::UniformGridLayoutItemsJustification>(),
00038                 winrt::name_of<winrt::UniformGridLayout>(),
00039                 false /* isAttached */,
00040                 ValueHelper<winrt::UniformGridLayoutItemsJustification>::BoxValueIfNecessary(winrt::UniformGridLayoutItemsJustification::Start),
00041                 winrt::PropertyChangedCallback(&OnItemsJustificationPropertyChanged));
00042     }
00043     if (!s_ItemsStretchProperty)
00044     {
00045         s_ItemsStretchProperty =
00046             InitializeDependencyProperty(
00047                 L"ItemsStretch",
00048                 winrt::name_of<winrt::UniformGridLayoutItemsStretch>(),
00049                 winrt::name_of<winrt::UniformGridLayout>(),
00050                 false /* isAttached */,
00051                 ValueHelper<winrt::UniformGridLayoutItemsStretch>::BoxValueIfNecessary(winrt::UniformGridLayoutItemsStretch::None),
00052                 winrt::PropertyChangedCallback(&OnItemsStretchPropertyChanged));
00053     }
00054     if (!s_MaximumRowsOrColumnsProperty)
00055     {
00056         s_MaximumRowsOrColumnsProperty =
00057             InitializeDependencyProperty(
00058                 L"MaximumRowsOrColumns",
00059                 winrt::name_of<int>(),
00060                 winrt::name_of<winrt::UniformGridLayout>(),
00061                 false /* isAttached */,
00062                 ValueHelper<int>::BoxValueIfNecessary(-1),
00063                 winrt::PropertyChangedCallback(&OnMaximumRowsOrColumnsPropertyChanged));
00064     }
00065     if (!s_MinColumnSpacingProperty)
00066     {
00067         s_MinColumnSpacingProperty =
00068             InitializeDependencyProperty(
00069                 L"MinColumnSpacing",
00070                 winrt::name_of<double>(),
00071                 winrt::name_of<winrt::UniformGridLayout>(),
00072                 false /* isAttached */,
00073                 ValueHelper<double>::BoxValueIfNecessary(0.0),
00074                 winrt::PropertyChangedCallback(&OnMinColumnSpacingPropertyChanged));
00075     }
00076     if (!s_MinItemHeightProperty)
00077     {
00078         s_MinItemHeightProperty =
00079             InitializeDependencyProperty(
00080                 L"MinItemHeight",
00081                 winrt::name_of<double>(),
00082                 winrt::name_of<winrt::UniformGridLayout>(),
00083                 false /* isAttached */,
00084                 ValueHelper<double>::BoxValueIfNecessary(0.0),
00085                 winrt::PropertyChangedCallback(&OnMinItemHeightPropertyChanged));
00086     }
00087     if (!s_MinItemWidthProperty)
00088     {
00089         s_MinItemWidthProperty =
00090             InitializeDependencyProperty(
00091                 L"MinItemWidth",
00092                 winrt::name_of<double>(),
00093                 winrt::name_of<winrt::UniformGridLayout>(),
00094                 false /* isAttached */,
00095                 ValueHelper<double>::BoxValueIfNecessary(0.0),
00096                 winrt::PropertyChangedCallback(&OnMinItemWidthPropertyChanged));
00097     }
00098     if (!s_MinRowSpacingProperty)
00099     {
00100         s_MinRowSpacingProperty =
00101             InitializeDependencyProperty(
00102                 L"MinRowSpacing",
00103                 winrt::name_of<double>(),
00104                 winrt::name_of<winrt::UniformGridLayout>(),
00105                 false /* isAttached */,
00106                 ValueHelper<double>::BoxValueIfNecessary(0.0),
00107                 winrt::PropertyChangedCallback(&OnMinRowSpacingPropertyChanged));
00108     }
00109     if (!s_OrientationProperty)
00110     {
00111         s_OrientationProperty =
00112             InitializeDependencyProperty(
00113                 L"Orientation",
00114                 winrt::name_of<winrt::Orientation>(),
00115                 winrt::name_of<winrt::UniformGridLayout>(),
00116                 false /* isAttached */,
00117                 ValueHelper<winrt::Orientation>::BoxValueIfNecessary(winrt::Orientation::Horizontal),
00118                 winrt::PropertyChangedCallback(&OnOrientationPropertyChanged));
00119     }
00120 }
00121
00122 void UniformGridLayoutProperties::ClearProperties()
00123 {
00124     s_ItemsJustificationProperty = nullptr;
00125     s_ItemsStretchProperty = nullptr;
00126     s_MaximumRowsOrColumnsProperty = nullptr;
00127     s_MinColumnSpacingProperty = nullptr;
00128     s_MinItemHeightProperty = nullptr;
00129     s_MinItemWidthProperty = nullptr;
00130     s_MinRowSpacingProperty = nullptr;
00131     s_OrientationProperty = nullptr;
00132 }
00133
00134 void UniformGridLayoutProperties::OnItemsJustificationPropertyChanged(
00135     winrt::DependencyObject const& sender,
00136     winrt::DependencyPropertyChangedEventArgs const& args)
00137 {
00138     auto owner = sender.as<winrt::UniformGridLayout>();
00139     winrt::get_self<UniformGridLayout>(owner)->OnPropertyChanged(args);
00140 }
00141
00142 void UniformGridLayoutProperties::OnItemsStretchPropertyChanged(
00143     winrt::DependencyObject const& sender,
00144     winrt::DependencyPropertyChangedEventArgs const& args)
00145 {
00146     auto owner = sender.as<winrt::UniformGridLayout>();
00147     winrt::get_self<UniformGridLayout>(owner)->OnPropertyChanged(args);
00148 }
00149
00150 void UniformGridLayoutProperties::OnMaximumRowsOrColumnsPropertyChanged(
00151     winrt::DependencyObject const& sender,
00152     winrt::DependencyPropertyChangedEventArgs const& args)
00153 {
00154     auto owner = sender.as<winrt::UniformGridLayout>();
00155     winrt::get_self<UniformGridLayout>(owner)->OnPropertyChanged(args);
00156 }
00157
00158 void UniformGridLayoutProperties::OnMinColumnSpacingPropertyChanged(
00159     winrt::DependencyObject const& sender,
00160     winrt::DependencyPropertyChangedEventArgs const& args)
00161 {
00162     auto owner = sender.as<winrt::UniformGridLayout>();
00163     winrt::get_self<UniformGridLayout>(owner)->OnPropertyChanged(args);
00164 }
00165
00166 void UniformGridLayoutProperties::OnMinItemHeightPropertyChanged(
00167     winrt::DependencyObject const& sender,
00168     winrt::DependencyPropertyChangedEventArgs const& args)
00169 {
00170     auto owner = sender.as<winrt::UniformGridLayout>();
00171     winrt::get_self<UniformGridLayout>(owner)->OnPropertyChanged(args);
00172 }
00173
00174 void UniformGridLayoutProperties::OnMinItemWidthPropertyChanged(
00175     winrt::DependencyObject const& sender,
00176     winrt::DependencyPropertyChangedEventArgs const& args)
00177 {
00178     auto owner = sender.as<winrt::UniformGridLayout>();
00179     winrt::get_self<UniformGridLayout>(owner)->OnPropertyChanged(args);
00180 }
00181
00182 void UniformGridLayoutProperties::OnMinRowSpacingPropertyChanged(
00183     winrt::DependencyObject const& sender,
00184     winrt::DependencyPropertyChangedEventArgs const& args)
00185 {
00186     auto owner = sender.as<winrt::UniformGridLayout>();
00187     winrt::get_self<UniformGridLayout>(owner)->OnPropertyChanged(args);
00188 }
00189
00190 void UniformGridLayoutProperties::OnOrientationPropertyChanged(
00191     winrt::DependencyObject const& sender,
00192     winrt::DependencyPropertyChangedEventArgs const& args)
00193 {
00194     auto owner = sender.as<winrt::UniformGridLayout>();
00195     winrt::get_self<UniformGridLayout>(owner)->OnPropertyChanged(args);
00196 }
00197
00198 void UniformGridLayoutProperties::ItemsJustification(winrt::UniformGridLayoutItemsJustification const& value)
00199 {
00200     [[gsl::suppress(con)]]
00201     {
00202     static_cast<UniformGridLayout*>(this)->SetValue(s_ItemsJustificationProperty, ValueHelper<winrt::UniformGridLayoutItemsJustification>::BoxValueIfNecessary(value));
00203     }
00204 }
00205
00206 winrt::UniformGridLayoutItemsJustification UniformGridLayoutProperties::ItemsJustification()
00207 {
00208     return ValueHelper<winrt::UniformGridLayoutItemsJustification>::CastOrUnbox(static_cast<UniformGridLayout*>(this)->GetValue(s_ItemsJustificationProperty));
00209 }
00210
00211 void UniformGridLayoutProperties::ItemsStretch(winrt::UniformGridLayoutItemsStretch const& value)
00212 {
00213     [[gsl::suppress(con)]]
00214     {
00215     static_cast<UniformGridLayout*>(this)->SetValue(s_ItemsStretchProperty, ValueHelper<winrt::UniformGridLayoutItemsStretch>::BoxValueIfNecessary(value));
00216     }
00217 }
00218
00219 winrt::UniformGridLayoutItemsStretch UniformGridLayoutProperties::ItemsStretch()
00220 {
00221     return ValueHelper<winrt::UniformGridLayoutItemsStretch>::CastOrUnbox(static_cast<UniformGridLayout*>(this)->GetValue(s_ItemsStretchProperty));
00222 }
00223
00224 void UniformGridLayoutProperties::MaximumRowsOrColumns(int value)
00225 {
00226     [[gsl::suppress(con)]]
00227     {
00228     static_cast<UniformGridLayout*>(this)->SetValue(s_MaximumRowsOrColumnsProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00229     }
00230 }
00231
00232 int UniformGridLayoutProperties::MaximumRowsOrColumns()
00233 {
00234     return ValueHelper<int>::CastOrUnbox(static_cast<UniformGridLayout*>(this)->GetValue(s_MaximumRowsOrColumnsProperty));
00235 }
00236
00237 void UniformGridLayoutProperties::MinColumnSpacing(double value)
00238 {
00239     [[gsl::suppress(con)]]
00240     {
00241     static_cast<UniformGridLayout*>(this)->SetValue(s_MinColumnSpacingProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00242     }
00243 }
00244
00245 double UniformGridLayoutProperties::MinColumnSpacing()
00246 {
00247     return ValueHelper<double>::CastOrUnbox(static_cast<UniformGridLayout*>(this)->GetValue(s_MinColumnSpacingProperty));
00248 }
00249
00250 void UniformGridLayoutProperties::MinItemHeight(double value)
00251 {
00252     [[gsl::suppress(con)]]
00253     {
00254     static_cast<UniformGridLayout*>(this)->SetValue(s_MinItemHeightProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00255     }
00256 }
00257
00258 double UniformGridLayoutProperties::MinItemHeight()
00259 {
00260     return ValueHelper<double>::CastOrUnbox(static_cast<UniformGridLayout*>(this)->GetValue(s_MinItemHeightProperty));
00261 }
00262
00263 void UniformGridLayoutProperties::MinItemWidth(double value)
00264 {
00265     [[gsl::suppress(con)]]
00266     {
00267     static_cast<UniformGridLayout*>(this)->SetValue(s_MinItemWidthProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00268     }
00269 }
00270
00271 double UniformGridLayoutProperties::MinItemWidth()
00272 {
00273     return ValueHelper<double>::CastOrUnbox(static_cast<UniformGridLayout*>(this)->GetValue(s_MinItemWidthProperty));
00274 }
00275
00276 void UniformGridLayoutProperties::MinRowSpacing(double value)
00277 {
00278     [[gsl::suppress(con)]]
00279     {
00280     static_cast<UniformGridLayout*>(this)->SetValue(s_MinRowSpacingProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00281     }
00282 }
00283
00284 double UniformGridLayoutProperties::MinRowSpacing()
00285 {
00286     return ValueHelper<double>::CastOrUnbox(static_cast<UniformGridLayout*>(this)->GetValue(s_MinRowSpacingProperty));
00287 }
00288
00289 void UniformGridLayoutProperties::Orientation(winrt::Orientation const& value)
00290 {
00291     [[gsl::suppress(con)]]
00292     {
00293     static_cast<UniformGridLayout*>(this)->SetValue(s_OrientationProperty, ValueHelper<winrt::Orientation>::BoxValueIfNecessary(value));
00294     }
00295 }
00296
00297 winrt::Orientation UniformGridLayoutProperties::Orientation()
00298 {
00299     return ValueHelper<winrt::Orientation>::CastOrUnbox(static_cast<UniformGridLayout*>(this)->GetValue(s_OrientationProperty));
00300 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewCollapsedEventArgs.h Source File

  • TreeView

TreeViewCollapsedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "TreeViewNode.h"
00006
00007 #include "TreeViewCollapsedEventArgs.g.h"
00008
00009 class TreeViewCollapsedEventArgs :
00010     public ReferenceTracker<TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable>
00011 {
00012 public:
00013     winrt::TreeViewNode Node();
00014     void Node(const winrt::TreeViewNode& value);
00015     winrt::IInspectable Item();
00016
00017 private:
00018     tracker_ref<winrt::TreeViewNode> m_node{ this };
00019 };
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ProgressBarReTemplatePage Member List

This is the complete list of members for ProgressBarReTemplatePage, including all inherited members.
ChangeValue_Click(object sender, RoutedEventArgs e) | ProgressBarReTemplatePage | [inline]
Indicator_SizeChanged(object sender, SizeChangedEventArgs e) | ProgressBarReTemplatePage | [inline, private]
ProgressBarReTemplatePage() | ProgressBarReTemplatePage | [inline]
ProgressBarReTemplatePage_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) | ProgressBarReTemplatePage | [inline, private]
ProgressBarReTemplatePage_Loaded(object sender, RoutedEventArgs e) | ProgressBarReTemplatePage | [inline, private]
UpdateMinMax_Click(object sender, RoutedEventArgs e) | ProgressBarReTemplatePage | [inline]
UpdatePadding_Click(object sender, RoutedEventArgs e) | ProgressBarReTemplatePage | [inline]
UpdateValue_Click(object sender, RoutedEventArgs e) | ProgressBarReTemplatePage | [inline]
UpdateWidth_Click(object sender, RoutedEventArgs e) | ProgressBarReTemplatePage | [inline]
Generated on Sun Dec 1 2024 20:54:24 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommandBarFlyout/CommandBarFlyoutCommandBar.h Source File

  • CommandBarFlyout

CommandBarFlyoutCommandBar.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "CommandBarFlyoutCommandBar.g.h"
00007 #include "CommandBarFlyoutCommandBar.properties.h"
00008 #include "CommandBarFlyoutTrace.h"
00009
00010 enum class CommandBarFlyoutOpenCloseAnimationKind
00011 {
00012     Opacity,
00013     Clip
00014 };
00015
00016 class CommandBarFlyoutCommandBar :
00017     public ReferenceTracker<CommandBarFlyoutCommandBar, winrt::implementation::CommandBarFlyoutCommandBarT>,
00018     public CommandBarFlyoutCommandBarProperties
00019 {
00020 public:
00021     CommandBarFlyoutCommandBar();
00022     ~CommandBarFlyoutCommandBar();
00023
00024     // IFrameworkElementOverrides
00025     void OnApplyTemplate();
00026
00027     void SetOwningFlyout(winrt::CommandBarFlyout const& owningFlyout);
00028
00029     bool HasOpenAnimation();
00030     CommandBarFlyoutOpenCloseAnimationKind OpenAnimationKind() { return m_openAnimationKind; };
00031     void PlayOpenAnimation();
00032     bool HasCloseAnimation();
00033     bool HasSecondaryOpenCloseAnimations();
00034     void PlayCloseAnimation(const winrt::weak_ref<winrt::CommandBarFlyout>& weakCommandBarFlyout, std::function<void()> onCompleteFunc);
00035
00036     void BindOwningFlyoutPresenterToCornerRadius();
00037
00038     void ClearShadow();
00039     void SetPresenter(winrt::FlyoutPresenter const& presenter);
00040
00041     // IControlOverrides / IControlOverridesHelper
00042     void OnKeyDown(winrt::KeyRoutedEventArgs const& args);
00043
00044     void OnCommandBarElementDependencyPropertyChanged();
00045
00046     bool m_commandBarFlyoutIsOpening{ false };
00047
00048     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00049
00050     void CacheLocalizedStringResources();
00051     void ClearLocalizedStringResourceCache();
00052
00053 private:
00054     void AttachControlEventHandlers();
00055     void AttachItemEventHandlers();
00056     void DetachEventHandlers();
00057
00058     void UpdateFlowsFromAndFlowsTo();
00059     void UpdateUI(bool useTransitions = true, bool isForSizeChange = false);
00060     void UpdateVisualState(bool useTransitions, bool isForSizeChange = false);
00061     void UpdateItemVisualState(winrt::Control const& item, bool isPrimaryItem);
00062     void UpdateTemplateSettings();
00063     void EnsureAutomationSetCountAndPosition();
00064     void EnsureLocalizedControlTypes();
00065     void SetKnownCommandLocalizedControlTypes(winrt::ICommandBarElement const& command);
00066     void PopulateAccessibleControls();
00067
00068     void SetPresenterName(winrt::FlyoutPresenter const& presenter);
00069
00070     void TryConnectSystemBackdrop();
00071
00072     template<class TCommand>
00073     bool HasVisibleLabel(TCommand const& command)
00074     {
00075         return command &&
00076             command.Label().size() > 0 &&
00077             command.Visibility() == winrt::Visibility::Visible &&
00078             command.LabelPosition() == winrt::CommandBarLabelPosition::Default;
00079     };
00080
00081     static bool IsControlFocusable(
00082         winrt::Control const& control,
00083         bool checkTabStop);
00084     static winrt::Control GetFirstTabStopControl(
00085         winrt::IObservableVector<winrt::ICommandBarElement> const& commands);
00086     static winrt::IAsyncOperation<bool> FocusControl(
00087         winrt::Control newFocus,
00088         winrt::Control oldFocus,
00089         winrt::FocusState focusState,
00090         bool updateTabStop);
00091     static winrt::IAsyncOperation<bool> FocusCommand(
00092         winrt::IObservableVector<winrt::ICommandBarElement> commands,
00093         winrt::Control moreButton,
00094         winrt::FocusState focusState,
00095         bool firstCommand,
00096         bool ensureTabStopUniqueness);
00097     static void EnsureTabStopUniqueness(
00098         winrt::IObservableVector<winrt::ICommandBarElement> const& commands,
00099         winrt::Control const& moreButton);
00100
00101     tracker_ref<winrt::FrameworkElement> m_primaryItemsRoot{ this };
00102     tracker_ref<winrt::Popup> m_overflowPopup{ this };
00103     tracker_ref<winrt::FrameworkElement> m_secondaryItemsRoot{ this };
00104     tracker_ref<winrt::ButtonBase> m_moreButton{ this };
00105     weak_ref<winrt::CommandBarFlyout> m_owningFlyout{ nullptr };
00106     winrt::Popup::ActualPlacementChanged_revoker m_overflowPopupActualPlacementChangedRevoker{};
00107     RoutedEventHandler_revoker m_keyDownRevoker{};
00108     winrt::UIElement::PreviewKeyDown_revoker m_secondaryItemsRootPreviewKeyDownRevoker{};
00109     winrt::FrameworkElement::SizeChanged_revoker m_secondaryItemsRootSizeChangedRevoker{};
00110     winrt::FrameworkElement::Loaded_revoker m_firstItemLoadedRevoker{};
00111     std::vector<winrt::FrameworkElement::Loaded_revoker> m_itemLoadedRevokerVector{};
00112     std::vector<winrt::FrameworkElement::SizeChanged_revoker> m_itemSizeChangedRevokerVector{};
00113
00114     // We need to manually connect the end element of the primary items to the start element of the secondary items
00115     // for the purposes of UIA items navigation. To ensure that we only have the current start and end elements registered
00116     // (e.g., if the app adds a new start element to the secondary commands, we want to unregister the previous start element),
00117     // we'll save references to those elements.
00118     tracker_ref<winrt::FrameworkElement> m_currentPrimaryItemsEndElement{ this };
00119     tracker_ref<winrt::FrameworkElement> m_currentSecondaryItemsStartElement{ this };
00120
00121     CommandBarFlyoutOpenCloseAnimationKind m_openAnimationKind{ CommandBarFlyoutOpenCloseAnimationKind::Clip };
00122     weak_ref<winrt::FlyoutPresenter> m_flyoutPresenter{};
00123     tracker_ref<winrt::Storyboard> m_openingStoryboard{ this };
00124     tracker_ref<winrt::Storyboard> m_closingStoryboard{ this };
00125     winrt::Storyboard::Completed_revoker m_openingStoryboardCompletedRevoker{};
00126     winrt::Storyboard::Completed_revoker m_closingStoryboardCompletedCallbackRevoker{};
00127
00128     bool m_secondaryItemsRootSized{ false };
00129
00130     void AttachEventsToSecondaryStoryboards();
00131
00132     winrt::Storyboard::Completed_revoker m_expandedUpToCollapsedStoryboardRevoker{};
00133     winrt::Storyboard::Completed_revoker m_expandedDownToCollapsedStoryboardRevoker{};
00134     winrt::Storyboard::Completed_revoker m_collapsedToExpandedUpStoryboardRevoker{};
00135     winrt::Storyboard::Completed_revoker m_collapsedToExpandedDownStoryboardRevoker{};
00136
00137     winrt::IVector<winrt::Control> m_horizontallyAccessibleControls{ nullptr };
00138     winrt::IVector<winrt::Control> m_verticallyAccessibleControls{ nullptr };
00139
00140     tracker_ref<winrt::FrameworkElement> m_outerOverflowContentRootV2{ this };
00141     tracker_ref<winrt::FrameworkElement> m_primaryItemsSystemBackdropRoot{ this };
00142     tracker_ref<winrt::FrameworkElement> m_overflowPopupSystemBackdropRoot{ this };
00143
00144     // These ContentExternalBackdropLink objects implement the backdrop behind the CommandBarFlyoutCommandBar. We don't
00145     // use the one built into Popup because we need to animate this backdrop using Storyboards in the CBFCB's template.
00146     // The one built into Popup is too high up in the Visual tree to be animated by a custom animation.
00147     winrt::ContentExternalBackdropLink m_backdropLink{ nullptr };
00148     winrt::ContentExternalBackdropLink m_overflowPopupBackdropLink{ nullptr };
00149
00150     // A copy of the value in the DependencyProperty. We need to unregister with this SystemBackdrop when this
00151     // CommandBarFlyoutCommandBar is deleted, but the DP value is already cleared by the time we get to Unloaded or the
00152     // dtor, so we cache a copy for ourselves to use during cleanup. Another possibility is to do cleanup during Closed,
00153     // but the app can release and delete this CommandBarFlyoutCommandBar without ever closing it.
00154     weak_ref<winrt::SystemBackdrop> m_systemBackdrop{ nullptr };
00155
00156     // Bookkeeping for registering and unregistering with the SystemBackdrop. In order to register, we need to have a
00157     // XamlRoot available so we can listen for events like theme changed or high contrast changed. It's possible we get
00158     // a SystemBackdrop object set without being in the tree, in which case there's no XamlRoot so we can't register
00159     // yet. We'll wait for the Loaded event to register.
00160     bool m_registeredWithSystemBackdrop{ false };
00161
00162     // Localized string caches. Looking these up from MRTCore is expensive, so we don't want to put the lookups in a
00163     // loop. Instead, look them up once, cache them, use the cached values, then clear the cache. The values in these
00164     // caches are only valid after CacheLocalizedStringResources and before ClearLocalizedStringResourceCache.
00165     bool m_areLocalizedStringResourcesCached{ false };
00166     winrt::hstring m_localizedCommandBarFlyoutAppBarButtonControlType{};
00167     winrt::hstring m_localizedCommandBarFlyoutAppBarToggleButtonControlType{};
00168 };
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/BringIntoViewOffsetsChange.h Source File

  • ScrollPresenter

BringIntoViewOffsetsChange.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "OffsetsChange.h"
00007
00008 class BringIntoViewOffsetsChange : public OffsetsChange
00009 {
00010 public:
00011     BringIntoViewOffsetsChange(
00012         const ITrackerHandleManager* owner,
00013         double zoomedHorizontalOffset,
00014         double zoomedVerticalOffset,
00015         ScrollPresenterViewKind offsetsKind,
00016         winrt::IInspectable const& options,
00017         winrt::UIElement const& element,
00018         winrt::Rect const& elementRect,
00019         double horizontalAlignmentRatio,
00020         double verticalAlignmentRatio,
00021         double horizontalOffset,
00022         double verticalOffset);
00023     ~BringIntoViewOffsetsChange();
00024
00025     winrt::UIElement Element() const
00026     {
00027         return m_element.get();
00028     }
00029
00030     winrt::Rect ElementRect() const
00031     {
00032         return m_elementRect;
00033     }
00034
00035     double HorizontalAlignmentRatio() const
00036     {
00037         return m_horizontalAlignmentRatio;
00038     }
00039
00040     double VerticalAlignmentRatio() const
00041     {
00042         return m_verticalAlignmentRatio;
00043     }
00044
00045     double HorizontalOffset() const
00046     {
00047         return m_horizontalOffset;
00048     }
00049
00050     double VerticalOffset() const
00051     {
00052         return m_verticalOffset;
00053     }
00054
00055 private:
00056     const ITrackerHandleManager* m_owner;
00057     tracker_ref<winrt::UIElement> m_element{ m_owner };
00058     winrt::Rect m_elementRect;
00059     double m_horizontalAlignmentRatio;
00060     double m_verticalAlignmentRatio;
00061     double m_horizontalOffset;
00062     double m_verticalOffset;
00063 };
00064
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/StaticAssertFalse.h Source File

  • inc

StaticAssertFalse.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 namespace details
00007 {
00008     template<typename >
00009     inline constexpr bool dependent_false_v{ false };
00010 }
00011
00012 // Use this macro in place of static_assert(false,...)
00013 // C++ compiler will always evaluate parse static_assert(false,...),
00014 // raising the assert even if the method calling it is never used.
00015 // Adding a template parameter causes it to only be compiled/assert
00016 // if the method calling it is used
00017 #define static_assert_false(message) \
00018 while(1){ \
00019 struct nested{}; \
00020 static_assert(::details::dependent_false_v<nested>, message); \
00021 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewAutomationPeer.cpp Source File

  • NavigationView

NavigationViewAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "NavigationViewAutomationPeer.h"
00008 #include "NavigationView.h"
00009 #include "NavigationViewItemBase.h"
00010 #include "SharedHelpers.h"
00011 #include "NavigationViewAutomationPeer.properties.cpp"
00012
00013
00014 NavigationViewAutomationPeer::NavigationViewAutomationPeer(winrt::NavigationView const& owner) :
00015     ReferenceTracker(owner)
00016 {
00017 }
00018
00019 winrt::IInspectable NavigationViewAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00020 {
00021     if (patternInterface == winrt::PatternInterface::Selection)
00022     {
00023         return *this;
00024     }
00025
00026     return __super::GetPatternCore(patternInterface);
00027 }
00028
00029 bool NavigationViewAutomationPeer::CanSelectMultiple()
00030 {
00031     return false;
00032 }
00033
00034 bool NavigationViewAutomationPeer::IsSelectionRequired()
00035 {
00036     return false;
00037 }
00038
00039 winrt::com_array<winrt::Microsoft::UI::Xaml::Automation::Provider::IRawElementProviderSimple> NavigationViewAutomationPeer::GetSelection()
00040 {
00041     if (auto nv = Owner().try_as<winrt::NavigationView>())
00042     {
00043         if (auto nvi = winrt::get_self<NavigationView>(nv)->GetSelectedContainer())
00044         {
00045             if (auto peer = winrt::FrameworkElementAutomationPeer::CreatePeerForElement(nvi))
00046             {
00047                 return { ProviderFromPeer(peer) };
00048             }
00049         }
00050     }
00051     return {};
00052 }
00053
00054 void NavigationViewAutomationPeer::RaiseSelectionChangedEvent(winrt::IInspectable const& oldSelection, winrt::IInspectable const& newSelection)
00055 {
00056     if (winrt::AutomationPeer::ListenerExists(winrt::AutomationEvents::SelectionPatternOnInvalidated))
00057     {
00058         if (auto nv = Owner().try_as<winrt::NavigationView>())
00059         {
00060             if (auto nvi = winrt::get_self<NavigationView>(nv)->GetSelectedContainer())
00061             {
00062                 if (auto peer = winrt::FrameworkElementAutomationPeer::CreatePeerForElement(nvi))
00063                 {
00064                     peer.RaiseAutomationEvent(winrt::AutomationEvents::SelectionItemPatternOnElementSelected);
00065                 }
00066             }
00067         }
00068     }
00069 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

BreadcrumbBarItem::BreadcrumbBarItemFactory Member List

This is the complete list of members for BreadcrumbBarItem::BreadcrumbBarItemFactory, including all inherited members.
Create(UIObject element) BreadcrumbBarItem::BreadcrumbBarItemFactory [inline]
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/UniqueIdElementPool.h Source File

  • Repeater

UniqueIdElementPool.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 class ItemsRepeater;
00007
00008 class UniqueIdElementPool final
00009 {
00010 public:
00011     UniqueIdElementPool(ItemsRepeater* owner);
00012
00013     void Add(const winrt::UIElement& element);
00014     winrt::UIElement Remove(int index);
00015     void Clear();
00016
00017     auto begin() const { return m_elementMap.begin(); }
00018     auto end() const { return m_elementMap.end(); }
00019
00020 #ifdef DBG
00021     auto IsEmpty() { return m_elementMap.size() == 0; }
00022 #endif
00023
00024 private:
00025     ItemsRepeater* m_owner{ nullptr };
00026     std::map<std::wstring, tracker_ref<winrt::UIElement>> m_elementMap;
00027 };
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

BoolToBrushConverter Member List

This is the complete list of members for BoolToBrushConverter, including all inherited members.
Convert(object value, Type targetType, object parameter, string language) | BoolToBrushConverter | [inline]
ConvertBack(object value, Type targetType, object parameter, string language) | BoolToBrushConverter | [inline]
Generated on Sun Dec 1 2024 20:54:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PremultiplyEffect Member List

This is the complete list of members for PremultiplyEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1Premultiply) | PremultiplyEffect
DECLARE_SINGLE_SOURCE(Source) | PremultiplyEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemCollectionTransitionProviderTests::CallInfo Member List

This is the complete list of members for ItemCollectionTransitionProviderTests::CallInfo, including all inherited members.
CallInfo(int index, ItemCollectionTransition transition) | ItemCollectionTransitionProviderTests::CallInfo | [inline]
Index | ItemCollectionTransitionProviderTests::CallInfo |
ToString() | ItemCollectionTransitionProviderTests::CallInfo | [inline]
Transition | ItemCollectionTransitionProviderTests::CallInfo |
Generated on Sun Dec 1 2024 20:53:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/InfoBarTemplateSettings.cpp Source File

  • InfoBar

InfoBarTemplateSettings.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "InfoBarTemplateSettings.h"
00007
00008 InfoBarTemplateSettings::InfoBarTemplateSettings()
00009 {
00010     EnsureProperties();
00011 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/SelectionSample/Common/BoolToBrushConverter.cs Source File

  • Repeater
  • TestUI
  • Samples
  • SelectionSample
  • Common

BoolToBrushConverter.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Windows.UI;
00006 using Microsoft.UI.Xaml.Data;
00007 using Microsoft.UI.Xaml.Media;
00008
00009 namespace MUXControlsTestApp.Samples.Selection
00010 {
00011     public class BoolToBrushConverter : IValueConverter
00012     {
00013         public object Convert(object value, Type targetType, object parameter, string language)
00014         {
00015             var val = value as bool?;
00016             if (!val.HasValue)
00017             {
00018                 return new SolidColorBrush(Microsoft.UI.Colors.Yellow);
00019             }
00020             else
00021             {
00022                 if (val.Value)
00023                 {
00024                     return new SolidColorBrush(Microsoft.UI.Colors.Green);
00025                 }
00026                 else
00027                 {
00028                     return new SolidColorBrush(Microsoft.UI.Colors.Transparent);
00029                 }
00030             }
00031         }
00032
00033         public object ConvertBack(object value, Type targetType, object parameter, string language)
00034         {
00035             throw new NotImplementedException();
00036         }
00037     }
00038 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnimatedChevronDownSmallVisualSource Member List

This is the complete list of members for AnimatedChevronDownSmallVisualSource, including all inherited members.
ColorAsVector4(winrt::Windows::UI::Color color) | AnimatedChevronDownSmallVisualSource | [private, static]
Duration() | AnimatedChevronDownSmallVisualSource |
EnsureThemeProperties(winrt::Microsoft::UI::Composition::Compositor compositor) | AnimatedChevronDownSmallVisualSource | [private]
Foreground() | AnimatedChevronDownSmallVisualSource | [inline]
Foreground(winrt::Windows::UI::Color value) | AnimatedChevronDownSmallVisualSource |
FrameCount() | AnimatedChevronDownSmallVisualSource |
Framerate() | AnimatedChevronDownSmallVisualSource |
FrameToProgress(double frameNumber) | AnimatedChevronDownSmallVisualSource |
Markers() | AnimatedChevronDownSmallVisualSource |
SetColorProperty(hstring const &propertyName, winrt::Windows::UI::Color value) | AnimatedChevronDownSmallVisualSource |
SetScalarProperty(hstring const &propertyName, double value) | AnimatedChevronDownSmallVisualSource |
TryCreateAnimatedVisual(winrt::Microsoft::UI::Composition::Compositor const &compositor) | AnimatedChevronDownSmallVisualSource |
TryCreateAnimatedVisual(winrt::Microsoft::UI::Composition::Compositor const &compositor, winrt::Windows::Foundation::IInspectable &diagnostics) | AnimatedChevronDownSmallVisualSource |
Generated on Sun Dec 1 2024 20:52:39 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SaturationEffect Member List

This is the complete list of members for SaturationEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1Saturation) | SaturationEffect |
DECLARE_NAMED_PROPERTY_MAPPING({L"Saturation", D2D1_SATURATION_PROP_SATURATION, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT}) | SaturationEffect |
DECLARE_POD_PROPERTY(Saturation, float, 0.5f, value >=0.0f &&value<=2.0f) | SaturationEffect |
DECLARE_SINGLE_SOURCE(Source) | SaturationEffect |
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | SaturationEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | SaturationEffect | [inline]
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ItemContainer.properties.h Source File

  • Generated

ItemContainer.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class ItemContainerProperties
00008 {
00009 public:
00010     ItemContainerProperties();
00011
00012     void CanUserInvoke(winrt::ItemContainerUserInvokeMode const& value);
00013     winrt::ItemContainerUserInvokeMode CanUserInvoke();
00014
00015     void CanUserSelect(winrt::ItemContainerUserSelectMode const& value);
00016     winrt::ItemContainerUserSelectMode CanUserSelect();
00017
00018     void Child(winrt::UIElement const& value);
00019     winrt::UIElement Child();
00020
00021     void IsSelected(bool value);
00022     bool IsSelected();
00023
00024     void MultiSelectMode(winrt::ItemContainerMultiSelectMode const& value);
00025     winrt::ItemContainerMultiSelectMode MultiSelectMode();
00026
00027     static winrt::DependencyProperty CanUserInvokeProperty() { return s_CanUserInvokeProperty; }
00028     static winrt::DependencyProperty CanUserSelectProperty() { return s_CanUserSelectProperty; }
00029     static winrt::DependencyProperty ChildProperty() { return s_ChildProperty; }
00030     static winrt::DependencyProperty IsSelectedProperty() { return s_IsSelectedProperty; }
00031     static winrt::DependencyProperty MultiSelectModeProperty() { return s_MultiSelectModeProperty; }
00032
00033     static GlobalDependencyProperty s_CanUserInvokeProperty;
00034     static GlobalDependencyProperty s_CanUserSelectProperty;
00035     static GlobalDependencyProperty s_ChildProperty;
00036     static GlobalDependencyProperty s_IsSelectedProperty;
00037     static GlobalDependencyProperty s_MultiSelectModeProperty;
00038
00039     winrt::event_token ItemInvoked(winrt::TypedEventHandler<winrt::ItemContainer, winrt::ItemContainerInvokedEventArgs> const& value);
00040     void ItemInvoked(winrt::event_token const& token);
00041
00042     event_source<winrt::TypedEventHandler<winrt::ItemContainer, winrt::ItemContainerInvokedEventArgs>> m_itemInvokedEventSource;
00043
00044     static void EnsureProperties();
00045     static void ClearProperties();
00046
00047     static void OnCanUserInvokePropertyChanged(
00048         winrt::DependencyObject const& sender,
00049         winrt::DependencyPropertyChangedEventArgs const& args);
00050
00051     static void OnCanUserSelectPropertyChanged(
00052         winrt::DependencyObject const& sender,
00053         winrt::DependencyPropertyChangedEventArgs const& args);
00054
00055     static void OnChildPropertyChanged(
00056         winrt::DependencyObject const& sender,
00057         winrt::DependencyPropertyChangedEventArgs const& args);
00058
00059     static void OnIsSelectedPropertyChanged(
00060         winrt::DependencyObject const& sender,
00061         winrt::DependencyPropertyChangedEventArgs const& args);
00062
00063     static void OnMultiSelectModePropertyChanged(
00064         winrt::DependencyObject const& sender,
00065         winrt::DependencyPropertyChangedEventArgs const& args);
00066 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MapControl/TestUI/MapControlPage.xaml.cs Source File

  • MapControl
  • TestUI

MapControlPage.xaml.cs

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Markup;
00010 using Windows.UI;
00011 using System.Windows.Input;
00012 using Windows.Devices.Geolocation;
00013 using System.Collections.Generic;
00014
00015 namespace MUXControlsTestApp
00016 {
00017     [TopLevelTestPage(Name = "MapControl")]
00018     public sealed partial class MapControlPage : TestPage
00019     {
00020         public MapControlPage()
00021         {
00022             this.InitializeComponent();
00023
00024             myMap.MapServiceToken = MapControlApiKey.AzureMapsToken;
00025
00026             BasicGeoposition firstCenterPosition = new BasicGeoposition() { Latitude = 0, Longitude = 0 };
00027             Geopoint firstCenterPoint = new Geopoint(firstCenterPosition);
00028             myMap.Center = firstCenterPoint;
00029
00030             myMap.MapElementClick += Map_MapElementClick;
00031             myMap.MapServiceErrorOccurred += Map_MapServiceErrorOccurred;
00032         }
00033
00034         private void GoButton_Click(object sender, RoutedEventArgs e)
00035         {
00036             myMap.MapServiceToken = MapServiceToken.Password;
00037         }
00038
00039         private void Map_MapServiceErrorOccurred(MapControl sender, MapControlMapServiceErrorOccurredEventArgs args)
00040         {
00041             output.Text += args.DiagnosticMessage;
00042         }
00043
00044         private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
00045         {
00046             ToggleSwitch toggleSwitch = sender as ToggleSwitch;
00047             if (toggleSwitch != null)
00048             {
00049                 myMap.InteractiveControlsVisible = toggleSwitch.IsOn;
00050             }
00051         }
00052         private void CenterButton_Click(object sender, RoutedEventArgs e)
00053         {
00054             BasicGeoposition centerPosition = new BasicGeoposition()
00055             {
00056                 Latitude = double.Parse(latitudeText.Text),
00057                 Longitude = double.Parse(longitudeText.Text)
00058             };
00059             Geopoint centerPoint = new Geopoint(centerPosition);
00060             myMap.Center = centerPoint;
00061         }
00062         private void SetZoom_Click(object sender, RoutedEventArgs e)
00063         {
00064             myMap.ZoomLevel = double.Parse(zoomText.Text);
00065         }
00066         private void AddPin_Click(object sender, RoutedEventArgs e)
00067         {
00068             BasicGeoposition position = new BasicGeoposition()
00069             {
00070                 Latitude = double.Parse(latitudePinText.Text),
00071                 Longitude = double.Parse(longitudePinText.Text)
00072             };
00073             Geopoint point = new Geopoint(position);
00074
00075             var icon = new MapIcon
00076             {
00077                 Location = point,
00078             };
00079
00080             var selectedLayer = layersSelection.SelectedItem as MapElementsLayer;
00081             selectedLayer.MapElements.Add(icon);
00082         }
00083         private void AddLayer_Click(object sender, RoutedEventArgs e)
00084         {
00085             var newLayer = new MapElementsLayer{};
00086
00087             newLayer.MapElementClick += Layer_MapElementClick;
00088             myMap.Layers.Add(newLayer);
00089             layersSelection.Items.Add(newLayer);
00090             if(layersSelection.SelectedIndex == -1)
00091             {
00092                 layersSelection.SelectedIndex = 0;
00093             }
00094         }
00095
00096         private void Layer_MapElementClick(MapElementsLayer sender, MapElementClickEventArgs args)
00097         {
00098             var icon = args.Element as MapIcon;
00099             sender.MapElements.Remove(icon);
00100             output.Text += "Layer Clicked\n";
00101         }
00102         private void Map_MapElementClick(MapControl sender, MapElementClickEventArgs args)
00103         {
00104             output.Text += "Map Clicked\n";
00105         }
00106     }
00107 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

HueRotationEffect Member List

This is the complete list of members for HueRotationEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1HueRotation) | HueRotationEffect |
DECLARE_NAMED_PROPERTY_MAPPING({L"Angle", D2D1_HUEROTATION_PROP_ANGLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES}) | HueRotationEffect |
DECLARE_POD_PROPERTY(Angle, float, 0.0f, true) | HueRotationEffect |
DECLARE_SINGLE_SOURCE(Source) | HueRotationEffect |
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | HueRotationEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | HueRotationEffect | [inline]
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: dll/XamlControlsResources.h Source File

  • dll

XamlControlsResources.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "XamlControlsResources.g.h"
00007 #include "XamlControlsResources.properties.h"
00008
00009 class XamlControlsResources :
00010     public ReferenceTracker<XamlControlsResources, winrt::implementation::XamlControlsResourcesT, winrt::composable>,
00011     public XamlControlsResourcesProperties
00012 {
00013 public:
00014     XamlControlsResources();
00015
00016     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs&  args);
00017     void UpdateAcrylicBrushesLightTheme(const winrt::IInspectable themeDictionary);
00018     void UpdateAcrylicBrushesDarkTheme(const winrt::IInspectable themeDictionary);
00019     static void EnsureRevealLights(winrt::UIElement const& element);
00020 private:
00021     void UpdateSource();
00022     void UpdateTintLuminosityOpacity(winrt::Microsoft::UI::Xaml::Media::AcrylicBrush brush, double luminosityValue);
00023 };
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/LayoutPanel.properties.cpp Source File

  • Generated

LayoutPanel.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "LayoutPanel.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(LayoutPanel)
00012 }
00013
00014 #include "LayoutPanel.g.cpp"
00015
00016 GlobalDependencyProperty LayoutPanelProperties::s_BorderBrushProperty{ nullptr };
00017 GlobalDependencyProperty LayoutPanelProperties::s_BorderThicknessProperty{ nullptr };
00018 GlobalDependencyProperty LayoutPanelProperties::s_CornerRadiusProperty{ nullptr };
00019 GlobalDependencyProperty LayoutPanelProperties::s_LayoutProperty{ nullptr };
00020 GlobalDependencyProperty LayoutPanelProperties::s_PaddingProperty{ nullptr };
00021
00022 LayoutPanelProperties::LayoutPanelProperties()
00023 {
00024     EnsureProperties();
00025 }
00026
00027 void LayoutPanelProperties::EnsureProperties()
00028 {
00029     if (!s_BorderBrushProperty)
00030     {
00031         s_BorderBrushProperty =
00032             InitializeDependencyProperty(
00033                 L"BorderBrush",
00034                 winrt::name_of<winrt::Brush>(),
00035                 winrt::name_of<winrt::LayoutPanel>(),
00036                 false /* isAttached */,
00037                 ValueHelper<winrt::Brush>::BoxedDefaultValue(),
00038                 winrt::PropertyChangedCallback(&OnBorderBrushPropertyChanged));
00039     }
00040     if (!s_BorderThicknessProperty)
00041     {
00042         s_BorderThicknessProperty =
00043             InitializeDependencyProperty(
00044                 L"BorderThickness",
00045                 winrt::name_of<winrt::Thickness>(),
00046                 winrt::name_of<winrt::LayoutPanel>(),
00047                 false /* isAttached */,
00048                 ValueHelper<winrt::Thickness>::BoxedDefaultValue(),
00049                 winrt::PropertyChangedCallback(&OnBorderThicknessPropertyChanged));
00050     }
00051     if (!s_CornerRadiusProperty)
00052     {
00053         s_CornerRadiusProperty =
00054             InitializeDependencyProperty(
00055                 L"CornerRadius",
00056                 winrt::name_of<winrt::CornerRadius>(),
00057                 winrt::name_of<winrt::LayoutPanel>(),
00058                 false /* isAttached */,
00059                 ValueHelper<winrt::CornerRadius>::BoxedDefaultValue(),
00060                 winrt::PropertyChangedCallback(&OnCornerRadiusPropertyChanged));
00061     }
00062     if (!s_LayoutProperty)
00063     {
00064         s_LayoutProperty =
00065             InitializeDependencyProperty(
00066                 L"Layout",
00067                 winrt::name_of<winrt::Layout>(),
00068                 winrt::name_of<winrt::LayoutPanel>(),
00069                 false /* isAttached */,
00070                 ValueHelper<winrt::Layout>::BoxedDefaultValue(),
00071                 winrt::PropertyChangedCallback(&OnLayoutPropertyChanged));
00072     }
00073     if (!s_PaddingProperty)
00074     {
00075         s_PaddingProperty =
00076             InitializeDependencyProperty(
00077                 L"Padding",
00078                 winrt::name_of<winrt::Thickness>(),
00079                 winrt::name_of<winrt::LayoutPanel>(),
00080                 false /* isAttached */,
00081                 ValueHelper<winrt::Thickness>::BoxedDefaultValue(),
00082                 winrt::PropertyChangedCallback(&OnPaddingPropertyChanged));
00083     }
00084 }
00085
00086 void LayoutPanelProperties::ClearProperties()
00087 {
00088     s_BorderBrushProperty = nullptr;
00089     s_BorderThicknessProperty = nullptr;
00090     s_CornerRadiusProperty = nullptr;
00091     s_LayoutProperty = nullptr;
00092     s_PaddingProperty = nullptr;
00093 }
00094
00095 void LayoutPanelProperties::OnBorderBrushPropertyChanged(
00096     winrt::DependencyObject const& sender,
00097     winrt::DependencyPropertyChangedEventArgs const& args)
00098 {
00099     auto owner = sender.as<winrt::LayoutPanel>();
00100     winrt::get_self<LayoutPanel>(owner)->OnPropertyChanged(args);
00101 }
00102
00103 void LayoutPanelProperties::OnBorderThicknessPropertyChanged(
00104     winrt::DependencyObject const& sender,
00105     winrt::DependencyPropertyChangedEventArgs const& args)
00106 {
00107     auto owner = sender.as<winrt::LayoutPanel>();
00108     winrt::get_self<LayoutPanel>(owner)->OnPropertyChanged(args);
00109 }
00110
00111 void LayoutPanelProperties::OnCornerRadiusPropertyChanged(
00112     winrt::DependencyObject const& sender,
00113     winrt::DependencyPropertyChangedEventArgs const& args)
00114 {
00115     auto owner = sender.as<winrt::LayoutPanel>();
00116     winrt::get_self<LayoutPanel>(owner)->OnPropertyChanged(args);
00117 }
00118
00119 void LayoutPanelProperties::OnLayoutPropertyChanged(
00120     winrt::DependencyObject const& sender,
00121     winrt::DependencyPropertyChangedEventArgs const& args)
00122 {
00123     auto owner = sender.as<winrt::LayoutPanel>();
00124     winrt::get_self<LayoutPanel>(owner)->OnPropertyChanged(args);
00125 }
00126
00127 void LayoutPanelProperties::OnPaddingPropertyChanged(
00128     winrt::DependencyObject const& sender,
00129     winrt::DependencyPropertyChangedEventArgs const& args)
00130 {
00131     auto owner = sender.as<winrt::LayoutPanel>();
00132     winrt::get_self<LayoutPanel>(owner)->OnPropertyChanged(args);
00133 }
00134
00135 void LayoutPanelProperties::BorderBrush(winrt::Brush const& value)
00136 {
00137     [[gsl::suppress(con)]]
00138     {
00139     static_cast<LayoutPanel*>(this)->SetValue(s_BorderBrushProperty, ValueHelper<winrt::Brush>::BoxValueIfNecessary(value));
00140     }
00141 }
00142
00143 winrt::Brush LayoutPanelProperties::BorderBrush()
00144 {
00145     return ValueHelper<winrt::Brush>::CastOrUnbox(static_cast<LayoutPanel*>(this)->GetValue(s_BorderBrushProperty));
00146 }
00147
00148 void LayoutPanelProperties::BorderThickness(winrt::Thickness const& value)
00149 {
00150     [[gsl::suppress(con)]]
00151     {
00152     static_cast<LayoutPanel*>(this)->SetValue(s_BorderThicknessProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
00153     }
00154 }
00155
00156 winrt::Thickness LayoutPanelProperties::BorderThickness()
00157 {
00158     return ValueHelper<winrt::Thickness>::CastOrUnbox(static_cast<LayoutPanel*>(this)->GetValue(s_BorderThicknessProperty));
00159 }
00160
00161 void LayoutPanelProperties::CornerRadius(winrt::CornerRadius const& value)
00162 {
00163     [[gsl::suppress(con)]]
00164     {
00165     static_cast<LayoutPanel*>(this)->SetValue(s_CornerRadiusProperty, ValueHelper<winrt::CornerRadius>::BoxValueIfNecessary(value));
00166     }
00167 }
00168
00169 winrt::CornerRadius LayoutPanelProperties::CornerRadius()
00170 {
00171     return ValueHelper<winrt::CornerRadius>::CastOrUnbox(static_cast<LayoutPanel*>(this)->GetValue(s_CornerRadiusProperty));
00172 }
00173
00174 void LayoutPanelProperties::Layout(winrt::Layout const& value)
00175 {
00176     [[gsl::suppress(con)]]
00177     {
00178     static_cast<LayoutPanel*>(this)->SetValue(s_LayoutProperty, ValueHelper<winrt::Layout>::BoxValueIfNecessary(value));
00179     }
00180 }
00181
00182 winrt::Layout LayoutPanelProperties::Layout()
00183 {
00184     return ValueHelper<winrt::Layout>::CastOrUnbox(static_cast<LayoutPanel*>(this)->GetValue(s_LayoutProperty));
00185 }
00186
00187 void LayoutPanelProperties::Padding(winrt::Thickness const& value)
00188 {
00189     [[gsl::suppress(con)]]
00190     {
00191     static_cast<LayoutPanel*>(this)->SetValue(s_PaddingProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
00192     }
00193 }
00194
00195 winrt::Thickness LayoutPanelProperties::Padding()
00196 {
00197     return ValueHelper<winrt::Thickness>::CastOrUnbox(static_cast<LayoutPanel*>(this)->GetValue(s_PaddingProperty));
00198 }
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressRing/TestUI/ProgressRingCustomLottieSourcePage.xaml.cs Source File

  • ProgressRing
  • TestUI

ProgressRingCustomLottieSourcePage.xaml.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using Microsoft.UI.Xaml;
00003 using Microsoft.UI.Xaml.Controls;
00004 using Microsoft.UI.Xaml.Media;
00005 using Microsoft.UI.Xaml.Media.Animation;
00006
00007 namespace MUXControlsTestApp
00008 {
00009     public sealed partial class ProgressRingCustomLottieSourcePage : TestPage
00010     {
00011         public ProgressRingCustomLottieSourcePage()
00012         {
00013             this.InitializeComponent();
00014             Loaded += ProgressRingCustomLottieSourcePage_Loaded;
00015
00016             NavigateToMainPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ProgressRingPage), 0); };
00017         }
00018
00019         private void ProgressRingCustomLottieSourcePage_Loaded(object sender, RoutedEventArgs e)
00020         {
00021             var layoutRoot = (Grid)VisualTreeHelper.GetChild(TestCustomLottieSourceProgressRing, 0);
00022
00023             var commonStatesGroup = VisualStateManager.GetVisualStateGroups(layoutRoot)[0];
00024             commonStatesGroup.CurrentStateChanged += this.ProgressRingCustomLottieSourcePage_CurrentStateChanged;
00025             VisualStateText.Text = commonStatesGroup.CurrentState.Name;
00026
00027             //for (int i = 0; i < commonStatesGroup.Transitions[0].Storyboard.Children.Count; i++)
00028             //{
00029             //    // Change the animation to 0 duration to avoid timing issues in the test.
00030             //    commonStatesGroup.Transitions[0].Storyboard.Children[i].Duration = new Duration(TimeSpan.FromSeconds(0));
00031             //}
00032
00033             var animatedVisualPlayer = (Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer)VisualTreeHelper.GetChild(layoutRoot, 0);
00034
00035             IsPlayingText.Text = animatedVisualPlayer.IsPlaying.ToString();
00036             OpacityText.Text = layoutRoot.Opacity.ToString();
00037
00038             Loaded -= ProgressRingCustomLottieSourcePage_Loaded;
00039         }
00040
00041         private void ProgressRingCustomLottieSourcePage_CurrentStateChanged(object sender, VisualStateChangedEventArgs e)
00042         {
00043             VisualStateText.Text = e.NewState.Name;
00044
00045             var layoutRoot = (Grid)VisualTreeHelper.GetChild(TestCustomLottieSourceProgressRing, 0);
00046             var animatedVisualPlayer = (Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer)VisualTreeHelper.GetChild(layoutRoot, 0);
00047             IsPlayingText.Text = animatedVisualPlayer.IsPlaying.ToString();
00048             OpacityText.Text = layoutRoot.Opacity.ToString();
00049         }
00050
00051         public void UpdateMinMax_Click(object sender, RoutedEventArgs e)
00052         {
00053             TestCustomLottieSourceProgressRing.Maximum = String.IsNullOrEmpty(MaximumInput.Text) ? Double.Parse(MaximumInput.PlaceholderText) : Double.Parse(MaximumInput.Text);
00054             TestCustomLottieSourceProgressRing.Minimum = String.IsNullOrEmpty(MinimumInput.Text) ? Double.Parse(MinimumInput.PlaceholderText) : Double.Parse(MinimumInput.Text);
00055         }
00056
00057         public void UpdateWidth_Click(object sender, RoutedEventArgs e)
00058         {
00059             TestCustomLottieSourceProgressRing.Width = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00060             TestCustomLottieSourceProgressRing.Height = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00061         }
00062
00063         public void UpdateValue_Click(object sender, RoutedEventArgs e)
00064         {
00065             TestCustomLottieSourceProgressRing.Value = String.IsNullOrEmpty(ValueInput.Text) ? Double.Parse(ValueInput.PlaceholderText) : Double.Parse(ValueInput.Text);
00066         }
00067         public void ChangeValue_Click(object sender, RoutedEventArgs e)
00068         {
00069             if (TestCustomLottieSourceProgressRing.Value + 1 > TestCustomLottieSourceProgressRing.Maximum)
00070             {
00071                 TestCustomLottieSourceProgressRing.Value = (int)(TestCustomLottieSourceProgressRing.Minimum + 0.5);
00072             }
00073             else
00074             {
00075                 TestCustomLottieSourceProgressRing.Value += 1;
00076             }
00077         }
00078     }
00079 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RegisterMetadata Member List

This is the complete list of members for RegisterMetadata, including all inherited members.
AttributeTable RegisterMetadata
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/IsTargetDPHelper.h Source File

  • Lights

IsTargetDPHelper.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 template<typename T>
00007 inline void OnAttachedIsTargetPropertyChanged(
00008     const winrt::DependencyObject& sender,
00009     const winrt::DependencyPropertyChangedEventArgs& args)
00010 {
00011     if (auto element = sender.try_as<winrt::UIElement>())
00012     {
00013         if (unbox_value<bool>(args.NewValue()))
00014         {
00015             winrt::XamlLight::AddTargetElement(T::GetLightIdStatic(), element);
00016         }
00017         else
00018         {
00019             winrt::XamlLight::RemoveTargetElement(T::GetLightIdStatic(), element);
00020         }
00021     }
00022     else if (auto brush = sender.try_as<winrt::Brush>())
00023     {
00024         if (unbox_value<bool>(args.NewValue()))
00025         {
00026             winrt::XamlLight::AddTargetBrush(T::GetLightIdStatic(), brush);
00027         }
00028         else
00029         {
00030             winrt::XamlLight::RemoveTargetBrush(T::GetLightIdStatic(), brush);
00031         }
00032     }
00033 }
00034
00035 template<typename T>
00036 inline auto InitializeIsTargetDependencyProperty()
00037 {
00038     return InitializeDependencyProperty(
00039         L"IsTarget",
00040         winrt::name_of<bool>(),
00041         winrt::name_of<winrt::DependencyObject>(),
00042         true /* isAttached */,
00043         box_value(false),
00044         &OnAttachedIsTargetPropertyChanged<T>);
00045 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemContainerSummaryPage Member List

This is the complete list of members for ItemContainerSummaryPage, including all inherited members.
BtnGetIsSelected_Click(object sender, RoutedEventArgs e) | ItemContainerSummaryPage | [inline, private]
CanUserInvokeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemContainerSummaryPage | [inline, private]
CanUserSelectComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemContainerSummaryPage | [inline, private]
HeartButton_Click(object sender, RoutedEventArgs e) | ItemContainerSummaryPage | [inline, private]
IsEnabledComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemContainerSummaryPage | [inline, private]
IsMultiSelectComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemContainerSummaryPage | [inline, private]
IsSelectedComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | ItemContainerSummaryPage | [inline, private]
ItemContainerSummaryPage() | ItemContainerSummaryPage | [inline]
ItemContainerSummaryPage_Loaded(object sender, RoutedEventArgs e) | ItemContainerSummaryPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemAutomationPeer.cpp Source File

  • NavigationView

NavigationViewItemAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "NavigationViewItemAutomationPeer.h"
00008 #include "NavigationView.h"
00009 #include "NavigationViewItemBase.h"
00010 #include "SharedHelpers.h"
00011 #include "NavigationViewHelper.h"
00012
00013
00014 #include "NavigationViewItemAutomationPeer.properties.cpp"
00015
00016 NavigationViewItemAutomationPeer::NavigationViewItemAutomationPeer(winrt::NavigationViewItem const& owner) :
00017     ReferenceTracker(owner)
00018 {
00019 }
00020
00021 //IAutomationPeerOverrides
00022
00023 winrt::hstring NavigationViewItemAutomationPeer::GetNameCore()
00024 {
00025     winrt::hstring returnHString = __super::GetNameCore();
00026
00027     // If a name hasn't been provided by AutomationProperties.Name in markup:
00028     if (returnHString.empty())
00029     {
00030         if (auto lvi = Owner().try_as<winrt::NavigationViewItem>())
00031         {
00032             returnHString = SharedHelpers::TryGetStringRepresentationFromObject(lvi.Content());
00033         }
00034     }
00035
00036     if (returnHString.empty())
00037     {
00038         // NB: It'll be up to the app to determine the automation label for
00039         // when they're using a PlaceholderValue vs. Value.
00040
00041         returnHString = ResourceAccessor::GetLocalizedStringResource(SR_NavigationViewItemDefaultControlName);
00042     }
00043
00044     return returnHString;
00045 }
00046
00047 winrt::IInspectable NavigationViewItemAutomationPeer::GetPatternCore(winrt::PatternInterface const& pattern)
00048 {
00049     // Note: We are intentionally not supporting Invoke Pattern, since supporting both SelectionItem and Invoke was
00050     // causing problems.
00051     // See this Issue for more details: https://github.com/microsoft/microsoft-ui-xaml/issues/2702
00052     if (pattern == winrt::PatternInterface::SelectionItem ||
00053         // Only provide expand collapse pattern if we have children!
00054         (pattern == winrt::PatternInterface::ExpandCollapse && HasChildren()))
00055     {
00056         return *this;
00057     }
00058
00059     return __super::GetPatternCore(pattern);
00060 }
00061
00062 winrt::hstring  NavigationViewItemAutomationPeer::GetClassNameCore()
00063 {
00064     return winrt::hstring_name_of<winrt::NavigationViewItem>();
00065 }
00066
00067 winrt::AutomationControlType NavigationViewItemAutomationPeer::GetAutomationControlTypeCore()
00068 {
00069     // To be compliant with MAS 4.1.2, in DisplayMode 'Top',
00070     //  a NavigationViewItem should report itsself as TabItem
00071     if (IsOnTopNavigation())
00072     {
00073         return winrt::AutomationControlType::TabItem;
00074     }
00075     else
00076     {
00077         // TODO: Should this be ListItem in minimal mode and
00078         // TreeItem otherwise.
00079         return winrt::AutomationControlType::ListItem;
00080     }
00081 }
00082
00083
00084 int32_t NavigationViewItemAutomationPeer::GetPositionInSetCore()
00085 {
00086     return GetPositionOrSetCountHelper(AutomationOutput::Position);
00087 }
00088
00089 int32_t NavigationViewItemAutomationPeer::GetSizeOfSetCore()
00090 {
00091     return GetPositionOrSetCountHelper(AutomationOutput::Size);
00092 }
00093
00094 int32_t NavigationViewItemAutomationPeer::GetLevelCore()
00095 {
00096     if (winrt::NavigationViewItemBase nvib = Owner().try_as<winrt::NavigationViewItemBase>())
00097     {
00098         auto const nvibImpl = winrt::get_self<NavigationViewItemBase>(nvib);
00099         if (nvibImpl->IsTopLevelItem())
00100         {
00101             return 1;
00102         }
00103         else
00104         {
00105             if (auto const navView = GetParentNavigationView())
00106             {
00107                 if (auto const indexPath = winrt::get_self<NavigationView>(navView)->GetIndexPathForContainer(nvib))
00108                 {
00109                     // first index in path stands for main or footer menu
00110                     return indexPath.GetSize() - 1;
00111                 }
00112             }
00113         }
00114     }
00115
00116     return 0;
00117 }
00118
00119 void NavigationViewItemAutomationPeer::Invoke()
00120 {
00121     if (auto const navView = GetParentNavigationView())
00122     {
00123         if (auto const navigationViewItem = Owner().try_as<winrt::NavigationViewItem>())
00124         {
00125             if (navigationViewItem == navView.SettingsItem())
00126             {
00127                 winrt::get_self<NavigationView>(navView)->OnSettingsInvoked();
00128             }
00129             else
00130             {
00131                 winrt::get_self<NavigationView>(navView)->OnNavigationViewItemInvoked(navigationViewItem);
00132             }
00133         }
00134     }
00135 }
00136
00137 // IExpandCollapseProvider
00138 winrt::ExpandCollapseState NavigationViewItemAutomationPeer::ExpandCollapseState()
00139 {
00140     auto state = winrt::ExpandCollapseState::LeafNode;
00141     if (winrt::NavigationViewItem navigationViewItem = Owner().try_as<winrt::NavigationViewItem>())
00142     {
00143         state = winrt::get_self<NavigationViewItem>(navigationViewItem)->IsExpanded() ?
00144             winrt::ExpandCollapseState::Expanded :
00145             winrt::ExpandCollapseState::Collapsed;
00146     }
00147
00148     return state;
00149 }
00150
00151 void NavigationViewItemAutomationPeer::Collapse()
00152 {
00153     if (auto const navView = GetParentNavigationView())
00154     {
00155         if (winrt::NavigationViewItem navigationViewItem = Owner().try_as<winrt::NavigationViewItem>())
00156         {
00157             navView.Collapse(navigationViewItem);
00158             RaiseExpandCollapseAutomationEvent(winrt::ExpandCollapseState::Collapsed);
00159         }
00160     }
00161 }
00162
00163 void NavigationViewItemAutomationPeer::Expand()
00164 {
00165     if (auto const navView = GetParentNavigationView())
00166     {
00167         if (winrt::NavigationViewItem navigationViewItem = Owner().try_as<winrt::NavigationViewItem>())
00168         {
00169             navView.Expand(navigationViewItem);
00170             RaiseExpandCollapseAutomationEvent(winrt::ExpandCollapseState::Expanded);
00171         }
00172     }
00173 }
00174
00175 void NavigationViewItemAutomationPeer::RaiseExpandCollapseAutomationEvent(winrt::ExpandCollapseState newState)
00176 {
00177     if (winrt::AutomationPeer::ListenerExists(winrt::AutomationEvents::PropertyChanged))
00178     {
00179         const winrt::ExpandCollapseState oldState = (newState == winrt::ExpandCollapseState::Expanded) ?
00180             winrt::ExpandCollapseState::Collapsed :
00181             winrt::ExpandCollapseState::Expanded;
00182
00183         // box_value(oldState) doesn't work here, use ReferenceWithABIRuntimeClassName to make Narrator can unbox it.
00184         RaisePropertyChangedEvent(winrt::ExpandCollapsePatternIdentifiers::ExpandCollapseStateProperty(),
00185             box_value(oldState),
00186             box_value(newState));
00187     }
00188 }
00189
00190
00191
00192 winrt::NavigationView NavigationViewItemAutomationPeer::GetParentNavigationView()
00193 {
00194     winrt::NavigationView navigationView{ nullptr };
00195
00196     winrt::NavigationViewItemBase navigationViewItem = Owner().try_as<winrt::NavigationViewItemBase>();
00197     if (navigationViewItem)
00198     {
00199         navigationView = winrt::get_self<NavigationViewItemBase>(navigationViewItem)->GetNavigationView();
00200     }
00201     return navigationView;
00202 }
00203
00204 int32_t NavigationViewItemAutomationPeer::GetNavigationViewItemCountInPrimaryList()
00205 {
00206     int32_t count = 0;
00207     if (auto navigationView = GetParentNavigationView())
00208     {
00209         count = winrt::get_self<NavigationView>(navigationView)->GetNavigationViewItemCountInPrimaryList();
00210     }
00211     return count;
00212 }
00213
00214 int32_t NavigationViewItemAutomationPeer::GetNavigationViewItemCountInTopNav()
00215 {
00216     int32_t count = 0;
00217     if (auto navigationView = GetParentNavigationView())
00218     {
00219         count = winrt::get_self<NavigationView>(navigationView)->GetNavigationViewItemCountInTopNav();
00220     }
00221     return count;
00222 }
00223
00224 bool NavigationViewItemAutomationPeer::IsSettingsItem()
00225 {
00226     if (auto navView = GetParentNavigationView())
00227     {
00228         winrt::NavigationViewItem item = Owner().try_as<winrt::NavigationViewItem>();
00229         auto settingsItem = navView.SettingsItem();
00230         if (item && settingsItem && (item == settingsItem || item.Content() == settingsItem))
00231         {
00232             return true;
00233         }
00234     }
00235     return false;
00236 }
00237
00238 bool NavigationViewItemAutomationPeer::IsOnTopNavigation()
00239 {
00240     const auto position = GetNavigationViewRepeaterPosition();
00241     return position != NavigationViewRepeaterPosition::LeftNav && position != NavigationViewRepeaterPosition::LeftFooter;
00242 }
00243
00244 bool NavigationViewItemAutomationPeer::IsOnTopNavigationOverflow()
00245 {
00246     return GetNavigationViewRepeaterPosition() == NavigationViewRepeaterPosition::TopOverflow;
00247 }
00248
00249 bool NavigationViewItemAutomationPeer::IsOnFooterNavigation()
00250 {
00251     const auto position = GetNavigationViewRepeaterPosition();
00252     return position == NavigationViewRepeaterPosition::LeftFooter || position == NavigationViewRepeaterPosition::TopFooter;
00253 }
00254
00255 NavigationViewRepeaterPosition NavigationViewItemAutomationPeer::GetNavigationViewRepeaterPosition()
00256 {
00257     if (winrt::NavigationViewItemBase navigationViewItem = Owner().try_as<winrt::NavigationViewItemBase>())
00258     {
00259         return winrt::get_self<NavigationViewItemBase>(navigationViewItem)->Position();
00260     }
00261     return NavigationViewRepeaterPosition::LeftNav;
00262 }
00263
00264 winrt::ItemsRepeater NavigationViewItemAutomationPeer::GetParentItemsRepeater()
00265 {
00266     if (auto const navview = GetParentNavigationView())
00267     {
00268         if (winrt::NavigationViewItemBase navigationViewItem = Owner().try_as<winrt::NavigationViewItemBase>())
00269         {
00270             return winrt::get_self<NavigationView>(navview)->GetParentItemsRepeaterForContainer(navigationViewItem);
00271         }
00272     }
00273     return nullptr;
00274 }
00275
00276 // Get either the position or the size of the set for this particular item by iterating through the children of the
00277 // parent items repeater and comparing the value of the FrameworkElementAutomationPeer we can get from the item
00278 // we're iterating through to this object.
00279 int32_t NavigationViewItemAutomationPeer::GetPositionOrSetCountHelper(AutomationOutput automationOutput)
00280 {
00281     int32_t returnValue = 0;
00282     bool itemFound = false;
00283
00284     if (auto const parentRepeater = GetParentItemsRepeater())
00285     {
00286         if (auto const itemsSourceView = parentRepeater.ItemsSourceView())
00287         {
00288             auto const numberOfElements = itemsSourceView.Count();
00289
00290             for (int32_t i = 0; i < numberOfElements; i++)
00291             {
00292                 if (auto child = parentRepeater.TryGetElement(i))
00293                 {
00294                     if (child.try_as<winrt::NavigationViewItemHeader>())
00295                     {
00296                         if (automationOutput == AutomationOutput::Size && itemFound)
00297                         {
00298                             break;
00299                         }
00300                         else
00301                         {
00302                             returnValue = 0;
00303                         }
00304                     }
00305                     else if (auto const navviewitem = child.try_as<winrt::NavigationViewItem>())
00306                     {
00307                         if (navviewitem.Visibility() == winrt::Visibility::Visible)
00308                         {
00309                             returnValue++;
00310
00311                             if (winrt::FrameworkElementAutomationPeer::FromElement(navviewitem) == static_cast<winrt::NavigationViewItemAutomationPeer>(*this))
00312                             {
00313                                 if (automationOutput == AutomationOutput::Position)
00314                                 {
00315                                     break;
00316                                 }
00317                                 else
00318                                 {
00319                                     itemFound = true;
00320                                 }
00321                             }
00322                         }
00323                     }
00324                 }
00325             }
00326         }
00327     }
00328
00329     return returnValue;
00330 }
00331
00332 bool NavigationViewItemAutomationPeer::IsSelected()
00333 {
00334     if (auto const nvi = Owner().try_as<winrt::NavigationViewItem>())
00335     {
00336         return nvi.IsSelected();
00337     }
00338     return false;
00339 }
00340
00341 winrt::IRawElementProviderSimple NavigationViewItemAutomationPeer::SelectionContainer()
00342 {
00343     if (auto const navview = GetParentNavigationView())
00344     {
00345         if (auto const peer = winrt::FrameworkElementAutomationPeer::CreatePeerForElement(navview))
00346         {
00347             return ProviderFromPeer(peer);
00348         }
00349     }
00350
00351     return nullptr;
00352 }
00353
00354 void NavigationViewItemAutomationPeer::AddToSelection()
00355 {
00356     ChangeSelection(true);
00357 }
00358
00359 void NavigationViewItemAutomationPeer::Select()
00360 {
00361     ChangeSelection(true);
00362 }
00363
00364 void NavigationViewItemAutomationPeer::RemoveFromSelection()
00365 {
00366     ChangeSelection(false);
00367 }
00368
00369 void NavigationViewItemAutomationPeer::ChangeSelection(bool isSelected)
00370 {
00371     // If the item is being selected, we trigger an invoke as if the user had clicked on the item:
00372     if(isSelected)
00373     {
00374         Invoke();
00375     }
00376     if (auto nvi = Owner().try_as<winrt::NavigationViewItem>())
00377     {
00378         nvi.IsSelected(isSelected);
00379     }
00380 }
00381
00382 bool NavigationViewItemAutomationPeer::HasChildren()
00383 {
00384     if (const auto& navigationViewItem = Owner().try_as<NavigationViewItem>())
00385     {
00386         return navigationViewItem->HasChildren();
00387     }
00388     return false;
00389 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterAutomationPeer.cpp Source File

  • ScrollPresenter

ScrollPresenterAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "ScrollPresenterAutomationPeer.h"
00009 #include "ResourceAccessor.h"
00010 #include <UIAutomationCore.h>
00011 #include <UIAutomationCoreApi.h>
00012
00013 double ScrollPresenterAutomationPeer::s_minimumPercent{ 0.0 };
00014 double ScrollPresenterAutomationPeer::s_maximumPercent{ 100.0 };
00015 double ScrollPresenterAutomationPeer::s_noScroll{ -1.0 };
00016
00017 #include "ScrollPresenterAutomationPeer.properties.cpp"
00018
00019 ScrollPresenterAutomationPeer::ScrollPresenterAutomationPeer(winrt::ScrollPresenter const& owner)
00020     : ReferenceTracker(owner)
00021 {
00022     SCROLLPRESENTER_TRACE_VERBOSE(owner, TRACE_MSG_METH_PTR, METH_NAME, this, owner);
00023 }
00024
00025 // IAutomationPeerOverrides implementation
00026
00027 winrt::AutomationControlType ScrollPresenterAutomationPeer::GetAutomationControlTypeCore()
00028 {
00029     return winrt::AutomationControlType::Pane;
00030 }
00031
00032 winrt::IInspectable ScrollPresenterAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00033 {
00034     return GetPatternCoreImpl(patternInterface);
00035 }
00036
00037 // IScrollProvider implementation
00038
00039 // Request to scroll horizontally and vertically by the specified amount.
00040 // The ability to call this method and simultaneously scroll horizontally
00041 // and vertically provides simple panning support.
00042 void ScrollPresenterAutomationPeer::Scroll(winrt::ScrollAmount const& horizontalAmount, winrt::ScrollAmount const& verticalAmount)
00043 {
00044     SCROLLPRESENTER_TRACE_VERBOSE(Owner(), TRACE_MSG_METH_STR_STR, METH_NAME, this,
00045         TypeLogging::ScrollAmountToString(horizontalAmount).c_str(), TypeLogging::ScrollAmountToString(verticalAmount).c_str());
00046
00047     if (!IsEnabled())
00048     {
00049         throw winrt::hresult_error(UIA_E_ELEMENTNOTENABLED);
00050     }
00051
00052     const bool scrollHorizontally = horizontalAmount != winrt::ScrollAmount::NoAmount;
00053     const bool scrollVertically = verticalAmount != winrt::ScrollAmount::NoAmount;
00054
00055     const bool isHorizontallyScrollable = HorizontallyScrollable();
00056     const bool isVerticallyScrollable = VerticallyScrollable();
00057
00058     if (!(scrollHorizontally && !isHorizontallyScrollable) && !(scrollVertically && !isVerticallyScrollable))
00059     {
00060         auto scrollPresenter = winrt::get_self<ScrollPresenter>(GetScrollPresenter());
00061         bool isInvalidOperation = false;
00062
00063         switch (horizontalAmount)
00064         {
00065         case winrt::ScrollAmount::LargeDecrement:
00066             scrollPresenter->PageLeft();
00067             break;
00068         case winrt::ScrollAmount::LargeIncrement:
00069             scrollPresenter->PageRight();
00070             break;
00071         case winrt::ScrollAmount::SmallDecrement:
00072             scrollPresenter->LineLeft();
00073             break;
00074         case winrt::ScrollAmount::SmallIncrement:
00075             scrollPresenter->LineRight();
00076             break;
00077         case winrt::ScrollAmount::NoAmount:
00078             break;
00079         default:
00080             isInvalidOperation = true;
00081             break;
00082         }
00083
00084         if (!isInvalidOperation)
00085         {
00086             switch (verticalAmount)
00087             {
00088             case winrt::ScrollAmount::LargeDecrement:
00089                 scrollPresenter->PageUp();
00090                 return;
00091             case winrt::ScrollAmount::SmallDecrement:
00092                 scrollPresenter->LineUp();
00093                 return;
00094             case winrt::ScrollAmount::SmallIncrement:
00095                 scrollPresenter->LineDown();
00096                 return;
00097             case winrt::ScrollAmount::LargeIncrement:
00098                 scrollPresenter->PageDown();
00099                 return;
00100             case winrt::ScrollAmount::NoAmount:
00101                 return;
00102             }
00103         }
00104     }
00105
00106     throw winrt::hresult_error(UIA_E_INVALIDOPERATION, L"Cannot perform the operation.");
00107 }
00108
00109 // Request to set the current horizontal and Vertical scroll position by percent (0-100).
00110 // Passing in the value of "-1", represented by the constant "NoScroll", will indicate that scrolling
00111 // in that direction should be ignored.
00112 // The ability to call this method and simultaneously scroll horizontally and vertically provides simple panning support.
00113 void ScrollPresenterAutomationPeer::SetScrollPercent(double horizontalPercent, double verticalPercent)
00114 {
00115     SCROLLPRESENTER_TRACE_VERBOSE(Owner(), TRACE_MSG_METH_DBL_DBL, METH_NAME, this, horizontalPercent, verticalPercent);
00116
00117     if (!IsEnabled())
00118     {
00119         throw winrt::hresult_error(UIA_E_ELEMENTNOTENABLED);
00120     }
00121
00122     const bool scrollHorizontally = horizontalPercent != s_noScroll;
00123     const bool scrollVertically = verticalPercent != s_noScroll;
00124
00125     if (!scrollHorizontally && !scrollVertically)
00126     {
00127         return;
00128     }
00129
00130     const bool isHorizontallyScrollable = HorizontallyScrollable();
00131     const bool isVerticallyScrollable = VerticallyScrollable();
00132
00133     if ((scrollHorizontally && !isHorizontallyScrollable) || (scrollVertically && !isVerticallyScrollable))
00134     {
00135         throw winrt::hresult_error(UIA_E_INVALIDOPERATION, L"Cannot perform the operation.");
00136     }
00137
00138     if ((scrollHorizontally && (horizontalPercent < s_minimumPercent || horizontalPercent > s_maximumPercent)) ||
00139         (scrollVertically && (verticalPercent < s_minimumPercent || verticalPercent > s_maximumPercent)))
00140     {
00141         throw winrt::hresult_error(E_INVALIDARG);
00142     }
00143
00144     auto scrollPresenter = winrt::get_self<ScrollPresenter>(GetScrollPresenter());
00145
00146     if (scrollHorizontally && !scrollVertically)
00147     {
00148         const double maxOffset = scrollPresenter->ScrollableWidth();
00149
00150         scrollPresenter->ScrollToHorizontalOffset(maxOffset * horizontalPercent / s_maximumPercent);
00151     }
00152     else if (scrollVertically && !scrollHorizontally)
00153     {
00154         const double maxOffset = scrollPresenter->ScrollableHeight();
00155
00156         scrollPresenter->ScrollToVerticalOffset(maxOffset * verticalPercent / s_maximumPercent);
00157     }
00158     else
00159     {
00160         const double maxHorizontalOffset = scrollPresenter->ScrollableWidth();
00161         const double maxVerticalOffset = scrollPresenter->ScrollableHeight();
00162
00163         scrollPresenter->ScrollToOffsets(
00164             maxHorizontalOffset * horizontalPercent / s_maximumPercent, maxVerticalOffset * verticalPercent / s_maximumPercent);
00165     }
00166 }
00167
00168 double ScrollPresenterAutomationPeer::HorizontalScrollPercent()
00169 {
00170     MUX_ASSERT(m_horizontalScrollPercent == get_HorizontalScrollPercentImpl());
00171
00172     return m_horizontalScrollPercent;
00173 }
00174
00175 double ScrollPresenterAutomationPeer::VerticalScrollPercent()
00176 {
00177     MUX_ASSERT(m_verticalScrollPercent == get_VerticalScrollPercentImpl());
00178
00179     return m_verticalScrollPercent;
00180 }
00181
00182 // Returns the horizontal percentage of the entire extent that is currently viewed.
00183 double ScrollPresenterAutomationPeer::HorizontalViewSize()
00184 {
00185     MUX_ASSERT(m_horizontalViewSize == get_HorizontalViewSizeImpl());
00186
00187     return m_horizontalViewSize;
00188 }
00189
00190 // Returns the vertical percentage of the entire extent that is currently viewed.
00191 double ScrollPresenterAutomationPeer::VerticalViewSize()
00192 {
00193     MUX_ASSERT(m_verticalViewSize == get_VerticalViewSizeImpl());
00194
00195     return m_verticalViewSize;
00196 }
00197
00198 bool ScrollPresenterAutomationPeer::HorizontallyScrollable()
00199 {
00200     MUX_ASSERT(m_horizontallyScrollable == get_HorizontallyScrollableImpl());
00201
00202     return m_horizontallyScrollable;
00203 }
00204
00205 bool ScrollPresenterAutomationPeer::VerticallyScrollable()
00206 {
00207     MUX_ASSERT(m_verticallyScrollable == get_VerticallyScrollableImpl());
00208
00209     return m_verticallyScrollable;
00210 }
00211
00212 // Raise relevant Scroll Pattern events for UIAutomation clients.
00213 void ScrollPresenterAutomationPeer::UpdateScrollPatternProperties()
00214 {
00215     SCROLLPRESENTER_TRACE_VERBOSE(Owner(), TRACE_MSG_METH, METH_NAME, this);
00216
00217     const double newHorizontalScrollPercent = get_HorizontalScrollPercentImpl();
00218     const double newVerticalScrollPercent = get_VerticalScrollPercentImpl();
00219     const double newHorizontalViewSize = get_HorizontalViewSizeImpl();
00220     const double newVerticalViewSize = get_VerticalViewSizeImpl();
00221     const bool newHorizontallyScrollable = get_HorizontallyScrollableImpl();
00222     const bool newVerticallyScrollable = get_VerticallyScrollableImpl();
00223
00224     if (newHorizontallyScrollable != m_horizontallyScrollable)
00225     {
00226         const bool oldHorizontallyScrollable = m_horizontallyScrollable;
00227         m_horizontallyScrollable = newHorizontallyScrollable;
00228         RaisePropertyChangedEvent(
00229             winrt::ScrollPatternIdentifiers::HorizontallyScrollableProperty(),
00230             box_value(oldHorizontallyScrollable).as<winrt::IReference<bool>>(),
00231             box_value(newHorizontallyScrollable).as<winrt::IReference<bool>>());
00232     }
00233
00234     if (newVerticallyScrollable != m_verticallyScrollable)
00235     {
00236         const bool oldVerticallyScrollable = m_verticallyScrollable;
00237         m_verticallyScrollable = newVerticallyScrollable;
00238         RaisePropertyChangedEvent(
00239             winrt::ScrollPatternIdentifiers::HorizontallyScrollableProperty(),
00240             box_value(oldVerticallyScrollable).as<winrt::IReference<bool>>(),
00241             box_value(newVerticallyScrollable).as<winrt::IReference<bool>>());
00242     }
00243
00244     if (newHorizontalViewSize != m_horizontalViewSize)
00245     {
00246         const double oldHorizontalViewSize = m_horizontalViewSize;
00247         m_horizontalViewSize = newHorizontalViewSize;
00248         RaisePropertyChangedEvent(
00249             winrt::ScrollPatternIdentifiers::HorizontalViewSizeProperty(),
00250             box_value(oldHorizontalViewSize).as<winrt::IReference<double>>(),
00251             box_value(newHorizontalViewSize).as<winrt::IReference<double>>());
00252     }
00253
00254     if (newVerticalViewSize != m_verticalViewSize)
00255     {
00256         const double oldVerticalViewSize = m_verticalViewSize;
00257         m_verticalViewSize = newVerticalViewSize;
00258         RaisePropertyChangedEvent(
00259             winrt::ScrollPatternIdentifiers::VerticalViewSizeProperty(),
00260             box_value(oldVerticalViewSize).as<winrt::IReference<double>>(),
00261             box_value(newVerticalViewSize).as<winrt::IReference<double>>());
00262     }
00263
00264     if (newHorizontalScrollPercent != m_horizontalScrollPercent)
00265     {
00266         const double oldHorizontalScrollPercent = m_horizontalScrollPercent;
00267         m_horizontalScrollPercent = newHorizontalScrollPercent;
00268         RaisePropertyChangedEvent(
00269             winrt::ScrollPatternIdentifiers::HorizontalScrollPercentProperty(),
00270             box_value(oldHorizontalScrollPercent).as<winrt::IReference<double>>(),
00271             box_value(newHorizontalScrollPercent).as<winrt::IReference<double>>());
00272     }
00273
00274     if (newVerticalScrollPercent != m_verticalScrollPercent)
00275     {
00276         const double oldVerticalScrollPercent = m_verticalScrollPercent;
00277         m_verticalScrollPercent = newVerticalScrollPercent;
00278         RaisePropertyChangedEvent(
00279             winrt::ScrollPatternIdentifiers::VerticalScrollPercentProperty(),
00280             box_value(oldVerticalScrollPercent).as<winrt::IReference<double>>(),
00281             box_value(newVerticalScrollPercent).as<winrt::IReference<double>>());
00282     }
00283 }
00284
00285 double ScrollPresenterAutomationPeer::get_HorizontalScrollPercentImpl()
00286 {
00287     com_ptr<ScrollPresenter> scrollPresenter = winrt::get_self<ScrollPresenter>(GetScrollPresenter())->get_strong();
00288
00289     return GetScrollPercent(
00290         scrollPresenter->GetZoomedExtentWidth(),
00291         scrollPresenter->ViewportWidth(),
00292         GetScrollPresenter().HorizontalOffset());
00293 }
00294
00295 double ScrollPresenterAutomationPeer::get_VerticalScrollPercentImpl()
00296 {
00297     com_ptr<ScrollPresenter> scrollPresenter = winrt::get_self<ScrollPresenter>(GetScrollPresenter())->get_strong();
00298
00299     return GetScrollPercent(
00300         scrollPresenter->GetZoomedExtentHeight(),
00301         scrollPresenter->ViewportHeight(),
00302         GetScrollPresenter().VerticalOffset());
00303 }
00304
00305 // Returns the horizontal percentage of the entire extent that is currently viewed.
00306 double ScrollPresenterAutomationPeer::get_HorizontalViewSizeImpl()
00307 {
00308     com_ptr<ScrollPresenter> scrollPresenter = winrt::get_self<ScrollPresenter>(GetScrollPresenter())->get_strong();
00309
00310     return GetViewPercent(
00311         scrollPresenter->GetZoomedExtentWidth(),
00312         scrollPresenter->ViewportWidth());
00313 }
00314
00315 // Returns the vertical percentage of the entire extent that is currently viewed.
00316 double ScrollPresenterAutomationPeer::get_VerticalViewSizeImpl()
00317 {
00318     com_ptr<ScrollPresenter> scrollPresenter = winrt::get_self<ScrollPresenter>(GetScrollPresenter())->get_strong();
00319
00320     return GetViewPercent(
00321         scrollPresenter->GetZoomedExtentHeight(),
00322         scrollPresenter->ViewportHeight());
00323 }
00324
00325 bool ScrollPresenterAutomationPeer::get_HorizontallyScrollableImpl()
00326 {
00327     com_ptr<ScrollPresenter> scrollPresenter = winrt::get_self<ScrollPresenter>(GetScrollPresenter())->get_strong();
00328
00329     return scrollPresenter->ScrollableWidth() > 0.0;
00330 }
00331
00332 bool ScrollPresenterAutomationPeer::get_VerticallyScrollableImpl()
00333 {
00334     com_ptr<ScrollPresenter> scrollPresenter = winrt::get_self<ScrollPresenter>(GetScrollPresenter())->get_strong();
00335
00336     return scrollPresenter->ScrollableHeight() > 0.0;
00337 }
00338
00339 winrt::IInspectable ScrollPresenterAutomationPeer::GetPatternCoreImpl(winrt::PatternInterface patternInterface)
00340 {
00341     if (patternInterface == winrt::PatternInterface::Scroll)
00342     {
00343         return *this;
00344     }
00345
00346     return __super::GetPatternCore(patternInterface);
00347 }
00348
00349 winrt::ScrollPresenter ScrollPresenterAutomationPeer::GetScrollPresenter()
00350 {
00351     winrt::UIElement owner = Owner();
00352     return owner.as<winrt::ScrollPresenter>();
00353 }
00354
00355 double ScrollPresenterAutomationPeer::GetViewPercent(double zoomedExtent, double viewport)
00356 {
00357     MUX_ASSERT(zoomedExtent >= 0.0);
00358     MUX_ASSERT(viewport >= 0.0);
00359
00360     if (zoomedExtent == 0.0)
00361     {
00362         return s_maximumPercent;
00363     }
00364
00365     return std::min(s_maximumPercent, (viewport / zoomedExtent * s_maximumPercent));
00366 }
00367
00368 double ScrollPresenterAutomationPeer::GetScrollPercent(double zoomedExtent, double viewport, double offset)
00369 {
00370     MUX_ASSERT(zoomedExtent >= 0.0);
00371     MUX_ASSERT(viewport >= 0.0);
00372
00373     if (viewport >= zoomedExtent)
00374     {
00375         return winrt::ScrollPatternIdentifiers::NoScroll();
00376     }
00377
00378     double scrollPercent = offset / (zoomedExtent - viewport) * s_maximumPercent;
00379
00380     scrollPercent = std::max(scrollPercent, s_minimumPercent);
00381     scrollPercent = std::min(scrollPercent, s_maximumPercent);
00382
00383     return scrollPercent;
00384 }
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PersonPictureTemplateSettingsProperties Member List

This is the complete list of members for PersonPictureTemplateSettingsProperties, including all inherited members.
ActualImageBrush(winrt::ImageBrush const &value) | PersonPictureTemplateSettingsProperties |
ActualImageBrush() | PersonPictureTemplateSettingsProperties |
ActualImageBrushProperty() | PersonPictureTemplateSettingsProperties | [inline, static]
ActualInitials(winrt::hstring const &value) | PersonPictureTemplateSettingsProperties |
ActualInitials() | PersonPictureTemplateSettingsProperties |
ActualInitialsProperty() | PersonPictureTemplateSettingsProperties | [inline, static]
ClearProperties() | PersonPictureTemplateSettingsProperties | [static]
EnsureProperties() | PersonPictureTemplateSettingsProperties | [static]
PersonPictureTemplateSettingsProperties() | PersonPictureTemplateSettingsProperties |
s_ActualImageBrushProperty | PersonPictureTemplateSettingsProperties | [static]
s_ActualInitialsProperty | PersonPictureTemplateSettingsProperties | [static]
Generated on Sun Dec 1 2024 20:53:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/ItemsViewTestHooks.idl Source File

  • ItemsView

ItemsViewTestHooks.idl

Go to the documentation of this file.
00001 ﻿namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [default_interface]
00006 [webhosthidden]
00007 runtimeclass ItemsViewTestHooks
00008 {
00009     static event Windows.Foundation.TypedEventHandler<MU_XC_NAMESPACE.ItemsView, Object> KeyboardNavigationReferenceOffsetChanged;
00010
00011     static Windows.Foundation.Point GetKeyboardNavigationReferenceOffset(MU_XC_NAMESPACE.ItemsView itemsView);
00012     static MU_XC_NAMESPACE.ScrollView GetScrollViewPart(MU_XC_NAMESPACE.ItemsView itemsView);
00013     static MU_XC_NAMESPACE.ItemsRepeater GetItemsRepeaterPart(MU_XC_NAMESPACE.ItemsView itemsView);
00014     static MU_XC_NAMESPACE.SelectionModel GetSelectionModel(MU_XC_NAMESPACE.ItemsView itemsView);
00015 }
00016
00017 }
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbLayout.h Source File

  • Breadcrumb

BreadcrumbLayout.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003 #pragma once
00004
00005 #include "pch.h"
00006 #include "common.h"
00007
00008 #include "Vector.h"
00009 #include "NonVirtualizingLayout.h"
00010
00011 class BreadcrumbLayout :
00012     public winrt::implements<BreadcrumbLayout, NonVirtualizingLayout>
00013 {
00014 public:
00015     BreadcrumbLayout();
00016     BreadcrumbLayout(const winrt::BreadcrumbBar& breadcrumb);
00017
00018     ~BreadcrumbLayout();
00019
00020     winrt::Size MeasureOverride(
00021         winrt::NonVirtualizingLayoutContext const& context,
00022         winrt::Size const& availableSize);
00023     winrt::Size ArrangeOverride(
00024         winrt::NonVirtualizingLayoutContext const& context,
00025         winrt::Size const& finalSize);
00026
00027     bool EllipsisIsRendered();
00028     uint32_t FirstRenderedItemIndexAfterEllipsis();
00029     uint32_t GetVisibleItemsCount();
00030
00031 private:
00032     void ArrangeItem(const winrt::UIElement& breadcrumbItem, float& accumulatedWidths, float maxElementHeight);
00033     void ArrangeItem(const winrt::NonVirtualizingLayoutContext& context, int index, float& accumulatedWidths, float maxElementHeight);
00034     void HideItem(const winrt::UIElement& breadcrumbItem);
00035     void HideItem(const winrt::NonVirtualizingLayoutContext& context, int index);
00036     int GetFirstBreadcrumbBarItemToArrange(winrt::NonVirtualizingLayoutContext const& context);
00037     float GetBreadcrumbBarItemsHeight(winrt::NonVirtualizingLayoutContext const& context, int firstItemToRender);
00038
00039     uint32_t GetItemCount(winrt::NonVirtualizingLayoutContext const& context);
00040     winrt::UIElement GetElementAt(winrt::NonVirtualizingLayoutContext const& context, uint32_t index);
00041
00042     winrt::Size m_availableSize{};
00043     winrt::BreadcrumbBarItem m_ellipsisButton{nullptr};
00044     winrt::weak_ref<winrt::BreadcrumbBar> m_breadcrumb{ nullptr };  // weak_ref because the BreadcrumbBar already points to us via m_itemsRepeaterLayout
00045
00046     bool m_ellipsisIsRendered{};
00047     uint32_t m_firstRenderedItemIndexAfterEllipsis{};
00048     uint32_t m_visibleItemsCount{};
00049 };
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/MapIcon.properties.h Source File

  • Generated

MapIcon.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class MapIconProperties
00008 {
00009 public:
00010     MapIconProperties();
00011
00012     void Location(winrt::Geopoint const& value);
00013     winrt::Geopoint Location();
00014
00015     static winrt::DependencyProperty LocationProperty() { return s_LocationProperty; }
00016
00017     static GlobalDependencyProperty s_LocationProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021
00022     static void OnLocationPropertyChanged(
00023         winrt::DependencyObject const& sender,
00024         winrt::DependencyPropertyChangedEventArgs const& args);
00025 };
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ComboBoxHelperProperties Member List

This is the complete list of members for ComboBoxHelperProperties, including all inherited members.
ClearProperties() | ComboBoxHelperProperties | [static]
ComboBoxHelperProperties() | ComboBoxHelperProperties |
EnsureProperties() | ComboBoxHelperProperties | [static]
GetKeepInteriorCornersSquare(winrt::ComboBox const &target) | ComboBoxHelperProperties | [static]
KeepInteriorCornersSquareProperty() | ComboBoxHelperProperties | [inline, static]
s_KeepInteriorCornersSquareProperty | ComboBoxHelperProperties | [static]
SetKeepInteriorCornersSquare(winrt::ComboBox const &target, bool value) | ComboBoxHelperProperties | [static]
Generated on Sun Dec 1 2024 20:52:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MapElementClickEventArgs Member List

This is the complete list of members for MapElementClickEventArgs, including all inherited members.
Element() | MapElementClickEventArgs | [inline]
Location() | MapElementClickEventArgs | [inline]
m_element | MapElementClickEventArgs | [private]
m_location | MapElementClickEventArgs | [private]
MapElementClickEventArgs(winrt::Geopoint location, winrt::MapElement element) | MapElementClickEventArgs | [inline]
Generated on Sun Dec 1 2024 20:52:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollingScrollAnimationStartingEventArgs.cpp Source File

  • ScrollPresenter

ScrollingScrollAnimationStartingEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "ScrollPresenterTrace.h"
00008 #include "ScrollingScrollAnimationStartingEventArgs.h"
00009
00010 winrt::CompositionAnimation ScrollingScrollAnimationStartingEventArgs::Animation()
00011 {
00012     return m_animation;
00013 }
00014
00015 void ScrollingScrollAnimationStartingEventArgs::Animation(winrt::CompositionAnimation const& value)
00016 {
00017     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_PTR, METH_NAME, this, value);
00018     if (!value)
00019     {
00020         throw winrt::hresult_invalid_argument(L"Animation cannot be set to null.");
00021     }
00022     m_animation = value;
00023 }
00024
00025 int32_t ScrollingScrollAnimationStartingEventArgs::CorrelationId()
00026 {
00027     return m_offsetsChangeCorrelationId;
00028 }
00029
00030 winrt::float2 ScrollingScrollAnimationStartingEventArgs::StartPosition()
00031 {
00032     return m_startPosition;
00033 }
00034
00035 winrt::float2 ScrollingScrollAnimationStartingEventArgs::EndPosition()
00036 {
00037     return m_endPosition;
00038 }
00039
00040 void ScrollingScrollAnimationStartingEventArgs::SetOffsetsChangeCorrelationId(int32_t offsetsChangeCorrelationId)
00041 {
00042     m_offsetsChangeCorrelationId = offsetsChangeCorrelationId;
00043 }
00044
00045 winrt::CompositionAnimation ScrollingScrollAnimationStartingEventArgs::GetAnimation() const
00046 {
00047     return m_animation;
00048 }
00049
00050 void ScrollingScrollAnimationStartingEventArgs::SetAnimation(const winrt::CompositionAnimation& animation)
00051 {
00052     m_animation = animation;
00053 }
00054
00055
00056 void ScrollingScrollAnimationStartingEventArgs::SetStartPosition(const winrt::float2& startPosition)
00057 {
00058     m_startPosition = startPosition;
00059 }
00060
00061
00062 void ScrollingScrollAnimationStartingEventArgs::SetEndPosition(const winrt::float2& endPosition)
00063 {
00064     m_endPosition = endPosition;
00065 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TwoPaneViewPage Member List

This is the complete list of members for TwoPaneViewPage, including all inherited members.
AddMarginCheckBox_Checked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) | TwoPaneViewPage | [inline, private]
AddMarginCheckBox_Unchecked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) | TwoPaneViewPage | [inline, private]
c_controlMargin | TwoPaneViewPage | [private]
c_defaultMinTallModeHeight | TwoPaneViewPage | [private]
c_defaultMinWideModeWidth | TwoPaneViewPage | [private]
c_simulatedMiddle | TwoPaneViewPage | [private]
c_simulatedPaneHeight | TwoPaneViewPage | [private]
c_simulatedPaneWidth | TwoPaneViewPage | [private]
HeightComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TwoPaneViewPage | [inline, private]
MinTallModeHeightTextBox_TextChanged(object sender, TextChangedEventArgs e) | TwoPaneViewPage | [inline, private]
MinWideModeWidthTextBox_TextChanged(object sender, TextChangedEventArgs e) | TwoPaneViewPage | [inline, private]
OneSideCheckBox_Checked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) | TwoPaneViewPage | [inline, private]
OneSideCheckBox_Unchecked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) | TwoPaneViewPage | [inline, private]
Pane1LengthComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TwoPaneViewPage | [inline, private]
Pane1LengthTextBox_TextChanged(object sender, TextChangedEventArgs e) | TwoPaneViewPage | [inline, private]
Pane2LengthComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TwoPaneViewPage | [inline, private]
Pane2LengthTextBox_TextChanged(object sender, TextChangedEventArgs e) | TwoPaneViewPage | [inline, private]
PanePriorityComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TwoPaneViewPage | [inline, private]
PaneSizeChanged(object sender, Microsoft.UI.Xaml.SizeChangedEventArgs e) | TwoPaneViewPage | [inline, private]
SimulateComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TwoPaneViewPage | [inline, private]
TallModeConfigurationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TwoPaneViewPage | [inline, private]
TwoPaneView_ModeChanged(TwoPaneView sender, object args) | TwoPaneViewPage | [inline, private]
TwoPaneView_SizeChanged(object sender, Microsoft.UI.Xaml.SizeChangedEventArgs e) | TwoPaneViewPage | [inline, private]
TwoPaneViewPage() | TwoPaneViewPage | [inline]
UpdateLength(int pane) | TwoPaneViewPage | [inline, private]
ViewModeToString(TwoPaneViewMode configuration) | TwoPaneViewPage | [inline, private]
WideModeConfigurationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TwoPaneViewPage | [inline, private]
WidthComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | TwoPaneViewPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarAutomationPeer.idl Source File

  • InkToolBar

InkToolBarAutomationPeer.idl

Go to the documentation of this file.
00001 namespace MU_XAP_NAMESPACE
00002 {
00003     [MUX_PREVIEW]
00004     unsealed runtimeclass InkToolBarAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer
00005     {
00006         InkToolBarAutomationPeer(MU_XC_NAMESPACE.InkToolBar owner);
00007     }
00008
00009     [MUX_PREVIEW]
00010     unsealed runtimeclass InkToolBarToolButtonAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.RadioButtonAutomationPeer
00011     {
00012         InkToolBarToolButtonAutomationPeer(MU_XC_NAMESPACE.InkToolBarToolButton owner);
00013     }
00014
00015     [MUX_PREVIEW]
00016     unsealed runtimeclass InkToolBarMenuButtonAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.ToggleButtonAutomationPeer
00017     {
00018         InkToolBarMenuButtonAutomationPeer(MU_XC_NAMESPACE.InkToolBarMenuButton owner);
00019     }
00020
00021     [MUX_PREVIEW]
00022     [default_interface]
00023     unsealed runtimeclass InkToolBarFlyoutItemAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.ButtonBaseAutomationPeer
00024     {
00025         InkToolBarFlyoutItemAutomationPeer(MU_XC_NAMESPACE.InkToolBarFlyoutItem owner);
00026     }
00027 }
00028
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MenuBar/MenuBar.h Source File

  • MenuBar

MenuBar.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "MenuBar.g.h"
00007 #include "MenuBar.properties.h"
00008
00009 class MenuBar :
00010     public ReferenceTracker<MenuBar, winrt::implementation::MenuBarT>,
00011     public MenuBarProperties
00012 {
00013 public:
00014     MenuBar();
00015
00016     void OnApplyTemplate();
00017
00018     bool IsFlyoutOpen() { return m_isFlyoutOpen; };
00019     void IsFlyoutOpen(bool state);
00020
00021     void RequestPassThroughElement(const winrt::Microsoft::UI::Xaml::Controls::MenuBarItem& menuBarItem);
00022
00023 public:
00024     // IUIElement / IUIElementOverridesHelper
00025     winrt::AutomationPeer OnCreateAutomationPeer();
00026
00027 private:
00028
00029     void SetUpTemplateParts();
00030     void UpdateAutomationSizeAndPosition();
00031
00032     bool m_isFlyoutOpen{ false };
00033     winrt::IObservableVector<winrt::MenuBarItem>::VectorChanged_revoker m_itemsVectorChangedRevoker{};
00034
00035     // Visual components
00036     tracker_ref<winrt::ItemsControl> m_contentRoot{ this };
00037     tracker_ref<winrt::Grid> m_layoutRoot{ this };
00038 };
00039
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsRepeaterElementIndexChangedEventArgs Member List

This is the complete list of members for ItemsRepeaterElementIndexChangedEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
CheckThread() | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< ItemsRepeaterElementIndexChangedEventArgs > &&self) noexcept | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline, static]
Element() | ItemsRepeaterElementIndexChangedEventArgs |
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
final_release(std::unique_ptr< ItemsRepeaterElementIndexChangedEventArgs > &&self) | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline, static]
GetBase() | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
GetInner() | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
IsOnThread() | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
ItemsRepeaterElementIndexChangedEventArgs(const winrt::UIElement &element, int oldIndex, int newIndex) | ItemsRepeaterElementIndexChangedEventArgs |
m_newIndex | ItemsRepeaterElementIndexChangedEventArgs | [private]
m_oldIndex | ItemsRepeaterElementIndexChangedEventArgs | [private]
NewIndex() | ItemsRepeaterElementIndexChangedEventArgs |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
OldIndex() | ItemsRepeaterElementIndexChangedEventArgs |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ItemsRepeaterElementIndexChangedEventArgs, winrt::implementation::ItemsRepeaterElementIndexChangedEventArgsT, winrt::composable, winrt::composing > | [inline]
Update(const winrt::UIElement &element, int oldIndex, int newIndex) | ItemsRepeaterElementIndexChangedEventArgs |
Generated on Sun Dec 1 2024 20:52:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/ScrollViewerIRefreshInfoProviderAdapter/InteractionTests/ScrollViewerAdapterTests.cs Source File

  • PullToRefresh
  • ScrollViewerIRefreshInfoProviderAdapter
  • InteractionTests

ScrollViewerAdapterTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00006 using Common;
00007
00008 using WEX.TestExecution;
00009 using WEX.TestExecution.Markup;
00010 using WEX.Logging.Interop;
00011
00012 using Microsoft.Windows.Apps.Test.Automation;
00013 using Microsoft.Windows.Apps.Test.Foundation;
00014 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00015 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00016 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00017
00018 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00019 {
00020     [TestClass]
00021     public class ScrollViewerAdapterTests
00022     {
00023         [ClassInitialize]
00024         [TestProperty("RunAs", "User")]
00025         [TestProperty("Classification", "Integration")]
00026         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00027         public static void ClassInitialize(TestContext testContext)
00028         {
00029             TestEnvironment.Initialize(testContext);
00030         }
00031
00032         [TestCleanup]
00033         public void TestCleanup()
00034         {
00035             TestCleanupHelper.Cleanup();
00036         }
00037
00038         [TestMethod]
00039         public void DeconstructionHandlesCorrectlyTest()
00040         {
00041             using (var setup = new TestSetupHelper("ScrollViewerAdapter Tests")) // This literally clicks the button corresponding to the test page.
00042             {
00043                 Log.Comment("Retrieve AdaptOnSVWithoutWaitingForLoadedButton button.");
00044                 UIObject AdaptOnSVWithoutWaitingForLoadedButtonUIObject = FindElement.ByName("AdaptOnSVWithoutWaitingForLoadedButton");
00045                 Verify.IsNotNull(AdaptOnSVWithoutWaitingForLoadedButtonUIObject, "Verifying that we found a UIElement called AdaptOnSVWithoutWaitingForLoadedButton");
00046
00047                 Log.Comment("Retrieve RemoveButton button.");
00048                 UIObject RemoveButtonUIObject = FindElement.ByName("RemoveButton");
00049                 Verify.IsNotNull(RemoveButtonUIObject, "Verifying that we found a UIElement called RemoveButton");
00050
00051                 Log.Comment("Retrieve GCButton button.");
00052                 UIObject GCButtonUIObject = FindElement.ByName("GCButton");
00053                 Verify.IsNotNull(GCButtonUIObject, "Verifying that we found a UIElement called GCButton");
00054
00055                 Log.Comment("Retrieve CheckLeaksButton button.");
00056                 UIObject CheckLeaksButtonUIObject = FindElement.ByName("CheckLeaksButton");
00057                 Verify.IsNotNull(CheckLeaksButtonUIObject, "Verifying that we found a UIElement called CheckLeaksButton");
00058
00059                 InputHelper.Tap(AdaptOnSVWithoutWaitingForLoadedButtonUIObject);
00060                 InputHelper.Tap(RemoveButtonUIObject);
00061                 InputHelper.Tap(GCButtonUIObject);
00062                 InputHelper.Tap(CheckLeaksButtonUIObject);
00063             }
00064         }
00065     }
00066 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/ColorSpectrumAutomationPeer.cpp Source File

  • ColorPicker

ColorSpectrumAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ColorSpectrumAutomationPeer.h"
00007
00008 #include "ResourceAccessor.h"
00009 #include "Utils.h"
00010
00011 #include "ColorSpectrumAutomationPeer.properties.cpp"
00012
00013 ColorSpectrumAutomationPeer::ColorSpectrumAutomationPeer(winrt::ColorSpectrum const& owner) :
00014     ReferenceTracker(owner)
00015 {
00016 }
00017
00018 winrt::IInspectable ColorSpectrumAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00019 {
00020     if (patternInterface == winrt::PatternInterface::Value)
00021     {
00022         return *this;
00023     }
00024
00025     return __super::GetPatternCore(patternInterface);
00026 }
00027
00028 winrt::AutomationControlType ColorSpectrumAutomationPeer::GetAutomationControlTypeCore()
00029 {
00030     return winrt::AutomationControlType::Slider;
00031 }
00032
00033 winrt::hstring ColorSpectrumAutomationPeer::GetLocalizedControlTypeCore()
00034 {
00035     return ResourceAccessor::GetLocalizedStringResource(SR_LocalizedControlTypeColorSpectrum);
00036 }
00037
00038 winrt::hstring ColorSpectrumAutomationPeer::GetNameCore()
00039 {
00040     winrt::hstring nameString = __super::GetNameCore();
00041
00042     // If a name hasn't been provided by AutomationProperties.Name in markup,
00043     // then we'll return the default value.
00044     if (nameString.empty())
00045     {
00046         nameString = ResourceAccessor::GetLocalizedStringResource(SR_AutomationNameColorSpectrum);
00047     }
00048
00049     return nameString;
00050 }
00051
00052 winrt::hstring ColorSpectrumAutomationPeer::GetClassNameCore()
00053 {
00054     return winrt::hstring_name_of<winrt::ColorSpectrum>();
00055 }
00056
00057 winrt::hstring ColorSpectrumAutomationPeer::GetHelpTextCore()
00058 {
00059     return ResourceAccessor::GetLocalizedStringResource(SR_HelpTextColorSpectrum);
00060 }
00061
00062 winrt::Rect ColorSpectrumAutomationPeer::GetBoundingRectangleCore()
00063 {
00064     winrt::Rect boundingRectangle = winrt::get_self<ColorSpectrum>(Owner().as<winrt::ColorSpectrum>())->GetBoundingRectangle();
00065     return boundingRectangle;
00066 }
00067
00068 winrt::Point ColorSpectrumAutomationPeer::GetClickablePointCore()
00069 {
00070     const auto boundingRect = GetBoundingRectangleCore(); // Call potentially overridden method
00071
00072     return winrt::Point{ boundingRect.X + boundingRect.Width / 2, boundingRect.Y + boundingRect.Height / 2 };
00073 }
00074
00075 bool ColorSpectrumAutomationPeer::IsReadOnly()
00076 {
00077     return false;
00078 }
00079
00080 winrt::hstring ColorSpectrumAutomationPeer::Value()
00081 {
00082     const winrt::ColorSpectrum colorSpectrumOwner = Owner().as<winrt::ColorSpectrum>();
00083     const winrt::Color color = colorSpectrumOwner.Color();
00084     const winrt::float4 hsvColor = colorSpectrumOwner.HsvColor();
00085
00086     return GetValueString(color, hsvColor);
00087 }
00088
00089 void ColorSpectrumAutomationPeer::SetValue(winrt::hstring const& value)
00090 {
00091     winrt::ColorSpectrum colorSpectrumOwner = Owner().as<winrt::ColorSpectrum>();
00092     winrt::Color color = unbox_value<winrt::Color>(winrt::XamlBindingHelper::ConvertValue({ winrt::hstring_name_of<winrt::Color>(), winrt::TypeKind::Metadata }, box_value(value)));
00093
00094     colorSpectrumOwner.Color(color);
00095
00096     // Since ColorPicker sets ColorSpectrum.Color and ColorPicker also responds to ColorSpectrum.ColorChanged,
00097     // we could get into an infinite loop if we always raised ColorSpectrum.ColorChanged when ColorSpectrum.Color changed.
00098     // Because of that, we'll raise the event manually.
00099     winrt::get_self<ColorSpectrum>(colorSpectrumOwner)->RaiseColorChanged();
00100 }
00101
00102 void ColorSpectrumAutomationPeer::RaisePropertyChangedEvent(winrt::Color oldColor, winrt::Color newColor, winrt::float4 oldHsvColor, winrt::float4 newHsvColor)
00103 {
00104     winrt::hstring oldValueString = GetValueString(oldColor, oldHsvColor);
00105     winrt::hstring newValueString = GetValueString(newColor, newHsvColor);
00106
00107     __super::RaisePropertyChangedEvent(winrt::ValuePatternIdentifiers::ValueProperty(), box_value(oldValueString), box_value(newValueString));
00108 }
00109
00110 winrt::hstring ColorSpectrumAutomationPeer::GetValueString(winrt::Color color, winrt::float4 hsvColor)
00111 {
00112     const auto hue = static_cast<unsigned int>(round(hsv::GetHue(hsvColor)));
00113     const auto saturation = static_cast<unsigned int>(round(hsv::GetSaturation(hsvColor) * 100));
00114     const auto value = static_cast<unsigned int>(round(hsv::GetValue(hsvColor) * 100));
00115
00116     return StringUtil::FormatString(
00117         ResourceAccessor::GetLocalizedStringResource(SR_ValueStringColorSpectrumWithColorName),
00118         winrt::ColorDisplayNameHelper::ToDisplayName(color).data(),
00119         hue, saturation, value);
00120 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectionTests Member List

This is the complete list of members for SelectionTests, including all inherited members.
CanSelectItemInFlyoutAndNVIGetsCollapsedOnFlyoutClose() | SelectionTests | [inline]
CanSelectNavigationViewItemWithChildren() | SelectionTests | [inline]
CheckSelectedItemEdgeCase() | SelectionTests | [inline]
ClassInitialize(TestContext testContext) | SelectionTests | [inline, static]
ClickClearSelectionButton() | NavigationViewTestsBase | [inline, protected]
ComboBoxName enum name | NavigationViewTestsBase | [protected]
compact | NavigationViewTestsBase | [protected]
ControlHeight enum name | NavigationViewTestsBase | [protected]
ControlWidth enum name | NavigationViewTestsBase | [protected]
DisplayModeChangeSelectionEventTest() | SelectionTests | [inline]
EnsureNavViewClosed() | NavigationViewTestsBase | [inline, protected]
EnsurePaneHeaderCanBeModifiedHelper(RegressionTestType navviewMode) | NavigationViewTestsBase | [inline, protected]
expanded | NavigationViewTestsBase | [protected]
GetTopNavigationItems(TopNavPosition position) | NavigationViewTestsBase | [inline, protected]
InvokeNavigationViewAccessKeyAndVerifyKeyTipPlacement(string expectedKeyTipTargetElementId) | NavigationViewTestsBase | [inline, protected]
InvokeOverflowButton() | NavigationViewTestsBase | [inline, protected]
IsItemInTopNavPrimaryList(string text) | NavigationViewTestsBase | [inline, protected]
MenuItemAutomationSelectionTest() | SelectionTests | [inline]
minimal | NavigationViewTestsBase | [protected]
ModifyCollectionOnItemInvokeTest() | SelectionTests | [inline]
OpenOverflowMenuAndInvokeItem(string itemName) | NavigationViewTestsBase | [inline, protected]
PaneOpenCloseTestCaseRetry(int retryNumber, Action action) | NavigationViewTestsBase | [inline, protected]
PaneOpenStatus enum name | NavigationViewTestsBase | [protected]
SelectingNonTopLevelItemInOverflow() | SelectionTests | [inline]
SelectionFollowFocusTest() | SelectionTests | [inline]
SetNavViewHeight(ControlHeight height) | NavigationViewTestsBase | [inline, protected]
SetNavViewWidth(ControlWidth width) | NavigationViewTestsBase | [inline, protected]
SetThreshold(Threshold threshold, ComboBoxName name) | NavigationViewTestsBase | [inline, protected]
SettingsCanBeUnselected() | SelectionTests | [inline]
SuppressSelectionItemInvokeTest() | SelectionTests | [inline]
TestCleanup() | NavigationViewTestsBase | [inline]
Threshold enum name | NavigationViewTestsBase | [protected]
TopNavPosition enum name | NavigationViewTestsBase | [protected]
UIObjectContains(UIObject uIObject, string itemName) | NavigationViewTestsBase | [inline, protected]
UIObjectToString(UIObject uIObject) | NavigationViewTestsBase | [inline, protected]
VerifyBackAndCloseButtonsVisibility(bool inLeftMinimalPanelDisplayMode) | NavigationViewTestsBase | [inline, protected]
VerifyDataContextCanBeUsedForNavigation() | SelectionTests | [inline]
VerifyDeselectionDisabled() | SelectionTests | [inline]
VerifyNavigationViewItemIsSelectedWorks() | SelectionTests | [inline]
VerifyNoCrashWhenSelectedItemIsInvalidItem() | SelectionTests | [inline]
VerifyNVIItemsRepeaterIsLoadedAfterSelectionSetInMarkup() | SelectionTests | [inline]
VerifySelectedItemInInvokedItem() | SelectionTests | [inline]
VerifySelectionItemPatternDoesInvoke() | SelectionTests | [inline]
VerifySettingCustomSelectedItemInConstructorWorks() | SelectionTests | [inline]
WaitAndAssertPaneStatus(PaneOpenStatus status) | NavigationViewTestsBase | [inline, protected]
Generated on Sun Dec 1 2024 20:53:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/SelectorBase.cpp Source File

  • ItemsView

SelectorBase.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SelectorBase.h"
00007
00008 SelectorBase::SelectorBase()
00009 {
00010     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00011 }
00012
00013 SelectorBase::~SelectorBase()
00014 {
00015     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00016 }
00017
00018 void SelectorBase::SetSelectionModel(winrt::SelectionModel const& selectionModel)
00019 {
00020     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_PTR, METH_NAME, this, selectionModel);
00021
00022     m_selectionModel = selectionModel;
00023 }
00024
00025 void SelectorBase::DeselectWithAnchorPreservation(int index)
00026 {
00027     MUX_ASSERT(index != -1);
00028
00029     if (m_selectionModel != nullptr)
00030     {
00031         auto const& anchorIndexPath = m_selectionModel.AnchorIndex();
00032
00033         MUX_ASSERT(anchorIndexPath == nullptr || anchorIndexPath.GetSize() == 1);
00034
00035         const int anchorIndex = anchorIndexPath == nullptr ? -1 : anchorIndexPath.GetAt(0);
00036
00037         m_selectionModel.Deselect(index);
00038
00039         if (anchorIndex != -1)
00040         {
00041             m_selectionModel.SetAnchorIndex(anchorIndex);
00042         }
00043     }
00044 }
00045
00046 bool SelectorBase::IsSelected(winrt::IndexPath const& index)
00047 {
00048     bool isSelected = false;
00049
00050     if (m_selectionModel != nullptr)
00051     {
00052         winrt::IReference<bool> isSelectedNullable = m_selectionModel.IsSelectedAt(index);
00053
00054         if (isSelectedNullable != nullptr)
00055         {
00056             isSelected = isSelectedNullable.Value();
00057         }
00058     }
00059
00060     return isSelected;
00061 }
00062
00063 bool SelectorBase::CanSelect(winrt::IndexPath const& index)
00064 {
00065     return m_selectionModel != nullptr;
00066 }
00067
00068 void SelectorBase::SelectAll()
00069 {
00070     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00071
00072     if (m_selectionModel != nullptr)
00073     {
00074         m_selectionModel.SelectAll();
00075     }
00076 }
00077
00078 void SelectorBase::Clear()
00079 {
00080     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00081
00082     if (m_selectionModel != nullptr)
00083     {
00084         m_selectionModel.ClearSelection();
00085     }
00086 }
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MockElementFactory Member List

This is the complete list of members for MockElementFactory, including all inherited members.
_recordedGetElementCalls | MockElementFactory | [private]
_recordedRecycleElementCalls | MockElementFactory | [private]
ClearElementFunc | MockElementFactory |
CreateElementFactory< T >(List< T > mapping) | MockElementFactory | [inline, static]
CreateElementFactory< T >(Dictionary< int, T > mapping) | MockElementFactory | [inline, static]
GetElementCore(ElementFactoryGetArgs args) | MockElementFactory | [inline, protected]
GetElementFunc | MockElementFactory |
RecycleElementCore(ElementFactoryRecycleArgs args) | MockElementFactory | [inline, protected]
ValidateGetElementCalls(params GetElementCallInfo[] expected) | MockElementFactory | [inline]
ValidateRecycleElementCalls(params RecycleElementCallInfo[] expected) | MockElementFactory | [inline]
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ToggleAnimatedIconHost Member List

This is the complete list of members for ToggleAnimatedIconHost, including all inherited members.
AnimatedIconTestHooks_LastAnimationSegmentChanged(AnimatedIcon sender, object args) | ToggleAnimatedIconHost | [inline, private]
GetAnimatedIcon() | ToggleAnimatedIconHost | [inline]
IconSource | ToggleAnimatedIconHost |
IconSourceChanged() | ToggleAnimatedIconHost | [inline, private]
IconSourceProperty | ToggleAnimatedIconHost | [static]
m_iconPresenter | ToggleAnimatedIconHost | [private]
m_transitionTextBlock | ToggleAnimatedIconHost | [private]
OnApplyTemplate() | ToggleAnimatedIconHost | [inline, protected]
OnIconSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ToggleAnimatedIconHost | [inline, private, static]
Title | ToggleAnimatedIconHost |
TitleProperty | ToggleAnimatedIconHost | [static]
ToggleAnimatedIconHost() | ToggleAnimatedIconHost | [inline]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommandBarFlyout Member List

This is the complete list of members for CommandBarFlyout, including all inherited members.
abi_enter() | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
AddDropShadow() | CommandBarFlyout |
AlwaysExpanded() | CommandBarFlyout | [inline]
AlwaysExpanded(bool value) | CommandBarFlyout | [inline]
CheckThread() | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
CommandBarFlyout() | CommandBarFlyout |
CreatePresenter() | CommandBarFlyout |
DeleteInstanceOnUIThread(std::unique_ptr< CommandBarFlyout > &&self) noexcept | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
final_release(std::unique_ptr< CommandBarFlyout > &&self) | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline, static]
GetBase() | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
GetInner() | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
GetPresenter() | CommandBarFlyout |
HookAllCommandBarElementDependencyPropertyChanges() | CommandBarFlyout | [private]
HookAppBarButtonDependencyPropertyChanges(winrt::AppBarButton const &appBarButton, int index) | CommandBarFlyout | [private]
HookAppBarToggleButtonDependencyPropertyChanges(winrt::AppBarToggleButton const &appBarToggleButton, int index) | CommandBarFlyout | [private]
IsOnThread() | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
m_propertyChangedRevokersByIndexMap | CommandBarFlyout | [private]
m_secondaryButtonClickRevokerByIndexMap | CommandBarFlyout | [private]
m_secondaryToggleButtonCheckedRevokerByIndexMap | CommandBarFlyout | [private]
m_secondaryToggleButtonUncheckedRevokerByIndexMap | CommandBarFlyout | [private]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
OnCommandBarElementDependencyPropertyChanged(winrt::DependencyObject const &dependencyObject, winrt::DependencyProperty const &dependencyProperty) | CommandBarFlyout | [private]
PrimaryCommands() | CommandBarFlyout |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< CommandBarFlyout, winrt::implementation::CommandBarFlyoutT > | [inline]
RemoveDropShadow() | CommandBarFlyout |
s_appBarButtonDependencyProperties | CommandBarFlyout | [private, static]
s_appBarToggleButtonDependencyProperties | CommandBarFlyout | [private, static]
SecondaryCommands() | CommandBarFlyout |
SetSecondaryCommandsToCloseWhenExecuted() | CommandBarFlyout | [private]
UnhookAllCommandBarElementDependencyPropertyChanges() | CommandBarFlyout | [private]
UnhookCommandBarElementDependencyPropertyChanges(int index, bool eraseRevokers=true) | CommandBarFlyout | [private]
~CommandBarFlyout() | CommandBarFlyout |
Generated on Sun Dec 1 2024 20:52:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

WinRTCollection Member List

This is the complete list of members for WinRTCollection, including all inherited members.
Add(object item) | WinRTCollection | [inline]
Clear() | WinRTCollection | [inline]
Contains(object item) | WinRTCollection | [inline]
CopyTo(object[] array, int arrayIndex) | WinRTCollection | [inline]
Count | WinRTCollection |
GetEnumerator() | WinRTCollection | [inline]
GetEnumerator() | WinRTCollection | [inline, private]
IndexOf(object item) | WinRTCollection | [inline]
Insert(int index, object item) | WinRTCollection | [inline]
IsReadOnly | WinRTCollection |
m_data | WinRTCollection | [private]
Remove(object item) | WinRTCollection | [inline]
RemoveAt(int index) | WinRTCollection | [inline]
Reset() | WinRTCollection | [inline]
ResetWith(IEnumerable< object > enumerable) | WinRTCollection | [inline]
this | WinRTCollection |
VectorChanged | WinRTCollection |
WinRTCollection(IEnumerable< object > collection) | WinRTCollection | [inline]
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ImageIcon/ImageIcon.h Source File

  • ImageIcon

ImageIcon.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "ImageIcon.g.h"
00010 #include "ImageIcon.properties.h"
00011
00012 class ImageIcon :
00013     public ReferenceTracker<ImageIcon, DeriveFromBitmapIconHelper_base, winrt::ImageIcon>,
00014     public ImageIconProperties
00015 {
00016
00017 public:
00018     ImageIcon();
00019     ~ImageIcon() {}
00020
00021     // IFrameworkElement
00022     void OnApplyTemplate();
00023
00024     void OnSourcePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00025
00026 private:
00027
00028     tracker_ref<winrt::Image> m_rootImage{ this };
00029 };
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/SelectionSample/Flat/FlatSample.xaml.cs Source File

  • Repeater
  • TestUI
  • Samples
  • SelectionSample
  • Flat

FlatSample.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.ObjectModel;
00005 using System.ComponentModel;
00006 using System.Diagnostics;
00007 using System.Linq;
00008 using Microsoft.UI.Xaml;
00009 using Microsoft.UI.Xaml.Controls;
00010 using MUXControlsTestApp.Utilities;
00011
00012 namespace MUXControlsTestApp.Samples.Selection
00013 {
00014     public sealed partial class FlatSample : Page
00015     {
00016         ObservableCollection<string> _data = new ObservableCollection<string>(Enumerable.Range(0, 1000).Select(x => x.ToString()));
00017         public FlatSample()
00018         {
00019             this.InitializeComponent();
00020             repeater.ItemTemplate = elementFactory;
00021             repeater.ItemsSource = _data;
00022             selectionModel.Source = _data;
00023             repeater.ElementPrepared += Repeater_ElementPrepared;
00024             repeater.ElementIndexChanged += Repeater_ElementIndexChanged;
00025             selectionModel.PropertyChanged += SelectionModel_PropertyChanged;
00026         }
00027
00028         private void SelectionModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
00029         {
00030             var manager = sender as SelectionModel;
00031             if (e.PropertyName == "SelectedItem")
00032             {
00033                 Debug.WriteLine("SelectedItem changed");
00034                 Debug.WriteLine(manager.SelectedItem);
00035             }
00036             else if (e.PropertyName == "SelectedIndices")
00037             {
00038                 Debug.WriteLine("SelectedIndices changed");
00039                 for (int i = 0; i < manager.SelectedIndices.Count; i++)
00040                 {
00041                     Debug.WriteLine(string.Format("{0}:{1}", manager.SelectedIndices[i], manager.SelectedItems[i].ToString()));
00042                 }
00043             }
00044             else if (e.PropertyName == "SelectedItems")
00045             {
00046                 Debug.WriteLine("SelectedItems changed");
00047                 for (int i = 0; i < manager.SelectedIndices.Count; i++)
00048                 {
00049                     Debug.WriteLine(string.Format("{0}:{1}", manager.SelectedIndices[i], manager.SelectedItems[i].ToString()));
00050                 }
00051             }
00052             else if (e.PropertyName == "SelectedIndex")
00053             {
00054                 Debug.WriteLine("SelectedIndex changed");
00055                 Debug.WriteLine(manager.SelectedIndex);
00056             }
00057
00058             var icpp = (Microsoft.UI.Xaml.Data.ICustomPropertyProvider)selectionModel;
00059             var selectedItemProperty = icpp.GetCustomProperty("SelectedItem");
00060             var canRead = selectedItemProperty.CanRead;
00061             var selectedItem =  selectedItemProperty.GetValue(selectionModel);
00062         }
00063
00064         private void Repeater_ElementIndexChanged(ItemsRepeater sender, ItemsRepeaterElementIndexChangedEventArgs args)
00065         {
00066             (args.Element as RepeaterItem).RepeatedIndex = args.NewIndex;
00067         }
00068
00069         private void Repeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args)
00070         {
00071             (args.Element as RepeaterItem).RepeatedIndex = args.Index;
00072         }
00073
00074         private void OnMultipleSelectionClicked(object sender, RoutedEventArgs e)
00075         {
00076             selectionModel.SingleSelect = multipleSelection.IsChecked.Value ? false : true;
00077         }
00078
00079         private void OnGroupedClicked(object sender, RoutedEventArgs e)
00080         {
00081             Frame.NavigateWithoutAnimation(typeof(GroupedSample));
00082         }
00083
00084         private void OnBackClicked(object sender, RoutedEventArgs e)
00085         {
00086             Frame.GoBack();
00087         }
00088
00089         private void insert_Click(object sender, RoutedEventArgs e)
00090         {
00091             var index = int.Parse(indexPath.Text);
00092             _data.Insert(index, "Insert:" + index.ToString());
00093         }
00094
00095         private void remove_Click(object sender, RoutedEventArgs e)
00096         {
00097             var index = int.Parse(indexPath.Text);
00098             _data.RemoveAt(index);
00099         }
00100
00101         private void clear_Click(object sender, RoutedEventArgs e)
00102         {
00103             _data.Move(0, 2);
00104             _data.Clear();
00105         }
00106     }
00107 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollingScrollAnimationStartingEventArgs Member List

This is the complete list of members for ScrollingScrollAnimationStartingEventArgs, including all inherited members.
Animation() | ScrollingScrollAnimationStartingEventArgs |
Animation(winrt::CompositionAnimation const &value) | ScrollingScrollAnimationStartingEventArgs |
CorrelationId() | ScrollingScrollAnimationStartingEventArgs |
EndPosition() | ScrollingScrollAnimationStartingEventArgs |
GetAnimation() const | ScrollingScrollAnimationStartingEventArgs |
ScrollingScrollAnimationStartingEventArgs() | ScrollingScrollAnimationStartingEventArgs | [inline]
SetAnimation(const winrt::CompositionAnimation &animation) | ScrollingScrollAnimationStartingEventArgs |
SetEndPosition(const winrt::float2 &endPosition) | ScrollingScrollAnimationStartingEventArgs |
SetOffsetsChangeCorrelationId(int32_t offsetsChangeCorrelationId) | ScrollingScrollAnimationStartingEventArgs |
SetStartPosition(const winrt::float2 &startPosition) | ScrollingScrollAnimationStartingEventArgs |
StartPosition() | ScrollingScrollAnimationStartingEventArgs |
~ScrollingScrollAnimationStartingEventArgs() | ScrollingScrollAnimationStartingEventArgs | [inline]
Generated on Sun Dec 1 2024 20:53:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/InteractionTests/BreadcrumbBarTests.cs Source File

  • Breadcrumb
  • InteractionTests

BreadcrumbBarTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005
00006 using Common;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Foundation;
00015 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00016 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00017 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00018 using System.Runtime.CompilerServices;
00019 using System.Threading;
00020 using System.Collections.ObjectModel;
00021 using Microsoft.Windows.Apps.Test.Automation.Text;
00022 using System.Drawing;
00023 using System.Runtime.InteropServices;
00024 using MUXTestInfra.Shared.Infra;
00025
00026 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00027 {
00028
00029     public class BreadcrumbBarItem : UIObject, IInvoke
00030     {
00031         public BreadcrumbBarItem(UIObject uiObject)
00032             : base(uiObject)
00033         {
00034             this.Initialize();
00035         }
00036
00037         private void Initialize()
00038         {
00039             _invokePattern = new InvokeImplementation(this);
00040         }
00041
00042         public void Invoke()
00043         {
00044             _invokePattern.Invoke();
00045         }
00046
00047         public UIEventWaiter GetInvokedWaiter()
00048         {
00049             return _invokePattern.GetInvokedWaiter();
00050         }
00051
00052         public void InvokeAndWait(TimeSpan? timeout = null)
00053         {
00054             using (var waiter = GetInvokedWaiter())
00055             {
00056                 Invoke();
00057                 if (timeout == null)
00058                 {
00059                     waiter.Wait();
00060                 }
00061                 else
00062                 {
00063                     waiter.Wait(timeout.Value);
00064                 }
00065             }
00066
00067             Wait.ForIdle();
00068         }
00069
00070         new public static IFactory<BreadcrumbBarItem> Factory
00071         {
00072             get
00073             {
00074                 if (null == BreadcrumbBarItem._factory)
00075                 {
00076                     BreadcrumbBarItem._factory = new BreadcrumbBarItemFactory();
00077                 }
00078                 return BreadcrumbBarItem._factory;
00079             }
00080         }
00081
00082         private IInvoke _invokePattern;
00083         private static IFactory<BreadcrumbBarItem> _factory = null;
00084
00085         private class BreadcrumbBarItemFactory : IFactory<BreadcrumbBarItem>
00086         {
00087             public BreadcrumbBarItem Create(UIObject element)
00088             {
00089                 return new BreadcrumbBarItem(element);
00090             }
00091         }
00092     }
00093
00094     [TestClass]
00095     public class BreadcrumbTests
00096     {
00097         [ClassInitialize]
00098         [TestProperty("RunAs", "User")]
00099         [TestProperty("Classification", "Integration")]
00100         [TestProperty("Platform", "Any")]
00101         public static void ClassInitialize(TestContext testContext)
00102         {
00103             TestEnvironment.Initialize(testContext);
00104         }
00105
00106         [TestCleanup]
00107         public void TestCleanup()
00108         {
00109             TestCleanupHelper.Cleanup();
00110         }
00111
00112         [TestMethod]
00113         [TestProperty("TestSuite", "A")]
00114         public void VerifyAxeScanPasses()
00115         {
00116             using (var setup = new TestSetupHelper("BreadcrumbBar-Axe"))
00117             {
00118                 AxeTestHelper.TestForAxeIssues();
00119             }
00120         }
00121
00122         [TestMethod]
00123         [TestProperty("TestSuite", "A")]
00124         public void NoInteractionTest()
00125         {
00126             // This is a sanity test that verifies that the BreadcrumbBar control exists and the basic setup for a test is correct
00127             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00128             {
00129                 UIObject breadcrumb = RetrieveBreadcrumbControl();
00130                 var breadcrumbItems = breadcrumb.Children;
00131
00132                 Verify.AreEqual(1, breadcrumbItems.Count, "The breadcrumb should contain 1 item.");
00133             }
00134         }
00135
00136         [TestMethod]
00137         [TestProperty("TestSuite", "A")]
00138         public void CheckCurrentItemDoesNotRaiseInvokeEvent()
00139         {
00140             // This is a sanity test that verifies that the BreadcrumbBar control exists and the basic setup for a test is correct
00141             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00142             {
00143                 UIObject breadcrumb = RetrieveBreadcrumbControl();
00144                 var breadcrumbItems = breadcrumb.Children;
00145
00146                 Verify.AreEqual(1, breadcrumbItems.Count, "The breadcrumb should contain 1 item.");
00147
00148                 var currentItem = breadcrumbItems[0];
00149
00150                 var currentBreadcrumbBarItem = ConvertTo<BreadcrumbBarItem>(currentItem);
00151                 Verify.IsNotNull(currentBreadcrumbBarItem, "UIElement should be a BreadcrumbBarItem");
00152
00153                 currentBreadcrumbBarItem.Click();
00154
00155                 VerifyLastClickedItemIs("");
00156                 Verify.AreEqual("Root", GetCurrentItemText(currentBreadcrumbBarItem));
00157             }
00158         }
00159
00160         [TestMethod]
00161         [TestProperty("TestSuite", "A")]
00162         public void AddItemsAndCompressBreadcrumbTest()
00163         {
00164             // In this test we add the nodes 'Node A', 'Node A_2', 'Node A_2_3', once the nodes have been added
00165             // we click on each item verify that the BreadcrumbBar contained the specified nodes. At the end, only the
00166             // ellipsis item and the 'Root' item should exist however ellipsis item is hidden from the UIA tree.
00167             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00168             {
00169                 var breadcrumb = SetUpTest();
00170
00171                 VerifyBreadcrumbBarItemsContain(breadcrumb.Children, new string[] { "Root", "Node A", "Node A_2", "Node A_2_3", "Node A_2_3_1" }, true);
00172
00173                 Verify.AreEqual(1, breadcrumb.Children.Count, "The breadcrumb should contain 1 item");
00174             }
00175         }
00176
00177         [TestMethod]
00178         [TestProperty("TestSuite", "A")]
00179         public void AddItemsAndInvokeBreadcrumbBarItemTest()
00180         {
00181             // In this test we add the breadcrumb Items 'Node A', 'Node A_2', 'Node A_2_3' & 'Node A_2_3_1'
00182             // Once those items have been added, we click on the 'Node A_2' item and verify that only the
00183             // ellipsis item, 'Root', 'Node A' and 'Node A_2' exist on the breadcrumb however ellipsis item is hidden from the UIA tree.
00184             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00185             {
00186                 var breadcrumb = SetUpTest();
00187
00188                 // Click on the Node A_2 BreadcrumbBarItem
00189                 var NodeA_2BreadcrumbBarItem = breadcrumb.Children[2];
00190                 NodeA_2BreadcrumbBarItem.Click();
00191
00192                 VerifyLastClickedItemIndexIs(2);
00193                 VerifyLastClickedItemIs("Node A_2");
00194
00195                 Verify.AreEqual(3, breadcrumb.Children.Count, "The breadcrumb should contain 3 items");
00196
00197                 VerifyBreadcrumbBarItemsContain(breadcrumb.Children, new string[] { "Root", "Node A", "Node A_2" });
00198             }
00199         }
00200
00201         [TestMethod]
00202         [TestProperty("TestSuite", "A")]
00203         public void InvokeEllipsisItemTest()
00204         {
00205             // In this test we add some items to the BreadcrumbBar, once all items have been added
00206             // the slider is clicked so nodes 'Node A_2', 'Node A' and 'Root' are crumbled.
00207             // Finally, we invoke the Ellipsis item to verify the crumbled nodes exist inside the flyout
00208             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00209             {
00210                 var breadcrumb = SetUpCrumbledTest();
00211
00212                 // Click on the Ellipsis BreadcrumbBarItem
00213                 InvokeEllipsisItem(breadcrumb);
00214
00215                 VerifyDropDownItemContainsText("Node A_2");
00216                 VerifyDropDownItemContainsText("Node A");
00217                 VerifyDropDownItemContainsText("Root");
00218
00219                 Log.Comment("Verify only 3 ellipsis items exist");
00220                 var ellipsisItem4 = FindElement.ByName("EllipsisItem4");
00221                 Verify.IsNull(ellipsisItem4, "EllipsisItem4 was found");
00222
00223                 Verify.AreEqual(6, breadcrumb.Children.Count, "The breadcrumb should contain 6 items: 5 items and ellipsis");
00224             }
00225         }
00226
00227         [TestMethod]
00228         [TestProperty("TestSuite", "A")]
00229         public void InvokeDropDownItemTest()
00230         {
00231             // All the steps performed in InvokeEllipsisItemTest are done, once that happens,
00232             // we invoke the 'Node A' item and we verify that only 'Root' and 'Node A' exist in the list
00233             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00234             {
00235                 var breadcrumb = SetUpCrumbledTest();
00236
00237                 // Click on the Ellipsis BreadcrumbBarItem
00238                 InvokeEllipsisItem(breadcrumb);
00239
00240                 var ellipsisItemNodeA = GetDropDownItemByName("Node A");
00241                 ellipsisItemNodeA.Invoke();
00242                 Thread.Sleep(500);
00243
00244                 VerifyBreadcrumbBarItemsContain(breadcrumb.Children, new string[] { "Root", "Node A" });
00245             }
00246         }
00247
00248         [TestMethod]
00249         [TestProperty("TestSuite", "A")]
00250         public void KeyboardNavigationLeftToRightTest()
00251         {
00252             using (var setup = new TestSetupHelper("BreadcrumbBar Tests", new TestSetupHelper.TestSetupHelperOptions { AutomaticCleanup = false }))
00253             {
00254                 var breadcrumb = SetUpTest();
00255                 var breadcrumbItems = breadcrumb.Children;
00256
00257                 var rtlCheckbox = RetrieveRTLCheckBox();
00258
00259                 SetFocusToFirstBreadcrumbBarItem(breadcrumb, false);
00260
00261                 KeyboardHelper.PressKey(Key.Right);
00262                 Verify.IsTrue(breadcrumbItems[1].HasKeyboardFocus, "'Node A' BreadcrumbBarItem should have focus");
00263
00264                 KeyboardHelper.PressKey(Key.Right);
00265                 Verify.IsTrue(breadcrumbItems[2].HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should have focus");
00266
00267                 KeyboardHelper.PressKey(Key.Right);
00268                 Verify.IsTrue(breadcrumbItems[3].HasKeyboardFocus, "'Node A_2_3' BreadcrumbBarItem should have focus");
00269
00270                 KeyboardHelper.PressKey(Key.Right);
00271                 Verify.IsTrue(breadcrumbItems[4].HasKeyboardFocus, "'Node A_2_3_1' BreadcrumbBarItem should have focus");
00272
00273                 KeyboardHelper.PressKey(Key.Right);
00274                 Verify.IsTrue(breadcrumbItems[4].HasKeyboardFocus, "'Node A_2_3_1' BreadcrumbBarItem should keep the focus");
00275
00276                 KeyboardHelper.PressKey(Key.Left);
00277                 Verify.IsTrue(breadcrumbItems[3].HasKeyboardFocus, "'Node A_2_3' BreadcrumbBarItem should have focus");
00278
00279                 KeyboardHelper.PressKey(Key.Left);
00280                 Verify.IsTrue(breadcrumbItems[2].HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should have focus");
00281
00282                 KeyboardHelper.PressKey(Key.Left);
00283                 Verify.IsTrue(breadcrumbItems[1].HasKeyboardFocus, "'Node A' BreadcrumbBarItem should have focus");
00284
00285                 KeyboardHelper.PressKey(Key.Left);
00286                 Verify.IsTrue(breadcrumbItems[0].HasKeyboardFocus, "'Root' BreadcrumbBarItem should have focus");
00287
00288                 // Bug to solve here
00289                 KeyboardHelper.PressKey(Key.Left);
00290                 Verify.IsTrue(breadcrumbItems[0].HasKeyboardFocus, "'Root' BreadcrumbBarItem should keep the focus");
00291
00292                 setup.AllowCleanup();
00293             }
00294         }
00295
00296         [TestMethod]
00297         [TestProperty("TestSuite", "A")]
00298         public void KeyboardNavigationRightToLeftTest()
00299         {
00300             using (var setup = new TestSetupHelper("BreadcrumbBar Tests", new TestSetupHelper.TestSetupHelperOptions { AutomaticCleanup = false }))
00301             {
00302                 var breadcrumb = SetUpTest();
00303                 var breadcrumbItems = breadcrumb.Children;
00304
00305                 var rtlCheckbox = RetrieveRTLCheckBox(true);
00306
00307                 SetFocusToFirstBreadcrumbBarItem(breadcrumb, false, true);
00308
00309                 KeyboardHelper.PressKey(Key.Left);
00310                 Verify.IsTrue(breadcrumbItems[1].HasKeyboardFocus, "'Node A' BreadcrumbBarItem should have focus");
00311
00312                 KeyboardHelper.PressKey(Key.Left);
00313                 Verify.IsTrue(breadcrumbItems[2].HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should have focus");
00314
00315                 KeyboardHelper.PressKey(Key.Left);
00316                 Verify.IsTrue(breadcrumbItems[3].HasKeyboardFocus, "'Node A_2_3' BreadcrumbBarItem should have focus");
00317
00318                 KeyboardHelper.PressKey(Key.Left);
00319                 Verify.IsTrue(breadcrumbItems[4].HasKeyboardFocus, "'Node A_2_3_1' BreadcrumbBarItem should have focus");
00320
00321                 KeyboardHelper.PressKey(Key.Left);
00322                 Verify.IsTrue(breadcrumbItems[4].HasKeyboardFocus, "'Node A_2_3_1' BreadcrumbBarItem should keep the focus");
00323
00324                 KeyboardHelper.PressKey(Key.Right);
00325                 Verify.IsTrue(breadcrumbItems[3].HasKeyboardFocus, "'Node A_2_3' BreadcrumbBarItem should have focus");
00326
00327                 KeyboardHelper.PressKey(Key.Right);
00328                 Verify.IsTrue(breadcrumbItems[2].HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should have focus");
00329
00330                 KeyboardHelper.PressKey(Key.Right);
00331                 Verify.IsTrue(breadcrumbItems[1].HasKeyboardFocus, "'Node A' BreadcrumbBarItem should have focus");
00332
00333                 KeyboardHelper.PressKey(Key.Right);
00334                 Verify.IsTrue(breadcrumbItems[0].HasKeyboardFocus, "'Root' BreadcrumbBarItem should have focus");
00335
00336                 // Bug to solve here
00337                 KeyboardHelper.PressKey(Key.Right);
00338                 Verify.IsTrue(breadcrumbItems[0].HasKeyboardFocus, "'Root' BreadcrumbBarItem should keep the focus");
00339
00340                 setup.AllowCleanup();
00341             }
00342         }
00343
00344         [TestMethod]
00345         [TestProperty("TestSuite", "A")]
00346         public void KeyboardNavigationForCrumbledLeftToRightTest()
00347         {
00348             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00349             {
00350                 var breadcrumb = SetUpCrumbledTest();
00351                 var breadcrumbItems = breadcrumb.Children;
00352
00353                 var rtlCheckbox = RetrieveRTLCheckBox();
00354
00355                 SetFocusToFirstBreadcrumbBarItem(breadcrumb, true);
00356
00357                 KeyboardHelper.PressKey(Key.Right);
00358                 Verify.IsTrue(breadcrumbItems[4].HasKeyboardFocus, "'Node A_2_3' BreadcrumbBarItem should have focus");
00359
00360                 KeyboardHelper.PressKey(Key.Right);
00361                 Verify.IsTrue(breadcrumbItems[5].HasKeyboardFocus, "'Node A_2_3_1' BreadcrumbBarItem should have focus");
00362
00363                 KeyboardHelper.PressKey(Key.Left);
00364                 Verify.IsTrue(breadcrumbItems[4].HasKeyboardFocus, "'Node A_2_3' BreadcrumbBarItem should have focus back");
00365
00366                 KeyboardHelper.PressKey(Key.Left);
00367                 Verify.IsTrue(breadcrumbItems[0].HasKeyboardFocus, "Ellipsis BreadcrumbBarItem should have focus back");
00368             }
00369         }
00370
00371         [TestMethod]
00372         [TestProperty("TestSuite", "A")]
00373         public void KeyboardNavigationForCrumbledRightToLeftTest()
00374         {
00375             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00376             {
00377                 var breadcrumb = SetUpCrumbledTest();
00378                 var breadcrumbItems = breadcrumb.Children;
00379
00380                 var rtlCheckbox = RetrieveRTLCheckBox(true);
00381
00382                 SetFocusToFirstBreadcrumbBarItem(breadcrumb, true);
00383
00384                 KeyboardHelper.PressKey(Key.Left);
00385                 Verify.IsTrue(breadcrumbItems[4].HasKeyboardFocus, "'Node A_2_3' BreadcrumbBarItem should have focus");
00386
00387                 KeyboardHelper.PressKey(Key.Left);
00388                 Verify.IsTrue(breadcrumbItems[5].HasKeyboardFocus, "'Node A_2_3_1' BreadcrumbBarItem should have focus");
00389
00390                 KeyboardHelper.PressKey(Key.Right);
00391                 Verify.IsTrue(breadcrumbItems[4].HasKeyboardFocus, "'Node A_2_3' BreadcrumbBarItem should have focus");
00392
00393                 KeyboardHelper.PressKey(Key.Right);
00394                 Verify.IsTrue(breadcrumbItems[0].HasKeyboardFocus, "Ellipsis BreadcrumbBarItem should have focus");
00395             }
00396         }
00397
00398         [TestMethod]
00399         [TestProperty("TestSuite", "A")]
00400         public void KeyboardNavigationFlyoutItemsTest()
00401         {
00402             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00403             {
00404                 var breadcrumb = SetUpCrumbledTest();
00405                 var breadcrumbItems = breadcrumb.Children;
00406
00407                 var rtlCheckbox = RetrieveRTLCheckBox();
00408
00409                 SetFocusToFirstBreadcrumbBarItem(breadcrumb, true);
00410
00411                 KeyboardHelper.PressKey(Key.Enter);
00412                 Thread.Sleep(1000);
00413
00414                 // Here we should verify that the first element in the flyout has focus and we can move up/down
00415
00416                 var dropDownItem = GetDropDownItemByName("Node A_2");
00417                 Verify.IsTrue(dropDownItem.HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should have focus");
00418
00419                 KeyboardHelper.PressKey(Key.Down);
00420
00421                 dropDownItem = GetDropDownItemByName("Node A");
00422                 Verify.IsTrue(dropDownItem.HasKeyboardFocus, "'Node A' BreadcrumbBarItem should have focus");
00423
00424                 KeyboardHelper.PressKey(Key.Down);
00425
00426                 dropDownItem = GetDropDownItemByName("Root");
00427                 Verify.IsTrue(dropDownItem.HasKeyboardFocus, "'Root' BreadcrumbBarItem should have focus");
00428
00429                 KeyboardHelper.PressKey(Key.Up);
00430
00431                 dropDownItem = GetDropDownItemByName("Node A");
00432                 Verify.IsTrue(dropDownItem.HasKeyboardFocus, "'Node A' BreadcrumbBarItem should have focus");
00433
00434                 KeyboardHelper.PressKey(Key.Up);
00435
00436                 dropDownItem = GetDropDownItemByName("Node A_2");
00437                 Verify.IsTrue(dropDownItem.HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should have focus");
00438             }
00439         }
00440
00441         [TestMethod]
00442         [TestProperty("TestSuite", "A")]
00443         public void KeyboardNavigationItemInvokationTest()
00444         {
00445             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00446             {
00447                 var breadcrumb = SetUpTest();
00448                 var breadcrumbItems = breadcrumb.Children;
00449
00450                 var rtlCheckbox = RetrieveRTLCheckBox();
00451
00452                 SetFocusToFirstBreadcrumbBarItem(breadcrumb, false);
00453
00454                 KeyboardHelper.PressKey(Key.Right);
00455                 Verify.IsTrue(breadcrumbItems[1].HasKeyboardFocus, "'Node A' BreadcrumbBarItem should have focus");
00456
00457                 KeyboardHelper.PressKey(Key.Right);
00458                 Verify.IsTrue(breadcrumbItems[2].HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should have focus");
00459
00460                 KeyboardHelper.PressKey(Key.Enter);
00461
00462                 VerifyLastClickedItemIndexIs(2);
00463                 VerifyLastClickedItemIs("Node A_2");
00464
00465                 // Possible bug to solve here
00466                 // Verify.IsTrue(breadcrumbItems[3].HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should keep focus");
00467
00468                 Verify.AreEqual(3, breadcrumb.Children.Count, "The breadcrumb should contain 3 items.");
00469
00470                 VerifyBreadcrumbBarItemsContain(breadcrumb.Children, new string[] { "Root", "Node A", "Node A_2" });
00471             }
00472         }
00473
00474         [TestMethod]
00475         [TestProperty("TestSuite", "A")]
00476         public void KeyboardNavigationDropDownItemInvokationTest()
00477         {
00478             using(var setup = new TestSetupHelper("BreadcrumbBar Tests", new TestSetupHelper.TestSetupHelperOptions { AutomaticCleanup = false }))
00479             {
00480                 var breadcrumb = SetUpCrumbledTest();
00481                 var breadcrumbItems = breadcrumb.Children;
00482
00483                 var rtlCheckbox = RetrieveRTLCheckBox();
00484
00485                 SetFocusToFirstBreadcrumbBarItem(breadcrumb, true);
00486
00487                 KeyboardHelper.PressKey(Key.Enter);
00488                 Thread.Sleep(1000);
00489
00490                 // Here we should verify that the first element in the flyout has focus and we can move up/down
00491                 // The flyout items should contain: "Node A_2", "Node A" and "Root"
00492                 var dropDownItem = GetDropDownItemByName("Node A_2");
00493                 Verify.IsTrue(dropDownItem.HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should have focus");
00494
00495                 KeyboardHelper.PressKey(Key.Down);
00496
00497                 dropDownItem = GetDropDownItemByName("Node A");
00498                 Verify.IsTrue(dropDownItem.HasKeyboardFocus, "'Node A' BreadcrumbBarItem should have focus");
00499
00500                 KeyboardHelper.PressKey(Key.Enter);
00501
00502                 VerifyLastClickedItemIndexIs(1);
00503                 VerifyLastClickedItemIs("Node A");
00504
00505                 // Possible bug to solve here
00506                 // Verify.IsTrue(breadcrumbItems[2].HasKeyboardFocus, "'Node A_2' BreadcrumbBarItem should keep focus");
00507
00508                 Verify.AreEqual(2, breadcrumb.Children.Count, "The breadcrumb should contain 2 items.");
00509
00510                 VerifyBreadcrumbBarItemsContain(breadcrumb.Children, new string[] { "Root", "Node A" });
00511
00512                 setup.AllowCleanup();
00513             }
00514         }
00515
00516         [TestMethod]
00517         [TestProperty("TestSuite", "A")]
00518         public void VerifyMulticlickCrash()
00519         {
00520             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00521             {
00522                 UIObject breadcrumb = RetrieveBreadcrumbControl();
00523                 ClickOnElements(new string[] { "Node A", "Node A_1" });
00524
00525                 UIObject slider = RetrieveWidthSlider();
00526                 slider.Click(PointerButtons.Primary, 1, slider.BoundingRectangle.Height / 2);
00527
00528                 InvokeEllipsisItem(breadcrumb);
00529
00530                 var ellipsisItemNodeA = VerifyDropDownItemContainsText("Root");
00531                 ellipsisItemNodeA.Invoke();
00532                 Thread.Sleep(500);
00533
00534                 for (int i = 0; i < 5; ++i)
00535                 {
00536                     breadcrumb.Children[0].Click();
00537
00538                     VerifyLastClickedItemIndexIs(0);
00539                     VerifyLastClickedItemIs("Root");
00540                 }
00541             }
00542         }
00543
00544         [TestMethod]
00545         [TestProperty("TestSuite", "A")]
00546         public void VerifyFlyoutRecycleCrash()
00547         {
00548             using (var setup = new TestSetupHelper("BreadcrumbBar Tests"))
00549             {
00550                 UIObject breadcrumb = SetUpCrumbledTest();
00551
00552                 UIObject slider = RetrieveWidthSlider();
00553                 slider.Click(PointerButtons.Primary, 1, slider.BoundingRectangle.Height / 2);
00554
00555                 InvokeEllipsisItem(breadcrumb);
00556
00557                 var ellipsisItemNodeA_2_3 = GetDropDownItemByName("Node A_2_3");
00558                 ellipsisItemNodeA_2_3.Invoke();
00559                 Thread.Sleep(500);
00560
00561                 InvokeEllipsisItem(breadcrumb);
00562             }
00563         }
00564
00565         private UIObject SetUpTest()
00566         {
00567             UIObject breadcrumb = RetrieveBreadcrumbControl();
00568             ClickOnElements(new string[] { "Node A", "Node A_2", "Node A_2_3", "Node A_2_3_1" });
00569
00570             var breadcrumbItems = breadcrumb.Children;
00571             Verify.AreEqual(5, breadcrumbItems.Count, "The breadcrumb should contain 5 items");
00572
00573             return breadcrumb;
00574         }
00575
00576         private UIObject SetUpCrumbledTest()
00577         {
00578             var breadcrumb = SetUpTest();
00579
00580             UIObject slider = RetrieveWidthSlider();
00581             slider.Click(PointerButtons.Primary, (slider.BoundingRectangle.Width / 3) - 10, slider.BoundingRectangle.Height / 2);
00582
00583             Verify.AreEqual(6, breadcrumb.Children.Count, "The breadcrumb should contain 6 items: 5 items and ellipsis");
00584
00585             return breadcrumb;
00586         }
00587
00588         private void InvokeEllipsisItem(UIObject breadcrumb)
00589         {
00590             var ellipsisItem = ConvertTo<BreadcrumbBarItem>(breadcrumb.Children[0]);
00591             ellipsisItem.Invoke();
00592
00593             Thread.Sleep(1000);
00594         }
00595
00596         private bool TryGetFocusForRs2(UIObject breadcrumb, int indexToFocus, bool isEllipsisVisible)
00597         {
00598             Log.Comment("Try Set focus for RS2 build");
00599
00600             UIObject anchor = RetrieveRTLCheckBox();
00601             FocusHelper.SetFocus(anchor);
00602
00603             // For RS2 we need only one Tab key stroke if the ellipsis is onscreen and 2 if it's not
00604             KeyboardHelper.PressKey(Key.Tab);
00605
00606             if (!isEllipsisVisible)
00607             {
00608                 KeyboardHelper.PressKey(Key.Tab);
00609             }
00610
00611             bool elementGotFocus = breadcrumb.Children[indexToFocus].HasKeyboardFocus;
00612
00613             if (elementGotFocus)
00614             {
00615                 Log.Comment("Got focus with RS2 way");
00616             }
00617             else
00618             {
00619                 Log.Comment("Didn't got focus with RS2 way");
00620             }
00621
00622             return elementGotFocus;
00623         }
00624
00625         private bool TryGetFocusForRs3(UIObject breadcrumb, int indexToFocus, bool isEllipsisVisible, bool isRightToLeft)
00626         {
00627             Log.Comment("Try Set focus for RS3 build");
00628
00629             UIObject anchor = RetrieveRTLCheckBox();
00630             FocusHelper.SetFocus(anchor);
00631
00632             // For RS3 we need only one Tab key stroke
00633             KeyboardHelper.PressKey(Key.Tab);
00634
00635             if (!isEllipsisVisible)
00636             {
00637                 if (isRightToLeft)
00638                 {
00639                     KeyboardHelper.PressKey(Key.Left);
00640                 }
00641                 else
00642                 {
00643                     KeyboardHelper.PressKey(Key.Right);
00644                 }
00645             }
00646
00647             bool elementGotFocus = breadcrumb.Children[indexToFocus].HasKeyboardFocus;
00648
00649             if (elementGotFocus)
00650             {
00651                 Log.Comment("Got focus with RS3 way");
00652             }
00653             else
00654             {
00655                 Log.Comment("Didn't got focus with RS3 way");
00656             }
00657
00658             return elementGotFocus;
00659         }
00660
00661         private bool TryGetFocusByPressingTab(UIObject breadcrumb, int indexToFocus)
00662         {
00663             Log.Comment("Try Set focus by just pressing tab a bunch of times");
00664
00665             UIObject anchor = RetrieveRTLCheckBox();
00666             FocusHelper.SetFocus(anchor);
00667
00668             int tabCount = 0;
00669             while ((!breadcrumb.Children[indexToFocus].HasKeyboardFocus) && tabCount < 10)
00670             {
00671                 KeyboardHelper.PressKey(Key.Tab);
00672                 ++tabCount;
00673             }
00674
00675             Log.Comment(tabCount + " times was pressed the <TAB> key before the control gained focus");
00676
00677             bool elementGotFocus = breadcrumb.Children[indexToFocus].HasKeyboardFocus;
00678
00679             if (elementGotFocus)
00680             {
00681                 Log.Comment("Got focus pressing <TAB> key");
00682             }
00683             else
00684             {
00685                 Log.Comment("Didn't got focus pressing <TAB> key");
00686             }
00687
00688             return elementGotFocus;
00689         }
00690
00691         private void SetFocusToFirstBreadcrumbBarItem(UIObject breadcrumb, bool isEllipsisVisible = false, bool isRightToLeft = false)
00692         {
00693             UIObject anchor = RetrieveRTLCheckBox();
00694             FocusHelper.SetFocus(anchor);
00695
00696             int indexToFocus = 0;
00697
00698             // The RS3 and RS2 behaviours seem a little odd on how many tabs need to be pressed
00699             bool gotFocus = TryGetFocusForRs2(breadcrumb, indexToFocus, isEllipsisVisible);
00700             if (!gotFocus)
00701             {
00702                 gotFocus = TryGetFocusForRs3(breadcrumb, indexToFocus, isEllipsisVisible, isRightToLeft);
00703                 if (!gotFocus)
00704                 {
00705                     gotFocus = TryGetFocusByPressingTab(breadcrumb, indexToFocus);
00706                 }
00707             }
00708
00709             if (isEllipsisVisible)
00710             {
00711                 Verify.IsTrue(gotFocus, "Ellipsis BreadcrumbBarItem should have focus");
00712             }
00713             else
00714             {
00715                 Verify.IsTrue(gotFocus, "'Root' BreadcrumbBarItem should have focus");
00716             }
00717         }
00718
00719         private T ConvertTo<T>(UIObject uiObject)
00720         {
00721             if (uiObject != null)
00722             {
00723                 return (T)Activator.CreateInstance(typeof(T), uiObject);
00724             }
00725             else
00726             {
00727                 return default(T);
00728             }
00729         }
00730
00731         private void ClickOnElements(string[] elementNames)
00732         {
00733             foreach (var elementName in elementNames)
00734             {
00735                 UIObject itemToAddButton = FindElement.ByName(elementName);
00736                 Verify.IsNotNull(itemToAddButton, "Verifying that we found a button with " + elementName + " text");
00737                 itemToAddButton.Click();
00738             }
00739         }
00740
00741         private UIObject RetrieveBreadcrumbControl()
00742         {
00743             Log.Comment("Retrieve breadcrumb control as generic UIElement");
00744             UIObject breadcrumb = FindElement.ByName("BreadcrumbControl");
00745             Verify.IsNotNull(breadcrumb, "Verifying that we found a UIElement called BreadcrumbControl");
00746
00747             return breadcrumb;
00748         }
00749
00750         private UIObject RetrieveWidthSlider()
00751         {
00752             UIObject slider = FindElement.ByName("WidthSlider");
00753             Verify.IsNotNull(slider, "WidthSlider not found");
00754
00755             return slider;
00756         }
00757
00758         private UIObject RetrieveRTLCheckBox(bool mustClickCheckBox = false)
00759         {
00760             var rtlCheckbox = FindElement.ByName<CheckBox>("RightToLeftCheckbox");
00761             Verify.IsNotNull(rtlCheckbox, "Verifying that we found a UIElement called RightToLeftCheckbox");
00762
00763             if (mustClickCheckBox)
00764             {
00765                 rtlCheckbox.Click();
00766             }
00767
00768             return rtlCheckbox;
00769         }
00770
00771         private void VerifyBreadcrumbBarItemsContain(UICollection<UIObject> breadcrumbItems, string[] expectedItemValues, bool firstItemIsCurrentItem = false, bool isEllipsisVisible = false)
00772         {
00773             // WARNING: this method clicks on each breadcrumb so once the verification has finished,
00774             // only the ellipsis item and 'Root' should exist
00775
00776             // As recycled breadcrumbs are not deleted, then we compare that the breadcrumb count is always bigger
00777             // than the expected values count
00778             var ellipsisPresentCount = isEllipsisVisible ? 1 : 0;
00779
00780             Verify.IsTrue(breadcrumbItems.Count - ellipsisPresentCount >= expectedItemValues.Length,
00781                 "The expected values count should at least be one less than the BreadcrumbBarItems count");
00782
00783             bool mustVerifyItemAsLastItem = firstItemIsCurrentItem;
00784
00785             // To verify the existence of the expected nodes we click on each of them and verify agains the strings
00786             // in LastClickedItemIndex and LastClickedItem textboxes.
00787             for (int i = expectedItemValues.Length - 1; i >= 0; --i)
00788             {
00789                 var currentItem = breadcrumbItems[i + ellipsisPresentCount];
00790                 Verify.IsNotNull(currentItem, "Current BreadcrumbBarItem should not be null");
00791
00792                 var currentBreadcrumbBarItem = ConvertTo<BreadcrumbBarItem>(currentItem);
00793                 Verify.IsNotNull(currentBreadcrumbBarItem, "UIElement should be a BreadcrumbBarItem");
00794
00795                 currentBreadcrumbBarItem.Click();
00796
00797                 if (mustVerifyItemAsLastItem)
00798                 {
00799                     Verify.AreEqual(expectedItemValues[i], GetCurrentItemText(currentBreadcrumbBarItem));
00800                     mustVerifyItemAsLastItem = false;
00801                 }
00802                 else
00803                 {
00804                     VerifyLastClickedItemIndexIs(i);
00805                     VerifyLastClickedItemIs(expectedItemValues[i]);
00806                 }
00807             }
00808         }
00809
00810         private Button VerifyDropDownItemContainsText(string expectedText)
00811         {
00812             Log.Comment("Retrieve the ellipsis item: " + expectedText);
00813
00814             var dropDownItem = GetDropDownItemByName(expectedText);
00815             VerifyDropDownItemContainsText(dropDownItem, expectedText);
00816
00817             return dropDownItem;
00818         }
00819
00820         private Button GetDropDownItemByName(string dropDownItemName)
00821         {
00822             var ellipsisFlyout = FindElement.ByName("EllipsisFlyout");
00823
00824             foreach (var child in ellipsisFlyout.Children)
00825             {
00826                 if (child.Name == dropDownItemName)
00827                 {
00828                     return ConvertTo<Button>(child);
00829                 }
00830             }
00831
00832             Verify.Fail(dropDownItemName + " not found");
00833             return null;
00834         }
00835
00836         private void VerifyDropDownItemContainsText(Button dropDownItem, string expectedEllipsisItemText)
00837         {
00838             var ellipsisItemTextBlock = ConvertTo<TextBlock>(dropDownItem.FirstChild);
00839             Verify.IsNotNull(ellipsisItemTextBlock, "The ellipsis Item should contain a Textblock as first item");
00840
00841             Verify.AreEqual(expectedEllipsisItemText, ellipsisItemTextBlock.GetText(),
00842                 "The ellipsis item doesn't match " + expectedEllipsisItemText);
00843         }
00844
00845         private void VerifyLastClickedItemIs(string expected)
00846         {
00847             var lastClickedItem = GetLastClickedItem();
00848             Verify.AreEqual(expected, lastClickedItem,
00849                     "The text in the button " + lastClickedItem + "doesn't match the expected '" + expected + "'");
00850         }
00851
00852         private void VerifyLastClickedItemIndexIs(int expected)
00853         {
00854             var lastClickedItemIndex = GetLastClickedItemIndex();
00855             Verify.AreEqual(expected, lastClickedItemIndex,
00856                     "The last clicked item index " + lastClickedItemIndex + "doesn't match the expected " + expected);
00857         }
00858
00859         private string GetLastClickedItem()
00860         {
00861             var lastItemTextBlock = FindElement.ByName<TextBlock>("LastClickedItem");
00862             return lastItemTextBlock.DocumentText;
00863         }
00864
00865         private int GetLastClickedItemIndex()
00866         {
00867             var lastItemTextBlock = FindElement.ByName<TextBlock>("LastClickedItemIndex");
00868             return Int32.Parse(lastItemTextBlock.DocumentText);
00869         }
00870
00871         private string GetCurrentItemText(BreadcrumbBarItem currentItem)
00872         {
00873             return currentItem.Children[0].GetText();
00874         }
00875     }
00876 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: dll/DoubleUtil.cpp Source File

  • dll

DoubleUtil.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include "DoubleUtil.h"
00006
00007 // Represents a value that is not a number (NaN).
00008 const double DoubleUtil::NaN = std::numeric_limits<double>::quiet_NaN();
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AutoSuggestBox Member List

This is the complete list of members for AutoSuggestBox, including all inherited members.
CanSelectSuggestion() | AutoSuggestBox | [inline]
ClassInitialize(TestContext testContext) | AutoSuggestBox | [inline, static]
TestCleanup() | AutoSuggestBox | [inline]
VerifyAxeScanPasses() | AutoSuggestBox | [inline]
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/TestUI/ScrollViewWithScrollControllersPage.xaml.cs Source File

  • ScrollView
  • TestUI

ScrollViewWithScrollControllersPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Controls;
00008 using Microsoft.UI.Xaml.Navigation;
00009 using Microsoft.UI.Dispatching;
00010 using Microsoft.UI.Private.Controls;
00011
00012 namespace MUXControlsTestApp
00013 {
00014     public sealed partial class ScrollViewWithScrollControllersPage : TestPage
00015     {
00016         private Object asyncEventReportingLock = new Object();
00017         private List<string> lstAsyncEventMessage = new List<string>();
00018         private ScrollView scrollView = null;
00019
00020         public ScrollViewWithScrollControllersPage()
00021         {
00022             // We need the styles of the CompositionScrollController, so lets load it
00023             App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00024
00025             this.InitializeComponent();
00026             UseScrollView(this.markupScrollView);
00027         }
00028
00029         ~ScrollViewWithScrollControllersPage()
00030         {
00031         }
00032
00033         protected override void OnNavigatedFrom(NavigationEventArgs e)
00034         {
00035             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00036             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00037
00038             MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00039
00040             base.OnNavigatedFrom(e);
00041         }
00042
00043         private void ChkScrollViewProperties_Checked(object sender, RoutedEventArgs e)
00044         {
00045             if (grdScrollViewProperties != null)
00046                 grdScrollViewProperties.Visibility = Visibility.Visible;
00047         }
00048
00049         private void ChkScrollViewProperties_Unchecked(object sender, RoutedEventArgs e)
00050         {
00051             if (grdScrollViewProperties != null)
00052                 grdScrollViewProperties.Visibility = Visibility.Collapsed;
00053         }
00054
00055         private void ChkScrollPresenterAttachedProperties_Checked(object sender, RoutedEventArgs e)
00056         {
00057             if (grdScrollPresenterAttachedProperties != null)
00058                 grdScrollPresenterAttachedProperties.Visibility = Visibility.Visible;
00059         }
00060
00061         private void ChkScrollPresenterAttachedProperties_Unchecked(object sender, RoutedEventArgs e)
00062         {
00063             if (grdScrollPresenterAttachedProperties != null)
00064                 grdScrollPresenterAttachedProperties.Visibility = Visibility.Collapsed;
00065         }
00066
00067         private void ChkContentProperties_Checked(object sender, RoutedEventArgs e)
00068         {
00069             if (grdContentProperties != null)
00070                 grdContentProperties.Visibility = Visibility.Visible;
00071         }
00072
00073         private void ChkContentProperties_Unchecked(object sender, RoutedEventArgs e)
00074         {
00075             if (grdContentProperties != null)
00076                 grdContentProperties.Visibility = Visibility.Collapsed;
00077         }
00078
00079         private void ChkLogs_Checked(object sender, RoutedEventArgs e)
00080         {
00081             if (grdLogs != null)
00082                 grdLogs.Visibility = Visibility.Visible;
00083         }
00084
00085         private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
00086         {
00087             if (grdLogs != null)
00088                 grdLogs.Visibility = Visibility.Collapsed;
00089         }
00090
00091         private void BtnGetContentOrientation_Click(object sender, RoutedEventArgs e)
00092         {
00093             UpdateContentOrientation();
00094         }
00095
00096         private void BtnGetHorizontalScrollMode_Click(object sender, RoutedEventArgs e)
00097         {
00098             UpdateHorizontalScrollMode();
00099         }
00100
00101         private void BtnGetVerticalScrollMode_Click(object sender, RoutedEventArgs e)
00102         {
00103             UpdateVerticalScrollMode();
00104         }
00105
00106         private void BtnGetZoomMode_Click(object sender, RoutedEventArgs e)
00107         {
00108             UpdateZoomMode();
00109         }
00110
00111         private void BtnSetContentOrientation_Click(object sender, RoutedEventArgs e)
00112         {
00113             try
00114             {
00115                 ScrollingContentOrientation co = (ScrollingContentOrientation)cmbContentOrientation.SelectedIndex;
00116                 scrollView.ContentOrientation = co;
00117             }
00118             catch (Exception ex)
00119             {
00120                 txtExceptionReport.Text = ex.ToString();
00121                 lstLogs.Items.Add(ex.ToString());
00122             }
00123         }
00124
00125         private void BtnSetHorizontalScrollMode_Click(object sender, RoutedEventArgs e)
00126         {
00127             try
00128             {
00129                 ScrollingScrollMode ssm = (ScrollingScrollMode)cmbHorizontalScrollMode.SelectedIndex;
00130                 scrollView.HorizontalScrollMode = ssm;
00131             }
00132             catch (Exception ex)
00133             {
00134                 txtExceptionReport.Text = ex.ToString();
00135                 lstLogs.Items.Add(ex.ToString());
00136             }
00137         }
00138
00139         private void BtnSetVerticalScrollMode_Click(object sender, RoutedEventArgs e)
00140         {
00141             try
00142             {
00143                 ScrollingScrollMode ssm = (ScrollingScrollMode)cmbVerticalScrollMode.SelectedIndex;
00144                 scrollView.VerticalScrollMode = ssm;
00145             }
00146             catch (Exception ex)
00147             {
00148                 txtExceptionReport.Text = ex.ToString();
00149                 lstLogs.Items.Add(ex.ToString());
00150             }
00151         }
00152
00153         private void BtnSetZoomMode_Click(object sender, RoutedEventArgs e)
00154         {
00155             try
00156             {
00157                 ScrollingZoomMode ssm = (ScrollingZoomMode)cmbZoomMode.SelectedIndex;
00158                 scrollView.ZoomMode = ssm;
00159             }
00160             catch (Exception ex)
00161             {
00162                 txtExceptionReport.Text = ex.ToString();
00163                 lstLogs.Items.Add(ex.ToString());
00164             }
00165         }
00166
00167         private void BtnGetWidth_Click(object sender, RoutedEventArgs e)
00168         {
00169             UpdateWidth();
00170         }
00171
00172         private void BtnSetWidth_Click(object sender, RoutedEventArgs e)
00173         {
00174             try
00175             {
00176                 scrollView.Width = Convert.ToDouble(txtWidth.Text);
00177             }
00178             catch (Exception ex)
00179             {
00180                 txtExceptionReport.Text = ex.ToString();
00181                 lstLogs.Items.Add(ex.ToString());
00182             }
00183         }
00184
00185         private void BtnGetHeight_Click(object sender, RoutedEventArgs e)
00186         {
00187             UpdateHeight();
00188         }
00189
00190         private void BtnSetHeight_Click(object sender, RoutedEventArgs e)
00191         {
00192             try
00193             {
00194                 scrollView.Height = Convert.ToDouble(txtHeight.Text);
00195             }
00196             catch (Exception ex)
00197             {
00198                 txtExceptionReport.Text = ex.ToString();
00199                 lstLogs.Items.Add(ex.ToString());
00200             }
00201         }
00202
00203         private void BtnGetPadding_Click(object sender, RoutedEventArgs e)
00204         {
00205             UpdatePadding();
00206         }
00207
00208         private void BtnSetPadding_Click(object sender, RoutedEventArgs e)
00209         {
00210             try
00211             {
00212                 scrollView.Padding = GetThicknessFromString(txtPadding.Text);
00213             }
00214             catch (Exception ex)
00215             {
00216                 txtExceptionReport.Text = ex.ToString();
00217                 lstLogs.Items.Add(ex.ToString());
00218             }
00219         }
00220
00221         private void BtnGetHorizontalScrollBarVisibility_Click(object sender, RoutedEventArgs e)
00222         {
00223             UpdateHorizontalScrollBarVisibility();
00224         }
00225
00226         private void BtnSetHorizontalScrollBarVisibility_Click(object sender, RoutedEventArgs e)
00227         {
00228             try
00229             {
00230                 scrollView.HorizontalScrollBarVisibility = (ScrollingScrollBarVisibility)cmbHorizontalScrollBarVisibility.SelectedIndex;
00231             }
00232             catch (Exception ex)
00233             {
00234                 txtExceptionReport.Text = ex.ToString();
00235                 lstLogs.Items.Add(ex.ToString());
00236             }
00237         }
00238
00239         private void BtnGetVerticalScrollBarVisibility_Click(object sender, RoutedEventArgs e)
00240         {
00241             UpdateVerticalScrollBarVisibility();
00242         }
00243
00244         private void BtnSetVerticalScrollBarVisibility_Click(object sender, RoutedEventArgs e)
00245         {
00246             try
00247             {
00248                 scrollView.VerticalScrollBarVisibility = (ScrollingScrollBarVisibility)cmbVerticalScrollBarVisibility.SelectedIndex;
00249             }
00250             catch (Exception ex)
00251             {
00252                 txtExceptionReport.Text = ex.ToString();
00253                 lstLogs.Items.Add(ex.ToString());
00254             }
00255         }
00256
00257         private void ChkIsEnabled_Checked(object sender, RoutedEventArgs e)
00258         {
00259             scrollView.IsEnabled = true;
00260         }
00261
00262         private void ChkIsEnabled_Unchecked(object sender, RoutedEventArgs e)
00263         {
00264             scrollView.IsEnabled = false;
00265         }
00266
00267         private void ChkIsTabStop_Checked(object sender, RoutedEventArgs e)
00268         {
00269             scrollView.IsTabStop = true;
00270         }
00271
00272         private void ChkIsTabStop_Unchecked(object sender, RoutedEventArgs e)
00273         {
00274             scrollView.IsTabStop = false;
00275         }
00276
00277         private void BtnGetContentWidth_Click(object sender, RoutedEventArgs e)
00278         {
00279             UpdateContentWidth();
00280         }
00281
00282         private void BtnSetContentWidth_Click(object sender, RoutedEventArgs e)
00283         {
00284             try
00285             {
00286                 FrameworkElement contentAsFE = scrollView.Content as FrameworkElement;
00287                 if (contentAsFE != null)
00288                     contentAsFE.Width = Convert.ToDouble(txtContentWidth.Text);
00289             }
00290             catch (Exception ex)
00291             {
00292                 txtExceptionReport.Text = ex.ToString();
00293                 lstLogs.Items.Add(ex.ToString());
00294             }
00295         }
00296
00297         private void BtnGetContentHeight_Click(object sender, RoutedEventArgs e)
00298         {
00299             UpdateContentHeight();
00300         }
00301
00302         private void BtnSetContentHeight_Click(object sender, RoutedEventArgs e)
00303         {
00304             try
00305             {
00306                 FrameworkElement contentAsFE = scrollView.Content as FrameworkElement;
00307                 if (contentAsFE != null)
00308                     contentAsFE.Height = Convert.ToDouble(txtContentHeight.Text);
00309             }
00310             catch (Exception ex)
00311             {
00312                 txtExceptionReport.Text = ex.ToString();
00313                 lstLogs.Items.Add(ex.ToString());
00314             }
00315         }
00316
00317         private void BtnGetContentMargin_Click(object sender, RoutedEventArgs e)
00318         {
00319             UpdateContentMargin();
00320         }
00321
00322         private void BtnSetContentMargin_Click(object sender, RoutedEventArgs e)
00323         {
00324             try
00325             {
00326                 FrameworkElement contentAsFE = scrollView.Content as FrameworkElement;
00327                 if (contentAsFE != null)
00328                     contentAsFE.Margin = GetThicknessFromString(txtContentMargin.Text);
00329             }
00330             catch (Exception ex)
00331             {
00332                 txtExceptionReport.Text = ex.ToString();
00333                 lstLogs.Items.Add(ex.ToString());
00334             }
00335         }
00336
00337         private void ChkIsContentEnabled_Checked(object sender, RoutedEventArgs e)
00338         {
00339             Control contentAsC = scrollView.Content as Control;
00340             if (contentAsC != null)
00341                 contentAsC.IsEnabled = true;
00342         }
00343
00344         private void ChkIsContentEnabled_Unchecked(object sender, RoutedEventArgs e)
00345         {
00346             Control contentAsC = scrollView.Content as Control;
00347             if (contentAsC != null)
00348                 contentAsC.IsEnabled = false;
00349         }
00350
00351         private void ChkIsContentTabStop_Checked(object sender, RoutedEventArgs e)
00352         {
00353             Control contentAsC = scrollView.Content as Control;
00354             if (contentAsC != null)
00355                 contentAsC.IsTabStop = true;
00356         }
00357
00358         private void ChkIsContentTabStop_Unchecked(object sender, RoutedEventArgs e)
00359         {
00360             Control contentAsC = scrollView.Content as Control;
00361             if (contentAsC != null)
00362                 contentAsC.IsTabStop = false;
00363         }
00364
00365         private void UpdateContentOrientation()
00366         {
00367             try
00368             {
00369                 cmbContentOrientation.SelectedIndex = (int)scrollView.ContentOrientation;
00370             }
00371             catch (Exception ex)
00372             {
00373                 txtExceptionReport.Text = ex.ToString();
00374                 lstLogs.Items.Add(ex.ToString());
00375             }
00376         }
00377
00378         private void UpdateHorizontalScrollMode()
00379         {
00380             try
00381             {
00382                 cmbHorizontalScrollMode.SelectedIndex = (int)scrollView.HorizontalScrollMode;
00383             }
00384             catch (Exception ex)
00385             {
00386                 txtExceptionReport.Text = ex.ToString();
00387                 lstLogs.Items.Add(ex.ToString());
00388             }
00389         }
00390
00391         private void UpdateVerticalScrollMode()
00392         {
00393             try
00394             {
00395                 cmbVerticalScrollMode.SelectedIndex = (int)scrollView.VerticalScrollMode;
00396             }
00397             catch (Exception ex)
00398             {
00399                 txtExceptionReport.Text = ex.ToString();
00400                 lstLogs.Items.Add(ex.ToString());
00401             }
00402         }
00403
00404         private void UpdateZoomMode()
00405         {
00406             try
00407             {
00408                 cmbZoomMode.SelectedIndex = (int)scrollView.ZoomMode;
00409             }
00410             catch (Exception ex)
00411             {
00412                 txtExceptionReport.Text = ex.ToString();
00413                 lstLogs.Items.Add(ex.ToString());
00414             }
00415         }
00416
00417         private void UpdateWidth()
00418         {
00419             txtWidth.Text = scrollView.Width.ToString();
00420         }
00421
00422         private void UpdateHeight()
00423         {
00424             txtHeight.Text = scrollView.Height.ToString();
00425         }
00426
00427         private void UpdatePadding()
00428         {
00429             txtPadding.Text = scrollView.Padding.ToString();
00430         }
00431
00432         private void UpdateHorizontalScrollBarVisibility()
00433         {
00434             cmbHorizontalScrollBarVisibility.SelectedIndex = (int)scrollView.HorizontalScrollBarVisibility;
00435         }
00436
00437         private void UpdateVerticalScrollBarVisibility()
00438         {
00439             cmbVerticalScrollBarVisibility.SelectedIndex = (int)scrollView.VerticalScrollBarVisibility;
00440         }
00441
00442         private void UpdateContentWidth()
00443         {
00444             FrameworkElement contentAsFE = scrollView.Content as FrameworkElement;
00445             if (contentAsFE == null)
00446                 txtContentWidth.Text = string.Empty;
00447             else
00448                 txtContentWidth.Text = contentAsFE.Width.ToString();
00449         }
00450
00451         private void UpdateContentHeight()
00452         {
00453             FrameworkElement contentAsFE = scrollView.Content as FrameworkElement;
00454             if (contentAsFE == null)
00455                 txtContentHeight.Text = string.Empty;
00456             else
00457                 txtContentHeight.Text = contentAsFE.Height.ToString();
00458         }
00459
00460         private void UpdateContentMargin()
00461         {
00462             FrameworkElement contentAsFE = scrollView.Content as FrameworkElement;
00463             if (contentAsFE == null)
00464                 txtContentMargin.Text = string.Empty;
00465             else
00466                 txtContentMargin.Text = contentAsFE.Margin.ToString();
00467         }
00468
00469         private Thickness GetThicknessFromString(string thickness)
00470         {
00471             string[] lengths = thickness.Split(',');
00472             if (lengths.Length < 4)
00473                 return new Thickness(Convert.ToDouble(lengths[0]));
00474             else
00475                 return new Thickness(
00476                     Convert.ToDouble(lengths[0]), Convert.ToDouble(lengths[1]), Convert.ToDouble(lengths[2]), Convert.ToDouble(lengths[3]));
00477         }
00478
00479         private void UseScrollView(ScrollView sv2)
00480         {
00481             if (scrollView == sv2 || sv2 == null)
00482                 return;
00483
00484             try
00485             {
00486                 if (scrollView == null && (chkLogScrollViewMessages.IsChecked == true || chkLogScrollPresenterMessages.IsChecked == true))
00487                 {
00488                     MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00489
00490                     if (chkLogScrollPresenterMessages.IsChecked == true)
00491                     {
00492                         MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00493                     }
00494                     if (chkLogScrollViewMessages.IsChecked == true)
00495                     {
00496                         MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00497                     }
00498                 }
00499
00500                 scrollView = sv2;
00501
00502                 UpdateContentOrientation();
00503                 UpdateHorizontalScrollMode();
00504                 UpdateVerticalScrollMode();
00505                 UpdateZoomMode();
00506
00507                 UpdateWidth();
00508                 UpdateHeight();
00509                 UpdatePadding();
00510                 UpdateHorizontalScrollBarVisibility();
00511                 UpdateVerticalScrollBarVisibility();
00512
00513                 chkIsEnabled.IsChecked = scrollView.IsEnabled;
00514                 chkIsTabStop.IsChecked = scrollView.IsTabStop;
00515
00516                 UpdateContentWidth();
00517                 UpdateContentHeight();
00518                 UpdateContentMargin();
00519
00520                 Control contentAsC = scrollView.Content as Control;
00521                 if (contentAsC != null)
00522                 {
00523                     chkIsContentEnabled.IsChecked = contentAsC.IsEnabled;
00524                     chkIsContentTabStop.IsChecked = contentAsC.IsTabStop;
00525                 }
00526             }
00527             catch (Exception ex)
00528             {
00529                 txtExceptionReport.Text = ex.ToString();
00530                 lstLogs.Items.Add(ex.ToString());
00531             }
00532         }
00533
00534         private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
00535         {
00536             lstLogs.Items.Clear();
00537         }
00538
00539         private void ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e)
00540         {
00541             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00542             if (chkLogScrollViewMessages.IsChecked == false)
00543                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00544         }
00545
00546         private void ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e)
00547         {
00548             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00549             if (chkLogScrollViewMessages.IsChecked == false)
00550                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00551         }
00552
00553         private void ChkLogScrollViewMessages_Checked(object sender, RoutedEventArgs e)
00554         {
00555             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00556             if (chkLogScrollPresenterMessages.IsChecked == false)
00557                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00558         }
00559
00560         private void ChkLogScrollViewMessages_Unchecked(object sender, RoutedEventArgs e)
00561         {
00562             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00563             if (chkLogScrollPresenterMessages.IsChecked == false)
00564                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00565         }
00566
00567         private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
00568         {
00569             // Cut off the terminating new line.
00570             string msg = args.Message.Substring(0, args.Message.Length - 1);
00571             string asyncEventMessage = string.Empty;
00572             string senderName = string.Empty;
00573
00574             try
00575             {
00576                 FrameworkElement fe = sender as FrameworkElement;
00577
00578                 if (fe != null)
00579                 {
00580                     senderName = "s:" + fe.Name + ", ";
00581                 }
00582             }
00583             catch
00584             {
00585             }
00586
00587             if (args.IsVerboseLevel)
00588             {
00589                 asyncEventMessage = "Verbose: " + senderName + "m:" + msg;
00590             }
00591             else
00592             {
00593                 asyncEventMessage = "Info: " + senderName + "m:" + msg;
00594             }
00595
00596             lock (asyncEventReportingLock)
00597             {
00598                 lstAsyncEventMessage.Add(asyncEventMessage);
00599
00600                 var ignored = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal,
00601                                                               AppendAsyncEventMessage);
00602             }
00603         }
00604
00605         private void AppendAsyncEventMessage()
00606         {
00607             lock (asyncEventReportingLock)
00608             {
00609                 foreach (string asyncEventMessage in lstAsyncEventMessage)
00610                 {
00611                     lstLogs.Items.Add(asyncEventMessage);
00612                 }
00613                 lstAsyncEventMessage.Clear();
00614             }
00615         }
00616
00617         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00618         {
00619             txtExceptionReport.Text = string.Empty;
00620         }
00621     }
00622 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/NestedLayoutSamples/StoreMockData.cs Source File

  • Repeater
  • TestUI
  • Samples
  • NestedLayoutSamples

StoreMockData.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.ObjectModel;
00005
00006 namespace MUXControlsTestApp.Samples
00007 {
00008     public class StoreMockData
00009     {
00010         public static ObservableCollection<Category> Create(int numCategories, int numItemsPerCategory)
00011         {
00012             var data = new ObservableCollection<Category>();
00013             for (int i = 0; i < numCategories; i++)
00014             {
00015                 var category = CreateCategory(numItemsPerCategory, "Category " + i.ToString());
00016                 data.Add(category);
00017             }
00018
00019             return data;
00020         }
00021
00022         public static Category CreateCategory(int numItems, string name)
00023         {
00024             var category = new Category() { Name = name };
00025             for (int i = 0; i < numItems; i++)
00026             {
00027                 category.Add(new Item() { Name = "Item " + i.ToString() });
00028             }
00029
00030             return category;
00031         }
00032     }
00033
00034     public class Category : ObservableCollection<Item>
00035     {
00036         public string Name { get; set; }
00037     }
00038
00039     public class Item
00040     {
00041         public string Name { get; set; }
00042     }
00043 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs Member List

This is the complete list of members for ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs, including all inherited members.
IsExpressionAnimationStarted() | ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs
PropertyName() | ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs
ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs(bool isExpressionAnimationStarted, wstring_view const &propertyName) | ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs
Generated on Sun Dec 1 2024 20:53:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/InspectingDataSource.h Source File

  • Repeater

InspectingDataSource.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ItemsSourceView.h"
00007
00008 class InspectingDataSource :
00009     public winrt::implements<InspectingDataSource, ItemsSourceView>
00010 {
00011 public:
00012     ForwardRefToBaseReferenceTracker(ItemsSourceView)
00013
00014     InspectingDataSource(const winrt::IInspectable& source);
00015     ~InspectingDataSource();
00016
00017 #pragma region ItemsSourceViewOverrides
00018
00019     int32_t GetSizeCore() override;
00020     winrt::IInspectable GetAtCore(int index) override;
00021     bool HasKeyIndexMappingCore() override;
00022     winrt::hstring KeyFromIndexCore(int index) override;
00023     int IndexFromKeyCore(winrt::hstring const& id) override;
00024     int IndexOfCore(winrt::IInspectable const& value);
00025 #pragma endregion
00026
00027 private:
00028     winrt::Collections::IVector<winrt::IInspectable>
00029     WrapIterable(const winrt::Collections::IIterable<winrt::IInspectable>& iterable);
00030
00031     void UnListenToCollectionChanges();
00032     void ListenToCollectionChanges();
00033
00034     void OnCollectionChanged(
00035         const winrt::IInspectable& sender,
00036         const winrt::NotifyCollectionChangedEventArgs& e);
00037
00038     void OnBindableVectorChanged(
00039         const winrt::IBindableObservableVector& sender,
00040         const winrt::IInspectable& e);
00041
00042     void OnVectorChanged(
00043         const winrt::Collections::IObservableVector<winrt::IInspectable>& sender,
00044         const winrt::Collections::IVectorChangedEventArgs& e);
00045
00046     tracker_ref<winrt::Collections::IVector<winrt::IInspectable>> m_vector{ this };
00047     tracker_ref<winrt::Collections::IVectorView<winrt::IInspectable>> m_vectorView{ this };
00048
00049     // To unhook event from data source
00050     tracker_ref<winrt::INotifyCollectionChanged> m_notifyCollectionChanged{ this };
00051     tracker_ref<winrt::IObservableVector<winrt::IInspectable>> m_observableVector{ this };
00052     tracker_ref<winrt::IBindableObservableVector> m_bindableObservableVector{ this };
00053     winrt::event_token m_eventToken{ };
00054     winrt::IKeyIndexMapping m_uniqueIdMaping{ nullptr };
00055 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RoutedEventTraits< RoutedEventType::KeyDown > Member List

This is the complete list of members for RoutedEventTraits< RoutedEventType::KeyDown >, including all inherited members.
Event() RoutedEventTraits< RoutedEventType::KeyDown > [inline, static]
Generated on Sun Dec 1 2024 20:53:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InspectingDataSourceTests::WinRTObservableVector::WinRTVectorChangedEventArgs Member List

This is the complete list of members for InspectingDataSourceTests::WinRTObservableVector::WinRTVectorChangedEventArgs, including all inherited members.
_index | InspectingDataSourceTests::WinRTObservableVector::WinRTVectorChangedEventArgs | [private]
CollectionChange | InspectingDataSourceTests::WinRTObservableVector::WinRTVectorChangedEventArgs |
Index | InspectingDataSourceTests::WinRTObservableVector::WinRTVectorChangedEventArgs |
WinRTVectorChangedEventArgs(CollectionChange change, int index) | InspectingDataSourceTests::WinRTObservableVector::WinRTVectorChangedEventArgs | [inline]
Generated on Sun Dec 1 2024 20:53:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/APITests/ScrollControllerTests.cs Source File

  • ScrollPresenter
  • APITests

ScrollControllerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using MUXControlsTestApp;
00006 using MUXControlsTestApp.Utilities;
00007 using System.Numerics;
00008 using System.Threading;
00009 using Windows.Foundation;
00010 using Windows.UI;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Controls;
00013 using Microsoft.UI.Xaml.Controls.Primitives;
00014 using Microsoft.UI.Xaml.Media;
00015 using Microsoft.UI.Xaml.Shapes;
00016
00017 using WEX.TestExecution;
00018 using WEX.TestExecution.Markup;
00019 using WEX.Logging.Interop;
00020
00021 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00022 {
00023     partial class ScrollPresenterTests : ApiTestBase
00024     {
00025         [TestMethod]
00026         [TestProperty("Description", "Sets the ScrollPresenter.HorizontalScrollController and ScrollPresenter.VerticalScrollController properties.")]
00027         public void SettingScrollControllerProperties()
00028         {
00029             ScrollPresenter scrollPresenter = null;
00030             CompositionScrollController horizontalScrollController = null;
00031             CompositionScrollController verticalScrollController = null;
00032
00033             RunOnUIThread.Execute(() =>
00034             {
00035                 // We need the styles of the CompositionScrollController, so let's load them
00036                 App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00037
00038                 scrollPresenter = new ScrollPresenter();
00039                 Verify.IsNotNull(scrollPresenter);
00040
00041                 horizontalScrollController = new CompositionScrollController();
00042                 Verify.IsNotNull(horizontalScrollController);
00043
00044                 verticalScrollController = new CompositionScrollController();
00045                 Verify.IsNotNull(verticalScrollController);
00046
00047                 Log.Comment("Setting ScrollPresenter.HorizontalScrollController and ScrollPresenter.VerticalScrollController properties.");
00048                 scrollPresenter.HorizontalScrollController = horizontalScrollController;
00049                 scrollPresenter.VerticalScrollController = verticalScrollController;
00050             });
00051
00052             IdleSynchronizer.Wait();
00053
00054             RunOnUIThread.Execute(() =>
00055             {
00056                 Log.Comment("Verifying ScrollPresenter properties.");
00057                 Verify.AreEqual(scrollPresenter.HorizontalScrollController, horizontalScrollController);
00058                 Verify.AreEqual(scrollPresenter.VerticalScrollController, verticalScrollController);
00059
00060                 Verify.IsFalse(horizontalScrollController.CanScroll); // horizontalScrollController.isScrollable is False
00061                 Verify.IsFalse(horizontalScrollController.IsScrollingWithMouse);
00062                 Verify.IsNull(horizontalScrollController.PanningInfo.PanningElementAncestor);
00063                 Verify.IsFalse(verticalScrollController.CanScroll); // verticalScrollController.isScrollable is False
00064                 Verify.IsFalse(verticalScrollController.IsScrollingWithMouse);
00065                 Verify.IsNull(verticalScrollController.PanningInfo.PanningElementAncestor);
00066             });
00067         }
00068
00069         [TestMethod]
00070         [TestProperty("Description", "Change ScrollPresenter view while scroll controllers are attached.")]
00071         public void ChangeOffsetsWhileScrollControllersAreAttached()
00072         {
00073             ScrollPresenter scrollPresenter = null;
00074             Rectangle rectangleScrollPresenterContent = null;
00075             CompositionScrollController horizontalScrollController = null;
00076             CompositionScrollController verticalScrollController = null;
00077             AutoResetEvent loadedEvent = new AutoResetEvent(false);
00078
00079             RunOnUIThread.Execute(() =>
00080             {
00081                 // We need the styles of the CompositionScrollController, so let's load them
00082                 App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00083
00084                 rectangleScrollPresenterContent = new Rectangle();
00085                 scrollPresenter = new ScrollPresenter();
00086                 horizontalScrollController = new CompositionScrollController();
00087                 verticalScrollController = new CompositionScrollController();
00088
00089                 horizontalScrollController.Orientation = Orientation.Horizontal;
00090
00091                 horizontalScrollController.LogMessage += (CompositionScrollController sender, string args) =>
00092                 {
00093                     Log.Comment(args);
00094                 };
00095
00096                 verticalScrollController.LogMessage += (CompositionScrollController sender, string args) =>
00097                 {
00098                     Log.Comment(args);
00099                 };
00100
00101                 scrollPresenter.HorizontalScrollController = horizontalScrollController;
00102                 scrollPresenter.VerticalScrollController = verticalScrollController;
00103
00104                 SetupUIWithScrollControllers(
00105                     scrollPresenter,
00106                     rectangleScrollPresenterContent,
00107                     horizontalScrollController,
00108                     verticalScrollController,
00109                     loadedEvent);
00110             });
00111
00112             WaitForEvent("Waiting for Loaded event", loadedEvent);
00113
00114             RunOnUIThread.Execute(() =>
00115             {
00116                 Log.Comment("HorizontalScrollController size={0}, {1}", horizontalScrollController.ActualWidth, horizontalScrollController.ActualHeight);
00117                 Log.Comment("VerticalScrollController size={0}, {1}", verticalScrollController.ActualWidth, verticalScrollController.ActualHeight);
00118             });
00119
00120             IdleSynchronizer.Wait();
00121
00122             Log.Comment("Jump to offsets");
00123             ScrollTo(
00124                 scrollPresenter,
00125                 (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth) / 2.0,
00126                 (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight) / 2.0,
00127                 ScrollingAnimationMode.Disabled,
00128                 ScrollingSnapPointsMode.Ignore,
00129                 hookViewChangingAndChanged: true,
00130                 isAnimationsEnabledOverride: null,
00131                 expectedFinalHorizontalOffset: (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth) / 2.0,
00132                 expectedFinalVerticalOffset: (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight) / 2.0);
00133
00134             Log.Comment("Animate to offsets");
00135             ScrollTo(
00136                 scrollPresenter,
00137                 (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth) / 4.0,
00138                 (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight) / 4.0,
00139                 ScrollingAnimationMode.Enabled,
00140                 ScrollingSnapPointsMode.Ignore,
00141                 hookViewChangingAndChanged: false,
00142                 isAnimationsEnabledOverride: null,
00143                 expectedFinalHorizontalOffset: (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth) / 4.0,
00144                 expectedFinalVerticalOffset: (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight) / 4.0);
00145
00146             Log.Comment("Jump to zoomFactor 2.0");
00147             ZoomTo(
00148                 scrollPresenter,
00149                 2.0f,
00150                 0.0f,
00151                 0.0f,
00152                 ScrollingAnimationMode.Disabled,
00153                 ScrollingSnapPointsMode.Ignore,
00154                 hookViewChangingAndChanged: false);
00155
00156             Log.Comment("Animate to zoomFactor 1.5");
00157             ZoomTo(
00158                 scrollPresenter,
00159                 1.5f,
00160                 0.0f,
00161                 0.0f,
00162                 ScrollingAnimationMode.Enabled,
00163                 ScrollingSnapPointsMode.Ignore,
00164                 hookViewChangingAndChanged: false);
00165         }
00166
00167         [TestMethod]
00168         [TestProperty("Description", "Change ScrollPresenter view via attached scroll controllers.")]
00169         public void ChangeOffsetsWithAttachedScrollControllers()
00170         {
00171             ScrollPresenter scrollPresenter = null;
00172             Rectangle rectangleScrollPresenterContent = null;
00173             CompositionScrollController horizontalScrollController = null;
00174             CompositionScrollController verticalScrollController = null;
00175             AutoResetEvent loadedEvent = new AutoResetEvent(false);
00176             AutoResetEvent scrollCompletedEvent = new AutoResetEvent(false);
00177             int hOffsetChangeCorrelationId = -1;
00178             int vOffsetChangeCorrelationId = -1;
00179
00180             RunOnUIThread.Execute(() =>
00181             {
00182                 // We need the styles of the CompositionScrollController, so let's load them
00183                 App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00184
00185                 rectangleScrollPresenterContent = new Rectangle();
00186                 scrollPresenter = new ScrollPresenter();
00187                 horizontalScrollController = new CompositionScrollController();
00188                 verticalScrollController = new CompositionScrollController();
00189
00190                 horizontalScrollController.Orientation = Orientation.Horizontal;
00191
00192                 horizontalScrollController.LogMessage += (CompositionScrollController sender, string args) =>
00193                 {
00194                     Log.Comment(args);
00195                 };
00196
00197                 verticalScrollController.LogMessage += (CompositionScrollController sender, string args) =>
00198                 {
00199                     Log.Comment(args);
00200                 };
00201
00202                 scrollPresenter.HorizontalScrollController = horizontalScrollController;
00203                 scrollPresenter.VerticalScrollController = verticalScrollController;
00204
00205                 SetupUIWithScrollControllers(
00206                     scrollPresenter,
00207                     rectangleScrollPresenterContent,
00208                     horizontalScrollController,
00209                     verticalScrollController,
00210                     loadedEvent);
00211
00212                 horizontalScrollController.OffsetChangeCompleted += (CompositionScrollController sender, CompositionScrollControllerOffsetChangeCompletedEventArgs args) =>
00213                 {
00214                     Log.Comment("ChangeOffset completed (horizontal). OffsetChangeCorrelationId=" + args.OffsetChangeCorrelationId);
00215
00216                     Log.Comment("Setting completion event");
00217                     scrollCompletedEvent.Set();
00218                 };
00219
00220                 verticalScrollController.OffsetChangeCompleted += (CompositionScrollController sender, CompositionScrollControllerOffsetChangeCompletedEventArgs args) =>
00221                 {
00222                     Log.Comment("ChangeOffset completed (vertical). OffsetChangeCorrelationId=" + args.OffsetChangeCorrelationId);
00223                 };
00224             });
00225
00226             WaitForEvent("Waiting for Loaded event", loadedEvent);
00227
00228             RunOnUIThread.Execute(() =>
00229             {
00230                 Log.Comment("HorizontalScrollController size={0}, {1}", horizontalScrollController.ActualWidth, horizontalScrollController.ActualHeight);
00231                 Log.Comment("VerticalScrollController size={0}, {1}", verticalScrollController.ActualWidth, verticalScrollController.ActualHeight);
00232             });
00233
00234             Log.Comment("Jump to zoomFactor 0.75");
00235             ZoomTo(
00236                 scrollPresenter,
00237                 0.75f,
00238                 0.0f,
00239                 0.0f,
00240                 ScrollingAnimationMode.Disabled,
00241                 ScrollingSnapPointsMode.Ignore);
00242
00243             RunOnUIThread.Execute(() =>
00244             {
00245                 Log.Comment("Jumping to horizontal offset");
00246                 hOffsetChangeCorrelationId = horizontalScrollController.ScrollTo(
00247                     (c_defaultUIScrollPresenterContentWidth * 0.75 - c_defaultUIScrollPresenterWidth) / 4.0,
00248                     ScrollingAnimationMode.Disabled);
00249
00250                 Log.Comment("Jumping to vertical offset");
00251                 vOffsetChangeCorrelationId = verticalScrollController.ScrollTo(
00252                     (c_defaultUIScrollPresenterContentHeight * 0.75 - c_defaultUIScrollPresenterHeight) / 4.0,
00253                     ScrollingAnimationMode.Disabled);
00254
00255                 Verify.AreEqual(hOffsetChangeCorrelationId, vOffsetChangeCorrelationId);
00256             });
00257
00258             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00259
00260             RunOnUIThread.Execute(() =>
00261             {
00262                 Verify.AreEqual((c_defaultUIScrollPresenterContentWidth * 0.75 - c_defaultUIScrollPresenterWidth) / 4.0, scrollPresenter.HorizontalOffset);
00263                 Verify.AreEqual((c_defaultUIScrollPresenterContentHeight * 0.75 - c_defaultUIScrollPresenterHeight) / 4.0, scrollPresenter.VerticalOffset);
00264
00265                 Log.Comment("Animating to horizontal offset");
00266                 hOffsetChangeCorrelationId = horizontalScrollController.ScrollTo(
00267                     (c_defaultUIScrollPresenterContentWidth * 0.75 - c_defaultUIScrollPresenterWidth) / 2.0,
00268                     ScrollingAnimationMode.Enabled);
00269
00270                 Log.Comment("Animating to vertical offset");
00271                 vOffsetChangeCorrelationId = verticalScrollController.ScrollTo(
00272                     (c_defaultUIScrollPresenterContentHeight * 0.75 - c_defaultUIScrollPresenterHeight) / 2.0,
00273                     ScrollingAnimationMode.Enabled);
00274
00275                 Verify.AreEqual(hOffsetChangeCorrelationId, vOffsetChangeCorrelationId);
00276
00277                 scrollCompletedEvent.Reset();
00278             });
00279
00280             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00281
00282             RunOnUIThread.Execute(() =>
00283             {
00284                 Verify.AreEqual((c_defaultUIScrollPresenterContentWidth * 0.75 - c_defaultUIScrollPresenterWidth) / 2.0, scrollPresenter.HorizontalOffset);
00285                 Verify.AreEqual((c_defaultUIScrollPresenterContentHeight * 0.75 - c_defaultUIScrollPresenterHeight) / 2.0, scrollPresenter.VerticalOffset);
00286             });
00287         }
00288
00289         [TestMethod]
00290         [TestProperty("Description", "Change ScrollPresenter view with additional velocity via attached scroll controllers.")]
00291         public void ChangeOffsetsWithAdditionalVelocityAndAttachedScrollControllers()
00292         {
00293             ScrollPresenter scrollPresenter = null;
00294             Rectangle rectangleScrollPresenterContent = null;
00295             CompositionScrollController horizontalScrollController = null;
00296             CompositionScrollController verticalScrollController = null;
00297             AutoResetEvent loadedEvent = new AutoResetEvent(false);
00298             AutoResetEvent scrollCompletedEvent = new AutoResetEvent(false);
00299             int hOffsetChangeCorrelationId = -1;
00300             int vOffsetChangeCorrelationId = -1;
00301
00302             RunOnUIThread.Execute(() =>
00303             {
00304                 // We need the styles of the CompositionScrollController, so let's load them
00305                 App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00306
00307                 rectangleScrollPresenterContent = new Rectangle();
00308                 scrollPresenter = new ScrollPresenter();
00309                 horizontalScrollController = new CompositionScrollController();
00310                 verticalScrollController = new CompositionScrollController();
00311
00312                 horizontalScrollController.Orientation = Orientation.Horizontal;
00313
00314                 horizontalScrollController.LogMessage += (CompositionScrollController sender, string args) =>
00315                 {
00316                     Log.Comment(args);
00317                 };
00318
00319                 verticalScrollController.LogMessage += (CompositionScrollController sender, string args) =>
00320                 {
00321                     Log.Comment(args);
00322                 };
00323
00324                 scrollPresenter.HorizontalScrollController = horizontalScrollController;
00325                 scrollPresenter.VerticalScrollController = verticalScrollController;
00326
00327                 SetupUIWithScrollControllers(
00328                     scrollPresenter,
00329                     rectangleScrollPresenterContent,
00330                     horizontalScrollController,
00331                     verticalScrollController,
00332                     loadedEvent);
00333
00334                 horizontalScrollController.OffsetChangeCompleted += (CompositionScrollController sender, CompositionScrollControllerOffsetChangeCompletedEventArgs args) =>
00335                 {
00336                     Log.Comment("ChangeOffset completed. OffsetChangeCorrelationId=" + args.OffsetChangeCorrelationId);
00337
00338                     Log.Comment("Setting completion event");
00339                     scrollCompletedEvent.Set();
00340                 };
00341             });
00342
00343             WaitForEvent("Waiting for Loaded event", loadedEvent);
00344
00345             RunOnUIThread.Execute(() =>
00346             {
00347                 Log.Comment("HorizontalScrollController size={0}, {1}", horizontalScrollController.ActualWidth, horizontalScrollController.ActualHeight);
00348                 Log.Comment("VerticalScrollController size={0}, {1}", verticalScrollController.ActualWidth, verticalScrollController.ActualHeight);
00349             });
00350
00351             Log.Comment("Jump to zoomFactor 0.75");
00352             ZoomTo(
00353                 scrollPresenter,
00354                 0.75f,
00355                 0.0f,
00356                 0.0f,
00357                 ScrollingAnimationMode.Disabled,
00358                 ScrollingSnapPointsMode.Ignore);
00359
00360             RunOnUIThread.Execute(() =>
00361             {
00362                 Log.Comment("Adding velocity to horizontal offset, with default inertia decay rate");
00363                 hOffsetChangeCorrelationId = horizontalScrollController.AddScrollVelocity(
00364                     100.0f /*offsetVelocity*/, null /*inertiaDecayRate*/);
00365
00366                 Log.Comment("Adding velocity to vertical offset, with default inertia decay rate");
00367                 vOffsetChangeCorrelationId = verticalScrollController.AddScrollVelocity(
00368                     100.0f /*offsetVelocity*/, null /*inertiaDecayRate*/);
00369
00370                 Verify.AreEqual(hOffsetChangeCorrelationId, vOffsetChangeCorrelationId);
00371             });
00372
00373             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00374
00375             RunOnUIThread.Execute(() =>
00376             {
00377                 Log.Comment("scrollPresenter.HorizontalOffset={0}", scrollPresenter.HorizontalOffset);
00378                 Log.Comment("scrollPresenter.VerticalOffset={0}", scrollPresenter.VerticalOffset);
00379
00380                 Verify.IsTrue(scrollPresenter.HorizontalOffset > 20.0);
00381                 Verify.IsTrue(scrollPresenter.VerticalOffset > 20.0);
00382
00383                 Log.Comment("Adding negative velocity to horizontal offset, with custom inertia decay rate");
00384                 hOffsetChangeCorrelationId = horizontalScrollController.AddScrollVelocity(
00385                     -50.0f /*offsetVelocity*/, 0.9f /*inertiaDecayRate*/);
00386
00387                 Log.Comment("Adding negative velocity to vertical offset, with custom inertia decay rate");
00388                 vOffsetChangeCorrelationId = verticalScrollController.AddScrollVelocity(
00389                     -50.0f /*offsetVelocity*/, 0.9f /*inertiaDecayRate*/);
00390
00391                 Verify.AreEqual(hOffsetChangeCorrelationId, vOffsetChangeCorrelationId);
00392
00393                 scrollCompletedEvent.Reset();
00394             });
00395
00396             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00397
00398             RunOnUIThread.Execute(() =>
00399             {
00400                 Log.Comment("scrollPresenter.HorizontalOffset={0}", scrollPresenter.HorizontalOffset);
00401                 Log.Comment("scrollPresenter.VerticalOffset={0}", scrollPresenter.VerticalOffset);
00402
00403                 Verify.IsTrue(scrollPresenter.HorizontalOffset < 20.0);
00404                 Verify.IsTrue(scrollPresenter.VerticalOffset < 20.0);
00405
00406                 Log.Comment("Adding velocity to horizontal offset, with no inertia decay rate");
00407                 hOffsetChangeCorrelationId = horizontalScrollController.AddScrollVelocity(
00408                     200.0f /*offsetVelocity*/, 0.0f /*inertiaDecayRate*/);
00409
00410                 Log.Comment("Adding velocity to vertical offset, with no inertia decay rate");
00411                 vOffsetChangeCorrelationId = verticalScrollController.AddScrollVelocity(
00412                     200.0f /*offsetVelocity*/, 0.0f /*inertiaDecayRate*/);
00413
00414                 Verify.AreEqual(hOffsetChangeCorrelationId, vOffsetChangeCorrelationId);
00415
00416                 scrollCompletedEvent.Reset();
00417             });
00418
00419             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00420
00421             RunOnUIThread.Execute(() =>
00422             {
00423                 Log.Comment("scrollPresenter.HorizontalOffset={0}", scrollPresenter.HorizontalOffset);
00424                 Log.Comment("scrollPresenter.VerticalOffset={0}", scrollPresenter.VerticalOffset);
00425
00426                 Verify.AreEqual(600.0, scrollPresenter.HorizontalOffset);
00427                 Verify.AreEqual(250.0, scrollPresenter.VerticalOffset);
00428             });
00429         }
00430
00431         [TestMethod]
00432         [TestProperty("Description", "Change ScrollPresenter view while a bi-directional scroll controller is attached.")]
00433         public void ChangeOffsetsWhileBiDirectionalScrollControllerIsAttached()
00434         {
00435             ScrollPresenter scrollPresenter = null;
00436             Rectangle rectangleScrollPresenterContent = null;
00437             BiDirectionalScrollController biDirectionalScrollController = null;
00438             AutoResetEvent loadedEvent = new AutoResetEvent(false);
00439
00440             RunOnUIThread.Execute(() =>
00441             {
00442                 // We need the styles of the CompositionScrollController, so let's load them
00443                 App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00444
00445                 rectangleScrollPresenterContent = new Rectangle();
00446                 scrollPresenter = new ScrollPresenter();
00447                 biDirectionalScrollController = new BiDirectionalScrollController();
00448
00449                 biDirectionalScrollController.LogMessage += (BiDirectionalScrollController sender, string args) =>
00450                 {
00451                     Log.Comment(args);
00452                 };
00453
00454                 scrollPresenter.HorizontalScrollController = biDirectionalScrollController.HorizontalScrollController;
00455                 scrollPresenter.VerticalScrollController = biDirectionalScrollController.VerticalScrollController;
00456
00457                 SetupUIWithBiDirectionalScrollController(
00458                     scrollPresenter,
00459                     rectangleScrollPresenterContent,
00460                     biDirectionalScrollController,
00461                     loadedEvent);
00462             });
00463
00464             WaitForEvent("Waiting for Loaded event", loadedEvent);
00465
00466             RunOnUIThread.Execute(() =>
00467             {
00468                 Log.Comment("BiDirectionalScrollController size={0}, {1}", biDirectionalScrollController.ActualWidth, biDirectionalScrollController.ActualHeight);
00469             });
00470
00471             IdleSynchronizer.Wait();
00472
00473             Log.Comment("Jump to offsets");
00474             ScrollTo(
00475                 scrollPresenter,
00476                 (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth) / 2.0,
00477                 (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight) / 2.0,
00478                 ScrollingAnimationMode.Disabled,
00479                 ScrollingSnapPointsMode.Ignore,
00480                 hookViewChangingAndChanged: true,
00481                 isAnimationsEnabledOverride: null,
00482                 expectedFinalHorizontalOffset: (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth) / 2.0,
00483                 expectedFinalVerticalOffset: (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight) / 2.0);
00484
00485             Log.Comment("Animate to offsets");
00486             ScrollTo(
00487                 scrollPresenter,
00488                 (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth) / 4.0,
00489                 (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight) / 4.0,
00490                 ScrollingAnimationMode.Enabled,
00491                 ScrollingSnapPointsMode.Ignore,
00492                 hookViewChangingAndChanged: false,
00493                 isAnimationsEnabledOverride: null,
00494                 expectedFinalHorizontalOffset: (c_defaultUIScrollPresenterContentWidth - c_defaultUIScrollPresenterWidth) / 4.0,
00495                 expectedFinalVerticalOffset: (c_defaultUIScrollPresenterContentHeight - c_defaultUIScrollPresenterHeight) / 4.0);
00496
00497             Log.Comment("Jump to zoomFactor 2.0");
00498             ZoomTo(
00499                 scrollPresenter,
00500                 2.0f,
00501                 0.0f,
00502                 0.0f,
00503                 ScrollingAnimationMode.Disabled,
00504                 ScrollingSnapPointsMode.Ignore,
00505                 hookViewChangingAndChanged: false);
00506
00507             Log.Comment("Animate to zoomFactor 1.5");
00508             ZoomTo(
00509                 scrollPresenter,
00510                 1.5f,
00511                 0.0f,
00512                 0.0f,
00513                 ScrollingAnimationMode.Enabled,
00514                 ScrollingSnapPointsMode.Ignore,
00515                 hookViewChangingAndChanged: false);
00516         }
00517
00518         [TestMethod]
00519         [TestProperty("Description", "Change ScrollPresenter view via attached bi-directional scroll controller.")]
00520         public void ChangeOffsetsWithAttachedBiDirectionalScrollController()
00521         {
00522             ScrollPresenter scrollPresenter = null;
00523             Rectangle rectangleScrollPresenterContent = null;
00524             BiDirectionalScrollController biDirectionalScrollController = null;
00525             AutoResetEvent loadedEvent = new AutoResetEvent(false);
00526             AutoResetEvent scrollCompletedEvent = new AutoResetEvent(false);
00527
00528             RunOnUIThread.Execute(() =>
00529             {
00530                 // We need the styles of the CompositionScrollController, so let's load them
00531                 App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00532
00533                 rectangleScrollPresenterContent = new Rectangle();
00534                 scrollPresenter = new ScrollPresenter();
00535                 biDirectionalScrollController = new BiDirectionalScrollController();
00536
00537                 biDirectionalScrollController.LogMessage += (BiDirectionalScrollController sender, string args) =>
00538                 {
00539                     Log.Comment(args);
00540                 };
00541
00542                 scrollPresenter.HorizontalScrollController = biDirectionalScrollController.HorizontalScrollController;
00543                 scrollPresenter.VerticalScrollController = biDirectionalScrollController.VerticalScrollController;
00544
00545                 SetupUIWithBiDirectionalScrollController(
00546                     scrollPresenter,
00547                     rectangleScrollPresenterContent,
00548                     biDirectionalScrollController,
00549                     loadedEvent);
00550
00551                 biDirectionalScrollController.ScrollCompleted += (BiDirectionalScrollController sender, BiDirectionalScrollControllerScrollingScrollCompletedEventArgs args) =>
00552                 {
00553                     Log.Comment("ChangeOffset completed. OffsetsChangeCorrelationId=" + args);
00554
00555                     Log.Comment("Setting completion event");
00556                     scrollCompletedEvent.Set();
00557                 };
00558             });
00559
00560             WaitForEvent("Waiting for Loaded event", loadedEvent);
00561
00562             RunOnUIThread.Execute(() =>
00563             {
00564                 Log.Comment("BiDirectionalScrollController size={0}, {1}", biDirectionalScrollController.ActualWidth, biDirectionalScrollController.ActualHeight);
00565             });
00566
00567             Log.Comment("Jump to zoomFactor 0.75");
00568             ZoomTo(
00569                 scrollPresenter,
00570                 0.75f,
00571                 0.0f,
00572                 0.0f,
00573                 ScrollingAnimationMode.Disabled,
00574                 ScrollingSnapPointsMode.Ignore);
00575
00576             RunOnUIThread.Execute(() =>
00577             {
00578                 Log.Comment("Jumping to offsets");
00579                 biDirectionalScrollController.ScrollTo(
00580                     (c_defaultUIScrollPresenterContentWidth * 0.75 - c_defaultUIScrollPresenterWidth) / 4.0,
00581                     (c_defaultUIScrollPresenterContentHeight * 0.75 - c_defaultUIScrollPresenterHeight) / 4.0,
00582                     ScrollingAnimationMode.Disabled);
00583             });
00584
00585             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00586
00587             RunOnUIThread.Execute(() =>
00588             {
00589                 Verify.AreEqual((c_defaultUIScrollPresenterContentWidth * 0.75 - c_defaultUIScrollPresenterWidth) / 4.0, scrollPresenter.HorizontalOffset);
00590                 Verify.AreEqual((c_defaultUIScrollPresenterContentHeight * 0.75 - c_defaultUIScrollPresenterHeight) / 4.0, scrollPresenter.VerticalOffset);
00591
00592                 Log.Comment("Animating to offsets");
00593                 biDirectionalScrollController.ScrollTo(
00594                     (c_defaultUIScrollPresenterContentWidth * 0.75 - c_defaultUIScrollPresenterWidth) / 2.0,
00595                     (c_defaultUIScrollPresenterContentHeight * 0.75 - c_defaultUIScrollPresenterHeight) / 2.0,
00596                     ScrollingAnimationMode.Enabled);
00597
00598                 scrollCompletedEvent.Reset();
00599             });
00600
00601             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00602
00603             RunOnUIThread.Execute(() =>
00604             {
00605                 Verify.AreEqual((c_defaultUIScrollPresenterContentWidth * 0.75 - c_defaultUIScrollPresenterWidth) / 2.0, scrollPresenter.HorizontalOffset);
00606                 Verify.AreEqual((c_defaultUIScrollPresenterContentHeight * 0.75 - c_defaultUIScrollPresenterHeight) / 2.0, scrollPresenter.VerticalOffset);
00607             });
00608         }
00609
00610         [TestMethod]
00611         [TestProperty("Description", "Change ScrollPresenter view with additional velocity via attached bi-directional scroll controller.")]
00612         public void ChangeOffsetsWithAdditionalVelocityAndAttachedBiDirectionalScrollController()
00613         {
00614             ScrollPresenter scrollPresenter = null;
00615             Rectangle rectangleScrollPresenterContent = null;
00616             BiDirectionalScrollController biDirectionalScrollController = null;
00617             AutoResetEvent loadedEvent = new AutoResetEvent(false);
00618             AutoResetEvent scrollCompletedEvent = new AutoResetEvent(false);
00619
00620             RunOnUIThread.Execute(() =>
00621             {
00622                 // We need the styles of the CompositionScrollController, so let's load them
00623                 App.AppendResourceDictionaryToMergedDictionaries(App.AdditionStylesXaml);
00624
00625                 rectangleScrollPresenterContent = new Rectangle();
00626                 scrollPresenter = new ScrollPresenter();
00627                 biDirectionalScrollController = new BiDirectionalScrollController();
00628
00629                 biDirectionalScrollController.LogMessage += (BiDirectionalScrollController sender, string args) =>
00630                 {
00631                     Log.Comment(args);
00632                 };
00633
00634                 scrollPresenter.HorizontalScrollController = biDirectionalScrollController.HorizontalScrollController;
00635                 scrollPresenter.VerticalScrollController = biDirectionalScrollController.VerticalScrollController;
00636
00637                 SetupUIWithBiDirectionalScrollController(
00638                     scrollPresenter,
00639                     rectangleScrollPresenterContent,
00640                     biDirectionalScrollController,
00641                     loadedEvent);
00642
00643                 biDirectionalScrollController.ScrollCompleted += (BiDirectionalScrollController sender, BiDirectionalScrollControllerScrollingScrollCompletedEventArgs args) =>
00644                 {
00645                     Log.Comment("AddScrollVelocity completed. OffsetsChangeCorrelationId=" + args);
00646
00647                     Log.Comment("Setting completion event");
00648                     scrollCompletedEvent.Set();
00649                 };
00650             });
00651
00652             WaitForEvent("Waiting for Loaded event", loadedEvent);
00653
00654             RunOnUIThread.Execute(() =>
00655             {
00656                 Log.Comment("BiDirectionalScrollController size={0}, {1}", biDirectionalScrollController.ActualWidth, biDirectionalScrollController.ActualHeight);
00657             });
00658
00659             Log.Comment("Jump to zoomFactor 0.75");
00660             ZoomTo(
00661                 scrollPresenter,
00662                 0.75f,
00663                 0.0f,
00664                 0.0f,
00665                 ScrollingAnimationMode.Disabled,
00666                 ScrollingSnapPointsMode.Ignore);
00667
00668             RunOnUIThread.Execute(() =>
00669             {
00670                 Log.Comment("Adding velocity to offsets, with default inertia decay rates");
00671                 biDirectionalScrollController.AddScrollVelocity(
00672                     new Vector2(100.0f) /*offsetsVelocity*/, null /*inertiaDecayRate*/);
00673             });
00674
00675             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00676
00677             RunOnUIThread.Execute(() =>
00678             {
00679                 Log.Comment("scrollPresenter.HorizontalOffset={0}", scrollPresenter.HorizontalOffset);
00680                 Log.Comment("scrollPresenter.VerticalOffset={0}", scrollPresenter.VerticalOffset);
00681
00682                 Verify.IsTrue(scrollPresenter.HorizontalOffset > 20.0);
00683                 Verify.IsTrue(scrollPresenter.VerticalOffset > 20.0);
00684
00685                 Log.Comment("Adding negative velocity to offsets, with custom inertia decay rates");
00686                 biDirectionalScrollController.AddScrollVelocity(
00687                     new Vector2(-50.0f) /*offsetsVelocity*/, new Vector2(0.9f) /*inertiaDecayRate*/);
00688
00689                 scrollCompletedEvent.Reset();
00690             });
00691
00692             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00693
00694             RunOnUIThread.Execute(() =>
00695             {
00696                 Log.Comment("scrollPresenter.HorizontalOffset={0}", scrollPresenter.HorizontalOffset);
00697                 Log.Comment("scrollPresenter.VerticalOffset={0}", scrollPresenter.VerticalOffset);
00698
00699                 Verify.IsTrue(scrollPresenter.HorizontalOffset < 20.0);
00700                 Verify.IsTrue(scrollPresenter.VerticalOffset < 20.0);
00701
00702                 Log.Comment("Adding velocity to offsets, with no inertia decay rates");
00703                 biDirectionalScrollController.AddScrollVelocity(
00704                     new Vector2(200.0f) /*offsetsVelocity*/, new Vector2(0.0f) /*inertiaDecayRate*/);
00705
00706                 scrollCompletedEvent.Reset();
00707             });
00708
00709             WaitForEvent("Waiting for operation completion", scrollCompletedEvent);
00710
00711             RunOnUIThread.Execute(() =>
00712             {
00713                 Log.Comment("scrollPresenter.HorizontalOffset={0}", scrollPresenter.HorizontalOffset);
00714                 Log.Comment("scrollPresenter.VerticalOffset={0}", scrollPresenter.VerticalOffset);
00715
00716                 Verify.AreEqual(600.0, scrollPresenter.HorizontalOffset);
00717                 Verify.AreEqual(250.0, scrollPresenter.VerticalOffset);
00718             });
00719         }
00720
00721         private void SetupUIWithScrollControllers(
00722             ScrollPresenter scrollPresenter,
00723             Rectangle rectangleScrollPresenterContent,
00724             CompositionScrollController horizontalScrollController,
00725             CompositionScrollController verticalScrollController,
00726             AutoResetEvent loadedEvent)
00727         {
00728             Log.Comment("Setting up UI with ScrollPresenter and scroll controlllers" + (rectangleScrollPresenterContent == null ? "" : " and Rectangle"));
00729
00730             LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
00731
00732             GradientStop brownGS = new GradientStop() { Color = Microsoft.UI.Colors.Brown, Offset = 0.0 };
00733             twoColorLGB.GradientStops.Add(brownGS);
00734
00735             GradientStop orangeGS = new GradientStop() { Color = Microsoft.UI.Colors.Orange, Offset = 1.0 };
00736             twoColorLGB.GradientStops.Add(orangeGS);
00737
00738             if (rectangleScrollPresenterContent != null)
00739             {
00740                 rectangleScrollPresenterContent.Width = c_defaultUIScrollPresenterContentWidth;
00741                 rectangleScrollPresenterContent.Height = c_defaultUIScrollPresenterContentHeight;
00742                 rectangleScrollPresenterContent.Fill = twoColorLGB;
00743             }
00744
00745             Verify.IsNotNull(scrollPresenter);
00746             scrollPresenter.Width = c_defaultUIScrollPresenterWidth;
00747             scrollPresenter.Height = c_defaultUIScrollPresenterHeight;
00748             if (rectangleScrollPresenterContent != null)
00749             {
00750                 scrollPresenter.Content = rectangleScrollPresenterContent;
00751             }
00752
00753             horizontalScrollController.Width = c_defaultUIScrollPresenterWidth;
00754             horizontalScrollController.HorizontalAlignment = HorizontalAlignment.Left;
00755
00756             StackPanel horizontalStackPanel = new StackPanel();
00757             horizontalStackPanel.Orientation = Orientation.Horizontal;
00758             horizontalStackPanel.Children.Add(scrollPresenter);
00759             horizontalStackPanel.Children.Add(verticalScrollController);
00760
00761             StackPanel verticalStackPanel = new StackPanel();
00762             verticalStackPanel.Children.Add(horizontalStackPanel);
00763             verticalStackPanel.Children.Add(horizontalScrollController);
00764             verticalStackPanel.Width = c_defaultUIScrollPresenterWidth + c_defaultUIScrollControllerThickness;
00765
00766             if (loadedEvent != null)
00767             {
00768                 verticalStackPanel.Loaded += (object sender, RoutedEventArgs e) =>
00769                 {
00770                     Log.Comment("Loaded event handler");
00771                     loadedEvent.Set();
00772                 };
00773             }
00774
00775             Log.Comment("Setting window content");
00776             Content = verticalStackPanel;
00777         }
00778
00779         private void SetupUIWithBiDirectionalScrollController(
00780             ScrollPresenter scrollPresenter,
00781             Rectangle rectangleScrollPresenterContent,
00782             BiDirectionalScrollController biDirectionalScrollController,
00783             AutoResetEvent loadedEvent)
00784         {
00785             Log.Comment("Setting up UI with ScrollPresenter and bi-directional scroll controller" + (rectangleScrollPresenterContent == null ? "" : " and Rectangle"));
00786
00787             LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
00788
00789             GradientStop brownGS = new GradientStop() { Color = Microsoft.UI.Colors.Brown, Offset = 0.0 };
00790             twoColorLGB.GradientStops.Add(brownGS);
00791
00792             GradientStop orangeGS = new GradientStop() { Color = Microsoft.UI.Colors.Orange, Offset = 1.0 };
00793             twoColorLGB.GradientStops.Add(orangeGS);
00794
00795             if (rectangleScrollPresenterContent != null)
00796             {
00797                 rectangleScrollPresenterContent.Width = c_defaultUIScrollPresenterContentWidth;
00798                 rectangleScrollPresenterContent.Height = c_defaultUIScrollPresenterContentHeight;
00799                 rectangleScrollPresenterContent.Fill = twoColorLGB;
00800             }
00801
00802             Verify.IsNotNull(scrollPresenter);
00803             scrollPresenter.Width = c_defaultUIScrollPresenterWidth;
00804             scrollPresenter.Height = c_defaultUIScrollPresenterHeight;
00805             if (rectangleScrollPresenterContent != null)
00806             {
00807                 scrollPresenter.Content = rectangleScrollPresenterContent;
00808             }
00809
00810             biDirectionalScrollController.Width = c_defaultUIScrollPresenterHeight;
00811             biDirectionalScrollController.Height = c_defaultUIScrollPresenterHeight;
00812
00813             StackPanel horizontalStackPanel = new StackPanel();
00814             horizontalStackPanel.Orientation = Orientation.Horizontal;
00815             horizontalStackPanel.Children.Add(scrollPresenter);
00816             horizontalStackPanel.Children.Add(biDirectionalScrollController);
00817
00818             if (loadedEvent != null)
00819             {
00820                 horizontalStackPanel.Loaded += (object sender, RoutedEventArgs e) =>
00821                 {
00822                     Log.Comment("Loaded event handler");
00823                     loadedEvent.Set();
00824                 };
00825             }
00826
00827             Log.Comment("Setting window content");
00828             Content = horizontalStackPanel;
00829         }
00830     }
00831 }
Generated on Sun Dec 1 2024 20:52:12 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InteractionTrackerAsyncOperation Member List

This is the complete list of members for InteractionTrackerAsyncOperation, including all inherited members.
GetOperationTrigger() const | InteractionTrackerAsyncOperation | [inline]
GetOperationType() const | InteractionTrackerAsyncOperation | [inline]
GetRequestId() const | InteractionTrackerAsyncOperation | [inline]
GetRequiredOperation() const | InteractionTrackerAsyncOperation | [inline]
GetTicksCountdown() const | InteractionTrackerAsyncOperation | [inline]
GetViewChangeBase() const | InteractionTrackerAsyncOperation | [inline]
GetViewChangeCorrelationId() const | InteractionTrackerAsyncOperation | [inline]
InteractionTrackerAsyncOperation(InteractionTrackerAsyncOperationType operationType, InteractionTrackerAsyncOperationTrigger operationTrigger, bool isDelayed, std::shared_ptr< ViewChangeBase > viewChangeBase) | InteractionTrackerAsyncOperation |
IsAnimated() const | InteractionTrackerAsyncOperation | [inline]
IsCanceled() const | InteractionTrackerAsyncOperation | [inline]
IsCompleted() const | InteractionTrackerAsyncOperation | [inline]
IsDelayed() const | InteractionTrackerAsyncOperation | [inline]
IsHorizontalScrollControllerRequest() const | InteractionTrackerAsyncOperation | [inline]
IsQueued() const | InteractionTrackerAsyncOperation | [inline]
IsUnqueueing() const | InteractionTrackerAsyncOperation | [inline]
IsVerticalScrollControllerRequest() const | InteractionTrackerAsyncOperation | [inline]
m_viewChangeBase | InteractionTrackerAsyncOperation | [private]
SetIsCanceled(bool isCanceled) | InteractionTrackerAsyncOperation | [inline]
SetIsCompleted(bool isCompleted) | InteractionTrackerAsyncOperation | [inline]
SetIsDelayed(bool isDelayed) | InteractionTrackerAsyncOperation | [inline]
SetIsScrollControllerRequest(bool isFromHorizontalScrollController) | InteractionTrackerAsyncOperation | [inline]
SetMaxTicksCountdown() | InteractionTrackerAsyncOperation | [inline]
SetRequestId(int requestId) | InteractionTrackerAsyncOperation | [inline]
SetRequiredOperation(std::shared_ptr< InteractionTrackerAsyncOperation > requiredOperation) | InteractionTrackerAsyncOperation | [inline]
SetTicksCountdown(int ticksCountdown) | InteractionTrackerAsyncOperation | [inline]
SetViewChangeCorrelationId(int32_t viewChangeCorrelationId) | InteractionTrackerAsyncOperation | [inline]
TickNonAnimatedOperation() | InteractionTrackerAsyncOperation | [inline]
TickQueuedOperation() | InteractionTrackerAsyncOperation | [inline]
~InteractionTrackerAsyncOperation() | InteractionTrackerAsyncOperation |
Generated on Sun Dec 1 2024 20:52:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/NavigationViewItemPresenter.properties.h Source File

  • Generated

NavigationViewItemPresenter.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class NavigationViewItemPresenterProperties
00008 {
00009 public:
00010     NavigationViewItemPresenterProperties();
00011
00012     void Icon(winrt::IconElement const& value);
00013     winrt::IconElement Icon();
00014
00015     void InfoBadge(winrt::InfoBadge const& value);
00016     winrt::InfoBadge InfoBadge();
00017
00018     void TemplateSettings(winrt::NavigationViewItemPresenterTemplateSettings const& value);
00019     winrt::NavigationViewItemPresenterTemplateSettings TemplateSettings();
00020
00021     static winrt::DependencyProperty IconProperty() { return s_IconProperty; }
00022     static winrt::DependencyProperty InfoBadgeProperty() { return s_InfoBadgeProperty; }
00023     static winrt::DependencyProperty TemplateSettingsProperty() { return s_TemplateSettingsProperty; }
00024
00025     static GlobalDependencyProperty s_IconProperty;
00026     static GlobalDependencyProperty s_InfoBadgeProperty;
00027     static GlobalDependencyProperty s_TemplateSettingsProperty;
00028
00029     static void EnsureProperties();
00030     static void ClearProperties();
00031 };
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollControllerAddScrollVelocityRequestedEventArgs.cpp Source File

  • ScrollPresenter

ScrollControllerAddScrollVelocityRequestedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenter.h"
00008 #include "ScrollControllerAddScrollVelocityRequestedEventArgs.h"
00009
00010 #include "ScrollControllerAddScrollVelocityRequestedEventArgs.properties.cpp"
00011
00012 ScrollControllerAddScrollVelocityRequestedEventArgs::ScrollControllerAddScrollVelocityRequestedEventArgs(
00013     float offsetVelocity,
00014     winrt::IReference<float> inertiaDecayRate)
00015 {
00016     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR_FLT, METH_NAME, this,
00017         TypeLogging::NullableFloatToString(inertiaDecayRate).c_str(), offsetVelocity);
00018
00019     m_offsetVelocity = offsetVelocity;
00020     m_inertiaDecayRate = inertiaDecayRate;
00021 }
00022
00023 float ScrollControllerAddScrollVelocityRequestedEventArgs::OffsetVelocity() const
00024 {
00025     return m_offsetVelocity;
00026 }
00027
00028 winrt::IReference<float> ScrollControllerAddScrollVelocityRequestedEventArgs::InertiaDecayRate() const
00029 {
00030     return m_inertiaDecayRate;
00031 }
00032
00033 int32_t ScrollControllerAddScrollVelocityRequestedEventArgs::CorrelationId() const
00034 {
00035     return m_correlationId;
00036 }
00037
00038 void ScrollControllerAddScrollVelocityRequestedEventArgs::CorrelationId(int32_t correlationId)
00039 {
00040     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, correlationId);
00041
00042     m_correlationId = correlationId;
00043 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/TestUI/RevealPage.xaml.cs Source File

  • Materials
  • Reveal
  • TestUI

RevealPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Controls;
00005
00006 namespace MUXControlsTestApp
00007 {
00008     [TopLevelTestPage(Name = "Reveal", Icon = "Reveal.png")]
00009     public sealed partial class RevealPage : TestPage
00010     {
00011         public RevealPage()
00012         {
00013             this.InitializeComponent();
00014
00015             navigateToBasicReveal.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealBasicPage), 0); };
00016             navigateToAdvReveal.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealListPage), 0); };
00017             navigateToColorReveal.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealColorPage), 0); };
00018             navigateToSimpleListReveal.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealSimpleListPage), 0); };
00019             navigateToRevealScenarios.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealScenarios), 0); };
00020             navigateToRevealFallback.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealFallbackPage), 0); };
00021             navigateToRevealStates.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealStatesPage), 0); };
00022             navigateToRevealRegressionTests.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealRegressionTestsPage), 0); };
00023             navigateToCoreWindowEventsTests.Click += delegate { Frame.NavigateWithoutAnimation(typeof(CoreWindowEventsPage), 0); };
00024 #if FEATURE_NAVIGATIONVIEW_ENABLED
00025             navigateToRevealMarkup.Click += delegate { Frame.NavigateWithoutAnimation(typeof(RevealMarkupPage), 0); };
00026 #endif
00027         }
00028     }
00029 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/SelectionModelChildrenRequestedEventArgs.h Source File

  • Repeater

SelectionModelChildrenRequestedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SelectionModelChildrenRequestedEventArgs.g.h"
00007
00008 class SelectionModelChildrenRequestedEventArgs :
00009     public ReferenceTracker<SelectionModelChildrenRequestedEventArgs, winrt::implementation::SelectionModelChildrenRequestedEventArgsT, winrt::composable, winrt::composing>
00010 {
00011 public:
00012     SelectionModelChildrenRequestedEventArgs(const winrt::IInspectable& data, const winrt::IndexPath& sourceIndexPath, bool throwOnAccess);
00013
00014 #pragma region ISelectionModelChildrenRequestedEventArgs
00015     winrt::IInspectable Source();
00016     winrt::IndexPath SourceIndex();
00017     winrt::IInspectable Children();
00018     void Children(winrt::IInspectable const& value);
00019 #pragma endregion
00020
00021     void Initialize(const winrt::IInspectable& source, const winrt::IndexPath& sourceIndexPath, bool throwOnAccess);
00022
00023 private:
00024     tracker_ref<winrt::IInspectable> m_source{ this };
00025     tracker_ref<winrt::IndexPath> m_sourceIndexPath{ this };
00026     tracker_ref<winrt::IInspectable> m_children{ this };
00027     // This flag allows for the re-use of a SelectionModelChildrenRequestedEventArgs object.
00028     // We do not want someone to cache the args object and access its properties later on, so we use this flag to only allow property access in the ChildrenRequested event handler.
00029     bool m_throwOnAccess{ true };
00030 };
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SelectorBar/SelectorBarItemAutomationPeer.h Source File

  • SelectorBar

SelectorBarItemAutomationPeer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SelectorBarItem.h"
00007 #include "ItemContainerAutomationPeer.h"
00008 #include "SelectorBarItemAutomationPeer.g.h"
00009
00010 class SelectorBarItemAutomationPeer :
00011     public winrt::implementation::SelectorBarItemAutomationPeerT<SelectorBarItemAutomationPeer, ItemContainerAutomationPeer>
00012 {
00013 public:
00014     ForwardRefToBaseReferenceTracker(ItemContainerAutomationPeer)
00015
00016     SelectorBarItemAutomationPeer(winrt::FrameworkElement const& owner);
00017
00018     // IAutomationPeerOverrides
00019     winrt::hstring GetNameCore() override;
00020     winrt::hstring GetLocalizedControlTypeCore() override;
00021     winrt::hstring GetClassNameCore() override;
00022 };
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarEraserFlyoutItemClickedEventArgs.h Source File

  • InkToolBar

InkToolBarEraserFlyoutItemClickedEventArgs.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarEraserFlyoutItemClickedEventArgs.g.h"
00011
00012 class InkToolBarEraserFlyoutItemClickedEventArgs :
00013     public ReferenceTracker<InkToolBarEraserFlyoutItemClickedEventArgs, winrt::implementation::InkToolBarEraserFlyoutItemClickedEventArgsT>
00014 {
00015 public:
00016
00017     winrt::InkToolBarEraserFlyoutItemKind EraserFlyoutItemKind() { winrt::throw_hresult(E_NOTIMPL); }
00018     bool Handled() { winrt::throw_hresult(E_NOTIMPL); }
00019     void Handled(bool value) { winrt::throw_hresult(E_NOTIMPL); }
00020 };
00021
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarTrace Member List

This is the complete list of members for InkToolBarTrace, including all inherited members.
s_IsDebugOutputEnabled | InkToolBarTrace | [static]
s_IsVerboseDebugOutputEnabled | InkToolBarTrace | [static]
TraceInfo(bool includeTraceLogging, const winrt::IInspectable &sender, PCWSTR message,...) noexcept | InkToolBarTrace | [inline, static]
TraceVerbose(bool includeTraceLogging, const winrt::IInspectable &sender, PCWSTR message,...) noexcept | InkToolBarTrace | [inline, static]
Generated on Sun Dec 1 2024 20:52:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TreeView.properties.h Source File

  • Generated

TreeView.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class TreeViewProperties
00008 {
00009 public:
00010     TreeViewProperties();
00011
00012     void CanDragItems(bool value);
00013     bool CanDragItems();
00014
00015     void CanReorderItems(bool value);
00016     bool CanReorderItems();
00017
00018     void ItemContainerStyle(winrt::Style const& value);
00019     winrt::Style ItemContainerStyle();
00020
00021     void ItemContainerStyleSelector(winrt::StyleSelector const& value);
00022     winrt::StyleSelector ItemContainerStyleSelector();
00023
00024     void ItemContainerTransitions(winrt::TransitionCollection const& value);
00025     winrt::TransitionCollection ItemContainerTransitions();
00026
00027     void ItemsSource(winrt::IInspectable const& value);
00028     winrt::IInspectable ItemsSource();
00029
00030     void ItemTemplate(winrt::DataTemplate const& value);
00031     winrt::DataTemplate ItemTemplate();
00032
00033     void ItemTemplateSelector(winrt::DataTemplateSelector const& value);
00034     winrt::DataTemplateSelector ItemTemplateSelector();
00035
00036     void SelectedItem(winrt::IInspectable const& value);
00037     winrt::IInspectable SelectedItem();
00038
00039     void SelectionMode(winrt::TreeViewSelectionMode const& value);
00040     winrt::TreeViewSelectionMode SelectionMode();
00041
00042     static winrt::DependencyProperty CanDragItemsProperty() { return s_CanDragItemsProperty; }
00043     static winrt::DependencyProperty CanReorderItemsProperty() { return s_CanReorderItemsProperty; }
00044     static winrt::DependencyProperty ItemContainerStyleProperty() { return s_ItemContainerStyleProperty; }
00045     static winrt::DependencyProperty ItemContainerStyleSelectorProperty() { return s_ItemContainerStyleSelectorProperty; }
00046     static winrt::DependencyProperty ItemContainerTransitionsProperty() { return s_ItemContainerTransitionsProperty; }
00047     static winrt::DependencyProperty ItemsSourceProperty() { return s_ItemsSourceProperty; }
00048     static winrt::DependencyProperty ItemTemplateProperty() { return s_ItemTemplateProperty; }
00049     static winrt::DependencyProperty ItemTemplateSelectorProperty() { return s_ItemTemplateSelectorProperty; }
00050     static winrt::DependencyProperty SelectedItemProperty() { return s_SelectedItemProperty; }
00051     static winrt::DependencyProperty SelectionModeProperty() { return s_SelectionModeProperty; }
00052
00053     static GlobalDependencyProperty s_CanDragItemsProperty;
00054     static GlobalDependencyProperty s_CanReorderItemsProperty;
00055     static GlobalDependencyProperty s_ItemContainerStyleProperty;
00056     static GlobalDependencyProperty s_ItemContainerStyleSelectorProperty;
00057     static GlobalDependencyProperty s_ItemContainerTransitionsProperty;
00058     static GlobalDependencyProperty s_ItemsSourceProperty;
00059     static GlobalDependencyProperty s_ItemTemplateProperty;
00060     static GlobalDependencyProperty s_ItemTemplateSelectorProperty;
00061     static GlobalDependencyProperty s_SelectedItemProperty;
00062     static GlobalDependencyProperty s_SelectionModeProperty;
00063
00064     winrt::event_token Collapsed(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewCollapsedEventArgs> const& value);
00065     void Collapsed(winrt::event_token const& token);
00066     winrt::event_token DragItemsCompleted(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewDragItemsCompletedEventArgs> const& value);
00067     void DragItemsCompleted(winrt::event_token const& token);
00068     winrt::event_token DragItemsStarting(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewDragItemsStartingEventArgs> const& value);
00069     void DragItemsStarting(winrt::event_token const& token);
00070     winrt::event_token Expanding(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewExpandingEventArgs> const& value);
00071     void Expanding(winrt::event_token const& token);
00072     winrt::event_token ItemInvoked(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewItemInvokedEventArgs> const& value);
00073     void ItemInvoked(winrt::event_token const& token);
00074     winrt::event_token SelectionChanged(winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewSelectionChangedEventArgs> const& value);
00075     void SelectionChanged(winrt::event_token const& token);
00076
00077     event_source<winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewCollapsedEventArgs>> m_collapsedEventSource;
00078     event_source<winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewDragItemsCompletedEventArgs>> m_dragItemsCompletedEventSource;
00079     event_source<winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewDragItemsStartingEventArgs>> m_dragItemsStartingEventSource;
00080     event_source<winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewExpandingEventArgs>> m_expandingEventSource;
00081     event_source<winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewItemInvokedEventArgs>> m_itemInvokedEventSource;
00082     event_source<winrt::TypedEventHandler<winrt::TreeView, winrt::TreeViewSelectionChangedEventArgs>> m_selectionChangedEventSource;
00083
00084     static void EnsureProperties();
00085     static void ClearProperties();
00086
00087     static void OnItemsSourcePropertyChanged(
00088         winrt::DependencyObject const& sender,
00089         winrt::DependencyPropertyChangedEventArgs const& args);
00090
00091     static void OnSelectedItemPropertyChanged(
00092         winrt::DependencyObject const& sender,
00093         winrt::DependencyPropertyChangedEventArgs const& args);
00094
00095     static void OnSelectionModePropertyChanged(
00096         winrt::DependencyObject const& sender,
00097         winrt::DependencyPropertyChangedEventArgs const& args);
00098 };
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/TestUI/BreadcrumbBarPage.xaml.cs Source File

  • Breadcrumb
  • TestUI

BreadcrumbBarPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Controls;
00006 using Microsoft.UI.Xaml.Controls.Primitives;
00007
00008 using BreadcrumbBar = Microsoft.UI.Xaml.Controls.BreadcrumbBar;
00009 using Breadcrumb_TestUI;
00010 using System.Collections.Generic;
00011 using System.Collections.ObjectModel;
00012 using Microsoft.UI.Xaml.Controls;
00013 using System.Linq;
00014
00015 namespace MUXControlsTestApp
00016 {
00017     [TopLevelTestPage(Name = "BreadcrumbBar")]
00018     public sealed partial class BreadcrumbBarPage : TestPage
00019     {
00020         private TreeStructure Tree = new TreeStructure();
00021         public ObservableCollection<object> breadCrumbList { get; } = new ObservableCollection<object>();
00022
00023         public ObservableCollection<object> currentNodeChildrenList { get; } = new ObservableCollection<object>();
00024
00025         private const int maxDepth = 7;
00026
00027         public BreadcrumbBarPage()
00028         {
00029             this.InitializeComponent();
00030             InitializeBreadcrumbAndChildren();
00031         }
00032
00033         private void InitializeBreadcrumbAndChildren()
00034         {
00035             // GenerateTree();
00036             GenerateTreeDynamic();
00037
00038             breadCrumbList.Add(Tree.Root);
00039             UpdateChildrenList(Tree.Root);
00040         }
00041
00042         private void GenerateTree()
00043         {
00044             Tree.Root = new TreeNode() {
00045                 Name = "Root",
00046                 Children = new List<object>()
00047                 {
00048                     new TreeNode()
00049                     {
00050                         Name = "A1",
00051                         Children = new List<object>()
00052                         {
00053                             new TreeNode()
00054                             {
00055                                 Name = "Nested A1"
00056                             },
00057                             new TreeNode()
00058                             {
00059                                 Name = "Nested A2"
00060                             },
00061                             new TreeNode()
00062                             {
00063                                 Name = "Nested A3"
00064                             },
00065                         }
00066                     },
00067                     new TreeNode()
00068                     {
00069                         Name = "B1",
00070                         Children = new List<object>()
00071                         {
00072                             new TreeNode()
00073                             {
00074                                 Name = "Nested B1"
00075                             },
00076                             new TreeNode()
00077                             {
00078                                 Name = "Nested B2"
00079                             },
00080                             new TreeNode()
00081                             {
00082                                 Name = "Nested B3"
00083                             },
00084                         }
00085                     },
00086                     new TreeNode()
00087                     {
00088                         Name = "C1",
00089                         Children = new List<object>()
00090                         {
00091                             new TreeNode()
00092                             {
00093                                 Name = "Nested C1"
00094                             },
00095                             new TreeNode()
00096                             {
00097                                 Name = "Nested C2"
00098                             },
00099                             new TreeNode()
00100                             {
00101                                 Name = "Nested C3"
00102                             },
00103                         }
00104                     }
00105                 }
00106             };
00107
00108             Tree.UpdateParents();
00109         }
00110
00111         private void GenerateTreeDynamic()
00112         {
00113             Tree.Root = new TreeNode() { Name = "Root" };
00114             CreateChildrenForNode(Tree.Root, 1);
00115
00116             Tree.UpdateParents();
00117         }
00118
00119         private void CreateChildrenForNode(TreeNode node, int depth)
00120         {
00121             if (depth > maxDepth)
00122             {
00123                 return;
00124             }
00125
00126             node.Children = new List<object>();
00127
00128             for (int i = 0; i < 3; ++i)
00129             {
00130                 string nodeName = "";
00131                 if (depth == 1)
00132                 {
00133                     // This will yield stuff as 'Node A' or 'Node B'
00134                     nodeName = "Node " + (char)('A' + i);
00135                 }
00136                 else
00137                 {
00138                     nodeName = node.Name + "_" + (i + 1);
00139                 }
00140
00141                 TreeNode child = new TreeNode() { Name = nodeName };
00142                 node.Children.Add(child);
00143                 CreateChildrenForNode(child, depth + 1);
00144             }
00145         }
00146
00147         private void ItemsRepeater_ButtonClick(object sender, RoutedEventArgs e)
00148         {
00149             Button btn = sender as Button;
00150             TreeNode treeNode = btn.Content as TreeNode;
00151             ReplaceList(breadCrumbList, treeNode.GetBreadCrumbPath());
00152             UpdateChildrenList(treeNode);
00153         }
00154
00155         private void WidthSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
00156         {
00157             if (BreadcrumbContainerColumn == null)
00158             {
00159                 return;
00160             }
00161
00162             BreadcrumbContainerColumn.Width = new GridLength(e.NewValue, GridUnitType.Pixel);
00163         }
00164
00165         private void RTL_Checked(object sender, RoutedEventArgs e)
00166         {
00167             BreadcrumbControl.FlowDirection = FlowDirection.RightToLeft;
00168         }
00169
00170         private void RTL_Unchecked(object sender, RoutedEventArgs e)
00171         {
00172             BreadcrumbControl.FlowDirection = FlowDirection.LeftToRight;
00173         }
00174
00175         private void ReplaceList(ObservableCollection<object> oldItemsList, List<object> newItemsList)
00176         {
00177             oldItemsList.Clear();
00178
00179             foreach (object child in newItemsList)
00180             {
00181                 oldItemsList.Add(child);
00182             }
00183         }
00184
00185         private void UpdateChildrenList(TreeNode node)
00186         {
00187             ReplaceList(currentNodeChildrenList, node.Children);
00188         }
00189
00190         private void BreadcrumbControl_ItemClicked(BreadcrumbBar sender, Microsoft.UI.Xaml.Controls.BreadcrumbBarItemClickedEventArgs args)
00191         {
00192             LastClickedItem.Text = args.Item.ToString();
00193             LastClickedItemIndex.Text = args.Index.ToString();
00194
00195             if (args.Item is TreeNode treeNode)
00196             {
00197                 ReplaceList(breadCrumbList, treeNode.GetBreadCrumbPath());
00198                 UpdateChildrenList(treeNode);
00199             }
00200         }
00201
00202         private void Child_ElementPrepared(object sender, ItemsRepeaterElementPreparedEventArgs e)
00203         {
00204             Button button = e.Element as Button;
00205             TreeNode node = (currentNodeChildrenList.ToArray<object>().GetValue(e.Index) as TreeNode);
00206
00207             button.Name = node.Name;
00208         }
00209     }
00210 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

VectorInnerImpl< VectorOptions, Wrapper > Member List

This is the complete list of members for VectorInnerImpl< VectorOptions, Wrapper >, including all inherited members.
Append(typename T_type const &value) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
Clear() | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
GetAt(uint32_t const index, bool useSafeGet) | VectorInnerImpl< VectorOptions, Wrapper > | [inline, private]
GetAt(uint32_t const index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
GetMany(uint32_t const startIndex, winrt::array_view< T_type > values) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
GetTrackerHandlerManager() | VectorInnerImpl< VectorOptions, Wrapper > | [inline, protected]
IndexOf(typename T_type const &value, uint32_t &index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
IndexOf_OptimizedForRemove(typename T_type const &value, uint32_t &index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
InsertAt(uint32_t const index, typename T_type const &value) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
m_optimizedIndexOf_StartNextSearchAt | VectorInnerImpl< VectorOptions, Wrapper > | [protected]
m_vector | VectorInnerImpl< VectorOptions, Wrapper > | [protected]
RaiseChildrenChanged(winrt::CollectionChange collectionChange, unsigned int index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline, virtual]
RemoveAt(uint32_t const index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
RemoveAtEnd() | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
ReplaceAll(winrt::array_view< T_type const > values) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
reserve(unsigned int n) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
SafeGetAt(uint32_t const index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
SetAt(uint32_t const index, typename T_type const &value) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
Size() | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
unwrap(T_Storage const &hold, bool useSafeGet=false) | VectorInnerImpl< VectorOptions, Wrapper > | [inline, protected]
VectorInnerImpl(ITrackerHandleManager *trackerHandleManager) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
wrap(typename T_type value) | VectorInnerImpl< VectorOptions, Wrapper > | [inline, protected]
Generated on Sun Dec 1 2024 20:53:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ObservableVector< T > Member List

This is the complete list of members for ObservableVector< T >, including all inherited members.
Append(winrt::IInspectable const &value) | ObservableVector< T > | [inline]
Clear() | ObservableVector< T > | [inline]
First() | ObservableVector< T > | [inline]
GetAt(uint32_t index) | ObservableVector< T > | [inline]
GetMany(uint32_t const startIndex, winrt::array_view< winrt::IInspectable > values) | ObservableVector< T > | [inline]
GetView() | ObservableVector< T > | [inline]
IndexOf(winrt::IInspectable const &value, uint32_t &index) | ObservableVector< T > | [inline]
InsertAt(uint32_t index, winrt::IInspectable const &value) | ObservableVector< T > | [inline]
m_changed | ObservableVector< T > | [private]
m_innerChangedRevoker | ObservableVector< T > | [private]
RemoveAt(uint32_t index) | ObservableVector< T > | [inline]
RemoveAtEnd() | ObservableVector< T > | [inline]
ReplaceAll(winrt::array_view< winrt::IInspectable const > value) | ObservableVector< T > | [inline]
SetAt(uint32_t const index, winrt::IInspectable const &value) | ObservableVector< T > | [inline]
Size() | ObservableVector< T > | [inline]
VectorChanged(winrt::VectorChangedEventHandler< winrt::IInspectable > const &handler) | ObservableVector< T > | [inline]
VectorChanged(winrt::event_token const cookie) | ObservableVector< T > | [inline]
Generated on Sun Dec 1 2024 20:52:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

FlowLayoutState Member List

This is the complete list of members for FlowLayoutState, including all inherited members.
abi_enter() | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
BufferSize | FlowLayoutState | [private, static]
CheckThread() | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< FlowLayoutState > &&self) noexcept | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
final_release(std::unique_ptr< FlowLayoutState > &&self) | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline, static]
FlowAlgorithm() | FlowLayoutState | [inline]
GetBase() | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
GetInner() | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
InitializeForContext(const winrt::VirtualizingLayoutContext &context, IFlowLayoutAlgorithmDelegates *callbacks) | FlowLayoutState |
IsOnThread() | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
OnLineArranged(int startIndex, int countInLine, double lineSize, const winrt::VirtualizingLayoutContext &context) | FlowLayoutState |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< FlowLayoutState, winrt::implementation::FlowLayoutStateT, winrt::composing > | [inline]
SpecialElementDesiredSize() const | FlowLayoutState | [inline]
SpecialElementDesiredSize(winrt::Size value) | FlowLayoutState | [inline]
TotalItemsPerLine() const | FlowLayoutState | [inline]
TotalLineSize() const | FlowLayoutState | [inline]
TotalLinesMeasured() const | FlowLayoutState | [inline]
UninitializeForContext(const winrt::VirtualizingLayoutContext &context) | FlowLayoutState |
Generated on Sun Dec 1 2024 20:52:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IAdapterAnimationHandler Member List

This is the complete list of members for IAdapterAnimationHandler, including all inherited members.
InteractionTrackerAnimation(Microsoft.UI.Xaml.UIElement refreshVisualizer, Microsoft.UI.Xaml.UIElement infoProvider, Microsoft.UI.Composition.Interactions.InteractionTracker interactionTracker) | IAdapterAnimationHandler
RefreshCompletedAnimation(Microsoft.UI.Xaml.UIElement refreshVisualizer, Microsoft.UI.Xaml.UIElement infoProvider) | IAdapterAnimationHandler
RefreshRequestedAnimation(Microsoft.UI.Xaml.UIElement refreshVisualizer, Microsoft.UI.Xaml.UIElement infoProvider, Double executionRatio) | IAdapterAnimationHandler
Generated on Sun Dec 1 2024 20:53:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollingScrollCompletedEventArgs.cpp Source File

  • ScrollPresenter

ScrollingScrollCompletedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ScrollingScrollCompletedEventArgs.h"
00007
00008 int32_t ScrollingScrollCompletedEventArgs::CorrelationId()
00009 {
00010     return m_offsetsChangeCorrelationId;
00011 }
00012
00013 ScrollPresenterViewChangeResult ScrollingScrollCompletedEventArgs::Result()
00014 {
00015     return m_result;
00016 }
00017
00018 void ScrollingScrollCompletedEventArgs::OffsetsChangeCorrelationId(int32_t offsetsChangeCorrelationId)
00019 {
00020     m_offsetsChangeCorrelationId = offsetsChangeCorrelationId;
00021 }
00022
00023 void ScrollingScrollCompletedEventArgs::Result(ScrollPresenterViewChangeResult result)
00024 {
00025     m_result = result;
00026 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/ScrollViewerIRefreshInfoProviderAdapter/ScrollViewerIRefreshInfoProviderAdapter.h Source File

  • PullToRefresh
  • ScrollViewerIRefreshInfoProviderAdapter

ScrollViewerIRefreshInfoProviderAdapter.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "RefreshInfoProviderImpl.h"
00006 #include "ScrollViewerIRefreshInfoProviderDefaultAnimationHandler.h"
00007
00008 #include "ScrollViewerIRefreshInfoProviderAdapter.g.h"
00009
00010 class ScrollViewerIRefreshInfoProviderAdapter :
00011     public ReferenceTracker<ScrollViewerIRefreshInfoProviderAdapter, winrt::implementation::ScrollViewerIRefreshInfoProviderAdapterT, winrt::composable, winrt::composing>
00012 {
00013 public:
00014     ScrollViewerIRefreshInfoProviderAdapter(winrt::RefreshPullDirection const& refreshPullDirection, winrt::IAdapterAnimationHandler const& animationHandler);
00015     ~ScrollViewerIRefreshInfoProviderAdapter();
00016
00017     winrt::IRefreshInfoProvider AdaptFromTree(winrt::UIElement const& root, winrt::Size const& size);
00018     winrt::IRefreshInfoProvider Adapt(winrt::FxScrollViewer const& adaptee, winrt::Size const& size);
00019     void SetAnimations(winrt::UIElement const& refreshVisualizerContainer);
00020
00021 private:
00022     void OnRefreshStarted(const winrt::IInspectable& sender, const winrt::IInspectable& args);
00023     void OnRefreshCompleted(const winrt::IInspectable& sender, const winrt::IInspectable& args);
00024
00025     void OnScrollViewerLoaded(const winrt::IInspectable& sender, const winrt::IInspectable& args);
00026     void OnScrollViewerDirectManipulationCompleted(const winrt::IInspectable& sender, const winrt::IInspectable& args);
00027     void OnScrollViewerViewChanging(const winrt::IInspectable& sender, const winrt::Microsoft::UI::Xaml::Controls::ScrollViewerViewChangingEventArgs& args);
00028
00029     bool IsWithinOffsetThreshold();
00030     void CleanupScrollViewer();
00031     void CleanupIRefreshInfoProvider();
00032
00033     bool IsOrientationVertical();
00034     winrt::UIElement GetScrollContent();
00035     winrt::FxScrollViewer AdaptFromTreeRecursiveHelper(const winrt::DependencyObject&, int depth);
00036     void MakeInteractionSource(const winrt::UIElement& contentParent);
00037
00038     tracker_com_ref<RefreshInfoProviderImpl> m_infoProvider{ this };
00039     tracker_ref<winrt::IAdapterAnimationHandler> m_animationHandler{ this };
00040     tracker_ref<winrt::FxScrollViewer> m_scrollViewer{ this };
00041     winrt::RefreshPullDirection m_refreshPullDirection{ winrt::RefreshPullDirection::TopToBottom };
00042     tracker_ref<winrt::InteractionTracker> m_interactionTracker{ this };
00043     tracker_ref<winrt::VisualInteractionSource> m_visualInteractionSource{ this };
00044     bool m_visualInteractionSourceIsAttached{ false };
00045
00046     winrt::event_token m_scrollViewer_LoadedToken{};
00047     winrt::event_token m_scrollViewer_PointerPressedToken{};
00048     winrt::event_token m_scrollViewer_DirectManipulationCompletedToken{};
00049     winrt::event_token m_scrollViewer_ViewChangingToken{};
00050     winrt::event_token m_infoProvider_RefreshStartedToken{};
00051     winrt::event_token m_infoProvider_RefreshCompletedToken{};
00052
00053     tracker_ref<winrt::IInspectable> m_boxedPointerPressedEventHandler{ this };
00054 };
00055
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ActivityFeedLayoutState Member List

This is the complete list of members for ActivityFeedLayoutState, including all inherited members.
_layoutRects | ActivityFeedLayoutState | [private]
FirstRealizedIndex | ActivityFeedLayoutState |
LayoutRects | ActivityFeedLayoutState |
Generated on Sun Dec 1 2024 20:54:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Telemetry/TypeLogging.cpp Source File

  • Telemetry

TypeLogging.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "TypeLogging.h"
00006 #include "Utils.h"
00007
00008 namespace TypeLogging
00009 {
00010 #pragma region Common section
00011
00012 winrt::hstring PointerPointToString(const winrt::PointerPoint& pointerPoint, bool verbose)
00013 {
00014     if (verbose)
00015     {
00016         return StringUtil::FormatString(L"PointerPoint: PointerId: %1!u!, Position: (%2!u!, %3!u!), IsInContact: %4!u!, PointerDeviceType: %5!u!",
00017             pointerPoint.PointerId(), static_cast<uint32_t>(pointerPoint.Position().X), static_cast<uint32_t>(pointerPoint.Position().Y),
00018             pointerPoint.IsInContact(), pointerPoint.PointerDeviceType());
00019     }
00020     else
00021     {
00022         return StringUtil::FormatString(L"PointerPoint: PointerId: %1!u!, Position: (%2!u!, %3!u!)",
00023             pointerPoint.PointerId(), static_cast<uint32_t>(pointerPoint.Position().X), static_cast<uint32_t>(pointerPoint.Position().Y));
00024     }
00025 }
00026
00027 winrt::hstring RectToString(const winrt::Rect& rect)
00028 {
00029     return StringUtil::FormatString(L"Rect: X: %1!i!, Y: %2!i!, W: %3!u!, H: %4!u!",
00030         static_cast<int32_t>(rect.X), static_cast<int32_t>(rect.Y), static_cast<uint32_t>(rect.Width), static_cast<uint32_t>(rect.Height));
00031 }
00032
00033 winrt::hstring SizeToString(const winrt::Size& size)
00034 {
00035     return StringUtil::FormatString(L"Size: W: %1!u!, H: %2!u!",
00036         static_cast<uint32_t>(size.Width), static_cast<uint32_t>(size.Height));
00037 }
00038
00039 winrt::hstring Float2ToString(const winrt::float2& v2)
00040 {
00041     return StringUtil::FormatString(L"(%1!i!, %2!i!)", static_cast<int32_t>(v2.x), static_cast<int32_t>(v2.y));
00042 }
00043
00044 winrt::hstring NullableFloatToString(const winrt::IReference<float>& nf)
00045 {
00046     if (nf)
00047     {
00048         return StringUtil::FormatString(L"%1!i!", static_cast<int32_t>(nf.Value()));
00049     }
00050     else
00051     {
00052         return L"null";
00053     }
00054 }
00055
00056 winrt::hstring NullableFloat2ToString(const winrt::IReference<winrt::float2>& nv2)
00057 {
00058     if (nv2)
00059     {
00060         return Float2ToString(nv2.Value());
00061     }
00062     else
00063     {
00064         return L"null";
00065     }
00066 }
00067
00068 winrt::hstring OrientationToString(const winrt::Orientation& orientation)
00069 {
00070     return orientation == winrt::Orientation::Horizontal ? L"Horizontal" : L"Vertical";
00071 }
00072
00073 winrt::hstring PointerDeviceTypeToString(const winrt::PointerDeviceType& pointerDeviceKind)
00074 {
00075     switch (pointerDeviceKind)
00076     {
00077     case winrt::PointerDeviceType::Touch:
00078         return L"Touch";
00079     case winrt::PointerDeviceType::Pen:
00080         return L"Pen";
00081     case winrt::PointerDeviceType::Mouse:
00082         return L"Mouse";
00083     default:
00084         MUX_ASSERT(false);
00085         return L"";
00086     }
00087 }
00088
00089 winrt::hstring PointerUpdateKindToString(const winrt::PointerUpdateKind& pointerUpdateKind)
00090 {
00091     switch (pointerUpdateKind)
00092     {
00093     case winrt::PointerUpdateKind::LeftButtonPressed:
00094         return L"LeftButtonPressed";
00095     case winrt::PointerUpdateKind::LeftButtonReleased:
00096         return L"LeftButtonReleased";
00097     case winrt::PointerUpdateKind::MiddleButtonPressed:
00098         return L"MiddleButtonPressed";
00099     case winrt::PointerUpdateKind::MiddleButtonReleased:
00100         return L"MiddleButtonReleased";
00101     case winrt::PointerUpdateKind::Other:
00102         return L"Other";
00103     case winrt::PointerUpdateKind::RightButtonPressed:
00104         return L"RightButtonPressed";
00105     case winrt::PointerUpdateKind::RightButtonReleased:
00106         return L"RightButtonReleased";
00107     case winrt::PointerUpdateKind::XButton1Pressed:
00108         return L"XButton1Pressed";
00109     case winrt::PointerUpdateKind::XButton1Released:
00110         return L"XButton1Released";
00111     case winrt::PointerUpdateKind::XButton2Pressed:
00112         return L"XButton2Pressed";
00113     case winrt::PointerUpdateKind::XButton2Released:
00114         return L"XButton2Released";
00115     default:
00116         MUX_ASSERT(false);
00117         return L"";
00118     }
00119 }
00120
00121 winrt::hstring ScrollEventTypeToString(const winrt::ScrollEventType& scrollEventType)
00122 {
00123     switch (scrollEventType)
00124     {
00125     case winrt::ScrollEventType::First:
00126         return L"First";
00127     case winrt::ScrollEventType::Last:
00128         return L"Last";
00129     case winrt::ScrollEventType::SmallDecrement:
00130         return L"SmallDecrement";
00131     case winrt::ScrollEventType::SmallIncrement:
00132         return L"SmallIncrement";
00133     case winrt::ScrollEventType::LargeDecrement:
00134         return L"LargeDecrement";
00135     case winrt::ScrollEventType::LargeIncrement:
00136         return L"LargeIncrement";
00137     case winrt::ScrollEventType::ThumbPosition:
00138         return L"ThumbPosition";
00139     case winrt::ScrollEventType::ThumbTrack:
00140         return L"ThumbTrack";
00141     case winrt::ScrollEventType::EndScroll:
00142         return L"EndScroll";
00143     default:
00144         MUX_ASSERT(false);
00145         return L"";
00146     }
00147 }
00148
00149 winrt::hstring ScrollingIndicatorModeToString(const winrt::ScrollingIndicatorMode& indicatorMode)
00150 {
00151     switch (indicatorMode)
00152     {
00153     case winrt::ScrollingIndicatorMode::None:
00154         return L"None";
00155     case winrt::ScrollingIndicatorMode::MouseIndicator:
00156         return L"MouseIndicator";
00157     case winrt::ScrollingIndicatorMode::TouchIndicator:
00158         return L"TouchIndicator";
00159     default:
00160         MUX_ASSERT(false);
00161         return L"";
00162     }
00163 }
00164
00165 winrt::hstring FocusStateToString(const winrt::FocusState& focusState)
00166 {
00167     switch (focusState)
00168     {
00169     case winrt::FocusState::Keyboard:
00170         return L"Keyboard";
00171     case winrt::FocusState::Pointer:
00172         return L"Pointer";
00173     case winrt::FocusState::Programmatic:
00174         return L"Programmatic";
00175     case winrt::FocusState::Unfocused:
00176         return L"Unfocused";
00177     default:
00178         MUX_ASSERT(false);
00179         return L"";
00180     }
00181 }
00182
00183 winrt::hstring ItemContainerInteractionTriggerToString(const winrt::ItemContainerInteractionTrigger& interactionTrigger)
00184 {
00185     switch (interactionTrigger)
00186     {
00187     case winrt::ItemContainerInteractionTrigger::PointerPressed:
00188         return L"PointerPressed";
00189     case winrt::ItemContainerInteractionTrigger::PointerReleased:
00190         return L"PointerReleased";
00191     case winrt::ItemContainerInteractionTrigger::Tap:
00192         return L"Tap";
00193     case winrt::ItemContainerInteractionTrigger::DoubleTap:
00194         return L"DoubleTap";
00195     case winrt::ItemContainerInteractionTrigger::EnterKey:
00196         return L"EnterKey";
00197     case winrt::ItemContainerInteractionTrigger::SpaceKey:
00198         return L"SpaceKey";
00199     default:
00200         MUX_ASSERT(false);
00201         return L"";
00202     }
00203 }
00204
00205 winrt::hstring ItemContainerMultiSelectModeToString(const winrt::ItemContainerMultiSelectMode& multiSelectMode)
00206 {
00207     std::vector<winrt::hstring> modes;
00208     winrt::hstring str;
00209
00210     if (static_cast<int>(multiSelectMode & winrt::ItemContainerMultiSelectMode::Auto) != 0)
00211     {
00212         modes.push_back(L"Auto");
00213     }
00214
00215     if (static_cast<int>(multiSelectMode & winrt::ItemContainerMultiSelectMode::Single) != 0)
00216     {
00217         modes.push_back(L"Single");
00218     }
00219
00220     if (static_cast<int>(multiSelectMode & winrt::ItemContainerMultiSelectMode::Extended) != 0)
00221     {
00222         modes.push_back(L"Extended");
00223     }
00224
00225     if (static_cast<int>(multiSelectMode & winrt::ItemContainerMultiSelectMode::Multiple) != 0)
00226     {
00227         modes.push_back(L"Multiple");
00228     }
00229
00230     if (modes.empty())
00231     {
00232         MUX_ASSERT(false);
00233         return L"";
00234     }
00235
00236     str = modes[0];
00237
00238     // If more than one, concatenate strings with "|".
00239     for (size_t i = 1; i < modes.size(); i++)
00240     {
00241         str = str + L"|" + modes[i];
00242     }
00243
00244     return str;
00245 }
00246
00247 winrt::hstring KeyRoutedEventArgsToString(const winrt::KeyRoutedEventArgs& eventArgs)
00248 {
00249     return StringUtil::FormatString(L"KeyRoutedEventArgs: Handled: %1!u!, Key: %2!u!, OriginalKey: %3!u!",
00250         static_cast<uint32_t>(eventArgs.Handled()), static_cast<uint32_t>(eventArgs.Key()), static_cast<uint32_t>(eventArgs.OriginalKey()));
00251 }
00252
00253 #pragma endregion
00254
00255 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TextCommandBarFlyoutTests::TextCommandBarFlyoutTestSetupHelper Member List

This is the complete list of members for TextCommandBarFlyoutTests::TextCommandBarFlyoutTestSetupHelper, including all inherited members.
[instance initializer] | TextCommandBarFlyoutTests::TextCommandBarFlyoutTestSetupHelper | [inline, private]
TestSetupHelperOptions | TextCommandBarFlyoutTests::TextCommandBarFlyoutTestSetupHelper | [private]
TextCommandBarFlyoutTestSetupHelper(string languageOverride="") | TextCommandBarFlyoutTests::TextCommandBarFlyoutTestSetupHelper | [inline]
Generated on Sun Dec 1 2024 20:53:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RadioButtonsFocusPage Member List

This is the complete list of members for RadioButtonsFocusPage, including all inherited members.
ChangeTestFrameVisibility(Visibility visibility) | RadioButtonsFocusPage | [inline, private]
getIndexToSelect(bool selectRadioButtons2) | RadioButtonsFocusPage | [inline, private]
OnLoaded(object sender, RoutedEventArgs e) | RadioButtonsFocusPage | [inline, private]
RadioButtonsFocusPage() | RadioButtonsFocusPage | [inline]
SelectByIndexButton1_Click(object sender, RoutedEventArgs e) | RadioButtonsFocusPage | [inline, private]
SelectByIndexButton2_Click(object sender, RoutedEventArgs e) | RadioButtonsFocusPage | [inline, private]
TestRadioButtons2_GotFocus(object sender, RoutedEventArgs e) | RadioButtonsFocusPage | [inline, private]
TestRadioButtons2_LostFocus(object sender, RoutedEventArgs e) | RadioButtonsFocusPage | [inline, private]
TestRadioButtons2_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) | RadioButtonsFocusPage | [inline, private]
TestRadioButtons_GotFocus(object sender, RoutedEventArgs e) | RadioButtonsFocusPage | [inline, private]
TestRadioButtons_LostFocus(object sender, RoutedEventArgs e) | RadioButtonsFocusPage | [inline, private]
TestRadioButtons_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) | RadioButtonsFocusPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollingZoomAnimationStartingEventArgs.cpp Source File

  • ScrollPresenter

ScrollingZoomAnimationStartingEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "ScrollPresenterTrace.h"
00008 #include "ScrollingZoomAnimationStartingEventArgs.h"
00009
00010 winrt::float2 ScrollingZoomAnimationStartingEventArgs::CenterPoint()
00011 {
00012     return m_centerPoint;
00013 }
00014
00015 float ScrollingZoomAnimationStartingEventArgs::StartZoomFactor()
00016 {
00017     return m_startZoomFactor;
00018 }
00019
00020 float ScrollingZoomAnimationStartingEventArgs::EndZoomFactor()
00021 {
00022     return m_endZoomFactor;
00023 }
00024
00025 winrt::CompositionAnimation ScrollingZoomAnimationStartingEventArgs::Animation()
00026 {
00027     return m_animation;
00028 }
00029
00030 void ScrollingZoomAnimationStartingEventArgs::Animation(winrt::CompositionAnimation const& value)
00031 {
00032     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_PTR, METH_NAME, this, value);
00033     if (!value)
00034     {
00035         throw winrt::hresult_invalid_argument(L"Animation cannot be set to null.");
00036     }
00037     m_animation = value;
00038 }
00039
00040 int32_t ScrollingZoomAnimationStartingEventArgs::CorrelationId()
00041 {
00042     return m_zoomFactorChangeCorrelationId;
00043 }
00044
00045 void ScrollingZoomAnimationStartingEventArgs::SetZoomFactorChangeCorrelationId(int32_t zoomFactorChangeCorrelationId)
00046 {
00047     m_zoomFactorChangeCorrelationId = zoomFactorChangeCorrelationId;
00048 }
00049
00050 winrt::CompositionAnimation ScrollingZoomAnimationStartingEventArgs::GetAnimation() const
00051 {
00052     return m_animation;
00053 }
00054
00055 void ScrollingZoomAnimationStartingEventArgs::SetAnimation(const winrt::CompositionAnimation& animation)
00056 {
00057     m_animation = animation;
00058 }
00059
00060 void ScrollingZoomAnimationStartingEventArgs::SetCenterPoint(const winrt::float2& centerPoint)
00061 {
00062     m_centerPoint = centerPoint;
00063 }
00064
00065 void ScrollingZoomAnimationStartingEventArgs::SetStartZoomFactor(const float& startZoomFactor)
00066 {
00067     m_startZoomFactor = startZoomFactor;
00068 }
00069
00070 void ScrollingZoomAnimationStartingEventArgs::SetEndZoomFactor(const float& endZoomFactor)
00071 {
00072     m_endZoomFactor = endZoomFactor;
00073 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarPenButton.h Source File

  • InkToolBar

InkToolBarPenButton.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarPenButton.g.h"
00011 #include "InkToolBarPenButton.properties.h"
00012
00013 #include "InkToolBarToolButton.h"
00014
00015 class InkToolBarPenButton :
00016     public winrt::implementation::InkToolBarPenButtonT<InkToolBarPenButton, InkToolBarToolButton, winrt::composable>,
00017     public InkToolBarPenButtonProperties
00018 {
00019 public:
00020     ForwardRefToBaseReferenceTracker(InkToolBarToolButton)
00021
00022     // These functions are ambiguous with InkToolBarToolButton, disambiguate
00023     using InkToolBarPenButtonProperties::EnsureProperties;
00024     using InkToolBarPenButtonProperties::ClearProperties;
00025
00026     winrt::IVector<winrt::Brush> Palette() { winrt::throw_hresult(E_NOTIMPL); }
00027     void Palette(winrt::IVector<winrt::Brush> value) { winrt::throw_hresult(E_NOTIMPL); }
00028     double MinStrokeWidth() { winrt::throw_hresult(E_NOTIMPL); }
00029     void MinStrokeWidth(double value) { winrt::throw_hresult(E_NOTIMPL); }
00030     double MaxStrokeWidth() { winrt::throw_hresult(E_NOTIMPL); }
00031     void MaxStrokeWidth(double value) { winrt::throw_hresult(E_NOTIMPL); }
00032     winrt::Brush SelectedBrush() { winrt::throw_hresult(E_NOTIMPL); }
00033     int32_t SelectedBrushIndex() { winrt::throw_hresult(E_NOTIMPL); }
00034     void SelectedBrushIndex(int32_t value) { winrt::throw_hresult(E_NOTIMPL); }
00035     double SelectedStrokeWidth() { winrt::throw_hresult(E_NOTIMPL); }
00036     void SelectedStrokeWidth(double value) { winrt::throw_hresult(E_NOTIMPL); }
00037 };
00038
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PersonPicture/InitialsGenerator.cpp Source File

  • PersonPicture

InitialsGenerator.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "InitialsGenerator.h"
00007 #include <cwctype>
00008 #include <sstream>
00009 #include <algorithm>
00010
00011 /// <summary>
00012 /// Helper function which takes in a Contact object and produces initials
00013 /// which represent that contact.
00014 /// </summary>
00015 /// <remarks>
00016 /// INTENDED LOGIC BEHAVIOR:
00017 /// - If the name contains glyphs, return a generic icon.
00018 /// - If we have access to First Name vs. Last Name data
00019 ///   (First Name being set regionally - i.e. it equals Given Name or Family Name based on system setting),
00020 ///   -> If non-symbolic, use the first letter of the First Name and first letter of the Last Name
00021 ///   -> If symbolic, use the first character of the Given Name
00022 /// - If we don't have access to First/Last or Given/Family Name, (i.e. long string Dr. Jordan von Hammerspike III)
00023 ///   -> If non-symbolic, break by space delimiter then follow the following rules:
00024 ///      --> Use the first letter of the first word and the first letter of the last word
00025 ///      --> If only one word, use a single letter
00026 ///   -> If symbolic, use the first one or two characters of the string (decided by how squished it looks visually)
00027 ///      --> Note: This branch of the logic falls apart in the Family Name, Given Name case.
00028 /// </remarks>
00029 winrt::hstring InitialsGenerator::InitialsFromContactObject(const winrt::Contact &contact)
00030 {
00031     if (!contact)
00032     {
00033         return winrt::hstring(L"");
00034     }
00035
00036     // Optimal case is we have a clearly defined First and Last name. If
00037     // available, that is the data which should be used.
00038     if (!contact.FirstName().empty() && !contact.LastName().empty())
00039     {
00040         CharacterType type = GetCharacterType(contact.FirstName());
00041
00042         // We'll attempt to make initials only if we recognize a name in the Standard character set.
00043         if (type == CharacterType::Standard)
00044         {
00045             std::wstring firstName = static_cast<std::wstring>(contact.FirstName());
00046             std::wstring lastName = static_cast<std::wstring>(contact.LastName());
00047
00048             std::wstring result = GetFirstFullCharacter(firstName.data());
00049             result.append(GetFirstFullCharacter(lastName.data()));
00050
00051             std::transform(result.begin(), result.end(), result.begin(), ::towupper);
00052
00053             return winrt::hstring(result);
00054         }
00055         else
00056         {
00057             // Return empty string. In our code-behind we will produce a generic glyph as a result.
00058             return winrt::hstring(L"");
00059         }
00060     }
00061
00062     // If the supplied object does not contain granular name data, then we must
00063     // extract the correct initials from the DisplayName.
00064     if (!contact.DisplayName().empty())
00065     {
00066         return InitialsFromDisplayName(contact.DisplayName());
00067     }
00068
00069     // Return empty string. In our code-behind we will produce a generic glyph as a result.
00070     return winrt::hstring(L"");
00071 }
00072
00073 winrt::hstring InitialsGenerator::InitialsFromDisplayName(const wstring_view &contactDisplayName)
00074 {
00075     const CharacterType type = GetCharacterType(contactDisplayName);
00076
00077     // We'll attempt to make initials only if we recognize a name in the Standard character set.
00078     if (type == CharacterType::Standard)
00079     {
00080         std::wstring displayName(contactDisplayName.data());
00081
00082         StripTrailingBrackets(displayName);
00083
00084         std::vector<std::wstring> words = Split(displayName, L' ');
00085
00086         if (words.size() == 1)
00087         {
00088             // If there's only a single long word, we'll show one initial.
00089             std::wstring firstWord = words.front();
00090
00091             std::wstring result = GetFirstFullCharacter(firstWord);
00092
00093             std::transform(result.begin(), result.end(), result.begin(), ::towupper);
00094
00095             return winrt::hstring(result);
00096         }
00097         else if (words.size() > 1)
00098         {
00099             // If there's at least two words, we'll show two initials.
00100             //
00101             // NOTE: Based on current implementation, we could be showing punctuation.
00102             // For example, "John -Smith" would be "J-".
00103             std::wstring firstWord = words.front();
00104             std::wstring lastWord = words.back();
00105
00106             std::wstring result = GetFirstFullCharacter(firstWord);
00107             result.append(GetFirstFullCharacter(lastWord));
00108
00109             std::transform(result.begin(), result.end(), result.begin(), ::towupper);
00110
00111             return winrt::hstring(result);
00112         }
00113         else
00114         {
00115             // If there's only spaces in the name, we'll get a Vector size of 0.
00116             return winrt::hstring(L"");
00117         }
00118     }
00119     else
00120     {
00121         // Return empty string. In our code-behind we will produce a generic glyph as a result.
00122         return winrt::hstring(L"");
00123     }
00124 }
00125
00126 std::wstring InitialsGenerator::GetFirstFullCharacter(const std::wstring &str)
00127 {
00128     // Index should begin at the first desireable character.
00129     unsigned int start = 0;
00130
00131     while (start < str.size())
00132     {
00133         const wchar_t character = str.at(start);
00134
00135         // Omit ! " # $ % & ' ( ) * + , - . /
00136         if ((character >= 0x0021) && (character <= 0x002F))
00137         {
00138             start++;
00139             continue;
00140         }
00141
00142         // Omit : ; < = > ? @
00143         if ((character >= 0x003A) && (character <= 0x0040))
00144         {
00145             start++;
00146             continue;
00147         }
00148
00149         // Omit { | } ~
00150         if ((character >= 0x007B) && (character <= 0x007E))
00151         {
00152             start++;
00153             continue;
00154         }
00155
00156         break;
00157     }
00158
00159     // If no desireable characters exist, we'll start at index 1, as combining
00160     // characters begin only after the first character.
00161     if (start >= str.size())
00162     {
00163         start = 0;
00164     }
00165
00166     // Combining characters begin only after the first character, so we should start
00167     // looking 1 after the start character.
00168     unsigned int index = start + 1;
00169
00170     while (index < str.size())
00171     {
00172         const wchar_t character = str.at(index);
00173
00174         // Combining Diacritical Marks -- Official Unicode character block
00175         if ((character < 0x0300) || (character > 0x036F))
00176         {
00177             break;
00178         }
00179
00180         index++;
00181     }
00182
00183     // Determine number of diacritics by adjusting for our initial offset.
00184     const unsigned int strLength = index - start;
00185
00186     std::wstring result(&str.at(start), strLength);
00187     return result;
00188 }
00189
00190 std::vector<std::wstring> InitialsGenerator::Split(const std::wstring &source, wchar_t delim, int maxIterations)
00191 {
00192     std::vector<std::wstring> result;
00193
00194     std::wistringstream buffer(source);
00195
00196     int i = 0;
00197
00198     for (std::wstring token; std::getline(buffer, token, delim);)
00199     {
00200         if (!token.empty())
00201         {
00202             result.push_back(token);
00203         }
00204         if (++i >= maxIterations)
00205         {
00206             break;
00207         }
00208     }
00209
00210     return result;
00211 }
00212
00213 void InitialsGenerator::StripTrailingBrackets(std::wstring &source)
00214 {
00215     // Guidance from the world readiness team is that text within a final set of brackets
00216     // can be removed for the purposes of calculating initials. ex. John Smith (OSG)
00217     std::wstring_view delimiters[] = { L"{}"sv, L"()"sv, L"[]"sv };
00218
00219     if (source.empty())
00220     {
00221         return;
00222     }
00223
00224     for (const auto delimiter : delimiters)
00225     {
00226         if (source[source.length() - 1] != delimiter[1])
00227         {
00228             continue;
00229         }
00230
00231         const auto start = source.find_last_of(delimiter[0]);
00232         if (start == std::string::npos)
00233         {
00234             continue;
00235         }
00236
00237         source.erase(start);
00238         return;
00239     }
00240 }
00241
00242 CharacterType InitialsGenerator::GetCharacterType(const wstring_view &str)
00243 {
00244     // Since we're doing initials, we're really only interested in the first
00245     // few characters. If the first three characters aren't a glyph then
00246     // we don't need to count it as such because we won't be changing meaning
00247     // by truncating to one or two.
00248     CharacterType result = CharacterType::Other;
00249
00250     for (int i = 0; i < 3; i++)
00251     {
00252         // Break on null character. 0xFEFF is a terminating character which appears as null.
00253         if ((str.data()[i] == '\0') || (str.data()[i] == 0xFEFF))
00254         {
00255             break;
00256         }
00257
00258         const wchar_t character = str.data()[i];
00259         const CharacterType evaluationResult = GetCharacterType(character);
00260
00261         // In mix-match scenarios, we'll want to follow this order of precedence:
00262         // Glyph > Symbolic > Roman
00263         switch (evaluationResult)
00264         {
00265         case CharacterType::Glyph:
00266             result = CharacterType::Glyph;
00267             break;
00268         case CharacterType::Symbolic:
00269             // Don't override a Glyph state with a Symbolic State.
00270             if (result != CharacterType::Glyph)
00271             {
00272                 result = CharacterType::Symbolic;
00273             }
00274             break;
00275         case CharacterType::Standard:
00276             // Don't override a Glyph or Symbolic state with a Latin state.
00277             if ((result != CharacterType::Glyph) && (result != CharacterType::Symbolic))
00278             {
00279                 result = CharacterType::Standard;
00280             }
00281             break;
00282         default:
00283             // Preserve result's current state (if we never got data other
00284             // than "Other", it'll be set to other anyway).
00285             break;
00286         }
00287     }
00288
00289     return result;
00290 }
00291
00292 CharacterType InitialsGenerator::GetCharacterType(wchar_t character)
00293 {
00294     // To ensure predictable behavior, we're currently operating on an allowed list of character sets.
00295     //
00296     // Each block below is a HEX range in the official Unicode spec, which defines a set
00297     // of Unicode characters. Changes to the character sets would only be made by Unicode, and
00298     // are highly unlikely (as it would break virtually every modern text parser).
00299     // Definitions available here: http://www.unicode.org/charts/
00300     //
00301     // GLYPH
00302     //
00303     // IPA Extensions
00304     if ((character >= 0x0250) && (character <= 0x02AF))
00305     {
00306         return CharacterType::Glyph;
00307     }
00308
00309     // Arabic
00310     if ((character >= 0x0600) && (character <= 0x06FF))
00311     {
00312         return CharacterType::Glyph;
00313     }
00314
00315     // Arabic Supplement
00316     if ((character >= 0x0750) && (character <= 0x077F))
00317     {
00318         return CharacterType::Glyph;
00319     }
00320
00321     // Arabic Extended-A
00322     if ((character >= 0x08A0) && (character <= 0x08FF))
00323     {
00324         return CharacterType::Glyph;
00325     }
00326
00327     // Arabic Presentation Forms-A
00328     if ((character >= 0xFB50) && (character <= 0xFDFF))
00329     {
00330         return CharacterType::Glyph;
00331     }
00332
00333     // Arabic Presentation Forms-B
00334     if ((character >= 0xFE70) && (character <= 0xFEFF))
00335     {
00336         return CharacterType::Glyph;
00337     }
00338
00339     // Devanagari
00340     if ((character >= 0x0900) && (character <= 0x097F))
00341     {
00342         return CharacterType::Glyph;
00343     }
00344
00345     // Devanagari Extended
00346     if ((character >= 0xA8E0) && (character <= 0xA8FF))
00347     {
00348         return CharacterType::Glyph;
00349     }
00350
00351     // Bangla
00352     if ((character >= 0x0980) && (character <= 0x09FF))
00353     {
00354         return CharacterType::Glyph;
00355     }
00356
00357     // Gurmukhi
00358     if ((character >= 0x0A00) && (character <= 0x0A7F))
00359     {
00360         return CharacterType::Glyph;
00361     }
00362
00363     // Gujarati
00364     if ((character >= 0x0A80) && (character <= 0x0AFF))
00365     {
00366         return CharacterType::Glyph;
00367     }
00368
00369     // Odia
00370     if ((character >= 0x0B00) && (character <= 0x0B7F))
00371     {
00372         return CharacterType::Glyph;
00373     }
00374
00375     // Tamil
00376     if ((character >= 0x0B80) && (character <= 0x0BFF))
00377     {
00378         return CharacterType::Glyph;
00379     }
00380
00381     // Telugu
00382     if ((character >= 0x0C00) && (character <= 0x0C7F))
00383     {
00384         return CharacterType::Glyph;
00385     }
00386
00387     // Kannada
00388     if ((character >= 0x0C80) && (character <= 0x0CFF))
00389     {
00390         return CharacterType::Glyph;
00391     }
00392
00393     // Malayalam
00394     if ((character >= 0x0D00) && (character <= 0x0D7F))
00395     {
00396         return CharacterType::Glyph;
00397     }
00398
00399     // Sinhala
00400     if ((character >= 0x0D80) && (character <= 0x0DFF))
00401     {
00402         return CharacterType::Glyph;
00403     }
00404
00405     // Thai
00406     if ((character >= 0x0E00) && (character <= 0x0E7F))
00407     {
00408         return CharacterType::Glyph;
00409     }
00410
00411     // Lao
00412     if ((character >= 0x0E80) && (character <= 0x0EFF))
00413     {
00414         return CharacterType::Glyph;
00415     }
00416
00417     // SYMBOLIC
00418     //
00419     // CJK Unified Ideographs
00420     if ((character >= 0x4E00) && (character <= 0x9FFF))
00421     {
00422         return CharacterType::Symbolic;
00423     }
00424
00425     // CJK Unified Ideographs Extension
00426     if ((character >= 0x3400) && (character <= 0x4DBF))
00427     {
00428         return CharacterType::Symbolic;
00429     }
00430
00431     // CJK Unified Ideographs Extension B
00432     if ((character >= 0x20000) && (character <= 0x2A6DF))
00433     {
00434         return CharacterType::Symbolic;
00435     }
00436
00437     // CJK Unified Ideographs Extension C
00438     if ((character >= 0x2A700) && (character <= 0x2B73F))
00439     {
00440         return CharacterType::Symbolic;
00441     }
00442
00443     // CJK Unified Ideographs Extension D
00444     if ((character >= 0x2B740) && (character <= 0x2B81F))
00445     {
00446         return CharacterType::Symbolic;
00447     }
00448
00449     // CJK Radicals Supplement
00450     if ((character >= 0x2E80) && (character <= 0x2EFF))
00451     {
00452         return CharacterType::Symbolic;
00453     }
00454
00455     // CJK Symbols and Punctuation
00456     if ((character >= 0x3000) && (character <= 0x303F))
00457     {
00458         return CharacterType::Symbolic;
00459     }
00460
00461     // CJK Strokes
00462     if ((character >= 0x31C0) && (character <= 0x31EF))
00463     {
00464         return CharacterType::Symbolic;
00465     }
00466
00467     // Enclosed CJK Letters and Months
00468     if ((character >= 0x3200) && (character <= 0x32FF))
00469     {
00470         return CharacterType::Symbolic;
00471     }
00472
00473     // CJK Compatibility
00474     if ((character >= 0x3300) && (character <= 0x33FF))
00475     {
00476         return CharacterType::Symbolic;
00477     }
00478
00479     // CJK Compatibility Ideographs
00480     if ((character >= 0xF900) && (character <= 0xFAFF))
00481     {
00482         return CharacterType::Symbolic;
00483     }
00484
00485     // CJK Compatibility Forms
00486     if ((character >= 0xFE30) && (character <= 0xFE4F))
00487     {
00488         return CharacterType::Symbolic;
00489     }
00490
00491     // CJK Compatibility Ideographs Supplement
00492     if ((character >= 0x2F800) && (character <= 0x2FA1F))
00493     {
00494         return CharacterType::Symbolic;
00495     }
00496
00497     // Greek and Coptic
00498     if ((character >= 0x0370) && (character <= 0x03FF))
00499     {
00500         return CharacterType::Symbolic;
00501     }
00502
00503     // Hebrew
00504     if ((character >= 0x0590) && (character <= 0x05FF))
00505     {
00506         return CharacterType::Symbolic;
00507     }
00508
00509     // Armenian
00510     if ((character >= 0x0530) && (character <= 0x058F))
00511     {
00512         return CharacterType::Symbolic;
00513     }
00514
00515     // LATIN
00516     //
00517     // Basic Latin
00518     if ((character > 0x0000) && (character <= 0x007F))
00519     {
00520         return CharacterType::Standard;
00521     }
00522
00523     // Latin-1 Supplement
00524     if ((character >= 0x0080) && (character <= 0x00FF))
00525     {
00526         return CharacterType::Standard;
00527     }
00528
00529     // Latin Extended-A
00530     if ((character >= 0x0100) && (character <= 0x017F))
00531     {
00532         return CharacterType::Standard;
00533     }
00534
00535     // Latin Extended-B
00536     if ((character >= 0x0180) && (character <= 0x024F))
00537     {
00538         return CharacterType::Standard;
00539     }
00540
00541     // Latin Extended-C
00542     if ((character >= 0x2C60) && (character <= 0x2C7F))
00543     {
00544         return CharacterType::Standard;
00545     }
00546
00547     // Latin Extended-D
00548     if ((character >= 0xA720) && (character <= 0xA7FF))
00549     {
00550         return CharacterType::Standard;
00551     }
00552
00553     // Latin Extended-E
00554     if ((character >= 0xAB30) && (character <= 0xAB6F))
00555     {
00556         return CharacterType::Standard;
00557     }
00558
00559     // Latin Extended Additional
00560     if ((character >= 0x1E00) && (character <= 0x1EFF))
00561     {
00562         return CharacterType::Standard;
00563     }
00564
00565     // Cyrillic
00566     if ((character >= 0x0400) && (character <= 0x04FF))
00567     {
00568         return CharacterType::Standard;
00569     }
00570
00571     // Cyrillic Supplement
00572     if ((character >= 0x0500) && (character <= 0x052F))
00573     {
00574         return CharacterType::Standard;
00575     }
00576
00577     // Combining Diacritical Marks
00578     if ((character >= 0x0300) && (character <= 0x036F))
00579     {
00580         return CharacterType::Standard;
00581     }
00582
00583     return CharacterType::Other;
00584 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

WebView2_TryCompleteInitialization_RAII Member List

This is the complete list of members for WebView2_TryCompleteInitialization_RAII, including all inherited members.
m_objectPointer | SimpleXamlStartStopEvent_RAII | [protected]
operator=(const SimpleXamlStartStopEvent_RAII &) | SimpleXamlStartStopEvent_RAII |
operator=(SimpleXamlStartStopEvent_RAII &&) | SimpleXamlStartStopEvent_RAII |
SimpleXamlStartStopEvent_RAII(const SimpleXamlStartStopEvent_RAII &) | SimpleXamlStartStopEvent_RAII |
SimpleXamlStartStopEvent_RAII(SimpleXamlStartStopEvent_RAII &&) | SimpleXamlStartStopEvent_RAII |
SimpleXamlStartStopEvent_RAII(uint64_t objectPointer) | SimpleXamlStartStopEvent_RAII | [inline, protected]
WebView2_TryCompleteInitialization_RAII(uint64_t objectPointer) | WebView2_TryCompleteInitialization_RAII | [inline]
~WebView2_TryCompleteInitialization_RAII() | WebView2_TryCompleteInitialization_RAII | [inline]
Generated on Sun Dec 1 2024 20:53:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

GroupedItemsControlPage Member List

This is the complete list of members for GroupedItemsControlPage, including all inherited members.
_cvs | GroupedItemsControlPage | [private]
_groupedItemsControlViewModel | GroupedItemsControlPage | [private]
_headerTemplates | GroupedItemsControlPage | [private]
_itemTemplates | GroupedItemsControlPage | [private]
AppendEventMessage(string eventMessage) | GroupedItemsControlPage | [inline, private]
BtnClearExceptionReport_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnClearLogs_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsControlTabNavigation_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsControlXYFocusKeyboardNavigation_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsPanelGroupHeaderPlacement_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsPanelGroupPadding_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsPanelMargin_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsPanelOrientation_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsWrapGridCacheLength_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsWrapGridItemHeight_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnGetItemsWrapGridItemWidth_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnResetItemsSource_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsControlTabNavigation_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsControlXYFocusKeyboardNavigation_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsPanelGroupHeaderPlacement_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsPanelGroupPadding_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsPanelMargin_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsPanelOrientation_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsSource_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsWrapGridCacheLength_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsWrapGridItemHeight_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
BtnSetItemsWrapGridItemWidth_Click(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
ChkDataSource_Checked(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
ChkDataSource_Unchecked(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
ChkItemsControlIsTabStop_IsCheckedChanged(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
ChkItemsPanelAreStickyGroupHeadersEnabled_IsCheckedChanged(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
ChkLogs_Checked(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
ChkLogs_Unchecked(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
ChkProperties_Checked(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
ChkProperties_Unchecked(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
CmbItemsControlHeaderTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e) | GroupedItemsControlPage | [inline, private]
CmbItemsControlItemsPanelType_SelectionChanged(object sender, SelectionChangedEventArgs e) | GroupedItemsControlPage | [inline, private]
CmbItemsControlItemTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e) | GroupedItemsControlPage | [inline, private]
CmbItemsPresenterFooter_SelectionChanged(object sender, SelectionChangedEventArgs e) | GroupedItemsControlPage | [inline, private]
CmbItemsPresenterHeader_SelectionChanged(object sender, SelectionChangedEventArgs e) | GroupedItemsControlPage | [inline, private]
FindElementOfTypeInSubtree< T >(DependencyObject element) | GroupedItemsControlPage | [inline, private, static]
GetThicknessFromString(string thickness) | GroupedItemsControlPage | [inline, private]
GroupedItemsControlPage() | GroupedItemsControlPage | [inline]
GroupedItemsControlPage_Loaded(object sender, RoutedEventArgs e) | GroupedItemsControlPage | [inline, private]
NbItemsWrapGridMaximumRowsOrColumns_ValueChanged(object sender, object e) | GroupedItemsControlPage | [inline, private]
OnNavigatedTo(NavigationEventArgs e) | GroupedItemsControlPage | [inline, protected]
UpdateItemsControlHeaderTemplate() | GroupedItemsControlPage | [inline, private]
UpdateItemsControlIsTabStop() | GroupedItemsControlPage | [inline, private]
UpdateItemsControlItemTemplate() | GroupedItemsControlPage | [inline, private]
UpdateItemsControlProperties() | GroupedItemsControlPage | [inline, private]
UpdateItemsControlTabNavigation() | GroupedItemsControlPage | [inline, private]
UpdateItemsControlXYFocusKeyboardNavigation() | GroupedItemsControlPage | [inline, private]
UpdateItemsPanelAreStickyGroupHeadersEnabled() | GroupedItemsControlPage | [inline, private]
UpdateItemsPanelGroupHeaderPlacement() | GroupedItemsControlPage | [inline, private]
UpdateItemsPanelGroupPadding() | GroupedItemsControlPage | [inline, private]
UpdateItemsPanelMargin() | GroupedItemsControlPage | [inline, private]
UpdateItemsPanelOrientation() | GroupedItemsControlPage | [inline, private]
UpdateItemsPanelProperties() | GroupedItemsControlPage | [inline, private]
UpdateItemsPanelType() | GroupedItemsControlPage | [inline, private]
UpdateItemsWrapGridCacheLength() | GroupedItemsControlPage | [inline, private]
UpdateItemsWrapGridItemHeight() | GroupedItemsControlPage | [inline, private]
UpdateItemsWrapGridItemWidth() | GroupedItemsControlPage | [inline, private]
UpdateItemsWrapGridUIVisibility(Visibility visibility) | GroupedItemsControlPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/TestUI/RevealScenarioGrid.xaml.cs Source File

  • Materials
  • Reveal
  • TestUI

RevealScenarioGrid.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Collections.ObjectModel;
00007 using System.IO;
00008 using System.Linq;
00009 using System.Runtime.InteropServices.WindowsRuntime;
00010 using Windows.Foundation;
00011 using Windows.Foundation.Collections;
00012 using Microsoft.UI.Xaml;
00013 using Microsoft.UI.Xaml.Controls;
00014 using Microsoft.UI.Xaml.Controls.Primitives;
00015 using Microsoft.UI.Xaml.Data;
00016 using Microsoft.UI.Xaml.Input;
00017 using Microsoft.UI.Xaml.Media;
00018 using Microsoft.UI.Xaml.Media.Imaging;
00019 using Microsoft.UI.Xaml.Navigation;
00020 using MUXControlsTestApp.Utilities;
00021
00022 namespace MUXControlsTestApp
00023 {
00024     public sealed partial class RevealScenarioGrid : TestPage
00025     {
00026         private ObservableCollection<RevealGridItem> gridSource;
00027         private ObservableCollection<RevealBackgroundItem> backgroundTypeSource;
00028         private ObservableCollection<RevealGridTypeItem> gridItemTypeSource;
00029         private ObservableCollection<SelectionModeItem> selectionModeSource;
00030
00031         public RevealScenarioGrid()
00032         {
00033             this.InitializeComponent();
00034
00035             gridSource = RevealGridItem.GetItems();
00036             backgroundTypeSource = RevealBackgroundItem.GetItems();
00037             gridItemTypeSource = RevealGridTypeItem.GetItems();
00038             selectionModeSource = SelectionModeItem.GetItems();
00039         }
00040
00041         private void BackgroundComboBoxChanged(object sender, SelectionChangedEventArgs e)
00042         {
00043             ComboBox box = (ComboBox)sender;
00044             RevealBackgroundItem item = (RevealBackgroundItem)box.SelectedItem;
00045             VisualStateManager.GoToState(this, item.Name, false);
00046         }
00047
00048         private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
00049         {
00050             ComboBox box = (ComboBox)sender;
00051             RevealGridTypeItem item = (RevealGridTypeItem)box.SelectedItem;
00052             VisualStateManager.GoToState(this, item.Name, false);
00053         }
00054
00055         private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00056         {
00057             ComboBox box = (ComboBox)sender;
00058             SelectionModeItem item = (SelectionModeItem)box.SelectedItem;
00059             RevealGrid.SelectionMode = item.Mode;
00060         }
00061     }
00062
00063     public class RevealGridItem
00064     {
00065         private static ObservableCollection<RevealGridItem> items;
00066
00067         public string Header;
00068         public string SubHeader = "This is a sub-header";
00069         public BitmapImage ImageSource;
00070
00071         public static ObservableCollection<RevealGridItem> GetItems()
00072         {
00073             if(items == null)
00074             {
00075                 items = new ObservableCollection<RevealGridItem>();
00076                 items.Add(new RevealGridItem { Header = "Smile", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage12.jpg")) });
00077                 items.Add(new RevealGridItem { Header = "Business", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage23.jpg")) });
00078                 items.Add(new RevealGridItem { Header = "Kid", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage20.jpg")) });
00079                 items.Add(new RevealGridItem { Header = "Metal", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage22.jpg")) });
00080                 items.Add(new RevealGridItem { Header = "Super Metal", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage7.jpg")) });
00081                 items.Add(new RevealGridItem { Header = "Smile", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage12.jpg")) });
00082                 items.Add(new RevealGridItem { Header = "Business", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage23.jpg")) });
00083                 items.Add(new RevealGridItem { Header = "Kid", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage20.jpg")) });
00084                 items.Add(new RevealGridItem { Header = "Metal", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage22.jpg")) });
00085                 items.Add(new RevealGridItem { Header = "Super Metal", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage7.jpg")) });
00086                 items.Add(new RevealGridItem { Header = "Smile", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage12.jpg")) });
00087                 items.Add(new RevealGridItem { Header = "Business", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage23.jpg")) });
00088                 items.Add(new RevealGridItem { Header = "Kid", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage20.jpg")) });
00089                 items.Add(new RevealGridItem { Header = "Metal", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage22.jpg")) });
00090                 items.Add(new RevealGridItem { Header = "Super Metal", ImageSource = new BitmapImage(new Uri("https://raw.githubusercontent.com/Microsoft/Windows-universal-samples/master/SharedContent/media/Samples/LandscapeImage7.jpg")) });
00091             }
00092
00093             return items;
00094         }
00095     }
00096
00097     public class RevealBackgroundItem
00098     {
00099         private static ObservableCollection<RevealBackgroundItem> items;
00100
00101         public string Name;
00102         public RevealTestBackgrounds Value;
00103
00104         public static ObservableCollection<RevealBackgroundItem> GetItems()
00105         {
00106             if(items == null)
00107             {
00108                 items = new ObservableCollection<RevealBackgroundItem>();
00109                 foreach (RevealTestBackgrounds theme in Enum.GetValues(typeof(RevealTestBackgrounds)))
00110                 {
00111                     items.Add(new RevealBackgroundItem { Name = Enum.GetName(typeof(RevealTestBackgrounds), theme), Value = theme });
00112                 }
00113             }
00114
00115             return items;
00116         }
00117     }
00118
00119     public class RevealGridTypeItem
00120     {
00121         private static ObservableCollection<RevealGridTypeItem> items;
00122
00123         public string Name;
00124         public RevealGridItemTemplates Template;
00125
00126         public static ObservableCollection<RevealGridTypeItem> GetItems()
00127         {
00128             if(items == null)
00129             {
00130                 items = new ObservableCollection<RevealGridTypeItem>();
00131                 foreach (RevealGridItemTemplates template in Enum.GetValues(typeof(RevealGridItemTemplates)))
00132                 {
00133                     items.Add(new RevealGridTypeItem { Name = Enum.GetName(typeof(RevealGridItemTemplates), template), Template = template });
00134                 }
00135             }
00136
00137             return items;
00138         }
00139     }
00140
00141     public class SelectionModeItem
00142     {
00143         private static ObservableCollection<SelectionModeItem> items;
00144
00145         public string Name;
00146         public ListViewSelectionMode Mode;
00147
00148         public static ObservableCollection<SelectionModeItem> GetItems()
00149         {
00150             if (items == null)
00151             {
00152                 items = new ObservableCollection<SelectionModeItem>();
00153                 foreach (ListViewSelectionMode mode in Enum.GetValues(typeof(ListViewSelectionMode)))
00154                 {
00155                     items.Add(new SelectionModeItem { Name = Enum.GetName(typeof(ListViewSelectionMode), mode), Mode = mode });
00156                 }
00157             }
00158
00159             return items;
00160         }
00161     }
00162
00163     public enum RevealTestBackgrounds
00164     {
00165         Default = 0,
00166         Acrylic = 1,
00167         Accent = 2
00168     }
00169
00170     public enum RevealGridItemTemplates
00171     {
00172         ImageWithText = 0,
00173         Image = 1,
00174         BaseLowItems = 2
00175     }
00176 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CanvasScrollControllerConsumer Member List

This is the complete list of members for CanvasScrollControllerConsumer, including all inherited members.
canvas | CanvasScrollControllerConsumer | [private]
CanvasScrollControllerConsumer(ListBox lstLog, Canvas canvas, FrameworkElement scrolledElement, bool isLogging) | CanvasScrollControllerConsumer | [inline]
GetHorizontalMaxOffset() | CanvasScrollControllerConsumer | [inline, private]
GetHorizontalOffset() | CanvasScrollControllerConsumer | [inline, private]
GetHorizontalViewportLength() | CanvasScrollControllerConsumer | [inline, private]
GetVerticalMaxOffset() | CanvasScrollControllerConsumer | [inline, private]
GetVerticalOffset() | CanvasScrollControllerConsumer | [inline, private]
GetVerticalViewportLength() | CanvasScrollControllerConsumer | [inline, private]
horizontalPS | CanvasScrollControllerConsumer | [private]
horizontalScrollController | CanvasScrollControllerConsumer | [private]
HorizontalScrollController | CanvasScrollControllerConsumer |
isEnabled | CanvasScrollControllerConsumer | [private]
IsEnabled | CanvasScrollControllerConsumer |
IsLogging | CanvasScrollControllerConsumer |
LogMessage(string message) | CanvasScrollControllerConsumer | [inline, private]
lstLog | CanvasScrollControllerConsumer | [private]
OnAddScrollVelocityRequested(IScrollController sender, ScrollControllerAddScrollVelocityRequestedEventArgs e) | CanvasScrollControllerConsumer | [inline, private]
OnCanScrollChanged(IScrollController sender, object e) | CanvasScrollControllerConsumer | [inline, private]
OnIsScrollingWithMouseChanged(IScrollController sender, object e) | CanvasScrollControllerConsumer | [inline, private]
OnScrollByRequested(IScrollController sender, ScrollControllerScrollByRequestedEventArgs e) | CanvasScrollControllerConsumer | [inline, private]
OnScrollToRequested(IScrollController sender, ScrollControllerScrollToRequestedEventArgs e) | CanvasScrollControllerConsumer | [inline, private]
preManipulationHorizontalOffset | CanvasScrollControllerConsumer | [private]
preManipulationVerticalOffset | CanvasScrollControllerConsumer | [private]
scrolledElement | CanvasScrollControllerConsumer | [private]
ScrolledElementManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) | CanvasScrollControllerConsumer | [inline, private]
ScrolledElementManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) | CanvasScrollControllerConsumer | [inline, private]
ScrolledElementManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e) | CanvasScrollControllerConsumer | [inline, private]
SetHorizontalInfo(double maxOffset, double viewportLength) | CanvasScrollControllerConsumer | [inline, private]
SetHorizontalOffset(double offset) | CanvasScrollControllerConsumer | [inline, private]
SetVerticalInfo(double maxOffset, double viewportLength) | CanvasScrollControllerConsumer | [inline, private]
SetVerticalOffset(double offset) | CanvasScrollControllerConsumer | [inline, private]
UpdateOffsets(Point cumulativeTranslation, bool clamp=false) | CanvasScrollControllerConsumer | [inline, private]
verticalPS | CanvasScrollControllerConsumer | [private]
verticalScrollController | CanvasScrollControllerConsumer | [private]
VerticalScrollController | CanvasScrollControllerConsumer |
Generated on Sun Dec 1 2024 20:54:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TeachingTipTestHooks Member List

This is the complete list of members for TeachingTipTestHooks, including all inherited members.
EffectiveHeroContentPlacementChanged(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipTestHooks | [static]
EffectiveHeroContentPlacementChanged(winrt::event_token const &token) | TeachingTipTestHooks | [static]
EffectivePlacementChanged(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipTestHooks | [static]
EffectivePlacementChanged(winrt::event_token const &token) | TeachingTipTestHooks | [static]
EnsureGlobalTestHooks() | TeachingTipTestHooks | [static]
GetEffectiveHeroContentPlacement(const winrt::TeachingTip &teachingTip) | TeachingTipTestHooks | [static]
GetEffectivePlacement(const winrt::TeachingTip &teachingTip) | TeachingTipTestHooks | [static]
GetGlobalTestHooks() | TeachingTipTestHooks | [inline, static]
GetHorizontalOffset(const winrt::TeachingTip &teachingTip) | TeachingTipTestHooks | [static]
GetIsIdle(const winrt::TeachingTip &teachingTip) | TeachingTipTestHooks | [static]
GetPopup(const winrt::TeachingTip &teachingTip) | TeachingTipTestHooks | [static]
GetSubtitleVisibility(const winrt::TeachingTip &teachingTip) | TeachingTipTestHooks | [static]
GetTitleVisibility(const winrt::TeachingTip &teachingTip) | TeachingTipTestHooks | [static]
GetVerticalOffset(const winrt::TeachingTip &teachingTip) | TeachingTipTestHooks | [static]
IdleStatusChanged(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipTestHooks | [static]
IdleStatusChanged(winrt::event_token const &token) | TeachingTipTestHooks | [static]
m_effectiveHeroContentPlacementChangedEventSource | TeachingTipTestHooks | [private]
m_effectivePlacementChangedEventSource | TeachingTipTestHooks | [private]
m_idleStatusChangedEventSource | TeachingTipTestHooks | [private]
m_offsetChangedEventSource | TeachingTipTestHooks | [private]
m_openedStatusChangedEventSource | TeachingTipTestHooks | [private]
m_subtitleVisibilityChangedEventSource | TeachingTipTestHooks | [private]
m_titleVisibilityChangedEventSource | TeachingTipTestHooks | [private]
NotifyEffectiveHeroContentPlacementChanged(const winrt::TeachingTip &sender) | TeachingTipTestHooks | [static]
NotifyEffectivePlacementChanged(const winrt::TeachingTip &sender) | TeachingTipTestHooks | [static]
NotifyIdleStatusChanged(const winrt::TeachingTip &sender) | TeachingTipTestHooks | [static]
NotifyOffsetChanged(const winrt::TeachingTip &sender) | TeachingTipTestHooks | [static]
NotifyOpenedStatusChanged(const winrt::TeachingTip &sender) | TeachingTipTestHooks | [static]
NotifySubtitleVisibilityChanged(const winrt::TeachingTip &sender) | TeachingTipTestHooks | [static]
NotifyTitleVisibilityChanged(const winrt::TeachingTip &sender) | TeachingTipTestHooks | [static]
OffsetChanged(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipTestHooks | [static]
OffsetChanged(winrt::event_token const &token) | TeachingTipTestHooks | [static]
OpenedStatusChanged(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipTestHooks | [static]
OpenedStatusChanged(winrt::event_token const &token) | TeachingTipTestHooks | [static]
s_testHooks | TeachingTipTestHooks | [private, static]
SetContentElevation(const winrt::TeachingTip &teachingTip, float elevation) | TeachingTipTestHooks | [static]
SetContractAnimationDuration(const winrt::TeachingTip &teachingTip, const winrt::TimeSpan &contractAnimationDuration) | TeachingTipTestHooks | [static]
SetContractEasingFunction(const winrt::TeachingTip &teachingTip, const winrt::CompositionEasingFunction &easingFunction) | TeachingTipTestHooks | [static]
SetExpandAnimationDuration(const winrt::TeachingTip &teachingTip, const winrt::TimeSpan &expandAnimationDuration) | TeachingTipTestHooks | [static]
SetExpandEasingFunction(const winrt::TeachingTip &teachingTip, const winrt::CompositionEasingFunction &easingFunction) | TeachingTipTestHooks | [static]
SetReturnTopForOutOfWindowPlacement(const winrt::TeachingTip &teachingTip, bool returnTopForOutOfWindowPlacement) | TeachingTipTestHooks | [static]
SetTailElevation(const winrt::TeachingTip &teachingTip, float elevation) | TeachingTipTestHooks | [static]
SetTestScreenBounds(const winrt::TeachingTip &teachingTip, const winrt::Rect &testScreenBounds) | TeachingTipTestHooks | [static]
SetTestWindowBounds(const winrt::TeachingTip &teachingTip, const winrt::Rect &testWindowBounds) | TeachingTipTestHooks | [static]
SetTipFollowsTarget(const winrt::TeachingTip &teachingTip, bool tipFollowsTarget) | TeachingTipTestHooks | [static]
SetTipShouldHaveShadow(const winrt::TeachingTip &teachingTip, bool tipShadow) | TeachingTipTestHooks | [static]
SetUseTestScreenBounds(const winrt::TeachingTip &teachingTip, bool useTestScreenBounds) | TeachingTipTestHooks | [static]
SetUseTestWindowBounds(const winrt::TeachingTip &teachingTip, bool useTestWindowBounds) | TeachingTipTestHooks | [static]
SubtitleVisibilityChanged(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipTestHooks | [static]
SubtitleVisibilityChanged(winrt::event_token const &token) | TeachingTipTestHooks | [static]
TitleVisibilityChanged(winrt::TypedEventHandler< winrt::TeachingTip, winrt::IInspectable > const &value) | TeachingTipTestHooks | [static]
TitleVisibilityChanged(winrt::event_token const &token) | TeachingTipTestHooks | [static]
Generated on Sun Dec 1 2024 20:53:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealSimpleListPage Member List

This is the complete list of members for RevealSimpleListPage, including all inherited members.
accent | RevealSimpleListPage | [private]
accentColor | RevealSimpleListPage | [private]
BackgroundColorButton_Click(object sender, RoutedEventArgs e) | RevealSimpleListPage | [inline, private]
BorderColorButton_Click(object sender, RoutedEventArgs e) | RevealSimpleListPage | [inline, private]
OnColorValuesChanged() | RevealSimpleListPage | [inline, private]
RevealSimpleListPage() | RevealSimpleListPage | [inline]
settings | RevealSimpleListPage | [private]
Settings_ColorValuesChanged(UISettings sender, object args) | RevealSimpleListPage | [inline, private]
source | RevealSimpleListPage | [private]
StyleChooser_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) | RevealSimpleListPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:26 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/RevealHoverLight.idl Source File

  • Lights

RevealHoverLight.idl

Go to the documentation of this file.
00001 ﻿namespace MU_PRIVATE_MEDIA_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [webhosthidden]
00006 unsealed runtimeclass RevealHoverLight : Microsoft.UI.Xaml.Media.XamlLight
00007 {
00008     RevealHoverLight();
00009 }
00010
00011 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TestUI/TreeViewViewModel.cs Source File

  • TreeView
  • TestUI

TreeViewViewModel.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004 using System.Collections.ObjectModel;
00005
00006 namespace MUXControlsTestApp
00007 {
00008     public class TreeViewViewModelItem
00009     {
00010         public string Name { get; set; }
00011
00012         public ObservableCollection<TreeViewViewModelItem> Items { get; set; }
00013     }
00014
00015     public class TreeViewViewModel
00016     {
00017         public ObservableCollection<TreeViewViewModelItem> Items { get; set; }
00018
00019         public TreeViewViewModel()
00020         {
00021             Items = new ObservableCollection<TreeViewViewModelItem>();
00022
00023             for (int i = 0; i < 5; i++)
00024             {
00025                 TreeViewViewModelItem item = new()
00026                 {
00027                     Name = $"Item {i + 1}",
00028                     Items = new ObservableCollection<TreeViewViewModelItem>()
00029                 };
00030
00031                 for (int j = 0; j < 5; j++)
00032                 {
00033                     item.Items.Add(new TreeViewViewModelItem()
00034                     {
00035                         Name = $"Item {i + 1}.{j + 1}"
00036                     });
00037                 }
00038
00039                 Items.Add(item);
00040             }
00041         }
00042     }
00043 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ButtonInteractionTests Member List

This is the complete list of members for ButtonInteractionTests, including all inherited members.
ButtonInteractionTestSetup(TestOptions options=TestOptions.None) | ButtonInteractionTests | [inline, private]
ClassInitialize(TestContext testContext) | ButtonInteractionTests | [inline, static]
DoesInvokeWithKeyboard() | ButtonInteractionTests | [inline]
DoesNotInvokeWhenClickIsDraggedOffBeforeRelease() | ButtonInteractionTests | [inline]
DummyControlAutomationId | ButtonInteractionTests |
HoverModeAutomationId | ButtonInteractionTests |
InvokeCountTextBlockAutomationId | ButtonInteractionTests |
InvokeModeComboBoxAutomationId | ButtonInteractionTests |
IsHoveringTextBlockAutomationId | ButtonInteractionTests |
IsPressingTextBlockAutomationId | ButtonInteractionTests |
PressModeAutomationId | ButtonInteractionTests |
ReleaseModeAutomationId | ButtonInteractionTests |
TargetElementAutomationId | ButtonInteractionTests |
TestCleanup() | ButtonInteractionTests | [inline]
TestOptions enum name | ButtonInteractionTests |
ValidateInvokeWithHoverMode() | ButtonInteractionTests | [inline]
ValidateInvokeWithPressMode() | ButtonInteractionTests | [inline]
ValidateInvokeWithReleaseMode() | ButtonInteractionTests | [inline]
Generated on Sun Dec 1 2024 20:53:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkCanvas/InkCanvas.h Source File

  • InkCanvas

InkCanvas.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "InkCanvas.g.h"
00007 #include "InkCanvas.properties.h"
00008 #include "dcomp.h"
00009 #include <windows.ui.input.inking.h>
00010 #include <inkpresenterdesktop.h>
00011
00012 struct ThreadData;
00013
00014 class InkCanvas :
00015     public ReferenceTracker<InkCanvas, winrt::implementation::InkCanvasT>,
00016     public InkCanvasProperties
00017 {
00018 public:
00019     InkCanvas();
00020     virtual ~InkCanvas();
00021
00022    winrt::InkPresenter InkPresenter() {
00023         return m_inkPresenter;
00024     };
00025
00026     void OnLoaded(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00027     void OnUnloaded(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00028     void OnIsEnabledPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00029     winrt::AutomationPeer OnCreateAutomationPeer();
00030
00031     winrt::IAsyncAction QueueInkPresenterWorkItem(winrt::DoInkPresenterWork workItem);
00032
00033 private:
00034
00035     void CreateInkPresenter();
00036     void UpdateInkPresenterSize();
00037
00038     void AttachToVisualLink();
00039     void DetachFromVisualLink();
00040
00041     std::shared_ptr<ThreadData> m_threadData;
00042
00043     HWND m_hostHwnd = NULL;
00044     winrt::com_ptr<IDCompositionVisual> m_inkRootVisual;
00045     winrt::InkPresenter m_inkPresenter{ nullptr };
00046
00047     winrt::IContentExternalOutputLink m_systemVisualLink{ nullptr };
00048
00049     winrt::FrameworkElement::Loaded_revoker m_loadedRevoker{};
00050     winrt::FrameworkElement::Unloaded_revoker m_unloadedRevoker{};
00051     winrt::XamlRoot::Changed_revoker m_xamlRootChangedRevoker{};
00052     winrt::FrameworkElement::SizeChanged_revoker m_sizeChanged_revoker;
00053
00054     // These methods (and struct) are all in support of the Composition Target method of
00055     // doing things.  They all can just go away and calls to them be removed when we
00056     // get the bug fixed for the visual link method and get that code path tested and enabled.
00057 protected:
00058     bool UseSystemVisualLink();
00059     bool AttachToCompositionTarget();
00060     void DetachFromCompositionTarget();
00061     void PositionInkVisual();
00062
00063     winrt::FrameworkElement::LayoutUpdated_revoker m_layoutUpdatedRevoker;
00064
00065     struct TargetData
00066     {
00067         static thread_local std::map<HWND, std::weak_ptr<TargetData>> m_tlsMap;
00068         winrt::com_ptr<IDCompositionTarget> m_compositionTarget;
00069         winrt::com_ptr<IDCompositionVisual> m_targetRootVisual;
00070         HWND m_hwnd;
00071
00072         static std::shared_ptr<TargetData> Get(HWND hwnd)
00073         {
00074             // Have we previously initialized target data for this hwnd.
00075             auto iter = m_tlsMap.find(hwnd);
00076             if (iter != m_tlsMap.end())
00077             {
00078                 return iter->second.lock();
00079             }
00080             // No, so initialize it
00081             auto targetData = std::make_shared<TargetData>(hwnd);
00082             m_tlsMap[hwnd] = targetData;
00083             return targetData;
00084         }
00085
00086         TargetData(HWND hwnd) : m_hwnd(hwnd)
00087         {
00088         }
00089
00090         ~TargetData()
00091         {
00092             m_tlsMap.erase(m_hwnd);
00093         }
00094     };
00095     std::shared_ptr<TargetData> m_targetData;
00096
00097  };
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenter.h Source File

  • ScrollPresenter

ScrollPresenter.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "DoubleUtil.h"
00007 #include "FloatUtil.h"
00008 #include "InteractionTrackerAsyncOperation.h"
00009 #include "ScrollingScrollAnimationStartingEventArgs.h"
00010 #include "ScrollingZoomAnimationStartingEventArgs.h"
00011 #include "ScrollingScrollCompletedEventArgs.h"
00012 #include "ScrollingZoomCompletedEventArgs.h"
00013 #include "ScrollingBringingIntoViewEventArgs.h"
00014 #include "ScrollingAnchorRequestedEventArgs.h"
00015 #include "ScrollingScrollStartingEventArgs.h"
00016 #include "ScrollingZoomStartingEventArgs.h"
00017 #include "SnapPointWrapper.h"
00018 #include "ScrollPresenterTrace.h"
00019 #include "ViewChange.h"
00020 #include "BringIntoViewOffsetsChange.h"
00021 #include "OffsetsChange.h"
00022 #include "OffsetsChangeWithAdditionalVelocity.h"
00023 #include "ZoomFactorChange.h"
00024 #include "ZoomFactorChangeWithAdditionalVelocity.h"
00025
00026 #include "ScrollPresenter.g.h"
00027 #include "ScrollPresenter.properties.h"
00028
00029 class ScrollPresenter :
00030     public ReferenceTracker<ScrollPresenter, DeriveFromPanelHelper_base, winrt::ScrollPresenter, winrt::IScrollPresenter2, winrt::Controls::IScrollAnchorProvider, winrt::IRepeaterScrollingSurface>,
00031     public ScrollPresenterProperties
00032 {
00033 public:
00034     ScrollPresenter();
00035     ~ScrollPresenter();
00036
00037     // Background property is ambiguous with Panel, lift up ScrollPresenterProperties::Background to disambiguate.
00038     using ScrollPresenterProperties::Background;
00039
00040     // Properties of the ExpressionAnimationSources CompositionPropertySet
00041     static constexpr std::wstring_view s_extentSourcePropertyName{ L"Extent"sv };
00042     static constexpr std::wstring_view s_viewportSourcePropertyName{ L"Viewport"sv };
00043     static constexpr std::wstring_view s_offsetSourcePropertyName{ L"Offset"sv };
00044     static constexpr std::wstring_view s_positionSourcePropertyName{ L"Position"sv };
00045     static constexpr std::wstring_view s_minPositionSourcePropertyName{ L"MinPosition"sv };
00046     static constexpr std::wstring_view s_maxPositionSourcePropertyName{ L"MaxPosition"sv };
00047     static constexpr std::wstring_view s_zoomFactorSourcePropertyName{ L"ZoomFactor"sv };
00048
00049     // Properties' default values.
00050     static constexpr winrt::ScrollingChainMode s_defaultHorizontalScrollChainMode{ winrt::ScrollingChainMode::Auto };
00051     static constexpr winrt::ScrollingChainMode s_defaultVerticalScrollChainMode{ winrt::ScrollingChainMode::Auto };
00052     static constexpr winrt::ScrollingRailMode s_defaultHorizontalScrollRailMode{ winrt::ScrollingRailMode::Enabled };
00053     static constexpr winrt::ScrollingRailMode s_defaultVerticalScrollRailMode{ winrt::ScrollingRailMode::Enabled };
00054     static constexpr winrt::ScrollingScrollMode s_defaultHorizontalScrollMode{ winrt::ScrollingScrollMode::Auto };
00055     static constexpr winrt::ScrollingScrollMode s_defaultVerticalScrollMode{ winrt::ScrollingScrollMode::Auto };
00056     static constexpr winrt::ScrollingScrollMode s_defaultComputedHorizontalScrollMode{ winrt::ScrollingScrollMode::Disabled };
00057     static constexpr winrt::ScrollingScrollMode s_defaultComputedVerticalScrollMode{ winrt::ScrollingScrollMode::Disabled };
00058     static constexpr winrt::ScrollingChainMode s_defaultZoomChainMode{ winrt::ScrollingChainMode::Auto };
00059     static constexpr winrt::ScrollingZoomMode s_defaultZoomMode{ winrt::ScrollingZoomMode::Disabled };
00060     static constexpr winrt::ScrollingInputKinds s_defaultIgnoredInputKinds{ winrt::ScrollingInputKinds::None };
00061     static constexpr winrt::ScrollingContentOrientation s_defaultContentOrientation{ winrt::ScrollingContentOrientation::Both };
00062     static constexpr bool s_defaultAnchorAtExtent{ true };
00063     static constexpr double s_defaultMinZoomFactor{ 0.1 };
00064     static constexpr double s_defaultMaxZoomFactor{ 10.0 };
00065     static constexpr double s_defaultAnchorRatio{ 0.0 };
00066
00067     // ChangeOffsets scrolling constants
00068     static constexpr int s_offsetsChangeMsPerUnit{ 5 };
00069     static constexpr int s_offsetsChangeMinMs{ 50 };
00070     static constexpr int s_offsetsChangeMaxMs{ 1000 };
00071
00072     // ChangeZoomFactor zooming constants
00073     static constexpr int s_zoomFactorChangeMsPerUnit{ 250 };
00074     static constexpr int s_zoomFactorChangeMinMs{ 50 };
00075     static constexpr int s_zoomFactorChangeMaxMs{ 1000 };
00076
00077     // Number of ticks ellapsed before restarting the Translation and Scale animations to allow the Content
00078     // rasterization to be triggered after the Idle State is reached or a zoom factor change operation completed.
00079     static constexpr int s_translationAndZoomFactorAnimationsRestartTicks = 4;
00080
00081     static const int32_t s_noOpCorrelationId;
00082
00083 #pragma region IScrollAnchorProvider
00084     void RegisterAnchorCandidate(winrt::UIElement const& element);
00085     void UnregisterAnchorCandidate(winrt::UIElement const& element);
00086     winrt::UIElement CurrentAnchor();
00087
00088     // To be removed
00089     winrt::Controls::IScrollAnchorProvider Parent() { return nullptr; }
00090     void Parent(winrt::Controls::IScrollAnchorProvider const& value) {}
00091 #pragma endregion
00092
00093 #pragma region IRepeaterScrollingSurface
00094     bool IsHorizontallyScrollable();
00095
00096     bool IsVerticallyScrollable();
00097
00098     winrt::UIElement AnchorElement();
00099
00100     winrt::event_token ViewportChanged(winrt::ViewportChangedEventHandler const& value);
00101
00102     void ViewportChanged(winrt::event_token const& token);
00103
00104     winrt::event_token PostArrange(winrt::PostArrangeEventHandler const& value);
00105
00106     void PostArrange(winrt::event_token const& token);
00107
00108     winrt::event_token ConfigurationChanged(winrt::ConfigurationChangedEventHandler const& value);
00109
00110     void ConfigurationChanged(winrt::event_token const& token);
00111
00112     winrt::Rect GetRelativeViewport(
00113         winrt::UIElement const& content);
00114 #pragma endregion
00115
00116 #pragma region IFrameworkElementOverridesHelper
00117     // IFrameworkElementOverrides (unoverridden methods provided by FrameworkElementOverridesHelper)
00118     winrt::Size MeasureOverride(winrt::Size const& availableSize); // not actually final for 'derived' classes
00119     winrt::Size ArrangeOverride(winrt::Size const& finalSize); // not actually final for 'derived' classes
00120 #pragma endregion
00121
00122 #pragma region InteractionTrackerOwner callbacks
00123     void ValuesChanged(const winrt::InteractionTrackerValuesChangedArgs& args);
00124     void RequestIgnored(const winrt::InteractionTrackerRequestIgnoredArgs& args);
00125     void InteractingStateEntered(const winrt::InteractionTrackerInteractingStateEnteredArgs& args);
00126     void InertiaStateEntered(const winrt::InteractionTrackerInertiaStateEnteredArgs& args);
00127     void IdleStateEntered(const winrt::InteractionTrackerIdleStateEnteredArgs& args);
00128     void CustomAnimationStateEntered(const winrt::InteractionTrackerCustomAnimationStateEnteredArgs& args);
00129 #pragma endregion
00130
00131 #pragma region IScrollPresenter
00132     winrt::CompositionPropertySet ExpressionAnimationSources();
00133
00134     double HorizontalOffset() const;
00135     double VerticalOffset() const;
00136     float ZoomFactor() const;
00137     double ExtentWidth() const;
00138     double ExtentHeight() const;
00139     double ViewportWidth() const;
00140     double ViewportHeight() const;
00141     double ScrollableWidth() const;
00142     double ScrollableHeight() const;
00143
00144     winrt::IScrollController HorizontalScrollController() const;
00145     void HorizontalScrollController(winrt::IScrollController const& value);
00146
00147     winrt::IScrollController VerticalScrollController() const;
00148     void VerticalScrollController(winrt::IScrollController const& value);
00149
00150     winrt::ScrollingInputKinds IgnoredInputKinds() const;
00151     void IgnoredInputKinds(winrt::ScrollingInputKinds const& value);
00152
00153     winrt::ScrollingInteractionState State() const;
00154
00155     winrt::IVector<winrt::ScrollSnapPointBase> HorizontalSnapPoints();
00156
00157     winrt::IVector<winrt::ScrollSnapPointBase> VerticalSnapPoints();
00158
00159     winrt::IVector<winrt::ZoomSnapPointBase> ZoomSnapPoints();
00160
00161     int32_t ScrollTo(double horizontalOffset, double verticalOffset);
00162     int32_t ScrollTo(double horizontalOffset, double verticalOffset, winrt::ScrollingScrollOptions const& options);
00163     int32_t ScrollBy(double horizontalOffsetDelta, double verticalOffsetDelta);
00164     int32_t ScrollBy(double horizontalOffsetDelta, double verticalOffsetDelta, winrt::ScrollingScrollOptions const& options);
00165     int32_t AddScrollVelocity(winrt::float2 offsetsVelocity, winrt::IReference<winrt::float2> inertiaDecayRate);
00166     int32_t ZoomTo(float zoomFactor, winrt::IReference<winrt::float2> centerPoint);
00167     int32_t ZoomTo(float zoomFactor, winrt::IReference<winrt::float2> centerPoint, winrt::ScrollingZoomOptions const& options);
00168     int32_t ZoomBy(float zoomFactorDelta, winrt::IReference<winrt::float2> centerPoint);
00169     int32_t ZoomBy(float zoomFactorDelta, winrt::IReference<winrt::float2> centerPoint, winrt::ScrollingZoomOptions const& options);
00170     int32_t AddZoomVelocity(float zoomFactorVelocity, winrt::IReference<winrt::float2> centerPoint, winrt::IReference<float> inertiaDecayRate);
00171
00172 #pragma endregion
00173
00174     enum class ScrollPresenterDimension
00175     {
00176         HorizontalScroll,
00177         VerticalScroll,
00178         HorizontalZoomFactor,
00179         VerticalZoomFactor,
00180         Scroll,
00181         ZoomFactor
00182     };
00183
00184     // Invoked by both ScrollPresenter and ScrollViewer controls
00185     static bool IsZoomFactorBoundaryValid(double value);
00186     static void ValidateZoomFactoryBoundary(double value);
00187
00188     // Invoked by both ScrollPresenter and ScrollViewer controls
00189     static bool IsAnchorRatioValid(double value);
00190     static void ValidateAnchorRatio(double value);
00191
00192     bool IsElementValidAnchor(
00193         const winrt::UIElement& element);
00194
00195 #pragma region Invoked by ScrollPresenterTestHooks
00196     float GetContentLayoutOffsetXDbg() const
00197     {
00198         return m_contentLayoutOffsetX;
00199     }
00200
00201     float GetContentLayoutOffsetYDbg() const
00202     {
00203         return m_contentLayoutOffsetY;
00204     }
00205
00206     void SetContentLayoutOffsetXDbg(float contentLayoutOffsetX);
00207     void SetContentLayoutOffsetYDbg(float contentLayoutOffsetY);
00208
00209     winrt::hstring GetTransformExpressionAnimationExpressionDbg() const;
00210     void SetTransformExpressionAnimationExpressionDbg(winrt::hstring const& transformExpressionAnimationExpression);
00211
00212     winrt::hstring GetMinPositionExpressionAnimationExpressionDbg() const;
00213     void SetMinPositionExpressionAnimationExpressionDbg(winrt::hstring const& minPositionExpressionAnimationExpression);
00214
00215     winrt::hstring GetMaxPositionExpressionAnimationExpressionDbg() const;
00216     void SetMaxPositionExpressionAnimationExpressionDbg(winrt::hstring const& maxPositionExpressionAnimationExpression);
00217
00218     winrt::float2 GetArrangeRenderSizesDeltaDbg();
00219
00220     winrt::float2 GetPositionDbg();
00221     winrt::float2 GetMinPositionDbg();
00222     void SetMinPositionDbg(winrt::float2 minPosition);
00223     winrt::float2 GetMaxPositionDbg();
00224     void SetMaxPositionDbg(winrt::float2 maxPosition);
00225
00226     winrt::IVector<winrt::ScrollSnapPointBase> GetConsolidatedHorizontalScrollSnapPointsDbg()
00227     {
00228         return GetConsolidatedScrollSnapPointsDbg(ScrollPresenterDimension::HorizontalScroll);
00229     }
00230
00231     winrt::IVector<winrt::ScrollSnapPointBase> GetConsolidatedVerticalScrollSnapPointsDbg()
00232     {
00233         return GetConsolidatedScrollSnapPointsDbg(ScrollPresenterDimension::VerticalScroll);
00234     }
00235
00236     winrt::IVector<winrt::ScrollSnapPointBase> GetConsolidatedScrollSnapPointsDbg(ScrollPresenterDimension dimension);
00237     winrt::IVector<winrt::ZoomSnapPointBase> GetConsolidatedZoomSnapPointsDbg();
00238
00239     std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>> GetHorizontalSnapPointWrapperDbg(winrt::ScrollSnapPointBase const& scrollSnapPoint)
00240     {
00241         return GetScrollSnapPointWrapperDbg(ScrollPresenterDimension::HorizontalScroll, scrollSnapPoint);
00242     }
00243
00244     std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>> GetVerticalSnapPointWrapperDbg(winrt::ScrollSnapPointBase const& scrollSnapPoint)
00245     {
00246         return GetScrollSnapPointWrapperDbg(ScrollPresenterDimension::VerticalScroll, scrollSnapPoint);
00247     }
00248
00249     std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>> GetScrollSnapPointWrapperDbg(ScrollPresenterDimension dimension, winrt::ScrollSnapPointBase const& scrollSnapPoint);
00250     std::shared_ptr<SnapPointWrapper<winrt::ZoomSnapPointBase>> GetZoomSnapPointWrapperDbg(winrt::ZoomSnapPointBase const& zoomSnapPoint);
00251 #pragma endregion
00252
00253     // Invoked when a dependency property of this ScrollPresenter has changed.
00254     void OnPropertyChanged(
00255         const winrt::DependencyPropertyChangedEventArgs& args);
00256
00257     void OnContentPropertyChanged(
00258         const winrt::DependencyObject& sender,
00259         const winrt::DependencyProperty& args);
00260
00261 #pragma region Automation Peer Helpers
00262     // Public methods accessed by the CScrollPresenterAutomationPeer class
00263     double GetZoomedExtentWidth() const;
00264     double GetZoomedExtentHeight() const;
00265
00266     void PageLeft();
00267     void PageRight();
00268     void PageUp();
00269     void PageDown();
00270     void LineLeft();
00271     void LineRight();
00272     void LineUp();
00273     void LineDown();
00274     void ScrollToHorizontalOffset(double offset);
00275     void ScrollToVerticalOffset(double offset);
00276     void ScrollToOffsets(double horizontalOffset, double verticalOffset);
00277 #pragma endregion
00278
00279     // IUIElementOverridesHelper
00280     winrt::AutomationPeer OnCreateAutomationPeer();
00281
00282 private:
00283 #ifdef DBG
00284     static winrt::hstring DependencyPropertyToString(const winrt::IDependencyProperty& dependencyProperty);
00285 #endif
00286
00287     double AnticipatedZoomedHorizontalOffset() const;
00288     double AnticipatedZoomedVerticalOffset() const;
00289     float AnticipatedZoomFactor() const;
00290     double AnticipatedScrollableWidth() const;
00291     double AnticipatedScrollableHeight() const;
00292
00293     winrt::Size ArrangeContent(
00294         const winrt::UIElement& content,
00295         const winrt::Thickness& contentMargin,
00296         winrt::Rect& finalContentRect,
00297         bool wasContentArrangeWidthStretched,
00298         bool wasContentArrangeHeightStretched);
00299     float ComputeContentLayoutOffsetDelta(ScrollPresenterDimension dimension, float unzoomedDelta) const;
00300     float ComputeEndOfInertiaZoomFactor() const;
00301 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
00302     winrt::float2 ComputeEndOfInertiaPosition();
00303 #endif // ScrollPresenterViewKind_RelativeToEndOfInertiaView
00304     void ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* minPosition, _Out_opt_ winrt::float2* maxPosition);
00305     winrt::float2 ComputePositionFromOffsets(double zoomedHorizontalOffset, double zoomedVerticalOffset);
00306     template <typename T> double ComputeValueAfterSnapPoints(double value, std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>> const& snapPointsSet);
00307     void ComputeBringIntoViewTargetOffsetsFromRequestEventArgs(
00308         const winrt::UIElement& content,
00309         const winrt::ScrollingSnapPointsMode& snapPointsMode,
00310         const winrt::BringIntoViewRequestedEventArgs& requestEventArgs,
00311         _Out_ double* targetZoomedHorizontalOffset,
00312         _Out_ double* targetZoomedVerticalOffset,
00313         _Out_ double* appliedOffsetX,
00314         _Out_ double* appliedOffsetY,
00315         _Out_ winrt::Rect* targetRect);
00316     void ComputeBringIntoViewUpdatedTargetOffsets(
00317         const winrt::UIElement& content,
00318         const winrt::UIElement& element,
00319         const winrt::Rect& elementRect,
00320         const winrt::ScrollingSnapPointsMode& snapPointsMode,
00321         double horizontalAlignmentRatio,
00322         double verticalAlignmentRatio,
00323         double horizontalOffset,
00324         double verticalOffset,
00325         _Out_ double* targetZoomedHorizontalOffset,
00326         _Out_ double* targetZoomedVerticalOffset);
00327     void ComputeBringIntoViewTargetOffsets(
00328         const winrt::UIElement& content,
00329         const winrt::UIElement& element,
00330         const winrt::Rect& elementRect,
00331         const winrt::ScrollingSnapPointsMode& snapPointsMode,
00332         double horizontalAlignmentRatio,
00333         double verticalAlignmentRatio,
00334         double horizontalOffset,
00335         double verticalOffset,
00336         _Out_ double* targetZoomedHorizontalOffset,
00337         _Out_ double* targetZoomedVerticalOffset,
00338         _Out_opt_ double* appliedOffsetX,
00339         _Out_opt_ double* appliedOffsetY,
00340         _Out_opt_ winrt::Rect* targetRect);
00341     void EnsureExpressionAnimationSources();
00342     void EnsureInteractionTracker();
00343     void EnsureScrollPresenterVisualInteractionSource();
00344     void EnsureScrollControllerVisualInteractionSource(
00345         const winrt::Visual& panningElementAncestorVisual,
00346         ScrollPresenterDimension dimension);
00347     void EnsureScrollControllerExpressionAnimationSources(
00348         ScrollPresenterDimension dimension);
00349     void EnsurePositionBoundariesExpressionAnimations();
00350     void EnsureTransformExpressionAnimations();
00351     template <typename T> void SetupSnapPoints(
00352         std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
00353         ScrollPresenterDimension dimension);
00354     template <typename T> void UpdateSnapPointsRanges(
00355         std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
00356         bool forImpulseOnly);
00357     template <typename T> void UpdateSnapPointsIgnoredValue(
00358         std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
00359         ScrollPresenterDimension dimension);
00360     template <typename T> bool UpdateSnapPointsIgnoredValue(
00361         std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
00362         double newIgnoredValue);
00363     void SetupInteractionTrackerBoundaries();
00364     void SetupInteractionTrackerZoomFactorBoundaries(
00365         double minZoomFactor, double maxZoomFactor);
00366     void SetupScrollPresenterVisualInteractionSource();
00367     void SetupScrollControllerVisualInterationSource(
00368         ScrollPresenterDimension dimension);
00369     void SetupScrollControllerVisualInterationSourcePositionModifiers(
00370         ScrollPresenterDimension dimension,
00371         const winrt::Orientation& orientation);
00372     void SetupVisualInteractionSourceRailingMode(
00373         const winrt::VisualInteractionSource& visualInteractionSource,
00374         ScrollPresenterDimension dimension,
00375         const winrt::ScrollingRailMode& railingMode);
00376     void SetupVisualInteractionSourceChainingMode(
00377         const winrt::VisualInteractionSource& visualInteractionSource,
00378         ScrollPresenterDimension dimension,
00379         const winrt::ScrollingChainMode& chainingMode);
00380     void SetupVisualInteractionSourceMode(
00381         const winrt::VisualInteractionSource& visualInteractionSource,
00382         ScrollPresenterDimension dimension,
00383         const winrt::ScrollingScrollMode& scrollMode);
00384     void SetupVisualInteractionSourceMode(
00385         const winrt::VisualInteractionSource& visualInteractionSource,
00386         const winrt::ScrollingZoomMode& zoomMode);
00387 #ifdef IsMouseWheelScrollDisabled
00388     void SetupVisualInteractionSourcePointerWheelConfig(
00389         const winrt::VisualInteractionSource& visualInteractionSource,
00390         ScrollPresenterDimension dimension,
00391         const winrt::ScrollingScrollMode& scrollMode);
00392 #endif
00393 #ifdef IsMouseWheelZoomDisabled
00394     void SetupVisualInteractionSourcePointerWheelConfig(
00395         const winrt::VisualInteractionSource& visualInteractionSource,
00396         const winrt::ScrollingZoomMode& zoomMode);
00397 #endif
00398     void SetupVisualInteractionSourceRedirectionMode(
00399         const winrt::VisualInteractionSource& visualInteractionSource);
00400     void SetupVisualInteractionSourceCenterPointModifier(
00401         const winrt::VisualInteractionSource& visualInteractionSource,
00402         ScrollPresenterDimension dimension,
00403         bool flowDirectionChanged);
00404     void SetupPositionBoundariesExpressionAnimations(
00405         const winrt::UIElement& content);
00406     void SetupTransformExpressionAnimations(
00407         const winrt::UIElement& content);
00408     void StartTransformExpressionAnimations(
00409         const winrt::UIElement& content);
00410     void StopTransformExpressionAnimations(
00411         const winrt::UIElement& content);
00412     bool StartTranslationAndZoomFactorExpressionAnimations(bool interruptCountdown = false);
00413     void StopTranslationAndZoomFactorExpressionAnimations();
00414     void StartExpressionAnimationSourcesAnimations();
00415     void StartScrollControllerExpressionAnimationSourcesAnimations(
00416         ScrollPresenterDimension dimension);
00417     void StopScrollControllerExpressionAnimationSourcesAnimations(
00418         ScrollPresenterDimension dimension);
00419     void UpdateContent(
00420         const winrt::UIElement& oldContent,
00421         const winrt::UIElement& newContent);
00422     void UpdatePositionBoundaries(
00423         const winrt::UIElement& content);
00424     void UpdateTransformSource(
00425         const winrt::UIElement& oldContent,
00426         const winrt::UIElement& newContent);
00427     void UpdateState(
00428         const winrt::ScrollingInteractionState& state);
00429     void UpdateExpressionAnimationSources();
00430     void UpdateUnzoomedExtentAndViewport(
00431         bool renderSizeChanged,
00432         double unzoomedExtentWidth,
00433         double unzoomedExtentHeight,
00434         double viewportWidth,
00435         double viewportHeight);
00436     void UpdateScrollAutomationPatternProperties();
00437     void UpdateAnticipatedOffset(ScrollPresenterDimension dimension, double zoomedOffset);
00438     void UpdateAnticipatedZoomFactor(float zoomFactor);
00439     void UpdateOffset(ScrollPresenterDimension dimension, double zoomedOffset);
00440     void UpdateScrollControllerIsScrollable(ScrollPresenterDimension dimension);
00441     void UpdateScrollControllerValues(ScrollPresenterDimension dimension);
00442     void UpdateVisualInteractionSourceMode(ScrollPresenterDimension dimension);
00443     void UpdateManipulationRedirectionMode();
00444     void OnContentSizeChanged(
00445         const winrt::UIElement& content);
00446     void OnViewChanged(bool horizontalOffsetChanged, bool verticalOffsetChanged);
00447     void OnContentLayoutOffsetChanged(ScrollPresenterDimension dimension);
00448
00449     void ChangeOffsetsPrivate(
00450         double zoomedHorizontalOffset,
00451         double zoomedVerticalOffset,
00452         ScrollPresenterViewKind offsetsKind,
00453         winrt::ScrollingScrollOptions const& options,
00454         winrt::BringIntoViewRequestedEventArgs const& bringIntoViewRequestedEventArgs,
00455         InteractionTrackerAsyncOperationTrigger operationTrigger,
00456         int32_t existingViewChangeCorrelationId,
00457         _Out_opt_ int32_t* viewChangeCorrelationId);
00458     void ChangeOffsetsWithAdditionalVelocityPrivate(
00459         winrt::float2 offsetsVelocity,
00460         winrt::float2 anticipatedOffsetsChange,
00461         winrt::IReference<winrt::float2> inertiaDecayRate,
00462         InteractionTrackerAsyncOperationTrigger operationTrigger,
00463         _Out_opt_ int32_t* viewChangeCorrelationId);
00464
00465     void ChangeZoomFactorPrivate(
00466         float zoomFactor,
00467         winrt::IReference<winrt::float2> centerPoint,
00468         ScrollPresenterViewKind zoomFactorKind,
00469         winrt::ScrollingZoomOptions const& options,
00470         _Out_opt_ int32_t* viewChangeCorrelationId);
00471     void ChangeZoomFactorWithAdditionalVelocityPrivate(
00472         float zoomFactorVelocity,
00473         float anticipatedZoomFactorChange,
00474         winrt::IReference<winrt::float2> centerPoint,
00475         winrt::IReference<float> inertiaDecayRate,
00476         InteractionTrackerAsyncOperationTrigger operationTrigger,
00477         _Out_opt_ int32_t* viewChangeCorrelationId);
00478
00479     void ProcessDequeuedViewChange(
00480         std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation);
00481     void ProcessOffsetsChange(
00482         InteractionTrackerAsyncOperationTrigger operationTrigger,
00483         std::shared_ptr<OffsetsChange> offsetsChange,
00484         int32_t offsetsChangeCorrelationId,
00485         bool isForAsyncOperation);
00486     void ProcessOffsetsChange(
00487         InteractionTrackerAsyncOperationTrigger operationTrigger,
00488         std::shared_ptr<OffsetsChangeWithAdditionalVelocity> offsetsChangeWithAdditionalVelocity);
00489     void PostProcessOffsetsChange(
00490         std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation);
00491     void ProcessZoomFactorChange(
00492         std::shared_ptr<ZoomFactorChange> zoomFactorChange,
00493         int32_t zoomFactorChangeCorrelationId);
00494     void ProcessZoomFactorChange(
00495         InteractionTrackerAsyncOperationTrigger operationTrigger,
00496         std::shared_ptr<ZoomFactorChangeWithAdditionalVelocity> zoomFactorChangeWithAdditionalVelocity);
00497     void PostProcessZoomFactorChange(
00498         std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation);
00499     void ResetAnticipatedView();
00500     void ResetOffsetsInertiaDecayRate();
00501     void ResetZoomFactorInertiaDecayRate();
00502     void CompleteViewChange(
00503         std::shared_ptr<InteractionTrackerAsyncOperation> interactionTrackerAsyncOperation,
00504         ScrollPresenterViewChangeResult result);
00505     void CompleteInteractionTrackerOperations(
00506         int requestId,
00507         ScrollPresenterViewChangeResult operationResult,
00508         ScrollPresenterViewChangeResult priorNonAnimatedOperationsResult,
00509         ScrollPresenterViewChangeResult priorAnimatedOperationsResult,
00510         bool completeNonAnimatedOperation,
00511         bool completeAnimatedOperation,
00512         bool completePriorNonAnimatedOperations,
00513         bool completePriorAnimatedOperations);
00514     void CompleteDelayedOperations();
00515     void MaximizeInteractionTrackerOperationsTicksCountdown();
00516     int GetInteractionTrackerOperationsTicksCountdown() const;
00517     int GetInteractionTrackerOperationsCount(
00518         bool includeAnimatedOperations,
00519         bool includeNonAnimatedOperations) const;
00520     std::shared_ptr<InteractionTrackerAsyncOperation> GetLastNonAnimatedInteractionTrackerOperation(
00521         std::shared_ptr<InteractionTrackerAsyncOperation> priorToInteractionTrackerOperation) const;
00522     std::shared_ptr<InteractionTrackerAsyncOperation> GetInteractionTrackerOperationFromRequestId(
00523         int requestId) const;
00524     std::shared_ptr<InteractionTrackerAsyncOperation> GetInteractionTrackerOperationFromKinds(
00525         bool isOperationTypeForOffsetsChange,
00526         InteractionTrackerAsyncOperationTrigger operationTrigger,
00527         ScrollPresenterViewKind const& viewKind,
00528         winrt::ScrollingScrollOptions const& options) const;
00529     std::shared_ptr<InteractionTrackerAsyncOperation> GetInteractionTrackerOperationWithAdditionalVelocity(
00530         bool isOperationTypeForOffsetsChange,
00531         InteractionTrackerAsyncOperationTrigger operationTrigger) const;
00532     template <typename T> winrt::InteractionTrackerInertiaRestingValue GetInertiaRestingValue(
00533         std::shared_ptr<SnapPointWrapper<T>> snapPointWrapper,
00534         winrt::Compositor const& compositor,
00535         winrt::hstring const& target,
00536         winrt::hstring const& scale) const;
00537
00538     winrt::ScrollingScrollMode GetComputedScrollMode(ScrollPresenterDimension dimension, bool ignoreZoomMode = false);
00539 #ifdef IsMouseWheelScrollDisabled
00540     winrt::ScrollingScrollMode GetComputedMouseWheelScrollMode(ScrollPresenterDimension dimension);
00541 #endif
00542 #ifdef IsMouseWheelZoomDisabled
00543     winrt::ScrollingZoomMode GetMouseWheelZoomMode();
00544 #endif
00545
00546     double GetComputedMaxWidth(
00547         double defaultMaxWidth,
00548         const winrt::FrameworkElement& content) const;
00549     double GetComputedMaxHeight(
00550         double defaultMaxHeight,
00551         const winrt::FrameworkElement& content) const;
00552     winrt::float2 GetArrangeRenderSizesDelta(
00553         const winrt::UIElement& content) const;
00554     winrt::hstring GetMinPositionExpression(
00555         const winrt::UIElement& content) const;
00556     winrt::hstring GetMinPositionXExpression(
00557         const winrt::UIElement& content) const;
00558     winrt::hstring GetMinPositionYExpression(
00559         const winrt::UIElement& content) const;
00560     winrt::hstring GetMaxPositionExpression(
00561         const winrt::UIElement& content) const;
00562     winrt::hstring GetMaxPositionXExpression(
00563         const winrt::UIElement& content) const;
00564     winrt::hstring GetMaxPositionYExpression(
00565         const winrt::UIElement& content) const;
00566
00567     winrt::CompositionAnimation GetPositionAnimation(
00568         double zoomedHorizontalOffset,
00569         double zoomedVerticalOffset,
00570         InteractionTrackerAsyncOperationTrigger operationTrigger,
00571         int32_t offsetsChangeCorrelationId);
00572     winrt::CompositionAnimation GetZoomFactorAnimation(
00573         float zoomFactor,
00574         const winrt::float2& centerPoint,
00575         int32_t zoomFactorChangeCorrelationId);
00576     int32_t GetNextViewChangeCorrelationId();
00577
00578     bool IsInertiaFromImpulse() const;
00579     bool IsLoadedAndSetUp() const;
00580     bool IsInputKindIgnored(winrt::ScrollingInputKinds const& inputKind);
00581     bool HasBringingIntoViewListener() const
00582     {
00583         return !!m_bringingIntoViewEventSource;
00584     }
00585
00586     void HookCompositionTargetRendering();
00587     void HookScrollPresenterEvents();
00588     void HookContentPropertyChanged(
00589         const winrt::UIElement& content);
00590     void HookHorizontalScrollControllerEvents(
00591         const winrt::IScrollController& horizontalScrollController);
00592     void HookHorizontalScrollControllerPanningInfoEvents(
00593         const winrt::IScrollControllerPanningInfo& horizontalScrollControllerPanningInfo,
00594         bool hasInteractionSource);
00595     void HookHorizontalScrollControllerInteractionSourceEvents(
00596         const winrt::IScrollControllerPanningInfo& horizontalScrollControllerPanningInfo);
00597     void HookVerticalScrollControllerEvents(
00598         const winrt::IScrollController& verticalScrollController);
00599     void HookVerticalScrollControllerPanningInfoEvents(
00600         const winrt::IScrollControllerPanningInfo& verticalScrollControllerPanningInfo,
00601         bool hasInteractionSource);
00602     void HookVerticalScrollControllerInteractionSourceEvents(
00603         const winrt::IScrollControllerPanningInfo& verticalScrollControllerPanningInfo);
00604     void UnhookCompositionTargetRendering();
00605     void UnhookContentPropertyChanged(
00606         const winrt::UIElement& content);
00607     void UnhookScrollPresenterEvents();
00608     void UnhookHorizontalScrollControllerEvents();
00609     void UnhookVerticalScrollControllerEvents();
00610     void UnhookHorizontalScrollControllerPanningInfoEvents();
00611     void UnhookVerticalScrollControllerPanningInfoEvents();
00612
00613     void RaiseInteractionSourcesChanged();
00614     void RaiseExpressionAnimationStatusChanged(
00615         bool isExpressionAnimationStarted,
00616         wstring_view const& propertyName);
00617     void RaiseExtentChanged();
00618     void RaiseStateChanged();
00619     void RaiseScrollStarting(
00620         int32_t offsetsChangeCorrelationId,
00621         double anticipatedHorizontalOffset,
00622         double anticipatedVerticalOffset,
00623         float anticipatedZoomFactor);
00624     void RaiseZoomStarting(
00625         int32_t zoomFactorChangeCorrelationId,
00626         double anticipatedHorizontalOffset,
00627         double anticipatedVerticalOffset,
00628         float anticipatedZoomFactor);
00629     void RaiseViewChanged();
00630     winrt::CompositionAnimation RaiseScrollAnimationStarting(
00631         const winrt::Vector3KeyFrameAnimation& positionAnimation,
00632         const winrt::float2& startPosition,
00633         const winrt::float2& endPosition,
00634         int32_t offsetsChangeCorrelationId);
00635     winrt::CompositionAnimation RaiseZoomAnimationStarting(
00636         const winrt::ScalarKeyFrameAnimation& zoomFactorAnimation,
00637         const float endZoomFactor,
00638         const winrt::float2& centerPoint,
00639         int32_t zoomFactorChangeCorrelationId);
00640     void RaiseViewChangeCompleted(
00641         bool isForScroll,
00642         ScrollPresenterViewChangeResult result,
00643         int32_t viewChangeCorrelationId);
00644     bool RaiseBringingIntoView(
00645         double targetZoomedHorizontalOffset,
00646         double targetZoomedVerticalOffset,
00647         const winrt::BringIntoViewRequestedEventArgs& requestEventArgs,
00648         int32_t offsetsChangeCorrelationId,
00649         _Inout_ winrt::ScrollingSnapPointsMode* snapPointsMode);
00650
00651     // Event handlers
00652     void OnFlowDirectionChanged(
00653         const winrt::DependencyObject& sender,
00654         const winrt::DependencyProperty& args);
00655     void OnCompositionTargetRendering(
00656         const winrt::IInspectable& sender,
00657         const winrt::IInspectable& args);
00658     void OnLoaded(
00659         const winrt::IInspectable& sender,
00660         const winrt::RoutedEventArgs& args);
00661     void OnUnloaded(
00662         const winrt::IInspectable& sender,
00663         const winrt::RoutedEventArgs& args);
00664     void OnBringIntoViewRequestedHandler(
00665         const winrt::IInspectable& sender,
00666         const winrt::BringIntoViewRequestedEventArgs& args);
00667     void OnPointerPressed(
00668         const winrt::IInspectable& sender,
00669         const winrt::PointerRoutedEventArgs& args);
00670
00671     void OnScrollControllerPanningInfoPanRequested(
00672         const winrt::IScrollControllerPanningInfo& sender,
00673         const winrt::ScrollControllerPanRequestedEventArgs& args);
00674     void OnScrollControllerPanningInfoChanged(
00675         const winrt::IScrollControllerPanningInfo& sender,
00676         const winrt::IInspectable& args);
00677     void OnScrollControllerScrollToRequested(
00678         const winrt::IScrollController& sender,
00679         const winrt::ScrollControllerScrollToRequestedEventArgs& args);
00680     void OnScrollControllerScrollByRequested(
00681         const winrt::IScrollController& sender,
00682         const winrt::ScrollControllerScrollByRequestedEventArgs& args);
00683     void OnScrollControllerAddScrollVelocityRequested(
00684         const winrt::IScrollController& sender,
00685         const winrt::ScrollControllerAddScrollVelocityRequestedEventArgs& args);
00686
00687     void OnHorizontalSnapPointsVectorChanged(
00688         const winrt::IObservableVector<winrt::ScrollSnapPointBase>& sender,
00689         const winrt::IVectorChangedEventArgs event);
00690     void OnVerticalSnapPointsVectorChanged(
00691         const winrt::IObservableVector<winrt::ScrollSnapPointBase>& sender,
00692         const winrt::IVectorChangedEventArgs event);
00693     void OnZoomSnapPointsVectorChanged(
00694         const winrt::IObservableVector<winrt::ZoomSnapPointBase>& sender,
00695         const winrt::IVectorChangedEventArgs event);
00696
00697     template <typename T> bool SnapPointsViewportChangedHelper(
00698         winrt::IObservableVector<T> const& snapPoints,
00699         double viewport);
00700     template <typename T> void SnapPointsVectorChangedHelper(
00701         winrt::IObservableVector<T> const& scrollSnapPoints,
00702         winrt::IVectorChangedEventArgs const& args,
00703         std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet,
00704         ScrollPresenterDimension dimension);
00705     template <typename T> void SnapPointsVectorItemInsertedHelper(
00706         std::shared_ptr<SnapPointWrapper<T>> insertedItem,
00707         std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* snapPointsSet);
00708     template <typename T> void RegenerateSnapPointsSet(
00709         winrt::IObservableVector<T> const& userVector,
00710         std::set<std::shared_ptr<SnapPointWrapper<T>>, SnapPointWrapperComparator<T>>* internalSet);
00711
00712 #pragma region IRepeaterScrollingSurface Helpers
00713     void RaiseConfigurationChanged();
00714     void RaisePostArrange();
00715     void RaiseViewportChanged(const bool isFinal);
00716     void RaiseAnchorRequested();
00717
00718     void IsAnchoring(
00719         _Out_ bool* isAnchoringElementHorizontally,
00720         _Out_ bool* isAnchoringElementVertically,
00721         _Out_opt_ bool* isAnchoringFarEdgeHorizontally = nullptr,
00722         _Out_opt_ bool* isAnchoringFarEdgeVertically = nullptr);
00723     void ComputeViewportAnchorPoint(
00724         double viewportWidth,
00725         double viewportHeight,
00726         _Out_ double* viewportAnchorPointHorizontalOffset,
00727         _Out_ double* viewportAnchorPointVerticalOffset);
00728     void ComputeElementAnchorPoint(
00729         bool isForPreArrange,
00730         _Out_ double* elementAnchorPointHorizontalOffset,
00731         _Out_ double* elementAnchorPointVerticalOffset);
00732     void ComputeAnchorPoint(
00733         const winrt::Rect& anchorBounds,
00734         _Out_ double* anchorPointX,
00735         _Out_ double* anchorPointY);
00736     winrt::Size ComputeViewportToElementAnchorPointsDistance(
00737         double viewportWidth,
00738         double viewportHeight,
00739         bool isForPreArrange);
00740     void ClearAnchorCandidates();
00741     void ResetAnchorElement();
00742     void EnsureAnchorElementSelection();
00743
00744     void ProcessAnchorCandidate(
00745         const winrt::UIElement& anchorCandidate,
00746         const winrt::UIElement& content,
00747         const winrt::Rect& viewportAnchorBounds,
00748         double viewportAnchorPointHorizontalOffset,
00749         double viewportAnchorPointVerticalOffset,
00750         _Inout_ double* bestAnchorCandidateDistance,
00751         _Inout_ winrt::UIElement* bestAnchorCandidate,
00752         _Inout_ winrt::Rect* bestAnchorCandidateBounds) const;
00753
00754     static winrt::Rect GetDescendantBounds(
00755         const winrt::UIElement& content,
00756         const winrt::UIElement& descendant);
00757
00758     static bool IsElementValidAnchor(
00759         const winrt::UIElement& element,
00760         const winrt::UIElement& content);
00761 #pragma endregion
00762
00763     static winrt::InteractionChainingMode InteractionChainingModeFromChainingMode(
00764         const winrt::ScrollingChainMode& chainingMode);
00765 #ifdef IsMouseWheelScrollDisabled
00766     static winrt::InteractionSourceRedirectionMode InteractionSourceRedirectionModeFromScrollMode(
00767         const winrt::ScrollingScrollMode& scrollMode);
00768 #endif
00769 #ifdef IsMouseWheelZoomDisabled
00770     static winrt::InteractionSourceRedirectionMode InteractionSourceRedirectionModeFromZoomMode(
00771         const winrt::ScrollingZoomMode& zoomMode);
00772 #endif
00773     static winrt::InteractionSourceMode InteractionSourceModeFromScrollMode(
00774         const winrt::ScrollingScrollMode& scrollMode);
00775     static winrt::InteractionSourceMode InteractionSourceModeFromZoomMode(
00776         const winrt::ScrollingZoomMode& zoomMode);
00777
00778     static double ComputeZoomedOffsetWithMinimalChange(
00779         double viewportStart,
00780         double viewportEnd,
00781         double childStart,
00782         double childEnd);
00783
00784     static winrt::Rect GetDescendantBounds(
00785         const winrt::UIElement& content,
00786         const winrt::UIElement& descendant,
00787         const winrt::Rect& descendantRect);
00788
00789     static winrt::ScrollingAnimationMode GetComputedAnimationMode(
00790         winrt::ScrollingAnimationMode const& animationMode);
00791
00792     static wstring_view GetVisualTargetedPropertyName(ScrollPresenterDimension dimension);
00793
00794 #ifdef DBG
00795     void DumpMinMaxPositions();
00796 #endif // DBG
00797
00798 private:
00799 #ifdef DBG
00800     winrt::float2 m_minPositionOverrideDbg{ FloatUtil::NaN, FloatUtil::NaN };
00801     winrt::float2 m_maxPositionOverrideDbg{ FloatUtil::NaN, FloatUtil::NaN };
00802 #endif // DBG
00803
00804     int32_t m_latestViewChangeCorrelationId{ 0 };
00805     int m_latestInteractionTrackerRequest{ 0 };
00806     InteractionTrackerAsyncOperationType m_lastInteractionTrackerAsyncOperationType{ InteractionTrackerAsyncOperationType::None };
00807     winrt::float2 m_endOfInertiaPosition{ 0.0f, 0.0f };
00808     float m_animationRestartZoomFactor{ 1.0f };
00809     float m_endOfInertiaZoomFactor{ 1.0f };
00810     float m_zoomFactor{ 1.0f };
00811     float m_anticipatedZoomFactor{ FloatUtil::NaN };
00812     float m_contentLayoutOffsetX{ 0.0f };
00813     float m_contentLayoutOffsetY{ 0.0f };
00814     double m_zoomedHorizontalOffset{ 0.0 };
00815     double m_zoomedVerticalOffset{ 0.0 };
00816     double m_anticipatedZoomedHorizontalOffset{ DoubleUtil::NaN };
00817     double m_anticipatedZoomedVerticalOffset{ DoubleUtil::NaN };
00818     double m_unzoomedExtentWidth{ 0.0 };
00819     double m_unzoomedExtentHeight{ 0.0 };
00820     double m_viewportWidth{ 0.0 };
00821     double m_viewportHeight{ 0.0 };
00822     bool m_horizontalSnapPointsNeedViewportUpdates{ false }; // True when at least one horizontal snap point is not near aligned.
00823     bool m_verticalSnapPointsNeedViewportUpdates{ false }; // True when at least one vertical snap point is not near aligned.
00824     bool m_isAnchorElementDirty{ true }; // False when m_anchorElement is up-to-date, True otherwise.
00825     bool m_isInertiaFromImpulse{ false }; // Only used on pre-RS5 versions, as a replacement for the InteractionTracker.IsInertiaFromImpulse property.
00826
00827     // Number of ticks remaining before restarting the Translation and Scale animations to allow the Content
00828     // rasterization to be triggered after the Idle State is reached or a zoom factor change operation completed.
00829     uint8_t m_translationAndZoomFactorAnimationsRestartTicksCountdown{};
00830
00831     // For perf reasons, the value of ContentOrientation is cached.
00832     winrt::ScrollingContentOrientation m_contentOrientation{ s_defaultContentOrientation };
00833     winrt::Size m_availableSize{};
00834
00835     tracker_ref<winrt::IScrollController> m_horizontalScrollController{ this };
00836     tracker_ref<winrt::IScrollController> m_verticalScrollController{ this };
00837     tracker_ref<winrt::IScrollControllerPanningInfo> m_horizontalScrollControllerPanningInfo{ this };
00838     tracker_ref<winrt::IScrollControllerPanningInfo> m_verticalScrollControllerPanningInfo{ this };
00839     tracker_ref<winrt::UIElement> m_anchorElement{ this };
00840     tracker_ref<winrt::ScrollingAnchorRequestedEventArgs> m_anchorRequestedEventArgs{ this };
00841     std::vector<tracker_ref<winrt::UIElement>> m_anchorCandidates;
00842     std::list<std::shared_ptr<InteractionTrackerAsyncOperation>> m_interactionTrackerAsyncOperations;
00843     winrt::Rect m_anchorElementBounds{};
00844     winrt::ScrollingInteractionState m_state{ winrt::ScrollingInteractionState::Idle };
00845     winrt::IInspectable m_pointerPressedEventHandler{ nullptr };
00846     winrt::CompositionPropertySet m_expressionAnimationSources{ nullptr };
00847     winrt::CompositionPropertySet m_horizontalScrollControllerExpressionAnimationSources{ nullptr };
00848     winrt::CompositionPropertySet m_verticalScrollControllerExpressionAnimationSources{ nullptr };
00849     winrt::VisualInteractionSource m_scrollPresenterVisualInteractionSource{ nullptr };
00850     winrt::VisualInteractionSource m_horizontalScrollControllerVisualInteractionSource{ nullptr };
00851     winrt::VisualInteractionSource m_verticalScrollControllerVisualInteractionSource{ nullptr };
00852     winrt::InteractionTracker m_interactionTracker{ nullptr };
00853     winrt::IInteractionTrackerOwner m_interactionTrackerOwner{ nullptr };
00854     winrt::ExpressionAnimation m_minPositionExpressionAnimation{ nullptr };
00855     winrt::ExpressionAnimation m_maxPositionExpressionAnimation{ nullptr };
00856     winrt::ExpressionAnimation m_translationExpressionAnimation{ nullptr };
00857     winrt::ExpressionAnimation m_transformMatrixTranslateXExpressionAnimation{ nullptr };
00858     winrt::ExpressionAnimation m_transformMatrixTranslateYExpressionAnimation{ nullptr };
00859     winrt::ExpressionAnimation m_zoomFactorExpressionAnimation{ nullptr };
00860     winrt::ExpressionAnimation m_transformMatrixZoomFactorExpressionAnimation{ nullptr };
00861
00862     winrt::ExpressionAnimation m_positionSourceExpressionAnimation{ nullptr };
00863     winrt::ExpressionAnimation m_minPositionSourceExpressionAnimation{ nullptr };
00864     winrt::ExpressionAnimation m_maxPositionSourceExpressionAnimation{ nullptr };
00865     winrt::ExpressionAnimation m_zoomFactorSourceExpressionAnimation{ nullptr };
00866
00867     winrt::ExpressionAnimation m_horizontalScrollControllerOffsetExpressionAnimation{ nullptr };
00868     winrt::ExpressionAnimation m_horizontalScrollControllerMaxOffsetExpressionAnimation{ nullptr };
00869     winrt::ExpressionAnimation m_verticalScrollControllerOffsetExpressionAnimation{ nullptr };
00870     winrt::ExpressionAnimation m_verticalScrollControllerMaxOffsetExpressionAnimation{ nullptr };
00871
00872     // Event Sources
00873     event_source<winrt::ViewportChangedEventHandler> m_viewportChanged{ this };
00874     event_source<winrt::PostArrangeEventHandler> m_postArrange{ this };
00875     event_source<winrt::ConfigurationChangedEventHandler> m_configurationChanged{ this };
00876
00877     // Event Revokers
00878     winrt::Microsoft::UI::Xaml::Media::CompositionTarget::Rendering_revoker m_renderingRevoker{};
00879     winrt::FrameworkElement::Loaded_revoker m_loadedRevoker{};
00880     winrt::FrameworkElement::Unloaded_revoker m_unloadedRevoker{};
00881     winrt::UIElement::BringIntoViewRequested_revoker m_bringIntoViewRequestedRevoker{};
00882     PropertyChanged_revoker m_flowDirectionChangedRevoker{};
00883     PropertyChanged_revoker m_contentMinWidthChangedRevoker{};
00884     PropertyChanged_revoker m_contentWidthChangedRevoker{};
00885     PropertyChanged_revoker m_contentMaxWidthChangedRevoker{};
00886     PropertyChanged_revoker m_contentMinHeightChangedRevoker{};
00887     PropertyChanged_revoker m_contentHeightChangedRevoker{};
00888     PropertyChanged_revoker m_contentMaxHeightChangedRevoker{};
00889     PropertyChanged_revoker m_contentHorizontalAlignmentChangedRevoker{};
00890     PropertyChanged_revoker m_contentVerticalAlignmentChangedRevoker{};
00891
00892     winrt::IScrollController::ScrollToRequested_revoker m_horizontalScrollControllerScrollToRequestedRevoker{};
00893     winrt::IScrollController::ScrollByRequested_revoker m_horizontalScrollControllerScrollByRequestedRevoker{};
00894     winrt::IScrollController::AddScrollVelocityRequested_revoker m_horizontalScrollControllerAddScrollVelocityRequestedRevoker{};
00895     winrt::IScrollControllerPanningInfo::Changed_revoker m_horizontalScrollControllerPanningInfoChangedRevoker{};
00896     winrt::IScrollControllerPanningInfo::PanRequested_revoker m_horizontalScrollControllerPanningInfoPanRequestedRevoker{};
00897
00898     winrt::IScrollController::ScrollToRequested_revoker m_verticalScrollControllerScrollToRequestedRevoker{};
00899     winrt::IScrollController::ScrollByRequested_revoker m_verticalScrollControllerScrollByRequestedRevoker{};
00900     winrt::IScrollController::AddScrollVelocityRequested_revoker m_verticalScrollControllerAddScrollVelocityRequestedRevoker{};
00901     winrt::IScrollControllerPanningInfo::Changed_revoker m_verticalScrollControllerPanningInfoChangedRevoker{};
00902     winrt::IScrollControllerPanningInfo::PanRequested_revoker m_verticalScrollControllerPanningInfoPanRequestedRevoker{};
00903
00904     // Used on platforms where we don't have XamlRoot.
00905     winrt::ICoreWindow::KeyDown_revoker m_coreWindowKeyDownRevoker{};
00906     winrt::ICoreWindow::KeyUp_revoker m_coreWindowKeyUpRevoker{};
00907
00908     winrt::IObservableVector<winrt::ScrollSnapPointBase>::VectorChanged_revoker m_horizontalSnapPointsVectorChangedRevoker{};
00909     winrt::IObservableVector<winrt::ScrollSnapPointBase>::VectorChanged_revoker m_verticalSnapPointsVectorChangedRevoker{};
00910     winrt::IObservableVector<winrt::ZoomSnapPointBase>::VectorChanged_revoker m_zoomSnapPointsVectorChangedRevoker{};
00911
00912     winrt::IVector<winrt::ScrollSnapPointBase> m_horizontalSnapPoints{};
00913     winrt::IVector<winrt::ScrollSnapPointBase> m_verticalSnapPoints{};
00914     winrt::IVector<winrt::ZoomSnapPointBase> m_zoomSnapPoints{};
00915     std::set<std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>>, SnapPointWrapperComparator<winrt::ScrollSnapPointBase>> m_sortedConsolidatedHorizontalSnapPoints{};
00916     std::set<std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>>, SnapPointWrapperComparator<winrt::ScrollSnapPointBase>> m_sortedConsolidatedVerticalSnapPoints{};
00917     std::set<std::shared_ptr<SnapPointWrapper<winrt::ZoomSnapPointBase>>, SnapPointWrapperComparator<winrt::ZoomSnapPointBase>> m_sortedConsolidatedZoomSnapPoints{};
00918
00919     // Maximum difference for offsets to be considered equal. Used for pointer wheel scrolling.
00920     static constexpr float s_offsetEqualityEpsilon{ 0.00001f };
00921     // Maximum difference for zoom factors to be considered equal. Used for pointer wheel zooming.
00922     static constexpr float s_zoomFactorEqualityEpsilon{ 0.00001f };
00923
00924     // Property names being targeted for the ScrollPresenter.Content's Visual.
00925     // RedStone v1 case:
00926     static constexpr std::wstring_view s_transformMatrixTranslateXPropertyName{ L"TransformMatrix._41"sv };
00927     static constexpr std::wstring_view s_transformMatrixTranslateYPropertyName{ L"TransformMatrix._42"sv };
00928     static constexpr std::wstring_view s_transformMatrixScaleXPropertyName{ L"TransformMatrix._11"sv };
00929     static constexpr std::wstring_view s_transformMatrixScaleYPropertyName{ L"TransformMatrix._22"sv };
00930     // RedStone v2 and higher case:
00931     static constexpr std::wstring_view s_translationPropertyName{ L"Translation"sv };
00932     static constexpr std::wstring_view s_scalePropertyName{ L"Scale"sv };
00933
00934     // Properties of the IScrollController's ExpressionAnimationSources CompositionPropertySet
00935     static constexpr wstring_view s_minOffsetPropertyName{ L"MinOffset"sv };
00936     static constexpr wstring_view s_maxOffsetPropertyName{ L"MaxOffset"sv };
00937     static constexpr wstring_view s_offsetPropertyName{ L"Offset"sv };
00938     static constexpr wstring_view s_multiplierPropertyName{ L"Multiplier"sv };
00939
00940     // Properties used in snap points composition expressions
00941     static constexpr wstring_view s_naturalRestingPositionXPropertyName{ L"NaturalRestingPosition.x"sv };
00942     static constexpr wstring_view s_naturalRestingPositionYPropertyName{ L"NaturalRestingPosition.y"sv };
00943     static constexpr wstring_view s_naturalRestingScalePropertyName{ L"NaturalRestingScale"sv };
00944     static constexpr wstring_view s_targetScalePropertyName{ L"this.Target.Scale"sv };
00945 };
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnnotatedScrollBar/AnnotatedScrollBarLabel.cpp Source File

  • AnnotatedScrollBar

AnnotatedScrollBarLabel.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "AnnotatedScrollBarLabel.h"
00007
00008 AnnotatedScrollBarLabel::AnnotatedScrollBarLabel(const winrt::IInspectable& content, double scrollOffset)
00009 {
00010     m_content.set(content);
00011     m_scrollOffset = scrollOffset;
00012 }
00013
00014 winrt::IInspectable AnnotatedScrollBarLabel::Content()
00015 {
00016     return m_content.get();
00017 }
00018
00019 double AnnotatedScrollBarLabel::ScrollOffset()
00020 {
00021     return m_scrollOffset;
00022 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TeachingTip/TeachingTipClosingEventArgs.h Source File

  • TeachingTip

TeachingTipClosingEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #pragma once
00006
00007 #include "TeachingTipClosingEventArgs.g.h"
00008
00009 class TeachingTipClosingEventArgs :
00010     public ReferenceTracker<TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing>
00011 {
00012 public:
00013     winrt::TeachingTipCloseReason Reason();
00014     void Reason(const winrt::TeachingTipCloseReason& reason);
00015     bool Cancel();
00016     void Cancel(const bool cancel);
00017
00018     winrt::Deferral GetDeferral();
00019     void SetDeferral(const winrt::Deferral& deferral);
00020
00021     void DecrementDeferralCount();
00022     void IncrementDeferralCount();
00023 private:
00024
00025     winrt::TeachingTipCloseReason m_reason{ winrt::TeachingTipCloseReason::CloseButton };
00026     bool m_cancel{ false };
00027     tracker_ref<winrt::Deferral> m_deferral{ this };
00028     int m_deferralCount{ 0 };
00029 };
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/APITests/ScrollPresenterSnapPointTests.cs Source File

  • ScrollPresenter
  • APITests

ScrollPresenterSnapPointTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using MUXControlsTestApp.Utilities;
00005 using System;
00006 using System.Numerics;
00007 using System.Threading;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Xaml.Controls.Primitives;
00010 using Microsoft.UI.Xaml.Shapes;
00011 using Microsoft.UI.Private.Controls;
00012 using Common;
00013
00014 using WEX.TestExecution;
00015 using WEX.TestExecution.Markup;
00016 using WEX.Logging.Interop;
00017
00018 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00019 {
00020     partial class ScrollPresenterTests : ApiTestBase
00021     {
00022         [TestMethod]
00023         [TestProperty("Description", "Create a bunch of snap points with invalid arguments.")]
00024         public void SnapPointsWithInvalidArgsThrow()
00025         {
00026             RunOnUIThread.Execute(() =>
00027             {
00028                 Verify.Throws<ArgumentException>(() => { new RepeatedScrollSnapPoint(offset:  10, interval:  0, start:  10, end: 100, alignment: ScrollSnapPointsAlignment.Near); });
00029                 Verify.Throws<ArgumentException>(() => { new RepeatedScrollSnapPoint(offset:  10, interval: -1, start:  10, end: 100, alignment: ScrollSnapPointsAlignment.Near); });
00030                 Verify.Throws<ArgumentException>(() => { new RepeatedScrollSnapPoint(offset:  10, interval: 10, start:  10, end:   1, alignment: ScrollSnapPointsAlignment.Near); });
00031                 Verify.Throws<ArgumentException>(() => { new RepeatedScrollSnapPoint(offset:  10, interval: 10, start:  10, end:  10, alignment: ScrollSnapPointsAlignment.Near); });
00032 #if ApplicableRangeType
00033                 Verify.Throws<ArgumentException>(() => { new RepeatedScrollSnapPoint(offset:   1, interval: 10, start:   1, end:  10, applicableRange: -10, alignment: ScrollSnapPointsAlignment.Near); });
00034                 Verify.Throws<ArgumentException>(() => { new RepeatedScrollSnapPoint(offset:   1, interval: 10, start:   1, end:  10, applicableRange:   0, alignment: ScrollSnapPointsAlignment.Near); });
00035                 Verify.Throws<ArgumentException>(() => { new RepeatedScrollSnapPoint(offset:  50, interval: 10, start: 100, end: 200, applicableRange:   2, alignment: ScrollSnapPointsAlignment.Near); });
00036                 Verify.Throws<ArgumentException>(() => { new RepeatedScrollSnapPoint(offset: 250, interval: 10, start: 100, end: 200, applicableRange:   2, alignment: ScrollSnapPointsAlignment.Near); });
00037                 Verify.Throws<ArgumentException>(() => { new ScrollSnapPoint(snapPointValue: 0, applicableRange:  0, alignment: ScrollSnapPointsAlignment.Near); });
00038                 Verify.Throws<ArgumentException>(() => { new ScrollSnapPoint(snapPointValue: 0, applicableRange: -1, alignment: ScrollSnapPointsAlignment.Near); });
00039 #endif
00040             });
00041         }
00042
00043         [TestMethod]
00044         [TestProperty("Description", "Verify that overlapping repeated snap points throw while adjacent ones do not.")]
00045         public void OverlappingRepeatedSnapPointsThrow()
00046         {
00047             RunOnUIThread.Execute(() =>
00048             {
00049                 ScrollPresenter scrollPresenter = new ScrollPresenter();
00050                 RepeatedScrollSnapPoint snapPoint1 = new RepeatedScrollSnapPoint(offset:  10, interval: 10, start:  10, end: 100, alignment: ScrollSnapPointsAlignment.Near);
00051                 RepeatedScrollSnapPoint snapPoint2 = new RepeatedScrollSnapPoint(offset:  10, interval: 10, start:  10, end: 100, alignment: ScrollSnapPointsAlignment.Near);
00052                 RepeatedScrollSnapPoint snapPoint3 = new RepeatedScrollSnapPoint(offset:   0, interval:  2, start:   0, end:  12, alignment: ScrollSnapPointsAlignment.Near);
00053                 RepeatedScrollSnapPoint snapPoint4 = new RepeatedScrollSnapPoint(offset:   0, interval:  2, start:   0, end:  10, alignment: ScrollSnapPointsAlignment.Near);
00054                 RepeatedScrollSnapPoint snapPoint5 = new RepeatedScrollSnapPoint(offset: 100, interval:  2, start: 100, end: 200, alignment: ScrollSnapPointsAlignment.Near);
00055
00056                 scrollPresenter.VerticalSnapPoints.Add(snapPoint1);
00057                 Verify.Throws<ArgumentException>(() => { scrollPresenter.VerticalSnapPoints.Add(snapPoint2); });
00058                 Verify.Throws<ArgumentException>(() => { scrollPresenter.VerticalSnapPoints.Add(snapPoint3); });
00059                 scrollPresenter.HorizontalSnapPoints.Add(snapPoint4);
00060                 scrollPresenter.HorizontalSnapPoints.Add(snapPoint5);
00061             });
00062         }
00063
00064         [TestMethod]
00065         [TestProperty("Description", "Add and remove snap points and make sure the corresponding collections look correct.")]
00066         public void CanAddAndRemoveSnapPointsFromAScrollPresenter()
00067         {
00068             CanAddAndRemoveSnapPointsFromAScrollPresenter(ScrollSnapPointsAlignment.Near);
00069             CanAddAndRemoveSnapPointsFromAScrollPresenter(ScrollSnapPointsAlignment.Center);
00070             CanAddAndRemoveSnapPointsFromAScrollPresenter(ScrollSnapPointsAlignment.Far);
00071         }
00072
00073         private void CanAddAndRemoveSnapPointsFromAScrollPresenter(ScrollSnapPointsAlignment alignment)
00074         {
00075             ScrollPresenter scrollPresenter = null;
00076             ScrollSnapPoint snapPoint2 = null;
00077             RepeatedScrollSnapPoint snapPoint3 = null;
00078             RepeatedScrollSnapPoint snapPoint4 = null;
00079
00080             RunOnUIThread.Execute(() =>
00081             {
00082                 scrollPresenter = new ScrollPresenter();
00083                 ScrollSnapPoint snapPoint1 = new ScrollSnapPoint(snapPointValue: 10, alignment: alignment);
00084                 snapPoint2 = new ScrollSnapPoint(snapPointValue: 10, alignment: alignment);
00085                 snapPoint3 = new RepeatedScrollSnapPoint(offset:  10, interval: 10, start:  10, end: 100, alignment: alignment);
00086                 snapPoint4 = new RepeatedScrollSnapPoint(offset: 100, interval: 10, start: 100, end: 200, alignment: alignment);
00087                 ZoomSnapPoint snapPoint5 = new ZoomSnapPoint(snapPointValue: 10);
00088                 scrollPresenter.HorizontalSnapPoints.Add(snapPoint1);
00089                 scrollPresenter.VerticalSnapPoints.Add(snapPoint1);
00090                 scrollPresenter.ZoomSnapPoints.Add(snapPoint5);
00091             });
00092
00093             IdleSynchronizer.Wait();
00094
00095             RunOnUIThread.Execute(() =>
00096             {
00097                 Verify.AreEqual<int>(1, scrollPresenter.HorizontalSnapPoints.Count);
00098                 Verify.AreEqual<int>(1, scrollPresenter.VerticalSnapPoints.Count);
00099                 Verify.AreEqual<int>(1, scrollPresenter.ZoomSnapPoints.Count);
00100                 scrollPresenter.HorizontalSnapPoints.Add(snapPoint2);
00101                 scrollPresenter.HorizontalSnapPoints.Add(snapPoint3);
00102                 scrollPresenter.HorizontalSnapPoints.Add(snapPoint4);
00103             });
00104
00105             IdleSynchronizer.Wait();
00106
00107             RunOnUIThread.Execute(() =>
00108             {
00109                 Verify.AreEqual<int>(4, scrollPresenter.HorizontalSnapPoints.Count);
00110                 scrollPresenter.HorizontalSnapPoints.Remove(snapPoint2);
00111             });
00112
00113             IdleSynchronizer.Wait();
00114
00115             RunOnUIThread.Execute(() =>
00116             {
00117                 Verify.AreEqual<int>(3, scrollPresenter.HorizontalSnapPoints.Count);
00118                 scrollPresenter.HorizontalSnapPoints.Remove(snapPoint2);
00119             });
00120
00121             IdleSynchronizer.Wait();
00122
00123             RunOnUIThread.Execute(() =>
00124             {
00125                 Verify.AreEqual<int>(3, scrollPresenter.HorizontalSnapPoints.Count);
00126                 scrollPresenter.HorizontalSnapPoints.Clear();
00127             });
00128
00129             IdleSynchronizer.Wait();
00130
00131             RunOnUIThread.Execute(() =>
00132             {
00133                 Verify.AreEqual<int>(0, scrollPresenter.HorizontalSnapPoints.Count);
00134                 Verify.AreEqual<int>(1, scrollPresenter.VerticalSnapPoints.Count);
00135                 Verify.AreEqual<int>(1, scrollPresenter.ZoomSnapPoints.Count);
00136             });
00137         }
00138
00139         [TestMethod]
00140         [TestProperty("Description", "Add scroll snap points with various alignments.")]
00141         public void CanAddScrollSnapPointsWithMixedAlignments()
00142         {
00143             ScrollPresenter scrollPresenter = null;
00144
00145             RunOnUIThread.Execute(() =>
00146             {
00147                 scrollPresenter = new ScrollPresenter();
00148                 ScrollSnapPoint nearSnapPoint = new ScrollSnapPoint(snapPointValue: 10, alignment: ScrollSnapPointsAlignment.Near);
00149                 ScrollSnapPoint centerSnapPoint = new ScrollSnapPoint(snapPointValue: 20, alignment: ScrollSnapPointsAlignment.Center);
00150                 ScrollSnapPoint farSnapPoint = new ScrollSnapPoint(snapPointValue: 30, alignment: ScrollSnapPointsAlignment.Far);
00151                 RepeatedScrollSnapPoint nearRepeatedScrollSnapPoint = new RepeatedScrollSnapPoint(offset: 50, interval: 10, start: 50, end: 100, alignment: ScrollSnapPointsAlignment.Near);
00152                 RepeatedScrollSnapPoint centerRepeatedScrollSnapPoint = new RepeatedScrollSnapPoint(offset: 180, interval: 10, start: 175, end: 225, alignment: ScrollSnapPointsAlignment.Center);
00153                 RepeatedScrollSnapPoint farRepeatedScrollSnapPoint = new RepeatedScrollSnapPoint(offset: 280, interval: 5, start: 280, end: 300, alignment: ScrollSnapPointsAlignment.Far);
00154                 scrollPresenter.HorizontalSnapPoints.Add(nearSnapPoint);
00155                 scrollPresenter.HorizontalSnapPoints.Add(centerSnapPoint);
00156                 scrollPresenter.HorizontalSnapPoints.Add(farSnapPoint);
00157                 scrollPresenter.VerticalSnapPoints.Add(nearSnapPoint);
00158                 scrollPresenter.VerticalSnapPoints.Add(centerSnapPoint);
00159                 scrollPresenter.VerticalSnapPoints.Add(farSnapPoint);
00160                 scrollPresenter.HorizontalSnapPoints.Add(nearRepeatedScrollSnapPoint);
00161                 scrollPresenter.HorizontalSnapPoints.Add(centerRepeatedScrollSnapPoint);
00162                 scrollPresenter.HorizontalSnapPoints.Add(farRepeatedScrollSnapPoint);
00163                 scrollPresenter.VerticalSnapPoints.Add(nearRepeatedScrollSnapPoint);
00164                 scrollPresenter.VerticalSnapPoints.Add(centerRepeatedScrollSnapPoint);
00165                 scrollPresenter.VerticalSnapPoints.Add(farRepeatedScrollSnapPoint);
00166             });
00167
00168             IdleSynchronizer.Wait();
00169
00170             RunOnUIThread.Execute(() =>
00171             {
00172                 Verify.AreEqual<int>(6, scrollPresenter.HorizontalSnapPoints.Count);
00173                 Verify.AreEqual<int>(6, scrollPresenter.VerticalSnapPoints.Count);
00174             });
00175         }
00176
00177         [TestMethod]
00178         [TestProperty("Description", "Add the same snap points to multiple collections and ensure they use collection-specific data.")]
00179         public void CanShareSnapPointsInMultipleCollections()
00180         {
00181             ScrollPresenter scrollPresenter1 = null;
00182             ScrollPresenter scrollPresenter2 = null;
00183             ScrollPresenter scrollPresenter3 = null;
00184
00185             ScrollSnapPoint scrollSnapPoint1 = null;
00186             ScrollSnapPoint scrollSnapPoint2 = null;
00187             ScrollSnapPoint scrollSnapPoint3 = null;
00188
00189             RepeatedScrollSnapPoint repeatedScrollSnapPoint1 = null;
00190             RepeatedScrollSnapPoint repeatedScrollSnapPoint2 = null;
00191             RepeatedScrollSnapPoint repeatedScrollSnapPoint3 = null;
00192
00193             ZoomSnapPoint zoomSnapPoint1 = null;
00194             ZoomSnapPoint zoomSnapPoint2 = null;
00195             ZoomSnapPoint zoomSnapPoint3 = null;
00196
00197             RunOnUIThread.Execute(() =>
00198             {
00199                 scrollPresenter1 = new ScrollPresenter();
00200                 scrollPresenter2 = new ScrollPresenter();
00201                 scrollPresenter3 = new ScrollPresenter();
00202
00203                 scrollSnapPoint1 = new ScrollSnapPoint(snapPointValue: 10, alignment: ScrollSnapPointsAlignment.Near);
00204                 scrollSnapPoint2 = new ScrollSnapPoint(snapPointValue: 20, alignment: ScrollSnapPointsAlignment.Near);
00205                 scrollSnapPoint3 = new ScrollSnapPoint(snapPointValue: 30, alignment: ScrollSnapPointsAlignment.Near);
00206
00207                 repeatedScrollSnapPoint1 = new RepeatedScrollSnapPoint(offset:  10, interval: 10, start:  10, end: 100, alignment: ScrollSnapPointsAlignment.Near);
00208                 repeatedScrollSnapPoint2 = new RepeatedScrollSnapPoint(offset: 200, interval: 10, start: 110, end: 200, alignment: ScrollSnapPointsAlignment.Near);
00209                 repeatedScrollSnapPoint3 = new RepeatedScrollSnapPoint(offset: 300, interval: 10, start: 210, end: 300, alignment: ScrollSnapPointsAlignment.Near);
00210
00211                 zoomSnapPoint1 = new ZoomSnapPoint(snapPointValue: 1);
00212                 zoomSnapPoint2 = new ZoomSnapPoint(snapPointValue: 2);
00213                 zoomSnapPoint3 = new ZoomSnapPoint(snapPointValue: 3);
00214
00215                 scrollPresenter1.HorizontalSnapPoints.Add(scrollSnapPoint1);
00216                 scrollPresenter1.HorizontalSnapPoints.Add(scrollSnapPoint2);
00217                 scrollPresenter1.VerticalSnapPoints.Add(scrollSnapPoint1);
00218                 scrollPresenter1.VerticalSnapPoints.Add(scrollSnapPoint3);
00219
00220                 scrollPresenter2.HorizontalSnapPoints.Add(repeatedScrollSnapPoint1);
00221                 scrollPresenter2.HorizontalSnapPoints.Add(repeatedScrollSnapPoint2);
00222                 scrollPresenter2.VerticalSnapPoints.Add(repeatedScrollSnapPoint1);
00223                 scrollPresenter2.VerticalSnapPoints.Add(repeatedScrollSnapPoint3);
00224
00225                 scrollPresenter1.ZoomSnapPoints.Add(zoomSnapPoint1);
00226                 scrollPresenter1.ZoomSnapPoints.Add(zoomSnapPoint2);
00227                 scrollPresenter2.ZoomSnapPoints.Add(zoomSnapPoint1);
00228                 scrollPresenter2.ZoomSnapPoints.Add(zoomSnapPoint3);
00229
00230                 scrollPresenter3.HorizontalSnapPoints.Add(scrollSnapPoint1);
00231                 scrollPresenter3.HorizontalSnapPoints.Add(scrollSnapPoint1);
00232             });
00233
00234             IdleSynchronizer.Wait();
00235
00236             RunOnUIThread.Execute(() =>
00237             {
00238                 Vector2 horizontalScrollSnapPoint11ApplicableZone = ScrollPresenterTestHooks.GetHorizontalSnapPointActualApplicableZone(scrollPresenter1, scrollSnapPoint1);
00239                 Vector2 verticalScrollSnapPoint11ApplicableZone = ScrollPresenterTestHooks.GetVerticalSnapPointActualApplicableZone(scrollPresenter1, scrollSnapPoint1);
00240                 Log.Comment("horizontalScrollSnapPoint11ApplicableZone=" + horizontalScrollSnapPoint11ApplicableZone.ToString());
00241                 Log.Comment("verticalScrollSnapPoint11ApplicableZone=" + verticalScrollSnapPoint11ApplicableZone.ToString());
00242
00243                 Vector2 horizontalScrollSnapPoint21ApplicableZone = ScrollPresenterTestHooks.GetHorizontalSnapPointActualApplicableZone(scrollPresenter2, repeatedScrollSnapPoint1);
00244                 Vector2 verticalScrollSnapPoint21ApplicableZone = ScrollPresenterTestHooks.GetVerticalSnapPointActualApplicableZone(scrollPresenter2, repeatedScrollSnapPoint1);
00245                 Log.Comment("horizontalScrollSnapPoint21ApplicableZone=" + horizontalScrollSnapPoint21ApplicableZone.ToString());
00246                 Log.Comment("verticalScrollSnapPoint21ApplicableZone=" + verticalScrollSnapPoint21ApplicableZone.ToString());
00247
00248                 Vector2 zoomSnapPoint11ApplicableZone = ScrollPresenterTestHooks.GetZoomSnapPointActualApplicableZone(scrollPresenter1, zoomSnapPoint1);
00249                 Vector2 zoomSnapPoint21ApplicableZone = ScrollPresenterTestHooks.GetZoomSnapPointActualApplicableZone(scrollPresenter2, zoomSnapPoint1);
00250                 Log.Comment("zoomSnapPoint11ApplicableZone=" + zoomSnapPoint11ApplicableZone.ToString());
00251                 Log.Comment("zoomSnapPoint21ApplicableZone=" + zoomSnapPoint21ApplicableZone.ToString());
00252
00253                 int combinationCount11 = ScrollPresenterTestHooks.GetHorizontalSnapPointCombinationCount(scrollPresenter1, scrollSnapPoint1);
00254                 int combinationCount31 = ScrollPresenterTestHooks.GetHorizontalSnapPointCombinationCount(scrollPresenter3, scrollSnapPoint1);
00255                 Log.Comment("combinationCount11=" + combinationCount11);
00256                 Log.Comment("combinationCount31=" + combinationCount31);
00257
00258                 Log.Comment("Expecting different applicable zones for ScrollSnapPoint in horizontal and vertical collections");
00259                 Verify.AreEqual<float>(15.0f, horizontalScrollSnapPoint11ApplicableZone.Y);
00260                 Verify.AreEqual<float>(20.0f, verticalScrollSnapPoint11ApplicableZone.Y);
00261
00262                 Log.Comment("Expecting identical applicable zones for RepeatedScrollSnapPoint in horizontal and vertical collections");
00263                 Verify.AreEqual<float>(10.0f, horizontalScrollSnapPoint21ApplicableZone.X);
00264                 Verify.AreEqual<float>(10.0f, verticalScrollSnapPoint21ApplicableZone.X);
00265                 Verify.AreEqual<float>(100.0f, horizontalScrollSnapPoint21ApplicableZone.Y);
00266                 Verify.AreEqual<float>(100.0f, verticalScrollSnapPoint21ApplicableZone.Y);
00267
00268                 Log.Comment("Expecting different applicable zones for ZoomSnapPoint in two zoom collections");
00269                 Verify.AreEqual<float>(1.5f, zoomSnapPoint11ApplicableZone.Y);
00270                 Verify.AreEqual<float>(2.0f, zoomSnapPoint21ApplicableZone.Y);
00271
00272                 Log.Comment("Expecting different combination counts for ScrollSnapPoint in two horizontal collections");
00273                 Verify.AreEqual<int>(0, combinationCount11);
00274                 Verify.AreEqual<int>(1, combinationCount31);
00275             });
00276         }
00277
00278         [TestMethod]
00279         [TestProperty("Description", "Snap to the first instance of a repeated scroll snap point and ensure it is placed after the Start value.")]
00280         public void SnapToFirstRepeatedScrollSnapPoint()
00281         {
00282             ScrollPresenter scrollPresenter = null;
00283             Rectangle rectangleScrollPresenterContent = null;
00284             AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00285
00286             RunOnUIThread.Execute(() =>
00287             {
00288                 rectangleScrollPresenterContent = new Rectangle();
00289                 scrollPresenter = new ScrollPresenter();
00290
00291                 SetupDefaultUI(scrollPresenter, rectangleScrollPresenterContent, scrollPresenterLoadedEvent);
00292             });
00293
00294             WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00295
00296             // Jump to absolute offsets
00297             ScrollTo(scrollPresenter, 60.0, 0.0, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Default);
00298
00299             // Add scroll repeated snap point with different offset and start.
00300             RunOnUIThread.Execute(() =>
00301             {
00302                 RepeatedScrollSnapPoint snapPoint = new RepeatedScrollSnapPoint(
00303                     offset: 50,
00304                     interval: 60,
00305                     start: 10,
00306                     end: 1190,
00307                     alignment: ScrollSnapPointsAlignment.Near);
00308
00309                 scrollPresenter.HorizontalSnapPoints.Add(snapPoint);
00310             });
00311
00312             // Flick with horizontal offset velocity to naturally land around offset 15.
00313             AddScrollVelocity(scrollPresenter, horizontalVelocity: -165.0f, verticalVelocity: 0.0f, horizontalInertiaDecayRate: null, verticalInertiaDecayRate: null, hookViewChangingAndChanged: false);
00314
00315             RunOnUIThread.Execute(() =>
00316             {
00317                 // HorizontalOffset expected to have snapped to first instance of repeated snap point: 50.
00318                 Verify.AreEqual(50.0, scrollPresenter.HorizontalOffset);
00319                 Verify.AreEqual(0.0, scrollPresenter.VerticalOffset);
00320                 Verify.AreEqual(1.0f, scrollPresenter.ZoomFactor);
00321             });
00322         }
00323
00324         [TestMethod]
00325         [TestProperty("Description", "Snap to the first instance of a repeated zoom snap point and ensure it is placed after the Start value.")]
00326         public void SnapToFirstRepeatedZoomSnapPoint()
00327         {
00328             ScrollPresenter scrollPresenter = null;
00329             Rectangle rectangleScrollPresenterContent = null;
00330             AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00331
00332             RunOnUIThread.Execute(() =>
00333             {
00334                 rectangleScrollPresenterContent = new Rectangle();
00335                 scrollPresenter = new ScrollPresenter();
00336
00337                 SetupDefaultUI(scrollPresenter, rectangleScrollPresenterContent, scrollPresenterLoadedEvent);
00338             });
00339
00340             WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00341
00342             // Jump to absolute zoom factor, and center the content in the viewport.
00343             ZoomTo(scrollPresenter,
00344                 zoomFactor: 6.0f,
00345                 centerPointX: 690.0f,
00346                 centerPointY: 340.0f,
00347                 ScrollingAnimationMode.Disabled,
00348                 ScrollingSnapPointsMode.Default);
00349
00350             // Add zoom repeated snap point with different offset and start.
00351             RunOnUIThread.Execute(() =>
00352             {
00353                 RepeatedZoomSnapPoint snapPoint = new RepeatedZoomSnapPoint(
00354                     offset: 5,
00355                     interval: 6,
00356                     start: 1,
00357                     end: 9);
00358
00359                 scrollPresenter.ZoomSnapPoints.Add(snapPoint);
00360             });
00361
00362             // Flick with zoom factor velocity to naturally land around factor 1.5.
00363             AddZoomVelocity(scrollPresenter,
00364                 zoomFactorVelocity: -5.0f,
00365                 inertiaDecayRate: 0.6675f,
00366                 centerPointX: 150.0f,
00367                 centerPointY: 100.0f,
00368                 hookViewChangingAndChanged: false);
00369
00370             RunOnUIThread.Execute(() =>
00371             {
00372                 // ZoomFactor expected to have snapped to first instance of repeated snap point: 5.
00373                 // Scroll offsets do not snap and end close to 2850, 1400 for a centered content.
00374                 Verify.IsTrue(Math.Abs(scrollPresenter.HorizontalOffset - 2850.0) < 1.0);
00375                 Verify.IsTrue(Math.Abs(scrollPresenter.VerticalOffset - 1400.0) < 1.0);
00376                 Verify.AreEqual(5.0f, scrollPresenter.ZoomFactor);
00377             });
00378         }
00379     }
00380 }
Generated on Sun Dec 1 2024 20:52:12 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/RevealBackgroundBrush.h Source File

  • Materials
  • Reveal

RevealBackgroundBrush.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "RevealBrush.h"
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/ScrollViewerIRefreshInfoProviderAdapter/ScrollViewerIRefreshInfoProviderAdapter.cpp Source File

  • PullToRefresh
  • ScrollViewerIRefreshInfoProviderAdapter

ScrollViewerIRefreshInfoProviderAdapter.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ScrollViewerIRefreshInfoProviderAdapter.h"
00007 #include "ScrollViewerIRefreshInfoProviderAdapterFactory.h"
00008 #include "RefreshInteractionRatioChangedEventArgs.h"
00009 #include "RefreshVisualizer.h"
00010 #include "ResourceAccessor.h"
00011 #include "PTRTracing.h"
00012
00013 // The maximum initial scroll viewer offset allowed before PTR is disabled, and we enter the peeking state
00014 #define INITIAL_OFFSET_THRESHOLD 1.0f
00015
00016 // The farthest down the tree we are willing to search for a SV in the adapt from tree method
00017 #define MAX_BFS_DEPTH 10
00018
00019 // In the event that we call Refresh before having an implementation of IRefreshInfoProvider to tell us
00020 // what value to use as the execution ratio, we use this value instead.
00021 #define FALLBACK_EXECUTION_RATIO 0.8
00022
00023 // The ScrollViewerAdapter is responsible for creating an implementation of the IRefreshInfoProvider interface from a ScrollViewer. This
00024 // Is accomplished by attaching an interaction tracker to the scrollViewer's content presenter and wiring the PTR functionality up to that.
00025 ScrollViewerIRefreshInfoProviderAdapter::~ScrollViewerIRefreshInfoProviderAdapter()
00026 {
00027     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00028     if (m_scrollViewer.safe_get())
00029     {
00030         CleanupScrollViewer();
00031     }
00032
00033     if (m_infoProvider.safe_get<winrt::IRefreshInfoProvider>())
00034     {
00035         CleanupIRefreshInfoProvider();
00036     }
00037 }
00038
00039 ScrollViewerIRefreshInfoProviderAdapter::ScrollViewerIRefreshInfoProviderAdapter(
00040     winrt::RefreshPullDirection const& refreshPullDirection, winrt::IAdapterAnimationHandler const& animationHandler)
00041 {
00042     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00043
00044     m_refreshPullDirection = refreshPullDirection;
00045     if (animationHandler)
00046     {
00047         m_animationHandler.set(animationHandler);
00048     }
00049     else
00050     {
00051         m_animationHandler.set(winrt::make_self<ScrollViewerIRefreshInfoProviderDefaultAnimationHandler>(nullptr, m_refreshPullDirection).as<winrt::IAdapterAnimationHandler>());
00052     }
00053 }
00054
00055 winrt::IRefreshInfoProvider ScrollViewerIRefreshInfoProviderAdapter::AdaptFromTree(winrt::UIElement const& root, winrt::Size const& refreshVisualizerSize)
00056 {
00057     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00058
00059     const winrt::UIElement& winrtRoot = root;
00060     winrt::FxScrollViewer rootAsSV = winrtRoot.try_as<winrt::FxScrollViewer>();
00061     int depth = 0;
00062     if (rootAsSV)
00063     {
00064         return Adapt(winrtRoot.as<winrt::FxScrollViewer>(), refreshVisualizerSize);
00065     }
00066     else
00067     {
00068         while (depth < MAX_BFS_DEPTH)
00069         {
00070             winrt::FxScrollViewer helperResult = AdaptFromTreeRecursiveHelper(winrtRoot, depth);
00071             if (helperResult)
00072             {
00073                 return Adapt(helperResult, refreshVisualizerSize);
00074                 break;
00075             }
00076             depth++;
00077         }
00078     }
00079
00080     return nullptr;
00081 }
00082
00083 winrt::IRefreshInfoProvider ScrollViewerIRefreshInfoProviderAdapter::Adapt(winrt::FxScrollViewer const& adaptee, winrt::Size const& refreshVisualizerSize)
00084 {
00085     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_PTR, METH_NAME, this, adaptee);
00086     if (!adaptee)
00087     {
00088         throw winrt::hresult_invalid_argument(L"Adaptee cannot be null.");
00089     }
00090
00091     if (m_scrollViewer)
00092     {
00093         CleanupScrollViewer();
00094     }
00095
00096     if (m_infoProvider)
00097     {
00098         CleanupIRefreshInfoProvider();
00099     }
00100
00101     m_infoProvider.set(nullptr);
00102     m_interactionTracker.set(nullptr);
00103     m_visualInteractionSource.set(nullptr);
00104     m_scrollViewer.set(adaptee);
00105
00106
00107     if (!m_scrollViewer.get().Content())
00108     {
00109         throw winrt::hresult_invalid_argument(L"Adaptee's content property cannot be null.");
00110     }
00111
00112     winrt::UIElement content = GetScrollContent();
00113     if (!content)
00114     {
00115         throw winrt::hresult_invalid_argument(L"Adaptee's content property must be a UIElement.");
00116     }
00117
00118     auto contentParent = winrt::VisualTreeHelper::GetParent(content);
00119     if (!contentParent)
00120     {
00121         //If the Content property does not have a parent this likely means the OnLoaded event of the SV has not fired yet.
00122         //Attach to this event to finish the adaption.
00123         m_scrollViewer_LoadedToken = m_scrollViewer.get().Loaded({ this, &ScrollViewerIRefreshInfoProviderAdapter::OnScrollViewerLoaded });
00124     }
00125     else
00126     {
00127         OnScrollViewerLoaded(nullptr, nullptr);
00128         winrt::UIElement contentParentAsUIElement = contentParent.try_as<winrt::UIElement>();
00129         if (!contentParentAsUIElement)
00130         {
00131             throw winrt::hresult_invalid_argument(L"Adaptee's content's parent must be a UIElement.");
00132         }
00133     }
00134     winrt::Visual contentVisual = winrt::ElementCompositionPreview::GetElementVisual(content);
00135     winrt::Compositor compositor = contentVisual.Compositor();
00136
00137     m_infoProvider.set(winrt::make_self<RefreshInfoProviderImpl>(m_refreshPullDirection, refreshVisualizerSize, compositor));
00138
00139     m_infoProvider_RefreshStartedToken = m_infoProvider.get()->RefreshStarted({ this, &ScrollViewerIRefreshInfoProviderAdapter::OnRefreshStarted });
00140     m_infoProvider_RefreshCompletedToken = m_infoProvider.get()->RefreshCompleted({ this, &ScrollViewerIRefreshInfoProviderAdapter::OnRefreshCompleted });
00141
00142     m_interactionTracker.set(winrt::InteractionTracker::CreateWithOwner(compositor, m_infoProvider.as<winrt::IInteractionTrackerOwner>()));
00143
00144     m_interactionTracker.get().MinPosition(winrt::float3(0.0f));
00145     m_interactionTracker.get().MaxPosition(winrt::float3(0.0f));
00146     m_interactionTracker.get().MinScale(1.0f);
00147     m_interactionTracker.get().MaxScale(1.0f);
00148
00149     if (m_visualInteractionSource.get())
00150     {
00151         m_interactionTracker.get().InteractionSources().Add(m_visualInteractionSource.get());
00152         m_visualInteractionSourceIsAttached = true;
00153     }
00154
00155     winrt::PointerEventHandler myEventHandler =
00156     [=](auto sender, auto args)
00157     {
00158         PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, L"ScrollViewer::PointerPressedHandler", this);
00159         if (args.Pointer().PointerDeviceType() == winrt::PointerDeviceType::Touch && m_visualInteractionSource.get())
00160         {
00161             if (m_visualInteractionSourceIsAttached)
00162             {
00163                 winrt::PointerPoint pp = args.GetCurrentPoint(nullptr);
00164
00165                 if (pp)
00166                 {
00167                     bool tryRedirectForManipulationSuccessful = true;
00168
00169                     try
00170                     {
00171                         PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_METH, L"ScrollViewer::PointerPressedHandler", this, L"TryRedirectForManipulation");
00172                         m_visualInteractionSource.get().TryRedirectForManipulation(pp);
00173                     }
00174                     catch (const winrt::hresult_error& e)
00175                     {
00176                         // Swallowing Access Denied error because of InteractionTracker bug 17434718 which has been causing crashes at least in RS3, RS4 and RS5.
00177                         if (e.to_abi() != E_ACCESSDENIED)
00178                         {
00179                             throw;
00180                         }
00181
00182                         tryRedirectForManipulationSuccessful = false;
00183                     }
00184
00185                     if (tryRedirectForManipulationSuccessful)
00186                     {
00187                         m_infoProvider.get()->SetPeekingMode(!IsWithinOffsetThreshold());
00188                     }
00189                 }
00190             }
00191             else
00192             {
00193                 throw winrt::hresult_invalid_argument(L"Invalid IRefreshInfoProvider adaptation of scroll viewer, this can occur when calling TryRedirectForManipulation to an unattached visual interaction source.");
00194             }
00195         }
00196     };
00197
00198     m_boxedPointerPressedEventHandler.set(winrt::box_value<winrt::PointerEventHandler>(myEventHandler));
00199     m_scrollViewer.get().AddHandler(winrt::UIElement::PointerPressedEvent(), m_boxedPointerPressedEventHandler.get(), true /* handledEventsToo */);
00200     m_scrollViewer_DirectManipulationCompletedToken = m_scrollViewer.get().DirectManipulationCompleted({ this, &ScrollViewerIRefreshInfoProviderAdapter::OnScrollViewerDirectManipulationCompleted });
00201     m_scrollViewer_ViewChangingToken = m_scrollViewer.get().ViewChanging({ this, &ScrollViewerIRefreshInfoProviderAdapter::OnScrollViewerViewChanging });
00202
00203     return m_infoProvider.as<winrt::IRefreshInfoProvider>();
00204 }
00205
00206 void ScrollViewerIRefreshInfoProviderAdapter::SetAnimations(winrt::UIElement const& refreshVisualizerContainer)
00207 {
00208     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00209     if (!refreshVisualizerContainer)
00210     {
00211         throw winrt::hresult_invalid_argument(L"The refreshVisualizerContainer cannot be null.");
00212     }
00213
00214     m_animationHandler.get().InteractionTrackerAnimation(refreshVisualizerContainer, GetScrollContent(), m_interactionTracker.get());
00215 }
00216
00217 void ScrollViewerIRefreshInfoProviderAdapter::OnRefreshStarted(const winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*args*/)
00218 {
00219     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00220     auto content = GetScrollContent();
00221     if (content)
00222     {
00223         content.CancelDirectManipulations();
00224     }
00225
00226     double executionRatio = FALLBACK_EXECUTION_RATIO;
00227     if (m_infoProvider.get())
00228     {
00229         executionRatio = m_infoProvider.get()->ExecutionRatio();
00230     }
00231
00232     m_animationHandler.get().RefreshRequestedAnimation(nullptr, content, executionRatio);
00233 }
00234
00235 void ScrollViewerIRefreshInfoProviderAdapter::OnRefreshCompleted(const winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*args*/)
00236 {
00237     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00238     m_animationHandler.get().RefreshCompletedAnimation(nullptr, GetScrollContent());
00239 }
00240
00241 void ScrollViewerIRefreshInfoProviderAdapter::OnScrollViewerLoaded(const winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*args*/)
00242 {
00243     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00244     winrt::UIElement content = GetScrollContent();
00245     if (!content)
00246     {
00247         throw winrt::hresult_invalid_argument(L"Adaptee's content property must be a UIElement.");
00248     }
00249
00250     auto contentParent = winrt::VisualTreeHelper::GetParent(content);
00251     if (!contentParent)
00252     {
00253         throw winrt::hresult_invalid_argument(L"Adaptee cannot be null.");
00254     }
00255
00256     winrt::UIElement contentParentAsUIElement = contentParent.try_as<winrt::UIElement>();
00257     if (!contentParentAsUIElement)
00258     {
00259         throw winrt::hresult_invalid_argument(L"Adaptee's content's parent must be a UIElement.");
00260     }
00261
00262     MakeInteractionSource(contentParentAsUIElement);
00263
00264     m_scrollViewer.get().Loaded(m_scrollViewer_LoadedToken);
00265 }
00266
00267 void ScrollViewerIRefreshInfoProviderAdapter::OnScrollViewerDirectManipulationCompleted(const winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*args*/)
00268 {
00269     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00270     if (m_infoProvider.get())
00271     {
00272         m_infoProvider.get()->UpdateIsInteractingForRefresh(false);
00273     }
00274 }
00275
00276 void ScrollViewerIRefreshInfoProviderAdapter::OnScrollViewerViewChanging(const winrt::IInspectable& /*sender*/, const winrt::Microsoft::UI::Xaml::Controls::ScrollViewerViewChangingEventArgs& args)
00277 {
00278     if (m_infoProvider.get() && m_infoProvider.get()->IsInteractingForRefresh())
00279     {
00280         PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, args.FinalView().HorizontalOffset(), args.FinalView().VerticalOffset());
00281         if (!IsWithinOffsetThreshold())
00282         {
00283             PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_STR, METH_NAME, this, L"No longer interacting for refresh due to ScrollViewer view change.");
00284             m_infoProvider.get()->UpdateIsInteractingForRefresh(false);
00285         }
00286     }
00287 }
00288
00289 bool ScrollViewerIRefreshInfoProviderAdapter::IsOrientationVertical()
00290 {
00291     return (m_refreshPullDirection == winrt::RefreshPullDirection::TopToBottom || m_refreshPullDirection == winrt::RefreshPullDirection::BottomToTop);
00292 }
00293
00294 winrt::UIElement ScrollViewerIRefreshInfoProviderAdapter::GetScrollContent()
00295 {
00296     if (m_scrollViewer)
00297     {
00298         auto content = m_scrollViewer.get().Content();
00299         return content.try_as<winrt::UIElement>();
00300     }
00301     return nullptr;
00302 }
00303
00304 void ScrollViewerIRefreshInfoProviderAdapter::MakeInteractionSource(const winrt::UIElement& contentParent)
00305 {
00306     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00307     winrt::Visual contentParentVisual = winrt::ElementCompositionPreview::GetElementVisual(contentParent);
00308
00309     m_visualInteractionSourceIsAttached = false;
00310     m_visualInteractionSource.set(winrt::VisualInteractionSource::Create(contentParentVisual));
00311     m_visualInteractionSource.get().ManipulationRedirectionMode(winrt::VisualInteractionSourceRedirectionMode::CapableTouchpadOnly);
00312     m_visualInteractionSource.get().ScaleSourceMode(winrt::InteractionSourceMode::Disabled);
00313     m_visualInteractionSource.get().PositionXSourceMode(IsOrientationVertical() ? winrt::InteractionSourceMode::Disabled : winrt::InteractionSourceMode::EnabledWithInertia);
00314     m_visualInteractionSource.get().PositionXChainingMode(IsOrientationVertical() ? winrt::InteractionChainingMode::Auto : winrt::InteractionChainingMode::Never);
00315     m_visualInteractionSource.get().PositionYSourceMode(IsOrientationVertical() ? winrt::InteractionSourceMode::EnabledWithInertia : winrt::InteractionSourceMode::Disabled);
00316     m_visualInteractionSource.get().PositionYChainingMode(IsOrientationVertical() ? winrt::InteractionChainingMode::Never : winrt::InteractionChainingMode::Auto);
00317
00318     if (m_interactionTracker)
00319     {
00320         m_interactionTracker.get().InteractionSources().Add(m_visualInteractionSource.get());
00321         m_visualInteractionSourceIsAttached = true;
00322     }
00323 }
00324
00325 winrt::FxScrollViewer ScrollViewerIRefreshInfoProviderAdapter::AdaptFromTreeRecursiveHelper(const winrt::DependencyObject& root, int depth)
00326 {
00327     PTR_TRACE_INFO(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, depth);
00328     const int numChildren = winrt::VisualTreeHelper::GetChildrenCount(root);
00329     if (depth == 0)
00330     {
00331         for (int i = 0; i < numChildren; i++)
00332         {
00333             const winrt::DependencyObject childObject = winrt::VisualTreeHelper::GetChild(root, i);
00334             const winrt::FxScrollViewer childObjectAsSV = childObject.try_as<winrt::FxScrollViewer>();
00335             if (childObjectAsSV)
00336             {
00337                 return childObjectAsSV;
00338             }
00339         }
00340         return nullptr;
00341     }
00342     else
00343     {
00344         for (int i = 0; i < numChildren; i++)
00345         {
00346             const winrt::DependencyObject childObject = winrt::VisualTreeHelper::GetChild(root, i);
00347             const winrt::FxScrollViewer recursiveResult = AdaptFromTreeRecursiveHelper(childObject, depth - 1);
00348             if (recursiveResult)
00349             {
00350                 return recursiveResult;
00351             }
00352         }
00353         return nullptr;
00354     }
00355 }
00356
00357 void ScrollViewerIRefreshInfoProviderAdapter::CleanupScrollViewer()
00358 {
00359     auto&& sv = m_scrollViewer.get();
00360     if (m_boxedPointerPressedEventHandler)
00361     {
00362         sv.RemoveHandler(winrt::UIElement::PointerPressedEvent(), m_boxedPointerPressedEventHandler.get());
00363         m_boxedPointerPressedEventHandler.set(nullptr);
00364     }
00365     if (m_scrollViewer_DirectManipulationCompletedToken.value)
00366     {
00367         sv.DirectManipulationCompleted(m_scrollViewer_DirectManipulationCompletedToken);
00368         m_scrollViewer_DirectManipulationCompletedToken.value = 0;
00369     }
00370     if (m_scrollViewer_ViewChangingToken.value)
00371     {
00372         sv.ViewChanging(m_scrollViewer_ViewChangingToken);
00373         m_scrollViewer_ViewChangingToken.value = 0;
00374     }
00375     if (m_scrollViewer_LoadedToken.value)
00376     {
00377         sv.Loaded(m_scrollViewer_LoadedToken);
00378         m_scrollViewer_LoadedToken.value = 0;
00379     }
00380 }
00381
00382 void ScrollViewerIRefreshInfoProviderAdapter::CleanupIRefreshInfoProvider()
00383 {
00384     auto&& provider = m_infoProvider.get();
00385     if (m_infoProvider_RefreshStartedToken.value)
00386     {
00387         provider->RefreshStarted(m_infoProvider_RefreshStartedToken);
00388         m_infoProvider_RefreshStartedToken.value = 0;
00389     }
00390     if (m_infoProvider_RefreshCompletedToken.value)
00391     {
00392         provider->RefreshCompleted(m_infoProvider_RefreshCompletedToken);
00393         m_infoProvider_RefreshCompletedToken.value = 0;
00394     }
00395 }
00396
00397 bool ScrollViewerIRefreshInfoProviderAdapter::IsWithinOffsetThreshold()
00398 {
00399     switch (m_refreshPullDirection)
00400     {
00401     case winrt::RefreshPullDirection::TopToBottom:
00402         return m_scrollViewer.get().VerticalOffset() < INITIAL_OFFSET_THRESHOLD;
00403     case winrt::RefreshPullDirection::BottomToTop:
00404         return m_scrollViewer.get().VerticalOffset() > m_scrollViewer.get().ScrollableHeight() - INITIAL_OFFSET_THRESHOLD;
00405     case winrt::RefreshPullDirection::LeftToRight:
00406         return m_scrollViewer.get().HorizontalOffset() < INITIAL_OFFSET_THRESHOLD;
00407     case winrt::RefreshPullDirection::RightToLeft:
00408         return m_scrollViewer.get().HorizontalOffset() > m_scrollViewer.get().ScrollableWidth() - INITIAL_OFFSET_THRESHOLD;
00409     default:
00410         MUX_ASSERT(false);
00411         return false;
00412     }
00413 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/ExtendedSelector.cpp Source File

  • ItemsView

ExtendedSelector.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ExtendedSelector.h"
00007
00008 ExtendedSelector::ExtendedSelector()
00009 {
00010     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00011 }
00012
00013 ExtendedSelector::~ExtendedSelector()
00014 {
00015     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00016 }
00017
00018 void ExtendedSelector::OnInteractedAction(winrt::IndexPath const &index, bool ctrl, bool shift)
00019 {
00020     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, ctrl, shift);
00021
00022     auto selectionModel = GetSelectionModel();
00023     if (shift)
00024     {
00025         auto anchorIndex = selectionModel.AnchorIndex();
00026         if (anchorIndex)
00027         {
00028             selectionModel.ClearSelection();
00029             selectionModel.AnchorIndex(anchorIndex);
00030             selectionModel.SelectRangeFromAnchorTo(index);
00031         }
00032     }
00033     else if (ctrl)
00034     {
00035         if (IsSelected(index))
00036         {
00037             selectionModel.DeselectAt(index);
00038         }
00039         else
00040         {
00041             selectionModel.SelectAt(index);
00042         }
00043     }
00044     else
00045     {
00046         // Only clear selection if interacting with a different item.
00047         if (!IsSelected(index))
00048         {
00049             selectionModel.ClearSelection();
00050             selectionModel.SelectAt(index);
00051         }
00052     }
00053 }
00054
00055 void ExtendedSelector::OnFocusedAction(winrt::IndexPath const &index, bool ctrl, bool shift)
00056 {
00057     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, ctrl, shift);
00058
00059     auto selectionModel = GetSelectionModel();
00060
00061     if (shift && ctrl)
00062     {
00063         if (selectionModel.AnchorIndex())
00064         {
00065             selectionModel.SelectRangeFromAnchorTo(index);
00066         }
00067     }
00068     else if (shift)
00069     {
00070         auto anchorIndex = selectionModel.AnchorIndex();
00071         if (anchorIndex)
00072         {
00073             selectionModel.ClearSelection();
00074             selectionModel.AnchorIndex(anchorIndex);
00075             selectionModel.SelectRangeFromAnchorTo(index);
00076         }
00077     }
00078     else if (!ctrl)
00079     {
00080         selectionModel.ClearSelection();
00081         selectionModel.SelectAt(index);
00082     }
00083 }
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TabViewAutomationPeer.properties.cpp Source File

  • Generated

TabViewAutomationPeer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "TabViewAutomationPeer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Automation::Peers
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(TabViewAutomationPeer)
00012 }
00013
00014 #include "TabViewAutomationPeer.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AcrylicBrush Member List

This is the complete list of members for AcrylicBrush, including all inherited members.
abi_enter() | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
AcrylicBrush() | AcrylicBrush |
AcrylicBrushProperties() | AcrylicBrushProperties |
AcrylicTestApi | AcrylicBrush | [private]
AlwaysUseFallback(bool value) | AcrylicBrushProperties |
AlwaysUseFallback() | AcrylicBrushProperties |
AlwaysUseFallbackProperty() | AcrylicBrushProperties | [inline, static]
CancelFallbackAnimationCompleteWait() | AcrylicBrush | [private]
CheckThread() | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
ClearProperties() | AcrylicBrushProperties | [static]
CoerceToZeroOneRange(double &value) | AcrylicBrush |
CoerceToZeroOneRange_Nullable(winrt::IReference< double > &value) | AcrylicBrush |
CombineNoiseWithTintEffect_Luminosity(const winrt::IGraphicsEffectSource &blurredSource, const winrt::Microsoft::UI::Private::Composition::Effects::ColorSourceEffect &tintColorEffect, const winrt::Color initialLuminosityColor, std::vector< winrt::hstring > &animatedProperties) | AcrylicBrush | [private, static]
CreateAcrylicBrush(bool useCrossFadeEffect, bool forceCreateAcrylicBrush=false) | AcrylicBrush | [private]
CreateAcrylicBrushCompositionEffectFactory(const winrt::Compositor &compositor, bool shouldBrushBeOpaque, bool useCrossFadeEffect, winrt::Color initialTintColor, winrt::Color initialLuminosityColor, winrt::Color initialFallbackColor) | AcrylicBrush | [private, static]
CreateAcrylicBrushWorker(const winrt::Compositor &compositor, bool useCrossFadeEffect, winrt::Color tintColor, winrt::Color luminosityColor, winrt::Color fallbackColor, bool shouldBrushBeOpaque, bool useCache=false) | AcrylicBrush | [static]
CreateAnimation(const winrt::CompositionBrush &brush, winrt::CompositionScopedBatch &scopedBatch, winrt::event_token &token, float acrylicStart, float acrylicEnd, const winrt::TypedEventHandler< winrt::IInspectable, winrt::CompositionBatchCompletedEventArgs > &handler) | AcrylicBrush | [private]
DeleteInstanceOnUIThread(std::unique_ptr< AcrylicBrush > &&self) noexcept | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline, static]
EnsureNoiseBrush() | AcrylicBrush | [private]
EnsureProperties() | AcrylicBrushProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
final_release(std::unique_ptr< AcrylicBrush > &&self) | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline, static]
GetBase() | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
GetEffectiveLuminosityColor() | AcrylicBrush | [private]
GetEffectiveTintColor() | AcrylicBrush | [private]
GetInner() | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
GetOrCreateAcrylicBrushCompositionEffectFactory(const winrt::Compositor &compositor, bool shouldBrushBeOpaque, bool useCrossFadeEffect, winrt::Color initialTintColor, winrt::Color initialLuminosityColor, winrt::Color initialFallbackColor, bool useCache) | AcrylicBrush | [private, static]
IsInFallbackMode() | AcrylicBrush | [inline, private]
IsOnThread() | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
MakeColorAnimation(const winrt::Color &color, const winrt::TimeSpan &duration, const winrt::Compositor &compositor) | AcrylicBrush | [private, static]
MakeFloatAnimation(float fromValue, float toValue, const winrt::TimeSpan &duration, const winrt::CompositionEasingFunction &easing, const winrt::Compositor &compositor) | AcrylicBrush | [private, static]
MaterialHelper | AcrylicBrush | [private]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
OnAlwaysUseFallbackPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | AcrylicBrushProperties | [static]
OnConnected() | AcrylicBrush |
OnDisconnected() | AcrylicBrush |
OnFallbackColorChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | AcrylicBrush | [private]
OnMaterialPolicyStatusChanged(const com_ptr< MaterialHelperBase > &sender, bool isDisabledByMaterialPolicy) | AcrylicBrush |
OnNoiseChanged(const com_ptr< MaterialHelperBase > &sender) | AcrylicBrush |
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | AcrylicBrush |
OnTintColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | AcrylicBrushProperties | [static]
OnTintLuminosityOpacityPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | AcrylicBrushProperties | [static]
OnTintOpacityPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | AcrylicBrushProperties | [static]
OnTintTransitionDurationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | AcrylicBrushProperties | [static]
PlayCrossFadeAnimation(const winrt::CompositionBrush &brush, float acrylicStart, float acrylicEnd) | AcrylicBrush | [private, static]
PolicyStatusChangedHelper(bool isDisabledByMaterialPolicy) | AcrylicBrush | [private]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< AcrylicBrush, winrt::implementation::AcrylicBrushT > | [inline]
s_AlwaysUseFallbackProperty | AcrylicBrushProperties | [static]
s_TintColorProperty | AcrylicBrushProperties | [static]
s_TintLuminosityOpacityProperty | AcrylicBrushProperties | [static]
s_TintOpacityProperty | AcrylicBrushProperties | [static]
s_TintTransitionDurationProperty | AcrylicBrushProperties | [static]
sc_blurRadius | AcrylicBrush | [private, static]
sc_noiseOpacity | AcrylicBrush | [private, static]
sc_saturation | AcrylicBrush | [private, static]
TintColor(winrt::Color const &value) | AcrylicBrushProperties |
TintColor() | AcrylicBrushProperties |
TintColorProperty() | AcrylicBrushProperties | [inline, static]
TintLuminosityOpacity(winrt::IReference< double > const &value) | AcrylicBrushProperties |
TintLuminosityOpacity() | AcrylicBrushProperties |
TintLuminosityOpacityProperty() | AcrylicBrushProperties | [inline, static]
TintOpacity(double value) | AcrylicBrushProperties |
TintOpacity() | AcrylicBrushProperties |
TintOpacityProperty() | AcrylicBrushProperties | [inline, static]
TintTransitionDuration(winrt::TimeSpan const &value) | AcrylicBrushProperties |
TintTransitionDuration() | AcrylicBrushProperties |
TintTransitionDurationProperty() | AcrylicBrushProperties | [inline, static]
UpdateAcrylicBrush() | AcrylicBrush | [private]
UpdateAcrylicStatus() | AcrylicBrush | [private]
~AcrylicBrush() | AcrylicBrush | [virtual]
Generated on Sun Dec 1 2024 20:52:37 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PagerControlTemplateSettings Member List

This is the complete list of members for PagerControlTemplateSettings, including all inherited members.
ClearProperties() | PagerControlTemplateSettingsProperties | [static]
EnsureProperties() | PagerControlTemplateSettingsProperties | [static]
NumberPanelItems(winrt::IVector< winrt::IInspectable > const &value) | PagerControlTemplateSettingsProperties |
NumberPanelItems() | PagerControlTemplateSettingsProperties |
NumberPanelItemsProperty() | PagerControlTemplateSettingsProperties | [inline, static]
PagerControlTemplateSettings() | PagerControlTemplateSettings | [inline]
PagerControlTemplateSettingsProperties() | PagerControlTemplateSettingsProperties |
Pages(winrt::IVector< winrt::IInspectable > const &value) | PagerControlTemplateSettingsProperties |
Pages() | PagerControlTemplateSettingsProperties |
PagesProperty() | PagerControlTemplateSettingsProperties | [inline, static]
s_NumberPanelItemsProperty | PagerControlTemplateSettingsProperties | [static]
s_PagesProperty | PagerControlTemplateSettingsProperties | [static]
Generated on Sun Dec 1 2024 20:53:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IAnimatedVisual Member List

This is the complete list of members for IAnimatedVisual, including all inherited members.
CreateAnimations() | IAnimatedVisual
DestroyAnimations() | IAnimatedVisual
Pause() | IAnimatedVisual
PlayAsync(Double fromProgress, Double toProgress, Boolean looped) | IAnimatedVisual
Resume() | IAnimatedVisual
SetPlaybackRate(Double playbackRate) | IAnimatedVisual
SetProgress(Double progress) | IAnimatedVisual
SetProgressObject(Microsoft.UI.Composition.CompositionPropertySet compositionPropertySet) | IAnimatedVisual
SetSize(Windows.Foundation.Size size) | IAnimatedVisual
Stop() | IAnimatedVisual
Generated on Sun Dec 1 2024 20:53:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/TestUI/ScrollViewBringIntoViewPage.xaml.cs Source File

  • ScrollView
  • TestUI

ScrollViewBringIntoViewPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using Microsoft.UI.Composition;
00007 using Microsoft.UI.Xaml;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Xaml.Navigation;
00010
00011 using ScrollPresenter = Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter;
00012 using ScrollView = Microsoft.UI.Xaml.Controls.ScrollView;
00013 using ScrollingScrollAnimationStartingEventArgs = Microsoft.UI.Xaml.Controls.ScrollingScrollAnimationStartingEventArgs;
00014 using ScrollingZoomAnimationStartingEventArgs = Microsoft.UI.Xaml.Controls.ScrollingZoomAnimationStartingEventArgs;
00015 using ScrollingScrollCompletedEventArgs = Microsoft.UI.Xaml.Controls.ScrollingScrollCompletedEventArgs;
00016 using ScrollingZoomCompletedEventArgs = Microsoft.UI.Xaml.Controls.ScrollingZoomCompletedEventArgs;
00017 using ScrollingBringingIntoViewEventArgs = Microsoft.UI.Xaml.Controls.ScrollingBringingIntoViewEventArgs;
00018 using MUXControlsTestHooks = Microsoft.UI.Private.Controls.MUXControlsTestHooks;
00019 using MUXControlsTestHooksLoggingMessageEventArgs = Microsoft.UI.Private.Controls.MUXControlsTestHooksLoggingMessageEventArgs;
00020 using ScrollViewTestHooks = Microsoft.UI.Private.Controls.ScrollViewTestHooks;
00021
00022 namespace MUXControlsTestApp
00023 {
00024     public sealed partial class ScrollViewBringIntoViewPage : TestPage
00025     {
00026         private object asyncEventReportingLock = new object();
00027         private List<string> lstAsyncEventMessage = new List<string>();
00028
00029         public ScrollViewBringIntoViewPage()
00030         {
00031             this.InitializeComponent();
00032
00033             if (chkLogScrollViewMessages.IsChecked == true || chkLogScrollPresenterMessages.IsChecked == true)
00034             {
00035                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00036
00037                 if (chkLogScrollPresenterMessages.IsChecked == true)
00038                 {
00039                     MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00040                 }
00041                 if (chkLogScrollViewMessages.IsChecked == true)
00042                 {
00043                     MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00044                 }
00045             }
00046         }
00047
00048         ~ScrollViewBringIntoViewPage()
00049         {
00050         }
00051
00052         protected override void OnNavigatedFrom(NavigationEventArgs e)
00053         {
00054             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00055             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00056
00057             MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00058
00059             base.OnNavigatedFrom(e);
00060         }
00061
00062         private void BtnStartBringIntoView_Click(object sender, RoutedEventArgs e)
00063         {
00064             try
00065             {
00066                 txtStockOffsetsChangeDuration.Text = string.Empty;
00067
00068                 FrameworkElement targetElement = null;
00069
00070                 switch (cmbTargetElement.SelectedIndex)
00071                 {
00072                     case 0:
00073                         targetElement = rectangle;
00074                         break;
00075                     case 1:
00076                         targetElement = scrollView;
00077                         break;
00078                 }
00079
00080                 if (targetElement != null)
00081                 {
00082                     BringIntoViewOptions options = new BringIntoViewOptions();
00083
00084                     options.AnimationDesired = cmbAnimationDesired.SelectedIndex == 0;
00085                     options.HorizontalAlignmentRatio = Convert.ToDouble(txtHorizontalAlignmentRatio.Text);
00086                     options.VerticalAlignmentRatio = Convert.ToDouble(txtVerticalAlignmentRatio.Text);
00087                     options.HorizontalOffset = Convert.ToDouble(txtHorizontalOffset.Text);
00088                     options.VerticalOffset = Convert.ToDouble(txtVerticalOffset.Text);
00089
00090                     if (chkLogScrollViewMessages.IsChecked == true)
00091                     {
00092                         AppendAsyncEventMessage("Invoking StartBringIntoView on " + targetElement.Name);
00093                     }
00094                     targetElement.StartBringIntoView(options);
00095                 }
00096
00097                 if (targetElement == null && chkLogScrollViewMessages.IsChecked == true)
00098                 {
00099                     AppendAsyncEventMessage("TargetElement not found");
00100                 }
00101             }
00102             catch (Exception ex)
00103             {
00104                 txtExceptionReport.Text = ex.ToString();
00105                 lstLogs.Items.Add(ex.ToString());
00106             }
00107         }
00108
00109         private void ChkBringIntoViewUI_Checked(object sender, RoutedEventArgs e)
00110         {
00111             if (grdBringIntoViewUI != null)
00112                 grdBringIntoViewUI.Visibility = Visibility.Visible;
00113         }
00114
00115         private void ChkBringIntoViewUI_Unchecked(object sender, RoutedEventArgs e)
00116         {
00117             if (grdBringIntoViewUI != null)
00118                 grdBringIntoViewUI.Visibility = Visibility.Collapsed;
00119         }
00120
00121         private void ChkLogs_Checked(object sender, RoutedEventArgs e)
00122         {
00123             if (grdLogs != null)
00124                 grdLogs.Visibility = Visibility.Visible;
00125         }
00126
00127         private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
00128         {
00129             if (grdLogs != null)
00130                 grdLogs.Visibility = Visibility.Collapsed;
00131         }
00132
00133         private void ScrollView_Loaded(object sender, RoutedEventArgs e)
00134         {
00135             AppendAsyncEventMessage($"ScrollView.Loaded");
00136             if (chkLogScrollPresenterEvents.IsChecked == true)
00137             {
00138                 LogScrollPresenterInfo();
00139             }
00140             LogScrollViewInfo();
00141         }
00142
00143         private void ScrollView_SizeChanged(object sender, SizeChangedEventArgs e)
00144         {
00145             AppendAsyncEventMessage($"ScrollView.SizeChanged Size={scrollView.ActualWidth}, {scrollView.ActualHeight}");
00146             if (chkLogScrollPresenterEvents.IsChecked == true)
00147             {
00148                 LogScrollPresenterInfo();
00149             }
00150             LogScrollViewInfo();
00151         }
00152
00153         private void ScrollView_GettingFocus(UIElement sender, Microsoft.UI.Xaml.Input.GettingFocusEventArgs args)
00154         {
00155             FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
00156             string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
00157             FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
00158             string newFEName = (newFE == null) ? "null" : newFE.Name;
00159
00160             AppendAsyncEventMessage($"ScrollView.GettingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
00161         }
00162
00163         private void ScrollView_LostFocus(object sender, RoutedEventArgs e)
00164         {
00165             AppendAsyncEventMessage("ScrollView.LostFocus");
00166         }
00167
00168         private void ScrollView_LosingFocus(UIElement sender, Microsoft.UI.Xaml.Input.LosingFocusEventArgs args)
00169         {
00170             FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
00171             string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
00172             FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
00173             string newFEName = (newFE == null) ? "null" : newFE.Name;
00174
00175             AppendAsyncEventMessage($"ScrollView.LosingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
00176         }
00177
00178         private void ScrollView_GotFocus(object sender, RoutedEventArgs e)
00179         {
00180             AppendAsyncEventMessage("ScrollView.GotFocus");
00181         }
00182
00183         private void ScrollPresenter_Loaded(object sender, RoutedEventArgs e)
00184         {
00185             AppendAsyncEventMessage($"ScrollPresenter.Loaded");
00186             LogScrollPresenterInfo();
00187             if (chkLogScrollViewEvents.IsChecked == true)
00188             {
00189                 LogScrollViewInfo();
00190             }
00191         }
00192
00193         private void ScrollPresenter_SizeChanged(object sender, SizeChangedEventArgs e)
00194         {
00195             AppendAsyncEventMessage($"ScrollPresenter.SizeChanged Size={scrollView.ActualWidth}, {scrollView.ActualHeight}");
00196             LogScrollPresenterInfo();
00197             if (chkLogScrollViewEvents.IsChecked == true)
00198             {
00199                 LogScrollViewInfo();
00200             }
00201         }
00202
00203         private void ScrollPresenter_ExtentChanged(ScrollPresenter sender, object args)
00204         {
00205             AppendAsyncEventMessage("ScrollPresenter.ExtentChanged ExtentWidth={sender.ExtentWidth}, ExtentHeight={sender.ExtentHeight}");
00206         }
00207
00208         private void ScrollPresenter_StateChanged(ScrollPresenter sender, object args)
00209         {
00210             AppendAsyncEventMessage($"ScrollPresenter.StateChanged {sender.State.ToString()}");
00211         }
00212
00213         private void ScrollPresenter_ViewChanged(ScrollPresenter sender, object args)
00214         {
00215             AppendAsyncEventMessage($"ScrollPresenter.ViewChanged HorizontalOffset={sender.HorizontalOffset.ToString()}, VerticalOffset={sender.VerticalOffset}, ZoomFactor={sender.ZoomFactor}");
00216         }
00217
00218         private void ScrollPresenter_ScrollAnimationStarting(ScrollPresenter sender, ScrollingScrollAnimationStartingEventArgs args)
00219         {
00220             AppendAsyncEventMessage($"ScrollPresenter.ScrollAnimationStarting OffsetsChangeCorrelationId={args.CorrelationId}, SP=({args.StartPosition.X}, {args.StartPosition.Y}), EP=({args.EndPosition.X}, {args.EndPosition.Y})");
00221
00222             try
00223             {
00224                 Vector3KeyFrameAnimation stockKeyFrameAnimation = args.Animation as Vector3KeyFrameAnimation;
00225
00226                 if (stockKeyFrameAnimation != null)
00227                 {
00228                     txtStockOffsetsChangeDuration.Text = stockKeyFrameAnimation.Duration.TotalMilliseconds.ToString();
00229
00230                     if (!string.IsNullOrWhiteSpace(txtOverriddenOffsetsChangeDuration.Text))
00231                     {
00232                         double durationOverride = Convert.ToDouble(txtOverriddenOffsetsChangeDuration.Text);
00233                         stockKeyFrameAnimation.Duration = TimeSpan.FromMilliseconds(durationOverride);
00234                     }
00235                 }
00236             }
00237             catch (Exception ex)
00238             {
00239                 txtExceptionReport.Text = ex.ToString();
00240                 lstLogs.Items.Add(ex.ToString());
00241             }
00242         }
00243
00244         private void ScrollPresenter_ZoomAnimationStarting(ScrollPresenter sender, ScrollingZoomAnimationStartingEventArgs args)
00245         {
00246             AppendAsyncEventMessage($"ScrollPresenter.ZoomAnimationStarting ZoomFactorChangeCorrelationId={args.CorrelationId}, CenterPoint={args.CenterPoint}, SZF={args.StartZoomFactor}, EZF={args.EndZoomFactor}");
00247         }
00248
00249         private void ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args)
00250         {
00251             AppendAsyncEventMessage($"ScrollPresenter.ScrollCompleted OffsetsChangeCorrelationId={args.CorrelationId}");
00252         }
00253
00254         private void ScrollPresenter_ZoomCompleted(ScrollPresenter sender, ScrollingZoomCompletedEventArgs args)
00255         {
00256             AppendAsyncEventMessage($"ScrollPresenter.ZoomCompleted ZoomFactorChangeCorrelationId={args.CorrelationId}");
00257         }
00258
00259         private void ScrollPresenter_BringingIntoView(ScrollPresenter sender, ScrollingBringingIntoViewEventArgs args)
00260         {
00261             string asyncEventMessage = "BringingIntoView ScrollPresenter=" + sender.Name;
00262             asyncEventMessage += ", TargetHorizontalOffset=" + args.TargetHorizontalOffset + ", TargetVerticalOffset=" + args.TargetVerticalOffset;
00263             asyncEventMessage += ", OffsetsChangeCorrelationId=" + args.CorrelationId;
00264             asyncEventMessage += ", SnapPointsMode=" + args.SnapPointsMode;
00265             asyncEventMessage += ", RequestEventArgs.AnimationDesired=" + args.RequestEventArgs.AnimationDesired + ", RequestEventArgs.Handled=" + args.RequestEventArgs.Handled;
00266             asyncEventMessage += ", RequestEventArgs.HorizontalAlignmentRatio=" + args.RequestEventArgs.HorizontalAlignmentRatio + ", RequestEventArgs.VerticalAlignmentRatio=" + args.RequestEventArgs.VerticalAlignmentRatio;
00267             asyncEventMessage += ", RequestEventArgs.HorizontalOffset=" + args.RequestEventArgs.HorizontalOffset + ", RequestEventArgs.VerticalOffset=" + args.RequestEventArgs.VerticalOffset;
00268             asyncEventMessage += ", RequestEventArgs.TargetRect=" + args.RequestEventArgs.TargetRect + ", RequestEventArgs.TargetElement=" + (args.RequestEventArgs.TargetElement as FrameworkElement).Name;
00269             asyncEventMessage += ", OriginalSource=";
00270             if (args.RequestEventArgs.OriginalSource == null)
00271                 asyncEventMessage += "null";
00272             else
00273                 asyncEventMessage += (args.RequestEventArgs.OriginalSource as FrameworkElement).Name;
00274             AppendAsyncEventMessage(asyncEventMessage);
00275
00276             if (chkCancelOperationInBringingIntoView.IsChecked == true)
00277             {
00278                 args.Cancel = true;
00279             }
00280         }
00281
00282         private void ScrollView_ExtentChanged(ScrollView sender, object args)
00283         {
00284             AppendAsyncEventMessage($"ScrollView.ExtentChanged ExtentWidth={sender.ExtentWidth}, ExtentHeight={sender.ExtentHeight}");
00285         }
00286
00287         private void ScrollView_StateChanged(ScrollView sender, object args)
00288         {
00289             AppendAsyncEventMessage($"ScrollView.StateChanged {sender.State.ToString()}");
00290         }
00291
00292         private void ScrollView_ViewChanged(ScrollView sender, object args)
00293         {
00294             AppendAsyncEventMessage($"ScrollView.ViewChanged HorizontalOffset={sender.HorizontalOffset.ToString()}, VerticalOffset={sender.VerticalOffset}, ZoomFactor={sender.ZoomFactor}");
00295         }
00296
00297         private void ScrollView_ScrollAnimationStarting(ScrollView sender, ScrollingScrollAnimationStartingEventArgs args)
00298         {
00299             AppendAsyncEventMessage($"ScrollView.ScrollAnimationStarting OffsetsChangeCorrelationId={args.CorrelationId}");
00300         }
00301
00302         private void ScrollView_ZoomAnimationStarting(ScrollView sender, ScrollingZoomAnimationStartingEventArgs args)
00303         {
00304             AppendAsyncEventMessage($"ScrollView.ZoomAnimationStarting ZoomFactorChangeCorrelationId={args.CorrelationId}, CenterPoint={args.CenterPoint}");
00305         }
00306
00307         private void ScrollView_ScrollCompleted(ScrollView sender, ScrollingScrollCompletedEventArgs args)
00308         {
00309             AppendAsyncEventMessage($"ScrollView.ScrollCompleted OffsetsChangeCorrelationId={args.CorrelationId}");
00310         }
00311
00312         private void ScrollView_ZoomCompleted(ScrollView sender, ScrollingZoomCompletedEventArgs args)
00313         {
00314             AppendAsyncEventMessage($"ScrollView.ZoomCompleted ZoomFactorChangeCorrelationId={args.CorrelationId}");
00315         }
00316
00317         private void ScrollView_BringingIntoView(ScrollView sender, ScrollingBringingIntoViewEventArgs args)
00318         {
00319             string asyncEventMessage = "BringingIntoView ScrollPresenter=" + sender.Name;
00320             asyncEventMessage += ", TargetHorizontalOffset=" + args.TargetHorizontalOffset + ", TargetVerticalOffset=" + args.TargetVerticalOffset;
00321             asyncEventMessage += ", OffsetsChangeCorrelationId=" + args.CorrelationId;
00322             asyncEventMessage += ", SnapPointsMode=" + args.SnapPointsMode;
00323             asyncEventMessage += ", RequestEventArgs.AnimationDesired=" + args.RequestEventArgs.AnimationDesired + ", RequestEventArgs.Handled=" + args.RequestEventArgs.Handled;
00324             asyncEventMessage += ", RequestEventArgs.HorizontalAlignmentRatio=" + args.RequestEventArgs.HorizontalAlignmentRatio + ", RequestEventArgs.VerticalAlignmentRatio=" + args.RequestEventArgs.VerticalAlignmentRatio;
00325             asyncEventMessage += ", RequestEventArgs.HorizontalOffset=" + args.RequestEventArgs.HorizontalOffset + ", RequestEventArgs.VerticalOffset=" + args.RequestEventArgs.VerticalOffset;
00326             asyncEventMessage += ", RequestEventArgs.TargetRect=" + args.RequestEventArgs.TargetRect + ", RequestEventArgs.TargetElement=" + (args.RequestEventArgs.TargetElement as FrameworkElement).Name;
00327             asyncEventMessage += ", OriginalSource=";
00328             if (args.RequestEventArgs.OriginalSource == null)
00329                 asyncEventMessage += "null";
00330             else
00331                 asyncEventMessage += (args.RequestEventArgs.OriginalSource as FrameworkElement).Name;
00332             AppendAsyncEventMessage(asyncEventMessage);
00333
00334             if (chkCancelOperationInBringingIntoView.IsChecked == true)
00335             {
00336                 args.Cancel = true;
00337             }
00338         }
00339
00340         private void LogScrollPresenterInfo()
00341         {
00342             ScrollPresenter scrollPresenter = scrollView.ScrollPresenter;
00343
00344             AppendAsyncEventMessage($"ScrollPresenter Info: HorizontalOffset={scrollPresenter.HorizontalOffset}, VerticalOffset={scrollPresenter.VerticalOffset}, ZoomFactor={scrollPresenter.ZoomFactor}");
00345             AppendAsyncEventMessage($"ScrollPresenter Info: ViewportWidth={scrollPresenter.ViewportWidth}, ExtentHeight={scrollPresenter.ViewportHeight}");
00346             AppendAsyncEventMessage($"ScrollPresenter Info: ExtentWidth={scrollPresenter.ExtentWidth}, ExtentHeight={scrollPresenter.ExtentHeight}");
00347             AppendAsyncEventMessage($"ScrollPresenter Info: ScrollableWidth={scrollPresenter.ScrollableWidth}, ScrollableHeight={scrollPresenter.ScrollableHeight}");
00348         }
00349
00350         private void LogScrollViewInfo()
00351         {
00352             AppendAsyncEventMessage($"ScrollView Info: HorizontalOffset={scrollView.HorizontalOffset}, VerticalOffset={scrollView.VerticalOffset}, ZoomFactor={scrollView.ZoomFactor}");
00353             AppendAsyncEventMessage($"ScrollView Info: ViewportWidth={scrollView.ViewportWidth}, ExtentHeight={scrollView.ViewportHeight}");
00354             AppendAsyncEventMessage($"ScrollView Info: ExtentWidth={scrollView.ExtentWidth}, ExtentHeight={scrollView.ExtentHeight}");
00355             AppendAsyncEventMessage($"ScrollView Info: ScrollableWidth={scrollView.ScrollableWidth}, ScrollableHeight={scrollView.ScrollableHeight}");
00356         }
00357
00358         private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
00359         {
00360             lstLogs.Items.Clear();
00361         }
00362
00363         private void FrameworkElement_BringIntoViewRequested(UIElement sender, BringIntoViewRequestedEventArgs args)
00364         {
00365             string asyncEventMessage = "BringIntoViewRequested Sender=" + (sender as FrameworkElement).Name;
00366             asyncEventMessage += ", AnimationDesired=" + args.AnimationDesired + ", Handled=" + args.Handled;
00367             asyncEventMessage += ", HorizontalAlignmentRatio=" + args.HorizontalAlignmentRatio + ", VerticalAlignmentRatio=" + args.VerticalAlignmentRatio;
00368             asyncEventMessage += ", HorizontalOffset=" + args.HorizontalOffset + ", VerticalOffset=" + args.VerticalOffset;
00369             asyncEventMessage += ", TargetRect=" + args.TargetRect + ", TargetElement=" + (args.TargetElement as FrameworkElement).Name;
00370             asyncEventMessage += ", OriginalSource=";
00371             if (args.OriginalSource == null)
00372                 asyncEventMessage += "null";
00373             else
00374                 asyncEventMessage += (args.OriginalSource as FrameworkElement).Name;
00375             AppendAsyncEventMessage(asyncEventMessage);
00376         }
00377
00378         private void ChkLogScrollPresenterEvents_Checked(object sender, RoutedEventArgs e)
00379         {
00380             if (scrollView != null)
00381             {
00382                 ScrollPresenter scrollPresenter = scrollView.ScrollPresenter;
00383
00384                 if (scrollPresenter != null)
00385                 {
00386                     scrollPresenter.Loaded += ScrollPresenter_Loaded;
00387                     scrollPresenter.SizeChanged += ScrollPresenter_SizeChanged;
00388                     scrollPresenter.ExtentChanged += ScrollPresenter_ExtentChanged;
00389                     scrollPresenter.StateChanged += ScrollPresenter_StateChanged;
00390                     scrollPresenter.ViewChanged += ScrollPresenter_ViewChanged;
00391                     scrollPresenter.ScrollAnimationStarting += ScrollPresenter_ScrollAnimationStarting;
00392                     scrollPresenter.ZoomAnimationStarting += ScrollPresenter_ZoomAnimationStarting;
00393                     scrollPresenter.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00394                     scrollPresenter.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00395                     scrollPresenter.BringingIntoView += ScrollPresenter_BringingIntoView;
00396                     scrollPresenter.BringIntoViewRequested += FrameworkElement_BringIntoViewRequested;
00397                 }
00398             }
00399         }
00400
00401         private void ChkLogScrollPresenterEvents_Unchecked(object sender, RoutedEventArgs e)
00402         {
00403             if (scrollView != null)
00404             {
00405                 ScrollPresenter scrollPresenter = scrollView.ScrollPresenter;
00406
00407                 if (scrollPresenter != null)
00408                 {
00409                     scrollPresenter.Loaded -= ScrollPresenter_Loaded;
00410                     scrollPresenter.SizeChanged -= ScrollPresenter_SizeChanged;
00411                     scrollPresenter.ExtentChanged -= ScrollPresenter_ExtentChanged;
00412                     scrollPresenter.StateChanged -= ScrollPresenter_StateChanged;
00413                     scrollPresenter.ViewChanged -= ScrollPresenter_ViewChanged;
00414                     scrollPresenter.ScrollAnimationStarting -= ScrollPresenter_ScrollAnimationStarting;
00415                     scrollPresenter.ZoomAnimationStarting -= ScrollPresenter_ZoomAnimationStarting;
00416                     scrollPresenter.ScrollCompleted -= ScrollPresenter_ScrollCompleted;
00417                     scrollPresenter.ZoomCompleted -= ScrollPresenter_ZoomCompleted;
00418                     scrollPresenter.BringingIntoView -= ScrollPresenter_BringingIntoView;
00419                     scrollPresenter.BringIntoViewRequested -= FrameworkElement_BringIntoViewRequested;
00420                 }
00421             }
00422         }
00423
00424         private void ChkLogScrollViewEvents_Checked(object sender, RoutedEventArgs e)
00425         {
00426             if (scrollView != null)
00427             {
00428                 scrollView.GettingFocus += ScrollView_GettingFocus;
00429                 scrollView.GotFocus += ScrollView_GotFocus;
00430                 scrollView.LosingFocus += ScrollView_LosingFocus;
00431                 scrollView.LostFocus += ScrollView_LostFocus;
00432                 scrollView.Loaded += ScrollView_Loaded;
00433                 scrollView.SizeChanged += ScrollView_SizeChanged;
00434                 scrollView.ExtentChanged += ScrollView_ExtentChanged;
00435                 scrollView.StateChanged += ScrollView_StateChanged;
00436                 scrollView.ViewChanged += ScrollView_ViewChanged;
00437                 scrollView.ScrollAnimationStarting += ScrollView_ScrollAnimationStarting;
00438                 scrollView.ZoomAnimationStarting += ScrollView_ZoomAnimationStarting;
00439                 scrollView.ScrollCompleted += ScrollView_ScrollCompleted;
00440                 scrollView.ZoomCompleted += ScrollView_ZoomCompleted;
00441                 scrollView.BringingIntoView += ScrollView_BringingIntoView;
00442                 scrollView.BringIntoViewRequested += FrameworkElement_BringIntoViewRequested;
00443             }
00444         }
00445
00446         private void ChkLogScrollViewEvents_Unchecked(object sender, RoutedEventArgs e)
00447         {
00448             if (scrollView != null)
00449             {
00450                 scrollView.GettingFocus -= ScrollView_GettingFocus;
00451                 scrollView.GotFocus -= ScrollView_GotFocus;
00452                 scrollView.LosingFocus -= ScrollView_LosingFocus;
00453                 scrollView.LostFocus -= ScrollView_LostFocus;
00454                 scrollView.Loaded -= ScrollView_Loaded;
00455                 scrollView.SizeChanged -= ScrollView_SizeChanged;
00456                 scrollView.ExtentChanged -= ScrollView_ExtentChanged;
00457                 scrollView.StateChanged -= ScrollView_StateChanged;
00458                 scrollView.ViewChanged -= ScrollView_ViewChanged;
00459                 scrollView.ScrollAnimationStarting -= ScrollView_ScrollAnimationStarting;
00460                 scrollView.ZoomAnimationStarting -= ScrollView_ZoomAnimationStarting;
00461                 scrollView.ScrollCompleted -= ScrollView_ScrollCompleted;
00462                 scrollView.ZoomCompleted -= ScrollView_ZoomCompleted;
00463                 scrollView.BringingIntoView -= ScrollView_BringingIntoView;
00464                 scrollView.BringIntoViewRequested -= FrameworkElement_BringIntoViewRequested;
00465             }
00466         }
00467
00468         private void ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e)
00469         {
00470             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00471             if (chkLogScrollViewMessages.IsChecked == false)
00472                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00473         }
00474
00475         private void ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e)
00476         {
00477             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00478             if (chkLogScrollViewMessages.IsChecked == false)
00479                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00480         }
00481
00482         private void ChkLogScrollViewMessages_Checked(object sender, RoutedEventArgs e)
00483         {
00484             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00485             if (chkLogScrollPresenterMessages.IsChecked == false)
00486                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00487         }
00488
00489         private void ChkLogScrollViewMessages_Unchecked(object sender, RoutedEventArgs e)
00490         {
00491             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00492             if (chkLogScrollPresenterMessages.IsChecked == false)
00493                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00494         }
00495
00496         private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
00497         {
00498             // Cut off the terminating new line.
00499             string msg = args.Message.Substring(0, args.Message.Length - 1);
00500             string asyncEventMessage;
00501             string senderName = string.Empty;
00502
00503             try
00504             {
00505                 FrameworkElement fe = sender as FrameworkElement;
00506
00507                 if (fe != null)
00508                 {
00509                     senderName = "s:" + fe.Name + ", ";
00510                 }
00511             }
00512             catch
00513             {
00514             }
00515
00516             if (args.IsVerboseLevel)
00517             {
00518                 asyncEventMessage = "Verbose: " + senderName + "m:" + msg;
00519             }
00520             else
00521             {
00522                 asyncEventMessage = "Info: " + senderName + "m:" + msg;
00523             }
00524
00525             AppendAsyncEventMessage(asyncEventMessage);
00526         }
00527
00528         private void AppendAsyncEventMessage(string asyncEventMessage)
00529         {
00530             lock (asyncEventReportingLock)
00531             {
00532                 while (asyncEventMessage.Length > 0)
00533                 {
00534                     string msgHead = asyncEventMessage;
00535
00536                     if (asyncEventMessage.Length > 110)
00537                     {
00538                         int commaIndex = asyncEventMessage.IndexOf(',', 110);
00539                         if (commaIndex != -1)
00540                         {
00541                             msgHead = asyncEventMessage.Substring(0, commaIndex);
00542                             asyncEventMessage = asyncEventMessage.Substring(commaIndex + 1);
00543                         }
00544                         else
00545                         {
00546                             asyncEventMessage = string.Empty;
00547                         }
00548                     }
00549                     else
00550                     {
00551                         asyncEventMessage = string.Empty;
00552                     }
00553
00554                     lstAsyncEventMessage.Add(msgHead);
00555                 }
00556                 var ignored = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, AppendAsyncEventMessage);
00557
00558             }
00559         }
00560
00561         private void AppendAsyncEventMessage()
00562         {
00563             lock (asyncEventReportingLock)
00564             {
00565                 foreach (string asyncEventMessage in lstAsyncEventMessage)
00566                 {
00567                     lstLogs.Items.Add(asyncEventMessage);
00568                 }
00569                 lstAsyncEventMessage.Clear();
00570             }
00571         }
00572
00573         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00574         {
00575             txtExceptionReport.Text = string.Empty;
00576         }
00577     }
00578 }
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollingScrollAnimationStartingEventArgs.h Source File

  • ScrollPresenter

ScrollingScrollAnimationStartingEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ScrollPresenterTrace.h"
00007 #include "ScrollingScrollAnimationStartingEventArgs.g.h"
00008
00009 class ScrollingScrollAnimationStartingEventArgs :
00010     public winrt::implementation::ScrollingScrollAnimationStartingEventArgsT<ScrollingScrollAnimationStartingEventArgs>
00011 {
00012 public:
00013     ScrollingScrollAnimationStartingEventArgs()
00014     {
00015         SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00016     }
00017
00018     ~ScrollingScrollAnimationStartingEventArgs()
00019     {
00020         SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00021     }
00022
00023     // IScrollingScrollAnimationStartingEventArgs overrides
00024     winrt::CompositionAnimation Animation();
00025     void Animation(winrt::CompositionAnimation const& value);
00026     int32_t CorrelationId();
00027     winrt::float2 StartPosition();
00028     winrt::float2 EndPosition();
00029
00030     void SetOffsetsChangeCorrelationId(int32_t offsetsChangeCorrelationId);
00031     winrt::CompositionAnimation GetAnimation() const;
00032     void SetAnimation(const winrt::CompositionAnimation& animation);
00033     void SetStartPosition(const winrt::float2& startPosition);
00034     void SetEndPosition(const winrt::float2& endPosition);
00035
00036 private:
00037     winrt::CompositionAnimation m_animation{ nullptr };
00038     int32_t m_offsetsChangeCorrelationId{ -1 };
00039     winrt::float2 m_startPosition{ 0.0f, 0.0f };
00040     winrt::float2 m_endPosition{ 0.0f, 0.0f };
00041 };
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarCustomPen.properties.cpp Source File

  • Generated

InkToolBarCustomPen.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InkToolBarCustomPen.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(InkToolBarCustomPen)
00012 }
00013
00014 #include "InkToolBarCustomPen.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorSourceEffect Member List

This is the complete list of members for ColorSourceEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1Flood) | ColorSourceEffect |
DECLARE_NAMED_PROPERTY_MAPPING({L"Color", D2D1_FLOOD_PROP_COLOR, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4}) | ColorSourceEffect |
DECLARE_POD_PROPERTY(Color, UIColor,(UIColor{255, 0, 0, 0}), true) | ColorSourceEffect |
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | ColorSourceEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | ColorSourceEffect | [inline]
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/OffsetsChangeWithAdditionalVelocity.cpp Source File

  • ScrollPresenter

OffsetsChangeWithAdditionalVelocity.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "OffsetsChangeWithAdditionalVelocity.h"
00009
00010 OffsetsChangeWithAdditionalVelocity::OffsetsChangeWithAdditionalVelocity(
00011     winrt::float2 offsetsVelocity,
00012     winrt::float2 anticipatedOffsetsChange,
00013     winrt::IReference<winrt::float2> inertiaDecayRate) :
00014         m_offsetsVelocity(offsetsVelocity),
00015         m_anticipatedOffsetsChange(anticipatedOffsetsChange),
00016         m_inertiaDecayRate(inertiaDecayRate)
00017 {
00018     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR_STR_STR, METH_NAME, this,
00019         TypeLogging::Float2ToString(offsetsVelocity).c_str(),
00020         TypeLogging::Float2ToString(anticipatedOffsetsChange).c_str(),
00021         TypeLogging::NullableFloat2ToString(inertiaDecayRate).c_str());
00022 }
00023
00024 OffsetsChangeWithAdditionalVelocity::~OffsetsChangeWithAdditionalVelocity()
00025 {
00026     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00027 }
00028
00029 void OffsetsChangeWithAdditionalVelocity::OffsetsVelocity(winrt::float2 const& offsetsVelocity)
00030 {
00031     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::Float2ToString(offsetsVelocity).c_str());
00032
00033     m_offsetsVelocity = offsetsVelocity;
00034 }
00035
00036 void OffsetsChangeWithAdditionalVelocity::AnticipatedOffsetsChange(winrt::float2 const& anticipatedOffsetsChange)
00037 {
00038     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::Float2ToString(anticipatedOffsetsChange).c_str());
00039
00040     m_anticipatedOffsetsChange = anticipatedOffsetsChange;
00041 }
00042
00043 void OffsetsChangeWithAdditionalVelocity::InertiaDecayRate(winrt::IReference<winrt::float2> const& inertiaDecayRate)
00044 {
00045     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::NullableFloat2ToString(inertiaDecayRate).c_str());
00046
00047     m_inertiaDecayRate = inertiaDecayRate;
00048 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ProgressBarTemplateSettings Member List

This is the complete list of members for ProgressBarTemplateSettings, including all inherited members.
ClearProperties() | ProgressBarTemplateSettingsProperties | [static]
ClipRect(winrt::RectangleGeometry const &value) | ProgressBarTemplateSettingsProperties |
ClipRect() | ProgressBarTemplateSettingsProperties |
ClipRectProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
Container2AnimationEndPosition(double value) | ProgressBarTemplateSettingsProperties |
Container2AnimationEndPosition() | ProgressBarTemplateSettingsProperties |
Container2AnimationEndPositionProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
Container2AnimationStartPosition(double value) | ProgressBarTemplateSettingsProperties |
Container2AnimationStartPosition() | ProgressBarTemplateSettingsProperties |
Container2AnimationStartPositionProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
ContainerAnimationEndPosition(double value) | ProgressBarTemplateSettingsProperties |
ContainerAnimationEndPosition() | ProgressBarTemplateSettingsProperties |
ContainerAnimationEndPositionProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
ContainerAnimationMidPosition(double value) | ProgressBarTemplateSettingsProperties |
ContainerAnimationMidPosition() | ProgressBarTemplateSettingsProperties |
ContainerAnimationMidPositionProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
ContainerAnimationStartPosition(double value) | ProgressBarTemplateSettingsProperties |
ContainerAnimationStartPosition() | ProgressBarTemplateSettingsProperties |
ContainerAnimationStartPositionProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
EllipseAnimationEndPosition(double value) | ProgressBarTemplateSettingsProperties |
EllipseAnimationEndPosition() | ProgressBarTemplateSettingsProperties |
EllipseAnimationEndPositionProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
EllipseAnimationWellPosition(double value) | ProgressBarTemplateSettingsProperties |
EllipseAnimationWellPosition() | ProgressBarTemplateSettingsProperties |
EllipseAnimationWellPositionProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
EllipseDiameter(double value) | ProgressBarTemplateSettingsProperties |
EllipseDiameter() | ProgressBarTemplateSettingsProperties |
EllipseDiameterProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
EllipseOffset(double value) | ProgressBarTemplateSettingsProperties |
EllipseOffset() | ProgressBarTemplateSettingsProperties |
EllipseOffsetProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
EnsureProperties() | ProgressBarTemplateSettingsProperties | [static]
IndicatorLengthDelta(double value) | ProgressBarTemplateSettingsProperties |
IndicatorLengthDelta() | ProgressBarTemplateSettingsProperties |
IndicatorLengthDeltaProperty() | ProgressBarTemplateSettingsProperties | [inline, static]
ProgressBarTemplateSettings() | ProgressBarTemplateSettings |
ProgressBarTemplateSettingsProperties() | ProgressBarTemplateSettingsProperties |
s_ClipRectProperty | ProgressBarTemplateSettingsProperties | [static]
s_Container2AnimationEndPositionProperty | ProgressBarTemplateSettingsProperties | [static]
s_Container2AnimationStartPositionProperty | ProgressBarTemplateSettingsProperties | [static]
s_ContainerAnimationEndPositionProperty | ProgressBarTemplateSettingsProperties | [static]
s_ContainerAnimationMidPositionProperty | ProgressBarTemplateSettingsProperties | [static]
s_ContainerAnimationStartPositionProperty | ProgressBarTemplateSettingsProperties | [static]
s_EllipseAnimationEndPositionProperty | ProgressBarTemplateSettingsProperties | [static]
s_EllipseAnimationWellPositionProperty | ProgressBarTemplateSettingsProperties | [static]
s_EllipseDiameterProperty | ProgressBarTemplateSettingsProperties | [static]
s_EllipseOffsetProperty | ProgressBarTemplateSettingsProperties | [static]
s_IndicatorLengthDeltaProperty | ProgressBarTemplateSettingsProperties | [static]
Generated on Sun Dec 1 2024 20:53:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/TestUI/ScrollPresenterLeakDetectionPage.xaml.cs Source File

  • ScrollPresenter
  • TestUI

ScrollPresenterLeakDetectionPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Windows.UI;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Shapes;
00010
00011 using ScrollPresenter = Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter;
00012
00013 namespace MUXControlsTestApp
00014 {
00015     public sealed partial class ScrollPresenterLeakDetectionPage : TestPage
00016     {
00017         private ScrollPresenter scrollPresenter = null;
00018
00019         public ScrollPresenterLeakDetectionPage()
00020         {
00021             this.InitializeComponent();
00022         }
00023
00024         private void BtnCreateScrollPresenter_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
00025         {
00026             scrollPresenter = new ScrollPresenter();
00027             scrollPresenter.Name = "dynamicScrollPresenter";
00028             scrollPresenter.Width = 300.0;
00029             scrollPresenter.Height = 400.0;
00030             scrollPresenter.Margin = new Thickness(1);
00031             scrollPresenter.Background = new SolidColorBrush(Microsoft.UI.Colors.HotPink);
00032             scrollPresenter.VerticalAlignment = VerticalAlignment.Top;
00033
00034             Rectangle rect = new Rectangle();
00035             rect.Width = 900.0;
00036             rect.Height = 1200.0;
00037             rect.Fill = new SolidColorBrush(Microsoft.UI.Colors.DarkRed);
00038             scrollPresenter.Content = rect;
00039
00040             btnCreateScrollPresenter.IsEnabled = false;
00041             btnAddScrollPresenter.IsEnabled = true;
00042             btnDeleteScrollPresenter.IsEnabled = true;
00043         }
00044
00045         private void BtnAddScrollPresenter_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
00046         {
00047             Grid.SetRow(scrollPresenter, 5);
00048             grid.Children.Add(scrollPresenter);
00049
00050             btnAddScrollPresenter.IsEnabled = false;
00051             btnDeleteScrollPresenter.IsEnabled = false;
00052             btnRemoveScrollPresenter.IsEnabled = true;
00053         }
00054
00055         private void BtnRemoveScrollPresenter_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
00056         {
00057             grid.Children.Remove(scrollPresenter);
00058
00059             btnRemoveScrollPresenter.IsEnabled = false;
00060             btnAddScrollPresenter.IsEnabled = true;
00061             btnDeleteScrollPresenter.IsEnabled = true;
00062         }
00063
00064         private void BtnDeleteScrollPresenter_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
00065         {
00066             if (scrollPresenter == null || grid.Children.Count == 6)
00067                 return;
00068
00069             scrollPresenter.Content = null;
00070             scrollPresenter = null;
00071
00072             btnDeleteScrollPresenter.IsEnabled = false;
00073             btnAddScrollPresenter.IsEnabled = false;
00074             btnCreateScrollPresenter.IsEnabled = true;
00075         }
00076
00077         private void BtnGarbageCollect_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
00078         {
00079             System.GC.Collect();
00080             System.GC.WaitForPendingFinalizers();
00081         }
00082     }
00083 }
Generated on Sun Dec 1 2024 20:52:16 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ExpanderTemplateSettings.properties.h Source File

  • Generated

ExpanderTemplateSettings.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class ExpanderTemplateSettingsProperties
00008 {
00009 public:
00010     ExpanderTemplateSettingsProperties();
00011
00012     void ContentHeight(double value);
00013     double ContentHeight();
00014
00015     void NegativeContentHeight(double value);
00016     double NegativeContentHeight();
00017
00018     static winrt::DependencyProperty ContentHeightProperty() { return s_ContentHeightProperty; }
00019     static winrt::DependencyProperty NegativeContentHeightProperty() { return s_NegativeContentHeightProperty; }
00020
00021     static GlobalDependencyProperty s_ContentHeightProperty;
00022     static GlobalDependencyProperty s_NegativeContentHeightProperty;
00023
00024     static void EnsureProperties();
00025     static void ClearProperties();
00026 };
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewDragItemsCompletedEventArgs.h Source File

  • TreeView

TreeViewDragItemsCompletedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "TreeViewDragItemsCompletedEventArgs.g.h"
00006
00007 using winrt::Windows::ApplicationModel::DataTransfer::DataPackageOperation;
00008
00009 class TreeViewDragItemsCompletedEventArgs :
00010     public ReferenceTracker<TreeViewDragItemsCompletedEventArgs, winrt::implementation::TreeViewDragItemsCompletedEventArgsT, winrt::composing, winrt::composable>
00011 {
00012 public:
00013     TreeViewDragItemsCompletedEventArgs(const winrt::DragItemsCompletedEventArgs& args, const winrt::IInspectable& newParent);
00014     DataPackageOperation DropResult() const;
00015     winrt::IVectorView<winrt::IInspectable> Items();
00016     winrt::IInspectable NewParentItem();
00017
00018 private:
00019     winrt::DragItemsCompletedEventArgs m_dragItemsCompletedEventArgs{ nullptr };
00020     winrt::IInspectable m_newParentItem;
00021 };
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarPenButton Member List

This is the complete list of members for InkToolBarPenButton, including all inherited members.
ClearProperties() | InkToolBarPenButtonProperties | [static]
EnsureProperties() | InkToolBarPenButtonProperties | [static]
InkToolBarPenButtonProperties() | InkToolBarPenButtonProperties |
MaxStrokeWidth() | InkToolBarPenButton | [inline]
MaxStrokeWidth(double value) | InkToolBarPenButton | [inline]
MaxStrokeWidthProperty() | InkToolBarPenButtonProperties | [inline, static]
MinStrokeWidth() | InkToolBarPenButton | [inline]
MinStrokeWidth(double value) | InkToolBarPenButton | [inline]
MinStrokeWidthProperty() | InkToolBarPenButtonProperties | [inline, static]
Palette() | InkToolBarPenButton | [inline]
Palette(winrt::IVector< winrt::Brush > value) | InkToolBarPenButton | [inline]
InkToolBarPenButtonProperties::Palette(winrt::IVector< winrt::Brush > const &value) | InkToolBarPenButtonProperties |
PaletteProperty() | InkToolBarPenButtonProperties | [inline, static]
s_MaxStrokeWidthProperty | InkToolBarPenButtonProperties | [static]
s_MinStrokeWidthProperty | InkToolBarPenButtonProperties | [static]
s_PaletteProperty | InkToolBarPenButtonProperties | [static]
s_SelectedBrushIndexProperty | InkToolBarPenButtonProperties | [static]
s_SelectedBrushProperty | InkToolBarPenButtonProperties | [static]
s_SelectedStrokeWidthProperty | InkToolBarPenButtonProperties | [static]
SelectedBrush() | InkToolBarPenButton | [inline]
InkToolBarPenButtonProperties::SelectedBrush(winrt::Brush const &value) | InkToolBarPenButtonProperties |
SelectedBrushIndex() | InkToolBarPenButton | [inline]
SelectedBrushIndex(int32_t value) | InkToolBarPenButton | [inline]
InkToolBarPenButtonProperties::SelectedBrushIndex(int value) | InkToolBarPenButtonProperties |
SelectedBrushIndexProperty() | InkToolBarPenButtonProperties | [inline, static]
SelectedBrushProperty() | InkToolBarPenButtonProperties | [inline, static]
SelectedStrokeWidth() | InkToolBarPenButton | [inline]
SelectedStrokeWidth(double value) | InkToolBarPenButton | [inline]
SelectedStrokeWidthProperty() | InkToolBarPenButtonProperties | [inline, static]
Generated on Sun Dec 1 2024 20:52:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SwipeControl Member List

This is the complete list of members for SwipeControl, including all inherited members.
abi_enter() | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
AlignStackPanel() | SwipeControl | [private]
AttachDismissingHandlers() | SwipeControl | [private]
AttachEventHandlers() | SwipeControl | [private]
blockFarContentPropertyName() | SwipeControl | [inline, private, static]
blockNearContentPropertyName() | SwipeControl | [inline, private, static]
BottomItems(winrt::SwipeItems const &value) | SwipeControlProperties |
BottomItems() | SwipeControlProperties |
BottomItemsProperty() | SwipeControlProperties | [inline, static]
CheckThread() | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
ClearProperties() | SwipeControlProperties | [static]
Close() | SwipeControl |
CloseIfNotRemainOpenExecuteItem() | SwipeControl | [private]
CloseWithoutAnimation() | SwipeControl | [private]
ConfigurePositionInertiaRestingValues() | SwipeControl | [private]
CreateBottomContent() | SwipeControl | [private]
CreateContent(const winrt::SwipeItems &items) | SwipeControl | [private]
CreateLeftContent() | SwipeControl | [private]
CreateRightContent() | SwipeControl | [private]
CreateTopContent() | SwipeControl | [private]
CurrentXamlRootChanged(const winrt::XamlRoot &sender, const winrt::XamlRootChangedEventArgs &args) | SwipeControl | [private]
CustomAnimationStateEntered(winrt::InteractionTrackerCustomAnimationStateEnteredArgs const &args) | SwipeControl |
DeleteInstanceOnUIThread(std::unique_ptr< SwipeControl > &&self) noexcept | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline, static]
DetachDismissingHandlers() | SwipeControl | [private]
DetachEventHandlers(bool useSafeGet) | SwipeControl | [private]
DirectionToInset(const CreatedContent &createdContent) | SwipeControl | [private, static]
DismissSwipeOnAcceleratorKeyActivator(const winrt::Windows::UI::Core::CoreDispatcher &sender, const winrt::AcceleratorKeyEventArgs &args) | SwipeControl | [private]
DismissSwipeOnAnExternalTap(winrt::Point const &tapPoint) | SwipeControl | [private]
EnsureClip() | SwipeControl | [private]
EnsureProperties() | SwipeControlProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
final_release(std::unique_ptr< SwipeControl > &&self) | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline, static]
FindVisualInteractionSourceVisual() | SwipeControl | [private]
foregroundVisualPropertyName() | SwipeControl | [inline, private, static]
GetAnimationTarget(winrt::UIElement child) | SwipeControl | [private]
GetBase() | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
GetCurrentItems() | SwipeControl | [inline]
GetInner() | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
GetIsIdle() | SwipeControl |
GetIsOpen() | SwipeControl |
GetLastInteractedWithSwipeControl() | SwipeControl | [static]
GetSwipeItemButton(const winrt::SwipeItem &swipeItem) | SwipeControl | [private]
GetTemplateParts() | SwipeControl | [private]
GetThis() | SwipeControl | [private]
hasBottomContentPropertyName() | SwipeControl | [inline, private, static]
hasLeftContentPropertyName() | SwipeControl | [inline, private, static]
hasRightContentPropertyName() | SwipeControl | [inline, private, static]
hasTopContentPropertyName() | SwipeControl | [inline, private, static]
IdleStateEntered(winrt::InteractionTrackerIdleStateEnteredArgs const &args) | SwipeControl |
InertiaStateEntered(winrt::InteractionTrackerInertiaStateEnteredArgs const &args) | SwipeControl |
InitializeInteractionTracker() | SwipeControl | [private]
InputEaterGridTapped(const winrt::IInspectable &, const winrt::TappedRoutedEventArgs &args) | SwipeControl | [private]
InteractingStateEntered(winrt::InteractionTrackerInteractingStateEnteredArgs const &args) | SwipeControl |
isFarOpenPropertyName() | SwipeControl | [inline, private, static]
isHorizontalPropertyName() | SwipeControl | [inline, private, static]
isNearContentPropertyName() | SwipeControl | [inline, private, static]
isNearOpenPropertyName() | SwipeControl | [inline, private, static]
IsOnThread() | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
IsTranslationFacadeAvailableForSwipeControl(const winrt::UIElement &element) | SwipeControl | [private, static]
LeftItems(winrt::SwipeItems const &value) | SwipeControlProperties |
LeftItems() | SwipeControlProperties |
LeftItemsProperty() | SwipeControlProperties | [inline, static]
m_acceleratorKeyActivatedRevoker | SwipeControl | [private]
maxThresholdPropertyName() | SwipeControl | [inline, private, static]
MeasureOverride(winrt::Size const &availableSize) | SwipeControl |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
OnApplyTemplate() | SwipeControl |
OnBottomItemsChanged(const winrt::IObservableVector< winrt::SwipeItem > &sender, const winrt::IVectorChangedEventArgs args) | SwipeControl | [private]
OnBottomItemsCollectionChanged(const winrt::DependencyPropertyChangedEventArgs &) | SwipeControl | [private]
OnBottomItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SwipeControlProperties | [static]
OnLeftItemsChanged(const winrt::IObservableVector< winrt::SwipeItem > &sender, const winrt::IVectorChangedEventArgs args) | SwipeControl | [private]
OnLeftItemsCollectionChanged(const winrt::DependencyPropertyChangedEventArgs &) | SwipeControl | [private]
OnLeftItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SwipeControlProperties | [static]
OnLoaded(const winrt::IInspectable &, const winrt::RoutedEventArgs &) | SwipeControl | [private]
OnPointerPressedEvent(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | SwipeControl | [private]
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | SwipeControl |
OnRightItemsChanged(const winrt::IObservableVector< winrt::SwipeItem > &sender, const winrt::IVectorChangedEventArgs args) | SwipeControl | [private]
OnRightItemsCollectionChanged(const winrt::DependencyPropertyChangedEventArgs &) | SwipeControl | [private]
OnRightItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SwipeControlProperties | [static]
OnSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &args) | SwipeControl | [private]
OnSwipeContentStackPanelSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &args) | SwipeControl | [private]
OnTopItemsChanged(const winrt::IObservableVector< winrt::SwipeItem > &sender, const winrt::IVectorChangedEventArgs args) | SwipeControl | [private]
OnTopItemsCollectionChanged(const winrt::DependencyPropertyChangedEventArgs &) | SwipeControl | [private]
OnTopItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | SwipeControlProperties | [static]
PopulateContentItems() | SwipeControl | [private]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< SwipeControl, winrt::implementation::SwipeControlT > | [inline]
RequestIgnored(winrt::InteractionTrackerRequestIgnoredArgs const &args) | SwipeControl |
RightItems(winrt::SwipeItems const &value) | SwipeControlProperties |
RightItems() | SwipeControlProperties |
RightItemsProperty() | SwipeControlProperties | [inline, static]
s_BottomItemsProperty | SwipeControlProperties | [static]
s_LeftItemsProperty | SwipeControlProperties | [static]
s_RightItemsProperty | SwipeControlProperties | [static]
s_TopItemsProperty | SwipeControlProperties | [static]
SetupClipAnimation() | SwipeControl | [private]
SetupExecuteExpressionAnimation() | SwipeControl | [private]
swipeContentSizeParameterName() | SwipeControl | [inline, private, static]
swipeContentVisualPropertyName() | SwipeControl | [inline, private, static]
SwipeControl() | SwipeControl |
SwipeControlProperties() | SwipeControlProperties |
swipeRootVisualPropertyName() | SwipeControl | [inline, private, static]
ThrowIfHasVerticalAndHorizontalContent(bool IsHorizontal=false) | SwipeControl | [private]
TopItems(winrt::SwipeItems const &value) | SwipeControlProperties |
TopItems() | SwipeControlProperties |
TopItemsProperty() | SwipeControlProperties | [inline, static]
trackerPropertyName() | SwipeControl | [inline, private, static]
TryGetSwipeVisuals() | SwipeControl | [private]
UpdateColors() | SwipeControl | [private]
UpdateColorsIfExecuteItem() | SwipeControl | [private]
UpdateColorsIfRevealItems() | SwipeControl | [private]
UpdateExecuteBackgroundColor(const winrt::SwipeItem &swipeItem) | SwipeControl | [private]
UpdateExecuteForegroundColor(const winrt::SwipeItem &swipeItem) | SwipeControl | [private]
UpdateIsOpen(bool isOpen) | SwipeControl | [private]
UpdateThresholdReached(float value) | SwipeControl | [private]
ValuesChanged(winrt::InteractionTrackerValuesChangedArgs const &args) | SwipeControl |
~SwipeControl() | SwipeControl | [virtual]
Generated on Sun Dec 1 2024 20:53:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsViewTestsWithInputHelper::LoggingHelper Member List

This is the complete list of members for ItemsViewTestsWithInputHelper::LoggingHelper, including all inherited members.
Dispose() | ItemsViewTestsWithInputHelper::LoggingHelper | [inline]
LoggingHelper(ItemsViewTestsWithInputHelper owner, ICollection< string > componentTypes) | ItemsViewTestsWithInputHelper::LoggingHelper | [inline]
m_componentTypes | ItemsViewTestsWithInputHelper::LoggingHelper | [private]
m_owner | ItemsViewTestsWithInputHelper::LoggingHelper | [private]
SetLoggingLevel(bool set, ICollection< string > componentTypes) | ItemsViewTestsWithInputHelper::LoggingHelper | [inline, private]
Generated on Sun Dec 1 2024 20:53:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/SpectrumBrush.cpp Source File

  • ColorPicker

SpectrumBrush.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SpectrumBrush.h"
00007 #include "Vector.h"
00008
00009 void SpectrumBrush::OnConnected()
00010 {
00011     m_isConnected = true;
00012     UpdateSpectrumBrush();
00013 }
00014
00015 void SpectrumBrush::OnDisconnected()
00016 {
00017     m_isConnected = false;
00018
00019     if (m_brush)
00020     {
00021         m_brush.Close();
00022         m_brush = nullptr;
00023         CompositionBrush(nullptr);
00024     }
00025 }
00026
00027 void SpectrumBrush::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00028 {
00029     winrt::IDependencyProperty property = args.Property();
00030     winrt::Compositor compositor = winrt::CompositionTarget::GetCompositorForCurrentThread();
00031
00032     if (property == s_MinSurfaceProperty)
00033     {
00034         m_minSurfaceBrush = compositor.CreateSurfaceBrush(MinSurface());
00035         UpdateSpectrumBrush();
00036     }
00037     else if (property == s_MaxSurfaceProperty)
00038     {
00039         m_maxSurfaceBrush = compositor.CreateSurfaceBrush(MaxSurface());
00040         UpdateSpectrumBrush();
00041     }
00042     else if (property == s_MaxSurfaceOpacityProperty)
00043     {
00044         if (m_brushEffect)
00045         {
00046             m_brushEffect->Weight(static_cast<float>(MaxSurfaceOpacity()));
00047         }
00048     }
00049 }
00050
00051 void SpectrumBrush::CreateSpectrumBrush()
00052 {
00053     winrt::Compositor compositor = winrt::CompositionTarget::GetCompositorForCurrentThread();
00054
00055     m_brushEffect = winrt::make_self<Microsoft::UI::Private::Composition::Effects::CrossFadeEffect>();
00056     m_brushEffect->Source1(winrt::CompositionEffectSourceParameter{ L"MinSurface" });
00057     m_brushEffect->Source2(winrt::CompositionEffectSourceParameter{ L"MaxSurface" });
00058     m_brushEffect->Weight(static_cast<float>(MaxSurfaceOpacity()));
00059
00060     winrt::CompositionEffectFactory effectFactory = compositor.CreateEffectFactory(*m_brushEffect);
00061     m_brush = effectFactory.CreateBrush();
00062
00063     CompositionBrush(m_brush);
00064 }
00065
00066 void SpectrumBrush::UpdateSpectrumBrush()
00067 {
00068     if (m_isConnected)
00069     {
00070         if (!m_brush)
00071         {
00072             CreateSpectrumBrush();
00073         }
00074
00075         m_brush.SetSourceParameter(L"MinSurface", m_minSurfaceBrush);
00076         m_brush.SetSourceParameter(L"MaxSurface", m_maxSurfaceBrush);
00077     }
00078 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarCustomToolButton.properties.h Source File

  • Generated

InkToolBarCustomToolButton.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InkToolBarCustomToolButtonProperties
00008 {
00009 public:
00010     InkToolBarCustomToolButtonProperties();
00011
00012     void ConfigurationContent(winrt::UIElement const& value);
00013     winrt::UIElement ConfigurationContent();
00014
00015     static winrt::DependencyProperty ConfigurationContentProperty() { return s_ConfigurationContentProperty; }
00016
00017     static GlobalDependencyProperty s_ConfigurationContentProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PipsPagerTests Member List

This is the complete list of members for PipsPagerTests, including all inherited members.
VerifyAutomationPeerBehavior() | PipsPagerTests | [inline]
VerifyEmptyPagerDoesNotCrash() | PipsPagerTests | [inline]
VerifyPipsPagerButtonUIABehavior() | PipsPagerTests | [inline]
VerifySelectedIndexChangedEventArgs() | PipsPagerTests | [inline]
Generated on Sun Dec 1 2024 20:53:35 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/RepeatedZoomSnapPoint.h Source File

  • ScrollPresenter

RepeatedZoomSnapPoint.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SnapPoint.h"
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbBarItemClickedEventArgs.cpp Source File

  • Breadcrumb

BreadcrumbBarItemClickedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "BreadcrumbBarItemClickedEventArgs.h"
00007
00008 winrt::IInspectable BreadcrumbBarItemClickedEventArgs::Item()
00009 {
00010     return m_item;
00011 }
00012
00013 void BreadcrumbBarItemClickedEventArgs::Item(const winrt::IInspectable& item)
00014 {
00015     m_item = item;
00016 }
00017
00018 int BreadcrumbBarItemClickedEventArgs::Index()
00019 {
00020     return m_index;
00021 }
00022
00023 void BreadcrumbBarItemClickedEventArgs::Index(const int& index)
00024 {
00025     m_index = index;
00026 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectorBarTrace Member List

This is the complete list of members for SelectorBarTrace, including all inherited members.
s_IsDebugOutputEnabled | SelectorBarTrace | [static]
s_IsVerboseDebugOutputEnabled | SelectorBarTrace | [static]
TraceInfo(bool includeTraceLogging, const winrt::IInspectable &sender, PCWSTR message,...) noexcept | SelectorBarTrace | [inline, static]
TracePerfInfo(PCWSTR info) noexcept | SelectorBarTrace | [inline, static]
TraceVerbose(bool includeTraceLogging, const winrt::IInspectable &sender, PCWSTR message,...) noexcept | SelectorBarTrace | [inline, static]
Generated on Sun Dec 1 2024 20:53:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Layout Member List

This is the complete list of members for Layout, including all inherited members.
Arrange(winrt::LayoutContext const &context, winrt::Size const &finalSize) | Layout |
ArrangeInvalidated(winrt::TypedEventHandler< winrt::Layout, winrt::IInspectable > const &value) | Layout |
ArrangeInvalidated(winrt::event_token const &token) | Layout |
CreateDefaultItemTransitionProvider() | Layout | [inline, virtual]
GetForcedIndexBasedLayoutOrientation() | Layout |
IndexBasedLayoutOrientation() | Layout |
InitializeForContext(winrt::LayoutContext const &context) | Layout |
InvalidateArrange() | Layout |
InvalidateMeasure() | Layout |
LayoutId() | Layout |
LayoutId(winrt::hstring const &state) | Layout |
m_layoutId | Layout | [private]
Measure(winrt::LayoutContext const &context, winrt::Size const &availableSize) | Layout |
MeasureInvalidated(winrt::TypedEventHandler< winrt::Layout, winrt::IInspectable > const &value) | Layout |
MeasureInvalidated(winrt::event_token const &token) | Layout |
ResetForcedIndexBasedLayoutOrientation() | Layout |
SetForcedIndexBasedLayoutOrientation(winrt::IndexBasedLayoutOrientation forcedIndexBasedLayoutOrientation) | Layout |
SetIndexBasedLayoutOrientation(winrt::IndexBasedLayoutOrientation orientation) | Layout |
UninitializeForContext(winrt::LayoutContext const &context) | Layout |
Generated on Sun Dec 1 2024 20:52:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PersonPicture/PersonPicture.idl Source File

  • PersonPicture

PersonPicture.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00007 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00008 unsealed runtimeclass PersonPicture : Microsoft.UI.Xaml.Controls.Control
00009 {
00010     PersonPicture();
00011
00012     Int32 BadgeNumber { get; set; };
00013     String BadgeGlyph { get; set; };
00014     Microsoft.UI.Xaml.Media.ImageSource BadgeImageSource { get; set; };
00015     String BadgeText { get; set; };
00016     Boolean IsGroup { get; set; };
00017     Windows.ApplicationModel.Contacts.Contact Contact { get; set; };
00018     String DisplayName { get; set; };
00019     String Initials { get; set; };
00020     Boolean PreferSmallImage { get; set; };
00021     Microsoft.UI.Xaml.Media.ImageSource ProfilePicture { get; set; };
00022
00023     [MUX_PROPERTY_NEEDS_DP_FIELD]
00024     PersonPictureTemplateSettings TemplateSettings { get; };
00025
00026     static Microsoft.UI.Xaml.DependencyProperty BadgeNumberProperty { get; };
00027     static Microsoft.UI.Xaml.DependencyProperty BadgeGlyphProperty { get; };
00028     static Microsoft.UI.Xaml.DependencyProperty BadgeImageSourceProperty { get; };
00029     static Microsoft.UI.Xaml.DependencyProperty BadgeTextProperty { get; };
00030     static Microsoft.UI.Xaml.DependencyProperty IsGroupProperty { get; };
00031     static Microsoft.UI.Xaml.DependencyProperty ContactProperty { get; };
00032     static Microsoft.UI.Xaml.DependencyProperty DisplayNameProperty { get; };
00033     static Microsoft.UI.Xaml.DependencyProperty InitialsProperty { get; };
00034     static Microsoft.UI.Xaml.DependencyProperty PreferSmallImageProperty { get; };
00035     static Microsoft.UI.Xaml.DependencyProperty ProfilePictureProperty { get; };
00036 }
00037
00038 [MUX_PUBLIC]
00039 [webhosthidden]
00040 [MUX_PROPERTY_NEEDS_DP_FIELD]
00041 runtimeclass PersonPictureTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00042 {
00043     String ActualInitials { get; };
00044     Microsoft.UI.Xaml.Media.ImageBrush ActualImageBrush { get; };
00045 }
00046
00047 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: IconSource/ImageIconSource.cpp Source File

  • IconSource

ImageIconSource.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006
00007 #include "ImageIconSource.h"
00008
00009 winrt::IconElement ImageIconSource::CreateIconElementCore()
00010 {
00011     winrt::ImageIcon imageIcon;
00012     if (const auto imageSource = ImageSource())
00013     {
00014         imageIcon.Source(imageSource);
00015     }
00016     if (const auto newForeground = Foreground())
00017     {
00018         imageIcon.Foreground(newForeground);
00019     }
00020     return imageIcon;
00021 }
00022
00023 winrt::DependencyProperty ImageIconSource::GetIconElementPropertyCore(winrt::DependencyProperty sourceProperty)
00024 {
00025     if (sourceProperty == s_ImageSourceProperty)
00026     {
00027         return winrt::ImageIcon::SourceProperty();
00028     }
00029
00030     return __super::GetIconElementPropertyCore(sourceProperty);
00031 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/Common/DataAsElementElementFactory.cs Source File

  • Repeater
  • APITests
  • Common

DataAsElementElementFactory.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml.Controls;
00006
00007 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common
00008 {
00009     class DataAsElementElementFactory : ElementFactory
00010     {
00011         protected override UIElement GetElementCore(Microsoft.UI.Xaml.ElementFactoryGetArgs args)
00012         {
00013             return args.Data as UIElement;
00014         }
00015
00016         protected override void RecycleElementCore(Microsoft.UI.Xaml.ElementFactoryRecycleArgs args)
00017         {
00018         }
00019     }
00020 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/RepeaterAutomationPeer.idl Source File

  • Repeater

RepeaterAutomationPeer.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XAP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 unsealed runtimeclass RepeaterAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer
00007 {
00008     RepeaterAutomationPeer(MU_XC_NAMESPACE.ItemsRepeater owner);
00009 }
00010
00011 }
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RefreshVisualizerTests Member List

This is the complete list of members for RefreshVisualizerTests, including all inherited members.
c_MaxWaitDuration | RefreshVisualizerTests | [private]
CanInstantiate() | RefreshVisualizerTests | [inline]
ContentIsUpdatable() | RefreshVisualizerTests | [inline]
NullContentDoesNotCrash() | RefreshVisualizerTests | [inline]
NullInfoProviderDoesNotCrash() | RefreshVisualizerTests | [inline]
RefreshCompletedDeferralCompletedOffUIThread() | RefreshVisualizerTests | [inline]
RefreshPropagatesToInfoProvider() | RefreshVisualizerTests | [inline]
RefreshRequestedEventFires() | RefreshVisualizerTests | [inline]
RefreshStateChangedEventFires() | RefreshVisualizerTests | [inline]
Generated on Sun Dec 1 2024 20:53:35 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RoutedEventTraits< RoutedEventType::PointerReleased > Member List

This is the complete list of members for RoutedEventTraits< RoutedEventType::PointerReleased >, including all inherited members.
Event() RoutedEventTraits< RoutedEventType::PointerReleased > [inline, static]
Generated on Sun Dec 1 2024 20:53:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommandBarFlyoutCommandBarTemplateSettingsProperties Member List

This is the complete list of members for CommandBarFlyoutCommandBarTemplateSettingsProperties, including all inherited members.
ClearProperties() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
CloseAnimationEndPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
CloseAnimationEndPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
CloseAnimationEndPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
CommandBarFlyoutCommandBarTemplateSettingsProperties() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ContentClipRect(winrt::Rect const &value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ContentClipRect() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ContentClipRectProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
CurrentWidth(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
CurrentWidth() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
CurrentWidthProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
EnsureProperties() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
ExpandDownAnimationEndPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandDownAnimationEndPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandDownAnimationEndPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
ExpandDownAnimationHoldPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandDownAnimationHoldPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandDownAnimationHoldPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
ExpandDownAnimationStartPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandDownAnimationStartPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandDownAnimationStartPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
ExpandDownOverflowVerticalPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandDownOverflowVerticalPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandDownOverflowVerticalPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
ExpandedWidth(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandedWidth() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandedWidthProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
ExpandUpAnimationEndPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandUpAnimationEndPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandUpAnimationEndPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
ExpandUpAnimationHoldPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandUpAnimationHoldPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandUpAnimationHoldPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
ExpandUpAnimationStartPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandUpAnimationStartPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandUpAnimationStartPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
ExpandUpOverflowVerticalPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandUpOverflowVerticalPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
ExpandUpOverflowVerticalPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
OpenAnimationEndPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
OpenAnimationEndPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
OpenAnimationEndPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
OpenAnimationStartPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
OpenAnimationStartPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
OpenAnimationStartPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
OverflowContentClipRect(winrt::Rect const &value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
OverflowContentClipRect() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
OverflowContentClipRectProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
s_CloseAnimationEndPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ContentClipRectProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_CurrentWidthProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandDownAnimationEndPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandDownAnimationHoldPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandDownAnimationStartPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandDownOverflowVerticalPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandedWidthProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandUpAnimationEndPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandUpAnimationHoldPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandUpAnimationStartPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_ExpandUpOverflowVerticalPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_OpenAnimationEndPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_OpenAnimationStartPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_OverflowContentClipRectProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_WidthExpansionAnimationEndPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_WidthExpansionAnimationStartPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_WidthExpansionDeltaProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_WidthExpansionMoreButtonAnimationEndPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
s_WidthExpansionMoreButtonAnimationStartPositionProperty | CommandBarFlyoutCommandBarTemplateSettingsProperties | [static]
WidthExpansionAnimationEndPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionAnimationEndPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionAnimationEndPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
WidthExpansionAnimationStartPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionAnimationStartPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionAnimationStartPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
WidthExpansionDelta(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionDelta() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionDeltaProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
WidthExpansionMoreButtonAnimationEndPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionMoreButtonAnimationEndPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionMoreButtonAnimationEndPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
WidthExpansionMoreButtonAnimationStartPosition(double value) | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionMoreButtonAnimationStartPosition() | CommandBarFlyoutCommandBarTemplateSettingsProperties |
WidthExpansionMoreButtonAnimationStartPositionProperty() | CommandBarFlyoutCommandBarTemplateSettingsProperties | [inline, static]
Generated on Sun Dec 1 2024 20:52:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ProgressRingTemplateSettings Member List

This is the complete list of members for ProgressRingTemplateSettings, including all inherited members.
ClearProperties() | ProgressRingTemplateSettingsProperties | [static]
EllipseDiameter(double value) | ProgressRingTemplateSettingsProperties |
EllipseDiameter() | ProgressRingTemplateSettingsProperties |
EllipseDiameterProperty() | ProgressRingTemplateSettingsProperties | [inline, static]
EllipseOffset(winrt::Thickness const &value) | ProgressRingTemplateSettingsProperties |
EllipseOffset() | ProgressRingTemplateSettingsProperties |
EllipseOffsetProperty() | ProgressRingTemplateSettingsProperties | [inline, static]
EnsureProperties() | ProgressRingTemplateSettingsProperties | [static]
MaxSideLength(double value) | ProgressRingTemplateSettingsProperties |
MaxSideLength() | ProgressRingTemplateSettingsProperties |
MaxSideLengthProperty() | ProgressRingTemplateSettingsProperties | [inline, static]
ProgressRingTemplateSettings() | ProgressRingTemplateSettings |
ProgressRingTemplateSettingsProperties() | ProgressRingTemplateSettingsProperties |
s_EllipseDiameterProperty | ProgressRingTemplateSettingsProperties | [static]
s_EllipseOffsetProperty | ProgressRingTemplateSettingsProperties | [static]
s_MaxSideLengthProperty | ProgressRingTemplateSettingsProperties | [static]
Generated on Sun Dec 1 2024 20:53:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TeachingTipClosingEventArgs Member List

This is the complete list of members for TeachingTipClosingEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
Cancel() | TeachingTipClosingEventArgs |
Cancel(const bool cancel) | TeachingTipClosingEventArgs |
CheckThread() | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
DecrementDeferralCount() | TeachingTipClosingEventArgs |
DeleteInstanceOnUIThread(std::unique_ptr< TeachingTipClosingEventArgs > &&self) noexcept | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
final_release(std::unique_ptr< TeachingTipClosingEventArgs > &&self) | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline, static]
GetBase() | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
GetDeferral() | TeachingTipClosingEventArgs |
GetInner() | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
IncrementDeferralCount() | TeachingTipClosingEventArgs |
IsOnThread() | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
Reason() | TeachingTipClosingEventArgs |
Reason(const winrt::TeachingTipCloseReason &reason) | TeachingTipClosingEventArgs |
ReferenceTracker(Args &&...args) | ReferenceTracker< TeachingTipClosingEventArgs, winrt::implementation::TeachingTipClosingEventArgsT, winrt::composable, winrt::composing > | [inline]
SetDeferral(const winrt::Deferral &deferral) | TeachingTipClosingEventArgs |
Generated on Sun Dec 1 2024 20:53:16 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorPickerProperties Member List

This is the complete list of members for ColorPickerProperties, including all inherited members.
ClearProperties() | ColorPickerProperties | [static]
Color(winrt::Color const &value) | ColorPickerProperties |
Color() | ColorPickerProperties |
ColorChanged(winrt::TypedEventHandler< winrt::ColorPicker, winrt::ColorChangedEventArgs > const &value) | ColorPickerProperties |
ColorChanged(winrt::event_token const &token) | ColorPickerProperties |
ColorPickerProperties() | ColorPickerProperties |
ColorProperty() | ColorPickerProperties | [inline, static]
ColorSpectrumComponents(winrt::ColorSpectrumComponents const &value) | ColorPickerProperties |
ColorSpectrumComponents() | ColorPickerProperties |
ColorSpectrumComponentsProperty() | ColorPickerProperties | [inline, static]
ColorSpectrumShape(winrt::ColorSpectrumShape const &value) | ColorPickerProperties |
ColorSpectrumShape() | ColorPickerProperties |
ColorSpectrumShapeProperty() | ColorPickerProperties | [inline, static]
EnsureProperties() | ColorPickerProperties | [static]
IsAlphaEnabled(bool value) | ColorPickerProperties |
IsAlphaEnabled() | ColorPickerProperties |
IsAlphaEnabledProperty() | ColorPickerProperties | [inline, static]
IsAlphaSliderVisible(bool value) | ColorPickerProperties |
IsAlphaSliderVisible() | ColorPickerProperties |
IsAlphaSliderVisibleProperty() | ColorPickerProperties | [inline, static]
IsAlphaTextInputVisible(bool value) | ColorPickerProperties |
IsAlphaTextInputVisible() | ColorPickerProperties |
IsAlphaTextInputVisibleProperty() | ColorPickerProperties | [inline, static]
IsColorChannelTextInputVisible(bool value) | ColorPickerProperties |
IsColorChannelTextInputVisible() | ColorPickerProperties |
IsColorChannelTextInputVisibleProperty() | ColorPickerProperties | [inline, static]
IsColorPreviewVisible(bool value) | ColorPickerProperties |
IsColorPreviewVisible() | ColorPickerProperties |
IsColorPreviewVisibleProperty() | ColorPickerProperties | [inline, static]
IsColorSliderVisible(bool value) | ColorPickerProperties |
IsColorSliderVisible() | ColorPickerProperties |
IsColorSliderVisibleProperty() | ColorPickerProperties | [inline, static]
IsColorSpectrumVisible(bool value) | ColorPickerProperties |
IsColorSpectrumVisible() | ColorPickerProperties |
IsColorSpectrumVisibleProperty() | ColorPickerProperties | [inline, static]
IsHexInputVisible(bool value) | ColorPickerProperties |
IsHexInputVisible() | ColorPickerProperties |
IsHexInputVisibleProperty() | ColorPickerProperties | [inline, static]
IsMoreButtonVisible(bool value) | ColorPickerProperties |
IsMoreButtonVisible() | ColorPickerProperties |
IsMoreButtonVisibleProperty() | ColorPickerProperties | [inline, static]
m_colorChangedEventSource | ColorPickerProperties |
MaxHue(int value) | ColorPickerProperties |
MaxHue() | ColorPickerProperties |
MaxHueProperty() | ColorPickerProperties | [inline, static]
MaxSaturation(int value) | ColorPickerProperties |
MaxSaturation() | ColorPickerProperties |
MaxSaturationProperty() | ColorPickerProperties | [inline, static]
MaxValue(int value) | ColorPickerProperties |
MaxValue() | ColorPickerProperties |
MaxValueProperty() | ColorPickerProperties | [inline, static]
MinHue(int value) | ColorPickerProperties |
MinHue() | ColorPickerProperties |
MinHueProperty() | ColorPickerProperties | [inline, static]
MinSaturation(int value) | ColorPickerProperties |
MinSaturation() | ColorPickerProperties |
MinSaturationProperty() | ColorPickerProperties | [inline, static]
MinValue(int value) | ColorPickerProperties |
MinValue() | ColorPickerProperties |
MinValueProperty() | ColorPickerProperties | [inline, static]
OnColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnColorSpectrumComponentsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnColorSpectrumShapePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsAlphaEnabledPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsAlphaSliderVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsAlphaTextInputVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsColorChannelTextInputVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsColorPreviewVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsColorSliderVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsColorSpectrumVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsHexInputVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnIsMoreButtonVisiblePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMaxHuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMaxSaturationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMaxValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMinHuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMinSaturationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnMinValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnOrientationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
OnPreviousColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorPickerProperties | [static]
Orientation(winrt::Orientation const &value) | ColorPickerProperties |
Orientation() | ColorPickerProperties |
OrientationProperty() | ColorPickerProperties | [inline, static]
PreviousColor(winrt::IReference< winrt::Color > const &value) | ColorPickerProperties |
PreviousColor() | ColorPickerProperties |
PreviousColorProperty() | ColorPickerProperties | [inline, static]
s_ColorProperty | ColorPickerProperties | [static]
s_ColorSpectrumComponentsProperty | ColorPickerProperties | [static]
s_ColorSpectrumShapeProperty | ColorPickerProperties | [static]
s_IsAlphaEnabledProperty | ColorPickerProperties | [static]
s_IsAlphaSliderVisibleProperty | ColorPickerProperties | [static]
s_IsAlphaTextInputVisibleProperty | ColorPickerProperties | [static]
s_IsColorChannelTextInputVisibleProperty | ColorPickerProperties | [static]
s_IsColorPreviewVisibleProperty | ColorPickerProperties | [static]
s_IsColorSliderVisibleProperty | ColorPickerProperties | [static]
s_IsColorSpectrumVisibleProperty | ColorPickerProperties | [static]
s_IsHexInputVisibleProperty | ColorPickerProperties | [static]
s_IsMoreButtonVisibleProperty | ColorPickerProperties | [static]
s_MaxHueProperty | ColorPickerProperties | [static]
s_MaxSaturationProperty | ColorPickerProperties | [static]
s_MaxValueProperty | ColorPickerProperties | [static]
s_MinHueProperty | ColorPickerProperties | [static]
s_MinSaturationProperty | ColorPickerProperties | [static]
s_MinValueProperty | ColorPickerProperties | [static]
s_OrientationProperty | ColorPickerProperties | [static]
s_PreviousColorProperty | ColorPickerProperties | [static]
Generated on Sun Dec 1 2024 20:52:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/RevealControls.idl Source File

  • Materials
  • Reveal

RevealControls.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 unsealed runtimeclass RevealListViewItemPresenter : Microsoft.UI.Xaml.Controls.Primitives.ListViewItemPresenter
00007 {
00008     RevealListViewItemPresenter();
00009 }
00010
00011 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/SnapPointWrapper.h Source File

  • ScrollPresenter

SnapPointWrapper.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SnapPoint.h"
00007
00008 // The SnapPointWrapper class has a SnapPointBase member that can be shared among multiple
00009 // HorizontalSnapPoints, VerticalSnapPoints and ZoomSnapPoints collections.
00010 // It also includes all the data that is specific to that snap point and a particular collection.
00011
00012 template <typename T>
00013 class SnapPointWrapper
00014 {
00015 public:
00016     SnapPointWrapper(T const& snapPoint);
00017 #ifdef DBG
00018     ~SnapPointWrapper();
00019 #endif //DBG
00020
00021     T SnapPoint() const;
00022     std::tuple<double, double> ActualApplicableZone() const;
00023     int CombinationCount() const;
00024     bool ResetIgnoredValue();
00025     void SetIgnoredValue(double ignoredValue);
00026
00027     winrt::ExpressionAnimation CreateRestingPointExpression(
00028         winrt::InteractionTracker const& interactionTracker,
00029         winrt::hstring const& target,
00030         winrt::hstring const& scale,
00031         bool isInertiaFromImpulse);
00032     winrt::ExpressionAnimation CreateConditionalExpression(
00033         winrt::InteractionTracker const& interactionTracker,
00034         winrt::hstring const& target,
00035         winrt::hstring const& scale,
00036         bool isInertiaFromImpulse);
00037     std::tuple<winrt::ExpressionAnimation, winrt::ExpressionAnimation> GetUpdatedExpressionAnimationsForImpulse();
00038     void DetermineActualApplicableZone(
00039         const SnapPointWrapper<T>* previousSnapPointWrapper,
00040         const SnapPointWrapper<T>* nextSnapPointWrapper,
00041         bool forImpulseOnly);
00042     void Combine(const SnapPointWrapper<T>* snapPointWrapper);
00043     double Evaluate(double value) const;
00044     bool SnapsAt(double value) const;
00045
00046     static SnapPointBase* GetSnapPointFromWrapper(std::shared_ptr<SnapPointWrapper<T>> snapPointWrapper);
00047
00048 private:
00049     static SnapPointBase* GetSnapPointFromWrapper(const SnapPointWrapper<T>* snapPointWrapper);
00050
00051 private:
00052     T m_snapPoint;
00053     std::tuple<double, double> m_actualApplicableZone{ -INFINITY, INFINITY };
00054     std::tuple<double, double> m_actualImpulseApplicableZone{ -INFINITY, INFINITY };
00055     int m_combinationCount{ 0 };
00056     double m_ignoredValue{ NAN }; // Ignored snapping value when inertia is triggered by an impulse
00057     winrt::ExpressionAnimation m_conditionExpressionAnimation{ nullptr };
00058     winrt::ExpressionAnimation m_restingValueExpressionAnimation{ nullptr };
00059 };
00060
00061 template <typename T>
00062 struct SnapPointWrapperComparator
00063 {
00064     inline bool operator()(std::shared_ptr<SnapPointWrapper<T>> left, std::shared_ptr<SnapPointWrapper<T>> right) const
00065     {
00066         winrt::SnapPointBase winrtLeftSnapPoint = left->SnapPoint().as<winrt::SnapPointBase>();
00067         winrt::SnapPointBase winrtRightSnapPoint = right->SnapPoint().as<winrt::SnapPointBase>();
00068         SnapPointBase* leftSnapPoint = winrt::get_self<SnapPointBase>(winrtLeftSnapPoint);
00069         const SnapPointBase* rightSnapPoint = winrt::get_self<SnapPointBase>(winrtRightSnapPoint);
00070
00071         return *leftSnapPoint < rightSnapPoint;
00072     }
00073 };
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/TestUI/ItemsViewBlankPage.xaml.cs Source File

  • ItemsView
  • TestUI

ItemsViewBlankPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.Generic;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Private.Controls;
00008
00009 namespace MUXControlsTestApp
00010 {
00011     public sealed partial class ItemsViewBlankPage : TestPage
00012     {
00013         private object asyncEventReportingLock = new object();
00014         private List<string> lstAsyncEventMessage = new List<string>();
00015
00016         public ItemsViewBlankPage()
00017         {
00018             this.InitializeComponent();
00019
00020             if (chkLogItemsViewMessages.IsChecked == true || chkLogScrollViewMessages.IsChecked == true || chkLogItemsRepeaterMessages.IsChecked == true)
00021             {
00022                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00023
00024                 if (chkLogItemsRepeaterMessages.IsChecked == true)
00025                 {
00026                     MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00027                 }
00028                 if (chkLogScrollViewMessages.IsChecked == true)
00029                 {
00030                     MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00031                 }
00032                 if (chkLogItemsViewMessages.IsChecked == true)
00033                 {
00034                     MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00035                 }
00036             }
00037         }
00038
00039         private void ChkCustomUI_Checked(object sender, RoutedEventArgs e)
00040         {
00041             if (grdCustomUI != null)
00042                 grdCustomUI.Visibility = Visibility.Visible;
00043         }
00044
00045         private void ChkCustomUI_Unchecked(object sender, RoutedEventArgs e)
00046         {
00047             if (grdCustomUI != null)
00048                 grdCustomUI.Visibility = Visibility.Collapsed;
00049         }
00050
00051         private void ChkLogs_Checked(object sender, RoutedEventArgs e)
00052         {
00053             if (grdLogs != null)
00054                 grdLogs.Visibility = Visibility.Visible;
00055         }
00056
00057         private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
00058         {
00059             if (grdLogs != null)
00060                 grdLogs.Visibility = Visibility.Collapsed;
00061         }
00062
00063         private void ItemsView_Loaded(object sender, RoutedEventArgs e)
00064         {
00065             AppendAsyncEventMessage($"ItemsView.Loaded");
00066             if (chkLogItemsRepeaterEvents.IsChecked == true)
00067             {
00068                 LogItemsRepeaterInfo();
00069             }
00070             if (chkLogScrollViewEvents.IsChecked == true)
00071             {
00072                 LogScrollViewInfo();
00073             }
00074             LogItemsViewInfo();
00075         }
00076
00077         private void ItemsView_SizeChanged(object sender, SizeChangedEventArgs e)
00078         {
00079             AppendAsyncEventMessage($"ItemsView.SizeChanged Size={itemsView.ActualWidth}, {itemsView.ActualHeight}");
00080             if (chkLogItemsRepeaterEvents.IsChecked == true)
00081             {
00082                 LogItemsRepeaterInfo();
00083             }
00084             if (chkLogScrollViewEvents.IsChecked == true)
00085             {
00086                 LogScrollViewInfo();
00087             }
00088             LogItemsViewInfo();
00089         }
00090
00091         private void ItemsView_GettingFocus(UIElement sender, Microsoft.UI.Xaml.Input.GettingFocusEventArgs args)
00092         {
00093             FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
00094             string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
00095             FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
00096             string newFEName = (newFE == null) ? "null" : newFE.Name;
00097
00098             AppendAsyncEventMessage($"ItemsView.GettingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
00099         }
00100
00101         private void ItemsView_LostFocus(object sender, RoutedEventArgs e)
00102         {
00103             AppendAsyncEventMessage("ItemsView.LostFocus");
00104         }
00105
00106         private void ItemsView_LosingFocus(UIElement sender, Microsoft.UI.Xaml.Input.LosingFocusEventArgs args)
00107         {
00108             FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
00109             string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
00110             FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
00111             string newFEName = (newFE == null) ? "null" : newFE.Name;
00112
00113             AppendAsyncEventMessage($"ItemsView.LosingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
00114         }
00115
00116         private void ItemsView_GotFocus(object sender, RoutedEventArgs e)
00117         {
00118             AppendAsyncEventMessage("ItemsView.GotFocus");
00119         }
00120
00121         private void ItemsRepeater_Loaded(object sender, RoutedEventArgs e)
00122         {
00123             AppendAsyncEventMessage($"ItemsRepeater.Loaded");
00124             LogItemsRepeaterInfo();
00125             if (chkLogItemsViewEvents.IsChecked == true)
00126             {
00127                 LogItemsViewInfo();
00128             }
00129         }
00130
00131         private void ItemsRepeater_SizeChanged(object sender, SizeChangedEventArgs e)
00132         {
00133             AppendAsyncEventMessage($"ItemsRepeater.SizeChanged Size={itemsView.ActualWidth}, {itemsView.ActualHeight}");
00134             LogItemsRepeaterInfo();
00135             if (chkLogItemsViewEvents.IsChecked == true)
00136             {
00137                 LogItemsViewInfo();
00138             }
00139         }
00140
00141         private void ScrollView_Loaded(object sender, RoutedEventArgs e)
00142         {
00143             AppendAsyncEventMessage($"ScrollView.Loaded");
00144             LogScrollViewInfo();
00145             if (chkLogItemsViewEvents.IsChecked == true)
00146             {
00147                 LogItemsViewInfo();
00148             }
00149         }
00150
00151         private void ScrollView_SizeChanged(object sender, SizeChangedEventArgs e)
00152         {
00153             AppendAsyncEventMessage($"ScrollView.SizeChanged Size={itemsView.ActualWidth}, {itemsView.ActualHeight}");
00154             LogScrollViewInfo();
00155             if (chkLogItemsViewEvents.IsChecked == true)
00156             {
00157                 LogItemsViewInfo();
00158             }
00159         }
00160
00161         private void ScrollView_ExtentChanged(ScrollView sender, object args)
00162         {
00163             AppendAsyncEventMessage("ScrollView.ExtentChanged ExtentWidth={sender.ExtentWidth}, ExtentHeight={sender.ExtentHeight}");
00164         }
00165
00166         private void ScrollView_StateChanged(ScrollView sender, object args)
00167         {
00168             AppendAsyncEventMessage($"ScrollView.StateChanged {sender.State.ToString()}");
00169         }
00170
00171         private void ScrollView_ViewChanged(ScrollView sender, object args)
00172         {
00173             AppendAsyncEventMessage($"ScrollView.ViewChanged HorizontalOffset={sender.HorizontalOffset.ToString()}, VerticalOffset={sender.VerticalOffset}, ZoomFactor={sender.ZoomFactor}");
00174         }
00175
00176         private void ScrollView_ScrollAnimationStarting(ScrollView sender, ScrollingScrollAnimationStartingEventArgs args)
00177         {
00178             AppendAsyncEventMessage($"ScrollView.ScrollAnimationStarting OffsetsChangeCorrelationId={args.CorrelationId}, SP=({args.StartPosition.X}, {args.StartPosition.Y}), EP=({args.EndPosition.X}, {args.EndPosition.Y})");
00179         }
00180
00181         private void ScrollView_ZoomAnimationStarting(ScrollView sender, ScrollingZoomAnimationStartingEventArgs args)
00182         {
00183             AppendAsyncEventMessage($"ScrollView.ZoomAnimationStarting ZoomFactorChangeCorrelationId={args.CorrelationId}, CenterPoint={args.CenterPoint}, SZF={args.StartZoomFactor}, EZF={args.EndZoomFactor}");
00184         }
00185
00186         private void ScrollView_ScrollCompleted(ScrollView sender, ScrollingScrollCompletedEventArgs args)
00187         {
00188             AppendAsyncEventMessage($"ScrollView.ScrollCompleted OffsetsChangeCorrelationId={args.CorrelationId}");
00189         }
00190
00191         private void ScrollView_ZoomCompleted(ScrollView sender, ScrollingZoomCompletedEventArgs args)
00192         {
00193             AppendAsyncEventMessage($"ScrollView.ZoomCompleted ZoomFactorChangeCorrelationId={args.CorrelationId}");
00194         }
00195
00196         private void LogItemsRepeaterInfo()
00197         {
00198             ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
00199
00200             AppendAsyncEventMessage($"ItemsRepeater Info: ItemsSource={itemsRepeater.ItemsSource}, ItemTemplate={itemsRepeater.ItemTemplate}, Layout={itemsRepeater.Layout}");
00201         }
00202
00203         private void LogScrollViewInfo()
00204         {
00205             ScrollView scrollView = ItemsViewTestHooks.GetScrollViewPart(itemsView);
00206
00207             AppendAsyncEventMessage($"ScrollView Info: HorizontalOffset={scrollView.HorizontalOffset}, VerticalOffset={scrollView.VerticalOffset}, ZoomFactor={scrollView.ZoomFactor}");
00208             AppendAsyncEventMessage($"ScrollView Info: ViewportWidth={scrollView.ViewportWidth}, ExtentHeight={scrollView.ViewportHeight}");
00209             AppendAsyncEventMessage($"ScrollView Info: ExtentWidth={scrollView.ExtentWidth}, ExtentHeight={scrollView.ExtentHeight}");
00210             AppendAsyncEventMessage($"ScrollView Info: ScrollableWidth={scrollView.ScrollableWidth}, ScrollableHeight={scrollView.ScrollableHeight}");
00211         }
00212
00213         private void LogItemsViewInfo()
00214         {
00215             //AppendAsyncEventMessage($"ItemsView Info: ItemsSource={itemsView.ItemsSource}, ItemTemplate={itemsView.ItemTemplate}, Layout={itemsView.Layout}");
00216         }
00217
00218         private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
00219         {
00220             lstLogs.Items.Clear();
00221         }
00222
00223         private void ChkLogItemsRepeaterEvents_Checked(object sender, RoutedEventArgs e)
00224         {
00225             if (itemsView != null)
00226             {
00227                 ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
00228
00229                 if (itemsRepeater != null)
00230                 {
00231                     itemsRepeater.Loaded += ItemsRepeater_Loaded;
00232                     itemsRepeater.SizeChanged += ItemsRepeater_SizeChanged;
00233                 }
00234             }
00235         }
00236
00237         private void ChkLogItemsRepeaterEvents_Unchecked(object sender, RoutedEventArgs e)
00238         {
00239             if (itemsView != null)
00240             {
00241                 ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
00242
00243                 if (itemsRepeater != null)
00244                 {
00245                     itemsRepeater.Loaded -= ItemsRepeater_Loaded;
00246                     itemsRepeater.SizeChanged -= ItemsRepeater_SizeChanged;
00247                 }
00248             }
00249         }
00250
00251         private void ChkLogScrollViewEvents_Checked(object sender, RoutedEventArgs e)
00252         {
00253             if (itemsView != null)
00254             {
00255                 ScrollView scrollView = ItemsViewTestHooks.GetScrollViewPart(itemsView);
00256
00257                 if (scrollView != null)
00258                 {
00259                     scrollView.Loaded += ScrollView_Loaded;
00260                     scrollView.SizeChanged += ScrollView_SizeChanged;
00261                     scrollView.ExtentChanged += ScrollView_ExtentChanged;
00262                     scrollView.StateChanged += ScrollView_StateChanged;
00263                     scrollView.ViewChanged += ScrollView_ViewChanged;
00264                     scrollView.ScrollAnimationStarting += ScrollView_ScrollAnimationStarting;
00265                     scrollView.ZoomAnimationStarting += ScrollView_ZoomAnimationStarting;
00266                     scrollView.ScrollCompleted += ScrollView_ScrollCompleted;
00267                     scrollView.ZoomCompleted += ScrollView_ZoomCompleted;
00268                 }
00269             }
00270         }
00271
00272         private void ChkLogScrollViewEvents_Unchecked(object sender, RoutedEventArgs e)
00273         {
00274             if (itemsView != null)
00275             {
00276                 ScrollView scrollView = ItemsViewTestHooks.GetScrollViewPart(itemsView);
00277
00278                 if (scrollView != null)
00279                 {
00280                     scrollView.Loaded -= ScrollView_Loaded;
00281                     scrollView.SizeChanged -= ScrollView_SizeChanged;
00282                     scrollView.ExtentChanged -= ScrollView_ExtentChanged;
00283                     scrollView.StateChanged -= ScrollView_StateChanged;
00284                     scrollView.ViewChanged -= ScrollView_ViewChanged;
00285                     scrollView.ScrollAnimationStarting -= ScrollView_ScrollAnimationStarting;
00286                     scrollView.ZoomAnimationStarting -= ScrollView_ZoomAnimationStarting;
00287                     scrollView.ScrollCompleted -= ScrollView_ScrollCompleted;
00288                     scrollView.ZoomCompleted -= ScrollView_ZoomCompleted;
00289                 }
00290             }
00291         }
00292
00293         private void ChkLogItemsViewEvents_Checked(object sender, RoutedEventArgs e)
00294         {
00295             if (itemsView != null)
00296             {
00297                 itemsView.GettingFocus += ItemsView_GettingFocus;
00298                 itemsView.GotFocus += ItemsView_GotFocus;
00299                 itemsView.LosingFocus += ItemsView_LosingFocus;
00300                 itemsView.LostFocus += ItemsView_LostFocus;
00301                 itemsView.Loaded += ItemsView_Loaded;
00302                 itemsView.SizeChanged += ItemsView_SizeChanged;
00303             }
00304         }
00305
00306         private void ChkLogItemsViewEvents_Unchecked(object sender, RoutedEventArgs e)
00307         {
00308             if (itemsView != null)
00309             {
00310                 itemsView.GettingFocus -= ItemsView_GettingFocus;
00311                 itemsView.GotFocus -= ItemsView_GotFocus;
00312                 itemsView.LosingFocus -= ItemsView_LosingFocus;
00313                 itemsView.LostFocus -= ItemsView_LostFocus;
00314                 itemsView.Loaded -= ItemsView_Loaded;
00315                 itemsView.SizeChanged -= ItemsView_SizeChanged;
00316             }
00317         }
00318
00319         private void ChkLogItemsRepeaterMessages_Checked(object sender, RoutedEventArgs e)
00320         {
00321             MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00322             if (chkLogItemsViewMessages.IsChecked == false && chkLogScrollViewMessages.IsChecked == false)
00323                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00324         }
00325
00326         private void ChkLogItemsRepeaterMessages_Unchecked(object sender, RoutedEventArgs e)
00327         {
00328             MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00329             if (chkLogItemsViewMessages.IsChecked == false && chkLogScrollViewMessages.IsChecked == false)
00330                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00331         }
00332
00333         private void ChkLogScrollViewMessages_Checked(object sender, RoutedEventArgs e)
00334         {
00335             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00336             if (chkLogItemsViewMessages.IsChecked == false && chkLogItemsRepeaterMessages.IsChecked == false)
00337                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00338         }
00339
00340         private void ChkLogScrollViewMessages_Unchecked(object sender, RoutedEventArgs e)
00341         {
00342             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00343             if (chkLogItemsViewMessages.IsChecked == false && chkLogItemsRepeaterMessages.IsChecked == false)
00344                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00345         }
00346
00347         private void ChkLogItemsViewMessages_Checked(object sender, RoutedEventArgs e)
00348         {
00349             MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00350             if (chkLogScrollViewMessages.IsChecked == false && chkLogItemsRepeaterMessages.IsChecked == false)
00351                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00352         }
00353
00354         private void ChkLogItemsViewMessages_Unchecked(object sender, RoutedEventArgs e)
00355         {
00356             MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00357             if (chkLogScrollViewMessages.IsChecked == false && chkLogItemsRepeaterMessages.IsChecked == false)
00358                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00359         }
00360
00361         private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
00362         {
00363             // Cut off the terminating new line.
00364             string msg = args.Message.Substring(0, args.Message.Length - 1);
00365             string asyncEventMessage = string.Empty;
00366             string senderName = string.Empty;
00367
00368             try
00369             {
00370                 FrameworkElement fe = sender as FrameworkElement;
00371
00372                 if (fe != null)
00373                 {
00374                     senderName = "s:" + fe.Name + ", ";
00375                 }
00376             }
00377             catch
00378             {
00379             }
00380
00381             if (args.IsVerboseLevel)
00382             {
00383                 asyncEventMessage = "Verbose: " + senderName + "m:" + msg;
00384             }
00385             else
00386             {
00387                 asyncEventMessage = "Info: " + senderName + "m:" + msg;
00388             }
00389
00390             AppendAsyncEventMessage(asyncEventMessage);
00391         }
00392
00393         private void AppendAsyncEventMessage(string asyncEventMessage)
00394         {
00395             lock (asyncEventReportingLock)
00396             {
00397                 while (asyncEventMessage.Length > 0)
00398                 {
00399                     string msgHead = asyncEventMessage;
00400
00401                     if (asyncEventMessage.Length > 110)
00402                     {
00403                         int commaIndex = asyncEventMessage.IndexOf(',', 110);
00404                         if (commaIndex != -1)
00405                         {
00406                             msgHead = asyncEventMessage.Substring(0, commaIndex);
00407                             asyncEventMessage = asyncEventMessage.Substring(commaIndex + 1);
00408                         }
00409                         else
00410                         {
00411                             asyncEventMessage = string.Empty;
00412                         }
00413                     }
00414                     else
00415                     {
00416                         asyncEventMessage = string.Empty;
00417                     }
00418
00419                     lstAsyncEventMessage.Add(msgHead);
00420                 }
00421                 var ignored = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, AppendAsyncEventMessage);
00422
00423             }
00424         }
00425
00426         private void AppendAsyncEventMessage()
00427         {
00428             lock (asyncEventReportingLock)
00429             {
00430                 foreach (string asyncEventMessage in lstAsyncEventMessage)
00431                 {
00432                     lstLogs.Items.Add(asyncEventMessage);
00433                 }
00434                 lstAsyncEventMessage.Clear();
00435             }
00436         }
00437
00438         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00439         {
00440             txtExceptionReport.Text = string.Empty;
00441         }
00442     }
00443 }
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectorBarTests Member List

This is the complete list of members for SelectorBarTests, including all inherited members.
c_defaultUISelectorBarParentHeight | SelectorBarTests | [private]
c_defaultUISelectorBarParentWidth | SelectorBarTests | [private]
c_MaxWaitDuration | SelectorBarTests | [private]
GetStringFromSelectorBarItem(SelectorBarItem selectorBarItem) | SelectorBarTests | [inline, private]
LogItemsViewProperties(ItemsView itemsView) | SelectorBarTests | [inline, private]
LogSelectorBarProperties(SelectorBar selectorBar) | SelectorBarTests | [inline, private]
SetupDefaultUI(SelectorBar selectorBar, AutoResetEvent selectorBarLoadedEvent=null, AutoResetEvent selectorBarUnloadedEvent=null, bool setAsContentRoot=true, bool useParentGrid=false) | SelectorBarTests | [inline, private]
VerifyDefaultSelectorBarItemPropertyValues() | SelectorBarTests | [inline]
VerifyDefaultSelectorBarPropertyValues() | SelectorBarTests | [inline]
VerifySelectorBarItems() | SelectorBarTests | [inline]
WaitForEvent(string logComment, EventWaitHandle eventWaitHandle) | SelectorBarTests | [inline, private]
Generated on Sun Dec 1 2024 20:53:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/TestUI/BiDirectionalScrollController.cs Source File

  • ScrollPresenter
  • TestUI

BiDirectionalScrollController.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Numerics;
00007 using Windows.Foundation;
00008 using Microsoft.UI.Composition;
00009 using Microsoft.UI.Input;
00010 using Microsoft.UI.Xaml;
00011 using Microsoft.UI.Xaml.Controls;
00012 using Microsoft.UI.Xaml.Controls.Primitives;
00013 using Microsoft.UI.Xaml.Hosting;
00014 using Microsoft.UI.Xaml.Input;
00015 using Microsoft.UI.Dispatching;
00016
00017 namespace MUXControlsTestApp.Utilities
00018 {
00019     public class BiDirectionalScrollControllerScrollingScrollCompletedEventArgs
00020     {
00021         internal BiDirectionalScrollControllerScrollingScrollCompletedEventArgs(int offsetsChangeCorrelationId)
00022         {
00023             OffsetsChangeCorrelationId = offsetsChangeCorrelationId;
00024         }
00025
00026         public int OffsetsChangeCorrelationId
00027         {
00028             get;
00029             set;
00030         }
00031     }
00032
00033     public sealed class BiDirectionalScrollController : ContentControl
00034     {
00035         private class UniScrollControllerScrollingScrollCompletedEventArgs
00036         {
00037             public UniScrollControllerScrollingScrollCompletedEventArgs(int offsetChangeCorrelationId)
00038             {
00039                 OffsetChangeCorrelationId = offsetChangeCorrelationId;
00040             }
00041
00042             public int OffsetChangeCorrelationId
00043             {
00044                 get;
00045                 set;
00046             }
00047         }
00048
00049         private class UniScrollController : IScrollController
00050         {
00051             public event TypedEventHandler<IScrollController, object> CanScrollChanged;
00052             public event TypedEventHandler<IScrollController, object> IsScrollingWithMouseChanged;
00053             public event TypedEventHandler<IScrollController, ScrollControllerScrollToRequestedEventArgs> ScrollToRequested;
00054             public event TypedEventHandler<IScrollController, ScrollControllerScrollByRequestedEventArgs> ScrollByRequested;
00055             public event TypedEventHandler<IScrollController, ScrollControllerAddScrollVelocityRequestedEventArgs> AddScrollVelocityRequested;
00056
00057             public event TypedEventHandler<UniScrollController, UniScrollControllerScrollingScrollCompletedEventArgs> ScrollCompleted;
00058
00059             private CompositionScrollControllerPanningInfo panningInfo = null;
00060
00061             public UniScrollController(BiDirectionalScrollController owner, Orientation orientation)
00062             {
00063                 panningInfo = new CompositionScrollControllerPanningInfo(owner.DispatcherQueue, owner.IsRailEnabled, orientation);
00064
00065                 Owner = owner;
00066                 Orientation = orientation;
00067                 MinOffset = 0.0;
00068                 MaxOffset = 0.0;
00069                 Offset = 0.0;
00070                 ViewportLength = 0.0;
00071             }
00072
00073             public IScrollControllerPanningInfo PanningInfo
00074             {
00075                 get
00076                 {
00077                     return panningInfo;
00078                 }
00079             }
00080
00081             public bool CanScroll
00082             {
00083                 get;
00084                 private set;
00085             }
00086
00087             public bool IsScrollingWithMouse
00088             {
00089                 get
00090                 {
00091                     RaiseLogMessage("UniScrollController: get_IsScrollingWithMouse for Orientation=" + Orientation);
00092                     return Owner.IsScrollingWithMouse;
00093                 }
00094             }
00095
00096             internal double MinOffset
00097             {
00098                 get;
00099                 private set;
00100             }
00101
00102             internal double MaxOffset
00103             {
00104                 get;
00105                 private set;
00106             }
00107
00108             internal double Offset
00109             {
00110                 get;
00111                 private set;
00112             }
00113
00114             internal double ViewportLength
00115             {
00116                 get;
00117                 private set;
00118             }
00119
00120             internal bool IsRailEnabled
00121             {
00122                 get
00123                 {
00124                     return panningInfo.IsRailEnabled;
00125                 }
00126                 set
00127                 {
00128                     panningInfo.IsRailEnabled = value;
00129                 }
00130             }
00131
00132             private bool IsScrollable
00133             {
00134                 get;
00135                 set;
00136             }
00137
00138             private Orientation Orientation
00139             {
00140                 get;
00141                 set;
00142             }
00143
00144             private BiDirectionalScrollController Owner
00145             {
00146                 get;
00147                 set;
00148             }
00149
00150             public void SetIsScrollable(bool isScrollable)
00151             {
00152                 RaiseLogMessage(
00153                     "UniScrollController: SetIsScrollable for Orientation=" + Orientation +
00154                     " with isScrollable=" + isScrollable);
00155                 IsScrollable = isScrollable;
00156                 UpdateCanScroll();
00157             }
00158
00159             public void SetValues(double minOffset, double maxOffset, double offset, double viewportLength)
00160             {
00161                 RaiseLogMessage(
00162                     "UniScrollController: SetValues for Orientation=" + Orientation +
00163                     " with minOffset=" + minOffset +
00164                     ", maxOffset=" + maxOffset +
00165                     ", offset=" + offset +
00166                     ", viewportLength=" + viewportLength);
00167
00168                 if (maxOffset < minOffset)
00169                 {
00170                     throw new ArgumentOutOfRangeException("maxOffset");
00171                 }
00172
00173                 if (viewportLength < 0.0)
00174                 {
00175                     throw new ArgumentOutOfRangeException("viewportLength");
00176                 }
00177
00178                 offset = Math.Max(minOffset, offset);
00179                 offset = Math.Min(maxOffset, offset);
00180
00181                 double offsetTarget = 0.0;
00182
00183                 if (Owner.OperationsCount == 0)
00184                 {
00185                     offsetTarget = offset;
00186                 }
00187                 else
00188                 {
00189                     offsetTarget = Math.Max(minOffset, offsetTarget);
00190                     offsetTarget = Math.Min(maxOffset, offsetTarget);
00191                 }
00192
00193                 if (Orientation == Orientation.Horizontal)
00194                     Owner.OffsetTarget = new Point(offsetTarget, Owner.OffsetTarget.Y);
00195                 else
00196                     Owner.OffsetTarget = new Point(Owner.OffsetTarget.X, offsetTarget);
00197
00198                 bool updatePanningFrameworkElementLength =
00199                     MinOffset != minOffset ||
00200                     MaxOffset != maxOffset ||
00201                     ViewportLength != viewportLength;
00202
00203                 MinOffset = minOffset;
00204                 Offset = offset;
00205                 MaxOffset = maxOffset;
00206                 ViewportLength = viewportLength;
00207
00208                 if (updatePanningFrameworkElementLength && !panningInfo.UpdatePanningFrameworkElementLength(minOffset, maxOffset, viewportLength))
00209                 {
00210                     panningInfo.UpdatePanningElementOffsetMultiplier();
00211                 }
00212
00213                 // Potentially changed MinOffset / MaxOffset value(s) may have an effect
00214                 // on the read-only IScrollController.CanScroll property.
00215                 UpdateCanScroll();
00216             }
00217
00218             public CompositionAnimation GetScrollAnimation(
00219                 int correlationId,
00220                 Vector2 startPosition,
00221                 Vector2 endPosition,
00222                 CompositionAnimation defaultAnimation)
00223             {
00224                 RaiseLogMessage(
00225                     "UniScrollController: GetScrollAnimation for Orientation=" + Orientation +
00226                     " with OffsetsChangeCorrelationId=" + correlationId + ", startPosition=" + startPosition + ", endPosition=" + endPosition);
00227                 return defaultAnimation;
00228             }
00229
00230             public void NotifyRequestedScrollCompleted(
00231                 int correlationId)
00232             {
00233                 RaiseLogMessage(
00234                     "UniScrollController: NotifyRequestedScrollCompleted for Orientation=" + Orientation +
00235                     " with OffsetsChangeCorrelationId=" + correlationId);
00236
00237                 ScrollCompleted?.Invoke(this, new UniScrollControllerScrollingScrollCompletedEventArgs(correlationId));
00238             }
00239
00240             internal void SetPanningFrameworkElement(FrameworkElement value)
00241             {
00242                 panningInfo.SetPanningFrameworkElement(value);
00243             }
00244
00245             internal void UpdateCanScroll()
00246             {
00247                 bool oldCanScroll = CanScroll;
00248
00249                 CanScroll =
00250                     MaxOffset > MinOffset && IsScrollable && Owner.IsEnabled;
00251
00252                 if (oldCanScroll != CanScroll)
00253                 {
00254                     RaiseCanScrollChanged();
00255                 }
00256             }
00257
00258             internal void UpdatePanningFrameworkElementLength()
00259             {
00260                 panningInfo.UpdatePanningFrameworkElementLength(MinOffset, MaxOffset, ViewportLength);
00261             }
00262
00263             internal void RaiseCanScrollChanged()
00264             {
00265                 RaiseLogMessage("UniScrollController: RaiseCanScrollChanged for Orientation=" + Orientation);
00266
00267                 if (CanScrollChanged != null)
00268                 {
00269                     CanScrollChanged(this, null);
00270                 }
00271             }
00272
00273             internal void RaiseIsScrollingWithMouseChanged()
00274             {
00275                 RaiseLogMessage("UniScrollController: RaiseIsScrollingWithMouseChanged for Orientation=" + Orientation);
00276
00277                 if (IsScrollingWithMouseChanged != null)
00278                 {
00279                     IsScrollingWithMouseChanged(this, null);
00280                 }
00281             }
00282
00283             internal bool RaisePanRequested(PointerPoint pointerPoint)
00284             {
00285                 RaiseLogMessage("UniScrollController: RaisePanRequested for Orientation=" + Orientation + " with pointerPoint=" + pointerPoint);
00286
00287                 return panningInfo.RaisePanRequested(pointerPoint);
00288             }
00289
00290             internal int RaiseScrollToRequested(
00291                 double offset,
00292                 ScrollingAnimationMode animationMode)
00293             {
00294                 RaiseLogMessage("UniScrollController: RaiseScrollToRequested for Orientation=" + Orientation + " with offset=" + offset + ", animationMode=" + animationMode);
00295
00296                 if (ScrollToRequested != null)
00297                 {
00298                     ScrollControllerScrollToRequestedEventArgs e =
00299                         new ScrollControllerScrollToRequestedEventArgs(
00300                             offset,
00301                             new ScrollingScrollOptions(animationMode, ScrollingSnapPointsMode.Ignore));
00302                     ScrollToRequested(this, e);
00303                     return e.CorrelationId;
00304                 }
00305                 return -1;
00306             }
00307
00308             internal int RaiseScrollByRequested(
00309                 double offsetDelta,
00310                 ScrollingAnimationMode animationMode)
00311             {
00312                 RaiseLogMessage("UniScrollController: RaiseScrollByRequested for Orientation=" + Orientation + " with offsetDelta=" + offsetDelta + ", animationMode=" + animationMode);
00313
00314                 if (ScrollByRequested != null)
00315                 {
00316                     ScrollControllerScrollByRequestedEventArgs e =
00317                         new ScrollControllerScrollByRequestedEventArgs(
00318                             offsetDelta,
00319                             new ScrollingScrollOptions(animationMode, ScrollingSnapPointsMode.Ignore));
00320                     ScrollByRequested(this, e);
00321                     return e.CorrelationId;
00322                 }
00323                 return -1;
00324             }
00325
00326             internal int RaiseAddScrollVelocityRequested(
00327                 float offsetVelocity, float? inertiaDecayRate)
00328             {
00329                 RaiseLogMessage("UniScrollController: RaiseAddScrollVelocityRequested for Orientation=" + Orientation + " with offsetVelocity=" + offsetVelocity + ", inertiaDecayRate=" + inertiaDecayRate);
00330
00331                 if (AddScrollVelocityRequested != null)
00332                 {
00333                     ScrollControllerAddScrollVelocityRequestedEventArgs e =
00334                         new ScrollControllerAddScrollVelocityRequestedEventArgs(
00335                             offsetVelocity,
00336                             inertiaDecayRate);
00337                     AddScrollVelocityRequested(this, e);
00338                     return e.CorrelationId;
00339                 }
00340                 return -1;
00341             }
00342
00343             private void RaiseLogMessage(string message)
00344             {
00345                 Owner.RaiseLogMessage(message);
00346             }
00347         }
00348
00349         private struct OperationInfo
00350         {
00351             public int CorrelationId;
00352             public Point RelativeOffsetChange;
00353             public Point OffsetTarget;
00354
00355             public OperationInfo(int correlationId, Point relativeOffsetChange, Point offsetTarget) : this()
00356             {
00357                 CorrelationId = correlationId;
00358                 RelativeOffsetChange = relativeOffsetChange;
00359                 OffsetTarget = offsetTarget;
00360             }
00361         }
00362
00363         private const float SmallChangeAdditionalVelocity = 144.0f;
00364         private const float SmallChangeInertiaDecayRate = 0.975f;
00365
00366         private List<string> lstAsyncEventMessage = new List<string>();
00367         private List<int> lstViewChangeCorrelationIds = new List<int>();
00368         private List<int> lstScrollToCorrelationIds = new List<int>();
00369         private List<int> lstScrollByCorrelationIds = new List<int>();
00370         private List<int> lstAddScrollVelocityCorrelationIds = new List<int>();
00371         private Dictionary<int, OperationInfo> operations = new Dictionary<int, OperationInfo>();
00372         private UniScrollController horizontalScrollController = null;
00373         private UniScrollController verticalScrollController = null;
00374         private RepeatButton biDecrementRepeatButton = null;
00375         private RepeatButton biIncrementRepeatButton = null;
00376         private RepeatButton horizontalIncrementVerticalDecrementRepeatButton = null;
00377         private RepeatButton horizontalDecrementVerticalIncrementRepeatButton = null;
00378         private RepeatButton horizontalDecrementRepeatButton = null;
00379         private RepeatButton horizontalIncrementRepeatButton = null;
00380         private RepeatButton verticalDecrementRepeatButton = null;
00381         private RepeatButton verticalIncrementRepeatButton = null;
00382         private bool isRailEnabled = true;
00383         private Point preManipulationThumbOffset;
00384
00385         public event TypedEventHandler<BiDirectionalScrollController, string> LogMessage;
00386         public event TypedEventHandler<BiDirectionalScrollController, BiDirectionalScrollControllerScrollingScrollCompletedEventArgs> ScrollCompleted;
00387
00388         public BiDirectionalScrollController()
00389         {
00390             this.DefaultStyleKey = typeof(BiDirectionalScrollController);
00391             this.IsScrollingWithMouse = false;
00392             this.horizontalScrollController = new UniScrollController(this, Orientation.Horizontal);
00393             this.verticalScrollController = new UniScrollController(this, Orientation.Vertical);
00394
00395             this.horizontalScrollController.ScrollCompleted += UniScrollController_ScrollCompleted;
00396             this.verticalScrollController.ScrollCompleted += UniScrollController_ScrollCompleted;
00397
00398             IsEnabledChanged += BiDirectionalScrollController_IsEnabledChanged;
00399             SizeChanged += BiDirectionalScrollController_SizeChanged;
00400         }
00401
00402         public bool IsRailEnabled
00403         {
00404             get
00405             {
00406                 return isRailEnabled;
00407             }
00408             set
00409             {
00410                 if (isRailEnabled != value)
00411                 {
00412                     isRailEnabled = value;
00413
00414                     if (Thumb != null)
00415                     {
00416                         Thumb.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY;
00417                         if (isRailEnabled)
00418                         {
00419                             Thumb.ManipulationMode |= ManipulationModes.TranslateRailsX | ManipulationModes.TranslateRailsY;
00420                         }
00421                     }
00422
00423                     horizontalScrollController.IsRailEnabled = isRailEnabled;
00424                     verticalScrollController.IsRailEnabled = isRailEnabled;
00425                 }
00426             }
00427         }
00428
00429         public IScrollController HorizontalScrollController
00430         {
00431             get
00432             {
00433                 return horizontalScrollController;
00434             }
00435         }
00436
00437         public IScrollController VerticalScrollController
00438         {
00439             get
00440             {
00441                 return verticalScrollController;
00442             }
00443         }
00444
00445         public int ScrollTo(double horizontalOffset, double verticalOffset, ScrollingAnimationMode animationMode)
00446         {
00447             int viewChangeCorrelationId = RaiseScrollToRequested(
00448                 new Point(horizontalOffset, verticalOffset),
00449                 animationMode, false /*hookupCompletion*/);
00450             lstViewChangeCorrelationIds.Add(viewChangeCorrelationId);
00451             return viewChangeCorrelationId;
00452         }
00453
00454         public int ScrollBy(double horizontalOffsetDelta, double verticalOffsetDelta, ScrollingAnimationMode animationMode)
00455         {
00456             int viewChangeCorrelationId = RaiseScrollByRequested(
00457                 new Point(horizontalOffsetDelta, verticalOffsetDelta),
00458                 animationMode, false /*hookupCompletion*/);
00459             lstViewChangeCorrelationIds.Add(viewChangeCorrelationId);
00460             return viewChangeCorrelationId;
00461         }
00462
00463         public int AddScrollVelocity(Vector2 offsetVelocity, Vector2? inertiaDecayRate)
00464         {
00465             int viewChangeCorrelationId = RaiseAddScrollVelocityRequested(
00466                 offsetVelocity, inertiaDecayRate, false /*hookupCompletion*/);
00467             lstViewChangeCorrelationIds.Add(viewChangeCorrelationId);
00468             return viewChangeCorrelationId;
00469         }
00470
00471         protected override void OnApplyTemplate()
00472         {
00473             UnhookHandlers();
00474
00475             base.OnApplyTemplate();
00476
00477             Thumb = GetTemplateChild("Thumb") as FrameworkElement;
00478             biDecrementRepeatButton = GetTemplateChild("BiDecrementRepeatButton") as RepeatButton;
00479             biIncrementRepeatButton = GetTemplateChild("BiIncrementRepeatButton") as RepeatButton;
00480             horizontalIncrementVerticalDecrementRepeatButton = GetTemplateChild("HorizontalIncrementVerticalDecrementRepeatButton") as RepeatButton;
00481             horizontalDecrementVerticalIncrementRepeatButton = GetTemplateChild("HorizontalDecrementVerticalIncrementRepeatButton") as RepeatButton;
00482             horizontalDecrementRepeatButton = GetTemplateChild("HorizontalDecrementRepeatButton") as RepeatButton;
00483             horizontalIncrementRepeatButton = GetTemplateChild("HorizontalIncrementRepeatButton") as RepeatButton;
00484             verticalDecrementRepeatButton = GetTemplateChild("VerticalDecrementRepeatButton") as RepeatButton;
00485             verticalIncrementRepeatButton = GetTemplateChild("VerticalIncrementRepeatButton") as RepeatButton;
00486
00487             if (Thumb != null)
00488             {
00489                 Thumb.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY;
00490                 if (IsRailEnabled)
00491                 {
00492                     Thumb.ManipulationMode |= ManipulationModes.TranslateRailsX | ManipulationModes.TranslateRailsY;
00493                 }
00494
00495                 FrameworkElement parent = Thumb.Parent as FrameworkElement;
00496
00497                 if (parent != null)
00498                 {
00499                     horizontalScrollController.SetPanningFrameworkElement(Thumb);
00500                     verticalScrollController.SetPanningFrameworkElement(Thumb);
00501                 }
00502                 else
00503                 {
00504                     horizontalScrollController.SetPanningFrameworkElement(null);
00505                     verticalScrollController.SetPanningFrameworkElement(null);
00506                 }
00507             }
00508             else
00509             {
00510                 horizontalScrollController.SetPanningFrameworkElement(null);
00511                 verticalScrollController.SetPanningFrameworkElement(null);
00512             }
00513
00514             HookHandlers();
00515         }
00516
00517         internal bool IsScrollingWithMouse
00518         {
00519             get;
00520             private set;
00521         }
00522
00523         internal Point OffsetTarget
00524         {
00525             get;
00526             set;
00527         }
00528
00529         private FrameworkElement Thumb
00530         {
00531             get;
00532             set;
00533         }
00534
00535         private double HorizontalThumbOffset
00536         {
00537             get
00538             {
00539                 if (Thumb != null)
00540                 {
00541                     double parentWidth = 0.0;
00542                     FrameworkElement parent = Thumb.Parent as FrameworkElement;
00543                     if (parent != null)
00544                     {
00545                         parentWidth = parent.ActualWidth;
00546                     }
00547                     if (horizontalScrollController.MaxOffset != horizontalScrollController.MinOffset)
00548                     {
00549                         return horizontalScrollController.Offset / (horizontalScrollController.MaxOffset - horizontalScrollController.MinOffset) * (parentWidth - Thumb.Width);
00550                     }
00551                 }
00552
00553                 return 0.0;
00554             }
00555         }
00556
00557         private double VerticalThumbOffset
00558         {
00559             get
00560             {
00561                 if (Thumb != null)
00562                 {
00563                     double parentHeight = 0.0;
00564                     FrameworkElement parent = Thumb.Parent as FrameworkElement;
00565                     if (parent != null)
00566                     {
00567                         parentHeight = parent.ActualHeight;
00568                     }
00569                     if (verticalScrollController.MaxOffset != verticalScrollController.MinOffset)
00570                     {
00571                         return verticalScrollController.Offset / (verticalScrollController.MaxOffset - verticalScrollController.MinOffset) * (parentHeight - Thumb.Height);
00572                     }
00573                 }
00574
00575                 return 0.0;
00576             }
00577         }
00578
00579         private void HookHandlers()
00580         {
00581             if (biDecrementRepeatButton != null)
00582             {
00583                 biDecrementRepeatButton.Click += BiDecrementRepeatButton_Click;
00584             }
00585
00586             if (biIncrementRepeatButton != null)
00587             {
00588                 biIncrementRepeatButton.Click += BiIncrementRepeatButton_Click;
00589             }
00590
00591             if (horizontalIncrementVerticalDecrementRepeatButton != null)
00592             {
00593                 horizontalIncrementVerticalDecrementRepeatButton.Click += HorizontalIncrementVerticalDecrementRepeatButton_Click;
00594             }
00595
00596             if (horizontalDecrementVerticalIncrementRepeatButton != null)
00597             {
00598                 horizontalDecrementVerticalIncrementRepeatButton.Click += HorizontalDecrementVerticalIncrementRepeatButton_Click;
00599             }
00600
00601             if (horizontalDecrementRepeatButton != null)
00602             {
00603                 horizontalDecrementRepeatButton.Click += HorizontalDecrementRepeatButton_Click;
00604             }
00605
00606             if (horizontalIncrementRepeatButton != null)
00607             {
00608                 horizontalIncrementRepeatButton.Click += HorizontalIncrementRepeatButton_Click;
00609             }
00610
00611             if (verticalDecrementRepeatButton != null)
00612             {
00613                 verticalDecrementRepeatButton.Click += VerticalDecrementRepeatButton_Click;
00614             }
00615
00616             if (verticalIncrementRepeatButton != null)
00617             {
00618                 verticalIncrementRepeatButton.Click += VerticalIncrementRepeatButton_Click;
00619             }
00620
00621             if (Thumb != null)
00622             {
00623                 Thumb.PointerPressed += Thumb_PointerPressed;
00624                 Thumb.ManipulationStarting += Thumb_ManipulationStarting;
00625                 Thumb.ManipulationDelta += Thumb_ManipulationDelta;
00626                 Thumb.ManipulationCompleted += Thumb_ManipulationCompleted;
00627
00628                 FrameworkElement parent = Thumb.Parent as FrameworkElement;
00629
00630                 if (parent != null)
00631                 {
00632                     parent.PointerPressed += Parent_PointerPressed;
00633                 }
00634             }
00635         }
00636
00637         private void UnhookHandlers()
00638         {
00639             if (biDecrementRepeatButton != null)
00640             {
00641                 biDecrementRepeatButton.Click -= BiDecrementRepeatButton_Click;
00642             }
00643
00644             if (biIncrementRepeatButton != null)
00645             {
00646                 biIncrementRepeatButton.Click -= BiIncrementRepeatButton_Click;
00647             }
00648
00649             if (horizontalIncrementVerticalDecrementRepeatButton != null)
00650             {
00651                 horizontalIncrementVerticalDecrementRepeatButton.Click -= HorizontalIncrementVerticalDecrementRepeatButton_Click;
00652             }
00653
00654             if (horizontalDecrementVerticalIncrementRepeatButton != null)
00655             {
00656                 horizontalDecrementVerticalIncrementRepeatButton.Click -= HorizontalDecrementVerticalIncrementRepeatButton_Click;
00657             }
00658
00659             if (horizontalDecrementRepeatButton != null)
00660             {
00661                 horizontalDecrementRepeatButton.Click -= HorizontalDecrementRepeatButton_Click;
00662             }
00663
00664             if (horizontalIncrementRepeatButton != null)
00665             {
00666                 horizontalIncrementRepeatButton.Click -= HorizontalIncrementRepeatButton_Click;
00667             }
00668
00669             if (verticalDecrementRepeatButton != null)
00670             {
00671                 verticalDecrementRepeatButton.Click -= VerticalDecrementRepeatButton_Click;
00672             }
00673
00674             if (verticalIncrementRepeatButton != null)
00675             {
00676                 verticalIncrementRepeatButton.Click -= VerticalIncrementRepeatButton_Click;
00677             }
00678
00679             if (Thumb != null)
00680             {
00681                 Thumb.PointerPressed -= Thumb_PointerPressed;
00682                 Thumb.ManipulationStarting -= Thumb_ManipulationStarting;
00683                 Thumb.ManipulationDelta -= Thumb_ManipulationDelta;
00684                 Thumb.ManipulationCompleted -= Thumb_ManipulationCompleted;
00685
00686                 FrameworkElement parent = Thumb.Parent as FrameworkElement;
00687                 if (parent != null)
00688                 {
00689                     parent.PointerPressed -= Parent_PointerPressed;
00690                 }
00691             }
00692         }
00693
00694         private void BiDecrementRepeatButton_Click(object sender, RoutedEventArgs e)
00695         {
00696             RaiseLogMessage("BiDirectionalScrollController: BiDecrementRepeatButton_Click");
00697
00698             if (!HorizontalScrollController.CanScroll &&
00699                 !VerticalScrollController.CanScroll)
00700                 return;
00701
00702             int viewChangeCorrelationId =
00703                 RaiseAddScrollVelocityRequested(new Vector2(-SmallChangeAdditionalVelocity), new Vector2(SmallChangeInertiaDecayRate), true /*hookupCompletion*/);
00704         }
00705
00706         private void BiIncrementRepeatButton_Click(object sender, RoutedEventArgs e)
00707         {
00708             RaiseLogMessage("BiDirectionalScrollController: BiIncrementRepeatButton_Click");
00709
00710             if (!HorizontalScrollController.CanScroll &&
00711                 !VerticalScrollController.CanScroll)
00712                 return;
00713
00714             int viewChangeCorrelationId =
00715                 RaiseAddScrollVelocityRequested(new Vector2(SmallChangeAdditionalVelocity), new Vector2(SmallChangeInertiaDecayRate), true /*hookupCompletion*/);
00716         }
00717
00718         private void HorizontalIncrementVerticalDecrementRepeatButton_Click(object sender, RoutedEventArgs e)
00719         {
00720             RaiseLogMessage("BiDirectionalScrollController: HorizontalIncrementVerticalDecrementRepeatButton_Click");
00721
00722             if (!HorizontalScrollController.CanScroll &&
00723                 !VerticalScrollController.CanScroll)
00724                 return;
00725
00726             int viewChangeCorrelationId =
00727                 RaiseAddScrollVelocityRequested(new Vector2(SmallChangeAdditionalVelocity, -SmallChangeAdditionalVelocity), new Vector2(SmallChangeInertiaDecayRate), true /*hookupCompletion*/);
00728         }
00729
00730         private void HorizontalDecrementVerticalIncrementRepeatButton_Click(object sender, RoutedEventArgs e)
00731         {
00732             RaiseLogMessage("BiDirectionalScrollController: HorizontalDecrementVerticalIncrementRepeatButton_Click");
00733
00734             if (!HorizontalScrollController.CanScroll &&
00735                 !VerticalScrollController.CanScroll)
00736                 return;
00737
00738             int viewChangeCorrelationId =
00739                 RaiseAddScrollVelocityRequested(new Vector2(-SmallChangeAdditionalVelocity, SmallChangeAdditionalVelocity), new Vector2(SmallChangeInertiaDecayRate), true /*hookupCompletion*/);
00740         }
00741
00742         private void HorizontalDecrementRepeatButton_Click(object sender, RoutedEventArgs e)
00743         {
00744             RaiseLogMessage("BiDirectionalScrollController: HorizontalDecrementRepeatButton_Click");
00745
00746             if (!HorizontalScrollController.CanScroll &&
00747                 !VerticalScrollController.CanScroll)
00748                 return;
00749
00750             int viewChangeCorrelationId =
00751                 RaiseAddScrollVelocityRequested(new Vector2(-SmallChangeAdditionalVelocity, 0), new Vector2(SmallChangeInertiaDecayRate), true /*hookupCompletion*/);
00752         }
00753
00754         private void HorizontalIncrementRepeatButton_Click(object sender, RoutedEventArgs e)
00755         {
00756             RaiseLogMessage("BiDirectionalScrollController: HorizontalIncrementRepeatButton_Click");
00757
00758             if (!HorizontalScrollController.CanScroll &&
00759                 !VerticalScrollController.CanScroll)
00760                 return;
00761
00762             int viewChangeCorrelationId =
00763                 RaiseAddScrollVelocityRequested(new Vector2(SmallChangeAdditionalVelocity, 0), new Vector2(SmallChangeInertiaDecayRate), true /*hookupCompletion*/);
00764         }
00765
00766         private void VerticalDecrementRepeatButton_Click(object sender, RoutedEventArgs e)
00767         {
00768             RaiseLogMessage("BiDirectionalScrollController: VerticalDecrementRepeatButton_Click");
00769
00770             if (!HorizontalScrollController.CanScroll &&
00771                 !VerticalScrollController.CanScroll)
00772                 return;
00773
00774             int viewChangeCorrelationId =
00775                 RaiseAddScrollVelocityRequested(new Vector2(0, -SmallChangeAdditionalVelocity), new Vector2(SmallChangeInertiaDecayRate), true /*hookupCompletion*/);
00776         }
00777
00778         private void VerticalIncrementRepeatButton_Click(object sender, RoutedEventArgs e)
00779         {
00780             RaiseLogMessage("BiDirectionalScrollController: VerticalIncrementRepeatButton_Click");
00781
00782             if (!HorizontalScrollController.CanScroll &&
00783                 !VerticalScrollController.CanScroll)
00784                 return;
00785
00786             int viewChangeCorrelationId =
00787                 RaiseAddScrollVelocityRequested(new Vector2(0, SmallChangeAdditionalVelocity), new Vector2(SmallChangeInertiaDecayRate), true /*hookupCompletion*/);
00788         }
00789
00790         private void Thumb_PointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
00791         {
00792             Point pt = e.GetCurrentPoint(sender as UIElement).Position;
00793             RaiseLogMessage("BiDirectionalScrollController: Thumb_PointerPressed with position=" + pt);
00794
00795             if (!HorizontalScrollController.CanScroll &&
00796                 !VerticalScrollController.CanScroll)
00797                 return;
00798
00799             switch (e.Pointer.PointerDeviceType)
00800             {
00801                 case Microsoft.UI.Input.PointerDeviceType.Touch:
00802                 case Microsoft.UI.Input.PointerDeviceType.Pen:
00803                     RaisePanRequested(e.GetCurrentPoint(null));
00804                     break;
00805                 case Microsoft.UI.Input.PointerDeviceType.Mouse:
00806                     if (!IsScrollingWithMouse)
00807                     {
00808                         IsScrollingWithMouse = true;
00809
00810                         if (HorizontalScrollController.CanScroll)
00811                             horizontalScrollController.RaiseIsScrollingWithMouseChanged();
00812                         if (VerticalScrollController.CanScroll)
00813                             verticalScrollController.RaiseIsScrollingWithMouseChanged();
00814                     }
00815                     break;
00816             }
00817         }
00818
00819         private void Parent_PointerPressed(object sender, PointerRoutedEventArgs e)
00820         {
00821             Point pt = e.GetCurrentPoint(sender as UIElement).Position;
00822             RaiseLogMessage("BiDirectionalScrollController: Parent_PointerPressed with position=" + pt);
00823
00824             if (!HorizontalScrollController.CanScroll &&
00825                 !VerticalScrollController.CanScroll)
00826                 return;
00827
00828             Point maxThumbOffset = MaxThumbOffset();
00829             double targetThumbHorizontalOffset = pt.X - Thumb.ActualWidth / 2.0;
00830             double targetThumbVerticalOffset = pt.Y - Thumb.ActualHeight / 2.0;
00831
00832             targetThumbHorizontalOffset = Math.Max(targetThumbHorizontalOffset, 0.0);
00833             targetThumbVerticalOffset = Math.Max(targetThumbVerticalOffset, 0.0);
00834
00835             targetThumbHorizontalOffset = Math.Min(targetThumbHorizontalOffset, maxThumbOffset.X);
00836             targetThumbVerticalOffset = Math.Min(targetThumbVerticalOffset, maxThumbOffset.Y);
00837
00838             Point targetThumbOffset = new Point(targetThumbHorizontalOffset, targetThumbVerticalOffset);
00839             Point targetScrollPresenterOffset = ScrollPresenterOffsetFromThumbOffset(targetThumbOffset);
00840
00841             int viewChangeCorrelationId = RaiseScrollToRequested(targetScrollPresenterOffset, ScrollingAnimationMode.Auto, true /*hookupCompletion*/);
00842             if (viewChangeCorrelationId != -1 && !operations.ContainsKey(viewChangeCorrelationId))
00843             {
00844                 operations.Add(
00845                     viewChangeCorrelationId,
00846                     new OperationInfo(viewChangeCorrelationId, new Point(targetScrollPresenterOffset.X - HorizontalThumbOffset, targetScrollPresenterOffset.Y - VerticalThumbOffset), targetScrollPresenterOffset));
00847             }
00848         }
00849
00850         private void Thumb_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
00851         {
00852             if (IsScrollingWithMouse)
00853             {
00854                 preManipulationThumbOffset = new Point(HorizontalThumbOffset, VerticalThumbOffset);
00855             }
00856         }
00857
00858         private void Thumb_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
00859         {
00860             if (IsScrollingWithMouse)
00861             {
00862                 Point targetThumbOffset = new Point(
00863                     preManipulationThumbOffset.X + e.Cumulative.Translation.X,
00864                     preManipulationThumbOffset.Y + e.Cumulative.Translation.Y);
00865                 Point scrollPresenterOffset = ScrollPresenterOffsetFromThumbOffset(targetThumbOffset);
00866
00867                 int viewChangeCorrelationId = RaiseScrollToRequested(
00868                     scrollPresenterOffset, ScrollingAnimationMode.Disabled, true /*hookupCompletion*/);
00869             }
00870         }
00871
00872         private void Thumb_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
00873         {
00874             if (IsScrollingWithMouse)
00875             {
00876                 IsScrollingWithMouse = false;
00877
00878                 if (HorizontalScrollController.CanScroll)
00879                     horizontalScrollController.RaiseIsScrollingWithMouseChanged();
00880                 if (VerticalScrollController.CanScroll)
00881                     verticalScrollController.RaiseIsScrollingWithMouseChanged();
00882             }
00883         }
00884
00885         private void BiDirectionalScrollController_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
00886         {
00887             RaiseLogMessage("BiDirectionalScrollController: IsEnabledChanged with IsEnabled=" + IsEnabled);
00888
00889             horizontalScrollController.UpdateCanScroll();
00890             verticalScrollController.UpdateCanScroll();
00891         }
00892
00893         private void BiDirectionalScrollController_SizeChanged(object sender, SizeChangedEventArgs e)
00894         {
00895             RaiseLogMessage("BiDirectionalScrollController: SizeChanged with NewSize=" + e.NewSize);
00896
00897             horizontalScrollController.UpdatePanningFrameworkElementLength();
00898             verticalScrollController.UpdatePanningFrameworkElementLength();
00899         }
00900
00901         private Point ScrollPresenterOffsetFromThumbOffset(Point thumbOffset)
00902         {
00903             Point scrollPresenterOffset = new Point();
00904
00905             if (Thumb != null)
00906             {
00907                 Size parentSize = new Size();
00908                 Size thumbSize = new Size(Thumb.ActualWidth, Thumb.ActualHeight);
00909                 FrameworkElement parent = Thumb.Parent as FrameworkElement;
00910                 if (parent != null)
00911                 {
00912                     parentSize = new Size(parent.ActualWidth, parent.ActualHeight);
00913                 }
00914                 if (parentSize.Width != thumbSize.Width || parentSize.Height != thumbSize.Height)
00915                 {
00916                     scrollPresenterOffset = new Point(
00917                         parentSize.Width == thumbSize.Width ? 0 : (thumbOffset.X * (horizontalScrollController.MaxOffset - horizontalScrollController.MinOffset) / (parentSize.Width - thumbSize.Width)),
00918                         parentSize.Height == thumbSize.Height ? 0 : (thumbOffset.Y * (verticalScrollController.MaxOffset - verticalScrollController.MinOffset) / (parentSize.Height - thumbSize.Height)));
00919                 }
00920             }
00921
00922             return scrollPresenterOffset;
00923         }
00924
00925         private Point MaxThumbOffset()
00926         {
00927             Point maxThumbOffset = new Point();
00928
00929             if (Thumb != null)
00930             {
00931                 Size parentSize = new Size();
00932                 Size thumbSize = new Size(Thumb.ActualWidth, Thumb.ActualHeight);
00933                 FrameworkElement parent = Thumb.Parent as FrameworkElement;
00934                 if (parent != null)
00935                 {
00936                     parentSize = new Size(parent.ActualWidth, parent.ActualHeight);
00937                 }
00938                 maxThumbOffset = new Point(
00939                     Math.Max(0.0, parentSize.Width - thumbSize.Width),
00940                     Math.Max(0.0, parentSize.Height - thumbSize.Height));
00941             }
00942
00943             return maxThumbOffset;
00944         }
00945
00946         private void UniScrollController_ScrollCompleted(IScrollController sender, UniScrollControllerScrollingScrollCompletedEventArgs args)
00947         {
00948             if (lstScrollToCorrelationIds.Contains(args.OffsetChangeCorrelationId))
00949             {
00950                 lstScrollToCorrelationIds.Remove(args.OffsetChangeCorrelationId);
00951
00952                 Point relativeOffsetChange;
00953
00954                 if (operations.ContainsKey(args.OffsetChangeCorrelationId))
00955                 {
00956                     OperationInfo oi = operations[args.OffsetChangeCorrelationId];
00957                     relativeOffsetChange = oi.RelativeOffsetChange;
00958                     operations.Remove(args.OffsetChangeCorrelationId);
00959                 }
00960
00961                 RaiseLogMessage("BiDirectionalScrollController: ScrollToRequest completed. OffsetChangeCorrelationId=" + args.OffsetChangeCorrelationId);
00962             }
00963             else if (lstScrollByCorrelationIds.Contains(args.OffsetChangeCorrelationId))
00964             {
00965                 lstScrollByCorrelationIds.Remove(args.OffsetChangeCorrelationId);
00966
00967                 Point relativeOffsetChange;
00968
00969                 if (operations.ContainsKey(args.OffsetChangeCorrelationId))
00970                 {
00971                     OperationInfo oi = operations[args.OffsetChangeCorrelationId];
00972                     relativeOffsetChange = oi.RelativeOffsetChange;
00973                     operations.Remove(args.OffsetChangeCorrelationId);
00974                 }
00975
00976                 RaiseLogMessage("BiDirectionalScrollController: ScrollByRequest completed. OffsetChangeCorrelationId=" + args.OffsetChangeCorrelationId);
00977             }
00978             else if (lstAddScrollVelocityCorrelationIds.Contains(args.OffsetChangeCorrelationId))
00979             {
00980                 lstAddScrollVelocityCorrelationIds.Remove(args.OffsetChangeCorrelationId);
00981
00982                 RaiseLogMessage("BiDirectionalScrollController: AddScrollVelocityRequest completed. OffsetChangeCorrelationId=" + args.OffsetChangeCorrelationId);
00983             }
00984
00985             if (lstViewChangeCorrelationIds.Contains(args.OffsetChangeCorrelationId))
00986             {
00987                 lstViewChangeCorrelationIds.Remove(args.OffsetChangeCorrelationId);
00988
00989                 RaiseScrollCompleted(args.OffsetChangeCorrelationId);
00990             }
00991         }
00992
00993         private void RaisePanRequested(PointerPoint pointerPoint)
00994         {
00995             RaiseLogMessage("BiDirectionalScrollController: RaisePanRequested with pointerPoint=" + pointerPoint);
00996             bool handled = horizontalScrollController.RaisePanRequested(pointerPoint);
00997             RaiseLogMessage("BiDirectionalScrollController: RaisePanRequested result Handled=" + handled);
00998         }
00999
01000         private int RaiseScrollToRequested(
01001             Point offset,
01002             ScrollingAnimationMode animationMode,
01003             bool hookupCompletion)
01004         {
01005             RaiseLogMessage("BiDirectionalScrollController: RaiseScrollToRequested with offset=" + offset + ", animationMode=" + animationMode);
01006
01007             int horizontalOffsetChangeCorrelationId = horizontalScrollController.RaiseScrollToRequested(
01008                 offset.X, animationMode);
01009
01010             if (horizontalOffsetChangeCorrelationId != -1)
01011                 RaiseLogMessage("BiDirectionalScrollController: Horizontal ScrollToRequest started. CorrelationId=" + horizontalOffsetChangeCorrelationId);
01012
01013             int verticalOffsetChangeCorrelationId = verticalScrollController.RaiseScrollToRequested(
01014                 offset.Y, animationMode);
01015
01016             if (verticalOffsetChangeCorrelationId != -1)
01017                 RaiseLogMessage("BiDirectionalScrollController: Vertical ScrollToRequest started. CorrelationId=" + verticalOffsetChangeCorrelationId);
01018
01019             int offsetChangeCorrelationId = -1;
01020
01021             if (horizontalOffsetChangeCorrelationId != -1 && verticalOffsetChangeCorrelationId != -1 && horizontalOffsetChangeCorrelationId == verticalOffsetChangeCorrelationId)
01022             {
01023                 offsetChangeCorrelationId = horizontalOffsetChangeCorrelationId;
01024             }
01025             else if (horizontalOffsetChangeCorrelationId != -1 && verticalOffsetChangeCorrelationId != -1 && horizontalOffsetChangeCorrelationId != verticalOffsetChangeCorrelationId)
01026             {
01027                 RaiseLogMessage("BiDirectionalScrollController: ScrollToRequest CorrelationIds do not match.");
01028             }
01029             else if (horizontalOffsetChangeCorrelationId != -1)
01030             {
01031                 offsetChangeCorrelationId = horizontalOffsetChangeCorrelationId;
01032             }
01033             else if (verticalOffsetChangeCorrelationId != -1)
01034             {
01035                 offsetChangeCorrelationId = verticalOffsetChangeCorrelationId;
01036             }
01037             else
01038             {
01039                 RaiseLogMessage("BiDirectionalScrollController: ScrollToRequest CorrelationIds are -1.");
01040             }
01041
01042             if (hookupCompletion && offsetChangeCorrelationId != -1 && !lstScrollToCorrelationIds.Contains(offsetChangeCorrelationId))
01043             {
01044                 lstScrollToCorrelationIds.Add(offsetChangeCorrelationId);
01045             }
01046
01047             return offsetChangeCorrelationId;
01048         }
01049
01050         private int RaiseScrollByRequested(
01051             Point offsetDelta,
01052             ScrollingAnimationMode animationMode,
01053             bool hookupCompletion)
01054         {
01055             RaiseLogMessage("BiDirectionalScrollController: RaiseScrollByRequested with offsetDelta=" + offsetDelta + ", animationMode=" + animationMode);
01056
01057             int horizontalOffsetChangeCorrelationId = horizontalScrollController.RaiseScrollByRequested(
01058                 offsetDelta.X, animationMode);
01059
01060             if (horizontalOffsetChangeCorrelationId != -1)
01061                 RaiseLogMessage("BiDirectionalScrollController: Horizontal ScrollByRequest started. CorrelationId=" + horizontalOffsetChangeCorrelationId);
01062
01063             int verticalOffsetChangeCorrelationId = verticalScrollController.RaiseScrollByRequested(
01064                 offsetDelta.Y, animationMode);
01065
01066             if (verticalOffsetChangeCorrelationId != -1)
01067                 RaiseLogMessage("BiDirectionalScrollController: Vertical ScrollByRequest started. CorrelationId=" + verticalOffsetChangeCorrelationId);
01068
01069             int offsetChangeCorrelationId = -1;
01070
01071             if (horizontalOffsetChangeCorrelationId != -1 && verticalOffsetChangeCorrelationId != -1 && horizontalOffsetChangeCorrelationId == verticalOffsetChangeCorrelationId)
01072             {
01073                 offsetChangeCorrelationId = horizontalOffsetChangeCorrelationId;
01074             }
01075             else if (horizontalOffsetChangeCorrelationId != -1 && verticalOffsetChangeCorrelationId != -1 && horizontalOffsetChangeCorrelationId != verticalOffsetChangeCorrelationId)
01076             {
01077                 RaiseLogMessage("BiDirectionalScrollController: ScrollByRequest CorrelationIds do not match.");
01078             }
01079             else if (horizontalOffsetChangeCorrelationId != -1)
01080             {
01081                 offsetChangeCorrelationId = horizontalOffsetChangeCorrelationId;
01082             }
01083             else if (verticalOffsetChangeCorrelationId != -1)
01084             {
01085                 offsetChangeCorrelationId = verticalOffsetChangeCorrelationId;
01086             }
01087             else
01088             {
01089                 RaiseLogMessage("BiDirectionalScrollController: ScrollByRequest CorrelationIds are -1.");
01090             }
01091
01092             if (hookupCompletion && offsetChangeCorrelationId != -1 && !lstScrollByCorrelationIds.Contains(offsetChangeCorrelationId))
01093             {
01094                 lstScrollByCorrelationIds.Add(offsetChangeCorrelationId);
01095             }
01096
01097             return offsetChangeCorrelationId;
01098         }
01099
01100         private int RaiseAddScrollVelocityRequested(
01101             Vector2 additionalVelocity, Vector2? inertiaDecayRate, bool hookupCompletion)
01102         {
01103             RaiseLogMessage("BiDirectionalScrollController: RaiseAddScrollVelocityRequested with additionalVelocity=" + additionalVelocity + ", inertiaDecayRate=" + inertiaDecayRate);
01104
01105             int horizontalOffsetChangeCorrelationId = -1;
01106             int verticalOffsetChangeCorrelationId = -1;
01107
01108             if (additionalVelocity.X != 0.0f)
01109             {
01110                 horizontalOffsetChangeCorrelationId = horizontalScrollController.RaiseAddScrollVelocityRequested(
01111                     additionalVelocity.X, inertiaDecayRate == null ? (float?)null : inertiaDecayRate.Value.X);
01112
01113                 if (horizontalOffsetChangeCorrelationId != -1)
01114                     RaiseLogMessage("BiDirectionalScrollController: AddScrollVelocityRequest started. CorrelationId=" + horizontalOffsetChangeCorrelationId);
01115             }
01116
01117             if (additionalVelocity.Y != 0.0f)
01118             {
01119                 verticalOffsetChangeCorrelationId = verticalScrollController.RaiseAddScrollVelocityRequested(
01120                     additionalVelocity.Y, inertiaDecayRate == null ? (float?)null : inertiaDecayRate.Value.Y);
01121
01122                 if (verticalOffsetChangeCorrelationId != -1)
01123                     RaiseLogMessage("BiDirectionalScrollController: AddScrollVelocityRequest started. CorrelationId=" + verticalOffsetChangeCorrelationId);
01124             }
01125
01126             int offsetChangeCorrelationId = -1;
01127
01128             if (horizontalOffsetChangeCorrelationId != -1 && verticalOffsetChangeCorrelationId != -1 && horizontalOffsetChangeCorrelationId == verticalOffsetChangeCorrelationId)
01129             {
01130                 offsetChangeCorrelationId = horizontalOffsetChangeCorrelationId;
01131             }
01132             else if (horizontalOffsetChangeCorrelationId != -1 && verticalOffsetChangeCorrelationId != -1 && horizontalOffsetChangeCorrelationId != verticalOffsetChangeCorrelationId)
01133             {
01134                 RaiseLogMessage("BiDirectionalScrollController: AddScrollVelocityRequest operations do not match.");
01135             }
01136             else if (horizontalOffsetChangeCorrelationId != -1)
01137             {
01138                 offsetChangeCorrelationId = horizontalOffsetChangeCorrelationId;
01139             }
01140             else if (verticalOffsetChangeCorrelationId != -1)
01141             {
01142                 offsetChangeCorrelationId = verticalOffsetChangeCorrelationId;
01143             }
01144             else
01145             {
01146                 RaiseLogMessage("BiDirectionalScrollController: AddScrollVelocityRequest operations are null.");
01147             }
01148
01149             if (hookupCompletion && offsetChangeCorrelationId != -1 && !lstAddScrollVelocityCorrelationIds.Contains(offsetChangeCorrelationId))
01150             {
01151                 lstAddScrollVelocityCorrelationIds.Add(offsetChangeCorrelationId);
01152             }
01153
01154             return offsetChangeCorrelationId;
01155         }
01156
01157         internal int OperationsCount
01158         {
01159             get
01160             {
01161                 return operations.Count;
01162             }
01163         }
01164
01165         internal void RaiseLogMessage(string message)
01166         {
01167             if (LogMessage != null)
01168             {
01169                 LogMessage(this, message);
01170             }
01171         }
01172
01173         private void RaiseScrollCompleted(int viewChangeCorrelationId)
01174         {
01175             if (ScrollCompleted != null)
01176             {
01177                 BiDirectionalScrollControllerScrollingScrollCompletedEventArgs args = new BiDirectionalScrollControllerScrollingScrollCompletedEventArgs(viewChangeCorrelationId);
01178
01179                 ScrollCompleted(this, args);
01180             }
01181         }
01182     }
01183 }
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ToggleSplitButtonAutomationPeer Member List

This is the complete list of members for ToggleSplitButtonAutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
CheckThread() | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
Collapse() | ToggleSplitButtonAutomationPeer |
DeleteInstanceOnUIThread(std::unique_ptr< ToggleSplitButtonAutomationPeer > &&self) noexcept | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
Expand() | ToggleSplitButtonAutomationPeer |
ExpandCollapseState() | ToggleSplitButtonAutomationPeer |
final_release(std::unique_ptr< ToggleSplitButtonAutomationPeer > &&self) | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline, static]
GetAutomationControlTypeCore() | ToggleSplitButtonAutomationPeer |
GetBase() | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
GetClassNameCore() | ToggleSplitButtonAutomationPeer |
GetImpl() | ToggleSplitButtonAutomationPeer | [private]
GetInner() | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
GetPatternCore(winrt::PatternInterface const &patternInterface) | ToggleSplitButtonAutomationPeer |
IsOnThread() | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ToggleSplitButtonAutomationPeer, winrt::implementation::ToggleSplitButtonAutomationPeerT > | [inline]
Toggle() | ToggleSplitButtonAutomationPeer |
ToggleSplitButtonAutomationPeer(winrt::ToggleSplitButton const &owner) | ToggleSplitButtonAutomationPeer |
ToggleState() | ToggleSplitButtonAutomationPeer |
Generated on Sun Dec 1 2024 20:53:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/SingleSelector.h Source File

  • ItemsView

SingleSelector.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SelectorBase.h"
00007
00008 class SingleSelector : public SelectorBase
00009 {
00010 public:
00011     SingleSelector();
00012     ~SingleSelector();
00013
00014     void FollowFocus(bool followFocus);
00015
00016     void OnInteractedAction(winrt::IndexPath const& index, bool ctrl, bool shift) override;
00017     void OnFocusedAction(winrt::IndexPath const& index, bool ctrl, bool shift) override;
00018
00019 private:
00020     bool m_followFocus{ true };
00021 };
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/InfoBar.h Source File

  • InfoBar

InfoBar.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "InfoBar.g.h"
00010 #include "InfoBar.properties.h"
00011
00012 class InfoBar :
00013     public ReferenceTracker<InfoBar, winrt::implementation::InfoBarT>,
00014     public InfoBarProperties
00015 {
00016
00017 public:
00018     InfoBar();
00019     ~InfoBar() {}
00020
00021     // IFrameworkElement
00022     void OnApplyTemplate();
00023
00024     // UIElement
00025     winrt::AutomationPeer OnCreateAutomationPeer();
00026
00027     // Property change handlers
00028     void OnIsOpenPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00029     void OnSeverityPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00030     void OnIconSourcePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00031     void OnIsIconVisiblePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00032     void OnIsClosablePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00033     void OnTitlePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00034     void OnActionButtonPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00035     void OnMessagePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00036
00037 private:
00038     void OnCloseButtonClick(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00039
00040     void RaiseClosingEvent();
00041     void RaiseClosedEvent();
00042
00043     void UpdateVisibility(bool notify = true, bool force = false);
00044     void UpdateSeverity();
00045     void UpdateIcon();
00046     void UpdateIconVisibility();
00047     void UpdateCloseButton();
00048     void UpdateForeground();
00049     void UpdateContentPosition();
00050
00051     const winrt::hstring GetCloseButtonResourceName(winrt::InfoBarSeverity severity);
00052     const winrt::hstring GetSeverityLevelResourceName(winrt::InfoBarSeverity severity);
00053     const winrt::hstring GetIconSeverityLevelResourceName(winrt::InfoBarSeverity severity);
00054
00055     void OnForegroundChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args);
00056
00057     winrt::InfoBarCloseReason m_lastCloseReason{ winrt::InfoBarCloseReason::Programmatic };
00058
00059     winrt::Button::Click_revoker m_closeButtonClickRevoker{};
00060     tracker_ref<winrt::FrameworkElement> m_standardIconTextBlock{ this };
00061
00062     bool m_applyTemplateCalled{ false };
00063     bool m_notifyOpen{ false };
00064     bool m_isVisible{ false };
00065 };
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RepeaterTestHooks Member List

This is the complete list of members for RepeaterTestHooks, including all inherited members.
BuildTreeCompleted(winrt::TypedEventHandler< winrt::IInspectable, winrt::IInspectable > const &value) | RepeaterTestHooks | [static]
BuildTreeCompleted(winrt::event_token const &token) | RepeaterTestHooks | [static]
BuildTreeCompletedImpl(winrt::TypedEventHandler< winrt::IInspectable, winrt::IInspectable > const &value) | RepeaterTestHooks |
BuildTreeCompletedImpl(winrt::event_token const &token) | RepeaterTestHooks |
EnsureHooks() | RepeaterTestHooks | [private, static]
GetElementFactoryElementIndex() | RepeaterTestHooks | [static]
GetGlobalTestHooks() | RepeaterTestHooks | [inline, static]
GetLayoutId(winrt::IInspectable const &layout) | RepeaterTestHooks | [static]
GetLogItemIndex() | RepeaterTestHooks | [static]
m_buildTreeCompleted | RepeaterTestHooks | [private]
NotifyBuildTreeCompleted() | RepeaterTestHooks | [static]
NotifyBuildTreeCompletedImpl() | RepeaterTestHooks |
s_elementFactoryElementIndex | RepeaterTestHooks | [private, static]
s_testHooks | RepeaterTestHooks | [private, static]
SetElementFactoryElementIndex(int index) | RepeaterTestHooks | [static]
SetLayoutId(winrt::IInspectable const &layout, const hstring &id) | RepeaterTestHooks | [static]
SetLogItemIndex(int logItemIndex) | RepeaterTestHooks | [static]
Generated on Sun Dec 1 2024 20:53:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PipsPager/APITests/PipsPagerTests.cs Source File

  • PipsPager
  • APITests

PipsPagerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using Microsoft.UI.Xaml.Controls;
00006 using MUXControlsTestApp.Utilities;
00007 using Microsoft.UI.Xaml.Automation.Peers;
00008 using Microsoft.UI.Xaml.Automation.Provider;
00009 using Microsoft.UI.Xaml.Automation.Peers;
00010 using Microsoft.UI.Xaml.Media;
00011 using Microsoft.UI.Xaml.Controls;
00012 using Microsoft.UI.Xaml.Automation;
00013 using WEX.TestExecution;
00014 using WEX.TestExecution.Markup;
00015 using WEX.Logging.Interop;
00016
00017 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00018 {
00019     [TestClass]
00020     public class PipsPagerTests : ApiTestBase
00021     {
00022         [TestMethod]
00023         public void VerifyAutomationPeerBehavior()
00024         {
00025             RunOnUIThread.Execute(() =>
00026             {
00027                 var pipsControl = new PipsPager();
00028                 pipsControl.NumberOfPages = 5;
00029                 Content = pipsControl;
00030
00031                 var peer = PipsPagerAutomationPeer.CreatePeerForElement(pipsControl);
00032                 var selectionPeer = peer as ISelectionProvider;
00033                 Verify.AreEqual(false, selectionPeer.CanSelectMultiple);
00034                 Verify.AreEqual(true, selectionPeer.IsSelectionRequired);
00035             });
00036         }
00037
00038         [TestMethod]
00039         public void VerifyPipsPagerButtonUIABehavior()
00040         {
00041             RunOnUIThread.Execute(() =>
00042             {
00043                 var pipsPager = new PipsPager();
00044                 pipsPager.NumberOfPages = 5;
00045                 Content = pipsPager;
00046             });
00047
00048             IdleSynchronizer.Wait();
00049
00050             RunOnUIThread.Execute(() =>
00051             {
00052                 var rootPanel = VisualTreeHelper.GetChild(Content, 0) as StackPanel;
00053                 var repeaterRootParent = VisualTreeHelper.GetChild(rootPanel, 1);
00054                 ItemsRepeater repeater = null;
00055                 while (repeater == null)
00056                 {
00057                     var nextChild = VisualTreeHelper.GetChild(repeaterRootParent, 0);
00058                     repeater = nextChild as ItemsRepeater;
00059                     repeaterRootParent = nextChild;
00060                 }
00061                 for (int i = 0; i < 5; i++)
00062                 {
00063                     var button = repeater.TryGetElement(i);
00064                     Verify.IsNotNull(button);
00065                     Verify.AreEqual(i + 1, button.GetValue(AutomationProperties.PositionInSetProperty));
00066                     Verify.AreEqual(5, button.GetValue(AutomationProperties.SizeOfSetProperty));
00067                 }
00068             });
00069         }
00070
00071         [TestMethod]
00072         public void VerifyEmptyPagerDoesNotCrash()
00073         {
00074             RunOnUIThread.Execute(() =>
00075             {
00076                 Content = new PipsPager();
00077             });
00078
00079             IdleSynchronizer.Wait();
00080
00081             RunOnUIThread.Execute(() =>
00082             {
00083                 Verify.IsNotNull(Content);
00084             });
00085         }
00086
00087         [TestMethod]
00088         public void VerifySelectedIndexChangedEventArgs()
00089         {
00090             PipsPager pager = null;
00091             var newIndex = -2;
00092             RunOnUIThread.Execute(() =>
00093             {
00094                 pager = new PipsPager();
00095                 pager.SelectedIndexChanged += Pager_SelectedIndexChanged;
00096                 Content = pager;
00097
00098             });
00099
00100             IdleSynchronizer.Wait();
00101
00102             RunOnUIThread.Execute(() =>
00103             {
00104                 VerifySelectionChanged(0);
00105
00106                 pager.NumberOfPages = 10;
00107                 VerifySelectionChanged(0);
00108
00109                 pager.SelectedPageIndex = 9;
00110                 VerifySelectionChanged(9);
00111
00112                 pager.SelectedPageIndex = 4;
00113                 VerifySelectionChanged(4);
00114             });
00115
00116             void Pager_SelectedIndexChanged(PipsPager sender, PipsPagerSelectedIndexChangedEventArgs args)
00117             {
00118                 newIndex = sender.SelectedPageIndex;
00119             }
00120
00121             void VerifySelectionChanged(int expectedNewIndex)
00122             {
00123                 Verify.AreEqual(expectedNewIndex, newIndex, "Expected PreviousPageIndex:" + expectedNewIndex + ", actual: " + newIndex);
00124             }
00125         }
00126     }
00127 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TeachingTipTests Member List

This is the complete list of members for TeachingTipTests, including all inherited members.
PropagatePropertiesDown() | TeachingTipTests | [inline]
TeachingTipBackgroundTest() | TeachingTipTests | [inline]
TeachingTipHeroContentPlacementTest() | TeachingTipTests | [inline]
TeachingTipWithContentAndWithoutHeroContentDoesNotCrash() | TeachingTipTests | [inline]
TeachingTipWithContentAndWithoutIconSourceDoesNotCrash() | TeachingTipTests | [inline]
VerifySubTitleBlockVisibilityOnInitialUnset() | TeachingTipTests | [inline]
Generated on Sun Dec 1 2024 20:53:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommandBarFlyout/TestUI/TextCommandBarFlyoutPage.xaml.cs Source File

  • CommandBarFlyout
  • TestUI

TextCommandBarFlyoutPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using System;
00006 using Windows.ApplicationModel.DataTransfer;
00007 using Windows.Foundation;
00008 using Windows.Foundation.Metadata;
00009 using Windows.System;
00010 using Microsoft.UI.Text;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Automation;
00013 using Microsoft.UI.Xaml.Controls;
00014 using Microsoft.UI.Xaml.Controls.Primitives;
00015 using Microsoft.UI.Xaml.Documents;
00016 using Microsoft.UI.Xaml.Input;
00017
00018 namespace MUXControlsTestApp
00019 {
00020     public sealed partial class TextCommandBarFlyoutPage : TestPage
00021     {
00022         public TextCommandBarFlyoutPage()
00023         {
00024             this.InitializeComponent();
00025
00026             RichEditBox1.Document.SetText(TextSetOptions.None, "Lorem ipsum ergo sum");
00027             Clipboard.ContentChanged += OnClipboardContentChanged;
00028
00029             TextControlContextFlyout.Placement = FlyoutPlacementMode.BottomEdgeAlignedLeft;
00030             TextControlSelectionFlyout.Placement = FlyoutPlacementMode.TopEdgeAlignedLeft;
00031             TextBox1.ContextFlyout = TextControlContextFlyout;
00032             TextBlock1.ContextFlyout = TextControlContextFlyout;
00033             RichEditBox1.ContextFlyout = TextControlContextFlyout;
00034             RichTextBlock1.ContextFlyout = TextControlContextFlyout;
00035             PasswordBox1.ContextFlyout = TextControlContextFlyout;
00036             TextBox1.SelectionFlyout = TextControlSelectionFlyout;
00037             TextBlock1.SelectionFlyout = TextControlSelectionFlyout;
00038             RichEditBox1.SelectionFlyout = TextControlSelectionFlyout;
00039             RichTextBlock1.SelectionFlyout = TextControlSelectionFlyout;
00040             PasswordBox1.SelectionFlyout = TextControlSelectionFlyout;
00041         }
00042
00043         private async void OnClipboardContentChanged(object sender, object e)
00044         {
00045             var clipboardContent = Clipboard.GetContent();
00046
00047             if (clipboardContent.Contains(StandardDataFormats.Rtf))
00048             {
00049                 RecordEvent(string.Format("Clipboard content changed to '{0}'", await Clipboard.GetContent().GetRtfAsync()));
00050             }
00051             else if (clipboardContent.Contains(StandardDataFormats.Text))
00052             {
00053                 RecordEvent(string.Format("Clipboard content changed to '{0}'", await Clipboard.GetContent().GetTextAsync()));
00054             }
00055             else
00056             {
00057                 RecordEvent(string.Format("Clipboard content changed to ''"));
00058             }
00059         }
00060
00061         private void RecordEvent(string eventString)
00062         {
00063             StatusReportingTextBox.Text = eventString;
00064         }
00065
00066         private void RecordEvent(object sender, string eventString)
00067         {
00068             DependencyObject senderAsDO = sender as DependencyObject;
00069
00070             if (senderAsDO != null)
00071             {
00072                 RecordEvent(AutomationProperties.GetAutomationId(senderAsDO) + " " + eventString);
00073             }
00074         }
00075
00076         private void OnTextBoxSelectAllClicked(object sender, object args)
00077         {
00078             TextBox1.SelectAll();
00079         }
00080
00081         private void OnTextBlockSelectAllClicked(object sender, object args)
00082         {
00083             TextBlock1.SelectAll();
00084         }
00085
00086         private void OnRichEditBoxSelectAllClicked(object sender, object args)
00087         {
00088             RichEditBox1.Document.Selection.Expand(TextRangeUnit.Story);
00089         }
00090
00091         private void OnRichTextBlockSelectAllClicked(object sender, object args)
00092         {
00093             RichTextBlock1.SelectAll();
00094         }
00095
00096         private void OnTextBoxClearSelectionClicked(object sender, object args)
00097         {
00098             TextBox1.Select(0, 0);
00099         }
00100
00101         private void OnTextBlockClearSelectionClicked(object sender, object args)
00102         {
00103             TextBlock1.Select(TextBlock1.ContentStart, TextBlock1.ContentStart);
00104         }
00105
00106         private void OnRichEditBoxClearSelectionClicked(object sender, object args)
00107         {
00108             RichEditBox1.Document.Selection.Collapse(true);
00109         }
00110
00111         private void OnTextBoxFillWithTextClicked(object sender, object args)
00112         {
00113             TextBox1.Text = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
00114         }
00115
00116         private void OnRichEditBoxFillWithTextClicked(object sender, object args)
00117         {
00118             RichEditBox1.Document.SetText(TextSetOptions.None, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
00119         }
00120
00121         private void OnRichTextBlockClearSelectionClicked(object sender, object args)
00122         {
00123             RichTextBlock1.Select(RichTextBlock1.ContentStart, RichTextBlock1.ContentStart);
00124         }
00125
00126         private void OnShowTextControlFlyoutOnTextBoxClicked(object sender, object args)
00127         {
00128             ShowTextControlContextFlyoutTransient(TextBox1);
00129         }
00130
00131         private void OnShowTextControlFlyoutOnTextBlockClicked(object sender, object args)
00132         {
00133             ShowTextControlContextFlyoutTransient(TextBlock1);
00134         }
00135
00136         private void OnShowTextControlFlyoutOnRichEditBoxClicked(object sender, object args)
00137         {
00138             ShowTextControlContextFlyoutTransient(RichEditBox1);
00139         }
00140
00141         private void OnShowTextControlFlyoutOnRichTextBlockClicked(object sender, object args)
00142         {
00143             ShowTextControlContextFlyoutTransient(RichTextBlock1);
00144         }
00145
00146         private void OnShowTextControlFlyoutOnPasswordBoxClicked(object sender, object args)
00147         {
00148             ShowTextControlContextFlyoutTransient(PasswordBox1);
00149         }
00150
00151         private void OnShowStandardTextControlFlyoutOnTextBoxClicked(object sender, object args)
00152         {
00153             ShowTextControlContextFlyoutStandard(TextBox1);
00154         }
00155
00156         private void OnShowStandardTextControlFlyoutOnTextBlockClicked(object sender, object args)
00157         {
00158             ShowTextControlContextFlyoutStandard(TextBlock1);
00159         }
00160
00161         private void OnShowStandardTextControlFlyoutOnRichEditBoxClicked(object sender, object args)
00162         {
00163             ShowTextControlContextFlyoutStandard(RichEditBox1);
00164         }
00165
00166         private void OnShowStandardTextControlFlyoutOnRichTextBlockClicked(object sender, object args)
00167         {
00168             ShowTextControlContextFlyoutStandard(RichTextBlock1);
00169         }
00170
00171         private void OnShowStandardTextControlFlyoutOnPasswordBoxClicked(object sender, object args)
00172         {
00173             ShowTextControlContextFlyoutStandard(PasswordBox1);
00174         }
00175
00176         private void ShowTextControlContextFlyoutTransient(FrameworkElement targetElement)
00177         {
00178             TextControlContextFlyout.ShowAt(targetElement, new FlyoutShowOptions { ShowMode = FlyoutShowMode.Transient });
00179         }
00180
00181         private void ShowTextControlContextFlyoutStandard(FrameworkElement targetElement)
00182         {
00183             TextControlSelectionFlyout.ShowAt(targetElement, new FlyoutShowOptions { ShowMode = FlyoutShowMode.Standard });
00184         }
00185
00186         private void OnClearClipboardContentsClicked(object sender, object args)
00187         {
00188             Clipboard.Clear();
00189         }
00190
00191         private void OnSetClipboardContentsClicked(object sender, object args)
00192         {
00193             DataPackage dataPackage = new DataPackage();
00194
00195             dataPackage.RequestedOperation = DataPackageOperation.Copy;
00196             dataPackage.SetText("Automatically set clipboard text");
00197
00198             Clipboard.SetContent(dataPackage);
00199         }
00200
00201         private void OnGetRichEditBoxRtfContentClicked(object sender, object args)
00202         {
00203             string rtfContent;
00204             RichEditBox1.Document.GetText(TextGetOptions.FormatRtf, out rtfContent);
00205             StatusReportingTextBox.Text = rtfContent;
00206         }
00207     }
00208 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CalendarViewTests Member List

This is the complete list of members for CalendarViewTests, including all inherited members.
VerifyVisualTree() CalendarViewTests [inline]
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AcrylicColorPage Member List

This is the complete list of members for AcrylicColorPage, including all inherited members.
AcrylicBrushNames | AcrylicColorPage | [static]
AcrylicColorPage() | AcrylicColorPage | [inline]
GetBrushName(string fullName) | AcrylicColorPage | [inline, static]
Generated on Sun Dec 1 2024 20:53:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/LayoutSamples/VirtualLayoutPages/VirtualizingStackLayoutSamplePage.xaml.cs Source File

  • Repeater
  • TestUI
  • Samples
  • LayoutSamples
  • VirtualLayoutPages

VirtualizingStackLayoutSamplePage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using MUXControlsTestApp.Samples.Model;
00005 using System;
00006 using System.Collections.ObjectModel;
00007 using System.Linq;
00008 using Microsoft.UI.Xaml;
00009 using Microsoft.UI.Xaml.Controls;
00010
00011 namespace MUXControlsTestApp.Samples
00012 {
00013     public sealed partial class VirtualizingStackLayoutSamplePage : Page
00014     {
00015         private string _lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam laoreet erat vel massa rutrum, eget mollis massa vulputate. Vivamus semper augue leo, eget faucibus nulla mattis nec. Donec scelerisque lacus at dui ultricies, eget auctor ipsum placerat. Integer aliquet libero sed nisi eleifend, nec rutrum arcu lacinia. Sed a sem et ante gravida congue sit amet ut augue. Donec quis pellentesque urna, non finibus metus. Proin sed ornare tellus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam laoreet erat vel massa rutrum, eget mollis massa vulputate. Vivamus semper augue leo, eget faucibus nulla mattis nec. Donec scelerisque lacus at dui ultricies, eget auctor ipsum placerat. Integer aliquet libero sed nisi eleifend, nec rutrum arcu lacinia. Sed a sem et ante gravida congue sit amet ut augue. Donec quis pellentesque urna, non finibus metus. Proin sed ornare tellus.";
00016
00017         public VirtualizingStackLayoutSamplePage()
00018         {
00019             this.InitializeComponent();
00020             repeater.ItemTemplate = elementFactory;
00021
00022             var rnd = new Random();
00023             var data = new ObservableCollection<Recipe>(Enumerable.Range(0, 300).Select(k =>
00024                            new Recipe
00025                            {
00026                                ImageUri = new Uri(string.Format("ms-appx:///Images/recipe{0}.png", k % 8 + 1)),
00027                                Description = k + " - " + _lorem.Substring(0, rnd.Next(50, 350))
00028                            }));
00029
00030             repeater.ItemsSource = data;
00031             bringIntoView.Click += BringIntoView_Click;
00032         }
00033
00034         private void BringIntoView_Click(object sender, RoutedEventArgs e)
00035         {
00036             int index = 0;
00037             if (int.TryParse(tb.Text, out index))
00038             {
00039                 if (index >= 0 && index < repeater.ItemsSourceView.Count)
00040                 {
00041                     var anchor = repeater.GetOrCreateElement(index);
00042                     anchor.StartBringIntoView();
00043                 }
00044             }
00045         }
00046     }
00047 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedIconTestHooks.h Source File

  • AnimatedIcon

AnimatedIconTestHooks.h

Go to the documentation of this file.
00001 ﻿#pragma once
00002
00003 #include "AnimatedIcon.h"
00004
00005 #include "AnimatedIconTestHooks.g.h"
00006
00007 class AnimatedIconTestHooks :
00008     public winrt::implementation::AnimatedIconTestHooksT<AnimatedIconTestHooks>
00009 {
00010 public:
00011     static com_ptr<AnimatedIconTestHooks> GetGlobalTestHooks()
00012     {
00013         return s_testHooks;
00014     }
00015
00016     static com_ptr<AnimatedIconTestHooks> EnsureGlobalTestHooks();
00017
00018     static void SetAnimationQueueBehavior(const winrt::AnimatedIcon& animatedIcon, winrt::AnimatedIconAnimationQueueBehavior behavior);
00019     static void SetDurationMultiplier(const winrt::AnimatedIcon& animatedIcon, float multiplier);
00020     static void SetSpeedUpMultiplier(const winrt::AnimatedIcon& animatedIcon, float multiplier);
00021     static void SetQueueLength(const winrt::AnimatedIcon& animatedIcon, int length);
00022
00023     static winrt::hstring GetLastAnimationSegment(const winrt::AnimatedIcon& animatedIcon);
00024     static winrt::hstring GetLastAnimationSegmentStart(const winrt::AnimatedIcon& animatedIcon);
00025     static winrt::hstring GetLastAnimationSegmentEnd(const winrt::AnimatedIcon& animatedIcon);
00026
00027     static void NotifyLastAnimationSegmentChanged(const winrt::AnimatedIcon& sender);
00028     static winrt::event_token LastAnimationSegmentChanged(winrt::TypedEventHandler<winrt::AnimatedIcon, winrt::IInspectable> const& value);
00029     static void LastAnimationSegmentChanged(winrt::event_token const& token);
00030 private:
00031     static com_ptr<AnimatedIconTestHooks> s_testHooks;
00032     winrt::event<winrt::TypedEventHandler<winrt::AnimatedIcon, winrt::IInspectable>> m_lastAnimationSegmentChangedEventSource;
00033 };
Generated on Sun Dec 1 2024 20:51:39 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InfoBarAutomationPeer Member List

This is the complete list of members for InfoBarAutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
CheckThread() | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< InfoBarAutomationPeer > &&self) noexcept | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
final_release(std::unique_ptr< InfoBarAutomationPeer > &&self) | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline, static]
GetAutomationControlTypeCore() | InfoBarAutomationPeer |
GetBase() | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
GetClassNameCore() | InfoBarAutomationPeer |
GetInfoBar() | InfoBarAutomationPeer | [private]
GetInner() | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
GetProcessingForSeverity(winrt::InfoBarSeverity severity) | InfoBarAutomationPeer | [private]
InfoBarAutomationPeer(winrt::InfoBar const &owner) | InfoBarAutomationPeer |
IsOnThread() | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
RaiseClosedEvent(winrt::InfoBarSeverity severity, wstring_view const &displayString) | InfoBarAutomationPeer |
RaiseOpenedEvent(winrt::InfoBarSeverity severity, wstring_view const &displayString) | InfoBarAutomationPeer |
ReferenceTracker(Args &&...args) | ReferenceTracker< InfoBarAutomationPeer, winrt::implementation::InfoBarAutomationPeerT > | [inline]
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemTemplateWrapper.cpp Source File

  • Repeater

ItemTemplateWrapper.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "ItemTemplateWrapper.h"
00006 #include "RecyclePool.h"
00007 #include "ItemsRepeater.common.h"
00008
00009 ItemTemplateWrapper::ItemTemplateWrapper(winrt::DataTemplate const& dataTemplate)
00010 {
00011     m_dataTemplate = dataTemplate;
00012 }
00013
00014 ItemTemplateWrapper::ItemTemplateWrapper(winrt::DataTemplateSelector const& dataTemplateSelector)
00015 {
00016     m_dataTemplateSelector = dataTemplateSelector;
00017 }
00018
00019 winrt::DataTemplate ItemTemplateWrapper::Template()
00020 {
00021     return m_dataTemplate;
00022 }
00023
00024 void ItemTemplateWrapper::Template(winrt::DataTemplate const& value)
00025 {
00026     m_dataTemplate = value;
00027 }
00028
00029 winrt::DataTemplateSelector ItemTemplateWrapper::TemplateSelector()
00030 {
00031     return m_dataTemplateSelector;
00032 }
00033
00034 void ItemTemplateWrapper::TemplateSelector(winrt::DataTemplateSelector const& value)
00035 {
00036     m_dataTemplateSelector = value;
00037 }
00038
00039 #pragma region IElementFactory
00040
00041 winrt::UIElement ItemTemplateWrapper::GetElement(winrt::ElementFactoryGetArgs const& args)
00042 {
00043     auto selectedTemplate = m_dataTemplate ? m_dataTemplate : m_dataTemplateSelector.SelectTemplate(args.Data());
00044     // Check if selected template we got is valid
00045     if (selectedTemplate == nullptr)
00046     {
00047         // Null template, use other SelectTemplate method
00048         try
00049         {
00050             selectedTemplate = m_dataTemplateSelector.SelectTemplate(args.Data(), nullptr);
00051         }
00052         catch (winrt::hresult_error e)
00053         {
00054             // The default implementation of SelectTemplate(IInspectable item, ILayout container) throws invalid arg for null container
00055             // To not force everbody to provide an implementation of that, catch that here
00056             if (e.code().value != E_INVALIDARG)
00057             {
00058                 throw e;
00059             }
00060         }
00061
00062         if (selectedTemplate == nullptr)
00063         {
00064             // Still nullptr, fail with a reasonable message now.
00065             throw winrt::hresult_invalid_argument(L"Null encountered as data template. That is not a valid value for a data template, and can not be used.");
00066         }
00067     }
00068     winrt::RecyclePool recyclePool = RecyclePool::GetPoolInstance(selectedTemplate);
00069     winrt::UIElement element = nullptr;
00070
00071     if (recyclePool)
00072     {
00073         // try to get an element from the recycle pool.
00074         element = recyclePool.TryGetElement(L"" /* key */, args.Parent().as<winrt::FrameworkElement>());
00075     }
00076
00077     if (!element)
00078     {
00079         // no element was found in recycle pool, create a new element
00080         element = selectedTemplate.LoadContent().as<winrt::FrameworkElement>();
00081
00082         // Template returned null, so insert empty element to render nothing
00083         if (!element) {
00084             auto rectangle = winrt::Rectangle();
00085             rectangle.Width(0);
00086             rectangle.Height(0);
00087             element = rectangle;
00088         }
00089
00090         // Associate template with element
00091         RecyclePool::SetOriginTemplate(element, selectedTemplate);
00092     }
00093
00094     return element;
00095 }
00096
00097 void ItemTemplateWrapper::RecycleElement(winrt::ElementFactoryRecycleArgs const& args)
00098 {
00099     auto element = args.Element();
00100     winrt::DataTemplate selectedTemplate = m_dataTemplate?
00101         m_dataTemplate:
00102         RecyclePool::GetOriginTemplate(element);
00103     auto recyclePool = RecyclePool::GetPoolInstance(selectedTemplate);
00104     if (!recyclePool)
00105     {
00106         // No Recycle pool in the template, create one.
00107         recyclePool = winrt::make<RecyclePool>();
00108         RecyclePool::SetPoolInstance(selectedTemplate, recyclePool);
00109     }
00110
00111     recyclePool.PutElement(args.Element(), L"" /* key */, args.Parent());
00112 }
00113
00114 #pragma endregion
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/StackLayoutState.h Source File

  • Repeater

StackLayoutState.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "StackLayoutState.g.h"
00007 #include "FlowLayoutAlgorithm.h"
00008
00009 class StackLayoutState :
00010     public ReferenceTracker<StackLayoutState, winrt::implementation::StackLayoutStateT, winrt::composing>
00011 {
00012 public:
00013     void InitializeForContext(
00014         const winrt::VirtualizingLayoutContext& context,
00015         IFlowLayoutAlgorithmDelegates* callbacks);
00016     void UninitializeForContext(const winrt::VirtualizingLayoutContext& context);
00017     void OnElementMeasured(int elementIndex, double majorSize, double minorSize);
00018     void OnMeasureStart();
00019
00020     ::FlowLayoutAlgorithm& FlowAlgorithm() { return m_flowAlgorithm; }
00021     double TotalElementSize() const { return m_totalElementSize; }
00022     double MaxArrangeBounds() const { return m_maxArrangeBounds; }
00023     int TotalElementsMeasured() const { return m_totalElementsMeasured; }
00024
00025 private:
00026     ::FlowLayoutAlgorithm m_flowAlgorithm{ this };
00027     std::vector<double> m_estimationBuffer{};
00028     double m_totalElementSize{};
00029     // During the measure pass, as we measure the elements, we will keep track
00030     // of the largest arrange bounds in the non-virtualizing direction. This value
00031     // is going to be used in the calculation of the extent.
00032     double m_maxArrangeBounds{};
00033     int m_totalElementsMeasured{};
00034     static const int BufferSize = 100;
00035 };
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Interactions/SliderInteraction/SliderInteraction.cpp Source File

  • Interactions
  • SliderInteraction

SliderInteraction.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006
00007 #include "SliderInteraction.h"
00008
00009 #include "SliderInteraction.properties.cpp"
00010
00011 winrt::Orientation SliderInteraction::Orientation()
00012 {
00013     return m_orientation;
00014 }
00015
00016 void SliderInteraction::Orientation(winrt::Orientation const& value)
00017 {
00018     const auto orientation = value;
00019     if (orientation != m_orientation)
00020     {
00021         m_orientation = orientation;
00022         UpdateTransform();
00023
00024         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"Orientation"));
00025     }
00026 }
00027
00028 double SliderInteraction::Minimum()
00029 {
00030     return m_minimum;
00031 }
00032
00033 void SliderInteraction::Minimum(double value)
00034 {
00035
00036     if (value > m_maximum)
00037     {
00038         throw winrt::hresult_invalid_argument(L"Minimum cannot be larger than Maximum.");
00039     }
00040
00041     if (value != m_minimum)
00042     {
00043         m_minimum = value;
00044         UpdatePosition(std::max(m_minimum, m_position) - m_position);
00045
00046         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"Minimum"));
00047     }
00048 }
00049
00050 double SliderInteraction::Maximum()
00051 {
00052     return m_maximum;
00053 }
00054
00055 void SliderInteraction::Maximum(double value)
00056 {
00057
00058     if (value < m_minimum)
00059     {
00060         throw winrt::hresult_invalid_argument(L"Maximum cannot be smaller than Minimum.");
00061     }
00062
00063     if (value != m_maximum)
00064     {
00065         m_maximum = value;
00066         UpdatePosition(std::min(m_maximum, m_position) - m_position);
00067
00068         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"Maximum"));
00069     }
00070 }
00071
00072 double SliderInteraction::Position()
00073 {
00074     return m_position;
00075 }
00076
00077 void SliderInteraction::SmallChange(double value)
00078 {
00079
00080     if (value > m_largeChange)
00081     {
00082         throw winrt::hresult_invalid_argument(L"SmallChange value cannot be larger than LargeChange value.");
00083     }
00084
00085     if (value != m_smallChange)
00086     {
00087         m_smallChange = value;
00088         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"SmallChange"));
00089     }
00090 }
00091
00092 double SliderInteraction::SmallChange()
00093 {
00094     return m_smallChange;
00095 }
00096
00097 void SliderInteraction::LargeChange(double value)
00098 {
00099
00100     if (value < m_smallChange)
00101     {
00102         throw winrt::hresult_invalid_argument(L"LargeChange value cannot be smaller than SmallChange value.");
00103     }
00104
00105     if (value != m_largeChange)
00106     {
00107         m_largeChange = value;
00108         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"LargeChange"));
00109     }
00110 }
00111
00112 double SliderInteraction::LargeChange()
00113 {
00114     return m_largeChange;
00115 }
00116
00117 winrt::event_token SliderInteraction::PropertyChanged(winrt::PropertyChangedEventHandler const& value)
00118 {
00119     return m_propertyChangedEventSource.add(value);
00120 }
00121
00122 void SliderInteraction::PropertyChanged(winrt::event_token const& token)
00123 {
00124     m_propertyChangedEventSource.remove(token);
00125 }
00126
00127 winrt::IVectorView<winrt::RoutedEvent> SliderInteraction::GetSupportedEventsCore()
00128 {
00129     std::vector<winrt::RoutedEvent> supportedEvents;
00130
00131     // Build the list of events that we'll respond to.
00132     supportedEvents.push_back(winrt::UIElement::KeyDownEvent());
00133     supportedEvents.push_back(winrt::UIElement::PointerMovedEvent());
00134     supportedEvents.push_back(winrt::UIElement::PointerPressedEvent());
00135     supportedEvents.push_back(winrt::UIElement::PointerReleasedEvent());
00136     supportedEvents.push_back(winrt::UIElement::PointerCanceledEvent());
00137     supportedEvents.push_back(winrt::UIElement::PointerCaptureLostEvent());
00138
00139     return winrt::single_threaded_vector(std::move(supportedEvents)).GetView();
00140 }
00141
00142 void SliderInteraction::OnKeyDown(winrt::UIElement const& sender, winrt::KeyRoutedEventArgs const& args)
00143 {
00144     const auto& target = sender;
00145     const auto& keyArgs = args;
00146
00147     ConfigureTargetElement(target);
00148
00149     switch (keyArgs.Key())
00150     {
00151     case winrt::VirtualKey::Left:
00152     case winrt::VirtualKey::Up:
00153         UpdatePosition(-m_smallChange);
00154         break;
00155
00156     case winrt::VirtualKey::Right:
00157     case winrt::VirtualKey::Down:
00158         UpdatePosition(m_smallChange);
00159         break;
00160
00161     case winrt::VirtualKey::PageUp:
00162         UpdatePosition(-m_largeChange);
00163         break;
00164
00165     case winrt::VirtualKey::PageDown:
00166         UpdatePosition(m_largeChange);
00167         break;
00168
00169     case winrt::VirtualKey::Home:
00170         UpdatePosition(m_minimum - m_position);
00171         break;
00172
00173     case winrt::VirtualKey::End:
00174         UpdatePosition(m_maximum - m_position);
00175         break;
00176     }
00177 }
00178
00179 void SliderInteraction::OnPointerMoved(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00180 {
00181     if (m_hasPointerCapture)
00182     {
00183         const auto& target = sender;
00184         const auto& pointerArgs = args;
00185         const auto position = pointerArgs.GetCurrentPoint(target).Position();
00186
00187         const winrt::Point delta(m_capturePosition.X - position.X, m_capturePosition.Y - position.Y);
00188
00189         UpdatePosition(m_orientation == winrt::Orientation::Horizontal ? -delta.X : -delta.Y);
00190     }
00191 }
00192
00193 void SliderInteraction::OnPointerPressed(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00194 {
00195     const auto& target = sender;
00196     const auto& pointerArgs = args;
00197
00198     ConfigureTargetElement(target);
00199
00200     m_hasPointerCapture = target.CapturePointer(pointerArgs.Pointer());
00201     m_capturePosition = pointerArgs.GetCurrentPoint(target).Position();
00202 }
00203
00204 void SliderInteraction::OnPointerReleased(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00205 {
00206     const auto& target = sender;
00207     const auto& pointerArgs = args;
00208
00209     if (m_hasPointerCapture)
00210     {
00211         target.ReleasePointerCapture(pointerArgs.Pointer());
00212     }
00213 }
00214
00215 void SliderInteraction::OnPointerCanceled(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00216 {
00217     const auto& target = sender;
00218     const auto& pointerArgs = args;
00219
00220     if (m_hasPointerCapture)
00221     {
00222         target.ReleasePointerCapture(pointerArgs.Pointer());
00223     }
00224 }
00225
00226 void SliderInteraction::OnPointerCaptureLost(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args)
00227 {
00228     m_hasPointerCapture = false;
00229     m_capturePosition = winrt::Point();
00230 }
00231
00232 void SliderInteraction::ConfigureTargetElement(const winrt::UIElement& target)
00233 {
00234     if (!m_translateTransform)
00235     {
00236         winrt::TranslateTransform translateTransform;
00237
00238         if (m_orientation == winrt::Orientation::Horizontal)
00239         {
00240             translateTransform.X(m_position);
00241             translateTransform.Y(0.0);
00242         }
00243         else
00244         {
00245             translateTransform.X(0.0);
00246             translateTransform.Y(m_position);
00247         }
00248
00249         target.RenderTransform(translateTransform);
00250
00251         m_translateTransform.set(translateTransform);
00252     }
00253 }
00254
00255 void SliderInteraction::UpdatePosition(double delta)
00256 {
00257     auto position = std::clamp(m_position + delta, m_minimum, m_maximum);
00258     if (position != m_position)
00259     {
00260         m_position = position;
00261
00262         UpdateTransform();
00263
00264         m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(L"Position"));
00265     }
00266 }
00267
00268 void SliderInteraction::UpdateTransform()
00269 {
00270     if (m_translateTransform)
00271     {
00272         if (m_orientation == winrt::Orientation::Horizontal)
00273         {
00274             m_translateTransform.get().X(m_position);
00275             m_translateTransform.get().Y(0.0);
00276         }
00277         else
00278         {
00279             m_translateTransform.get().X(0.0);
00280             m_translateTransform.get().Y(m_position);
00281         }
00282     }
00283 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewItemInvokedEventArgs.h Source File

  • TreeView

TreeViewItemInvokedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "TreeViewItemInvokedEventArgs.g.h"
00007
00008 class TreeViewItemInvokedEventArgs :
00009     public ReferenceTracker<TreeViewItemInvokedEventArgs, winrt::implementation::TreeViewItemInvokedEventArgsT, winrt::composing, winrt::composable>
00010 {
00011 public:
00012     winrt::IInspectable InvokedItem();
00013     bool Handled();
00014     void Handled(bool value);
00015     void InvokedItem(const winrt::IInspectable& invokedItem);
00016
00017 private:
00018     bool m_Handled{false};
00019     tracker_ref<winrt::IInspectable> m_invokedItem{ this };
00020 };
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PrimitiveXamlType Member List

This is the complete list of members for PrimitiveXamlType, including all inherited members.
ActivateInstance() | XamlTypeBase |
AddDPMember(wstring_view const &name, wstring_view const &memberTypeName, winrt::DependencyProperty const &dp, bool isContent) | XamlTypeBase |
AddMember(wstring_view const &name, wstring_view const &memberTypeName, std::function< winrt::IInspectable(const winrt::IInspectable &)> getter, std::function< void(const winrt::IInspectable &, const winrt::IInspectable &)> setter, bool isContent, bool isDependencyProperty, bool isAttachable) | XamlTypeBase |
AddToMap(winrt::IInspectable const &instance, winrt::IInspectable const &key, winrt::IInspectable const &value) | XamlTypeBase |
AddToVector(winrt::IInspectable const &instance, winrt::IInspectable const &value) | XamlTypeBase |
BaseType() | XamlTypeBase |
BoxedType() | XamlTypeBase |
ContentProperty() | XamlTypeBase |
CreateFromString(winrt::hstring const &value) | XamlTypeBase |
FullName() | XamlTypeBase |
GetMember(winrt::hstring const &name) | XamlTypeBase |
IsArray() | XamlTypeBase |
IsBindable() | XamlTypeBase |
IsCollection() | XamlTypeBase |
IsConstructible() | XamlTypeBase |
IsDictionary() | XamlTypeBase |
IsMarkupExtension() | XamlTypeBase |
ItemType() | XamlTypeBase |
KeyType() | XamlTypeBase |
m_activator | XamlTypeBase | [protected]
m_addToMap | XamlTypeBase | [protected]
m_collectionAdd | XamlTypeBase | [protected]
m_contentProperty | XamlTypeBase | [protected]
m_createFromString | XamlTypeBase | [protected]
m_isBindable | XamlTypeBase | [protected]
m_isSystemType | XamlTypeBase | [protected]
m_members | XamlTypeBase | [protected]
m_typeName | XamlTypeBase | [protected]
PrimitiveXamlType(wstring_view const &typeName) | PrimitiveXamlType | [inline]
RunInitializer() | XamlTypeBase |
UnderlyingType() | XamlTypeBase |
Generated on Sun Dec 1 2024 20:53:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshVisualizer/RefreshVisualizerPrivate.idl Source File

  • PullToRefresh
  • RefreshVisualizer

RefreshVisualizerPrivate.idl

Go to the documentation of this file.
00001 ﻿namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [webhosthidden]
00006 interface IRefreshInfoProvider
00007 {
00008     void OnRefreshStarted();
00009     void OnRefreshCompleted();
00010     Boolean IsInteractingForRefresh { get; };
00011     Microsoft.UI.Composition.CompositionPropertySet CompositionProperties { get; };
00012     String InteractionRatioCompositionProperty { get; };
00013     Double ExecutionRatio { get; };
00014     event Windows.Foundation.TypedEventHandler<IRefreshInfoProvider, Object> IsInteractingForRefreshChanged;
00015     event Windows.Foundation.TypedEventHandler<IRefreshInfoProvider, MU_XC_NAMESPACE.RefreshInteractionRatioChangedEventArgs> InteractionRatioChanged;
00016     event Windows.Foundation.TypedEventHandler<IRefreshInfoProvider, Object> RefreshStarted;
00017     event Windows.Foundation.TypedEventHandler<IRefreshInfoProvider, Object> RefreshCompleted;
00018 }
00019
00020 [MUX_INTERNAL]
00021 [webhosthidden]
00022 interface IRefreshVisualizerPrivate
00023 {
00024     IRefreshInfoProvider InfoProvider { get; set; };
00025     void SetInternalPullDirection(MU_XC_NAMESPACE.RefreshPullDirection value);
00026 }
00027
00028 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealBackgroundBrush Member List

This is the complete list of members for RevealBackgroundBrush, including all inherited members.
abi_enter() | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
CheckThread() | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< RevealBackgroundBrush > &&self) noexcept | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
final_release(std::unique_ptr< RevealBackgroundBrush > &&self) | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline, static]
GetBase() | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
GetInner() | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
IsOnThread() | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< RevealBackgroundBrush, winrt::implementation::RevealBackgroundBrushT, RevealBrush > | [inline]
Generated on Sun Dec 1 2024 20:53:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/SingleSelector.cpp Source File

  • ItemsView

SingleSelector.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SingleSelector.h"
00007
00008 SingleSelector::SingleSelector()
00009 {
00010     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00011 }
00012
00013 SingleSelector::~SingleSelector()
00014 {
00015     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00016 }
00017
00018 void SingleSelector::FollowFocus(bool followFocus)
00019 {
00020     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, followFocus);
00021
00022     m_followFocus = followFocus;
00023 }
00024
00025 void SingleSelector::OnInteractedAction(winrt::IndexPath const& index, bool ctrl, bool shift)
00026 {
00027     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, ctrl, shift);
00028
00029     auto selectionModel = GetSelectionModel();
00030     selectionModel.SingleSelect(true);
00031
00032     if (!ctrl)
00033     {
00034         selectionModel.SelectAt(index);
00035     }
00036     else if (!IsSelected(index))
00037     {
00038         selectionModel.SelectAt(index);
00039     }
00040     else
00041     {
00042         selectionModel.DeselectAt(index);
00043     }
00044 }
00045
00046 void SingleSelector::OnFocusedAction(winrt::IndexPath const& index, bool ctrl, bool shift)
00047 {
00048     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, ctrl, shift);
00049
00050     auto selectionModel = GetSelectionModel();
00051     selectionModel.SingleSelect(true);
00052
00053     if (!ctrl && m_followFocus)
00054     {
00055         selectionModel.SelectAt(index);
00056     }
00057 }
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NonVirtualStackLayout Member List

This is the complete list of members for NonVirtualStackLayout, including all inherited members.
ArrangeOverride(NonVirtualizingLayoutContext context, Size finalSize) | NonVirtualStackLayout | [inline, protected]
NonVirtualizingLayout::ArrangeOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &finalSize) | NonVirtualizingLayout | [virtual]
InitializeForContextCore(winrt::LayoutContext const &context) | NonVirtualizingLayout | [virtual]
MeasureOverride(NonVirtualizingLayoutContext context, Size availableSize) | NonVirtualStackLayout | [inline, protected]
NonVirtualizingLayout::MeasureOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &availableSize) | NonVirtualizingLayout | [virtual]
NonVirtualizingLayout() | NonVirtualizingLayout |
UninitializeForContextCore(winrt::LayoutContext const &context) | NonVirtualizingLayout | [virtual]
Generated on Sun Dec 1 2024 20:53:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TextPage Member List

This is the complete list of members for TextPage, including all inherited members.
TextPage() TextPage [inline]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/InfoBarPanel.h Source File

  • InfoBar

InfoBarPanel.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "InfoBarPanel.g.h"
00006 #include "InfoBarPanel.properties.h"
00007
00008 class InfoBarPanel :
00009     public ReferenceTracker<InfoBarPanel, winrt::implementation::InfoBarPanelT>,
00010     public InfoBarPanelProperties
00011 {
00012 public:
00013     winrt::Size MeasureOverride(winrt::Size const& availableSize);
00014     winrt::Size ArrangeOverride(winrt::Size const& finalSize);
00015
00016 private:
00017     bool m_isVertical{ false };
00018 };
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewSelectedItemEdgeCasePage Member List

This is the complete list of members for NavigationViewSelectedItemEdgeCasePage, including all inherited members.
Button_click(object sender, RoutedEventArgs e) | NavigationViewSelectedItemEdgeCasePage | [inline, private]
CopyIsSelected_Click(object sender, RoutedEventArgs e) | NavigationViewSelectedItemEdgeCasePage | [inline, private]
Movies_Click(object sender, RoutedEventArgs e) | NavigationViewSelectedItemEdgeCasePage | [inline, private]
Movies_Click2(object sender, RoutedEventArgs e) | NavigationViewSelectedItemEdgeCasePage | [inline, private]
NavigationViewSelectedItemEdgeCasePage() | NavigationViewSelectedItemEdgeCasePage | [inline]
NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) | NavigationViewSelectedItemEdgeCasePage | [inline, private]
TV_Click(object sender, RoutedEventArgs e) | NavigationViewSelectedItemEdgeCasePage | [inline, private]
TV_Click2(object sender, RoutedEventArgs e) | NavigationViewSelectedItemEdgeCasePage | [inline, private]
Generated on Sun Dec 1 2024 20:54:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RecipeElementFactory Member List

This is the complete list of members for RecipeElementFactory, including all inherited members.
_groupTemplate | RecipeElementFactory | [private]
_itemTemplate | RecipeElementFactory | [private]
_pageInfo | RecipeElementFactory | [private]
_sharedRecyclePool | RecipeElementFactory | [private]
_yearTemplate | RecipeElementFactory | [private]
CreateContainer(string recycleKey) | RecipeElementFactory | [inline, private]
GetContainerType(object data) | RecipeElementFactory | [inline, private]
GetElementCore(ElementFactoryGetArgs args) | RecipeElementFactory | [inline, protected]
PrepareContainer(UIElement container, string containerType, object data) | RecipeElementFactory | [inline, private]
RecipeContainerType | RecipeElementFactory |
RecipeElementFactory(DataTemplate itemTemplate, DataTemplate groupTemplate, DataTemplate yearTemplate, PageInfo pinfo) | RecipeElementFactory | [inline]
RecipeGroupType | RecipeElementFactory |
RecycleElementCore(ElementFactoryRecycleArgs args) | RecipeElementFactory | [inline, protected]
RecyclePool | RecipeElementFactory |
YearType | RecipeElementFactory |
Generated on Sun Dec 1 2024 20:54:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/SelectionModel.cpp Source File

  • Repeater

SelectionModel.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "SelectionNode.h"
00008 #include "SelectionModel.h"
00009 #include "SelectionTreeHelper.h"
00010 #include "IndexPath.h"
00011 #include "SelectionModelSelectionChangedEventArgs.h"
00012 #include "SelectionModelChildrenRequestedEventArgs.h"
00013 #include "Vector.h"
00014 #include "SelectedItems.h"
00015 #include "CustomProperty.h"
00016
00017 #include "SelectionModel.properties.cpp"
00018
00019 SelectionModel::SelectionModel()
00020 {
00021     // Parent is null for root node.
00022     m_rootNode = std::make_shared<SelectionNode>(this, nullptr /* parent */);
00023     // Parent is null for leaf node since it is shared. This is ok since we just
00024     // use the leaf as a placeholder and never ask stuff of it.
00025     m_leafNode = std::make_shared<SelectionNode>(this, nullptr /* parent */);
00026 }
00027
00028 SelectionModel::~SelectionModel()
00029 {
00030     ClearSelection(false /*resetAnchor*/, false /*raiseSelectionChanged*/);
00031     m_rootNode = nullptr;
00032     m_leafNode = nullptr;
00033     m_selectedIndicesCached = nullptr;
00034     m_selectedItemsCached = nullptr;
00035 }
00036
00037 #pragma region ISelectionModel
00038
00039 winrt::IInspectable SelectionModel::Source()
00040 {
00041     return m_rootNode->Source();
00042 }
00043
00044 void SelectionModel::Source(winrt::IInspectable const& value)
00045 {
00046     ClearSelection(true /* resetAnchor */, false /* raiseSelectionChanged */);
00047     m_rootNode->Source(value);
00048     OnSelectionChanged();
00049     RaisePropertyChanged(L"Source");
00050 }
00051
00052 bool SelectionModel::SingleSelect()
00053 {
00054     return m_singleSelect;
00055 }
00056
00057 void SelectionModel::SingleSelect(bool value)
00058 {
00059     if (m_singleSelect != !!value)
00060     {
00061         m_singleSelect = value;
00062         auto selectedIndices = SelectedIndices();
00063
00064         // Only update selection and raise SelectionChanged event when:
00065         // - we switch from SelectionMode::Multiple to SelectionMode::Single and
00066         // - more than one item was selected at the time of the switch
00067         if (value && selectedIndices && selectedIndices.Size() > 1)
00068         {
00069             // We want to be single select, so make sure there is only
00070             // one selected item.
00071             auto firstSelectionIndexPath = selectedIndices.GetAt(0);
00072             ClearSelection(true /* resetAnchor */, false /*raiseSelectionChanged */);
00073             SelectWithPathImpl(firstSelectionIndexPath, true /* select */, true /* raiseSelectionChanged */);
00074         }
00075
00076         RaisePropertyChanged(L"SingleSelect");
00077     }
00078 }
00079
00080 winrt::IndexPath SelectionModel::AnchorIndex()
00081 {
00082     winrt::IndexPath anchor = nullptr;
00083     if (m_rootNode->AnchorIndex() >= 0)
00084     {
00085         std::vector<int> path;
00086         auto current = m_rootNode;
00087         while (current && current->AnchorIndex() >= 0)
00088         {
00089             path.emplace_back(current->AnchorIndex());
00090             current = current->GetAt(current->AnchorIndex(), false);
00091         }
00092
00093         anchor = winrt::make<IndexPath>(path);
00094     }
00095
00096     return anchor;
00097 }
00098
00099 void SelectionModel::AnchorIndex(winrt::IndexPath const& value)
00100 {
00101     if (value)
00102     {
00103         SelectionTreeHelper::TraverseIndexPath(
00104             m_rootNode,
00105             value,
00106             true, /* realizeChildren */
00107             [](std::shared_ptr<SelectionNode> currentNode, const winrt::IndexPath& path, int depth, int childIndex)
00108         {
00109             currentNode->AnchorIndex(path.GetAt(depth));
00110         }
00111         );
00112     }
00113     else
00114     {
00115         m_rootNode->AnchorIndex(-1);
00116     }
00117
00118     RaisePropertyChanged(L"AnchorIndex");
00119 }
00120
00121 winrt::IndexPath SelectionModel::SelectedIndex()
00122 {
00123     winrt::IndexPath selectedIndex = nullptr;
00124     auto selectedIndices = SelectedIndices();
00125     if (selectedIndices && selectedIndices.Size() > 0)
00126     {
00127         selectedIndex = selectedIndices.GetAt(0);
00128     }
00129
00130     return selectedIndex;
00131 }
00132
00133 void SelectionModel::SelectedIndex(winrt::IndexPath const& value)
00134 {
00135     auto isSelected = IsSelectedAt(value);
00136     if (!isSelected || !isSelected.Value())
00137     {
00138         ClearSelection(true /* resetAnchor */, false /*raiseSelectionChanged */);
00139         SelectWithPathImpl(value, true /* select */, false /* raiseSelectionChanged */);
00140         OnSelectionChanged();
00141     }
00142 }
00143
00144 winrt::IInspectable SelectionModel::SelectedItem()
00145 {
00146     winrt::IInspectable item = nullptr;
00147     auto selectedItems = SelectedItems();
00148     if (selectedItems && selectedItems.Size() > 0)
00149     {
00150         item = selectedItems.GetAt(0);
00151     }
00152
00153     return item;
00154 }
00155
00156 winrt::IVectorView<winrt::IInspectable> SelectionModel::SelectedItems()
00157 {
00158     if (!m_selectedItemsCached)
00159     {
00160         std::vector<SelectedItemInfo> selectedInfos;
00161         if (m_rootNode.get()->Source())
00162         {
00163             SelectionTreeHelper::Traverse(
00164                 m_rootNode,
00165                 false, /* realizeChildren */
00166                 [&selectedInfos](const SelectionTreeHelper::TreeWalkNodeInfo& currentInfo)
00167             {
00168                 if (currentInfo.Node->SelectedCount() > 0)
00169                 {
00170                     selectedInfos.emplace_back(SelectedItemInfo{ currentInfo.Node, currentInfo.Path });
00171                 }
00172             });
00173         }
00174
00175         // Instead of creating a dumb vector that takes up the space for all the selected items,
00176         // we create a custom VectorView implimentation that calls back using a delegate to find
00177         // the selected item at a particular index. This avoid having to create the storage and copying
00178         // needed in a dumb vector. This also allows us to expose a tree of selected nodes into an
00179         // easier to consume flat vector view of objects.
00180         auto selectedItems = winrt::make<::SelectedItems<winrt::IInspectable>>(
00181             selectedInfos,
00182             [](const std::vector<SelectedItemInfo>& infos, unsigned int index) // callback for GetAt(index)
00183         {
00184             unsigned int currentIndex = 0;
00185             winrt::IInspectable item{ nullptr };
00186             for (const auto& info : infos)
00187             {
00188                 if (const auto node = info.Node.lock())
00189                 {
00190                     const unsigned int currentCount = node->SelectedCount();
00191                     if (index >= currentIndex && index < currentIndex + currentCount)
00192                     {
00193                         int targetIndex = node->SelectedIndices().at(index - currentIndex);
00194                         item = node->ItemsSourceView().GetAt(targetIndex);
00195                         break;
00196                     }
00197
00198                     currentIndex += currentCount;
00199                 }
00200                 else
00201                 {
00202                     throw winrt::hresult_error(E_FAIL, L"selection has changed since SelectedItems property was read.");
00203                 }
00204             }
00205
00206             return item;
00207         });
00208         m_selectedItemsCached = selectedItems;
00209     }
00210
00211     return m_selectedItemsCached;
00212 }
00213
00214 winrt::IVectorView<winrt::IndexPath> SelectionModel::SelectedIndices()
00215 {
00216     if (!m_selectedIndicesCached)
00217     {
00218         std::vector<SelectedItemInfo> selectedInfos;
00219         SelectionTreeHelper::Traverse(
00220             m_rootNode,
00221             false, /* realizeChildren */
00222             [&selectedInfos](const SelectionTreeHelper::TreeWalkNodeInfo& currentInfo)
00223         {
00224             if (currentInfo.Node->SelectedCount() > 0)
00225             {
00226                 selectedInfos.emplace_back(SelectedItemInfo{ currentInfo.Node, currentInfo.Path });
00227             }
00228         });
00229
00230         // Instead of creating a dumb vector that takes up the space for all the selected indices,
00231         // we create a custom VectorView implimentation that calls back using a delegate to find
00232         // the IndexPath at a particular index. This avoid having to create the storage and copying
00233         // needed in a dumb vector. This also allows us to expose a tree of selected nodes into an
00234         // easier to consume flat vector view of IndexPaths.
00235         auto indices = winrt::make<::SelectedItems<winrt::IndexPath>>(
00236             selectedInfos,
00237             [](const std::vector<SelectedItemInfo>& infos, unsigned int index) // callback for GetAt(index)
00238         {
00239             unsigned int currentIndex = 0;
00240             winrt::IndexPath path{ nullptr };
00241             for (const auto info : infos)
00242             {
00243                 if (const auto node = info.Node.lock())
00244                 {
00245                     const unsigned int currentCount = node->SelectedCount();
00246                     if (index >= currentIndex && index < currentIndex + currentCount)
00247                     {
00248                         int targetIndex = node->SelectedIndices().at(index - currentIndex);
00249                         path = winrt::get_self<IndexPath>(info.Path)->CloneWithChildIndex(targetIndex);
00250                         break;
00251                     }
00252
00253                     currentIndex += currentCount;
00254                 }
00255                 else
00256                 {
00257                     throw winrt::hresult_error(E_FAIL, L"selection has changed since SelectedIndices property was read.");
00258                 }
00259             }
00260
00261             return path;
00262         });
00263         m_selectedIndicesCached = indices;
00264     }
00265
00266     return m_selectedIndicesCached;
00267 }
00268
00269 void SelectionModel::SetAnchorIndex(int32_t index)
00270 {
00271     AnchorIndex(winrt::make<IndexPath>(index));
00272 }
00273
00274 void SelectionModel::SetAnchorIndex(int groupIndex, int itemIndex)
00275 {
00276     AnchorIndex(winrt::make<IndexPath>(groupIndex, itemIndex));
00277 }
00278
00279 void SelectionModel::Select(int32_t index)
00280 {
00281     SelectImpl(index, true /* select */);
00282 }
00283
00284 void SelectionModel::Select(int groupIndex, int itemIndex)
00285 {
00286     SelectWithGroupImpl(groupIndex, itemIndex, true /* select */);
00287 }
00288
00289 void SelectionModel::SelectAt(winrt::IndexPath const& index)
00290 {
00291     SelectWithPathImpl(index, true /* select */, true /* raiseSelectionChanged */);
00292 }
00293
00294 void SelectionModel::Deselect(int32_t index)
00295 {
00296     SelectImpl(index, false /* select */);
00297 }
00298
00299 void SelectionModel::Deselect(int groupIndex, int itemIndex)
00300 {
00301     SelectWithGroupImpl(groupIndex, itemIndex, false /* select */);
00302 }
00303
00304 void SelectionModel::DeselectAt(winrt::IndexPath const& index)
00305 {
00306     SelectWithPathImpl(index, false /* select */, true /* raiseSelectionChanged */);
00307 }
00308
00309 winrt::IReference<bool> SelectionModel::IsSelected(int index)
00310 {
00311     MUX_ASSERT(index >= 0);
00312     auto isSelected = m_rootNode->IsSelectedWithPartial(index);
00313     return isSelected;
00314 }
00315
00316 winrt::IReference<bool> SelectionModel::IsSelected(int groupIndex, int itemIndex)
00317 {
00318     MUX_ASSERT(groupIndex >= 0 && itemIndex >= 0);
00319     winrt::IReference<bool> isSelected = false;
00320     auto childNode = m_rootNode->GetAt(groupIndex, false /*realizeChild*/);
00321     if (childNode)
00322     {
00323         isSelected = childNode->IsSelectedWithPartial(itemIndex);
00324     }
00325
00326     return isSelected;
00327 }
00328
00329 winrt::IReference<bool> SelectionModel::IsSelectedAt(winrt::IndexPath const& index)
00330 {
00331     const auto path = index;
00332     MUX_ASSERT(winrt::get_self<IndexPath>(path)->IsValid());
00333     bool isRealized = true;
00334     auto node = m_rootNode;
00335     for (int i = 0; i < path.GetSize() - 1; i++)
00336     {
00337         const auto childIndex = path.GetAt(i);
00338         node = node->GetAt(childIndex, false /* realizeChild */);
00339         if (!node)
00340         {
00341             isRealized = false;
00342             break;
00343         }
00344     }
00345
00346     winrt::IReference<bool> isSelected = false;
00347     if (isRealized)
00348     {
00349         const auto size = path.GetSize();
00350         if (size == 0)
00351         {
00352             isSelected = SelectionNode::ConvertToNullableBool(node->EvaluateIsSelectedBasedOnChildrenNodes());
00353         }
00354         else
00355         {
00356             isSelected = node->IsSelectedWithPartial(path.GetAt(size - 1));
00357         }
00358     }
00359
00360     return isSelected;
00361 }
00362
00363 void SelectionModel::SelectRangeFromAnchor(int32_t index)
00364 {
00365     SelectRangeFromAnchorImpl(index, true /* select */ );
00366 }
00367
00368 void SelectionModel::SelectRangeFromAnchor(int endGroupIndex, int endItemIndex)
00369 {
00370     SelectRangeFromAnchorWithGroupImpl(endGroupIndex, endItemIndex, true /* select */);
00371 }
00372
00373 void SelectionModel::SelectRangeFromAnchorTo(winrt::IndexPath const& index)
00374 {
00375     SelectRangeImpl(AnchorIndex(), index, true /* select */);
00376 }
00377
00378 void SelectionModel::DeselectRangeFromAnchor(int32_t index)
00379 {
00380     SelectRangeFromAnchorImpl(index, false /* select */);
00381 }
00382
00383 void SelectionModel::DeselectRangeFromAnchor(int endGroupIndex, int endItemIndex)
00384 {
00385     SelectRangeFromAnchorWithGroupImpl(endGroupIndex, endItemIndex, false /* select */);
00386 }
00387
00388 void SelectionModel::DeselectRangeFromAnchorTo(winrt::IndexPath const& index)
00389 {
00390     SelectRangeImpl(AnchorIndex(), index, false /* select */);
00391 }
00392
00393
00394 void SelectionModel::SelectRange(winrt::IndexPath const& start, winrt::IndexPath const& end)
00395 {
00396     SelectRangeImpl(start, end, true /* select */);
00397 }
00398
00399 void SelectionModel::DeselectRange(winrt::IndexPath const& start, winrt::IndexPath const& end)
00400 {
00401     SelectRangeImpl(start, end, false /* select */);
00402 }
00403
00404 void SelectionModel::SelectAll()
00405 {
00406     SelectionTreeHelper::Traverse(
00407         m_rootNode,
00408         true, /* realizeChildren */
00409         [](const SelectionTreeHelper::TreeWalkNodeInfo& info)
00410     {
00411         if (info.Node->DataCount() > 0)
00412         {
00413             info.Node->SelectAll();
00414         }
00415     });
00416
00417     OnSelectionChanged();
00418 }
00419
00420 // This function assumes a flat list data source.
00421 // This allows us to avoid devirtualizing all the items.
00422 void SelectionModel::SelectAllFlat()
00423 {
00424     m_rootNode->SelectAll();
00425     OnSelectionChanged();
00426 }
00427
00428 void SelectionModel::ClearSelection()
00429 {
00430     ClearSelection(true /*resetAnchor*/, true /* raiseSelectionChanged */);
00431 }
00432
00433 #pragma endregion
00434
00435 #pragma region ICustomPropertyProvider
00436
00437 winrt::TypeName SelectionModel::Type()
00438 {
00439     auto outer = get_strong().as<winrt::IInspectable>();
00440     winrt::TypeName typeName;
00441     typeName.Kind = winrt::TypeKind::Metadata;
00442     typeName.Name = winrt::get_class_name(outer);
00443     return typeName;
00444 }
00445
00446 winrt::ICustomProperty SelectionModel::GetCustomProperty(hstring const& name)
00447 {
00448     // Exposing SelectedItem through ICustomPropertyProvider so that Binding can work
00449     // for SelectedItem. This is requried since SelectedItem is not a dependency proeprty and
00450     // is evaluated when requested.
00451     if (name == L"SelectedItem")
00452     {
00453         auto selectedItemCustomProperty = winrt::make<CustomProperty>(
00454             L"SelectedItem" /* name */,
00455             winrt::xaml_typename<winrt::IInspectable>() /* typeName */,
00456             [](winrt::IInspectable const& target) { return target.as<winrt::SelectionModel>().SelectedItem(); } /* getter */,
00457             nullptr /* setter */);
00458         return selectedItemCustomProperty;
00459     }
00460
00461     return nullptr;
00462 }
00463
00464 winrt::ICustomProperty SelectionModel::GetIndexedProperty(hstring const& name, winrt::TypeName const& type)
00465 {
00466     // No indexed properties exposed via ICustomPropertyProvider
00467     return nullptr;
00468 }
00469
00470 hstring SelectionModel::GetStringRepresentation()
00471 {
00472     return L"SelectionModel";
00473 }
00474
00475 #pragma endregion
00476
00477 #pragma region INotifyPropertyChanged
00478
00479 winrt::event_token SelectionModel::PropertyChanged(winrt::PropertyChangedEventHandler const& value)
00480 {
00481     return m_propertyChangedEventSource.add(value);
00482 }
00483
00484 void SelectionModel::PropertyChanged(winrt::event_token const& token)
00485 {
00486     m_propertyChangedEventSource.remove(token);
00487 }
00488
00489 #pragma endregion
00490
00491 #pragma region ISelectionModelProtected
00492
00493 void SelectionModel::OnPropertyChanged(winrt::hstring const& propertyName)
00494 {
00495     RaisePropertyChanged(propertyName);
00496 }
00497
00498 #pragma endregion
00499
00500 void SelectionModel::RaisePropertyChanged(std::wstring_view const& name)
00501 {
00502     m_propertyChangedEventSource(*this, winrt::PropertyChangedEventArgs(name));
00503 }
00504
00505 void SelectionModel::OnSelectionInvalidatedDueToCollectionChange()
00506 {
00507     auto scopeGuard = gsl::finally([this]()
00508     {
00509         m_selectionInvalidatedDueToCollectionChange = false;
00510     });
00511
00512     m_selectionInvalidatedDueToCollectionChange = true;
00513     OnSelectionChanged();
00514 }
00515
00516 winrt::IInspectable SelectionModel::ResolvePath(const winrt::IInspectable& data, const winrt::IndexPath& dataIndexPath)
00517 {
00518     winrt::IInspectable resolved = nullptr;
00519     // Raise ChildrenRequested event if there is a handler
00520     if (m_childrenRequestedEventSource)
00521     {
00522         if (!m_childrenRequestedEventArgs)
00523         {
00524             m_childrenRequestedEventArgs = tracker_ref<winrt::SelectionModelChildrenRequestedEventArgs>(this, winrt::make<SelectionModelChildrenRequestedEventArgs>(data, dataIndexPath, false /*throwOnAccess*/));
00525         }
00526         else
00527         {
00528             winrt::get_self<SelectionModelChildrenRequestedEventArgs>(m_childrenRequestedEventArgs.get())->Initialize(data, dataIndexPath, false /*throwOnAccess*/);
00529         }
00530
00531         m_childrenRequestedEventSource(*this, m_childrenRequestedEventArgs.get());
00532         resolved = m_childrenRequestedEventArgs.get().Children();
00533
00534         // Clear out the values in the args so that it cannot be used after the event handler call.
00535         winrt::get_self<SelectionModelChildrenRequestedEventArgs>(m_childrenRequestedEventArgs.get())->Initialize(nullptr, nullptr, true /*throwOnAccess*/);
00536     }
00537     else
00538     {
00539         // No handlers for ChildrenRequested event. If data is of type ItemsSourceView
00540         // or a type that can be used to create a ItemsSourceView using ItemsSourceView::CreateFrom, then we can
00541         // auto-resolve that as the child. If not, then we consider the value as a leaf. This is to
00542         // avoid having to provide the event handler for the most common scenarios. If the app dev does
00543         // not want this default behavior, they can provide the handler to override.
00544         if (data.try_as<winrt::ItemsSourceView>() ||
00545             data.try_as<winrt::IBindableVector>() ||
00546             data.try_as<winrt::IIterable<winrt::IInspectable>>() ||
00547             data.try_as<winrt::IBindableIterable>())
00548         {
00549             resolved = data;
00550         }
00551     }
00552
00553     return resolved;
00554 }
00555
00556 void SelectionModel::ClearSelection(bool resetAnchor, bool raiseSelectionChanged)
00557 {
00558     SelectionTreeHelper::Traverse(
00559         m_rootNode,
00560         false, /* realizeChildren */
00561         [](const SelectionTreeHelper::TreeWalkNodeInfo& info)
00562     {
00563         info.Node->Clear();
00564     });
00565
00566     if (resetAnchor)
00567     {
00568         AnchorIndex(nullptr);
00569     }
00570
00571     if (raiseSelectionChanged)
00572     {
00573         OnSelectionChanged();
00574     }
00575 }
00576
00577 void SelectionModel::OnSelectionChanged()
00578 {
00579     m_selectedIndicesCached = nullptr;
00580     m_selectedItemsCached = nullptr;
00581
00582     // Raise SelectionChanged event
00583     if (m_selectionChangedEventSource)
00584     {
00585         if (!m_selectionChangedEventArgs)
00586         {
00587             m_selectionChangedEventArgs = tracker_ref<winrt::SelectionModelSelectionChangedEventArgs>(this, winrt::make<SelectionModelSelectionChangedEventArgs>());
00588         }
00589
00590         m_selectionChangedEventSource(*this, m_selectionChangedEventArgs.get());
00591     }
00592
00593     RaisePropertyChanged(L"SelectedIndex");
00594     RaisePropertyChanged(L"SelectedIndices");
00595     if (m_rootNode->Source())
00596     {
00597         RaisePropertyChanged(L"SelectedItem");
00598         RaisePropertyChanged(L"SelectedItems");
00599     }
00600 }
00601
00602 void SelectionModel::SelectImpl(int index, bool select)
00603 {
00604     if (m_rootNode->IsSelected(index) != select)
00605     {
00606         if (m_singleSelect)
00607         {
00608             ClearSelection(true /*resetAnchor*/, false /* raiseSelectionChanged */);
00609         }
00610         const auto selected = m_rootNode->Select(index, select);
00611         if (selected)
00612         {
00613             AnchorIndex(winrt::make<IndexPath>(index));
00614         }
00615         OnSelectionChanged();
00616     }
00617 }
00618
00619 void SelectionModel::SelectWithGroupImpl(int groupIndex, int itemIndex, bool select)
00620 {
00621     if (m_singleSelect)
00622     {
00623         ClearSelection(true /*resetAnchor*/, false /* raiseSelectionChanged */);
00624     }
00625
00626     const auto childNode = m_rootNode->GetAt(groupIndex, true /* realize */);
00627     const auto selected = childNode->Select(itemIndex, select);
00628     if (selected)
00629     {
00630         AnchorIndex(winrt::make<IndexPath>(groupIndex, itemIndex));
00631     }
00632
00633     OnSelectionChanged();
00634 }
00635
00636 void SelectionModel::SelectWithPathImpl(const winrt::IndexPath& index, bool select, bool raiseSelectionChanged)
00637 {
00638     bool newSelection = true;
00639
00640     // Handle single select differently as comparing indexpaths is faster
00641     if (m_singleSelect)
00642     {
00643         if (auto const selectedIndex = SelectedIndex())
00644         {
00645             // If paths are equal and we want to select, skip everything and do nothing
00646             if (select && selectedIndex.CompareTo(index) == 0)
00647             {
00648                 newSelection = false;
00649             }
00650         }
00651         else
00652         {
00653             // If we are in single select and selectedIndex is null, deselecting is not a new change.
00654             // Selecting something is a new change, so set flag to appropriate value here.
00655             newSelection = select;
00656         }
00657     }
00658
00659     // Selection is actually different from previous one, so update.
00660     if (newSelection)
00661     {
00662         bool selected = false;
00663         // If we unselect something, raise event any way, otherwise changedSelection is false
00664         bool changedSelection = false;
00665
00666         // We only need to clear selection by walking the data structure from the beginning when:
00667         // - we are in single selection mode and
00668         // - want to select something.
00669         //
00670         // If we want to unselect something we unselect it directly in TraverseIndexPath below and raise the SelectionChanged event
00671         // if required.
00672         if (m_singleSelect && select)
00673         {
00674             ClearSelection(true /*resetAnchor*/, false /* raiseSelectionChanged */);
00675         }
00676
00677         SelectionTreeHelper::TraverseIndexPath(
00678             m_rootNode,
00679             index,
00680             true, /* realizeChildren */
00681             [&selected, &select, &changedSelection](std::shared_ptr<SelectionNode> currentNode, const winrt::IndexPath& path, int depth, int childIndex)
00682             {
00683                 if (depth == path.GetSize() - 1)
00684                 {
00685                     if (currentNode->IsSelected(childIndex) != select)
00686                     {
00687                         // Node has different value then we want to set, so lets update!
00688                         changedSelection = true;
00689                     }
00690                     selected = currentNode->Select(childIndex, select);
00691                 }
00692             }
00693         );
00694
00695         if (selected)
00696         {
00697             AnchorIndex(index);
00698         }
00699
00700         // The walk tree operation can change the indices, and the next time it get's read,
00701         // we would throw an exception. That's what we are preventing with next two lines
00702         m_selectedIndicesCached = nullptr;
00703         m_selectedItemsCached = nullptr;
00704
00705         if (raiseSelectionChanged && changedSelection)
00706         {
00707             OnSelectionChanged();
00708         }
00709     }
00710 }
00711
00712 void SelectionModel::SelectRangeFromAnchorImpl(int index, bool select)
00713 {
00714     int anchorIndex = 0;
00715     const auto anchor = AnchorIndex();
00716     if (anchor)
00717     {
00718         MUX_ASSERT(anchor.GetSize() == 1);
00719         anchorIndex = anchor.GetAt(0);
00720     }
00721
00722     const bool selected = m_rootNode->SelectRange(IndexRange(anchorIndex, index), select);
00723     if (selected)
00724     {
00725         OnSelectionChanged();
00726     }
00727 }
00728
00729 void SelectionModel::SelectRangeFromAnchorWithGroupImpl(int endGroupIndex, int endItemIndex, bool select)
00730 {
00731     int startGroupIndex = 0;
00732     int startItemIndex = 0;
00733     auto anchorIndex = AnchorIndex();
00734     if (anchorIndex)
00735     {
00736         MUX_ASSERT(anchorIndex.GetSize() == 2);
00737         startGroupIndex = anchorIndex.GetAt(0);
00738         startItemIndex = anchorIndex.GetAt(1);
00739     }
00740
00741     // Make sure start > end
00742     if (startGroupIndex > endGroupIndex ||
00743         (startGroupIndex == endGroupIndex && startItemIndex > endItemIndex))
00744     {
00745         int temp = startGroupIndex;
00746         startGroupIndex = endGroupIndex;
00747         endGroupIndex = temp;
00748         temp = startItemIndex;
00749         startItemIndex = endItemIndex;
00750         endItemIndex = temp;
00751     }
00752
00753     bool selected = false;
00754     for (int groupIdx = startGroupIndex; groupIdx <= endGroupIndex; groupIdx++)
00755     {
00756         const auto groupNode = m_rootNode->GetAt(groupIdx, true /* realizeChild */);
00757         const int startIndex = groupIdx == startGroupIndex ? startItemIndex : 0;
00758         const int endIndex = groupIdx == endGroupIndex ? endItemIndex : groupNode->DataCount() - 1;
00759         selected |= groupNode->SelectRange(IndexRange(startIndex, endIndex), select);
00760     }
00761
00762     if (selected)
00763     {
00764         OnSelectionChanged();
00765     }
00766 }
00767
00768 void SelectionModel::SelectRangeImpl(const winrt::IndexPath& start, const winrt::IndexPath& end, bool select)
00769 {
00770     auto winrtStart = start;
00771     auto winrtEnd = end;
00772
00773     int32_t compareIndexPaths = winrtEnd.CompareTo(winrtStart);
00774
00775     if (compareIndexPaths == 0)
00776     {
00777         if (select)
00778         {
00779             SelectAt(winrtStart);
00780         }
00781         else
00782         {
00783             DeselectAt(winrtStart);
00784         }
00785     }
00786     else
00787     {
00788         // Make sure start <= end
00789         if (compareIndexPaths == -1)
00790         {
00791             auto temp = winrtStart;
00792             winrtStart = winrtEnd;
00793             winrtEnd = temp;
00794         }
00795
00796         // Note: Since we do not know the depth of the tree, we have to walk to each leaf
00797         SelectionTreeHelper::TraverseRangeRealizeChildren(
00798             m_rootNode,
00799             winrtStart,
00800             winrtEnd,
00801             [select](const SelectionTreeHelper::TreeWalkNodeInfo& info)
00802         {
00803             if (info.Node->DataCount() == 0)
00804             {
00805                 // Select only leaf nodes
00806                 info.ParentNode->Select(info.Path.GetAt(info.Path.GetSize() - 1), select);
00807             }
00808         });
00809     }
00810
00811     OnSelectionChanged();
00812 }
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SwipeControl/SwipeTestHooks.h Source File

  • SwipeControl

SwipeTestHooks.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SwipeControl.h"
00007
00008 #include "SwipeTestHooks.g.h"
00009
00010 class SwipeTestHooks :
00011     public winrt::implementation::SwipeTestHooksT<SwipeTestHooks>
00012 {
00013 public:
00014     static com_ptr<SwipeTestHooks> GetGlobalTestHooks()
00015     {
00016         return s_testHooks;
00017     }
00018
00019     static com_ptr<SwipeTestHooks> EnsureGlobalTestHooks();
00020
00021     static winrt::SwipeControl GetLastInteractedWithSwipeControl();
00022     static bool GetIsOpen(const winrt::SwipeControl& swipeControl);
00023     static bool GetIsIdle(const winrt::SwipeControl& swipeControl);
00024
00025     static void NotifyLastInteractedWithSwipeControlChanged();
00026     static winrt::event_token LastInteractedWithSwipeControlChanged(winrt::TypedEventHandler<winrt::IInspectable, winrt::IInspectable> const& value);
00027     static void LastInteractedWithSwipeControlChanged(winrt::event_token const& token);
00028
00029     static void NotifyOpenedStatusChanged(const winrt::SwipeControl& sender);
00030     static winrt::event_token OpenedStatusChanged(winrt::TypedEventHandler<winrt::SwipeControl, winrt::IInspectable> const& value);
00031     static void OpenedStatusChanged(winrt::event_token const& token);
00032
00033     static void NotifyIdleStatusChanged(const winrt::SwipeControl& sender);
00034     static winrt::event_token IdleStatusChanged(winrt::TypedEventHandler<winrt::SwipeControl, winrt::IInspectable> const& value);
00035     static void IdleStatusChanged(winrt::event_token const& token);
00036
00037 private:
00038     static com_ptr<SwipeTestHooks> s_testHooks;
00039     winrt::event<winrt::TypedEventHandler<winrt::IInspectable, winrt::IInspectable>> m_lastInteractedWithSwipeControlChangedEventSource;
00040     winrt::event<winrt::TypedEventHandler<winrt::SwipeControl, winrt::IInspectable>> m_openedStatusChangedEventSource;
00041     winrt::event<winrt::TypedEventHandler<winrt::SwipeControl, winrt::IInspectable>> m_idleStatusChangedEventSource;
00042 };
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/TestUI/NavigationViewAxeTestPage.xaml.cs Source File

  • NavigationView
  • TestUI

NavigationViewAxeTestPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.IO;
00007 using System.Linq;
00008 using System.Runtime.InteropServices.WindowsRuntime;
00009 using Windows.Foundation;
00010 using Windows.Foundation.Collections;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Controls;
00013 using Microsoft.UI.Xaml.Controls.Primitives;
00014 using Microsoft.UI.Xaml.Data;
00015 using Microsoft.UI.Xaml.Input;
00016 using Microsoft.UI.Xaml.Media;
00017 using Microsoft.UI.Xaml.Navigation;
00018
00019 namespace MUXControlsTestApp
00020 {
00021     [AxeScanTestPage(Name = "NavigationView-Axe")]
00022     public sealed partial class NavigationViewAxeTestPage : TestPage
00023     {
00024         public NavigationViewAxeTestPage()
00025         {
00026             this.InitializeComponent();
00027         }
00028     }
00029 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarEraserButton.h Source File

  • InkToolBar

InkToolBarEraserButton.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarEraserButton.g.h"
00011 #include "InkToolBarEraserButton.properties.h"
00012
00013 #include "InkToolBarToolButton.h"
00014
00015 class InkToolBarEraserButton :
00016     public winrt::implementation::InkToolBarEraserButtonT<InkToolBarEraserButton, InkToolBarToolButton>,
00017     public InkToolBarEraserButtonProperties
00018 {
00019 public:
00020     ForwardRefToBaseReferenceTracker(InkToolBarToolButton)
00021
00022     // These functions are ambiguous with InkToolBarToolButton, disambiguate
00023     using InkToolBarEraserButtonProperties::EnsureProperties;
00024     using InkToolBarEraserButtonProperties::ClearProperties;
00025
00026     winrt::InkToolBarEraserKind SelectedEraser() { winrt::throw_hresult(E_NOTIMPL); }
00027     void SelectedEraser(winrt::InkToolBarEraserKind value) { winrt::throw_hresult(E_NOTIMPL); }
00028     bool IsClearAllVisible() { winrt::throw_hresult(E_NOTIMPL); }
00029     void IsClearAllVisible(bool value) { winrt::throw_hresult(E_NOTIMPL); }
00030     bool IsStrokeEraserVisible() { winrt::throw_hresult(E_NOTIMPL); }
00031     void IsStrokeEraserVisible(bool value) { winrt::throw_hresult(E_NOTIMPL); }
00032     bool ArePrecisionErasersVisible() { winrt::throw_hresult(E_NOTIMPL); }
00033     void ArePrecisionErasersVisible(bool value) { winrt::throw_hresult(E_NOTIMPL); }
00034 };
00035
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioButtons/InteractionTests/RadioButtonsTests.cs Source File

  • RadioButtons
  • InteractionTests

RadioButtonsTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004
00005 using System;
00006
00007 using Common;
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00009 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00010 using System.Collections.Generic;
00011
00012 using WEX.TestExecution;
00013 using WEX.TestExecution.Markup;
00014 using WEX.Logging.Interop;
00015
00016 using Microsoft.Windows.Apps.Test.Automation;
00017 using Microsoft.Windows.Apps.Test.Foundation;
00018 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00019 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00020 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00021 using static Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.RadioButtonsTestPageElements;
00022
00023 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00024 {
00025     [TestClass]
00026     public class RadioButtonsTests
00027     {
00028         RadioButtonsTestPageElements elements;
00029
00030         [ClassInitialize]
00031         [TestProperty("RunAs", "User")]
00032         [TestProperty("Classification", "Integration")]
00033         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00034         [TestProperty("Ignore", "True")] //Task 26103056: MUXC RadioButtons test is unreliable. They have been disabled.
00035         public static void ClassInitialize(TestContext testContext)
00036         {
00037             TestEnvironment.Initialize(testContext);
00038         }
00039
00040         public void TestCleanup()
00041         {
00042             TestCleanupHelper.Cleanup();
00043         }
00044
00045         [TestMethod]
00046         [TestProperty("TestSuite", "A")]
00047         public void SelectionTest()
00048         {
00049             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00050             {
00051                 elements = new RadioButtonsTestPageElements();
00052                 SetItemType(RadioButtonsSourceType.RadioButton);
00053                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00054                 {
00055                     SetSource(location);
00056
00057                     SelectByIndex(1);
00058                     VerifySelectedIndex(1);
00059                     RadioButton item1 = FindElement.ByName<RadioButton>("Radio Button 1");
00060                     Verify.IsTrue(item1.IsSelected);
00061
00062                     SelectByItem(3);
00063                     VerifySelectedIndex(3);
00064                     RadioButton item3 = FindElement.ByName<RadioButton>("Radio Button 3");
00065                     Verify.IsTrue(item3.IsSelected);
00066                     Verify.IsFalse(item1.IsSelected);
00067                 }
00068             }
00069         }
00070
00071         [TestMethod]
00072         [TestProperty("TestSuite", "B")]
00073         public void SelectByItem()
00074         {
00075             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00076             {
00077                 elements = new RadioButtonsTestPageElements();
00078                 SetItemType(RadioButtonsSourceType.RadioButton);
00079                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00080                 {
00081                     SetSource(location);
00082                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00083                     {
00084                         if (location == RadioButtonsSourceLocation.Items && type == RadioButtonsSourceType.String)
00085                         {
00086                             // This is broken due to issue #1674. The items collection does not have a way to compare
00087                             // boxed strings for equality.
00088                             continue;
00089                         }
00090
00091                         SetItemType(type);
00092
00093                         SelectByItem(1);
00094                         VerifySelectedIndex(1);
00095
00096                         SelectByItem(3);
00097                         VerifySelectedIndex(3);
00098                     }
00099                 }
00100             }
00101         }
00102
00103         [TestMethod]
00104         [TestProperty("TestSuite", "C")]
00105         public void FocusComingFromAnotherRepeaterTest()
00106         {
00107             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtonsFocus Test" }))
00108             {
00109                 var elements = new RadioButtonsFocusTestPageElements();
00110
00111                 // Select items
00112                 SelectByIndex(1, false);
00113                 SelectByIndex(2, true);
00114
00115                 // Verify selection
00116                 VerifySelectedIndex(1, false);
00117                 VerifySelectedIndex(2, true);
00118
00119                 VerifyRadioButtonsHasFocus(true, false);
00120
00121                 // Move focus to second RadioButtons control by pressing TAB
00122                 KeyboardHelper.PressKey(Key.Tab);
00123
00124                 // Verify that
00125                 // - the first RadioButtons control no longer has focus and
00126                 // - the third radio button of the second RadioButtons control now has focus
00127                 VerifyRadioButtonsHasFocus(false, false);
00128                 VerifySelectedFocusedIndex(2, true);
00129
00130                 // Move focus to the first RadioButtons control by pressing TAB again
00131                 KeyboardHelper.PressKey(Key.Tab, ModifierKey.Shift);
00132
00133                 // Verify that the second radio button is still selected and now has focus
00134                 VerifySelectedFocusedIndex(1, false);
00135
00136                 void SelectByIndex(int index, bool checkRadioButtons2)
00137                 {
00138                     if (checkRadioButtons2)
00139                     {
00140                         elements.GetIndexToSelectTextBox2().SetValue(index.ToString());
00141                         elements.GetSelectByIndexButton2().Click();
00142                     }
00143                     else
00144                     {
00145                         elements.GetIndexToSelectTextBox1().SetValue(index.ToString());
00146                         elements.GetSelectByIndexButton1().Click();
00147                     }
00148                 }
00149
00150                 void VerifySelectedIndex(int index, bool checkRadioButtons2)
00151                 {
00152                     if (checkRadioButtons2)
00153                     {
00154                         Verify.AreEqual(index, Int32.Parse(elements.GetSelectedIndexTextBlock2().DocumentText), $"RadioButton with index {index} should have been selected.");
00155                     }
00156                     else
00157                     {
00158                         Verify.AreEqual(index, Int32.Parse(elements.GetSelectedIndexTextBlock1().DocumentText), $"RadioButton with index {index} should have been selected.");
00159                     }
00160                 }
00161
00162                 void VerifyRadioButtonsHasFocus(bool hasFocus, bool checkRadioButtons2)
00163                 {
00164                     if (checkRadioButtons2)
00165                     {
00166                         Verify.AreEqual(hasFocus, elements.GetRadioButtons2HasFocusCheckBox().ToggleState == ToggleState.On);
00167                     }
00168                     else
00169                     {
00170                         Verify.AreEqual(hasFocus, elements.GetRadioButtons1HasFocusCheckBox().ToggleState == ToggleState.On);
00171                     }
00172                 }
00173
00174                 void VerifyFocusedIndex(int index, bool checkRadioButtons2)
00175                 {
00176                     if (checkRadioButtons2)
00177                     {
00178                         Verify.AreEqual(index, Int32.Parse(elements.GetFocusedIndexTextBlock2().DocumentText), $"RadioButton with index {index} should have focus.");
00179                     }
00180                     else
00181                     {
00182                         Verify.AreEqual(index, Int32.Parse(elements.GetFocusedIndexTextBlock1().DocumentText), $"RadioButton with index {index} should have focus.");
00183                     }
00184
00185                 }
00186
00187                 void VerifySelectedFocusedIndex(int index, bool checkRadioButtons2)
00188                 {
00189                     VerifySelectedIndex(index, checkRadioButtons2);
00190                     VerifyFocusedIndex(index, checkRadioButtons2);
00191                 }
00192             }
00193         }
00194
00195         [TestMethod]
00196         [TestProperty("TestSuite", "A")]
00197         public void BasicKeyboardTest()
00198         {
00199             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00200             {
00201                 elements = new RadioButtonsTestPageElements();
00202                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00203                 {
00204                     SetSource(location);
00205                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00206                     {
00207                         bool useBackup = type == RadioButtonsSourceType.String;
00208                         SetItemType(type);
00209                         TapOnItem(3, useBackup);
00210                         VerifySelectedFocusedIndex(3);
00211                         KeyboardHelper.PressKey(Key.Down);
00212                         VerifySelectedFocusedIndex(4);
00213                         KeyboardHelper.PressKey(Key.Up);
00214                         VerifySelectedFocusedIndex(3);
00215                         KeyboardHelper.PressKey(Key.Left);
00216                         VerifySelectedFocusedIndex(3);
00217                         KeyboardHelper.PressKey(Key.Right);
00218                         VerifySelectedFocusedIndex(3);
00219
00220                         TapOnItem(0, useBackup);
00221                         VerifySelectedFocusedIndex(0);
00222                         KeyboardHelper.PressKey(Key.Up);
00223                         VerifySelectedFocusedIndex(0);
00224
00225                         TapOnItem(9, useBackup);
00226                         VerifySelectedFocusedIndex(9);
00227                         KeyboardHelper.PressKey(Key.Down);
00228                         VerifySelectedFocusedIndex(9);
00229                     }
00230                 }
00231             }
00232         }
00233
00234         [TestMethod]
00235         [TestProperty("TestSuite", "B")]
00236         public void MultiColumnKeyboardTest()
00237         {
00238             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00239             {
00240                 elements = new RadioButtonsTestPageElements();
00241                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00242                 {
00243                     SetSource(location);
00244                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00245                     {
00246                         SetItemType(type);
00247                         bool useBackup = type == RadioButtonsSourceType.String;
00248                         SetNumberOfColumns(3);
00249                         TapOnItem(3, useBackup);
00250                         VerifySelectedFocusedIndex(3);
00251                         KeyboardHelper.PressKey(Key.Down);
00252                         VerifySelectedFocusedIndex(4);
00253                         KeyboardHelper.PressKey(Key.Up);
00254                         VerifySelectedFocusedIndex(3);
00255                         KeyboardHelper.PressKey(Key.Left);
00256                         VerifySelectedFocusedIndex(3);
00257                         KeyboardHelper.PressKey(Key.Right);
00258                         VerifySelectedFocusedIndex(6);
00259                         KeyboardHelper.PressKey(Key.Right);
00260                         VerifySelectedFocusedIndex(9);
00261                         KeyboardHelper.PressKey(Key.Right);
00262                         VerifySelectedFocusedIndex(9);
00263                         KeyboardHelper.PressKey(Key.Left);
00264                         VerifySelectedFocusedIndex(6);
00265                         KeyboardHelper.PressKey(Key.Left);
00266                         VerifySelectedFocusedIndex(2);
00267                         KeyboardHelper.PressKey(Key.Left);
00268                         VerifySelectedFocusedIndex(2);
00269
00270                         TapOnItem(0, useBackup);
00271                         VerifySelectedFocusedIndex(0);
00272                         KeyboardHelper.PressKey(Key.Up);
00273                         VerifySelectedFocusedIndex(0);
00274                         KeyboardHelper.PressKey(Key.Left);
00275                         VerifySelectedFocusedIndex(0);
00276                         KeyboardHelper.PressKey(Key.Right);
00277                         VerifySelectedFocusedIndex(4);
00278
00279                         TapOnItem(9, useBackup);
00280                         VerifySelectedFocusedIndex(9);
00281                         KeyboardHelper.PressKey(Key.Down);
00282                         VerifySelectedFocusedIndex(9);
00283                         KeyboardHelper.PressKey(Key.Right);
00284                         VerifySelectedFocusedIndex(9);
00285                         KeyboardHelper.PressKey(Key.Left);
00286                         VerifySelectedFocusedIndex(6);
00287                     }
00288                 }
00289             }
00290         }
00291
00292         [TestMethod]
00293         [TestProperty("TestSuite", "B")]
00294         public void SingleRowKeyboardTest()
00295         {
00296             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00297             {
00298                 elements = new RadioButtonsTestPageElements();
00299                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00300                 {
00301                     SetSource(location);
00302                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00303                     {
00304                         SetItemType(type);
00305                         bool useBackup = type == RadioButtonsSourceType.String;
00306                         SetNumberOfColumns(3);
00307                         SetNumberOfItems(3);
00308                         TapOnItem(0, useBackup);
00309                         VerifySelectedFocusedIndex(0);
00310                         KeyboardHelper.PressKey(Key.Right);
00311                         VerifySelectedFocusedIndex(1);
00312                         KeyboardHelper.PressKey(Key.Right);
00313                         VerifySelectedFocusedIndex(2);
00314                         KeyboardHelper.PressKey(Key.Left);
00315                         VerifySelectedFocusedIndex(1);
00316                         KeyboardHelper.PressKey(Key.Left);
00317                         VerifySelectedFocusedIndex(0);
00318                         KeyboardHelper.PressKey(Key.Down);
00319                         VerifySelectedFocusedIndex(1);
00320                         KeyboardHelper.PressKey(Key.Down);
00321                         VerifySelectedFocusedIndex(2);
00322                         KeyboardHelper.PressKey(Key.Up);
00323                         VerifySelectedFocusedIndex(1);
00324                         KeyboardHelper.PressKey(Key.Up);
00325                         VerifySelectedFocusedIndex(0);
00326                     }
00327                 }
00328             }
00329         }
00330
00331         [TestMethod]
00332         [TestProperty("TestSuite", "C")]
00333         public void DisabledItemsKeyboardTest()
00334         {
00335             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00336             {
00337                 elements = new RadioButtonsTestPageElements();
00338                 SetItemType(RadioButtonsSourceType.RadioButton);
00339                 SetNumberOfColumns(3);
00340                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00341                 {
00342                     SetSource(location);
00343
00344                     SetNumberOfItems(10);
00345                     InsertDisabledRadioButton(10);
00346                     TapOnItem(7);
00347                     VerifySelectedFocusedIndex(7);
00348                     KeyboardHelper.PressKey(Key.Right);
00349                     VerifySelectedFocusedIndex(9);
00350                     KeyboardHelper.PressKey(Key.Left);
00351                     VerifySelectedFocusedIndex(5);
00352                     KeyboardHelper.PressKey(Key.Down);
00353                     VerifySelectedFocusedIndex(6);
00354                     KeyboardHelper.PressKey(Key.Right);
00355                     VerifySelectedFocusedIndex(9);
00356                     //There is a known bug here where pressing down or right will put focus
00357                     //On the first item because RadioButton handles the event.
00358                     //RadioButtons doesn't catch this because it only catches when the
00359                     //Last item is focused, but that item is disabled here...
00360                     //Bug #1654
00361                     //KeyboardHelper.PressKey(Key.Down);
00362                     //VerifySelectedFocusedIndex(9);
00363                     //KeyboardHelper.PressKey(Key.Right);
00364                     //VerifySelectedFocusedIndex(9);
00365
00366                     InsertDisabledRadioButton(6);
00367                     InsertDisabledRadioButton(6);
00368
00369                     TapOnItem(1);
00370                     VerifySelectedFocusedIndex(1);
00371                     KeyboardHelper.PressKey(Key.Right);
00372                     VerifySelectedFocusedIndex(10);
00373                     TapOnItem(2);
00374                     VerifySelectedFocusedIndex(2);
00375                     KeyboardHelper.PressKey(Key.Right);
00376                     VerifySelectedFocusedIndex(11);
00377                     TapOnItem(5);
00378                     KeyboardHelper.PressKey(Key.Up);
00379                     VerifySelectedFocusedIndex(4);
00380                     KeyboardHelper.PressKey(Key.Down);
00381                     VerifySelectedFocusedIndex(5);
00382                     KeyboardHelper.PressKey(Key.Down);
00383                     VerifySelectedFocusedIndex(8);
00384                     TapOnItem(8);
00385                     VerifySelectedFocusedIndex(10);
00386                     KeyboardHelper.PressKey(Key.Left);
00387                     VerifySelectedFocusedIndex(1);
00388                     TapOnItem(9);
00389                     VerifySelectedFocusedIndex(11);
00390                     KeyboardHelper.PressKey(Key.Left);
00391                     VerifySelectedFocusedIndex(2);
00392
00393                     ElementCache.Clear();
00394                 }
00395             }
00396         }
00397
00398         [TestMethod]
00399         [TestProperty("TestSuite", "A")]
00400         public void DisabledItemsAtTopOfColumnKeyboardTest()
00401         {
00402             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00403             {
00404                 elements = new RadioButtonsTestPageElements();
00405                 SetItemType(RadioButtonsSourceType.RadioButton);
00406                 SetNumberOfColumns(3);
00407                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00408                 {
00409                     SetSource(location);
00410
00411                     SetNumberOfItems(10);
00412                     InsertDisabledRadioButton(5);
00413                     InsertDisabledRadioButton(5);
00414                     InsertDisabledRadioButton(5);
00415
00416                     TapOnItem(0);
00417                     VerifySelectedFocusedIndex(0);
00418                     KeyboardHelper.PressKey(Key.Right);
00419                     VerifySelectedFocusedIndex(9);
00420                     TapOnItem(1);
00421                     VerifySelectedFocusedIndex(1);
00422                     KeyboardHelper.PressKey(Key.Right);
00423                     VerifySelectedFocusedIndex(10);
00424                     TapOnItem(2);
00425                     VerifySelectedFocusedIndex(2);
00426                     KeyboardHelper.PressKey(Key.Right);
00427                     VerifySelectedFocusedIndex(11);
00428                     TapOnItem(3);
00429                     VerifySelectedFocusedIndex(3);
00430                     KeyboardHelper.PressKey(Key.Right);
00431                     VerifySelectedFocusedIndex(8);
00432                     TapOnItem(4);
00433                     VerifySelectedFocusedIndex(4);
00434                     KeyboardHelper.PressKey(Key.Right);
00435                     VerifySelectedFocusedIndex(8);
00436                     TapOnItem(6);
00437                     VerifySelectedFocusedIndex(9);
00438                     KeyboardHelper.PressKey(Key.Left);
00439                     VerifySelectedFocusedIndex(0);
00440                     TapOnItem(7);
00441                     VerifySelectedFocusedIndex(10);
00442                     KeyboardHelper.PressKey(Key.Left);
00443                     VerifySelectedFocusedIndex(1);
00444                     TapOnItem(8);
00445                     VerifySelectedFocusedIndex(11);
00446                     KeyboardHelper.PressKey(Key.Left);
00447                     VerifySelectedFocusedIndex(2);
00448                     TapOnItem(9);
00449                     VerifySelectedFocusedIndex(12);
00450                     KeyboardHelper.PressKey(Key.Left);
00451                     VerifySelectedFocusedIndex(8);
00452
00453                     ElementCache.Clear();
00454                 }
00455             }
00456         }
00457
00458         public void RS2MultiColumnKeyboardTest()
00459         {
00460             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00461             {
00462                 elements = new RadioButtonsTestPageElements();
00463                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00464                 {
00465                     SetSource(location);
00466                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00467                     {
00468                         SetItemType(type);
00469                         bool useBackup = type == RadioButtonsSourceType.String;
00470                         SetNumberOfColumns(3);
00471                         TapOnItem(3, useBackup);
00472                         VerifySelectedFocusedIndex(3);
00473                         KeyboardHelper.PressKey(Key.Down);
00474                         VerifyFocusedIndex(4);
00475                         KeyboardHelper.PressKey(Key.Up);
00476                         VerifyFocusedIndex(3);
00477                         KeyboardHelper.PressKey(Key.Left);
00478                         VerifyFocusedIndex(2);
00479                         KeyboardHelper.PressKey(Key.Right);
00480                         VerifyFocusedIndex(3);
00481                         KeyboardHelper.PressKey(Key.Right);
00482                         VerifyFocusedIndex(4);
00483                         VerifySelectedIndex(3);
00484
00485                         TapOnItem(9, useBackup);
00486                         VerifySelectedFocusedIndex(9);
00487                         KeyboardHelper.PressKey(Key.Left);
00488                         VerifyFocusedIndex(8);
00489                         KeyboardHelper.PressKey(Key.Right);
00490                         VerifyFocusedIndex(9);
00491                         KeyboardHelper.PressKey(Key.Right);
00492                         VerifyFocusedIndex(0);
00493                         KeyboardHelper.PressKey(Key.Tab);
00494                         VerifyFocusedIndex(1);
00495                         VerifySelectedIndex(9);
00496
00497                         TapOnItem(9, useBackup);
00498                         VerifySelectedFocusedIndex(9);
00499                         KeyboardHelper.PressKey(Key.Tab);
00500                         VerifyRadioButtonsHasFocus(false);
00501                     }
00502                 }
00503             }
00504         }
00505
00506         [TestMethod]
00507         [TestProperty("TestSuite", "B")]
00508         [TestProperty("Ignore", "True")] // Disabled due to #4576: Unreliable test
00509         public void GamepadCanEscapeAndDoesNotSelectWithFocus()
00510         {
00511             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00512             {
00513                 elements = new RadioButtonsTestPageElements();
00514                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00515                 {
00516                     SetSource(location);
00517                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00518                     {
00519                         SetItemType(type);
00520                         bool useBackup = type == RadioButtonsSourceType.String;
00521                         SetNumberOfColumns(3);
00522
00523                         TapOnItem(9, useBackup);
00524                         VerifySelectedFocusedIndex(9);
00525                         GamepadHelper.PressButton(null, GamepadButton.DPadDown);
00526                         VerifyRadioButtonsHasFocus(false);
00527
00528                         TapOnItem(0, useBackup);
00529                         VerifySelectedFocusedIndex(0);
00530                         GamepadHelper.PressButton(null, GamepadButton.DPadUp);
00531                         VerifyRadioButtonsHasFocus(false);
00532
00533                         TapOnItem(7, useBackup);
00534                         VerifySelectedFocusedIndex(7);
00535                         GamepadHelper.PressButton(null, GamepadButton.DPadRight);
00536                         VerifyRadioButtonsHasFocus(false);
00537
00538                         TapOnItem(7, useBackup);
00539                         VerifySelectedFocusedIndex(7);
00540                         GamepadHelper.PressButton(null, GamepadButton.DPadDown);
00541                         VerifySelectedIndex(7);
00542                         VerifyFocusedIndex(8);
00543
00544                         GamepadHelper.PressButton(null, GamepadButton.DPadLeft);
00545                         VerifySelectedIndex(7);
00546                         VerifyFocusedIndex(5);
00547                     }
00548                 }
00549             }
00550         }
00551
00552         [TestMethod]
00553         [TestProperty("TestSuite", "C")]
00554         public void ControlKeyKeyboardTest()
00555         {
00556             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00557             {
00558                 elements = new RadioButtonsTestPageElements();
00559                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00560                 {
00561                     SetSource(location);
00562                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00563                     {
00564                         SetItemType(type);
00565                         bool useBackup = type == RadioButtonsSourceType.String;
00566                         TapOnItem(3, useBackup);
00567                         VerifySelectedFocusedIndex(3);
00568                         KeyboardHelper.PressDownModifierKey(ModifierKey.Control);
00569                         KeyboardHelper.PressKey(Key.Down);
00570                         KeyboardHelper.ReleaseModifierKey(ModifierKey.Control);
00571                         VerifySelectedIndex(3);
00572                         VerifyFocusedIndex(4);
00573                     }
00574                 }
00575             }
00576         }
00577
00578         [TestMethod]
00579         [TestProperty("TestSuite", "A")]
00580         public void ColumnsTest()
00581         {
00582             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00583             {
00584                 elements = new RadioButtonsTestPageElements();
00585                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00586                 {
00587                     SetSource(location);
00588                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00589                     {
00590                         SetItemType(type);
00591                         SetNumberOfColumns(1);
00592                         SetNumberOfItems(10);
00593                         SetBorderWidthToInf();
00594
00595                         VerifyLayoutData(10, 1, 0);
00596                         SetNumberOfColumns(3);
00597                         VerifyLayoutData(3, 3, 1);
00598                         SetNumberOfColumns(5);
00599                         VerifyLayoutData(2, 5, 0);
00600                         SetNumberOfColumns(7);
00601                         VerifyLayoutData(1, 7, 3);
00602                         SetNumberOfColumns(10);
00603                         VerifyLayoutData(1, 10, 0);
00604                         SetNumberOfColumns(20);
00605                         VerifyLayoutData(1, 10, 0);
00606
00607                         SetNumberOfItems(77);
00608                         VerifyLayoutData(3, 20, 17);
00609
00610                         SetBorderWidth(100);
00611                         VerifyLayoutData(77, 1, 0);
00612                         SetBorderWidth(200);
00613                         VerifyLayoutData(77, 1, 0);
00614                         SetBorderWidth(300);
00615                         VerifyLayoutData(38, 2, 1);
00616                         SetBorderWidth(500);
00617                         VerifyLayoutData(25, 3, 2);
00618                         SetBorderWidth(550);
00619                         VerifyLayoutData(19, 4, 1);
00620                     }
00621                 }
00622             }
00623         }
00624
00625         [TestMethod]
00626         [TestProperty("TestSuite", "B")]
00627         public void UIAProperties()
00628         {
00629             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00630             {
00631                 elements = new RadioButtonsTestPageElements();
00632                 SetItemType(RadioButtonsSourceType.RadioButton);
00633                 SetSource(RadioButtonsSourceLocation.ItemSource);
00634
00635                 Log.Comment("Verify the header is set as the name for the RadioButtons control.");
00636                 UIObject groupElement = TryFindElement.ByName("More Radio Buttons");
00637                 Verify.IsTrue(groupElement.ControlType == ControlType.Group);
00638
00639                 SelectByIndex(1);
00640                 VerifySelectedIndex(1);
00641                 VerifySelectedPositionInSet(2);
00642                 VerifySelectedSizeOfSet(10);
00643
00644                 SetNumberOfColumns(3);
00645                 VerifySelectedIndex(1);
00646                 VerifySelectedPositionInSet(2);
00647                 VerifySelectedSizeOfSet(10);
00648
00649                 InsertEnabledRadioButton(0);
00650                 VerifySelectedIndex(2);
00651                 VerifySelectedPositionInSet(3);
00652                 VerifySelectedSizeOfSet(11);
00653
00654                 InsertEnabledRadioButton(10);
00655                 VerifySelectedIndex(2);
00656                 VerifySelectedPositionInSet(3);
00657                 VerifySelectedSizeOfSet(12);
00658
00659                 SelectByIndex(10);
00660                 VerifySelectedIndex(10);
00661                 VerifySelectedPositionInSet(11);
00662                 VerifySelectedSizeOfSet(12);
00663
00664                 SetNumberOfItems(17);
00665                 SelectByIndex(16);
00666                 VerifySelectedIndex(16);
00667                 VerifySelectedPositionInSet(17);
00668                 VerifySelectedSizeOfSet(17);
00669             }
00670         }
00671
00672         [TestMethod]
00673         [TestProperty("TestSuite", "C")]
00674         public void InsertedCheckedRadioButtonGetsSelection()
00675         {
00676             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00677             {
00678                 elements = new RadioButtonsTestPageElements();
00679                 SetItemType(RadioButtonsSourceType.RadioButton);
00680                 SetSource(RadioButtonsSourceLocation.ItemSource);
00681
00682                 SelectByIndex(3);
00683                 VerifySelectedIndex(3);
00684
00685                 InsertEnabledRadioButton(6, /*isChecked*/true);
00686                 VerifySelectedIndex(6);
00687             }
00688         }
00689
00690         [TestMethod]
00691         [TestProperty("TestSuite", "A")]
00692         public void ScrollViewerSettingSelectionDoesNotMoveFocus()
00693         {
00694             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00695             {
00696                 elements = new RadioButtonsTestPageElements();
00697                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00698                 {
00699                     SetSource(location);
00700                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00701                     {
00702                         SetItemType(type);
00703                         SelectByIndex(3);
00704                         VerifySelectedIndex(3);
00705                         VerifyRadioButtonsHasFocus(false);
00706
00707                         elements.GetReproTextBlock().Click();
00708                         VerifySelectedIndex(3);
00709                         // This behavior is probably wrong, it is probably more correct for focus to be on the selected item...
00710                         VerifyFocusedIndex(0);
00711
00712                         KeyboardHelper.PressKey(Key.Down);
00713                         VerifySelectedFocusedIndex(1);
00714                     }
00715                 }
00716             }
00717         }
00718         [TestMethod]
00719         [TestProperty("TestSuite", "B")]
00720         public void AccessKeys()
00721         {
00722             using (var setup = new TestSetupHelper(new[] { "RadioButtons Tests", "RadioButtons Test" }))
00723             {
00724                 elements = new RadioButtonsTestPageElements();
00725                 foreach (RadioButtonsSourceLocation location in Enum.GetValues(typeof(RadioButtonsSourceLocation)))
00726                 {
00727                     SetSource(location);
00728                     foreach (RadioButtonsSourceType type in Enum.GetValues(typeof(RadioButtonsSourceType)))
00729                     {
00730                         SetItemType(type);
00731                         SetNumberOfItems(10);
00732
00733                         VerifyRadioButtonsHasFocus(false);
00734                         UseAccessKey();
00735                         VerifyFocusedIndex(0);
00736                         VerifySelectedIndex(-1);
00737
00738                         SelectByIndex(3);
00739                         VerifySelectedIndex(3);
00740                         VerifyFocusedIndex(-1);
00741
00742                         KeyboardHelper.PressKey(Key.Tab);
00743                         VerifyRadioButtonsHasFocus(false);
00744                         UseAccessKey();
00745                         VerifySelectedFocusedIndex(3);
00746                         UseAccessKey();
00747                         VerifySelectedFocusedIndex(3);
00748                     }
00749                 }
00750             }
00751         }
00752
00753         void SetNumberOfColumns(int columns)
00754         {
00755             elements.GetMaxColumnsTextBlock().SetValue(columns.ToString());
00756             elements.GetSetMaxColumnsButton().Click();
00757         }
00758
00759         void SetNumberOfItems(int items)
00760         {
00761             elements.GetNumberOfItemsTextBlock().SetValue(items.ToString());
00762             elements.GetSetNumberOfItemsButton().Click();
00763         }
00764
00765         void SetBorderWidth(float width)
00766         {
00767             elements.GetBorderWidthTextBox().SetValue(width.ToString());
00768             elements.GetSetBorderWidthButton().Click();
00769         }
00770
00771         void SetBorderWidthToInf()
00772         {
00773             elements.GetBorderWidthTextBox().SetValue("inf");
00774             elements.GetSetBorderWidthButton().Click();
00775         }
00776
00777         void SetSource(RadioButtonsSourceLocation location)
00778         {
00779             switch(location)
00780             {
00781                 case RadioButtonsSourceLocation.Items:
00782                     elements.GetSourceComboBox().SelectItemByName("ItemsComboBoxItem");
00783                     break;
00784                 case RadioButtonsSourceLocation.ItemSource:
00785                     elements.GetSourceComboBox().SelectItemByName("ItemsSourceComboBoxItem");
00786                     break;
00787             }
00788         }
00789
00790         void SetItemType(RadioButtonsSourceType type)
00791         {
00792             switch(type)
00793             {
00794                 case RadioButtonsSourceType.String:
00795                     elements.GetItemTypeComboBox().SelectItemByName("StringsComboBoxItem");
00796                     break;
00797                 case RadioButtonsSourceType.RadioButton:
00798                     elements.GetItemTypeComboBox().SelectItemByName("RadioButtonElementsComboBoxItem");
00799                     break;
00800             }
00801         }
00802
00803         void InsertDisabledRadioButton(int index, bool isChecked = false, string content = "Custom")
00804         {
00805             InsertRadioButton(index, true, isChecked, content);
00806         }
00807
00808         void InsertEnabledRadioButton(int index, bool isChecked = false, string content = "Custom")
00809         {
00810             InsertRadioButton(index, false, isChecked, content);
00811         }
00812
00813         void InsertRadioButton(int index, bool disabled, bool isChecked = false, string content = "Custom")
00814         {
00815             if (disabled)
00816             {
00817                 elements.GetCustomDisabledCheckBox().Check();
00818             }
00819             else
00820             {
00821                 elements.GetCustomDisabledCheckBox().Uncheck();
00822             }
00823
00824             if(isChecked)
00825             {
00826                 elements.GetCustomCheckedCheckBox().Check();
00827             }
00828             else
00829             {
00830                 elements.GetCustomCheckedCheckBox().Uncheck();
00831             }
00832
00833             elements.GetCustomIndexTextBox().SetValue(index.ToString());
00834             elements.GetCustomContentTextBox().SetValue(content);
00835             elements.GetInsertDisplayRadioButtonButton().Click();
00836         }
00837
00838         int GetSelectedIndex()
00839         {
00840             return Int32.Parse(elements.GetSelectedIndexTextBlock().DocumentText);
00841         }
00842
00843         string GetSelectedItem()
00844         {
00845             return elements.GetSelectedItemTextBlock().DocumentText;
00846         }
00847
00848         int GetFocusedIndex()
00849         {
00850             return Int32.Parse(elements.GetFocusedIndexTextBlock().DocumentText);
00851         }
00852
00853         string GetFocusedItem()
00854         {
00855             return elements.GetFocusedItemTextBlock().DocumentText;
00856         }
00857
00858         Tuple<int, int, int> GetLayoutData()
00859         {
00860             return new Tuple<int, int, int>(
00861                 Int32.Parse(elements.GetLayoutNumberOfRowsTextBlock().DocumentText),
00862                 Int32.Parse(elements.GetLayoutNumberOfColumnsTextBlock().DocumentText),
00863                 Int32.Parse(elements.GetLayoutNumberOfLargerColumnsTextBlock().DocumentText)
00864             );
00865         }
00866
00867         void VerifyLayoutData(int rows, int columns, int largerColumns)
00868         {
00869             var data = GetLayoutData();
00870             Verify.AreEqual(rows, data.Item1);
00871             Verify.AreEqual(columns, data.Item2);
00872             Verify.AreEqual(largerColumns, data.Item3);
00873         }
00874
00875         void ClickOnItem(int index)
00876         {
00877             Log.Comment("Clicking on item 'Radio Button " + index + "'");
00878             RadioButton item = FindElement.ByName<RadioButton>("Radio Button " + index);
00879             item.Click();
00880         }
00881
00882         void UseAccessKey()
00883         {
00884             KeyboardHelper.PressDownModifierKey(ModifierKey.Alt);
00885             KeyboardHelper.PressKey(Key.R);
00886             KeyboardHelper.ReleaseModifierKey(ModifierKey.Alt);
00887         }
00888
00889         void TapOnItem(int index, bool useBackup = false)
00890         {
00891             if (useBackup)
00892             {
00893                 BackupTap(index);
00894             }
00895             else
00896             {
00897                 Log.Comment("Clicking on item 'Radio Button " + index + "'");
00898                 RadioButton item = FindElement.ByName<RadioButton>("Radio Button " + index);
00899                 item.Click();
00900             }
00901         }
00902
00903         void BackupTap(int index)
00904         {
00905             SelectByIndex(index);
00906             elements.GetFocusSelectedItemButton().Click();
00907         }
00908
00909         void SelectByIndex(int index)
00910         {
00911             SetIndexToSelect(index);
00912             elements.GetSelectByIndexButton().Click();
00913         }
00914
00915         void SelectByItem(int index)
00916         {
00917             SetIndexToSelect(index);
00918             elements.GetSelectByItemButton().Click();
00919         }
00920
00921         void SetIndexToSelect(int index)
00922         {
00923             elements.GetIndexToSelectTextBlock().SetValue(index.ToString());
00924         }
00925
00926         void VerifySelectedPositionInSet(int index)
00927         {
00928             Verify.AreEqual(index, Int32.Parse(elements.GetSelectedPositionInSetTextBlock().DocumentText));
00929         }
00930         void VerifySelectedSizeOfSet(int index)
00931         {
00932             Verify.AreEqual(index, Int32.Parse(elements.GetSelectedSizeOfSetTextBlock().DocumentText));
00933         }
00934
00935         void VerifySelectedFocusedIndex(int index)
00936         {
00937             VerifySelectedIndex(index);
00938             VerifyFocusedIndex(index);
00939         }
00940
00941         void VerifyRadioButtonsHasFocus(bool hasFocus)
00942         {
00943             Verify.AreEqual(hasFocus, elements.GetRadioButtonsHasFocusCheckBox().ToggleState == ToggleState.On);
00944         }
00945
00946         void VerifySelectedIndex(int index)
00947         {
00948             Verify.AreEqual(index, Int32.Parse(elements.GetSelectedIndexTextBlock().DocumentText));
00949         }
00950
00951         void VerifyFocusedIndex(int index)
00952         {
00953             Verify.AreEqual(index, Int32.Parse(elements.GetFocusedIndexTextBlock().DocumentText));
00954         }
00955     }
00956 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PagerControl/PagerControlSelectedIndexChangedEventArgs.h Source File

  • PagerControl

PagerControlSelectedIndexChangedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "PagerControlSelectedIndexChangedEventArgs.g.h"
00007
00008 class PagerControlSelectedIndexChangedEventArgs :
00009     public winrt::implementation::PagerControlSelectedIndexChangedEventArgsT<PagerControlSelectedIndexChangedEventArgs>
00010 {
00011 public:
00012     PagerControlSelectedIndexChangedEventArgs(const int previousIndex,const int newIndex) :
00013         m_previousPageIndex(previousIndex), m_newPageIndex(newIndex) {};
00014
00015     int NewPageIndex() { return m_newPageIndex; };
00016     int PreviousPageIndex() { return m_previousPageIndex; };
00017
00018 private:
00019
00020     int m_newPageIndex = -1;
00021     int m_previousPageIndex = -1;
00022
00023 };
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbBarElementFactory.h Source File

  • Breadcrumb

BreadcrumbBarElementFactory.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "common.h"
00006 #include "ElementFactory.h"
00007
00008 class BreadcrumbElementFactory :
00009     public winrt::implements<BreadcrumbElementFactory, ElementFactory>
00010 {
00011 public:
00012     BreadcrumbElementFactory();
00013
00014     void UserElementFactory(const winrt::IInspectable& newValue);
00015     winrt::UIElement GetElementCore(const winrt::ElementFactoryGetArgs& args) override;
00016     void RecycleElementCore(const winrt::ElementFactoryRecycleArgs& args) override;
00017
00018 private:
00019     winrt::IElementFactory m_itemTemplateWrapper{ nullptr };
00020 };
00021
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/InteractionTests/CommonStylesTests.cs Source File

  • CommonStyles
  • InteractionTests

CommonStylesTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00007
00008 using WEX.TestExecution;
00009 using WEX.TestExecution.Markup;
00010 using WEX.Logging.Interop;
00011
00012 using Microsoft.Windows.Apps.Test.Automation;
00013 using Microsoft.Windows.Apps.Test.Foundation;
00014 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00015 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00016 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00017 using System;
00018
00019 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00020 {
00021     [TestClass]
00022     public class CommonStylesTests
00023     {
00024         [ClassInitialize]
00025         [TestProperty("RunAs", "User")]
00026         [TestProperty("Classification", "Integration")]
00027         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00028         public static void ClassInitialize(TestContext testContext)
00029         {
00030             TestEnvironment.Initialize(testContext);
00031         }
00032
00033         [TestCleanup]
00034         public void TestCleanup()
00035         {
00036             TestCleanupHelper.Cleanup();
00037         }
00038
00039         [TestMethod]
00040         public void SliderDensityTest()
00041         {
00042             RunDensityTests("SliderDensityTest");
00043         }
00044
00045         [TestMethod]
00046         public void ToggleSwitchDensityTest()
00047         {
00048             RunDensityTests("ToggleSwitchDensityTest");
00049         }
00050
00051         [TestMethod]
00052         public void DatePickerDensityTest()
00053         {
00054             RunDensityTests("DatePickerDensityTest");
00055         }
00056
00057         [TestMethod]
00058         public void TimePickerDensityTest()
00059         {
00060             RunDensityTests("TimePickerDensityTest");
00061         }
00062
00063         [TestMethod]
00064         public void AutoSuggestBoxDensityTest()
00065         {
00066             RunDensityTests("AutoSuggestBoxDensityTest");
00067         }
00068
00069         [TestMethod]
00070         public void ListViewItemDensityTest()
00071         {
00072             RunDensityTests("ListViewItemDensityTest");
00073         }
00074
00075         [TestMethod]
00076         public void TextBoxDensityTest()
00077         {
00078             RunDensityTests("TextBoxDensityTest");
00079         }
00080
00081         [TestMethod]
00082         public void PasswordBoxDensityTest()
00083         {
00084             RunDensityTests("PasswordBoxDensityTest");
00085         }
00086
00087         [TestMethod]
00088         public void ComboBoxDensityTest()
00089         {
00090             RunDensityTests("ComboBoxDensityTest");
00091         }
00092
00093         [TestMethod]
00094         public void RichEditBoxDensityTest()
00095         {
00096             RunDensityTests("RichEditBoxDensityTest");
00097         }
00098
00099         [TestMethod]
00100         public void AppBarToggleButtonDensityTest()
00101         {
00102             RunDensityTests("AppBarToggleButtonDensityTest");
00103         }
00104
00105         [TestMethod]
00106         public void AppBarButtonDensityTest()
00107         {
00108             RunDensityTests("AppBarButtonDensityTest");
00109         }
00110
00111         private void RunDensityTests(string buttonName)
00112         {
00113             using (var setup = new TestSetupHelper("CommonStyles Tests"))
00114             {
00115                 Log.Comment("Click on " + buttonName);
00116                 var button = new Button(FindElement.ByName(buttonName));
00117                 button.Invoke();
00118                 Wait.ForIdle();
00119
00120                 var densityTestResult = new TextBlock(FindElement.ByName("DensityTestResult")).GetText();
00121                 Verify.AreEqual(densityTestResult, "Pass", "We expect density test result is Pass");
00122             }
00123         }
00124
00125         [TestMethod]
00126         public void RunCompactTests()
00127         {
00128             using (var setup = new TestSetupHelper("Compact Tests"))
00129             {
00130                 Log.Comment("Click on RunTest");
00131                 var button = new Button(FindElement.ByName("RunTest"));
00132                 button.Invoke();
00133                 Wait.ForIdle();
00134
00135                 var testResult = new TextBlock(FindElement.ById("CompactTestResult")).GetText();
00136                 Verify.AreEqual(testResult, "Pass", "We expect compact test result is Pass"); // "Pass" string matches value used by MUXControlsTestApp.SimpleVerify
00137             }
00138         }
00139
00140         //[TestMethod]
00141         // Disabled due to: Bug 24013494: DCPP: CommonStylesTests.CornerRadiusTest is failing due to hitting an Assert in TickBar::ArrangeOverride
00142         public void CornerRadiusTest()
00143         {
00144             using (var setup = new TestSetupHelper("CornerRadius Tests"))
00145             {
00146                 var textBlock = FindElement.ByName("CornerRadius");
00147                 Verify.IsNotNull(textBlock, "Verify corner radius page doesn't crash");
00148             }
00149         }
00150
00151         //[TestMethod]
00152         // InkToolbar is not presently in WinUI 3.
00153         public void InkToolbarTest()
00154         {
00155             using (var setup = new TestSetupHelper("InkToolbar Tests"))
00156             {
00157                 var textBlock = FindElement.ByName("InkToolbar");
00158                 Verify.IsNotNull(textBlock, "Verify InkToolbar page doesn't crash");
00159
00160                 var verticalInkToolbar = FindElement.ById("VerticalInkToolbar");
00161                 Verify.IsNotNull(textBlock, "Verify verticalInkToolbar doesn't crash");
00162
00163                 Log.Comment("Click on " + "InkToolbarBallpointPenButton");
00164                 var radioButton = new RadioButton(FindElement.ById("InkToolbarBallpointPenButton"));
00165                 radioButton.Select();
00166                 Wait.ForIdle();
00167             }
00168         }
00169
00170         [TestMethod]
00171         public void MenuFlyoutItemSizeTest()
00172         {
00173             using (var setup = new TestSetupHelper("MenuFlyout Tests"))
00174             {
00175                 Log.Comment("Mouse click on Button to verify MenuFlyoutItem size.");
00176
00177                 var testMenuFlyoutButton = FindElement.ByName("TestMenuFlyoutButton");
00178                 Verify.IsNotNull(testMenuFlyoutButton, "Verifying that we found a UIElement called TestMenuFlyoutButton");
00179
00180                 InputHelper.LeftClick(testMenuFlyoutButton);
00181                 Wait.ForIdle();
00182
00183                 var testMenuFlyoutItem = FindElement.ByName("TestMenuFlyoutItem");
00184                 Verify.IsNotNull(testMenuFlyoutItem, "Verifying that we found a UIElement called TestMenuFlyoutItem");
00185
00186                 InputHelper.LeftClick(testMenuFlyoutItem);
00187                 Wait.ForIdle();
00188
00189                 var testMenuFlyoutItemHeightTextBlock = FindElement.ByName<TextBlock>("TestMenuFlyoutItemHeightTextBlock");
00190                 var testMenuFlyoutItemWidthTextBlock = FindElement.ByName<TextBlock>("TestMenuFlyoutItemWidthTextBlock");
00191
00192                 Verify.IsNotNull(testMenuFlyoutItemHeightTextBlock, "Verifying that we found a UIElement called TestMenuFlyoutItemHeightTextBlock");
00193                 Verify.IsNotNull(testMenuFlyoutItemWidthTextBlock, "Verifying that we found a UIElement called TestMenuFlyoutItemWidthTextBlock");
00194
00195                 var width = Convert.ToDouble(testMenuFlyoutItemWidthTextBlock.GetText());
00196
00197                 Verify.AreEqual("30", testMenuFlyoutItemHeightTextBlock.GetText(), "Comparing height of MenuFlyoutItem after Flyout was opened with mouse");
00198                 Verify.IsGreaterThan(width, 0.0, "Comparing height of MenuFlyoutItem after Flyout was opened with mouse");
00199                 Verify.IsLessThan(width, 200.0, "Comparing height of MenuFlyoutItem after Flyout was opened with mouse");
00200
00201                 InputHelper.LeftClick(testMenuFlyoutItemHeightTextBlock);
00202                 Wait.ForIdle();
00203                 InputHelper.Tap(testMenuFlyoutButton);
00204                 Wait.ForIdle();
00205                 InputHelper.Tap(testMenuFlyoutItem);
00206                 Wait.ForIdle();
00207
00208                 width = Convert.ToDouble(testMenuFlyoutItemWidthTextBlock.GetText());
00209                 Verify.AreEqual("38", testMenuFlyoutItemHeightTextBlock.GetText(), "Comparing height of MenuFlyoutItem after Flyout was opened with touch");
00210                 Verify.IsGreaterThan(width, 200.0, "Comparing width of MenuFlyoutItem after Flyout was opened with touch");
00211             }
00212         }
00213
00214         [TestMethod]
00215         public void TopBottomAppBarTest()
00216         {
00217             using (var setup = new TestSetupHelper(new[] { "CommandBar Tests", "navigateToCommandBar" }))
00218             {
00219                 var topAppBar = FindElement.ByName("TopCmdBar");
00220                 Verify.IsNotNull(topAppBar);
00221                 var topBounds = topAppBar.BoundingRectangle;
00222                 Verify.IsTrue(topBounds.Width > 0 && topBounds.Height > 0,
00223                         string.Format("Top CommandBar bounds are ({0}, {1})", topBounds.Width, topBounds.Height));
00224
00225                 var bottomAppBar = FindElement.ByName("BottomCmdBar");
00226                 Verify.IsNotNull(bottomAppBar);
00227                 var bottomBounds = bottomAppBar.BoundingRectangle;
00228                 Verify.IsTrue(bottomBounds.Width > 0 && bottomBounds.Height > 0,
00229                         string.Format("Bottom CommandBar bounds are ({0}, {1})", bottomBounds.Width, bottomBounds.Height));
00230
00231                 Log.Comment("Find Restore/Maximize button");
00232                 ElementCache.Clear();
00233                 var maxRestoreButton = new Button(FindElement.ByNameOrId("Restore"));
00234
00235                 maxRestoreButton.Invoke();
00236                 Wait.ForMilliseconds(1000);
00237
00238                 var newTopBounds = topAppBar.BoundingRectangle;
00239                 Verify.IsTrue(newTopBounds.Width != topBounds.Width,
00240                         string.Format("New top CommandBar bounds are ({0}, {1})", newTopBounds.Width, newTopBounds.Height));
00241
00242                 var newBottomBounds = topAppBar.BoundingRectangle;
00243                 Verify.IsTrue(newBottomBounds.Width != bottomBounds.Width,
00244                         string.Format("New bottom CommandBar bounds are ({0}, {1})", newBottomBounds.Width, newBottomBounds.Height));
00245
00246                 maxRestoreButton.Invoke();
00247                 Wait.ForMilliseconds(1000);
00248             }
00249         }
00250
00251         [TestMethod]
00252         public void HyperlinkIsOffscreenTest()
00253         {
00254             using (var setup = new TestSetupHelper("TextControls Tests"))
00255             {
00256                 var hyperlink = FindElement.ByName("hyperlinkText");
00257                 Verify.IsNotNull(hyperlink);
00258                 var hyperlinkStartingBounds = hyperlink.BoundingRectangle;
00259                 Verify.IsTrue(hyperlinkStartingBounds.X > 0 && hyperlinkStartingBounds.Y > 0,
00260                         string.Format("Hyperlink corner is at ({0}, {1})", hyperlinkStartingBounds.X, hyperlinkStartingBounds.Y));
00261
00262                 Verify.IsTrue(hyperlink.IsOffscreen == false, "IsOffscreen == false");
00263
00264                 var resizeButton = new Button(FindElement.ByName("resizeWindowButton"));
00265                 resizeButton.Invoke();
00266                 Wait.ForIdle();
00267
00268                 var hyperlinkEndingBounds = hyperlink.BoundingRectangle;
00269                 Verify.IsTrue(hyperlinkEndingBounds.X <= 0 && hyperlinkEndingBounds.Y <= 0,
00270                         string.Format("Hyperlink corner is at ({0}, {1})", hyperlinkEndingBounds.X, hyperlinkEndingBounds.Y));
00271
00272                 Verify.IsTrue(hyperlink.IsOffscreen == true, "IsOffscreen == true");
00273
00274                 resizeButton.Invoke();
00275                 Wait.ForIdle();
00276             }
00277         }
00278
00279         [TestMethod]
00280         [TestProperty("Description", "Scrolls a vertical grouped GridView with Mandatory snap points and with the mouse-wheel.")]
00281         public void ScrollGroupedGridViewWithMandatorySnapPointsTest()
00282         {
00283             using (var setup = new TestSetupHelper(new[] { "GridView Tests", "navigateToGroupedGridView" }))
00284             {
00285                 Log.Comment("Retrieving cmbScrollViewerVerticalSnapPointsType");
00286                 UIObject scrollViewerVerticalSnapPointsType = FindElement.ById("cmbScrollViewerVerticalSnapPointsType");
00287                 Verify.IsNotNull(scrollViewerVerticalSnapPointsType, "Verifying that cmbScrollViewerVerticalSnapPointsType was found");
00288                 ComboBox cmbScrollViewerVerticalSnapPointsType = new ComboBox(scrollViewerVerticalSnapPointsType);
00289
00290                 Log.Comment("Changing cmbScrollViewerVerticalSnapPointsType selection to 'Mandatory'");
00291                 cmbScrollViewerVerticalSnapPointsType.SelectItemByName("Mandatory");
00292                 Log.Comment("Selection is now {0}", cmbScrollViewerVerticalSnapPointsType.Selection[0].Name);
00293
00294                 Log.Comment("Retrieving cmbItemsPanelGroupHeaderPlacement");
00295                 UIObject itemsPanelGroupHeaderPlacement = FindElement.ById("cmbItemsPanelGroupHeaderPlacement");
00296                 Verify.IsNotNull(itemsPanelGroupHeaderPlacement, "Verifying that cmbItemsPanelGroupHeaderPlacement was found");
00297                 ComboBox cmbItemsPanelGroupHeaderPlacement = new ComboBox(itemsPanelGroupHeaderPlacement);
00298
00299                 Log.Comment("Changing cmbItemsPanelGroupHeaderPlacement selection to 'Left'");
00300                 cmbItemsPanelGroupHeaderPlacement.SelectItemByName("Left");
00301                 Log.Comment("Selection is now {0}", cmbItemsPanelGroupHeaderPlacement.Selection[0].Name);
00302
00303                 Log.Comment("Retrieving btnSetItemsPanelGroupHeaderPlacement");
00304                 UIObject setItemsPanelGroupHeaderPlacement = FindElement.ById("btnSetItemsPanelGroupHeaderPlacement");
00305                 Verify.IsNotNull(setItemsPanelGroupHeaderPlacement, "Verifying that btnSetItemsPanelGroupHeaderPlacement was found");
00306                 Button btnSetItemsPanelGroupHeaderPlacement = new Button(setItemsPanelGroupHeaderPlacement);
00307
00308                 Log.Comment("Invoking btnSetItemsPanelGroupHeaderPlacement");
00309                 btnSetItemsPanelGroupHeaderPlacement.Invoke();
00310                 Wait.ForIdle();
00311
00312                 Log.Comment("Retrieving btnGetItemsWrapGridItemHeight");
00313                 UIObject getItemsWrapGridItemHeight = FindElement.ById("btnGetItemsWrapGridItemHeight");
00314                 Verify.IsNotNull(getItemsWrapGridItemHeight, "Verifying that btnGetItemsWrapGridItemHeight was found");
00315                 Button btnGetItemsWrapGridItemHeight = new Button(getItemsWrapGridItemHeight);
00316
00317                 Log.Comment("Invoking btnGetItemsWrapGridItemHeight");
00318                 btnGetItemsWrapGridItemHeight.Invoke();
00319                 Wait.ForIdle();
00320
00321                 Log.Comment("Retrieving txtItemsWrapGridItemHeight");
00322                 UIObject itemsWrapGridItemHeight = FindElement.ById("txtItemsWrapGridItemHeight");
00323                 Verify.IsNotNull(itemsWrapGridItemHeight);
00324                 Edit txtItemsWrapGridItemHeight = new Edit(itemsWrapGridItemHeight);
00325
00326                 Log.Comment("txtItemsWrapGridItemHeight.Value: " + txtItemsWrapGridItemHeight.Value);
00327                 Verify.AreEqual("150", txtItemsWrapGridItemHeight.Value);
00328
00329                 Log.Comment("Retrieving gridView");
00330                 UIObject gridViewUIObject = FindElement.ById("gridView");
00331                 Verify.IsNotNull(gridViewUIObject, "Verifying that gridView was found");
00332                 Wait.ForIdle();
00333
00334                 Log.Comment("Scrolling gridView with mouse wheel");
00335                 InputHelper.RotateWheel(gridViewUIObject, -120);
00336                 Wait.ForIdle();
00337
00338                 Log.Comment("Verifying gridView scrolled to mandatory snap point, i.e. a small multiple of 150");
00339                 bool scrolledToMandatorySnapPoint =
00340                     TryWaitForEditValues(editName: "txtScrollViewerVerticalOffset", editValue: "150") ||
00341                     TryWaitForEditValues(editName: "txtScrollViewerVerticalOffset", editValue: "300");
00342                 Log.Comment("scrolledToMandatorySnapPoint:" + scrolledToMandatorySnapPoint);
00343                 Verify.IsTrue(scrolledToMandatorySnapPoint);
00344             }
00345         }
00346
00347         [TestMethod]
00348         public void ListViewBaseItemPageNavigationTest()
00349         {
00350             using (var setup = new TestSetupHelper("CommonStyles Tests"))
00351             {
00352                 Log.Comment("Click on NavigateToNewPageButton");
00353                 var button = new Button(FindElement.ByName("NavigateToNewPageButton"));
00354
00355                 InputHelper.ScrollToElement(button);
00356                 Wait.ForIdle();
00357
00358                 // LeftClick is required in order for PointerCapture to happen
00359                 InputHelper.LeftClick(button);
00360                 Wait.ForIdle();
00361
00362                 Log.Comment("Verify successful page navigation");
00363                 var buttonNavigateToGridView = FindElement.ById("navigateToGridView");
00364                 Verify.IsNotNull(buttonNavigateToGridView, "GridViewPage is expected to be loaded.");
00365             }
00366         }
00367
00368
00369         private bool TryWaitForEditValues(string editName, string editValue)
00370         {
00371             UIObject editUIObject = FindElement.ById(editName);
00372             Verify.IsNotNull(editUIObject);
00373             Edit edit = new Edit(editUIObject);
00374
00375             Log.Comment("Current value for " + editName + ": " + edit.Value);
00376             if (edit.Value != editValue)
00377             {
00378                 using (var waiter = new ValueChangedEventWaiter(edit, editValue))
00379                 {
00380                     Log.Comment("Waiting for " + editName + " to be set to " + editValue);
00381
00382                     bool success = waiter.TryWait(TimeSpan.FromSeconds(2.0));
00383                     Log.Comment("Current value for " + editName + ": " + edit.Value + ", (success:" + success + ")");
00384                     return success;
00385                 }
00386             }
00387             return true;
00388         }
00389     }
00390 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AcrylicBrush.properties.cpp Source File

  • Generated

AcrylicBrush.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "AcrylicBrush.h"
00008
00009 GlobalDependencyProperty AcrylicBrushProperties::s_AlwaysUseFallbackProperty{ nullptr };
00010 GlobalDependencyProperty AcrylicBrushProperties::s_TintColorProperty{ nullptr };
00011 GlobalDependencyProperty AcrylicBrushProperties::s_TintLuminosityOpacityProperty{ nullptr };
00012 GlobalDependencyProperty AcrylicBrushProperties::s_TintOpacityProperty{ nullptr };
00013 GlobalDependencyProperty AcrylicBrushProperties::s_TintTransitionDurationProperty{ nullptr };
00014
00015 AcrylicBrushProperties::AcrylicBrushProperties()
00016 {
00017     EnsureProperties();
00018 }
00019
00020 void AcrylicBrushProperties::EnsureProperties()
00021 {
00022     if (!s_AlwaysUseFallbackProperty)
00023     {
00024         s_AlwaysUseFallbackProperty =
00025             InitializeDependencyProperty(
00026                 L"AlwaysUseFallback",
00027                 winrt::name_of<bool>(),
00028                 winrt::name_of<winrt::AcrylicBrush>(),
00029                 false /* isAttached */,
00030                 ValueHelper<bool>::BoxedDefaultValue(),
00031                 winrt::PropertyChangedCallback(&OnAlwaysUseFallbackPropertyChanged));
00032     }
00033     if (!s_TintColorProperty)
00034     {
00035         s_TintColorProperty =
00036             InitializeDependencyProperty(
00037                 L"TintColor",
00038                 winrt::name_of<winrt::Color>(),
00039                 winrt::name_of<winrt::AcrylicBrush>(),
00040                 false /* isAttached */,
00041                 ValueHelper<winrt::Color>::BoxValueIfNecessary(AcrylicBrush::sc_defaultTintColor),
00042                 winrt::PropertyChangedCallback(&OnTintColorPropertyChanged));
00043     }
00044     if (!s_TintLuminosityOpacityProperty)
00045     {
00046         s_TintLuminosityOpacityProperty =
00047             InitializeDependencyProperty(
00048                 L"TintLuminosityOpacity",
00049                 winrt::name_of<winrt::IReference<double>>(),
00050                 winrt::name_of<winrt::AcrylicBrush>(),
00051                 false /* isAttached */,
00052                 ValueHelper<winrt::IReference<double>>::BoxedDefaultValue(),
00053                 winrt::PropertyChangedCallback(&OnTintLuminosityOpacityPropertyChanged));
00054     }
00055     if (!s_TintOpacityProperty)
00056     {
00057         s_TintOpacityProperty =
00058             InitializeDependencyProperty(
00059                 L"TintOpacity",
00060                 winrt::name_of<double>(),
00061                 winrt::name_of<winrt::AcrylicBrush>(),
00062                 false /* isAttached */,
00063                 ValueHelper<double>::BoxValueIfNecessary(AcrylicBrush::sc_defaultTintOpacity),
00064                 winrt::PropertyChangedCallback(&OnTintOpacityPropertyChanged));
00065     }
00066     if (!s_TintTransitionDurationProperty)
00067     {
00068         s_TintTransitionDurationProperty =
00069             InitializeDependencyProperty(
00070                 L"TintTransitionDuration",
00071                 winrt::name_of<winrt::TimeSpan>(),
00072                 winrt::name_of<winrt::AcrylicBrush>(),
00073                 false /* isAttached */,
00074                 ValueHelper<winrt::TimeSpan>::BoxValueIfNecessary(AcrylicBrush::sc_defaultTintTransitionDuration),
00075                 winrt::PropertyChangedCallback(&OnTintTransitionDurationPropertyChanged));
00076     }
00077 }
00078
00079 void AcrylicBrushProperties::ClearProperties()
00080 {
00081     s_AlwaysUseFallbackProperty = nullptr;
00082     s_TintColorProperty = nullptr;
00083     s_TintLuminosityOpacityProperty = nullptr;
00084     s_TintOpacityProperty = nullptr;
00085     s_TintTransitionDurationProperty = nullptr;
00086 }
00087
00088 void AcrylicBrushProperties::OnAlwaysUseFallbackPropertyChanged(
00089     winrt::DependencyObject const& sender,
00090     winrt::DependencyPropertyChangedEventArgs const& args)
00091 {
00092     auto owner = sender.as<winrt::AcrylicBrush>();
00093     winrt::get_self<AcrylicBrush>(owner)->OnPropertyChanged(args);
00094 }
00095
00096 void AcrylicBrushProperties::OnTintColorPropertyChanged(
00097     winrt::DependencyObject const& sender,
00098     winrt::DependencyPropertyChangedEventArgs const& args)
00099 {
00100     auto owner = sender.as<winrt::AcrylicBrush>();
00101     winrt::get_self<AcrylicBrush>(owner)->OnPropertyChanged(args);
00102 }
00103
00104 void AcrylicBrushProperties::OnTintLuminosityOpacityPropertyChanged(
00105     winrt::DependencyObject const& sender,
00106     winrt::DependencyPropertyChangedEventArgs const& args)
00107 {
00108     auto owner = sender.as<winrt::AcrylicBrush>();
00109
00110     auto value = winrt::unbox_value<winrt::IReference<double>>(args.NewValue());
00111     auto coercedValue = value;
00112     winrt::get_self<AcrylicBrush>(owner)->CoerceToZeroOneRange_Nullable(coercedValue);
00113     if (value != coercedValue)
00114     {
00115         sender.SetValue(args.Property(), winrt::box_value<winrt::IReference<double>>(coercedValue));
00116         return;
00117     }
00118
00119     winrt::get_self<AcrylicBrush>(owner)->OnPropertyChanged(args);
00120 }
00121
00122 void AcrylicBrushProperties::OnTintOpacityPropertyChanged(
00123     winrt::DependencyObject const& sender,
00124     winrt::DependencyPropertyChangedEventArgs const& args)
00125 {
00126     auto owner = sender.as<winrt::AcrylicBrush>();
00127
00128     auto value = winrt::unbox_value<double>(args.NewValue());
00129     auto coercedValue = value;
00130     winrt::get_self<AcrylicBrush>(owner)->CoerceToZeroOneRange(coercedValue);
00131     if (std::memcmp(&value, &coercedValue, sizeof(value)) != 0) // use memcmp to avoid tripping over nan
00132     {
00133         sender.SetValue(args.Property(), winrt::box_value<double>(coercedValue));
00134         return;
00135     }
00136
00137     winrt::get_self<AcrylicBrush>(owner)->OnPropertyChanged(args);
00138 }
00139
00140 void AcrylicBrushProperties::OnTintTransitionDurationPropertyChanged(
00141     winrt::DependencyObject const& sender,
00142     winrt::DependencyPropertyChangedEventArgs const& args)
00143 {
00144     auto owner = sender.as<winrt::AcrylicBrush>();
00145     winrt::get_self<AcrylicBrush>(owner)->OnPropertyChanged(args);
00146 }
00147
00148 void AcrylicBrushProperties::AlwaysUseFallback(bool value)
00149 {
00150     [[gsl::suppress(con)]]
00151     {
00152     static_cast<AcrylicBrush*>(this)->SetValue(s_AlwaysUseFallbackProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00153     }
00154 }
00155
00156 bool AcrylicBrushProperties::AlwaysUseFallback()
00157 {
00158     return ValueHelper<bool>::CastOrUnbox(static_cast<AcrylicBrush*>(this)->GetValue(s_AlwaysUseFallbackProperty));
00159 }
00160
00161 void AcrylicBrushProperties::TintColor(winrt::Color const& value)
00162 {
00163     [[gsl::suppress(con)]]
00164     {
00165     static_cast<AcrylicBrush*>(this)->SetValue(s_TintColorProperty, ValueHelper<winrt::Color>::BoxValueIfNecessary(value));
00166     }
00167 }
00168
00169 winrt::Color AcrylicBrushProperties::TintColor()
00170 {
00171     return ValueHelper<winrt::Color>::CastOrUnbox(static_cast<AcrylicBrush*>(this)->GetValue(s_TintColorProperty));
00172 }
00173
00174 void AcrylicBrushProperties::TintLuminosityOpacity(winrt::IReference<double> const& value)
00175 {
00176     [[gsl::suppress(con)]]
00177     {
00178     winrt::IReference<double> coercedValue = value;
00179     static_cast<AcrylicBrush*>(this)->CoerceToZeroOneRange_Nullable(coercedValue);
00180     static_cast<AcrylicBrush*>(this)->SetValue(s_TintLuminosityOpacityProperty, ValueHelper<winrt::IReference<double>>::BoxValueIfNecessary(coercedValue));
00181     }
00182 }
00183
00184 winrt::IReference<double> AcrylicBrushProperties::TintLuminosityOpacity()
00185 {
00186     return ValueHelper<winrt::IReference<double>>::CastOrUnbox(static_cast<AcrylicBrush*>(this)->GetValue(s_TintLuminosityOpacityProperty));
00187 }
00188
00189 void AcrylicBrushProperties::TintOpacity(double value)
00190 {
00191     [[gsl::suppress(con)]]
00192     {
00193     double coercedValue = value;
00194     static_cast<AcrylicBrush*>(this)->CoerceToZeroOneRange(coercedValue);
00195     static_cast<AcrylicBrush*>(this)->SetValue(s_TintOpacityProperty, ValueHelper<double>::BoxValueIfNecessary(coercedValue));
00196     }
00197 }
00198
00199 double AcrylicBrushProperties::TintOpacity()
00200 {
00201     return ValueHelper<double>::CastOrUnbox(static_cast<AcrylicBrush*>(this)->GetValue(s_TintOpacityProperty));
00202 }
00203
00204 void AcrylicBrushProperties::TintTransitionDuration(winrt::TimeSpan const& value)
00205 {
00206     [[gsl::suppress(con)]]
00207     {
00208     static_cast<AcrylicBrush*>(this)->SetValue(s_TintTransitionDurationProperty, ValueHelper<winrt::TimeSpan>::BoxValueIfNecessary(value));
00209     }
00210 }
00211
00212 winrt::TimeSpan AcrylicBrushProperties::TintTransitionDuration()
00213 {
00214     return ValueHelper<winrt::TimeSpan>::CastOrUnbox(static_cast<AcrylicBrush*>(this)->GetValue(s_TintTransitionDurationProperty));
00215 }
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommandBarFlyoutCommandBarAutomationPropertiesProperties Member List

This is the complete list of members for CommandBarFlyoutCommandBarAutomationPropertiesProperties, including all inherited members.
ClearProperties() | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
CommandBarFlyoutCommandBarAutomationPropertiesProperties() | CommandBarFlyoutCommandBarAutomationPropertiesProperties |
ControlTypeProperty() | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [inline, static]
EnsureProperties() | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
GetControlType(winrt::UIElement const &target) | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
s_ControlTypeProperty | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
SetControlType(winrt::UIElement const &target, winrt::AutomationControlType const &value) | CommandBarFlyoutCommandBarAutomationPropertiesProperties | [static]
Generated on Sun Dec 1 2024 20:52:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/InteractionTests/ScrollPresenterTestsBase.cs Source File

  • ScrollPresenter
  • InteractionTests

ScrollPresenterTestsBase.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using System;
00006 using System.Collections.Generic;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation;
00016 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00017 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00018
00019 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00020 {
00021     // Base class for ScrollPresenterTestsWithAutomationPeer and ScrollPresenterTestsWithInputHelper with common private debugging facilities.
00022     public class ScrollPresenterTestsBase
00023     {
00024         // outputDebugStringLevel can be "None", "Info" or "Verbose"
00025         protected void SetOutputDebugStringLevel(string outputDebugStringLevel)
00026         {
00027             Log.Comment("Retrieving cmbScrollPresenterOutputDebugStringLevel");
00028             ComboBox cmbScrollPresenterOutputDebugStringLevel = new ComboBox(FindElement.ByName("cmbScrollPresenterOutputDebugStringLevel"));
00029             Verify.IsNotNull(cmbScrollPresenterOutputDebugStringLevel, "Verifying that cmbScrollPresenterOutputDebugStringLevel was found");
00030
00031             Log.Comment("Changing output-debug-string-level selection to " + outputDebugStringLevel);
00032             cmbScrollPresenterOutputDebugStringLevel.SelectItemByName(outputDebugStringLevel);
00033             Log.Comment("Selection is now {0}", cmbScrollPresenterOutputDebugStringLevel.Selection[0].Name);
00034         }
00035
00036         protected void SetLoggingLevel(bool isPrivateLoggingEnabled)
00037         {
00038             Log.Comment("Retrieving chkLogScrollPresenterMessages");
00039             CheckBox chkLogScrollPresenterMessages = new CheckBox(FindElement.ById("chkLogScrollPresenterMessages"));
00040             Verify.IsNotNull(chkLogScrollPresenterMessages, "Verifying that chkLogScrollPresenterMessages was found");
00041
00042             if (isPrivateLoggingEnabled && chkLogScrollPresenterMessages.ToggleState != ToggleState.On ||
00043                 !isPrivateLoggingEnabled && chkLogScrollPresenterMessages.ToggleState != ToggleState.Off)
00044             {
00045                 Log.Comment("Toggling chkLogScrollPresenterMessages.IsChecked to " + isPrivateLoggingEnabled);
00046                 chkLogScrollPresenterMessages.Toggle();
00047                 Wait.ForIdle();
00048             }
00049         }
00050
00051         protected void LogTraces()
00052         {
00053             LogTraces(false /*recordWarning*/);
00054         }
00055
00056         protected void LogTraces(bool recordWarning)
00057         {
00058             List<string> traces = recordWarning ? new List<string>() : null;
00059
00060             Log.Comment("Reading full log:");
00061
00062             UIObject fullLogUIObject = FindElement.ById("cmbFullLog");
00063             Verify.IsNotNull(fullLogUIObject);
00064             ComboBox cmbFullLog = new ComboBox(fullLogUIObject);
00065             Verify.IsNotNull(cmbFullLog);
00066
00067             UIObject getFullLogUIObject = FindElement.ById("btnGetFullLog");
00068             Verify.IsNotNull(getFullLogUIObject);
00069             Button getFullLogButton = new Button(getFullLogUIObject);
00070             Verify.IsNotNull(getFullLogButton);
00071
00072             getFullLogButton.Invoke();
00073             Wait.ForIdle();
00074
00075             foreach (ComboBoxItem item in cmbFullLog.AllItems)
00076             {
00077                 string trace = item.Name;
00078
00079                 if (recordWarning)
00080                 {
00081                     traces.Add(trace);
00082                 }
00083                 Log.Comment(trace);
00084             }
00085
00086             if (recordWarning)
00087             {
00088                 string warning = "Non-final test pass failed.";
00089                 Log.Warning(warning);
00090
00091                 WarningReportHelper.Record(warning, traces);
00092             }
00093         }
00094
00095         protected void ClearTraces()
00096         {
00097             Log.Comment("Clearing full log.");
00098
00099             UIObject clearFullLogUIObject = FindElement.ById("btnClearFullLog");
00100             Verify.IsNotNull(clearFullLogUIObject);
00101             Button clearFullLogButton = new Button(clearFullLogUIObject);
00102             Verify.IsNotNull(clearFullLogButton);
00103
00104             clearFullLogButton.Invoke();
00105             Wait.ForIdle();
00106         }
00107
00108         protected void LogAndClearTraces()
00109         {
00110             LogAndClearTraces(false /*recordTraces*/);
00111         }
00112
00113         protected void LogAndClearTraces(bool recordWarning)
00114         {
00115             LogTraces(recordWarning);
00116             ClearTraces();
00117         }
00118
00119         protected bool WaitForEditValue(string editName, string editValue, double secondsTimeout = 2.0, bool throwOnError = true)
00120         {
00121             Edit edit = new Edit(FindElement.ById(editName));
00122             Verify.IsNotNull(edit);
00123             Log.Comment("Current value for " + editName + ": " + edit.Value);
00124             if (edit.Value != editValue)
00125             {
00126                 using (var waiter = new ValueChangedEventWaiter(edit, editValue))
00127                 {
00128                     Log.Comment("Waiting for " + editName + " to be set to " + editValue);
00129
00130                     bool success = waiter.TryWait(TimeSpan.FromSeconds(secondsTimeout));
00131                     Log.Comment("Current value for " + editName + ": " + edit.Value);
00132
00133                     if (success)
00134                     {
00135                         Log.Comment("Wait succeeded");
00136                     }
00137                     else
00138                     {
00139                         if (edit.Value == editValue)
00140                         {
00141                             Log.Warning("Wait failed but TextBox contains expected Text");
00142                             LogAndClearTraces();
00143                         }
00144                         else
00145                         {
00146                             if (throwOnError)
00147                             {
00148                                 Log.Error("Wait for edit value failed");
00149                                 LogAndClearTraces();
00150                                 throw new WaiterException();
00151                             }
00152                             else
00153                             {
00154                                 Log.Warning("Wait for edit value failed");
00155                                 LogAndClearTraces();
00156                                 return false;
00157                             }
00158                         }
00159                     }
00160                 }
00161             }
00162             return true;
00163         }
00164     }
00165 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewItemPresenter Member List

This is the complete list of members for NavigationViewItemPresenter, including all inherited members.
abi_enter() | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
CheckThread() | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
ClearProperties() | NavigationViewItemPresenterProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< NavigationViewItemPresenter > &&self) noexcept | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline, static]
EnsureProperties() | NavigationViewItemPresenterProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
final_release(std::unique_ptr< NavigationViewItemPresenter > &&self) | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline, static]
GetBase() | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
GetInner() | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
GetNavigationViewItem() | NavigationViewItemPresenter | [private]
GetSelectionIndicator() | NavigationViewItemPresenter |
GoToElementStateCore(winrt::hstring const &stateName, bool useTransitions) | NavigationViewItemPresenter |
Icon(winrt::IconElement const &value) | NavigationViewItemPresenterProperties |
Icon() | NavigationViewItemPresenterProperties |
IconProperty() | NavigationViewItemPresenterProperties | [inline, static]
IgnorePointerId(const winrt::PointerRoutedEventArgs &args) | NavigationViewItemPresenter | [private]
InfoBadge(winrt::InfoBadge const &value) | NavigationViewItemPresenterProperties |
InfoBadge() | NavigationViewItemPresenterProperties |
InfoBadgeProperty() | NavigationViewItemPresenterProperties | [inline, static]
IsOnThread() | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
LoadChevron() | NavigationViewItemPresenter |
NavigationViewItemPresenter() | NavigationViewItemPresenter |
NavigationViewItemPresenterProperties() | NavigationViewItemPresenterProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
OnApplyTemplate() | NavigationViewItemPresenter |
OnExpandCollapseChevronPointerCanceled(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItemPresenter | [private]
OnExpandCollapseChevronPointerCaptureLost(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItemPresenter | [private]
OnExpandCollapseChevronPointerExited(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItemPresenter | [private]
OnExpandCollapseChevronPointerPressed(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItemPresenter | [private]
OnExpandCollapseChevronPointerReleased(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItemPresenter | [private]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< NavigationViewItemPresenter, winrt::implementation::NavigationViewItemPresenterT > | [inline]
ResetTrackedPointerId() | NavigationViewItemPresenter | [private]
RotateExpandCollapseChevron(bool isExpanded) | NavigationViewItemPresenter |
s_IconProperty | NavigationViewItemPresenterProperties | [static]
s_InfoBadgeProperty | NavigationViewItemPresenterProperties | [static]
s_TemplateSettingsProperty | NavigationViewItemPresenterProperties | [static]
TemplateSettings(winrt::NavigationViewItemPresenterTemplateSettings const &value) | NavigationViewItemPresenterProperties |
TemplateSettings() | NavigationViewItemPresenterProperties |
TemplateSettingsProperty() | NavigationViewItemPresenterProperties | [inline, static]
UnhookEventsAndClearFields() | NavigationViewItemPresenter | [private]
UpdateClosedCompactVisualState(bool isTopLevelItem, bool isClosedCompact) | NavigationViewItemPresenter |
UpdateCompactPaneLength(double compactPaneLength, bool shouldUpdate) | NavigationViewItemPresenter |
UpdateContentLeftIndentation(double leftIndentation) | NavigationViewItemPresenter |
UpdateMargin() | NavigationViewItemPresenter | [private]
Generated on Sun Dec 1 2024 20:52:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SimpleVerify Member List

This is the complete list of members for SimpleVerify, including all inherited members.
_errors | SimpleVerify | [private]
IsEqual(object actualValue, object expectValue, string message) | SimpleVerify | [inline]
IsTrue(bool condition, string message) | SimpleVerify | [inline]
ToString() | SimpleVerify | [inline]
Generated on Sun Dec 1 2024 20:54:37 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ZoomSnapPointBase Member List

This is the complete list of members for ZoomSnapPointBase, including all inherited members.
OnUpdateViewport(double newViewport) | ZoomSnapPointBase | [private]
ZoomSnapPointBase() | ZoomSnapPointBase | [protected]
Generated on Sun Dec 1 2024 20:53:24 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IconSourceToIconSourceElementConverter Member List

This is the complete list of members for IconSourceToIconSourceElementConverter, including all inherited members.
Convert(winrt::IInspectable const &value, winrt::TypeName const &targetType, winrt::IInspectable const &parameter, winrt::hstring const &language) | IconSourceToIconSourceElementConverter
ConvertBack(winrt::IInspectable const &value, winrt::TypeName const &targetType, winrt::IInspectable const &parameter, winrt::hstring const &language) noexcept | IconSourceToIconSourceElementConverter
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TestUI/TreeViewNodeInMarkupTestPage.xaml.cs Source File

  • TreeView
  • TestUI

TreeViewNodeInMarkupTestPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     public sealed partial class TreeViewNodeInMarkupTestPage : TestPage
00007     {
00008         public TreeViewNodeInMarkupTestPage()
00009         {
00010             this.InitializeComponent();
00011         }
00012     }
00013 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CustomItemsSource Member List

This is the complete list of members for CustomItemsSource, including all inherited members.
_inner | CustomItemsSource | [private]
Add(object value) | CustomItemsSourceView | [inline]
Clear() | CustomItemsSource | [inline]
CollectionChanged | CustomItemsSourceView |
Contains(object value) | CustomItemsSourceView | [inline]
CopyTo(Array array, int index) | CustomItemsSourceView | [inline]
Count | CustomItemsSourceView |
CustomItemsSource(List< int > source) | CustomItemsSource | [inline]
GetAt(int index) | CustomItemsSource | [inline]
GetAtCallCount | CustomItemsSource |
GetAtCore(int index) | CustomItemsSource | [inline, protected, virtual]
GetEnumerator() | CustomItemsSourceView | [inline]
GetSizeCore() | CustomItemsSource | [inline, protected, virtual]
IndexOf(object value) | CustomItemsSourceView | [inline]
Inner | CustomItemsSource |
Insert(int index, int count, bool reset, int valueStart=1000) | CustomItemsSource | [inline]
Microsoft::UI::Xaml::Tests::MUXControls::ApiTests::RepeaterTests::Common::CustomItemsSourceView::Insert(int index, object value) | CustomItemsSourceView | [inline]
IsFixedSize | CustomItemsSourceView |
IsReadOnly | CustomItemsSourceView |
IsSynchronized | CustomItemsSourceView |
Move(int oldIndex, int newIndex, int count, bool reset) | CustomItemsSource | [inline]
OnItemsSourceChanged(NotifyCollectionChangedEventArgs args) | CustomItemsSourceView | [inline, protected]
Remove(int index, int count, bool reset) | CustomItemsSource | [inline]
Microsoft::UI::Xaml::Tests::MUXControls::ApiTests::RepeaterTests::Common::CustomItemsSourceView::Remove(object value) | CustomItemsSourceView | [inline]
RemoveAt(int index) | CustomItemsSourceView | [inline]
Replace(int index, int oldCount, int newCount, bool reset) | CustomItemsSource | [inline]
Reset() | CustomItemsSource | [inline]
SyncRoot | CustomItemsSourceView |
this | CustomItemsSourceView |
Generated on Sun Dec 1 2024 20:53:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ImageIcon.properties.cpp Source File

  • Generated

ImageIcon.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "ImageIcon.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(ImageIcon)
00012 }
00013
00014 #include "ImageIcon.g.cpp"
00015
00016 GlobalDependencyProperty ImageIconProperties::s_SourceProperty{ nullptr };
00017
00018 ImageIconProperties::ImageIconProperties()
00019 {
00020     EnsureProperties();
00021 }
00022
00023 void ImageIconProperties::EnsureProperties()
00024 {
00025     if (!s_SourceProperty)
00026     {
00027         s_SourceProperty =
00028             InitializeDependencyProperty(
00029                 L"Source",
00030                 winrt::name_of<winrt::ImageSource>(),
00031                 winrt::name_of<winrt::ImageIcon>(),
00032                 false /* isAttached */,
00033                 ValueHelper<winrt::ImageSource>::BoxedDefaultValue(),
00034                 winrt::PropertyChangedCallback(&OnSourcePropertyChanged));
00035     }
00036 }
00037
00038 void ImageIconProperties::ClearProperties()
00039 {
00040     s_SourceProperty = nullptr;
00041 }
00042
00043 void ImageIconProperties::OnSourcePropertyChanged(
00044     winrt::DependencyObject const& sender,
00045     winrt::DependencyPropertyChangedEventArgs const& args)
00046 {
00047     auto owner = sender.as<winrt::ImageIcon>();
00048     winrt::get_self<ImageIcon>(owner)->OnSourcePropertyChanged(args);
00049 }
00050
00051 void ImageIconProperties::Source(winrt::ImageSource const& value)
00052 {
00053     [[gsl::suppress(con)]]
00054     {
00055     static_cast<ImageIcon*>(this)->SetValue(s_SourceProperty, ValueHelper<winrt::ImageSource>::BoxValueIfNecessary(value));
00056     }
00057 }
00058
00059 winrt::ImageSource ImageIconProperties::Source()
00060 {
00061     return ValueHelper<winrt::ImageSource>::CastOrUnbox(static_cast<ImageIcon*>(this)->GetValue(s_SourceProperty));
00062 }
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/SnapPointWrapper.cpp Source File

  • ScrollPresenter

SnapPointWrapper.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "SnapPointWrapper.h"
00007
00008 template<typename T>
00009 SnapPointWrapper<T>::SnapPointWrapper(T const& snapPoint)
00010     : m_snapPoint(snapPoint)
00011 {
00012 }
00013
00014 #ifdef DBG
00015 template<typename T>
00016 SnapPointWrapper<T>::~SnapPointWrapper()
00017 {
00018 }
00019 #endif //DBG
00020
00021 template<typename T>
00022 T SnapPointWrapper<T>::SnapPoint() const
00023 {
00024     return m_snapPoint;
00025 }
00026
00027 template<typename T>
00028 std::tuple<double, double> SnapPointWrapper<T>::ActualApplicableZone() const
00029 {
00030     return m_actualApplicableZone;
00031 }
00032
00033 template<typename T>
00034 int SnapPointWrapper<T>::CombinationCount() const
00035 {
00036     return m_combinationCount;
00037 }
00038
00039 template<typename T>
00040 bool SnapPointWrapper<T>::ResetIgnoredValue()
00041 {
00042     if (!isnan(m_ignoredValue))
00043     {
00044         m_ignoredValue = NAN;
00045         return true;
00046     }
00047
00048     return false;
00049 }
00050
00051 template<typename T>
00052 void SnapPointWrapper<T>::SetIgnoredValue(double ignoredValue)
00053 {
00054     MUX_ASSERT(!isnan(ignoredValue));
00055
00056     m_ignoredValue = ignoredValue;
00057 }
00058
00059 template<typename T>
00060 winrt::ExpressionAnimation SnapPointWrapper<T>::CreateRestingPointExpression(
00061     winrt::InteractionTracker const& interactionTracker,
00062     winrt::hstring const& target,
00063     winrt::hstring const& scale,
00064     bool isInertiaFromImpulse)
00065 {
00066     m_restingValueExpressionAnimation = GetSnapPointFromWrapper(this)->CreateRestingPointExpression(
00067         m_ignoredValue,
00068         m_actualImpulseApplicableZone,
00069         interactionTracker,
00070         target,
00071         scale,
00072         isInertiaFromImpulse);
00073
00074     return m_restingValueExpressionAnimation;
00075 }
00076
00077 template<typename T>
00078 winrt::ExpressionAnimation SnapPointWrapper<T>::CreateConditionalExpression(
00079     winrt::InteractionTracker const& interactionTracker,
00080     winrt::hstring const& target,
00081     winrt::hstring const& scale,
00082     bool isInertiaFromImpulse)
00083 {
00084     m_conditionExpressionAnimation = GetSnapPointFromWrapper(this)->CreateConditionalExpression(
00085         m_actualApplicableZone,
00086         m_actualImpulseApplicableZone,
00087         interactionTracker,
00088         target,
00089         scale,
00090         isInertiaFromImpulse);
00091
00092     return m_conditionExpressionAnimation;
00093 }
00094
00095 // Invoked when the InteractionTracker reaches the Idle State and a new ignored value may have to be set.
00096 template<typename T>
00097 std::tuple<winrt::ExpressionAnimation, winrt::ExpressionAnimation> SnapPointWrapper<T>::GetUpdatedExpressionAnimationsForImpulse()
00098 {
00099     const SnapPointBase* snapPoint = GetSnapPointFromWrapper(this);
00100
00101     snapPoint->UpdateConditionalExpressionAnimationForImpulse(
00102         m_conditionExpressionAnimation,
00103         m_actualImpulseApplicableZone);
00104     snapPoint->UpdateRestingPointExpressionAnimationForImpulse(
00105         m_restingValueExpressionAnimation,
00106         m_ignoredValue,
00107         m_actualImpulseApplicableZone);
00108
00109     return std::make_tuple(m_conditionExpressionAnimation, m_restingValueExpressionAnimation);
00110 }
00111
00112 template<typename T>
00113 void SnapPointWrapper<T>::DetermineActualApplicableZone(
00114     const SnapPointWrapper<T>* previousSnapPointWrapper,
00115     const SnapPointWrapper<T>* nextSnapPointWrapper,
00116     bool forImpulseOnly)
00117 {
00118     SnapPointBase* snapPoint = GetSnapPointFromWrapper(this);
00119     const SnapPointBase* previousSnapPoint = GetSnapPointFromWrapper(previousSnapPointWrapper);
00120     const SnapPointBase* nextSnapPoint = GetSnapPointFromWrapper(nextSnapPointWrapper);
00121     const double previousIgnoredValue = previousSnapPointWrapper ? previousSnapPointWrapper->m_ignoredValue : NAN;
00122     const double nextIgnoredValue = nextSnapPointWrapper ? nextSnapPointWrapper->m_ignoredValue : NAN;
00123
00124     if (!forImpulseOnly)
00125     {
00126         m_actualApplicableZone = snapPoint->DetermineActualApplicableZone(
00127             previousSnapPoint,
00128             nextSnapPoint);
00129     }
00130
00131     m_actualImpulseApplicableZone = snapPoint->DetermineActualImpulseApplicableZone(
00132         previousSnapPoint,
00133         nextSnapPoint,
00134         m_ignoredValue,
00135         previousIgnoredValue,
00136         nextIgnoredValue);
00137 }
00138
00139 template<typename T>
00140 void SnapPointWrapper<T>::Combine(const SnapPointWrapper<T>* snapPointWrapper)
00141 {
00142     GetSnapPointFromWrapper(this)->Combine(m_combinationCount, snapPointWrapper->SnapPoint());
00143 }
00144
00145 template<typename T>
00146 double SnapPointWrapper<T>::Evaluate(double value) const
00147 {
00148     return GetSnapPointFromWrapper(this)->Evaluate(m_actualApplicableZone, value);
00149 }
00150
00151 template<typename T>
00152 bool SnapPointWrapper<T>::SnapsAt(double value) const
00153 {
00154     return GetSnapPointFromWrapper(this)->SnapsAt(m_actualApplicableZone, value);
00155 }
00156
00157 template<typename T>
00158 SnapPointBase* SnapPointWrapper<T>::GetSnapPointFromWrapper(std::shared_ptr<SnapPointWrapper<T>> snapPointWrapper)
00159 {
00160     return GetSnapPointFromWrapper(snapPointWrapper.get());
00161 }
00162
00163 template<typename T>
00164 SnapPointBase* SnapPointWrapper<T>::GetSnapPointFromWrapper(const SnapPointWrapper<T>* snapPointWrapper)
00165 {
00166     if (snapPointWrapper)
00167     {
00168         winrt::SnapPointBase winrtPreviousSnapPoint = snapPointWrapper->SnapPoint().as<winrt::SnapPointBase>();
00169         return winrt::get_self<SnapPointBase>(winrtPreviousSnapPoint);
00170     }
00171     return nullptr;
00172 }
00173
00174 template SnapPointWrapper<winrt::ScrollSnapPointBase>::SnapPointWrapper(winrt::ScrollSnapPointBase const& snapPoint);
00175 template SnapPointWrapper<winrt::ZoomSnapPointBase>::SnapPointWrapper(winrt::ZoomSnapPointBase const& snapPoint);
00176
00177 #ifdef DBG
00178 template SnapPointWrapper<winrt::ScrollSnapPointBase>::~SnapPointWrapper();
00179 template SnapPointWrapper<winrt::ZoomSnapPointBase>::~SnapPointWrapper();
00180 #endif //DBG
00181
00182 template winrt::ScrollSnapPointBase SnapPointWrapper<winrt::ScrollSnapPointBase>::SnapPoint() const;
00183 template winrt::ZoomSnapPointBase SnapPointWrapper<winrt::ZoomSnapPointBase>::SnapPoint() const;
00184
00185 template std::tuple<double, double> SnapPointWrapper<winrt::ScrollSnapPointBase>::ActualApplicableZone() const;
00186 template std::tuple<double, double> SnapPointWrapper<winrt::ZoomSnapPointBase>::ActualApplicableZone() const;
00187
00188 template int SnapPointWrapper<winrt::ScrollSnapPointBase>::CombinationCount() const;
00189 template int SnapPointWrapper<winrt::ZoomSnapPointBase>::CombinationCount() const;
00190
00191 template bool SnapPointWrapper<winrt::ScrollSnapPointBase>::ResetIgnoredValue();
00192 template bool SnapPointWrapper<winrt::ZoomSnapPointBase>::ResetIgnoredValue();
00193
00194 template void SnapPointWrapper<winrt::ScrollSnapPointBase>::SetIgnoredValue(double ignoredValue);
00195 template void SnapPointWrapper<winrt::ZoomSnapPointBase>::SetIgnoredValue(double ignoredValue);
00196
00197 template winrt::ExpressionAnimation SnapPointWrapper<winrt::ScrollSnapPointBase>::CreateRestingPointExpression(
00198     winrt::InteractionTracker const& interactionTracker,
00199     winrt::hstring const& target,
00200     winrt::hstring const& scale,
00201     bool isInertiaFromImpulse);
00202 template winrt::ExpressionAnimation SnapPointWrapper<winrt::ZoomSnapPointBase>::CreateRestingPointExpression(
00203     winrt::InteractionTracker const& interactionTracker,
00204     winrt::hstring const& target,
00205     winrt::hstring const& scale,
00206     bool isInertiaFromImpulse);
00207
00208 template winrt::ExpressionAnimation SnapPointWrapper<winrt::ScrollSnapPointBase>::CreateConditionalExpression(
00209     winrt::InteractionTracker const& interactionTracker,
00210     winrt::hstring const& target,
00211     winrt::hstring const& scale,
00212     bool isInertiaFromImpulse);
00213 template winrt::ExpressionAnimation SnapPointWrapper<winrt::ZoomSnapPointBase>::CreateConditionalExpression(
00214     winrt::InteractionTracker const& interactionTracker,
00215     winrt::hstring const& target,
00216     winrt::hstring const& scale,
00217     bool isInertiaFromImpulse);
00218
00219 template std::tuple<winrt::ExpressionAnimation, winrt::ExpressionAnimation> SnapPointWrapper<winrt::ScrollSnapPointBase>::GetUpdatedExpressionAnimationsForImpulse();
00220 template std::tuple<winrt::ExpressionAnimation, winrt::ExpressionAnimation> SnapPointWrapper<winrt::ZoomSnapPointBase>::GetUpdatedExpressionAnimationsForImpulse();
00221
00222 template void SnapPointWrapper<winrt::ScrollSnapPointBase>::DetermineActualApplicableZone(
00223     const SnapPointWrapper<winrt::ScrollSnapPointBase>* previousSnapPoint,
00224     const SnapPointWrapper<winrt::ScrollSnapPointBase>* nextSnapPoint,
00225     bool forImpulseOnly);
00226 template void SnapPointWrapper<winrt::ZoomSnapPointBase>::DetermineActualApplicableZone(
00227     const SnapPointWrapper<winrt::ZoomSnapPointBase>* previousSnapPoint,
00228     const SnapPointWrapper<winrt::ZoomSnapPointBase>* nextSnapPoint,
00229     bool forImpulseOnly);
00230
00231 template void SnapPointWrapper<winrt::ScrollSnapPointBase>::Combine(const SnapPointWrapper<winrt::ScrollSnapPointBase>* snapPointWrapper);
00232 template void SnapPointWrapper<winrt::ZoomSnapPointBase>::Combine(const SnapPointWrapper<winrt::ZoomSnapPointBase>* snapPointWrapper);
00233
00234 template double SnapPointWrapper<winrt::ScrollSnapPointBase>::Evaluate(double value) const;
00235 template double SnapPointWrapper<winrt::ZoomSnapPointBase>::Evaluate(double value) const;
00236
00237 template bool SnapPointWrapper<winrt::ScrollSnapPointBase>::SnapsAt(double value) const;
00238 template bool SnapPointWrapper<winrt::ZoomSnapPointBase>::SnapsAt(double value) const;
00239
00240 template SnapPointBase* SnapPointWrapper<winrt::ScrollSnapPointBase>::GetSnapPointFromWrapper(std::shared_ptr<SnapPointWrapper<winrt::ScrollSnapPointBase>> snapPointWrapper);
00241 template SnapPointBase* SnapPointWrapper<winrt::ZoomSnapPointBase>::GetSnapPointFromWrapper(std::shared_ptr<SnapPointWrapper<winrt::ZoomSnapPointBase>> snapPointWrapper);
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MockElementFactory::RecycleElementCallInfo Member List

This is the complete list of members for MockElementFactory::RecycleElementCallInfo, including all inherited members.
Element | MockElementFactory::RecycleElementCallInfo |
Owner | MockElementFactory::RecycleElementCallInfo |
RecycleElementCallInfo(UIElement element, UIElement owner) | MockElementFactory::RecycleElementCallInfo | [inline]
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Expander/InteractionTests/ExpanderTests.cs Source File

  • Expander
  • InteractionTests

ExpanderTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00008 using System.Collections.Generic;
00009 using Windows.Foundation.Metadata;
00010
00011 using WEX.TestExecution;
00012 using WEX.TestExecution.Markup;
00013 using WEX.Logging.Interop;
00014
00015 using Microsoft.Windows.Apps.Test.Automation;
00016 using Microsoft.Windows.Apps.Test.Foundation;
00017 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00018 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00019 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00020 using MUXTestInfra.Shared.Infra;
00021
00022 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00023 {
00024     public class Expander : UIObject, IExpandCollapse
00025     {
00026         public Expander(UIObject uiObject)
00027             : base(uiObject)
00028         {
00029             this.Initialize();
00030         }
00031
00032         private void Initialize()
00033         {
00034             _expandCollapsePattern = new ExpandCollapseImplementation(this);
00035         }
00036
00037         public void ExpandAndWait()
00038         {
00039             using (var waiter = GetExpandedWaiter())
00040             {
00041                 Expand();
00042                 waiter.Wait();
00043             }
00044
00045             Wait.ForIdle();
00046         }
00047
00048         public void CollapseAndWait()
00049         {
00050             using (var waiter = GetCollapsedWaiter())
00051             {
00052                 Collapse();
00053                 waiter.Wait();
00054             }
00055
00056             Wait.ForIdle();
00057         }
00058
00059         public void Expand()
00060         {
00061             _expandCollapsePattern.Expand();
00062         }
00063
00064         public void Collapse()
00065         {
00066             _expandCollapsePattern.Collapse();
00067         }
00068
00069         public UIEventWaiter GetExpandedWaiter()
00070         {
00071             return _expandCollapsePattern.GetExpandedWaiter();
00072         }
00073
00074         public UIEventWaiter GetCollapsedWaiter()
00075         {
00076             return _expandCollapsePattern.GetCollapsedWaiter();
00077         }
00078
00079         public ExpandCollapseState ExpandCollapseState
00080         {
00081             get { return _expandCollapsePattern.ExpandCollapseState; }
00082         }
00083
00084         new public static IFactory<Expander> Factory
00085         {
00086             get
00087             {
00088                 if (null == Expander._factory)
00089                 {
00090                     Expander._factory = new ExpanderFactory();
00091                 }
00092                 return Expander._factory;
00093             }
00094         }
00095
00096         private IExpandCollapse _expandCollapsePattern;
00097         private static IFactory<Expander> _factory = null;
00098         private class ExpanderFactory : IFactory<Expander>
00099         {
00100             public Expander Create(UIObject element)
00101             {
00102                 return new Expander(element);
00103             }
00104         }
00105     }
00106
00107     [TestClass]
00108     public class ExpanderTests
00109     {
00110         [ClassInitialize]
00111         [TestProperty("RunAs", "User")]
00112         [TestProperty("Classification", "Integration")]
00113         [TestProperty("Platform", "Any")]
00114         [TestProperty("MUXControlsTestSuite", "SuiteB")]
00115         public static void ClassInitialize(TestContext testContext)
00116         {
00117             TestEnvironment.Initialize(testContext);
00118         }
00119
00120         public void TestCleanup()
00121         {
00122             TestCleanupHelper.Cleanup();
00123         }
00124
00125         [TestMethod]
00126         public void VerifyAxeScanPasses()
00127         {
00128             using (var setup = new TestSetupHelper("Expander-Axe"))
00129             {
00130                 AxeTestHelper.TestForAxeIssues();
00131             }
00132         }
00133
00134         [TestMethod]
00135         public void ExpandCollapseAutomationTests()
00136         {
00137             using (var setup = new TestSetupHelper("Expander Tests"))
00138             {
00139                 Expander expander = FindElement.ByName<Expander>("ExpandedExpander");
00140                 expander.SetFocus();
00141                 Wait.ForIdle();
00142
00143                 Log.Comment("Collapse using keyboard space key.");
00144                 KeyboardHelper.PressKey(Key.Space);
00145                 Verify.AreEqual(expander.ExpandCollapseState, ExpandCollapseState.Collapsed);
00146
00147                 Log.Comment("Expand using keyboard space key.");
00148                 KeyboardHelper.PressKey(Key.Space);
00149                 Verify.AreEqual(expander.ExpandCollapseState, ExpandCollapseState.Expanded);
00150
00151                 Log.Comment("Collapse by clicking.");
00152                 expander.Click();
00153                 Verify.AreEqual(expander.ExpandCollapseState, ExpandCollapseState.Collapsed);
00154
00155                 Log.Comment("Expand by clicking.");
00156                 expander.Click();
00157                 Verify.AreEqual(expander.ExpandCollapseState, ExpandCollapseState.Expanded);
00158
00159                 Log.Comment("Collapse using UIA ExpandCollapse pattern");
00160                 expander.CollapseAndWait();
00161                 Verify.AreEqual(expander.ExpandCollapseState, ExpandCollapseState.Collapsed);
00162
00163                 Log.Comment("Expand using UIA ExpandCollapse pattern");
00164                 expander.ExpandAndWait();
00165                 Verify.AreEqual(expander.ExpandCollapseState, ExpandCollapseState.Expanded);
00166             }
00167         }
00168
00169         [TestMethod]
00170         public void AutomationPeerTest()
00171         {
00172             using (var setup = new TestSetupHelper("Expander Tests"))
00173             {
00174                 // An control to take initial focus:
00175                 Button dummyButton = FindElement.ByName<Button>("DummyButton");
00176                 dummyButton.SetFocus();
00177                 Wait.ForIdle();
00178
00179                 Expander expander = FindElement.ByName<Expander>("ExpanderWithToggleSwitch");
00180                 Verify.IsTrue(expander.IsKeyboardFocusable, "Expander should be Keyboard Focusable");
00181                 Verify.IsFalse(expander.HasKeyboardFocus, "Expander should initially be unfocused");
00182
00183                 expander.SetFocus();
00184                 Wait.ForIdle();
00185
00186                 Verify.IsTrue(expander.HasKeyboardFocus, "Expander should be focused");
00187
00188                 // Verify ExpandedExpander header content AutomationProperties.Name properties are set
00189                 VerifyElement.Found("This expander with ToggleSwitch is expanded by default.", FindBy.Name);
00190                 VerifyElement.Found("This is the second line of text.", FindBy.Name);
00191                 VerifyElement.Found("SettingsToggleSwitch", FindBy.Name);
00192
00193                 // Verify ExpandedExpander content AutomationProperties.Name property is set
00194                 VerifyElement.Found("ExpanderWithToggleSwitch Content", FindBy.Name);
00195
00196                 Log.Comment("Collapse using keyboard space key.");
00197                 KeyboardHelper.PressKey(Key.Space);
00198                 Verify.AreEqual(expander.ExpandCollapseState, ExpandCollapseState.Collapsed);
00199
00200                 // Verify ExpandedExpander content AutomationProperties.Name property is not visible once collapsed
00201                 VerifyElement.NotFound("ExpanderWithToggleSwitch Content", FindBy.Name);
00202             }
00203         }
00204     }
00205 }
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbItem.properties.cpp Source File

  • Breadcrumb

BreadcrumbItem.properties.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "BreadCrumbItem.h"
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemCollectionTransitionProgress.cpp Source File

  • Repeater

ItemCollectionTransitionProgress.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ItemCollectionTransitionProgress.h"
00007 #include "ItemCollectionTransition.h"
00008 #include "ItemCollectionTransitionProvider.h"
00009
00010 ItemCollectionTransitionProgress::ItemCollectionTransitionProgress(winrt::ItemCollectionTransition transition)
00011 {
00012     m_transition = transition;
00013 }
00014
00015 winrt::UIElement ItemCollectionTransitionProgress::Element()
00016 {
00017     if (auto transition = m_transition.get())
00018     {
00019         return winrt::get_self<ItemCollectionTransition>(transition)->Element();
00020     }
00021     else
00022     {
00023         return nullptr;
00024     }
00025 }
00026
00027 void ItemCollectionTransitionProgress::Complete()
00028 {
00029     if (auto transition = m_transition.get())
00030     {
00031         auto transitionImpl = winrt::get_self<ItemCollectionTransition>(transition);
00032         auto transitionProvider = winrt::get_self<ItemCollectionTransitionProvider>(transitionImpl->OwningProvider());
00033         transitionProvider->NotifyTransitionCompleted(transition);
00034     }
00035 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

EffectBase::NamedProperty Member List

This is the complete list of members for EffectBase::NamedProperty, including all inherited members.
Index | EffectBase::NamedProperty
Mapping | EffectBase::NamedProperty
Name | EffectBase::NamedProperty
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: DropDownButton/DropDownButton.h Source File

  • DropDownButton

DropDownButton.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "DropDownButton.g.h"
00010
00011 class DropDownButton :
00012     public ReferenceTracker<DropDownButton, winrt::implementation::DropDownButtonT>
00013 {
00014
00015 public:
00016     DropDownButton();
00017
00018     // IFrameworkElement
00019     void OnApplyTemplate();
00020
00021     // IUIElement
00022     winrt::AutomationPeer OnCreateAutomationPeer();
00023
00024     // Internal -- for DropDownButtonAutomationPeer.
00025     bool IsFlyoutOpen();
00026     void OpenFlyout();
00027     void CloseFlyout();
00028
00029 private:
00030     void RegisterFlyoutEvents();
00031
00032     void OnFlyoutPropertyChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args);
00033     void OnFlyoutOpened(const winrt::IInspectable& sender, const winrt::IInspectable& args);
00034     void OnFlyoutClosed(const winrt::IInspectable& sender, const winrt::IInspectable& args);
00035
00036     bool m_isFlyoutOpen{ false };
00037
00038     PropertyChanged_revoker m_flyoutPropertyChangedRevoker{};
00039     winrt::FlyoutBase::Opened_revoker m_flyoutOpenedRevoker{};
00040     winrt::FlyoutBase::Closed_revoker m_flyoutClosedRevoker{};
00041 };
00042
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

BlankPage Member List

This is the complete list of members for BlankPage, including all inherited members.
BlankPage() BlankPage [inline]
Generated on Sun Dec 1 2024 20:53:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterChainingAndRailingPage Member List

This is the complete list of members for ScrollPresenterChainingAndRailingPage, including all inherited members.
btnClearFullLog_Click(object sender, RoutedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
btnGetFullLog_Click(object sender, RoutedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
btnResetViews_Click(object sender, RoutedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
CmbHorizontalScrollChainMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
CmbHorizontalScrollRailMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
CmbVerticalScrollChainMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
CmbVerticalScrollRailMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
CmbZoomChainMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, private]
fullLogs | ScrollPresenterChainingAndRailingPage | [private]
GetScrollPresenterWithSuffix(string suffix) | ScrollPresenterChainingAndRailingPage | [inline, private]
GetScrollViewerWithSuffix(string suffix) | ScrollPresenterChainingAndRailingPage | [inline, private]
InitializeUIFromScrollPresenter(string suffix) | ScrollPresenterChainingAndRailingPage | [inline, private]
InitializeUIFromScrollViewer(string suffix) | ScrollPresenterChainingAndRailingPage | [inline, private]
MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args) | ScrollPresenterChainingAndRailingPage | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | ScrollPresenterChainingAndRailingPage | [inline, protected]
ResetView(UIElement element) | ScrollPresenterChainingAndRailingPage | [inline, private]
scrollPresenter3ZoomFactorChangeCorrelationId | ScrollPresenterChainingAndRailingPage | [private]
ScrollPresenter_StateChanged(ScrollPresenter sender, object args) | ScrollPresenterChainingAndRailingPage | [inline, private]
ScrollPresenter_ZoomCompleted(ScrollPresenter sender, ScrollingZoomCompletedEventArgs args) | ScrollPresenterChainingAndRailingPage | [inline, private]
ScrollPresenterChainingAndRailingPage() | ScrollPresenterChainingAndRailingPage | [inline]
ScrollViewer2_DirectManipulationCompleted(object sender, object e) | ScrollPresenterChainingAndRailingPage | [inline, private]
ScrollViewer2_DirectManipulationStarted(object sender, object e) | ScrollPresenterChainingAndRailingPage | [inline, private]
~ScrollPresenterChainingAndRailingPage() | ScrollPresenterChainingAndRailingPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:27 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/Common/ElementFromElementElementFactory.cs Source File

  • Repeater
  • APITests
  • Common

ElementFromElementElementFactory.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml.Controls;
00006
00007 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common
00008 {
00009     class ElementFromElementElementFactory : ElementFactory
00010     {
00011         protected override UIElement GetElementCore(Microsoft.UI.Xaml.ElementFactoryGetArgs args)
00012         {
00013             var button = new Button();
00014             button.Content = args.Data;
00015             return button;
00016         }
00017
00018         protected override void RecycleElementCore(Microsoft.UI.Xaml.ElementFactoryRecycleArgs args)
00019         {
00020             var container = args.Element as Button;
00021             container.Content = null;
00022         }
00023     }
00024 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NumberBox/NumberBox.cpp Source File

  • NumberBox

NumberBox.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "NumberBox.h"
00007 #include "NumberBoxAutomationPeer.h"
00008 #include "NumberBoxParser.h"
00009 #include "RuntimeProfiler.h"
00010 #include "ResourceAccessor.h"
00011 #include "Utils.h"
00012 #include "winnls.h"
00013
00014 static constexpr wstring_view c_numberBoxHeaderName{ L"HeaderContentPresenter"sv };
00015 static constexpr wstring_view c_numberBoxDownButtonName{ L"DownSpinButton"sv };
00016 static constexpr wstring_view c_numberBoxUpButtonName{ L"UpSpinButton"sv };
00017 static constexpr wstring_view c_numberBoxTextBoxName{ L"InputBox"sv };
00018 static constexpr wstring_view c_numberBoxPopupName{ L"UpDownPopup"sv };
00019 static constexpr wstring_view c_numberBoxPopupDownButtonName{ L"PopupDownSpinButton"sv };
00020 static constexpr wstring_view c_numberBoxPopupUpButtonName{ L"PopupUpSpinButton"sv };
00021 static constexpr wstring_view c_numberBoxPopupContentRootName{ L"PopupContentRoot"sv };
00022
00023 static constexpr double c_popupShadowDepth = 16.0;
00024 static constexpr wstring_view c_numberBoxPopupShadowDepthName{ L"NumberBoxPopupShadowDepth"sv };
00025
00026 // Shockingly, there is no standard function for trimming strings.
00027 const std::wstring c_whitespace = L" \n\r\t\f\v";
00028 std::wstring trim(const std::wstring& s)
00029 {
00030     const size_t start = s.find_first_not_of(c_whitespace);
00031     const size_t end = s.find_last_not_of(c_whitespace);
00032     return (start == std::wstring::npos || end == std::wstring::npos) ? L"" : s.substr(start, end - start + 1);
00033 }
00034
00035 NumberBox::NumberBox()
00036 {
00037     __RP_Marker_ClassById(RuntimeProfiler::ProfId_NumberBox);
00038
00039     NumberFormatter(GetRegionalSettingsAwareDecimalFormatter());
00040
00041     PointerWheelChanged({ this, &NumberBox::OnNumberBoxScroll });
00042
00043     GotFocus({ this, &NumberBox::OnNumberBoxGotFocus });
00044     LostFocus({ this, &NumberBox::OnNumberBoxLostFocus });
00045
00046     SetDefaultStyleKey(this);
00047     SetDefaultInputScope();
00048
00049     // We are not revoking this since the event and the listener reside on the same object and as such have the same lifecycle.
00050     // That means that as soon as the NumberBox gets removed so will the event and the listener.
00051     this->RegisterPropertyChangedCallback(winrt::AutomationProperties::NameProperty(), { this , &NumberBox::OnAutomationPropertiesNamePropertyChanged });
00052     this->RegisterPropertyChangedCallback(winrt::AutomationProperties::LabeledByProperty(), { this, &NumberBox::OnAutomationPropertiesLabeledByPropertyChanged });
00053 }
00054
00055 void NumberBox::UnhookEvents()
00056 {
00057     m_upButtonClickRevoker.revoke();
00058     m_downButtonClickRevoker.revoke();
00059     m_textBoxPreviewKeyDownRevoker.revoke();
00060     m_textBoxKeyDownRevoker.revoke();
00061     m_textBoxKeyUpRevoker.revoke();
00062     m_popupUpButtonClickRevoker.revoke();
00063     m_popupDownButtonClickRevoker.revoke();
00064     m_isEnabledChangedRevoker.revoke();
00065     m_textBoxLoadedRevoker.revoke();
00066 }
00067
00068 void NumberBox::SetDefaultInputScope()
00069 {
00070     // Sets the default value of the InputScope property.
00071     // Note that InputScope is a class that cannot be set to a default value within the IDL.
00072     const auto inputScopeName = winrt::InputScopeName(winrt::InputScopeNameValue::Number);
00073     const auto inputScope = winrt::InputScope();
00074     inputScope.Names().Append(inputScopeName);
00075
00076     static_cast<NumberBox*>(this)->SetValue(s_InputScopeProperty, ValueHelper<winrt::InputScope>::BoxValueIfNecessary(inputScope));
00077
00078     return;
00079 }
00080
00081 // This was largely copied from Calculator's GetRegionalSettingsAwareDecimalFormatter()
00082 winrt::DecimalFormatter NumberBox::GetRegionalSettingsAwareDecimalFormatter()
00083 {
00084     winrt::DecimalFormatter formatter = nullptr;
00085
00086     WCHAR currentLocale[LOCALE_NAME_MAX_LENGTH] = {};
00087     if (GetUserDefaultLocaleName(currentLocale, LOCALE_NAME_MAX_LENGTH) != 0)
00088     {
00089         // GetUserDefaultLocaleName may return an invalid bcp47 language tag with trailing non-BCP47 friendly characters,
00090         // which if present would start with an underscore, for example sort order
00091         // (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd373814(v=vs.85).aspx).
00092         // Therefore, if there is an underscore in the locale name, trim all characters from the underscore onwards.
00093         WCHAR* underscore = wcschr(currentLocale, L'_');
00094         if (underscore != nullptr)
00095         {
00096             *underscore = L'\0';
00097         }
00098
00099         if (winrt::Language::IsWellFormed(currentLocale))
00100         {
00101             std::vector<winrt::hstring> languageList;
00102             languageList.push_back(winrt::hstring(currentLocale));
00103             formatter = winrt::DecimalFormatter(languageList, winrt::GlobalizationPreferences::HomeGeographicRegion());
00104         }
00105     }
00106
00107     if (!formatter)
00108     {
00109         formatter = winrt::DecimalFormatter();
00110     }
00111
00112     formatter.IntegerDigits(1);
00113     formatter.FractionDigits(0);
00114
00115     return formatter;
00116 }
00117
00118 void NumberBox::Value(double value)
00119 {
00120     // When using two way bindings to Value using x:Bind, we could end up with a stack overflow because
00121     // nan != nan. However in this case, we are using nan as a value to represent value not set (cleared)
00122     // and that can happen quite often. We can avoid the stack overflow by breaking the cycle here. This is possible
00123     // for x:Bind since the generated code goes through this property setter. This is not the case for Binding
00124     // unfortunately. x:Bind is recommended over Binding anyway due to its perf and debuggability benefits.
00125     if (!std::isnan(value) || !std::isnan(Value()))
00126     {
00127         static_cast<NumberBox*>(this)->SetValue(s_ValueProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00128     }
00129 }
00130
00131 double NumberBox::Value()
00132 {
00133     return ValueHelper<double>::CastOrUnbox(static_cast<NumberBox*>(this)->GetValue(s_ValueProperty));
00134 }
00135
00136 winrt::AutomationPeer NumberBox::OnCreateAutomationPeer()
00137 {
00138     return winrt::make<NumberBoxAutomationPeer>(*this);
00139 }
00140
00141 void NumberBox::OnApplyTemplate()
00142 {
00143     UnhookEvents();
00144
00145     const winrt::IControlProtected controlProtected = *this;
00146
00147     const auto spinDownName = ResourceAccessor::GetLocalizedStringResource(SR_NumberBoxDownSpinButtonName);
00148     const auto spinUpName = ResourceAccessor::GetLocalizedStringResource(SR_NumberBoxUpSpinButtonName);
00149
00150     if (const auto spinDown = GetTemplateChildT<winrt::RepeatButton>(c_numberBoxDownButtonName, controlProtected))
00151     {
00152         m_downButtonClickRevoker = spinDown.Click(winrt::auto_revoke, { this, &NumberBox::OnSpinDownClick });
00153
00154         // Do localization for the down button
00155         if (winrt::AutomationProperties::GetName(spinDown).empty())
00156         {
00157             winrt::AutomationProperties::SetName(spinDown, spinDownName);
00158         }
00159     }
00160
00161     if (const auto spinUp = GetTemplateChildT<winrt::RepeatButton>(c_numberBoxUpButtonName, controlProtected))
00162     {
00163         m_upButtonClickRevoker = spinUp.Click(winrt::auto_revoke, { this, &NumberBox::OnSpinUpClick });
00164
00165         // Do localization for the up button
00166         if (winrt::AutomationProperties::GetName(spinUp).empty())
00167         {
00168             winrt::AutomationProperties::SetName(spinUp, spinUpName);
00169         }
00170     }
00171
00172     UpdateHeaderPresenterState();
00173
00174     m_textBox.set([this, controlProtected]() {
00175         const auto textBox = GetTemplateChildT<winrt::TextBox>(c_numberBoxTextBoxName, controlProtected);
00176         if (textBox)
00177         {
00178             // Listen to PreviewKeyDown because textbox eats the down arrow key in some circumstances.
00179             m_textBoxPreviewKeyDownRevoker = textBox.PreviewKeyDown(winrt::auto_revoke, { this, &NumberBox::OnNumberBoxKeyDown });
00180             m_textBoxKeyUpRevoker = textBox.KeyUp(winrt::auto_revoke, { this, &NumberBox::OnNumberBoxKeyUp });
00181         }
00182         return textBox;
00183     }());
00184
00185     if (const auto textBox = m_textBox.get())
00186     {
00187         m_textBoxLoadedRevoker = textBox.Loaded(winrt::auto_revoke, { this, &NumberBox::OnTextBoxLoaded });
00188     }
00189
00190     m_popup.set(GetTemplateChildT<winrt::Popup>(c_numberBoxPopupName, controlProtected));
00191
00192     if (const auto popupRoot = GetTemplateChildT<winrt::UIElement>(c_numberBoxPopupContentRootName, controlProtected))
00193     {
00194         if (!popupRoot.Shadow())
00195         {
00196             popupRoot.Shadow(winrt::ThemeShadow{});
00197             const auto translation = popupRoot.Translation();
00198
00199             const double shadowDepth = unbox_value<double>(SharedHelpers::FindInApplicationResources(c_numberBoxPopupShadowDepthName, box_value(c_popupShadowDepth)));
00200
00201             popupRoot.Translation({ translation.x, translation.y, static_cast<float>(shadowDepth) });
00202         }
00203     }
00204
00205     if (const auto popupSpinDown = GetTemplateChildT<winrt::RepeatButton>(c_numberBoxPopupDownButtonName, controlProtected))
00206     {
00207         m_popupDownButtonClickRevoker = popupSpinDown.Click(winrt::auto_revoke, { this, &NumberBox::OnSpinDownClick });
00208     }
00209
00210     if (const auto popupSpinUp = GetTemplateChildT<winrt::RepeatButton>(c_numberBoxPopupUpButtonName, controlProtected))
00211     {
00212         m_popupUpButtonClickRevoker = popupSpinUp.Click(winrt::auto_revoke, { this, &NumberBox::OnSpinUpClick });
00213     }
00214
00215     m_isEnabledChangedRevoker = IsEnabledChanged(winrt::auto_revoke, { this,  &NumberBox::OnIsEnabledChanged });
00216
00217     m_displayRounder.SignificantDigits(10);
00218
00219     UpdateSpinButtonPlacement();
00220     UpdateSpinButtonEnabled();
00221
00222     UpdateVisualStateForIsEnabledChange();
00223
00224     ReevaluateForwardedUIAProperties();
00225
00226     if (ReadLocalValue(s_ValueProperty) == winrt::DependencyProperty::UnsetValue()
00227         && ReadLocalValue(s_TextProperty) != winrt::DependencyProperty::UnsetValue())
00228     {
00229         // If Text has been set, but Value hasn't, update Value based on Text.
00230         UpdateValueToText();
00231     }
00232     else
00233     {
00234         UpdateTextToValue();
00235     }
00236 }
00237
00238 void NumberBox::OnTextBoxLoaded(winrt::IInspectable const&, winrt::RoutedEventArgs const&)
00239 {
00240     // Updating again once TextBox is loaded so its visual states are set properly.
00241     UpdateSpinButtonPlacement();
00242 }
00243
00244 void NumberBox::OnValuePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00245 {
00246     // This handler may change Value; don't send extra events in that case.
00247     if (!m_valueUpdating)
00248     {
00249         const auto oldValue = unbox_value<double>(args.OldValue());
00250
00251         auto scopeGuard = gsl::finally([this]()
00252         {
00253             m_valueUpdating = false;
00254         });
00255         m_valueUpdating = true;
00256
00257         CoerceValue();
00258
00259         const auto newValue = Value();
00260         if (newValue != oldValue && !(std::isnan(newValue) && std::isnan(oldValue)))
00261         {
00262             // Fire ValueChanged event
00263             const auto valueChangedArgs = winrt::make_self<NumberBoxValueChangedEventArgs>(oldValue, newValue);
00264             m_valueChangedEventSource(*this, *valueChangedArgs);
00265
00266             // Fire value property change for UIA
00267             if (const auto peer = winrt::FrameworkElementAutomationPeer::FromElement(*this).as<winrt::NumberBoxAutomationPeer>())
00268             {
00269                 winrt::get_self<NumberBoxAutomationPeer>(peer)->RaiseValueChangedEvent(oldValue, newValue);
00270             }
00271         }
00272
00273         UpdateTextToValue();
00274         UpdateSpinButtonEnabled();
00275     }
00276 }
00277
00278 void NumberBox::OnMinimumPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00279 {
00280     CoerceMaximum();
00281     CoerceValue();
00282
00283     UpdateSpinButtonEnabled();
00284     ReevaluateForwardedUIAProperties();
00285 }
00286
00287 void NumberBox::OnMaximumPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00288 {
00289     CoerceMinimum();
00290     CoerceValue();
00291
00292     UpdateSpinButtonEnabled();
00293     ReevaluateForwardedUIAProperties();
00294 }
00295
00296 void NumberBox::OnSmallChangePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00297 {
00298     UpdateSpinButtonEnabled();
00299 }
00300
00301 void NumberBox::OnIsWrapEnabledPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00302 {
00303     UpdateSpinButtonEnabled();
00304 }
00305
00306 void NumberBox::OnNumberFormatterPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00307 {
00308     // Update text with new formatting
00309     UpdateTextToValue();
00310 }
00311
00312 void NumberBox::ValidateNumberFormatter(winrt::INumberFormatter2 value)
00313 {
00314     // NumberFormatter also needs to be an INumberParser
00315     if (!value.try_as<winrt::INumberParser>())
00316     {
00317         throw winrt::hresult_error(E_INVALIDARG);
00318     }
00319 }
00320
00321 void NumberBox::OnSpinButtonPlacementModePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00322 {
00323     UpdateSpinButtonPlacement();
00324 }
00325
00326 void NumberBox::OnTextPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00327 {
00328     if (!m_textUpdating)
00329     {
00330         UpdateValueToText();
00331     }
00332 }
00333
00334 void NumberBox::UpdateValueToText()
00335 {
00336     if (auto && textBox = m_textBox.get())
00337     {
00338         textBox.Text(Text());
00339         ValidateInput();
00340     }
00341 }
00342
00343 void NumberBox::OnHeaderPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00344 {
00345     UpdateHeaderPresenterState();
00346 }
00347
00348 void NumberBox::OnHeaderTemplatePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00349 {
00350     UpdateHeaderPresenterState();
00351 }
00352
00353 void NumberBox::OnValidationModePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00354 {
00355     ValidateInput();
00356     UpdateSpinButtonEnabled();
00357 }
00358
00359 void NumberBox::OnIsEnabledChanged(const winrt::IInspectable&, const winrt::DependencyPropertyChangedEventArgs&)
00360 {
00361     UpdateVisualStateForIsEnabledChange();
00362 }
00363
00364 void NumberBox::OnAutomationPropertiesNamePropertyChanged(const winrt::DependencyObject&, const winrt::DependencyProperty&)
00365 {
00366     ReevaluateForwardedUIAProperties();
00367 }
00368
00369 void NumberBox::OnAutomationPropertiesLabeledByPropertyChanged(const winrt::DependencyObject&, const winrt::DependencyProperty&)
00370 {
00371     ReevaluateForwardedUIAProperties();
00372 }
00373
00374 void NumberBox::ReevaluateForwardedUIAProperties()
00375 {
00376     if (const auto textBox = m_textBox.get())
00377     {
00378         // UIA Name
00379         const auto name = winrt::AutomationProperties::GetName(*this);
00380         const auto minimum = Minimum() == -std::numeric_limits<double>::max() ?
00381             winrt::hstring{} :
00382             winrt::hstring{ L" " + ResourceAccessor::GetLocalizedStringResource(SR_NumberBoxMinimumValueStatus) + winrt::to_hstring(Minimum()) };
00383         const auto maximum = Maximum() == std::numeric_limits<double>::max() ?
00384             winrt::hstring{} :
00385             winrt::hstring{ L" " + ResourceAccessor::GetLocalizedStringResource(SR_NumberBoxMaximumValueStatus) + winrt::to_hstring(Maximum()) };
00386
00387         if (!name.empty())
00388         {
00389             // AutomationProperties.Name is a non empty string, we will use that value.
00390             winrt::AutomationProperties::SetName(textBox, name + minimum + maximum );
00391         }
00392         else
00393         {
00394             if (const auto headerAsString = Header().try_as<winrt::IReference<winrt::hstring>>())
00395             {
00396                 // Header is a string, we can use that as our UIA name.
00397                 winrt::AutomationProperties::SetName(textBox, headerAsString.Value() + minimum + maximum );
00398             }
00399         }
00400
00401         // UIA LabeledBy
00402         const auto labeledBy = winrt::AutomationProperties::GetLabeledBy(*this);
00403         if (labeledBy)
00404         {
00405             winrt::AutomationProperties::SetLabeledBy(textBox, labeledBy);
00406         }
00407     }
00408 }
00409
00410 void NumberBox::UpdateVisualStateForIsEnabledChange()
00411 {
00412     winrt::VisualStateManager::GoToState(*this, IsEnabled() ? L"Normal" : L"Disabled", false);
00413 }
00414
00415 void NumberBox::OnNumberBoxGotFocus(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args)
00416 {
00417     // When the control receives focus, select the text
00418     if (auto && textBox = m_textBox.get())
00419     {
00420         textBox.SelectAll();
00421     }
00422
00423     if (SpinButtonPlacementMode() == winrt::NumberBoxSpinButtonPlacementMode::Compact)
00424     {
00425         if (auto && popup = m_popup.get())
00426         {
00427             popup.IsOpen(true);
00428         }
00429     }
00430 }
00431
00432 void NumberBox::OnNumberBoxLostFocus(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args)
00433 {
00434     ValidateInput();
00435
00436     if (auto && popup = m_popup.get())
00437     {
00438         popup.IsOpen(false);
00439     }
00440 }
00441
00442 void NumberBox::CoerceMinimum()
00443 {
00444     const auto max = Maximum();
00445     if (Minimum() > max)
00446     {
00447         Minimum(max);
00448     }
00449 }
00450
00451 void NumberBox::CoerceMaximum()
00452 {
00453     const auto min = Minimum();
00454     if (Maximum() < min)
00455     {
00456         Maximum(min);
00457     }
00458 }
00459
00460 void NumberBox::CoerceValue()
00461 {
00462     // Validate that the value is in bounds
00463     const auto value = Value();
00464     if (!std::isnan(value) && !IsInBounds(value) && ValidationMode() == winrt::NumberBoxValidationMode::InvalidInputOverwritten)
00465     {
00466         // Coerce value to be within range
00467         const auto max = Maximum();
00468         if (value > max)
00469         {
00470             Value(max);
00471         }
00472         else
00473         {
00474             Value(Minimum());
00475         }
00476     }
00477 }
00478
00479 void NumberBox::ValidateInput()
00480 {
00481     // Validate the content of the inner textbox
00482     if (auto&& textBox = m_textBox.get())
00483     {
00484         const auto text = trim(textBox.Text().data());
00485
00486         // Handles empty TextBox case, set text to current value
00487         if (text.empty())
00488         {
00489             Value(std::numeric_limits<double>::quiet_NaN());
00490         }
00491         else
00492         {
00493             // Setting NumberFormatter to something that isn't an INumberParser will throw an exception, so this should be safe
00494             const auto numberParser = NumberFormatter().as<winrt::INumberParser>();
00495
00496             const winrt::IReference<double> value = AcceptsExpression()
00497                 ? NumberBoxParser::Compute(text, numberParser)
00498                 : numberParser.ParseDouble(text);
00499
00500             if (!value)
00501             {
00502                 if (ValidationMode() == winrt::NumberBoxValidationMode::InvalidInputOverwritten)
00503                 {
00504                     // Override text to current value
00505                     UpdateTextToValue();
00506                 }
00507             }
00508             else
00509             {
00510                 if (value.Value() == Value())
00511                 {
00512                     // Even if the value hasn't changed, we still want to update the text (e.g. Value is 3, user types 1 + 2, we want to replace the text with 3)
00513                     UpdateTextToValue();
00514                 }
00515                 else
00516                 {
00517                     Value(value.Value());
00518                 }
00519             }
00520         }
00521     }
00522 }
00523
00524 void NumberBox::OnSpinDownClick(winrt::IInspectable const&  sender, winrt::RoutedEventArgs const& args)
00525 {
00526     StepValue(-SmallChange());
00527 }
00528
00529 void NumberBox::OnSpinUpClick(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args)
00530 {
00531     StepValue(SmallChange());
00532 }
00533
00534 void NumberBox::OnNumberBoxKeyDown(winrt::IInspectable const& sender, winrt::KeyRoutedEventArgs const& args)
00535 {
00536     // Handle these on key down so that we get repeat behavior.
00537     switch (args.OriginalKey())
00538     {
00539         case winrt::VirtualKey::Up:
00540             StepValue(SmallChange());
00541             args.Handled(true);
00542             break;
00543
00544         case winrt::VirtualKey::Down:
00545             StepValue(-SmallChange());
00546             args.Handled(true);
00547             break;
00548
00549         case winrt::VirtualKey::PageUp:
00550             StepValue(LargeChange());
00551             args.Handled(true);
00552             break;
00553
00554         case winrt::VirtualKey::PageDown:
00555             StepValue(-LargeChange());
00556             args.Handled(true);
00557             break;
00558     }
00559 }
00560
00561 void NumberBox::OnNumberBoxKeyUp(winrt::IInspectable const& sender, winrt::KeyRoutedEventArgs const& args)
00562 {
00563     switch (args.OriginalKey())
00564     {
00565     case winrt::VirtualKey::Enter:
00566     case winrt::VirtualKey::GamepadA:
00567         ValidateInput();
00568         args.Handled(true);
00569         break;
00570
00571     case winrt::VirtualKey::Escape:
00572     case winrt::VirtualKey::GamepadB:
00573         UpdateTextToValue();
00574         args.Handled(true);
00575         break;
00576     }
00577 }
00578
00579 void NumberBox::OnNumberBoxScroll(winrt::IInspectable const& sender, winrt::PointerRoutedEventArgs const& args)
00580 {
00581     if (auto && textBox = m_textBox.get())
00582     {
00583         if (textBox.FocusState() != winrt::FocusState::Unfocused)
00584         {
00585             const auto delta = args.GetCurrentPoint(*this).Properties().MouseWheelDelta();
00586             if (delta > 0)
00587             {
00588                 StepValue(SmallChange());
00589             }
00590             else if (delta < 0)
00591             {
00592                 StepValue(-SmallChange());
00593             }
00594             // Only set as handled when we actually changed our state.
00595             args.Handled(true);
00596         }
00597     }
00598 }
00599
00600 void NumberBox::StepValue(double change)
00601 {
00602     // Before adjusting the value, validate the contents of the textbox so we don't override it.
00603     ValidateInput();
00604
00605     auto newVal = Value();
00606     if (!std::isnan(newVal))
00607     {
00608         newVal += change;
00609
00610         if (IsWrapEnabled())
00611         {
00612             const auto max = Maximum();
00613             const auto min = Minimum();
00614
00615             if (newVal > max)
00616             {
00617                 newVal = min;
00618             }
00619             else if (newVal < min)
00620             {
00621                 newVal = max;
00622             }
00623         }
00624
00625         Value(newVal);
00626
00627         // We don't want the caret to move to the front of the text for example when using the up/down arrows
00628         // to change the numberbox value.
00629         MoveCaretToTextEnd();
00630     }
00631 }
00632
00633 // Updates TextBox.Text with the formatted Value
00634 void NumberBox::UpdateTextToValue()
00635 {
00636     if (auto && textBox = m_textBox.get())
00637     {
00638         winrt::hstring newText = L"";
00639
00640         const auto value = Value();
00641         if (!std::isnan(value))
00642         {
00643             // Rounding the value here will prevent displaying digits caused by floating point imprecision.
00644             const auto roundedValue = m_displayRounder.RoundDouble(value);
00645             newText = NumberFormatter().FormatDouble(roundedValue);
00646         }
00647
00648         textBox.Text(newText);
00649
00650         auto scopeGuard = gsl::finally([this]()
00651         {
00652             m_textUpdating = false;
00653         });
00654         m_textUpdating = true;
00655         Text(newText.data());
00656     }
00657 }
00658
00659 void NumberBox::UpdateSpinButtonPlacement()
00660 {
00661     const auto spinButtonMode = SpinButtonPlacementMode();
00662     auto state = L"SpinButtonsCollapsed";
00663
00664     if (spinButtonMode == winrt::NumberBoxSpinButtonPlacementMode::Inline)
00665     {
00666         state = L"SpinButtonsVisible";
00667     }
00668     else if (spinButtonMode == winrt::NumberBoxSpinButtonPlacementMode::Compact)
00669     {
00670         state = L"SpinButtonsPopup";
00671     }
00672
00673     winrt::VisualStateManager::GoToState(*this, state, false);
00674
00675     if (const auto textbox = m_textBox.get())
00676     {
00677         winrt::VisualStateManager::GoToState(textbox, state, false);
00678     }
00679 }
00680
00681 void NumberBox::UpdateSpinButtonEnabled()
00682 {
00683     const auto value = Value();
00684     bool isUpButtonEnabled = false;
00685     bool isDownButtonEnabled = false;
00686
00687     if (!std::isnan(value))
00688     {
00689         if (IsWrapEnabled() || ValidationMode() != winrt::NumberBoxValidationMode::InvalidInputOverwritten)
00690         {
00691             // If wrapping is enabled, or invalid values are allowed, then the buttons should be enabled
00692             isUpButtonEnabled = true;
00693             isDownButtonEnabled = true;
00694         }
00695         else
00696         {
00697             if (value < Maximum())
00698             {
00699                 isUpButtonEnabled = true;
00700             }
00701             if (value > Minimum())
00702             {
00703                 isDownButtonEnabled = true;
00704             }
00705         }
00706     }
00707
00708     winrt::VisualStateManager::GoToState(*this, isUpButtonEnabled ? L"UpSpinButtonEnabled" : L"UpSpinButtonDisabled", false);
00709     winrt::VisualStateManager::GoToState(*this, isDownButtonEnabled ? L"DownSpinButtonEnabled" : L"DownSpinButtonDisabled", false);
00710 }
00711
00712 bool NumberBox::IsInBounds(double value)
00713 {
00714     return (value >= Minimum() && value <= Maximum());
00715 }
00716
00717 void NumberBox::UpdateHeaderPresenterState()
00718 {
00719     bool shouldShowHeader = false;
00720
00721     // Load header presenter as late as possible
00722
00723     // To enable lightweight styling, collapse header presenter if there is no header specified
00724     if (const auto header = Header())
00725     {
00726         // Check if header is string or not
00727         if (const auto headerAsString = header.try_as<winrt::IReference<winrt::hstring>>())
00728         {
00729             if (!headerAsString.Value().empty())
00730             {
00731                 // Header is not empty string
00732                 shouldShowHeader = true;
00733             }
00734         }
00735         else
00736         {
00737             // Header is not a string, so let's show header presenter
00738             shouldShowHeader = true;
00739             // When our header isn't a string, we use the NumberBox's UIA name for the textbox's UIA name.
00740             if (const auto textBox = m_textBox.get())
00741             {
00742                 winrt::AutomationProperties::SetName(textBox, winrt::AutomationProperties::GetName(*this));
00743             }
00744         }
00745     }
00746     if(const auto headerTemplate = HeaderTemplate())
00747     {
00748         shouldShowHeader = true;
00749     }
00750
00751     if(shouldShowHeader && m_headerPresenter == nullptr)
00752     {
00753         if (const auto headerPresenter = GetTemplateChildT<winrt::ContentPresenter>(c_numberBoxHeaderName, (winrt::IControlProtected)*this))
00754         {
00755             // Set presenter to enable lightweight styling of the headers margin
00756             m_headerPresenter.set(headerPresenter);
00757         }
00758     }
00759
00760     if (auto&& headerPresenter = m_headerPresenter.get())
00761     {
00762         headerPresenter.Visibility(shouldShowHeader ? winrt::Visibility::Visible : winrt::Visibility::Collapsed);
00763     }
00764
00765     ReevaluateForwardedUIAProperties();
00766 }
00767
00768 void NumberBox::MoveCaretToTextEnd()
00769 {
00770     if (auto && textBox = m_textBox.get())
00771     {
00772         // This places the caret at the end of the text.
00773         textBox.Select(static_cast<int32_t>(textBox.Text().size()), 0);
00774     }
00775 }
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresentersWithSimpleContentsPage Member List

This is the complete list of members for ScrollPresentersWithSimpleContentsPage, including all inherited members.
btnClearFullLog_Click(object sender, RoutedEventArgs e) | ScrollPresentersWithSimpleContentsPage | [inline, private]
btnGetFullLog_Click(object sender, RoutedEventArgs e) | ScrollPresentersWithSimpleContentsPage | [inline, private]
btnResetViews_Click(object sender, RoutedEventArgs e) | ScrollPresentersWithSimpleContentsPage | [inline, private]
canScrollPresenter51ContentShrink | ScrollPresentersWithSimpleContentsPage | [private]
ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e) | ScrollPresentersWithSimpleContentsPage | [inline, private]
ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e) | ScrollPresentersWithSimpleContentsPage | [inline, private]
CmbShowScrollPresenter_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresentersWithSimpleContentsPage | [inline, private]
fullLogs | ScrollPresentersWithSimpleContentsPage | [private]
MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args) | ScrollPresentersWithSimpleContentsPage | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | ScrollPresentersWithSimpleContentsPage | [inline, protected]
ResetView(ScrollPresenter scrollPresenter) | ScrollPresentersWithSimpleContentsPage | [inline, private]
scrollPresenter52ZoomFactorChangeCorrelationId | ScrollPresentersWithSimpleContentsPage | [private]
ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args) | ScrollPresentersWithSimpleContentsPage | [inline, private]
ScrollPresenter_StateChanged(ScrollPresenter sender, object args) | ScrollPresentersWithSimpleContentsPage | [inline, private]
ScrollPresenter_ViewChanged(ScrollPresenter sender, object args) | ScrollPresentersWithSimpleContentsPage | [inline, private]
ScrollPresenter_ZoomCompleted(ScrollPresenter sender, ScrollingZoomCompletedEventArgs args) | ScrollPresentersWithSimpleContentsPage | [inline, private]
ScrollPresentersWithSimpleContentsPage() | ScrollPresentersWithSimpleContentsPage | [inline]
ScrollPresenterTestHooks_ContentLayoutOffsetXChanged(ScrollPresenter sender, object args) | ScrollPresentersWithSimpleContentsPage | [inline, private]
ScrollPresenterTestHooks_ContentLayoutOffsetYChanged(ScrollPresenter sender, object args) | ScrollPresentersWithSimpleContentsPage | [inline, private]
~ScrollPresentersWithSimpleContentsPage() | ScrollPresentersWithSimpleContentsPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ButtonInteraction Member List

This is the complete list of members for ButtonInteraction, including all inherited members.
abi_enter() | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
ButtonInteractionProperties() | ButtonInteractionProperties |
CheckThread() | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
ClearProperties() | ButtonInteractionProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< ButtonInteraction > &&self) noexcept | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline, static]
EnsureProperties() | ButtonInteractionProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
final_release(std::unique_ptr< ButtonInteraction > &&self) | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline, static]
GetBase() | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
GetInner() | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
GetSupportedEventsCore() | ButtonInteraction |
Invoked(winrt::TypedEventHandler< winrt::ButtonInteraction, winrt::ButtonInteractionInvokedEventArgs > const &value) | ButtonInteractionProperties |
Invoked(winrt::event_token const &token) | ButtonInteractionProperties |
InvokeMode() | ButtonInteraction |
InvokeMode(winrt::ButtonInteractionInvokeMode const &value) | ButtonInteraction |
IsHovering() | ButtonInteraction |
IsOnThread() | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
IsPressing() | ButtonInteraction |
m_invokedEventSource | ButtonInteractionProperties |
m_propertyChangedEventSource | ButtonInteractionProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
OnKeyDown(winrt::UIElement const &sender, winrt::KeyRoutedEventArgs const &args) | ButtonInteraction |
OnKeyUp(winrt::UIElement const &sender, winrt::KeyRoutedEventArgs const &args) | ButtonInteraction |
OnPointerCanceled(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | ButtonInteraction |
OnPointerCaptureLost(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | ButtonInteraction |
OnPointerEntered(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | ButtonInteraction |
OnPointerExited(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | ButtonInteraction |
OnPointerPressed(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | ButtonInteraction |
OnPointerReleased(winrt::UIElement const &sender, winrt::PointerRoutedEventArgs const &args) | ButtonInteraction |
PropertyChanged(winrt::PropertyChangedEventHandler const &value) | ButtonInteraction |
PropertyChanged(winrt::event_token const &token) | ButtonInteraction |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
RaiseInvoked(winrt::UIElement target) | ButtonInteraction | [private]
ReferenceTracker(Args &&...args) | ReferenceTracker< ButtonInteraction, winrt::implementation::ButtonInteractionT > | [inline]
UpdateIsHovering(bool isHovering) | ButtonInteraction | [private]
UpdateIsPressing(bool isPressing) | ButtonInteraction | [private]
Generated on Sun Dec 1 2024 20:52:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MUXControlsFactory Member List

This is the complete list of members for MUXControlsFactory, including all inherited members.
Deinitialize() | MUXControlsFactory | [inline, static]
EnsureInitialized() | MUXControlsFactory | [static]
IsInitialized() | MUXControlsFactory | [inline, static]
s_initialized | MUXControlsFactory | [private, static]
VerifyInitialized() | MUXControlsFactory | [static]
Generated on Sun Dec 1 2024 20:52:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SpecialTreeView Member List

This is the complete list of members for SpecialTreeView, including all inherited members.
abi_enter() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
CanDragItems(bool value) | TreeViewProperties |
CanDragItems() | TreeViewProperties |
CanDragItemsProperty() | TreeViewProperties | [inline, static]
CanReorderItems(bool value) | TreeViewProperties |
CanReorderItems() | TreeViewProperties |
CanReorderItemsProperty() | TreeViewProperties | [inline, static]
CheckThread() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
ClearProperties() | TreeViewProperties | [static]
Collapse(winrt::TreeViewNode const &value) | TreeView |
Collapsed(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewCollapsedEventArgs > const &value) | TreeViewProperties |
Collapsed(winrt::event_token const &token) | TreeViewProperties |
ContainerFromItem(winrt::IInspectable const &item) | TreeView |
ContainerFromNode(winrt::TreeViewNode const &node) const | TreeView |
DeleteInstanceOnUIThread(std::unique_ptr< TreeView > &&self) noexcept | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline, static]
DragItemsCompleted(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewDragItemsCompletedEventArgs > const &value) | TreeViewProperties |
DragItemsCompleted(winrt::event_token const &token) | TreeViewProperties |
DragItemsStarting(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewDragItemsStartingEventArgs > const &value) | TreeViewProperties |
DragItemsStarting(winrt::event_token const &token) | TreeViewProperties |
EnsureProperties() | TreeViewProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
Expand(winrt::TreeViewNode const &value) | TreeView |
Expanding(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewExpandingEventArgs > const &value) | TreeViewProperties |
Expanding(winrt::event_token const &token) | TreeViewProperties |
final_release(std::unique_ptr< TreeView > &&self) | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline, static]
GetAssociatedNode(winrt::IInspectable item) | TreeView |
GetBase() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
GetInner() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
IsOnThread() | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
ItemContainerStyle(winrt::Style const &value) | TreeViewProperties |
ItemContainerStyle() | TreeViewProperties |
ItemContainerStyleProperty() | TreeViewProperties | [inline, static]
ItemContainerStyleSelector(winrt::StyleSelector const &value) | TreeViewProperties |
ItemContainerStyleSelector() | TreeViewProperties |
ItemContainerStyleSelectorProperty() | TreeViewProperties | [inline, static]
ItemContainerTransitions(winrt::TransitionCollection const &value) | TreeViewProperties |
ItemContainerTransitions() | TreeViewProperties |
ItemContainerTransitionsProperty() | TreeViewProperties | [inline, static]
ItemFromContainer(winrt::DependencyObject const &container) | TreeView |
ItemInvoked(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewItemInvokedEventArgs > const &value) | TreeViewProperties |
ItemInvoked(winrt::event_token const &token) | TreeViewProperties |
ItemsSource(winrt::IInspectable const &value) | TreeViewProperties |
ItemsSource() | TreeViewProperties |
ItemsSourceProperty() | TreeViewProperties | [inline, static]
ItemTemplate(winrt::DataTemplate const &value) | TreeViewProperties |
ItemTemplate() | TreeViewProperties |
ItemTemplateProperty() | TreeViewProperties | [inline, static]
ItemTemplateSelector(winrt::DataTemplateSelector const &value) | TreeViewProperties |
ItemTemplateSelector() | TreeViewProperties |
ItemTemplateSelectorProperty() | TreeViewProperties | [inline, static]
ListControl() const | TreeView |
m_collapsedEventSource | TreeViewProperties |
m_dragItemsCompletedEventSource | TreeViewProperties |
m_dragItemsStartingEventSource | TreeViewProperties |
m_expandingEventSource | TreeViewProperties |
m_itemInvokedEventSource | TreeViewProperties |
m_selectionChangedEventSource | TreeViewProperties |
MutableListControl() | TreeView |
NodeFromContainer(winrt::DependencyObject const &container) const | TreeView |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
OnApplyTemplate() | TreeView |
OnContainerContentChanging(const winrt::IInspectable &sender, const winrt::ContainerContentChangingEventArgs &args) | TreeView |
OnItemClick(const winrt::IInspectable &sender, const winrt::ItemClickEventArgs &args) | TreeView |
OnItemsSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
OnListControlDragItemsCompleted(const winrt::IInspectable &sender, const winrt::DragItemsCompletedEventArgs &args) | TreeView |
OnListControlDragItemsStarting(const winrt::IInspectable &sender, const winrt::DragItemsStartingEventArgs &args) | TreeView |
OnListControlSelectionChanged(const winrt::IInspectable &sender, const winrt::SelectionChangedEventArgs &args) | TreeView |
OnNodeCollapsed(const winrt::TreeViewNode &sender, const winrt::IInspectable &) | TreeView |
OnNodeExpanding(const winrt::TreeViewNode &sender, const winrt::IInspectable &) | TreeView |
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | TreeView |
OnSelectedItemPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
OnSelectionModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewProperties | [static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
RaiseSelectionChanged(const winrt::IVector< winrt::IInspectable > addedItems, const winrt::IVector< winrt::IInspectable > removedItems) | TreeView |
ReferenceTracker(Args &&...args) | ReferenceTracker< TreeView, winrt::implementation::TreeViewT > | [inline]
RootNodes() | TreeView |
s_CanDragItemsProperty | TreeViewProperties | [static]
s_CanReorderItemsProperty | TreeViewProperties | [static]
s_ItemContainerStyleProperty | TreeViewProperties | [static]
s_ItemContainerStyleSelectorProperty | TreeViewProperties | [static]
s_ItemContainerTransitionsProperty | TreeViewProperties | [static]
s_ItemsSourceProperty | TreeViewProperties | [static]
s_ItemTemplateProperty | TreeViewProperties | [static]
s_ItemTemplateSelectorProperty | TreeViewProperties | [static]
s_SelectedItemProperty | TreeViewProperties | [static]
s_SelectionModeProperty | TreeViewProperties | [static]
SelectAll() | TreeView |
SelectedItem(winrt::IInspectable const &value) | TreeViewProperties |
SelectedItem() | TreeViewProperties |
SelectedItemProperty() | TreeViewProperties | [inline, static]
SelectedItems() | TreeView |
SelectedNode(winrt::TreeViewNode const &node) | TreeView |
SelectedNode() | TreeView |
SelectedNodes() | TreeView |
SelectionChanged(winrt::TypedEventHandler< winrt::TreeView, winrt::TreeViewSelectionChangedEventArgs > const &value) | TreeViewProperties |
SelectionChanged(winrt::event_token const &token) | TreeViewProperties |
SelectionMode(winrt::TreeViewSelectionMode const &value) | TreeViewProperties |
SelectionMode() | TreeViewProperties |
SelectionModeProperty() | TreeViewProperties | [inline, static]
TreeView() | TreeView |
TreeViewProperties() | TreeViewProperties |
UpdateItemsSelectionMode(bool isMultiSelect) | TreeView |
UpdateSelection(winrt::TreeViewNode const &node, bool isSelected) | TreeView |
Generated on Sun Dec 1 2024 20:53:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/RecyclePool.cpp Source File

  • Repeater

RecyclePool.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "RecyclePool.h"
00008
00009 #pragma region IRecyclePool
00010
00011 void RecyclePool::PutElement(
00012     winrt::UIElement const& element,
00013     winrt::hstring const& key)
00014 {
00015     PutElementCore(element, key, nullptr /* owner */);
00016 }
00017
00018 void RecyclePool::PutElement(
00019     winrt::UIElement const& element,
00020     winrt::hstring const& key,
00021     winrt::UIElement const& owner)
00022 {
00023     PutElementCore(element, key, owner);
00024 }
00025
00026 winrt::UIElement RecyclePool::TryGetElement(
00027     winrt::hstring const& key)
00028 {
00029     return TryGetElementCore(key, nullptr /* owner */);
00030 }
00031
00032 winrt::UIElement RecyclePool::TryGetElement(
00033     winrt::hstring const& key,
00034     winrt::UIElement const& owner)
00035 {
00036     return TryGetElementCore(key, owner);
00037 }
00038
00039 #pragma endregion
00040
00041 #pragma region IRecyclePoolOverrides
00042
00043 void RecyclePool::PutElementCore(
00044     winrt::UIElement const& element,
00045     winrt::hstring const& key,
00046     winrt::UIElement const& owner)
00047 {
00048
00049     const auto& winrtKey = key;
00050     const auto iterator = m_elements.find(winrtKey);
00051     const auto& winrtOwner = owner;
00052     auto winrtOwnerAsPanel = EnsureOwnerIsPanelOrNull(winrtOwner);
00053
00054     ElementInfo elementInfo{ this /* refManager */, element, winrtOwnerAsPanel };
00055
00056     if (iterator != m_elements.end())
00057     {
00058         iterator->second.emplace_back(std::move(elementInfo));
00059     }
00060     else
00061     {
00062         std::vector<ElementInfo> pool;
00063         pool.emplace_back(elementInfo);
00064         m_elements.emplace(winrtKey, std::move(pool));
00065     }
00066 }
00067
00068 winrt::UIElement RecyclePool::TryGetElementCore(
00069     winrt::hstring const& key,
00070     winrt::UIElement const& owner)
00071 {
00072     const auto iterator = m_elements.find(key);
00073     if (iterator != m_elements.end())
00074     {
00075         auto& elements = iterator->second;
00076         if (elements.size() > 0)
00077         {
00078             ElementInfo elementInfo{ this /* refManager */, nullptr, nullptr };
00079             // Prefer an element from the same owner or with no owner so that we don't incur
00080             // the enter/leave cost during recycling.
00081             // TODO: prioritize elements with the same owner to those without an owner.
00082             const auto& winrtOwner = owner;
00083             auto iter = std::find_if(
00084                 elements.begin(),
00085                 elements.end(),
00086                 [&winrtOwner](const ElementInfo& elemInfo) { return elemInfo.Owner() == winrtOwner || !elemInfo.Owner(); });
00087
00088             if (iter != elements.end())
00089             {
00090                 elementInfo = *iter;
00091                 elements.erase(iter);
00092             }
00093             else
00094             {
00095                 elementInfo = elements.back();
00096                 elements.pop_back();
00097             }
00098
00099             auto ownerAsPanel = EnsureOwnerIsPanelOrNull(winrtOwner);
00100             if (elementInfo.Owner() && elementInfo.Owner() != ownerAsPanel)
00101             {
00102                 // Element is still under its parent. remove it from its parent.
00103                 auto panel = elementInfo.Owner();
00104                 if (panel)
00105                 {
00106                     unsigned int childIndex = 0;
00107                     bool found = panel.Children().IndexOf(elementInfo.Element(), childIndex);
00108                     if (!found)
00109                     {
00110                         throw winrt::hresult_error(E_FAIL, L"ItemsRepeater's child not found in its Children collection.");
00111                     }
00112
00113                     panel.Children().RemoveAt(childIndex);
00114                 }
00115             }
00116
00117             return elementInfo.Element();
00118         }
00119     }
00120
00121     return nullptr;
00122 }
00123
00124
00125 #pragma endregion
00126
00127 winrt::Panel RecyclePool::EnsureOwnerIsPanelOrNull(const winrt::UIElement& owner)
00128 {
00129     winrt::Panel ownerAsPanel = nullptr;
00130     if (owner)
00131     {
00132         ownerAsPanel = owner.try_as<winrt::Panel>();
00133         if (!ownerAsPanel)
00134         {
00135             throw winrt::hresult_error(E_FAIL, L"owner must to be a Panel or null.");
00136         }
00137     }
00138
00139     return ownerAsPanel;
00140 }
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RefreshVisualizer.properties.h Source File

  • Generated

RefreshVisualizer.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class RefreshVisualizerProperties
00008 {
00009 public:
00010     RefreshVisualizerProperties();
00011
00012     void Content(winrt::UIElement const& value);
00013     winrt::UIElement Content();
00014
00015     void Orientation(winrt::RefreshVisualizerOrientation const& value);
00016     winrt::RefreshVisualizerOrientation Orientation();
00017
00018     void State(winrt::RefreshVisualizerState const& value);
00019     winrt::RefreshVisualizerState State();
00020
00021     static winrt::DependencyProperty ContentProperty() { return s_ContentProperty; }
00022     static winrt::DependencyProperty InfoProviderProperty() { return s_InfoProviderProperty; }
00023     static winrt::DependencyProperty OrientationProperty() { return s_OrientationProperty; }
00024     static winrt::DependencyProperty StateProperty() { return s_StateProperty; }
00025
00026     static GlobalDependencyProperty s_ContentProperty;
00027     static GlobalDependencyProperty s_InfoProviderProperty;
00028     static GlobalDependencyProperty s_OrientationProperty;
00029     static GlobalDependencyProperty s_StateProperty;
00030
00031     winrt::event_token RefreshRequested(winrt::TypedEventHandler<winrt::RefreshVisualizer, winrt::RefreshRequestedEventArgs> const& value);
00032     void RefreshRequested(winrt::event_token const& token);
00033     winrt::event_token RefreshStateChanged(winrt::TypedEventHandler<winrt::RefreshVisualizer, winrt::RefreshStateChangedEventArgs> const& value);
00034     void RefreshStateChanged(winrt::event_token const& token);
00035
00036     event_source<winrt::TypedEventHandler<winrt::RefreshVisualizer, winrt::RefreshRequestedEventArgs>> m_refreshRequestedEventSource;
00037     event_source<winrt::TypedEventHandler<winrt::RefreshVisualizer, winrt::RefreshStateChangedEventArgs>> m_refreshStateChangedEventSource;
00038
00039     static void EnsureProperties();
00040     static void ClearProperties();
00041
00042     static void OnContentPropertyChanged(
00043         winrt::DependencyObject const& sender,
00044         winrt::DependencyPropertyChangedEventArgs const& args);
00045
00046     static void OnInfoProviderPropertyChanged(
00047         winrt::DependencyObject const& sender,
00048         winrt::DependencyPropertyChangedEventArgs const& args);
00049
00050     static void OnOrientationPropertyChanged(
00051         winrt::DependencyObject const& sender,
00052         winrt::DependencyPropertyChangedEventArgs const& args);
00053
00054     static void OnStatePropertyChanged(
00055         winrt::DependencyObject const& sender,
00056         winrt::DependencyPropertyChangedEventArgs const& args);
00057 };
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterTestHooksInteractionSourcesChangedEventArgs.cpp Source File

  • ScrollPresenter

ScrollPresenterTestHooksInteractionSourcesChangedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ScrollPresenterTestHooksInteractionSourcesChangedEventArgs.h"
00007
00008 ScrollPresenterTestHooksInteractionSourcesChangedEventArgs::ScrollPresenterTestHooksInteractionSourcesChangedEventArgs(
00009     const winrt::Microsoft::UI::Composition::Interactions::CompositionInteractionSourceCollection& interactionSources)
00010 {
00011     m_interactionSources = interactionSources;
00012 }
00013
00014 #pragma region IScrollPresenterTestHooksInteractionSourcesChangedEventArgs
00015
00016 winrt::Microsoft::UI::Composition::Interactions::CompositionInteractionSourceCollection ScrollPresenterTestHooksInteractionSourcesChangedEventArgs::InteractionSources()
00017 {
00018     return m_interactionSources;
00019 }
00020
00021 #pragma endregion
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ParallaxView/TestUI/Ingredient.cs Source File

  • ParallaxView
  • TestUI

Ingredient.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     public class Ingredient
00007     {
00008         public string Name { get; set; }
00009         public string Amount { get; set; }
00010         public string Photo { get; set; }
00011
00012         public Ingredient() { }
00013
00014         public Ingredient(string name, string amount, string photo)
00015         {
00016             this.Name = name;
00017             this.Amount = amount;
00018             this.Photo = photo;
00019         }
00020     }
00021 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RatingItemFontInfo Member List

This is the complete list of members for RatingItemFontInfo, including all inherited members.
ClearProperties() | RatingItemFontInfoProperties | [static]
DisabledGlyph(winrt::hstring const &value) | RatingItemFontInfoProperties |
DisabledGlyph() | RatingItemFontInfoProperties |
DisabledGlyphProperty() | RatingItemFontInfoProperties | [inline, static]
EnsureProperties() | RatingItemFontInfoProperties | [static]
Glyph(winrt::hstring const &value) | RatingItemFontInfoProperties |
Glyph() | RatingItemFontInfoProperties |
GlyphProperty() | RatingItemFontInfoProperties | [inline, static]
PlaceholderGlyph(winrt::hstring const &value) | RatingItemFontInfoProperties |
PlaceholderGlyph() | RatingItemFontInfoProperties |
PlaceholderGlyphProperty() | RatingItemFontInfoProperties | [inline, static]
PointerOverGlyph(winrt::hstring const &value) | RatingItemFontInfoProperties |
PointerOverGlyph() | RatingItemFontInfoProperties |
PointerOverGlyphProperty() | RatingItemFontInfoProperties | [inline, static]
PointerOverPlaceholderGlyph(winrt::hstring const &value) | RatingItemFontInfoProperties |
PointerOverPlaceholderGlyph() | RatingItemFontInfoProperties |
PointerOverPlaceholderGlyphProperty() | RatingItemFontInfoProperties | [inline, static]
RatingItemFontInfoProperties() | RatingItemFontInfoProperties |
s_DisabledGlyphProperty | RatingItemFontInfoProperties | [static]
s_GlyphProperty | RatingItemFontInfoProperties | [static]
s_PlaceholderGlyphProperty | RatingItemFontInfoProperties | [static]
s_PointerOverGlyphProperty | RatingItemFontInfoProperties | [static]
s_PointerOverPlaceholderGlyphProperty | RatingItemFontInfoProperties | [static]
s_UnsetGlyphProperty | RatingItemFontInfoProperties | [static]
UnsetGlyph(winrt::hstring const &value) | RatingItemFontInfoProperties |
UnsetGlyph() | RatingItemFontInfoProperties |
UnsetGlyphProperty() | RatingItemFontInfoProperties | [inline, static]
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealScenarioList Member List

This is the complete list of members for RevealScenarioList, including all inherited members.
BackgroundComboBoxChanged(object sender, SelectionChangedEventArgs e) | RevealScenarioList | [inline, private]
backgroundTypeSource | RevealScenarioList | [private]
listSource | RevealScenarioList | [private]
RevealScenarioList() | RevealScenarioList | [inline]
Generated on Sun Dec 1 2024 20:54:26 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Common/CornerRadiusFilterConverters.idl Source File

  • Common

CornerRadiusFilterConverters.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XCP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 [default_interface]
00007 runtimeclass CornerRadiusFilterConverter : Microsoft.UI.Xaml.DependencyObject, Microsoft.UI.Xaml.Data.IValueConverter
00008 {
00009     CornerRadiusFilterConverter();
00010
00011     [MUX_DEFAULT_VALUE("winrt::CornerRadiusFilterKind::None")]
00012     CornerRadiusFilterKind Filter{ get; set; };
00013     [MUX_DEFAULT_VALUE("1.0")]
00014     Double Scale{ get; set; };
00015
00016     static Microsoft.UI.Xaml.DependencyProperty FilterProperty{ get; };
00017     static Microsoft.UI.Xaml.DependencyProperty ScaleProperty{ get; };
00018 };
00019
00020 [MUX_PUBLIC]
00021 [webhosthidden]
00022 enum CornerRadiusFilterKind
00023 {
00024     None,
00025     Top,
00026     Right,
00027     Bottom,
00028     Left,
00029     TopLeftValue,
00030     BottomRightValue
00031 };
00032
00033 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/LayoutContextAdapter.h Source File

  • Repeater

LayoutContextAdapter.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "LayoutContext.h"
00007 #include "VirtualizingLayoutContext.h"
00008 #include "NonvirtualizingLayoutContext.h"
00009
00010 class LayoutContextAdapter :
00011     public winrt::implements<LayoutContextAdapter, VirtualizingLayoutContext>
00012 {
00013 public:
00014     LayoutContextAdapter(winrt::NonVirtualizingLayoutContext const& nonVirtualizingContext);
00015
00016 #pragma region ILayoutContextOverrides
00017
00018     winrt::IInspectable LayoutStateCore();
00019     void LayoutStateCore(winrt::IInspectable const& state);
00020
00021 #pragma endregion
00022
00023 #pragma region IVirtualizingLayoutContextOverrides
00024
00025     int32_t ItemCountCore();
00026     winrt::IInspectable GetItemAtCore(int index);
00027     winrt::UIElement GetOrCreateElementAtCore(int index, winrt::ElementRealizationOptions const& options);
00028     void RecycleElementCore(winrt::UIElement const& element);
00029     int32_t GetElementIndexCore(winrt::UIElement const& element);
00030
00031     winrt::Rect VisibleRectCore();
00032     winrt::Rect RealizationRectCore();
00033
00034     int32_t RecommendedAnchorIndexCore();
00035
00036     winrt::Point LayoutOriginCore();
00037     void LayoutOriginCore(winrt::Point const& value);
00038
00039 #pragma endregion
00040
00041 private:
00042     winrt::weak_ref<winrt::NonVirtualizingLayoutContext> m_nonVirtualizingContext{ nullptr };
00043 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/VirtualizationInfo.h Source File

  • Repeater

VirtualizationInfo.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include <limits>
00006
00007 enum class ElementOwner
00008 {
00009     // All elements are originally owned by the view generator.
00010     ElementFactory,
00011     // Ownership is transferred to the layout when it calls GetElement.
00012     Layout,
00013     // Ownership is transferred to the pinned pool if the element is cleared (outside of
00014     // a 'remove' collection change of course).
00015     PinnedPool,
00016     // Ownership is transfered to the reset pool if the element is cleared by a reset and
00017     // the data source supports unique ids.
00018     UniqueIdResetPool,
00019     // Ownership is transfered to the animator if the element is cleared due to a
00020     // 'remove'-like collection change.
00021     Animator
00022 };
00023
00024 // Would be nice to have this be part of UIElement similar to how MCBP does it.
00025 // That would make the lookups much more performant than an attached property.
00026 class VirtualizationInfo : public winrt::implements<VirtualizationInfo, winrt::IInspectable>
00027 {
00028 public:
00029     VirtualizationInfo();
00030
00031     ElementOwner Owner() const { return m_owner; }
00032     int Index() const { return m_index; }
00033
00034     // Pinned means that the element is protected from getting cleared by layout.
00035     // A pinned element may still get cleared by a collection change.
00036     // IsPinned == true doesn't necessarly mean that the element is currently
00037     // owned by the PinnedPool, only that its ownership may be transferred to the
00038     // PinnedPool if it gets cleared by layout.
00039     bool IsPinned() const;
00040     bool IsHeldByLayout() const;
00041     bool IsInPinnedPool() const;
00042     bool IsInUniqueIdResetPool() const;
00043     bool IsRealized() const;
00044
00045     // Info for phasing
00046     void UpdatePhasingInfo(int phase, const winrt::IInspectable& data, const winrt::IDataTemplateComponent& component);
00047     int Phase() const { return m_phase; }
00048     void Phase(int phase) { m_phase = phase; }
00049     winrt::IInspectable Data() const { return m_data.get(); }
00050     winrt::IDataTemplateComponent DataTemplateComponent() const { return m_dataTemplateComponent.get(); }
00051
00052     bool MustClearDataContext() const { return m_mustClearDataContext; }
00053     void MustClearDataContext(bool mustClearDataContext) { m_mustClearDataContext = mustClearDataContext; }
00054
00055     static constexpr int PhaseNotSpecified = std::numeric_limits<int>::min();
00056     static constexpr int PhaseReachedEnd = -1;
00057
00058 #pragma region Ownership state machine
00059
00060     void MoveOwnershipToLayoutFromElementFactory(int index, wstring_view uniqueId);
00061     void MoveOwnershipToLayoutFromUniqueIdResetPool();
00062     void MoveOwnershipToLayoutFromPinnedPool();
00063     void MoveOwnershipToElementFactory();
00064     void MoveOwnershipToUniqueIdResetPoolFromLayout();
00065     void MoveOwnershipToAnimator();
00066     void MoveOwnershipToPinnedPool();
00067
00068 #pragma endregion
00069
00070     unsigned AddPin();
00071     unsigned RemovePin();
00072
00073     void UpdateIndex(int newIndex);
00074
00075     winrt::Rect ArrangeBounds() const { return m_arrangeBounds; }
00076     void ArrangeBounds(winrt::Rect value) { m_arrangeBounds = value; }
00077
00078     wstring_view UniqueId() const { return m_uniqueId; }
00079
00080 #pragma region Keep element from being recycled
00081     bool KeepAlive() { return m_keepAlive; }
00082     void KeepAlive(bool value) { m_keepAlive = value; }
00083 #pragma endregion
00084
00085     bool AutoRecycleCandidate() { return m_autoRecycleCandidate; }
00086     void AutoRecycleCandidate(bool value) { m_autoRecycleCandidate = value; }
00087
00088 #ifdef DBG
00089     static int GetLogItemIndex()
00090     {
00091         return s_logItemIndexDbg;
00092     }
00093
00094     static void SetLogItemIndex(int logItemIndex)
00095     {
00096         s_logItemIndexDbg = logItemIndex;
00097     }
00098 #endif // DBG
00099
00100 private:
00101     unsigned m_pinCounter{ 0u };
00102     int m_index{ -1 };
00103     winrt::hstring m_uniqueId;
00104     ElementOwner m_owner{ ElementOwner::ElementFactory };
00105     winrt::Rect m_arrangeBounds;
00106     int m_phase{ PhaseNotSpecified };
00107     bool m_keepAlive{ false };
00108     bool m_autoRecycleCandidate{ false };
00109     bool m_mustClearDataContext{ false };
00110
00111     weak_ref<winrt::IInspectable> m_data;
00112     weak_ref<winrt::IDataTemplateComponent> m_dataTemplateComponent;
00113
00114 #ifdef DBG
00115     static int s_logItemIndexDbg;
00116 #endif // DBG
00117 };
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/enum_array.h Source File

  • inc

enum_array.h

Go to the documentation of this file.
00001 ﻿#pragma once
00002 #include <array>
00003
00004 template<typename E, class T, std::size_t N>
00005 class enum_array : public std::array<T, N> {
00006 public:
00007     T& operator[] (E e) {
00008         return std::array<T, N>::operator[]((std::size_t)e);
00009     }
00010
00011     const T& operator[] (E e) const {
00012         return std::array<T, N>::operator[]((std::size_t)e);
00013     }
00014 };
00015
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewItem Member List

This is the complete list of members for NavigationViewItem, including all inherited members.
ClearProperties() | NavigationViewItemProperties | [static]
CompactPaneLength(double value) | NavigationViewItemProperties |
CompactPaneLength() | NavigationViewItemProperties |
CompactPaneLengthProperty() | NavigationViewItemProperties | [inline, static]
EnsureProperties() | NavigationViewItemProperties | [static]
ForceCollapse() | NavigationViewItem | [private]
ForwardRefToBaseReferenceTracker(NavigationViewItemBase) NavigationViewItem() | NavigationViewItem |
GetPresenter() const | NavigationViewItem | [private]
GetPresenterOrItem() const | NavigationViewItem | [private]
GetRepeater() const | NavigationViewItem | [inline]
GetSelectionIndicator() const | NavigationViewItem |
HandleExpansionStateMemory() | NavigationViewItem | [private]
HasChildren() | NavigationViewItem |
HasPotentialChildren() | NavigationViewItem |
HasUnrealizedChildren(bool value) | NavigationViewItemProperties |
HasUnrealizedChildren() | NavigationViewItemProperties |
HasUnrealizedChildrenProperty() | NavigationViewItemProperties | [inline, static]
HookInputEvents(const winrt::IControlProtected &controlProtected) | NavigationViewItem | [private]
Icon(winrt::IconElement const &value) | NavigationViewItemProperties |
Icon() | NavigationViewItemProperties |
IconProperty() | NavigationViewItemProperties | [inline, static]
IgnorePointerId(const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
InfoBadge(winrt::InfoBadge const &value) | NavigationViewItemProperties |
InfoBadge() | NavigationViewItemProperties |
InfoBadgeProperty() | NavigationViewItemProperties | [inline, static]
IsChildSelected(bool value) | NavigationViewItemProperties |
IsChildSelected() | NavigationViewItemProperties |
IsChildSelectedProperty() | NavigationViewItemProperties | [inline, static]
IsExpanded(bool value) | NavigationViewItemProperties |
IsExpanded() | NavigationViewItemProperties |
IsExpandedProperty() | NavigationViewItemProperties | [inline, static]
IsOnLeftNav() const | NavigationViewItem | [private]
IsOnTopPrimary() const | NavigationViewItem | [private]
IsOutOfControlBounds(const winrt::Point &point) | NavigationViewItem | [private]
IsRepeaterVisible() const | NavigationViewItem |
LoadElementsForDisplayingChildren() | NavigationViewItem | [private]
LoadMenuItemsHost() | NavigationViewItem | [private]
MenuItems(winrt::IVector< winrt::IInspectable > const &value) | NavigationViewItemProperties |
MenuItems() | NavigationViewItemProperties |
MenuItemsProperty() | NavigationViewItemProperties | [inline, static]
MenuItemsSource(winrt::IInspectable const &value) | NavigationViewItemProperties |
MenuItemsSource() | NavigationViewItemProperties |
MenuItemsSourceProperty() | NavigationViewItemProperties | [inline, static]
NavigationViewItemProperties() | NavigationViewItemProperties |
OnApplyTemplate() override | NavigationViewItem |
OnContentChanged(winrt::IInspectable const &oldContent, winrt::IInspectable const &newContent) override | NavigationViewItem |
OnCreateAutomationPeer() override | NavigationViewItem |
OnExpandCollapseChevronPointerReleased() | NavigationViewItem |
OnFlyoutClosing(const winrt::IInspectable &sender, const winrt::FlyoutBaseClosingEventArgs &args) | NavigationViewItem | [private]
OnGotFocus(winrt::RoutedEventArgs const &e) override | NavigationViewItem |
OnHasUnrealizedChildrenPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | NavigationViewItem |
NavigationViewItemProperties::OnHasUnrealizedChildrenPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | NavigationViewItemProperties | [static]
OnIconPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | NavigationViewItem |
NavigationViewItemProperties::OnIconPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | NavigationViewItemProperties | [static]
OnInfoBadgePropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | NavigationViewItem |
NavigationViewItemProperties::OnInfoBadgePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | NavigationViewItemProperties | [static]
OnIsEnabledChanged(const winrt::IInspectable &sender, const winrt::DependencyPropertyChangedEventArgs &args) | NavigationViewItem | [private]
OnIsExpandedPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | NavigationViewItem |
NavigationViewItemProperties::OnIsExpandedPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | NavigationViewItemProperties | [static]
OnItemsSourceViewChanged(const winrt::IInspectable &sender, const winrt::NotifyCollectionChangedEventArgs &args) | NavigationViewItem | [private]
OnLoaded(winrt::IInspectable const &, winrt::RoutedEventArgs const &) | NavigationViewItem |
OnLostFocus(winrt::RoutedEventArgs const &e) override | NavigationViewItem |
OnMenuItemsPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | NavigationViewItem |
NavigationViewItemProperties::OnMenuItemsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | NavigationViewItemProperties | [static]
OnMenuItemsSourcePropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | NavigationViewItem |
NavigationViewItemProperties::OnMenuItemsSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | NavigationViewItemProperties | [static]
OnMenuItemsVectorChanged(const winrt::Collections::IObservableVector< winrt::IInspectable > &sender, const winrt::Collections::IVectorChangedEventArgs &args) | NavigationViewItem | [private]
OnNavigationViewItemBaseDepthChanged() override | NavigationViewItem | [private]
OnNavigationViewItemBaseIsSelectedChanged() override | NavigationViewItem | [private]
OnNavigationViewItemBasePositionChanged() override | NavigationViewItem | [private]
OnPresenterPointerCanceled(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
OnPresenterPointerCaptureLost(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
OnPresenterPointerEntered(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
OnPresenterPointerExited(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
OnPresenterPointerMoved(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
OnPresenterPointerPressed(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
OnPresenterPointerReleased(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
OnSplitViewPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | NavigationViewItem | [private]
PrepNavigationViewItem(const winrt::SplitView &splitView) | NavigationViewItem | [private]
ProcessPointerCanceled(const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
ProcessPointerOver(const winrt::PointerRoutedEventArgs &args) | NavigationViewItem | [private]
PropagateDepthToChildren(int depth) | NavigationViewItem |
ReparentRepeater() | NavigationViewItem | [private]
ResetTrackedPointerId() | NavigationViewItem | [private]
RestoreExpandedState() | NavigationViewItem | [private]
RotateExpandCollapseChevron(bool isExpanded) | NavigationViewItem |
s_CompactPaneLengthProperty | NavigationViewItemProperties | [static]
s_HasUnrealizedChildrenProperty | NavigationViewItemProperties | [static]
s_IconProperty | NavigationViewItemProperties | [static]
s_InfoBadgeProperty | NavigationViewItemProperties | [static]
s_IsChildSelectedProperty | NavigationViewItemProperties | [static]
s_IsExpandedProperty | NavigationViewItemProperties | [static]
s_MenuItemsProperty | NavigationViewItemProperties | [static]
s_MenuItemsSourceProperty | NavigationViewItemProperties | [static]
s_SelectsOnInvokedProperty | NavigationViewItemProperties | [static]
SelectsOnInvoked(bool value) | NavigationViewItemProperties |
SelectsOnInvoked() | NavigationViewItemProperties |
SelectsOnInvokedProperty() | NavigationViewItemProperties | [inline, static]
ShouldEnableToolTip() const | NavigationViewItem | [private]
ShouldRepeaterShowInFlyout() const | NavigationViewItem |
ShouldShowContent() | NavigationViewItem | [private]
ShouldShowIcon() | NavigationViewItem | [private]
ShouldShowInfoBadge() | NavigationViewItem | [private]
ShowHideChildren() | NavigationViewItem |
ShowSelectionIndicator(bool visible) | NavigationViewItem | [private]
SuggestedToolTipChanged(winrt::IInspectable const &newContent) | NavigationViewItem | [private]
UnhookEventsAndClearFields() | NavigationViewItem | [private]
UnhookInputEvents() | NavigationViewItem | [private]
UpdateCompactPaneLength() | NavigationViewItem | [private]
UpdateIsClosedCompact() | NavigationViewItem | [private]
UpdateItemIndentation() | NavigationViewItem | [private]
UpdateNavigationViewItemToolTip() | NavigationViewItem | [private]
UpdateRepeaterItemsSource() | NavigationViewItem | [private]
UpdateVisualState(bool useTransitions) | NavigationViewItem | [private]
UpdateVisualStateForChevron() | NavigationViewItem | [private]
UpdateVisualStateForClosedCompact() | NavigationViewItem | [private]
UpdateVisualStateForIconAndContent(bool showIcon, bool showContent) | NavigationViewItem | [private]
UpdateVisualStateForInfoBadge() | NavigationViewItem | [private]
UpdateVisualStateForKeyboardFocusedState() | NavigationViewItem | [private]
UpdateVisualStateForNavigationViewPositionChange() | NavigationViewItem | [private]
UpdateVisualStateForPointer() | NavigationViewItem | [private]
UpdateVisualStateForToolTip() | NavigationViewItem | [private]
UpdateVisualStateNoTransition() | NavigationViewItem |
Generated on Sun Dec 1 2024 20:52:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/AnimationSamples/RadialElementAnimator.cs Source File

  • Repeater
  • TestUI
  • Samples
  • AnimationSamples

RadialElementAnimator.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Numerics;
00006 using Windows.Foundation;
00007 using Microsoft.UI.Composition;
00008 using Microsoft.UI.Xaml;
00009 using Microsoft.UI.Xaml.Controls;
00010 using Microsoft.UI.Xaml.Controls.Primitives;
00011 using Microsoft.UI.Xaml.Hosting;
00012 using Microsoft.UI.Xaml.Media;
00013 using System.Collections.Generic;
00014 using Microsoft.UI.Xaml.Media.Animation;
00015 using System.Linq;
00016
00017 namespace MUXControlsTestApp.Samples
00018 {
00019     public class RadialItemCollectionTransitionProvider : ItemCollectionTransitionProvider
00020     {
00021         private const double DefaultAnimationDurationInMs = 600.0;
00022
00023         private static double _animationSlowdownFactor = 1.0;
00024         public static double AnimationSlowdownFactor
00025         {
00026             get
00027             {
00028                 return _animationSlowdownFactor;
00029             }
00030             set
00031             {
00032                 _animationSlowdownFactor = value;
00033             }
00034         }
00035
00036         protected override bool ShouldAnimateCore(ItemCollectionTransition transition)
00037         {
00038             return true;
00039         }
00040
00041         protected override void StartTransitions(IList<ItemCollectionTransition> transitions)
00042         {
00043             var addTransitions = transitions.Where(transition => transition.Operation == ItemCollectionTransitionOperation.Add).ToList();
00044             var removeTransitions = transitions.Where(transition => transition.Operation == ItemCollectionTransitionOperation.Remove).ToList();
00045             var moveTransitions = transitions.Where(transition => transition.Operation == ItemCollectionTransitionOperation.Move).ToList();
00046
00047             StartAddTransitions(addTransitions);
00048             StartRemoveTransitions(removeTransitions);
00049             StartMoveTransitions(moveTransitions);
00050         }
00051
00052         private static void StartAddTransitions(IList<ItemCollectionTransition> transitions)
00053         {
00054             foreach (var transition in transitions)
00055             {
00056                 var progress = transition.Start();
00057                 var visual = ElementCompositionPreview.GetElementVisual(progress.Element);
00058                 var compositor = visual.Compositor;
00059
00060                 var parent = (FrameworkElement)VisualTreeHelper.GetParent(progress.Element);
00061                 var to = LayoutInformation.GetLayoutSlot((FrameworkElement)progress.Element);
00062                 var from = to;
00063                 from.X = (parent.ActualWidth - ((FrameworkElement)progress.Element).ActualWidth) / 2;
00064                 from.Y = (parent.ActualHeight - ((FrameworkElement)progress.Element).ActualHeight) / 2;
00065
00066                 var batch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
00067                 AnimateOffset(visual, compositor, from, to);
00068                 batch.End();
00069                 batch.Completed += delegate { progress.Complete(); };
00070             }
00071         }
00072
00073         private static void StartRemoveTransitions(IList<ItemCollectionTransition> transitions)
00074         {
00075             foreach (var transition in transitions)
00076             {
00077                 var progress = transition.Start();
00078                 var visual = ElementCompositionPreview.GetElementVisual(progress.Element);
00079                 var compositor = visual.Compositor;
00080
00081                 var fadeOutAnimation = compositor.CreateScalarKeyFrameAnimation();
00082                 fadeOutAnimation.InsertExpressionKeyFrame(0.0f, "this.CurrentValue");
00083                 fadeOutAnimation.InsertKeyFrame(1.0f, 0.0f);
00084                 fadeOutAnimation.Duration = TimeSpan.FromMilliseconds(DefaultAnimationDurationInMs * AnimationSlowdownFactor);
00085
00086                 var batch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
00087                 visual.StartAnimation("Opacity", fadeOutAnimation);
00088                 batch.End();
00089                 batch.Completed += delegate { progress.Complete(); };
00090             }
00091         }
00092
00093         private static void StartMoveTransitions(IList<ItemCollectionTransition> transitions)
00094         {
00095             foreach (var transition in transitions)
00096             {
00097                 var progress = transition.Start();
00098                 var outerVisual = ElementCompositionPreview.GetElementVisual(progress.Element);
00099                 var innerVisual = ElementCompositionPreview.GetElementVisual((UIElement)VisualTreeHelper.GetChild(progress.Element, 0));
00100                 var compositor = outerVisual.Compositor;
00101
00102                 var parent = (FrameworkElement)VisualTreeHelper.GetParent(progress.Element);
00103                 var center = new Point(parent.ActualWidth / 2, parent.ActualHeight / 2);
00104                 var from = new Point((transition.OldBounds.Left + transition.OldBounds.Right) / 2 - center.X, -(transition.OldBounds.Top + transition.OldBounds.Bottom) / 2 + center.Y);
00105                 var to = new Point((transition.NewBounds.Left + transition.NewBounds.Right) / 2 - center.X, -(transition.NewBounds.Top + transition.NewBounds.Bottom) / 2 + center.Y);
00106                 var fromLength = Math.Sqrt(from.X * from.X + from.Y * from.Y);
00107                 var toLength = Math.Sqrt(to.X * to.X + to.Y * to.Y);
00108                 from.X /= fromLength;
00109                 from.Y /= fromLength;
00110                 to.X /= toLength;
00111                 to.Y /= toLength;
00112
00113                 var angle = Math.Acos(Math.Min(1, to.X * from.X + to.Y * from.Y));
00114                 var sign = Math.Sign(to.X * from.Y - to.Y * from.X);
00115                 if (sign == 0) sign = Math.Sign(from.Y - to.Y);
00116                 if (double.IsNaN(angle)) angle = 0;
00117
00118                 outerVisual.CenterPoint = new Vector3((float)(center.X - transition.NewBounds.X), (float)(center.Y - transition.NewBounds.Y), 0);
00119                 innerVisual.CenterPoint = new Vector3((float)(transition.NewBounds.Width / 2), (float)(transition.NewBounds.Height / 2), 0);
00120
00121                 var outerRotate = compositor.CreateScalarKeyFrameAnimation();
00122                 {
00123                     outerRotate.InsertExpressionKeyFrame(0.0f, (-sign * angle).ToString());
00124                     outerRotate.InsertKeyFrame(1.0f, 0.0f);
00125                     outerRotate.Duration = TimeSpan.FromMilliseconds(DefaultAnimationDurationInMs * AnimationSlowdownFactor);
00126                 }
00127
00128                 var innerRotate = compositor.CreateScalarKeyFrameAnimation();
00129                 {
00130                     innerRotate.InsertExpressionKeyFrame(0.0f, (sign * angle).ToString());
00131                     innerRotate.InsertKeyFrame(1.0f, 0.0f);
00132                     innerRotate.Duration = TimeSpan.FromMilliseconds(DefaultAnimationDurationInMs * AnimationSlowdownFactor);
00133                 }
00134
00135                 var batch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
00136                 outerVisual.StartAnimation("RotationAngle", outerRotate);
00137                 innerVisual.StartAnimation("RotationAngle", innerRotate);
00138                 batch.End();
00139                 batch.Completed += delegate { progress.Complete(); };
00140             }
00141         }
00142
00143         private static void AnimateOffset(Visual visual, Compositor compositor, Rect oldBounds, Rect newBounds)
00144         {
00145             var offsetAnimation = compositor.CreateVector2KeyFrameAnimation();
00146
00147             offsetAnimation.SetVector2Parameter("delta", new Vector2(
00148                 (float)(oldBounds.X - newBounds.X),
00149                 (float)(oldBounds.Y - newBounds.Y)));
00150             offsetAnimation.SetVector2Parameter("final", new Vector2());
00151             offsetAnimation.InsertExpressionKeyFrame(0.0f, "this.CurrentValue + delta");
00152             offsetAnimation.InsertExpressionKeyFrame(1.0f, "final");
00153             offsetAnimation.Duration = TimeSpan.FromMilliseconds(
00154                 DefaultAnimationDurationInMs * AnimationSlowdownFactor);
00155
00156             visual.StartAnimation("TransformMatrix._41_42", offsetAnimation);
00157         }
00158     }
00159 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MainWindowLightConfiguration Member List

This is the complete list of members for MainWindowLightConfiguration, including all inherited members.
Dispose() | MainWindowLightConfiguration | [inline]
MainWindowLightConfiguration() | MainWindowLightConfiguration | [inline]
View | MainWindowLightConfiguration |
Generated on Sun Dec 1 2024 20:53:34 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RadialGradientBrush.properties.h Source File

  • Generated

RadialGradientBrush.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class RadialGradientBrushProperties
00008 {
00009 public:
00010     RadialGradientBrushProperties();
00011
00012     void Center(winrt::Point const& value);
00013     winrt::Point Center();
00014
00015     void GradientOrigin(winrt::Point const& value);
00016     winrt::Point GradientOrigin();
00017
00018     void InterpolationSpace(winrt::CompositionColorSpace const& value);
00019     winrt::CompositionColorSpace InterpolationSpace();
00020
00021     void MappingMode(winrt::BrushMappingMode const& value);
00022     winrt::BrushMappingMode MappingMode();
00023
00024     void RadiusX(double value);
00025     double RadiusX();
00026
00027     void RadiusY(double value);
00028     double RadiusY();
00029
00030     void SpreadMethod(winrt::GradientSpreadMethod const& value);
00031     winrt::GradientSpreadMethod SpreadMethod();
00032
00033     static winrt::DependencyProperty CenterProperty() { return s_CenterProperty; }
00034     static winrt::DependencyProperty GradientOriginProperty() { return s_GradientOriginProperty; }
00035     static winrt::DependencyProperty InterpolationSpaceProperty() { return s_InterpolationSpaceProperty; }
00036     static winrt::DependencyProperty MappingModeProperty() { return s_MappingModeProperty; }
00037     static winrt::DependencyProperty RadiusXProperty() { return s_RadiusXProperty; }
00038     static winrt::DependencyProperty RadiusYProperty() { return s_RadiusYProperty; }
00039     static winrt::DependencyProperty SpreadMethodProperty() { return s_SpreadMethodProperty; }
00040
00041     static GlobalDependencyProperty s_CenterProperty;
00042     static GlobalDependencyProperty s_GradientOriginProperty;
00043     static GlobalDependencyProperty s_InterpolationSpaceProperty;
00044     static GlobalDependencyProperty s_MappingModeProperty;
00045     static GlobalDependencyProperty s_RadiusXProperty;
00046     static GlobalDependencyProperty s_RadiusYProperty;
00047     static GlobalDependencyProperty s_SpreadMethodProperty;
00048
00049     static void EnsureProperties();
00050     static void ClearProperties();
00051
00052     static void OnCenterPropertyChanged(
00053         winrt::DependencyObject const& sender,
00054         winrt::DependencyPropertyChangedEventArgs const& args);
00055
00056     static void OnGradientOriginPropertyChanged(
00057         winrt::DependencyObject const& sender,
00058         winrt::DependencyPropertyChangedEventArgs const& args);
00059
00060     static void OnInterpolationSpacePropertyChanged(
00061         winrt::DependencyObject const& sender,
00062         winrt::DependencyPropertyChangedEventArgs const& args);
00063
00064     static void OnMappingModePropertyChanged(
00065         winrt::DependencyObject const& sender,
00066         winrt::DependencyPropertyChangedEventArgs const& args);
00067
00068     static void OnRadiusXPropertyChanged(
00069         winrt::DependencyObject const& sender,
00070         winrt::DependencyPropertyChangedEventArgs const& args);
00071
00072     static void OnRadiusYPropertyChanged(
00073         winrt::DependencyObject const& sender,
00074         winrt::DependencyPropertyChangedEventArgs const& args);
00075
00076     static void OnSpreadMethodPropertyChanged(
00077         winrt::DependencyObject const& sender,
00078         winrt::DependencyPropertyChangedEventArgs const& args);
00079 };
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/TestUI/ScrollPresenterStackPanelAnchoringPage.xaml.cs Source File

  • ScrollPresenter
  • TestUI

ScrollPresenterStackPanelAnchoringPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Numerics;
00007 using Windows.Foundation;
00008 using Windows.UI;
00009 using Microsoft.UI.Composition;
00010 using Microsoft.UI.Xaml;
00011 using Microsoft.UI.Xaml.Controls;
00012 using Microsoft.UI.Xaml.Controls.Primitives;
00013 using Microsoft.UI.Xaml.Media;
00014 using Microsoft.UI.Xaml.Navigation;
00015 using Microsoft.UI.Private.Controls;
00016 using Microsoft.UI.Dispatching;
00017
00018 namespace MUXControlsTestApp
00019 {
00020     public sealed partial class ScrollPresenterStackPanelAnchoringPage : TestPage
00021     {
00022         private DispatcherTimer timer = new DispatcherTimer();
00023         private Object asyncEventReportingLock = new Object();
00024         private List<string> lstAsyncEventMessage = new List<string>();
00025         private List<QueuedOperation> lstQueuedOperations = new List<QueuedOperation>();
00026         private List<QueuedOperation> lstTriggeredOperations = new List<QueuedOperation>();
00027         private Border currentAnchor = null;
00028         private UIElement anchorElement = null;
00029         private SolidColorBrush chartreuseBrush = new SolidColorBrush(Microsoft.UI.Colors.Chartreuse);
00030         private SolidColorBrush blanchedAlmondBrush = new SolidColorBrush(Microsoft.UI.Colors.BlanchedAlmond);
00031         private SolidColorBrush orangeBrush = new SolidColorBrush(Microsoft.UI.Colors.Orange);
00032         private int operationCount = 0;
00033         private double lastScrollPresenterOffset = 0.0;
00034
00035         public ScrollPresenterStackPanelAnchoringPage()
00036         {
00037             InitializeComponent();
00038
00039             Loaded += ScrollPresenterStackPanelAnchoringPage_Loaded;
00040
00041             scrollPresenter.SizeChanged += ScrollPresenter_SizeChanged;
00042
00043             timer.Interval = new TimeSpan(0, 0, 2 /*sec*/);
00044             timer.Tick += Timer_Tick;
00045
00046             Insert(0 /*newIndex*/, 16 /*newCount*/);
00047         }
00048
00049         protected override void OnNavigatedFrom(NavigationEventArgs e)
00050         {
00051             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00052             MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00053
00054             UpdateRaiseAnchorNotifications(raiseAnchorNotifications: false);
00055
00056             base.OnNavigatedFrom(e);
00057         }
00058
00059         private void ScrollPresenterStackPanelAnchoringPage_Loaded(object sender, RoutedEventArgs e)
00060         {
00061             try
00062             {
00063                 if (chkLogScrollPresenterMessages.IsChecked == true)
00064                 {
00065                     MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00066                     MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00067                 }
00068
00069                 UpdateRaiseAnchorNotifications(raiseAnchorNotifications: true);
00070
00071                 UpdateHorizontalAnchorRatio();
00072                 UpdateVerticalAnchorRatio();
00073
00074                 if (chkLogScrollPresenterEvents.IsChecked == true)
00075                 {
00076                     scrollPresenter.ExtentChanged += ScrollPresenter_ExtentChanged;
00077                     scrollPresenter.StateChanged += ScrollPresenter_StateChanged;
00078                 }
00079                 scrollPresenter.AnchorRequested += ScrollPresenter_AnchorRequested;
00080                 scrollPresenter.ViewChanged += ScrollPresenter_ViewChanged;
00081                 scrollPresenter.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00082                 scrollPresenter.ScrollAnimationStarting += ScrollPresenter_ScrollAnimationStarting;
00083             }
00084             catch (Exception ex)
00085             {
00086                 txtExceptionReport.Text = ex.ToString();
00087                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00088             }
00089         }
00090
00091         private void ScrollPresenter_SizeChanged(object sender, SizeChangedEventArgs e)
00092         {
00093             cnsAnchorPoint.Width = scrollPresenter.Width;
00094             cnsAnchorPoint.Height = scrollPresenter.Height;
00095         }
00096
00097         private void Timer_Tick(object sender, object e)
00098         {
00099             timer.Stop();
00100             ExecuteQueuedOperations();
00101         }
00102
00103         private void BtnInsert_Click(object sender, RoutedEventArgs e)
00104         {
00105             try
00106             {
00107                 switch (cmbDelayMode.SelectedIndex)
00108                 {
00109                     case 0: // No delay
00110                         Insert(int.Parse(txtNewStartIndex.Text), int.Parse(txtNewCount.Text));
00111                         break;
00112                     case 1: // Timer expiration
00113                         lstQueuedOperations.Add(new QueuedOperation(QueuedOperationType.Insert, 0, 0, int.Parse(txtNewStartIndex.Text), int.Parse(txtNewCount.Text)));
00114                         AppendAsyncEventMessage("Queued Insert NewIndex=" + txtNewStartIndex.Text + ", NewCount=" + txtNewCount.Text);
00115                         timer.Start();
00116                         break;
00117                     case 2: // Offset crosses 350
00118                         lstTriggeredOperations.Add(new QueuedOperation(QueuedOperationType.Insert, 0, 0, int.Parse(txtNewStartIndex.Text), int.Parse(txtNewCount.Text)));
00119                         AppendAsyncEventMessage("Triggerable Insert NewIndex=" + txtNewStartIndex.Text + ", NewCount=" + txtNewCount.Text);
00120                         break;
00121                 }
00122             }
00123             catch (Exception ex)
00124             {
00125                 txtExceptionReport.Text = ex.ToString();
00126                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00127             }
00128         }
00129
00130         private void BtnRemove_Click(object sender, RoutedEventArgs e)
00131         {
00132             try
00133             {
00134                 switch (cmbDelayMode.SelectedIndex)
00135                 {
00136                     case 0: // No delay
00137                         Remove(int.Parse(txtOldStartIndex.Text), int.Parse(txtOldCount.Text));
00138                         break;
00139                     case 1: // Timer expiration
00140                         lstQueuedOperations.Add(new QueuedOperation(QueuedOperationType.Remove, int.Parse(txtOldStartIndex.Text), int.Parse(txtOldCount.Text), 0, 0));
00141                         AppendAsyncEventMessage("Queued Remove OldIndex=" + txtOldStartIndex.Text + ", OldCount=" + txtOldCount.Text);
00142                         timer.Start();
00143                         break;
00144                     case 2: // Offset crosses 350
00145                         lstTriggeredOperations.Add(new QueuedOperation(QueuedOperationType.Remove, int.Parse(txtOldStartIndex.Text), int.Parse(txtOldCount.Text), 0, 0));
00146                         AppendAsyncEventMessage("Triggerable Remove OldIndex=" + txtOldStartIndex.Text + ", OldCount=" + txtOldCount.Text);
00147                         break;
00148                 }
00149             }
00150             catch (Exception ex)
00151             {
00152                 txtExceptionReport.Text = ex.ToString();
00153                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00154             }
00155         }
00156
00157         private void BtnReplace_Click(object sender, RoutedEventArgs e)
00158         {
00159             try
00160             {
00161                 switch (cmbDelayMode.SelectedIndex)
00162                 {
00163                     case 0: // No delay
00164                         Replace(int.Parse(txtOldStartIndex.Text), int.Parse(txtOldCount.Text), int.Parse(txtNewCount.Text));
00165                         break;
00166                     case 1: // Timer expiration
00167                         lstQueuedOperations.Add(new QueuedOperation(QueuedOperationType.Replace, int.Parse(txtOldStartIndex.Text), int.Parse(txtOldCount.Text), 0, int.Parse(txtNewCount.Text)));
00168                         AppendAsyncEventMessage("Queued Replace OldIndex=" + txtOldStartIndex.Text + ", OldCount=" + txtOldCount.Text + ", NewCount=" + txtNewCount.Text);
00169                         timer.Start();
00170                         break;
00171                     case 2: // Offset crosses 350
00172                         lstTriggeredOperations.Add(new QueuedOperation(QueuedOperationType.Replace, int.Parse(txtOldStartIndex.Text), int.Parse(txtOldCount.Text), 0, int.Parse(txtNewCount.Text)));
00173                         AppendAsyncEventMessage("Triggerable Replace OldIndex=" + txtOldStartIndex.Text + ", OldCount=" + txtOldCount.Text + ", NewCount=" + txtNewCount.Text);
00174                         break;
00175                 }
00176             }
00177             catch (Exception ex)
00178             {
00179                 txtExceptionReport.Text = ex.ToString();
00180                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00181             }
00182         }
00183
00184         private void BtnShrink_Click(object sender, RoutedEventArgs e)
00185         {
00186             try
00187             {
00188                 switch (cmbDelayMode.SelectedIndex)
00189                 {
00190                     case 0: // No delay
00191                         Shrink(int.Parse(txtIndex.Text), 1);
00192                         break;
00193                     case 1: // Timer expiration
00194                         lstQueuedOperations.Add(new QueuedOperation(QueuedOperationType.Shrink, 0, 0, int.Parse(txtIndex.Text), 1));
00195                         AppendAsyncEventMessage("Queued Shrink Index=" + txtIndex.Text);
00196                         timer.Start();
00197                         break;
00198                     case 2: // Offset crosses 350
00199                         lstTriggeredOperations.Add(new QueuedOperation(QueuedOperationType.Shrink, 0, 0, int.Parse(txtIndex.Text), 1));
00200                         AppendAsyncEventMessage("Triggerable Shrink Index=" + txtIndex.Text);
00201                         break;
00202                 }
00203             }
00204             catch (Exception ex)
00205             {
00206                 txtExceptionReport.Text = ex.ToString();
00207                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00208             }
00209         }
00210
00211         private void BtnShrinkMore_Click(object sender, RoutedEventArgs e)
00212         {
00213             try
00214             {
00215                 switch (cmbDelayMode.SelectedIndex)
00216                 {
00217                     case 0: // No delay
00218                         Shrink(int.Parse(txtIndex.Text), 4);
00219                         break;
00220                     case 1: // Timer expiration
00221                         lstQueuedOperations.Add(new QueuedOperation(QueuedOperationType.Shrink, 0, 0, int.Parse(txtIndex.Text), 4));
00222                         AppendAsyncEventMessage("Queued Shrink More Index=" + txtIndex.Text);
00223                         timer.Start();
00224                         break;
00225                     case 2: // Offset crosses 350
00226                         lstTriggeredOperations.Add(new QueuedOperation(QueuedOperationType.Shrink, 0, 0, int.Parse(txtIndex.Text), 4));
00227                         AppendAsyncEventMessage("Triggerable Shrink More Index=" + txtIndex.Text);
00228                         break;
00229                 }
00230             }
00231             catch (Exception ex)
00232             {
00233                 txtExceptionReport.Text = ex.ToString();
00234                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00235             }
00236         }
00237
00238         private void BtnExpand_Click(object sender, RoutedEventArgs e)
00239         {
00240             try
00241             {
00242                 switch (cmbDelayMode.SelectedIndex)
00243                 {
00244                     case 0: // No delay
00245                         Expand(int.Parse(txtIndex.Text), 1);
00246                         break;
00247                     case 1: // Timer expiration
00248                         lstQueuedOperations.Add(new QueuedOperation(QueuedOperationType.Expand, 0, 0, int.Parse(txtIndex.Text), 1));
00249                         AppendAsyncEventMessage("Queued Expand Index=" + txtIndex.Text);
00250                         timer.Start();
00251                         break;
00252                     case 2: // Offset crosses 350
00253                         lstTriggeredOperations.Add(new QueuedOperation(QueuedOperationType.Expand, 0, 0, int.Parse(txtIndex.Text), 1));
00254                         AppendAsyncEventMessage("Triggerable Expand Index=" + txtIndex.Text);
00255                         break;
00256                 }
00257             }
00258             catch (Exception ex)
00259             {
00260                 txtExceptionReport.Text = ex.ToString();
00261                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00262             }
00263         }
00264
00265         private void BtnExpandMore_Click(object sender, RoutedEventArgs e)
00266         {
00267             try
00268             {
00269                 switch (cmbDelayMode.SelectedIndex)
00270                 {
00271                     case 0: // No delay
00272                         Expand(int.Parse(txtIndex.Text), 4);
00273                         break;
00274                     case 1: // Timer expiration
00275                         lstQueuedOperations.Add(new QueuedOperation(QueuedOperationType.Expand, 0, 0, int.Parse(txtIndex.Text), 4));
00276                         AppendAsyncEventMessage("Queued Expand Index=" + txtIndex.Text);
00277                         timer.Start();
00278                         break;
00279                     case 2: // Offset crosses 350
00280                         lstTriggeredOperations.Add(new QueuedOperation(QueuedOperationType.Expand, 0, 0, int.Parse(txtIndex.Text), 4));
00281                         AppendAsyncEventMessage("Triggerable Expand Index=" + txtIndex.Text);
00282                         break;
00283                 }
00284             }
00285             catch (Exception ex)
00286             {
00287                 txtExceptionReport.Text = ex.ToString();
00288                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00289             }
00290         }
00291
00292         private void ExecuteQueuedOperations()
00293         {
00294             try
00295             {
00296                 while (lstQueuedOperations.Count > 0)
00297                 {
00298                     QueuedOperation qo = lstQueuedOperations[0];
00299
00300                     switch (qo.Type)
00301                     {
00302                         case QueuedOperationType.Insert:
00303                             AppendAsyncEventMessage("Unqueuing Insert NewIndex=" + qo.NewIndex + ", NewCount=" + qo.NewCount);
00304                             Insert(qo.NewIndex, qo.NewCount);
00305                             break;
00306                         case QueuedOperationType.Remove:
00307                             AppendAsyncEventMessage("Unqueuing Remove OldIndex=" + qo.OldIndex + ", OldCount=" + qo.OldCount);
00308                             Remove(qo.OldIndex, qo.OldCount);
00309                             break;
00310                         case QueuedOperationType.Replace:
00311                             AppendAsyncEventMessage("Unqueuing Replace OldIndex=" + qo.OldIndex + ", OldCount=" + qo.OldCount + ", NewCount=" + qo.NewCount);
00312                             Replace(qo.OldIndex, qo.OldCount, qo.NewCount);
00313                             break;
00314                         case QueuedOperationType.Shrink:
00315                             AppendAsyncEventMessage("Unqueuing Shrink Index=" + qo.NewIndex + ", Amount=" + qo.NewCount * 20);
00316                             Shrink(qo.NewIndex, qo.NewCount);
00317                             break;
00318                         case QueuedOperationType.Expand:
00319                             AppendAsyncEventMessage("Unqueuing Expand Index=" + qo.NewIndex + ", Amount=" + qo.NewCount * 20);
00320                             Expand(qo.NewIndex, qo.NewCount);
00321                             break;
00322                     }
00323
00324                     lstQueuedOperations.RemoveAt(0);
00325                 }
00326             }
00327             catch (Exception ex)
00328             {
00329                 txtExceptionReport.Text = ex.ToString();
00330                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00331             }
00332         }
00333
00334         private void ExecuteTriggerableOperations()
00335         {
00336             try
00337             {
00338                 while (lstTriggeredOperations.Count > 0)
00339                 {
00340                     QueuedOperation qo = lstTriggeredOperations[0];
00341
00342                     switch (qo.Type)
00343                     {
00344                         case QueuedOperationType.Insert:
00345                             AppendAsyncEventMessage("Triggering Insert NewIndex=" + qo.NewIndex + ", NewCount=" + qo.NewCount);
00346                             Insert(qo.NewIndex, qo.NewCount);
00347                             break;
00348                         case QueuedOperationType.Remove:
00349                             AppendAsyncEventMessage("Triggering Remove OldIndex=" + qo.OldIndex + ", OldCount=" + qo.OldCount);
00350                             Remove(qo.OldIndex, qo.OldCount);
00351                             break;
00352                         case QueuedOperationType.Replace:
00353                             AppendAsyncEventMessage("Triggering Replace OldIndex=" + qo.OldIndex + ", OldCount=" + qo.OldCount + ", NewCount=" + qo.NewCount);
00354                             Replace(qo.OldIndex, qo.OldCount, qo.NewCount);
00355                             break;
00356                         case QueuedOperationType.Shrink:
00357                             AppendAsyncEventMessage("Triggering Shrink Index=" + qo.NewIndex + ", Amount=" + qo.NewCount * 20);
00358                             Shrink(qo.NewIndex, qo.NewCount);
00359                             break;
00360                         case QueuedOperationType.Expand:
00361                             AppendAsyncEventMessage("Triggering Expand Index=" + qo.NewIndex + ", Amount=" + qo.NewCount * 20);
00362                             Expand(qo.NewIndex, qo.NewCount);
00363                             break;
00364                     }
00365
00366                     lstTriggeredOperations.RemoveAt(0);
00367                 }
00368             }
00369             catch (Exception ex)
00370             {
00371                 txtExceptionReport.Text = ex.ToString();
00372                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00373             }
00374         }
00375
00376         private void Insert(int newIndex, int newCount)
00377         {
00378             if (newIndex < 0 || newIndex > stackPanel.Children.Count || newCount <= 0)
00379             {
00380                 throw new ArgumentException();
00381             }
00382
00383             for (int i = 0; i < newCount; i++)
00384             {
00385                 TextBlock textBlock = new TextBlock();
00386                 textBlock.Text = "TB#" + stackPanel.Children.Count + "_" + operationCount;
00387                 textBlock.Name = "textBlock" + stackPanel.Children.Count + "_" + operationCount;
00388                 textBlock.HorizontalAlignment = HorizontalAlignment.Center;
00389                 textBlock.VerticalAlignment = VerticalAlignment.Center;
00390
00391                 Border border = new Border();
00392                 border.Name = "border" + stackPanel.Children.Count + "_" + operationCount;
00393                 border.BorderThickness = border.Margin = new Thickness(3);
00394                 border.BorderBrush = chartreuseBrush;
00395                 border.Background = blanchedAlmondBrush;
00396                 if (chkHorizontalOrientation.IsChecked == true)
00397                 {
00398                     border.Width = 120;
00399                     border.Height = 170;
00400                 }
00401                 else
00402                 {
00403                     border.Width = 170;
00404                     border.Height = 120;
00405                 }
00406                 border.Child = textBlock;
00407
00408                 stackPanel.Children.Insert(newIndex + i, border);
00409             }
00410
00411             operationCount++;
00412         }
00413
00414         private void Remove(int oldIndex, int oldCount)
00415         {
00416             if (oldIndex < 0 || oldIndex > stackPanel.Children.Count - oldCount || oldCount <= 0)
00417             {
00418                 throw new ArgumentException();
00419             }
00420
00421             bool isAnchorRemoved = false;
00422
00423             for (int i = 0; i < oldCount; i++)
00424             {
00425                 if (!isAnchorRemoved && anchorElement == stackPanel.Children[oldIndex])
00426                 {
00427                     isAnchorRemoved = true;
00428                 }
00429                 stackPanel.Children.RemoveAt(oldIndex);
00430             }
00431
00432             if (isAnchorRemoved)
00433             {
00434                 BtnSetAnchorElement_Click(null, null);
00435             }
00436
00437             operationCount++;
00438         }
00439
00440         private void Replace(int oldIndex, int oldCount, int newCount)
00441         {
00442             if (oldIndex < 0 || oldIndex > stackPanel.Children.Count - oldCount || oldCount <= 0 || newCount <= 0)
00443             {
00444                 throw new ArgumentException();
00445             }
00446
00447             for (int i = 0; i < oldCount; i++)
00448             {
00449                 stackPanel.Children.RemoveAt(oldIndex);
00450             }
00451
00452             for (int i = 0; i < newCount; i++)
00453             {
00454                 TextBlock textBlock = new TextBlock();
00455                 textBlock.Text = "TB#" + stackPanel.Children.Count + "_" + operationCount;
00456                 textBlock.Name = "textBlock" + stackPanel.Children.Count + "_" + operationCount;
00457                 textBlock.HorizontalAlignment = HorizontalAlignment.Center;
00458                 textBlock.VerticalAlignment = VerticalAlignment.Center;
00459
00460                 Border border = new Border();
00461                 border.Name = "border" + stackPanel.Children.Count + "_" + operationCount;
00462                 border.BorderThickness = border.Margin = new Thickness(3);
00463                 border.BorderBrush = chartreuseBrush;
00464                 border.Background = blanchedAlmondBrush;
00465                 if (chkHorizontalOrientation.IsChecked == true)
00466                 {
00467                     border.Width = 120;
00468                     border.Height = 170;
00469                 }
00470                 else
00471                 {
00472                     border.Width = 170;
00473                     border.Height = 120;
00474                 }
00475                 border.Child = textBlock;
00476
00477                 stackPanel.Children.Insert(oldIndex + i, border);
00478             }
00479
00480             operationCount++;
00481         }
00482
00483         private void Shrink(int index, int amount)
00484         {
00485             if (index < 0 || index >= stackPanel.Children.Count)
00486             {
00487                 throw new ArgumentException();
00488             }
00489
00490             Border border = stackPanel.Children[index] as Border;
00491             border.Height = Math.Max(20, border.Height - 20 * amount);
00492
00493             operationCount++;
00494         }
00495
00496         private void Expand(int index, int amount)
00497         {
00498             if (index < 0 || index >= stackPanel.Children.Count)
00499             {
00500                 throw new ArgumentException();
00501             }
00502
00503             Border border = stackPanel.Children[index] as Border;
00504             border.Height += 20 * amount;
00505
00506             operationCount++;
00507         }
00508
00509         private void ScrollPresenter_ExtentChanged(ScrollPresenter sender, object args)
00510         {
00511             if (chkLogScrollPresenterEvents.IsChecked == true)
00512             {
00513                 AppendAsyncEventMessage("ExtentChanged ExtentWidth=" + sender.ExtentWidth.ToString() + ", ExtentHeight=" + sender.ExtentHeight.ToString());
00514             }
00515         }
00516
00517         private void ScrollPresenter_StateChanged(ScrollPresenter sender, object args)
00518         {
00519             if (chkLogScrollPresenterEvents.IsChecked == true)
00520             {
00521                 AppendAsyncEventMessage("StateChanged " + sender.State.ToString());
00522             }
00523         }
00524
00525         private void ScrollPresenter_ViewChanged(ScrollPresenter sender, object args)
00526         {
00527             if (chkLogScrollPresenterEvents.IsChecked == true)
00528             {
00529                 AppendAsyncEventMessage("ViewChanged H=" + sender.HorizontalOffset.ToString() + ", V=" + sender.VerticalOffset.ToString() + ", S=" + sender.ZoomFactor.ToString());
00530             }
00531
00532             double newScrollPresenterOffset = stackPanel.Orientation == Orientation.Horizontal ? scrollPresenter.HorizontalOffset : scrollPresenter.VerticalOffset;
00533
00534             if (lstTriggeredOperations.Count > 0 &&
00535                 ((lastScrollPresenterOffset <= 350.0 && newScrollPresenterOffset > 350.0) || (lastScrollPresenterOffset >= 350.0 && newScrollPresenterOffset < 350.0)))
00536             {
00537                 ExecuteTriggerableOperations();
00538             }
00539             else
00540             {
00541                 scrollPresenter.InvalidateArrange();
00542             }
00543
00544             lastScrollPresenterOffset = newScrollPresenterOffset;
00545         }
00546
00547         private void ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args)
00548         {
00549             if (chkLogScrollPresenterEvents.IsChecked == true)
00550             {
00551                 ScrollPresenterViewChangeResult result = ScrollPresenterTestHooks.GetScrollCompletedResult(args);
00552
00553                 AppendAsyncEventMessage("ScrollCompleted OffsetsChangeCorrelationId=" + args.CorrelationId + ", Result=" + result);
00554             }
00555         }
00556
00557         private void ScrollPresenter_AnchorRequested(ScrollPresenter sender, ScrollingAnchorRequestedEventArgs args)
00558         {
00559             try
00560             {
00561                 IList<UIElement> anchorCandidates = args.AnchorCandidates;
00562
00563                 if (chkLogScrollPresenterEvents.IsChecked == true)
00564                 {
00565                     AppendAsyncEventMessage("AnchorRequested anchor=" + (args.AnchorElement == null ? "null" : "non-null") + ", count=" + anchorCandidates.Count);
00566                 }
00567
00568                 if (anchorElement == null)
00569                 {
00570                     foreach (UIElement child in stackPanel.Children)
00571                     {
00572                         anchorCandidates.Add(child);
00573                     }
00574                 }
00575                 else
00576                 {
00577                     args.AnchorElement = anchorElement;
00578                 }
00579             }
00580             catch (Exception ex)
00581             {
00582                 cmbAnchorElement.SelectedIndex = 0;
00583                 BtnSetAnchorElement_Click(null, null);
00584
00585                 txtExceptionReport.Text = ex.ToString();
00586                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00587             }
00588         }
00589
00590         private void BtnGetHorizontalAnchorRatio_Click(object sender, RoutedEventArgs e)
00591         {
00592             UpdateHorizontalAnchorRatio();
00593         }
00594
00595         private void BtnSetHorizontalAnchorRatio_Click(object sender, RoutedEventArgs e)
00596         {
00597             try
00598             {
00599                 scrollPresenter.HorizontalAnchorRatio = Convert.ToDouble(txtHorizontalAnchorRatio.Text);
00600             }
00601             catch (Exception ex)
00602             {
00603                 txtExceptionReport.Text = ex.ToString();
00604                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00605             }
00606         }
00607
00608         private void BtnGetVerticalAnchorRatio_Click(object sender, RoutedEventArgs e)
00609         {
00610             UpdateVerticalAnchorRatio();
00611         }
00612
00613         private void BtnSetVerticalAnchorRatio_Click(object sender, RoutedEventArgs e)
00614         {
00615             try
00616             {
00617                 scrollPresenter.VerticalAnchorRatio = Convert.ToDouble(txtVerticalAnchorRatio.Text);
00618             }
00619             catch (Exception ex)
00620             {
00621                 txtExceptionReport.Text = ex.ToString();
00622                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00623             }
00624         }
00625
00626         private void BtnGetWidth_Click(object sender, RoutedEventArgs e)
00627         {
00628             txtWidth.Text = scrollPresenter.Width.ToString();
00629         }
00630
00631         private void BtnSetWidth_Click(object sender, RoutedEventArgs e)
00632         {
00633             try
00634             {
00635                 scrollPresenter.Width = Convert.ToDouble(txtWidth.Text);
00636             }
00637             catch (Exception ex)
00638             {
00639                 txtExceptionReport.Text = ex.ToString();
00640                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00641             }
00642         }
00643
00644         private void BtnGetHeight_Click(object sender, RoutedEventArgs e)
00645         {
00646             txtHeight.Text = scrollPresenter.Height.ToString();
00647         }
00648
00649         private void BtnSetHeight_Click(object sender, RoutedEventArgs e)
00650         {
00651             try
00652             {
00653                 scrollPresenter.Height = Convert.ToDouble(txtHeight.Text);
00654             }
00655             catch (Exception ex)
00656             {
00657                 txtExceptionReport.Text = ex.ToString();
00658                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00659             }
00660         }
00661
00662         private void BtnGetCurrentAnchor_Click(object sender, RoutedEventArgs e)
00663         {
00664             try
00665             {
00666                 if (scrollPresenter.CurrentAnchor == null)
00667                 {
00668                     txtCurrentAnchor.Text = "null";
00669                 }
00670                 else
00671                 {
00672                     FrameworkElement currentAnchorAsFE = scrollPresenter.CurrentAnchor as FrameworkElement;
00673
00674                     txtCurrentAnchor.Text = currentAnchorAsFE == null ? "UIElement" : currentAnchorAsFE.Name;
00675                 }
00676             }
00677             catch (Exception ex)
00678             {
00679                 txtExceptionReport.Text = ex.ToString();
00680                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00681             }
00682         }
00683
00684         private void BtnGetAnchorElement_Click(object sender, RoutedEventArgs e)
00685         {
00686             try
00687             {
00688                 string asyncEventMessage = "AnchorElement=";
00689
00690                 if (anchorElement == null)
00691                 {
00692                     cmbAnchorElement.SelectedIndex = 0;
00693                     asyncEventMessage += "null";
00694                 }
00695                 else if (anchorElement == scrollPresenter)
00696                 {
00697                     cmbAnchorElement.SelectedIndex = 1;
00698                     asyncEventMessage += "scrollPresenter";
00699                 }
00700                 else if (anchorElement == tblCollapsedAnchorElement)
00701                 {
00702                     cmbAnchorElement.SelectedIndex = 2;
00703                     asyncEventMessage += "collapsed";
00704                 }
00705                 else if (anchorElement == border)
00706                 {
00707                     cmbAnchorElement.SelectedIndex = 3;
00708                     asyncEventMessage += "border";
00709                 }
00710                 else
00711                 {
00712                     cmbAnchorElement.SelectedIndex = 4;
00713                     asyncEventMessage += "item";
00714                 }
00715                 AppendAsyncEventMessage(asyncEventMessage);
00716             }
00717             catch (Exception ex)
00718             {
00719                 txtExceptionReport.Text = ex.ToString();
00720                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00721             }
00722         }
00723
00724         private void BtnSetAnchorElement_Click(object sender, RoutedEventArgs e)
00725         {
00726             try
00727             {
00728                 switch (cmbAnchorElement.SelectedIndex)
00729                 {
00730                     case 0:
00731                         anchorElement = null;
00732                         break;
00733                     case 1:
00734                         anchorElement = scrollPresenter;
00735                         break;
00736                     case 2:
00737                         anchorElement = tblCollapsedAnchorElement;
00738                         break;
00739                     case 3:
00740                         anchorElement = border;
00741                         break;
00742                     case 4:
00743                         anchorElement = stackPanel.Children[int.Parse(txtItemIndex.Text)];
00744                         break;
00745                 }
00746
00747                 scrollPresenter.InvalidateArrange();
00748             }
00749             catch (Exception ex)
00750             {
00751                 txtExceptionReport.Text = ex.ToString();
00752                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00753             }
00754         }
00755
00756         private void CmbAnchorElement_SelectionChanged(object sender, SelectionChangedEventArgs e)
00757         {
00758             if (tblItemIndex != null && txtItemIndex != null && cmbAnchorElement != null)
00759                 tblItemIndex.Visibility = txtItemIndex.Visibility = cmbAnchorElement.SelectedIndex == 4 ? Visibility.Visible : Visibility.Collapsed;
00760         }
00761
00762         private void UpdateHorizontalAnchorRatio()
00763         {
00764             txtHorizontalAnchorRatio.Text = scrollPresenter.HorizontalAnchorRatio.ToString();
00765         }
00766
00767         private void UpdateVerticalAnchorRatio()
00768         {
00769             txtVerticalAnchorRatio.Text = scrollPresenter.VerticalAnchorRatio.ToString();
00770         }
00771
00772         private void BtnInvalidateArrange_Click(object sender, RoutedEventArgs e)
00773         {
00774             scrollPresenter.InvalidateArrange();
00775         }
00776
00777         private void BtnScrollTo_Click(object sender, RoutedEventArgs e)
00778         {
00779             try
00780             {
00781                 txtStockOffsetsChangeDuration.Text = string.Empty;
00782
00783                 int viewChangeCorrelationId = scrollPresenter.ScrollTo(
00784                     chkHorizontalOrientation.IsChecked == true ? Convert.ToDouble(txtCOAO.Text) : 0,
00785                     chkHorizontalOrientation.IsChecked == true ? 0 : Convert.ToDouble(txtCOAO.Text),
00786                     new ScrollingScrollOptions(ScrollingAnimationMode.Auto, ScrollingSnapPointsMode.Ignore));
00787                 AppendAsyncEventMessage("Invoked ScrollTo Id=" + viewChangeCorrelationId);
00788             }
00789             catch (Exception ex)
00790             {
00791                 txtExceptionReport.Text = ex.ToString();
00792                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00793             }
00794         }
00795
00796         private void ScrollPresenter_ScrollAnimationStarting(ScrollPresenter sender, ScrollingScrollAnimationStartingEventArgs args)
00797         {
00798             try
00799             {
00800                 AppendAsyncEventMessage("ScrollAnimationStarting OffsetsChangeCorrelationId=" + args.CorrelationId);
00801
00802                 Vector3KeyFrameAnimation stockKeyFrameAnimation = args.Animation as Vector3KeyFrameAnimation;
00803
00804                 if (stockKeyFrameAnimation != null && !string.IsNullOrWhiteSpace(txtOverriddenOffsetsChangeDuration.Text))
00805                 {
00806                     txtStockOffsetsChangeDuration.Text = stockKeyFrameAnimation.Duration.TotalMilliseconds.ToString();
00807                     double durationOverride = Convert.ToDouble(txtOverriddenOffsetsChangeDuration.Text);
00808                     stockKeyFrameAnimation.Duration = TimeSpan.FromMilliseconds(durationOverride);
00809                 }
00810             }
00811             catch (Exception ex)
00812             {
00813                 txtExceptionReport.Text = ex.ToString();
00814                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00815             }
00816         }
00817
00818         private void BtnAddScrollVelocity_Click(object sender, RoutedEventArgs e)
00819         {
00820             try
00821             {
00822                 Vector2? inertiaDecayRate = null;
00823
00824                 if (txtCOWAVAIDR.Text != "null")
00825                 {
00826                     inertiaDecayRate = new Vector2(
00827                         chkHorizontalOrientation.IsChecked == true ? Convert.ToSingle(txtCOWAVAIDR.Text) : 0,
00828                         chkHorizontalOrientation.IsChecked == true ? 0 : Convert.ToSingle(txtCOWAVAIDR.Text));
00829                 }
00830
00831                 txtStockOffsetsChangeDuration.Text = string.Empty;
00832
00833                 int viewChangeCorrelationId = scrollPresenter.AddScrollVelocity(
00834                     new Vector2(
00835                         chkHorizontalOrientation.IsChecked == true ? Convert.ToSingle(txtCOWAVAV.Text) : 0,
00836                         chkHorizontalOrientation.IsChecked == true ? 0 : Convert.ToSingle(txtCOWAVAV.Text)),
00837                     inertiaDecayRate);
00838                 AppendAsyncEventMessage("Invoked AddScrollVelocity Id=" + viewChangeCorrelationId);
00839             }
00840             catch (Exception ex)
00841             {
00842                 txtExceptionReport.Text = ex.ToString();
00843                 lstScrollPresenterEvents.Items.Add(ex.ToString());
00844             }
00845         }
00846
00847         private void BtnClearScrollPresenterEvents_Click(object sender, RoutedEventArgs e)
00848         {
00849             lstScrollPresenterEvents.Items.Clear();
00850         }
00851
00852         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00853         {
00854             txtExceptionReport.Text = string.Empty;
00855         }
00856
00857         private void ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e)
00858         {
00859             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00860             MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00861         }
00862
00863         private void ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e)
00864         {
00865             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00866             MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00867         }
00868
00869         private void UpdateRaiseAnchorNotifications(bool raiseAnchorNotifications)
00870         {
00871             if (raiseAnchorNotifications)
00872             {
00873                 if (!ScrollPresenterTestHooks.AreAnchorNotificationsRaised)
00874                 {
00875                     ScrollPresenterTestHooks.AreAnchorNotificationsRaised = true;
00876                     ScrollPresenterTestHooks.AnchorEvaluated += ScrollPresenterTestHooks_AnchorEvaluated;
00877                 }
00878             }
00879             else
00880             {
00881                 if (ScrollPresenterTestHooks.AreAnchorNotificationsRaised)
00882                 {
00883                     ScrollPresenterTestHooks.AreAnchorNotificationsRaised = false;
00884                     ScrollPresenterTestHooks.AnchorEvaluated -= ScrollPresenterTestHooks_AnchorEvaluated;
00885                 }
00886
00887                 if (currentAnchor != null)
00888                 {
00889                     currentAnchor.BorderBrush = new SolidColorBrush(Microsoft.UI.Colors.Chartreuse);
00890                     currentAnchor = null;
00891                 }
00892                 cnsAnchorPoint.Visibility = Visibility.Collapsed;
00893             }
00894         }
00895
00896         private void ChkHorizontalOrientation_Checked(object sender, RoutedEventArgs e)
00897         {
00898             stackPanel.Orientation = Orientation.Horizontal;
00899             scrollPresenter.ContentOrientation = ScrollingContentOrientation.Horizontal;
00900             scrollPresenter.Width = 600;
00901             scrollPresenter.Height = 300;
00902             cnsAnchorPoint.Width = 600;
00903             cnsAnchorPoint.Height = 300;
00904             Grid.SetRow(scrollPresenter, 0);
00905             Grid.SetColumnSpan(scrollPresenter, 4);
00906             Grid.SetRow(cnsAnchorPoint, 0);
00907             Grid.SetColumnSpan(cnsAnchorPoint, 4);
00908
00909             foreach (Border border in stackPanel.Children)
00910             {
00911                 border.Width = 120;
00912                 border.Height = 170;
00913             }
00914         }
00915
00916         private void ChkHorizontalOrientation_Unchecked(object sender, RoutedEventArgs e)
00917         {
00918             stackPanel.Orientation = Orientation.Vertical;
00919             scrollPresenter.ContentOrientation = ScrollingContentOrientation.Vertical;
00920             scrollPresenter.Width = 300;
00921             scrollPresenter.Height = 600;
00922             cnsAnchorPoint.Width = 300;
00923             cnsAnchorPoint.Height = 600;
00924             Grid.SetRow(scrollPresenter, 1);
00925             Grid.SetColumnSpan(scrollPresenter, 1);
00926             Grid.SetRow(cnsAnchorPoint, 1);
00927             Grid.SetColumnSpan(cnsAnchorPoint, 1);
00928
00929             foreach (Border border in stackPanel.Children)
00930             {
00931                 border.Width = 170;
00932                 border.Height = 120;
00933             }
00934         }
00935
00936         private void ChkLogScrollPresenterEvents_Checked(object sender, RoutedEventArgs e)
00937         {
00938             scrollPresenter.ExtentChanged += ScrollPresenter_ExtentChanged;
00939             scrollPresenter.StateChanged += ScrollPresenter_StateChanged;
00940         }
00941
00942         private void ChkLogScrollPresenterEvents_Unchecked(object sender, RoutedEventArgs e)
00943         {
00944             scrollPresenter.ExtentChanged -= ScrollPresenter_ExtentChanged;
00945             scrollPresenter.StateChanged -= ScrollPresenter_StateChanged;
00946         }
00947
00948         private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
00949         {
00950             // Cut off the terminating new line.
00951             string msg = args.Message.Substring(0, args.Message.Length - 1);
00952             string asyncEventMessage = string.Empty;
00953             string senderName = string.Empty;
00954
00955             try
00956             {
00957                 FrameworkElement fe = sender as FrameworkElement;
00958
00959                 if (fe != null)
00960                 {
00961                     senderName = "s:" + fe.Name + ", ";
00962                 }
00963             }
00964             catch
00965             {
00966             }
00967
00968             if (args.IsVerboseLevel)
00969             {
00970                 asyncEventMessage = "Verbose: " + senderName + "m:" + msg;
00971             }
00972             else
00973             {
00974                 asyncEventMessage = "Info: " + senderName + "m:" + msg;
00975             }
00976
00977             AppendAsyncEventMessage(asyncEventMessage);
00978         }
00979
00980         private void ScrollPresenterTestHooks_AnchorEvaluated(ScrollPresenter sender, ScrollPresenterTestHooksAnchorEvaluatedEventArgs args)
00981         {
00982             string anchorName;
00983             Border newAnchor = null;
00984
00985             if (args.AnchorElement == null)
00986             {
00987                 anchorName = "null";
00988             }
00989             else
00990             {
00991                 if (args.AnchorElement is FrameworkElement)
00992                 {
00993                     FrameworkElement anchorElementAsFE = args.AnchorElement as FrameworkElement;
00994
00995                     if (string.IsNullOrWhiteSpace(anchorElementAsFE.Name))
00996                         anchorName = "unnamed-FE";
00997                     else
00998                         anchorName = anchorElementAsFE.Name;
00999
01000                     newAnchor = anchorElementAsFE as Border;
01001                 }
01002                 else
01003                 {
01004                     anchorName = "UIE";
01005                 }
01006             }
01007
01008             if (newAnchor != currentAnchor)
01009             {
01010                 if (currentAnchor != null)
01011                 {
01012                     currentAnchor.BorderBrush = chartreuseBrush;
01013                 }
01014                 if (newAnchor != null)
01015                 {
01016                     newAnchor.BorderBrush = orangeBrush;
01017                 }
01018                 currentAnchor = newAnchor;
01019             }
01020
01021             if (double.IsNaN(args.ViewportAnchorPointHorizontalOffset) && double.IsNaN(args.ViewportAnchorPointVerticalOffset))
01022             {
01023                 cnsAnchorPoint.Visibility = Visibility.Collapsed;
01024             }
01025             else
01026             {
01027                 cnsAnchorPoint.Visibility = Visibility.Visible;
01028
01029                 if (double.IsNaN(args.ViewportAnchorPointHorizontalOffset))
01030                 {
01031                     rectAnchorPoint.Width = scrollPresenter.Width;
01032                     Canvas.SetLeft(rectAnchorPoint, 0);
01033                 }
01034                 else
01035                 {
01036                     rectAnchorPoint.Width = double.IsNaN(args.ViewportAnchorPointVerticalOffset) ? 2 : 4;
01037                     Canvas.SetLeft(rectAnchorPoint, args.ViewportAnchorPointHorizontalOffset * scrollPresenter.ZoomFactor - scrollPresenter.HorizontalOffset - rectAnchorPoint.Width / 2);
01038                 }
01039
01040                 if (double.IsNaN(args.ViewportAnchorPointVerticalOffset))
01041                 {
01042                     rectAnchorPoint.Height = scrollPresenter.Height;
01043                     Canvas.SetTop(rectAnchorPoint, 0);
01044                 }
01045                 else
01046                 {
01047                     rectAnchorPoint.Height = double.IsNaN(args.ViewportAnchorPointHorizontalOffset) ? 2 : 4;
01048                     Canvas.SetTop(rectAnchorPoint, args.ViewportAnchorPointVerticalOffset * scrollPresenter.ZoomFactor - scrollPresenter.VerticalOffset - rectAnchorPoint.Height / 2);
01049                 }
01050             }
01051
01052             if (chkLogScrollPresenterAnchorNotifications.IsChecked == true)
01053             {
01054                 AppendAsyncEventMessage("  AnchorEvaluated: s:" + sender.Name + ", a:" + anchorName + ", ap:(" + (int)args.ViewportAnchorPointHorizontalOffset + ", " + (int)args.ViewportAnchorPointVerticalOffset + ")");
01055             }
01056         }
01057
01058         private void AppendAsyncEventMessage(string asyncEventMessage)
01059         {
01060             lock (asyncEventReportingLock)
01061             {
01062                 lstAsyncEventMessage.Add(asyncEventMessage);
01063
01064                 var ignored = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, AppendAsyncEventMessage);
01065             }
01066         }
01067
01068         private void AppendAsyncEventMessage()
01069         {
01070             lock (asyncEventReportingLock)
01071             {
01072                 foreach (string asyncEventMessage in lstAsyncEventMessage)
01073                 {
01074                     lstScrollPresenterEvents.Items.Add(asyncEventMessage);
01075                 }
01076                 lstAsyncEventMessage.Clear();
01077             }
01078         }
01079
01080         private enum QueuedOperationType
01081         {
01082             Insert,
01083             Remove,
01084             Replace,
01085             Shrink,
01086             Expand,
01087         }
01088
01089         private class QueuedOperation
01090         {
01091             public QueuedOperation(QueuedOperationType type, int oldIndex, int oldCount, int newIndex, int newCount)
01092             {
01093                 this.Type = type;
01094                 this.OldIndex = oldIndex;
01095                 this.OldCount = oldCount;
01096                 this.NewIndex = newIndex;
01097                 this.NewCount = newCount;
01098             }
01099
01100             public QueuedOperationType Type { get; set; }
01101             public int OldIndex { get; set; }
01102             public int NewIndex { get; set; }
01103             public int OldCount { get; set; }
01104             public int NewCount { get; set; }
01105         }
01106     }
01107 }
Generated on Sun Dec 1 2024 20:52:16 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/CommonStylesPage.xaml.cs Source File

  • CommonStyles
  • TestUI

CommonStylesPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.Generic;
00005 using System.Collections.ObjectModel;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Controls;
00008 using Microsoft.UI.Xaml.Media;
00009 using System.Linq;
00010 using Common;
00011 using MUXControlsTestApp.Utilities;
00012 using Windows.UI;
00013
00014 namespace MUXControlsTestApp
00015 {
00016     class SimpleVerify
00017     {
00018         private List<string> _errors = new List<string>();
00019
00020         public void IsTrue(bool condition, string message)
00021         {
00022             if (!condition)
00023             {
00024                 _errors.Add(message);
00025             }
00026         }
00027         public void IsEqual(object actualValue, object expectValue, string message)
00028         {
00029             if (expectValue != actualValue && !expectValue.Equals(actualValue))
00030             {
00031                 _errors.Add(message + " - expect " + expectValue.ToString() + " but it's " + actualValue.ToString());
00032             }
00033         }
00034
00035         public override string ToString()
00036         {
00037             if (_errors.Count == 0)
00038             {
00039                 return "Pass";
00040             }
00041             return "Fail: " + string.Join(";", _errors);
00042         }
00043     }
00044
00045     [TopLevelTestPage(Name = "CommonStyles")]
00046     public sealed partial class CommonStylesPage : TestPage
00047     {
00048         ObservableCollection<FontFamily> fonts = new ObservableCollection<FontFamily>();
00049
00050         private string[] miscellaneousGridViewSource =
00051         {
00052             "GridView Item #1",
00053         };
00054
00055         public CommonStylesPage()
00056         {
00057             this.InitializeComponent();
00058             fonts.Add(new FontFamily("Arial"));
00059             fonts.Add(new FontFamily("Courier New"));
00060             fonts.Add(new FontFamily("Times New Roman"));
00061         }
00062
00063         private void NavigateToNewPageButton_Click(object sender, RoutedEventArgs e)
00064         {
00065             Frame.NavigateWithoutAnimation(typeof(GridViewPage), 0);
00066         }
00067
00068         private void SliderDensityTest_Click(object sender, RoutedEventArgs e)
00069         {
00070             string expectSliderPreContentMargin = "14";
00071             string expectSliderPostContentMargin = "14";
00072             string expectSliderHorizontalHeight = "32";
00073             string expectSliderVerticalWidth = "32";
00074
00075             SimpleVerify simpleVerify = new SimpleVerify();
00076             // Horizontal Slider
00077             var root = (FrameworkElement)VisualTreeHelper.GetChild(Slider1, 0);
00078             var grid = (Grid)root.FindName("HorizontalTemplate");
00079             simpleVerify.IsTrue(grid != null, "HorizontalTemplate can't be found");
00080             if (grid != null)
00081             {
00082                 simpleVerify.IsEqual(grid.MinHeight.ToString(), expectSliderHorizontalHeight, "HorizontalTemplate|MinHeight=SliderHorizontalHeight");
00083                 var rowDefinitions = grid.RowDefinitions;
00084                 if (rowDefinitions.Count == 3)
00085                 {
00086                     simpleVerify.IsEqual(rowDefinitions[0].Height.ToString(), expectSliderPreContentMargin, "HorizontalTemplate.RowDefinitions[0].Height=SliderPreContentMargin");
00087                     simpleVerify.IsEqual(rowDefinitions[2].Height.ToString(), expectSliderPostContentMargin, "HorizontalTemplate.RowDefinitions[2].Height=SliderPostContentMargin");
00088                 }
00089             }
00090
00091             // Vertical Slider
00092             root = (FrameworkElement)VisualTreeHelper.GetChild(Slider2, 0);
00093             grid = (Grid)root.FindName("VerticalTemplate");
00094             simpleVerify.IsTrue(grid != null, "VerticalTemplate can't be found");
00095             if (grid != null)
00096             {
00097                 simpleVerify.IsEqual(grid.MinWidth.ToString(), expectSliderVerticalWidth, "VerticalTemplate|MinWidth=SliderVerticalWidth");
00098                 var columnDefinitions = grid.ColumnDefinitions;
00099                 if (columnDefinitions.Count == 3)
00100                 {
00101                     simpleVerify.IsEqual(columnDefinitions[0].Width.ToString(), expectSliderPreContentMargin, "VerticalTemplate.columnDefinitions[0].Width=SliderPreContentMargin");
00102                     simpleVerify.IsEqual(columnDefinitions[2].Width.ToString(), expectSliderPostContentMargin, "VerticalTemplate.columnDefinitions[2].Width=SliderPostContentMargin");
00103                 }
00104             }
00105             DensityTestResult.Text = simpleVerify.ToString();
00106         }
00107
00108         private void RichEditBoxDensityTest_Click(object sender, RoutedEventArgs e)
00109         {
00110             HeaderContentPresenterMarginTest(RichEditBox);
00111         }
00112
00113         private void TextBoxDensityTest_Click(object sender, RoutedEventArgs e)
00114         {
00115             HeaderContentPresenterMarginTest(TextBox);
00116         }
00117
00118         private void PasswordBoxDensityTest_Click(object sender, RoutedEventArgs e)
00119         {
00120             HeaderContentPresenterMarginTest(PasswordBox);
00121         }
00122
00123         private void ComboBoxDensityTest_Click(object sender, RoutedEventArgs e)
00124         {
00125             HeaderContentPresenterMarginTest(ComboBox);
00126         }
00127
00128         private void ToggleSwitchDensityTest_Click(object sender, RoutedEventArgs e)
00129         {
00130             SimpleVerify simpleVerify = new SimpleVerify();
00131             var root = (FrameworkElement)VisualTreeHelper.GetChild(ToggleSwitch, 0);
00132             var contentPresenter = (ContentPresenter)root.FindName("HeaderContentPresenter");
00133             simpleVerify.IsTrue(contentPresenter != null, "HeaderContentPresenter can't be found");
00134
00135             string expectedHeaderMargin = "0,0,0,4";
00136             string expectToggleSwitchPreContentMargin = "10";
00137             string expectToggleSwitchPostContentMargin = "10";
00138
00139             if (contentPresenter != null)
00140             {
00141                 simpleVerify.IsEqual(contentPresenter.Margin.ToString(), expectedHeaderMargin, "HeaderContentPresenter.Margin");
00142             }
00143
00144             var grid = (Grid)root;
00145             if (grid != null)
00146             {
00147                 var rowDefinitions = grid.RowDefinitions;
00148
00149                 // layout has been changed since RS5 and it's not 4 rows anymore. We expect RS5  will be covered by UIElement tree test case in os repo.
00150                 if (rowDefinitions.Count == 4)
00151                 {
00152                     simpleVerify.IsEqual(rowDefinitions[1].Height.ToString(), expectToggleSwitchPreContentMargin, "rowDefinitions[1].Height");
00153                     simpleVerify.IsEqual(rowDefinitions[3].Height.ToString(), expectToggleSwitchPostContentMargin, "rowDefinitions[3].Height");
00154                 }
00155             }
00156             DensityTestResult.Text = simpleVerify.ToString();
00157         }
00158         private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
00159         {
00160             if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
00161             {
00162                 var suggestList = new List<string>();
00163                 suggestList.Add("001");
00164                 suggestList.Add("002");
00165                 suggestList.Add("003");
00166                 suggestList.Add("004");
00167                 suggestList.Add("005");
00168                 sender.ItemsSource = suggestList.Select(text => sender.Text + text);
00169             }
00170         }
00171
00172         private void DatePickerDensityTest_Click(object sender, RoutedEventArgs e)
00173         {
00174             SimpleVerify simpleVerify = new SimpleVerify();
00175             var root = (FrameworkElement)VisualTreeHelper.GetChild(DatePicker, 0);
00176             var contentPresenter = (ContentPresenter)root.FindName("HeaderContentPresenter");
00177             simpleVerify.IsTrue(contentPresenter != null, "HeaderContentPresenter can't be found");
00178
00179             string expectedHeaderMargin = "0,0,0,4";
00180             string expectDatePickerFlyoutPresenterItemPadding = "0,3,0,6";
00181             string expectDatePickerFlyoutPresenterMonthPadding = "9,3,0,6";
00182
00183             if (contentPresenter != null)
00184             {
00185                 simpleVerify.IsEqual(contentPresenter.Margin.ToString(), expectedHeaderMargin, "HeaderContentPresenter.Margin");
00186             }
00187
00188             // Down-level need to change code, so RS5 have different ItemPadding, see bug 19373347, but we will not fix it
00189             if (!PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4))
00190             {
00191                 var textBlock = (TextBlock)root.FindName("DayTextBlock");
00192                 simpleVerify.IsEqual(textBlock.Padding.ToString(), expectDatePickerFlyoutPresenterItemPadding, "DayTextBlock.Padding");
00193
00194                 textBlock = (TextBlock)root.FindName("MonthTextBlock");
00195                 simpleVerify.IsEqual(textBlock.Padding.ToString(), expectDatePickerFlyoutPresenterMonthPadding, "MonthTextBlock.Padding");
00196
00197                 textBlock = (TextBlock)root.FindName("YearTextBlock");
00198                 simpleVerify.IsEqual(textBlock.Padding.ToString(), expectDatePickerFlyoutPresenterItemPadding, "YearTextBlock.Padding");
00199             }
00200             DensityTestResult.Text = simpleVerify.ToString();
00201         }
00202
00203         private void TimePickerDensityTest_Click(object sender, RoutedEventArgs e)
00204         {
00205             SimpleVerify simpleVerify = new SimpleVerify();
00206             var root = (FrameworkElement)VisualTreeHelper.GetChild(TimePicker, 0);
00207             var contentPresenter = (ContentPresenter)root.FindName("HeaderContentPresenter");
00208             simpleVerify.IsTrue(contentPresenter != null, "HeaderContentPresenter can't be found");
00209
00210             string expectedHeaderMargin = "0,0,0,4";
00211             string expectTimePickerFlyoutPresenterItemPadding = "0,3,0,6";
00212
00213             if (contentPresenter != null)
00214             {
00215                 simpleVerify.IsEqual(contentPresenter.Margin.ToString(), expectedHeaderMargin, "HeaderContentPresenter.Margin");
00216             }
00217
00218             // Down-level need to change code, so RS5 have different ItemPadding, see bug 19373347, but we will not fix it
00219             if (!PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4))
00220             {
00221                 var textBlock = (TextBlock)root.FindName("HourTextBlock");
00222                 simpleVerify.IsEqual(textBlock.Padding.ToString(), expectTimePickerFlyoutPresenterItemPadding, "HourTextBlock.Padding");
00223
00224                 textBlock = (TextBlock)root.FindName("MinuteTextBlock");
00225                 simpleVerify.IsEqual(textBlock.Padding.ToString(), expectTimePickerFlyoutPresenterItemPadding, "MinuteTextBlock.Padding");
00226
00227                 textBlock = (TextBlock)root.FindName("PeriodTextBlock");
00228                 simpleVerify.IsEqual(textBlock.Padding.ToString(), expectTimePickerFlyoutPresenterItemPadding, "PeriodTextBlock.Padding");
00229             }
00230             DensityTestResult.Text = simpleVerify.ToString();
00231         }
00232
00233         private void ListViewItemDensityTest_Click(object sender, RoutedEventArgs e)
00234         {
00235             var item = ListView1.FindVisualChildByType<ListViewItem>();
00236             SimpleVerify simpleVerify = new SimpleVerify();
00237             if (item != null)
00238             {
00239                 simpleVerify.IsEqual(item.MinHeight.ToString(), "40", "ListViewItem minHeight is 40");
00240             }
00241             else
00242             {
00243                 simpleVerify.IsTrue(false, "Can't find ListViewItem");
00244             }
00245             DensityTestResult.Text = simpleVerify.ToString();
00246         }
00247
00248         private void AutoSuggestBoxDensityTest_Click(object sender, RoutedEventArgs e)
00249         {
00250             // AutoSuggestBox Density is actually implemented in AutoSuggestBoxTextBoxStyle, so we need to get textbox first
00251             var root = (FrameworkElement)VisualTreeHelper.GetChild(AutoSuggestBox, 0);
00252             var textBox = (TextBox)root.FindName("TextBox");
00253             HeaderContentPresenterMarginTest(textBox);
00254         }
00255
00256         private void HeaderContentPresenterMarginTest(DependencyObject control)
00257         {
00258             SimpleVerify simpleVerify = new SimpleVerify();
00259             var root = (FrameworkElement)VisualTreeHelper.GetChild(control, 0);
00260             var contentPresenter = (ContentPresenter)root.FindName("HeaderContentPresenter");
00261             simpleVerify.IsTrue(contentPresenter != null, "HeaderContentPresenter can't be found");
00262
00263             string expectedHeaderMargin = "0,0,0,8";
00264             if (contentPresenter != null)
00265             {
00266                 simpleVerify.IsEqual(contentPresenter.Margin.ToString(), expectedHeaderMargin, "HeaderContentPresenter.Margin");
00267             }
00268
00269             DensityTestResult.Text = simpleVerify.ToString();
00270         }
00271         private void VerifyHeight(FrameworkElement[] frameworkElements, SimpleVerify simpleVerify, int height)
00272         {
00273             var expectedHeight = height.ToString();
00274             foreach (var element in frameworkElements)
00275             {
00276                 simpleVerify.IsEqual(element.ActualHeight.ToString(), expectedHeight, element.Name.ToString() + ".ActualHeight");
00277             }
00278         }
00279
00280         private void AppBarButtonDensityTest_Click(object sender, RoutedEventArgs e)
00281         {
00282             SimpleVerify simpleVerify = new SimpleVerify();
00283             FrameworkElement[] iconCollapsedElements = { AppBarButton1, AppBarButton3 };
00284             VerifyHeight(iconCollapsedElements, simpleVerify, 48);
00285
00286             DensityTestResult.Text = simpleVerify.ToString();
00287         }
00288
00289         private void AppBarToggleButtonDensityTest_Click(object sender, RoutedEventArgs e)
00290         {
00291             SimpleVerify simpleVerify = new SimpleVerify();
00292             FrameworkElement[] iconCollapsedElements = { AppBarToggleButton1, AppBarToggleButton3 };
00293             VerifyHeight(iconCollapsedElements, simpleVerify, 48);
00294
00295             DensityTestResult.Text = simpleVerify.ToString();
00296         }
00297
00298         private void BlueBackground_Click(object sender, RoutedEventArgs e)
00299         {
00300             RootSampleControlsPanel.Background = new SolidColorBrush(Color.FromArgb(255,0, 173, 239));
00301         }
00302
00303         private void StandardBackground_Click(object sender, RoutedEventArgs e)
00304         {
00305             RootSampleControlsPanel.Background = new SolidColorBrush(Microsoft.UI.Colors.Transparent);
00306         }
00307
00308         private void CmbListViewSelectionMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
00309         {
00310             if (listView1 != null)
00311             {
00312                 listView1.SelectionMode = (ListViewSelectionMode)(sender as ComboBox).SelectedIndex;
00313             }
00314         }
00315
00316         private void CmbGridViewSelectionMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
00317         {
00318             if (gridView1 != null)
00319             {
00320                 gridView1.SelectionMode = (ListViewSelectionMode)(sender as ComboBox).SelectedIndex;
00321             }
00322         }
00323
00324         private void ChkListViewIsEnabled_Checked(object sender, RoutedEventArgs e)
00325         {
00326             if (listView1 != null)
00327             {
00328                 listView1.IsEnabled = true;
00329             }
00330         }
00331
00332         private void ChkListViewIsEnabled_Unchecked(object sender, RoutedEventArgs e)
00333         {
00334             if (listView1 != null)
00335             {
00336                 listView1.IsEnabled = false;
00337             }
00338         }
00339
00340         private void ChkGridViewIsEnabled_Checked(object sender, RoutedEventArgs e)
00341         {
00342             if (gridView1 != null)
00343             {
00344                 gridView1.IsEnabled = true;
00345             }
00346         }
00347
00348         private void ChkGridViewIsEnabled_Unchecked(object sender, RoutedEventArgs e)
00349         {
00350             if (gridView1 != null)
00351             {
00352                 gridView1.IsEnabled = false;
00353             }
00354         }
00355     }
00356 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TwoPaneView/DisplayRegionHelperTestApiFactory.cpp Source File

  • TwoPaneView

DisplayRegionHelperTestApiFactory.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "DisplayRegionHelper.h"
00007 #include "DisplayRegionHelperTestApiFactory.h"
00008
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

GrayscaleEffect Member List

This is the complete list of members for GrayscaleEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1Grayscale) | GrayscaleEffect
DECLARE_SINGLE_SOURCE(Source) | GrayscaleEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IScrollControllerAdapter Member List

This is the complete list of members for IScrollControllerAdapter, including all inherited members.
_scrollController | IScrollControllerAdapter | [private]
_scrollController_AddScrollVelocityRequested(IScrollController sender, ScrollControllerAddScrollVelocityRequestedEventArgs args) | IScrollControllerAdapter | [inline, private]
_scrollController_ScrollByRequested(IScrollController sender, ScrollControllerScrollByRequestedEventArgs args) | IScrollControllerAdapter | [inline, private]
_scrollController_ScrollToRequested(IScrollController sender, ScrollControllerScrollToRequestedEventArgs args) | IScrollControllerAdapter | [inline, private]
_scrollViewer | IScrollControllerAdapter | [private]
IScrollControllerAdapter(ScrollViewer sv, IScrollController scrollController) | IScrollControllerAdapter | [inline]
pageScrollViewer_SizeChanged(object sender, object e) | IScrollControllerAdapter | [inline, private]
pageScrollViewer_ViewChanged(object sender, object e) | IScrollControllerAdapter | [inline, private]
s_velocityNeededPerPixel | IScrollControllerAdapter | [private, static]
SetUpBridge() | IScrollControllerAdapter | [inline, private]
Generated on Sun Dec 1 2024 20:54:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Collections/BindableVector.h Source File

  • Collections

BindableVector.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "Vector.h"
00006
00007 template<int flags = MakeVectorParam<VectorFlag::Bindable, VectorFlag::Observable, VectorFlag::DependencyObjectBase>(),
00008     typename Helper = VectorFlagHelper<flags>>
00009 class BindableVector :
00010     public VectorBase<winrt::IInspectable, Helper::isObservable, true, Helper::isDependencyObjectBase, Helper::isNoTrackerRef>
00011 {
00012 };
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NumberBoxPage Member List

This is the complete list of members for NumberBoxPage, including all inherited members.
CustomFormatterButton_Click(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
DataModelWithINPC | NumberBoxPage |
InputScope_Changed(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
MaxCheckBox_CheckChanged(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
MaxValueChanged(object sender, object e) | NumberBoxPage | [inline, private]
MinCheckBox_CheckChanged(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
MinValueChanged(object sender, object e) | NumberBoxPage | [inline, private]
NumberBoxPage() | NumberBoxPage | [inline]
NumberBoxValueChanged(object sender, NumberBoxValueChangedEventArgs e) | NumberBoxPage | [inline, private]
ScrollviewerWithScroll_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e) | NumberBoxPage | [inline, private]
SetNaNButton_Click(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
SetTextButton_Click(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
SetTwoWayBoundNaNButton_Click(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
SetValueButton_Click(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
SpinMode_Changed(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
TextAlignment_Changed(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
TextPropertyChanged(DependencyObject o, DependencyProperty p) | NumberBoxPage | [inline, private]
ToggleHeaderTemplateValueButton_Click(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
ToggleHeaderValueButton_Click(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
Validation_Changed(object sender, RoutedEventArgs e) | NumberBoxPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedVisuals/AnimatedChevronUpDownSmallVisualSource.cpp Source File

  • AnimatedIcon
  • AnimatedVisuals

AnimatedChevronUpDownSmallVisualSource.cpp

Go to the documentation of this file.
00001 ﻿//------------------------------------------------------------------------------
00002 // <auto-generated>
00003 //     This code was generated by a tool.
00004 //
00005 //       LottieGen version:
00006 //           7.1.0+ge1fa92580f
00007 //
00008 //       Command:
00009 //           LottieGen -Language Cppwinrt -WinUIVersion 2.4 -InputFile AnimatedChevronUpDownSmallVisualSource.json
00010 //
00011 //       Input file:
00012 //           AnimatedChevronUpDownSmallVisualSource.json (24992 bytes created 23:37-07:00 Oct 5 2021)
00013 //
00014 //       LottieGen source:
00015 //           http://aka.ms/Lottie
00016 //
00017 //     Changes to this file may cause incorrect behavior and will be lost if
00018 //     the code is regenerated.
00019 // </auto-generated>
00020 //------------------------------------------------------------------------------
00021 // ____________________________________
00022 // |       Object stats       | Count |
00023 // |__________________________|_______|
00024 // | All CompositionObjects   |    39 |
00025 // |--------------------------+-------|
00026 // | Expression animators     |     3 |
00027 // | KeyFrame animators       |     2 |
00028 // | Reference parameters     |     3 |
00029 // | Expression operations    |     4 |
00030 // |--------------------------+-------|
00031 // | Animated brushes         |     1 |
00032 // | Animated gradient stops  |     - |
00033 // | ExpressionAnimations     |     2 |
00034 // | PathKeyFrameAnimations   |     - |
00035 // |--------------------------+-------|
00036 // | ContainerVisuals         |     2 |
00037 // | ShapeVisuals             |     1 |
00038 // |--------------------------+-------|
00039 // | ContainerShapes          |     - |
00040 // | CompositionSpriteShapes  |     1 |
00041 // |--------------------------+-------|
00042 // | Brushes                  |     1 |
00043 // | Gradient stops           |     - |
00044 // | CompositionVisualSurface |     - |
00045 // ------------------------------------
00046 #include "pch.h"
00047 #include "AnimatedVisuals\AnimatedChevronUpDownSmallVisualSource.h"
00048 #include <winrt/Windows.Foundation.Metadata.h>
00049 #include <winrt/Windows.Foundation.Collections.h>
00050 #include <winrt/Microsoft.UI.Composition.h>
00051 #include "d2d1.h"
00052 #include <d2d1_1.h>
00053 #include <d2d1helper.h>
00054 #include <Windows.Graphics.Interop.h>
00055 #include <Windows.Graphics.Effects.Interop.h>
00056 #include <winrt/Windows.Graphics.Effects.h>
00057
00058 using namespace winrt::Microsoft::UI::Xaml::Controls;
00059 using namespace winrt::Windows::Foundation;
00060 using namespace winrt::Windows::Foundation::Numerics;
00061 using namespace winrt::Windows::Graphics;
00062 using namespace winrt::Windows::UI;
00063 using namespace winrt::Microsoft::UI::Composition;
00064 using TimeSpan = winrt::Windows::Foundation::TimeSpan;
00065
00066 namespace winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals
00067 {
00068     CppWinRTActivatableClassWithBasicFactory(AnimatedChevronUpDownSmallVisualSource)
00069 }
00070 #include "AnimatedVisuals\AnimatedChevronUpDownSmallVisualSource.g.cpp"
00071
00072 class CanvasGeometry : public winrt::implements<CanvasGeometry,
00073     IGeometrySource2D,
00074     ::ABI::Windows::Graphics::IGeometrySource2DInterop>
00075 {
00076     winrt::com_ptr<ID2D1Geometry> _geometry{ nullptr };
00077
00078 public:
00079     CanvasGeometry(winrt::com_ptr<ID2D1Geometry> geometry)
00080         : _geometry{ geometry }
00081     { }
00082
00083     // IGeometrySource2D.
00084     winrt::com_ptr<ID2D1Geometry> Geometry() { return _geometry; }
00085
00086     // IGeometrySource2DInterop.
00087     IFACEMETHODIMP GetGeometry(ID2D1Geometry** value) override
00088     {
00089         _geometry.copy_to(value);
00090         return S_OK;
00091     }
00092
00093     // IGeometrySource2DInterop.
00094     IFACEMETHODIMP TryGetGeometryUsingFactory(ID2D1Factory*, ID2D1Geometry**) override
00095     {
00096         return E_NOTIMPL;
00097     }
00098 };
00099 class AnimatedChevronUpDownSmallVisualSource_AnimatedVisual : public winrt::implements<AnimatedChevronUpDownSmallVisualSource_AnimatedVisual,
00100         winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual,
00101         IClosable>
00102 {
00103     winrt::com_ptr<ID2D1Factory> _d2dFactory{ nullptr };
00104     static constexpr int64_t c_durationTicks{ 43333333L };
00105     Compositor const _c{ nullptr };
00106     ExpressionAnimation const _reusableExpressionAnimation{ nullptr };
00107     CompositionPropertySet const _themeProperties{ nullptr };
00108     ContainerVisual _root{ nullptr };
00109     CubicBezierEasingFunction _cubicBezierEasingFunction_0{ nullptr };
00110     CubicBezierEasingFunction _cubicBezierEasingFunction_1{ nullptr };
00111     CubicBezierEasingFunction _cubicBezierEasingFunction_2{ nullptr };
00112     CubicBezierEasingFunction _cubicBezierEasingFunction_3{ nullptr };
00113     ExpressionAnimation _rootProgress{ nullptr };
00114     StepEasingFunction _holdThenStepEasingFunction{ nullptr };
00115
00116     static void StartProgressBoundAnimation(
00117         CompositionObject target,
00118         winrt::hstring animatedPropertyName,
00119         CompositionAnimation animation,
00120         ExpressionAnimation controllerProgressExpression)
00121     {
00122         target.StartAnimation(animatedPropertyName, animation);
00123         const auto controller = target.TryGetAnimationController(animatedPropertyName);
00124         controller.Pause();
00125         controller.StartAnimation(L"Progress", controllerProgressExpression);
00126     }
00127
00128     void BindProperty(
00129         CompositionObject target,
00130         winrt::hstring animatedPropertyName,
00131         winrt::hstring expression,
00132         winrt::hstring referenceParameterName,
00133         CompositionObject referencedObject)
00134     {
00135         _reusableExpressionAnimation.ClearAllParameters();
00136         _reusableExpressionAnimation.Expression(expression);
00137         _reusableExpressionAnimation.SetReferenceParameter(referenceParameterName, referencedObject);
00138         target.StartAnimation(animatedPropertyName, _reusableExpressionAnimation);
00139     }
00140
00141     ScalarKeyFrameAnimation CreateScalarKeyFrameAnimation(float initialProgress, float initialValue, CompositionEasingFunction initialEasingFunction)
00142     {
00143         const auto result = _c.CreateScalarKeyFrameAnimation();
00144         result.Duration(TimeSpan{ c_durationTicks });
00145         result.InsertKeyFrame(initialProgress, initialValue, initialEasingFunction);
00146         return result;
00147     }
00148
00149     Vector2KeyFrameAnimation CreateVector2KeyFrameAnimation(float initialProgress, winrt::float2 initialValue, CompositionEasingFunction initialEasingFunction)
00150     {
00151         const auto result = _c.CreateVector2KeyFrameAnimation();
00152         result.Duration(TimeSpan{ c_durationTicks });
00153         result.InsertKeyFrame(initialProgress, initialValue, initialEasingFunction);
00154         return result;
00155     }
00156
00157     // - - - - PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff
00158     // Controls - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 -
00159     // Dropdown Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00160     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00161     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00162     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00163     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00164     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00165     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00166     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00167     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00168     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00169     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00170     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00171     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00172     // Dropdown Rotate - 18 - PressedOffToNormalOn
00173     // - - - Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2
00174     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00175     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00176     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00177     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00178     // - - ShapeGroup: Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00179     // Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00180     winrt::com_ptr<CanvasGeometry> Geometry()
00181     {
00182         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00183         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00184         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00185         winrt::check_hresult(path->Open(sink.put()));
00186         sink->BeginFigure({ -3.54299998F, -1.79299998F }, D2D1_FIGURE_BEGIN_FILLED);
00187         sink->AddLine({ 0.0199999996F, 1.70700002F });
00188         sink->AddLine({ 3.48900008F, -1.71500003F });
00189         sink->EndFigure(D2D1_FIGURE_END_OPEN);
00190         winrt::check_hresult(sink->Close());
00191         auto result = winrt::make_self<CanvasGeometry>(path);
00192         return result;
00193     }
00194
00195     // - - PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff
00196     // Controls - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 -
00197     // Dropdown Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00198     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00199     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00200     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00201     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00202     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00203     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00204     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00205     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00206     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00207     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00208     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00209     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00210     // Dropdown Rotate - 18 - PressedOffToNormalOn
00211     // - Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00212     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00213     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00214     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00215     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00216     // ShapeGroup: Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00217     // Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00218     // Color bound to theme property value: Foreground
00219     CompositionColorBrush ThemeColor_Foreground()
00220     {
00221         const auto result = _c.CreateColorBrush();
00222         BindProperty(result, L"Color", L"ColorRGB(_theme.Foreground.W,_theme.Foreground.X,_theme.Foreground.Y,_theme.Foreground.Z)", L"_theme", _themeProperties);
00223         return result;
00224     }
00225
00226     // - - PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff
00227     // Controls - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 -
00228     // Dropdown Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00229     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00230     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00231     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00232     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00233     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00234     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00235     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00236     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00237     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00238     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00239     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00240     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00241     // Dropdown Rotate - 18 - PressedOffToNormalOn
00242     // - Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00243     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00244     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00245     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00246     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00247     // ShapeGroup: Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00248     // Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00249     CompositionPathGeometry PathGeometry()
00250     {
00251         return _c.CreatePathGeometry(CompositionPath(CanvasGeometryToIGeometrySource2D(Geometry())));
00252     }
00253
00254     // - PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff
00255     // Controls - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 -
00256     // Dropdown Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00257     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00258     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00259     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00260     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00261     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00262     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00263     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00264     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00265     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00266     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00267     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00268     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00269     // Dropdown Rotate - 18 - PressedOffToNormalOn
00270     // Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00271     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00272     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00273     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00274     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00275     // Path 1 Path 1 Path 1 Path 1 Path 1 Path 1 Path 1 Path 1 Path 1 Path 1 Path 1 Path 1
00276     // Path 1 Path 1 Path 1 Path 1 Path 1 Path 1
00277     CompositionSpriteShape SpriteShape()
00278     {
00279         const auto result = _c.CreateSpriteShape(PathGeometry());
00280         result.Scale({ 4.0F, 4.0F });
00281         result.StrokeBrush(ThemeColor_Foreground());
00282         result.StrokeDashCap(CompositionStrokeCap::Round);
00283         result.StrokeStartCap(CompositionStrokeCap::Round);
00284         result.StrokeEndCap(CompositionStrokeCap::Round);
00285         result.StrokeLineJoin(CompositionStrokeLineJoin::Round);
00286         result.StrokeMiterLimit(2.0F);
00287         StartProgressBoundAnimation(result, L"RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_180_to_180(), RootProgress());
00288         StartProgressBoundAnimation(result, L"Offset", OffsetVector2Animation(), _rootProgress);
00289         return result;
00290     }
00291
00292     // Transforms for Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff Controls
00293     // - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 - Dropdown
00294     // Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00295     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00296     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00297     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00298     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00299     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00300     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00301     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00302     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00303     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00304     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00305     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00306     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00307     // Dropdown Rotate - 18 - PressedOffToNormalOn Scale(1,1,0)
00308     ContainerVisual ContainerVisual_0()
00309     {
00310         const auto result = _c.CreateContainerVisual();
00311         result.Clip(InsetClip_0());
00312         result.Size({ 48.0F, 48.0F });
00313         // Scale:<1, 1>
00314         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F });
00315         // Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00316         // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00317         // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00318         // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00319         // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00320         result.Children().InsertAtTop(ShapeVisual_0());
00321         return result;
00322     }
00323
00324     // The root of the composition.
00325     ContainerVisual Root()
00326     {
00327         const auto result = _root = _c.CreateContainerVisual();
00328         const auto propertySet = result.Properties();
00329         propertySet.InsertScalar(L"Progress", 0.0F);
00330         // PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff Controls
00331         // - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 - Dropdown
00332         // Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00333         // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00334         // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00335         // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00336         // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00337         // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00338         // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00339         // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00340         // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00341         // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00342         // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00343         // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00344         // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00345         // Dropdown Rotate - 18 - PressedOffToNormalOn
00346         result.Children().InsertAtTop(ContainerVisual_0());
00347         return result;
00348     }
00349
00350     CubicBezierEasingFunction CubicBezierEasingFunction_0()
00351     {
00352         return _cubicBezierEasingFunction_0 = _c.CreateCubicBezierEasingFunction({ 0.166999996F, 0.166999996F }, { 0.0F, 1.0F });
00353     }
00354
00355     CubicBezierEasingFunction CubicBezierEasingFunction_1()
00356     {
00357         return _cubicBezierEasingFunction_1 = _c.CreateCubicBezierEasingFunction({ 0.850000024F, 0.0F }, { 0.75F, 1.0F });
00358     }
00359
00360     CubicBezierEasingFunction CubicBezierEasingFunction_2()
00361     {
00362         return _cubicBezierEasingFunction_2 = _c.CreateCubicBezierEasingFunction({ 0.349999994F, 0.0F }, { 0.0F, 1.0F });
00363     }
00364
00365     CubicBezierEasingFunction CubicBezierEasingFunction_3()
00366     {
00367         return _cubicBezierEasingFunction_3 = _c.CreateCubicBezierEasingFunction({ 0.850000024F, 0.0F }, { 0.449999988F, 1.0F });
00368     }
00369
00370     ExpressionAnimation RootProgress()
00371     {
00372         const auto result = _rootProgress = _c.CreateExpressionAnimation(L"_.Progress");
00373         result.SetReferenceParameter(L"_", _root);
00374         return result;
00375     }
00376
00377     // PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff Controls
00378     // - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 - Dropdown
00379     // Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00380     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00381     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00382     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00383     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00384     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00385     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00386     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00387     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00388     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00389     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00390     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00391     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00392     // Dropdown Rotate - 18 - PressedOffToNormalOn
00393     InsetClip InsetClip_0()
00394     {
00395         const auto result = _c.CreateInsetClip();
00396         return result;
00397     }
00398
00399     // - - PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff
00400     // Controls - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 -
00401     // Dropdown Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00402     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00403     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00404     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00405     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00406     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00407     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00408     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00409     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00410     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00411     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00412     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00413     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00414     // Dropdown Rotate - 18 - PressedOffToNormalOn
00415     // - Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00416     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00417     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00418     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00419     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00420     // ShapeGroup: Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00421     // Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00422     // Rotation
00423     ScalarKeyFrameAnimation RotationAngleInDegreesScalarAnimation_180_to_180()
00424     {
00425         // Frame 0.
00426         const auto result = CreateScalarKeyFrameAnimation(0.0F, 180.0F, StepThenHoldEasingFunction());
00427         // Frame 15.
00428         result.InsertKeyFrame(0.057692308F, 180.0F, HoldThenStepEasingFunction());
00429         // Frame 25.
00430         result.InsertKeyFrame(0.0961538479F, 0.0F, CubicBezierEasingFunction_0());
00431         // Frame 30.
00432         result.InsertKeyFrame(0.115384616F, 180.0F, _holdThenStepEasingFunction);
00433         // Frame 40.
00434         result.InsertKeyFrame(0.15384616F, 180.0F, _holdThenStepEasingFunction);
00435         // Frame 50.
00436         result.InsertKeyFrame(0.192307696F, 0.0F, _holdThenStepEasingFunction);
00437         // Frame 65.
00438         result.InsertKeyFrame(0.25F, 0.0F, _holdThenStepEasingFunction);
00439         // Frame 75.
00440         result.InsertKeyFrame(0.288461536F, 180.0F, _cubicBezierEasingFunction_0);
00441         // Frame 80.
00442         result.InsertKeyFrame(0.307692319F, 0.0F, _holdThenStepEasingFunction);
00443         // Frame 90.
00444         result.InsertKeyFrame(0.346153855F, 0.0F, _holdThenStepEasingFunction);
00445         // Frame 100.
00446         result.InsertKeyFrame(0.384615391F, 180.0F, _holdThenStepEasingFunction);
00447         // Frame 109.
00448         result.InsertKeyFrame(0.419230759F, 0.0F, _cubicBezierEasingFunction_0);
00449         // Frame 110.
00450         result.InsertKeyFrame(0.423076928F, 180.0F, _holdThenStepEasingFunction);
00451         // Frame 120.
00452         result.InsertKeyFrame(0.461538464F, 180.0F, _holdThenStepEasingFunction);
00453         // Frame 130.
00454         result.InsertKeyFrame(0.5F, 0.0F, _holdThenStepEasingFunction);
00455         // Frame 139.
00456         result.InsertKeyFrame(0.534615397F, 180.0F, _cubicBezierEasingFunction_0);
00457         // Frame 140.
00458         result.InsertKeyFrame(0.538461566F, 0.0F, _holdThenStepEasingFunction);
00459         // Frame 150.
00460         result.InsertKeyFrame(0.576923072F, 0.0F, _holdThenStepEasingFunction);
00461         // Frame 160.
00462         result.InsertKeyFrame(0.615384638F, 180.0F, _holdThenStepEasingFunction);
00463         // Frame 169.
00464         result.InsertKeyFrame(0.649999976F, 0.0F, _cubicBezierEasingFunction_0);
00465         // Frame 170.
00466         result.InsertKeyFrame(0.653846145F, 180.0F, _holdThenStepEasingFunction);
00467         // Frame 175.
00468         result.InsertKeyFrame(0.673076928F, 180.0F, _holdThenStepEasingFunction);
00469         // Frame 185.
00470         result.InsertKeyFrame(0.711538434F, 0.0F, _cubicBezierEasingFunction_0);
00471         // Frame 190.
00472         result.InsertKeyFrame(0.730769217F, 180.0F, _holdThenStepEasingFunction);
00473         // Frame 195.
00474         result.InsertKeyFrame(0.75F, 180.0F, _holdThenStepEasingFunction);
00475         // Frame 205.
00476         result.InsertKeyFrame(0.788461566F, 0.0F, _cubicBezierEasingFunction_0);
00477         // Frame 210.
00478         result.InsertKeyFrame(0.807692289F, 0.0F, _holdThenStepEasingFunction);
00479         // Frame 219.
00480         result.InsertKeyFrame(0.842307687F, 180.0F, _cubicBezierEasingFunction_0);
00481         // Frame 220.
00482         result.InsertKeyFrame(0.846153855F, 0.0F, _holdThenStepEasingFunction);
00483         // Frame 225.
00484         result.InsertKeyFrame(0.865384638F, 0.0F, _holdThenStepEasingFunction);
00485         // Frame 235.
00486         result.InsertKeyFrame(0.903846145F, 180.0F, _cubicBezierEasingFunction_0);
00487         // Frame 240.
00488         result.InsertKeyFrame(0.923076928F, 0.0F, _holdThenStepEasingFunction);
00489         // Frame 245.
00490         result.InsertKeyFrame(0.942307711F, 0.0F, _holdThenStepEasingFunction);
00491         // Frame 255.
00492         result.InsertKeyFrame(0.980769217F, 180.0F, _cubicBezierEasingFunction_0);
00493         return result;
00494     }
00495
00496     // PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff Controls
00497     // - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 - Dropdown
00498     // Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00499     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00500     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00501     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00502     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00503     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00504     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00505     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00506     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00507     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00508     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00509     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00510     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00511     // Dropdown Rotate - 18 - PressedOffToNormalOn
00512     // Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00513     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00514     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00515     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00516     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00517     ShapeVisual ShapeVisual_0()
00518     {
00519         const auto result = _c.CreateShapeVisual();
00520         result.Size({ 48.0F, 48.0F });
00521         // ShapeGroup: Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00522         // Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00523         result.Shapes().Append(SpriteShape());
00524         return result;
00525     }
00526
00527     StepEasingFunction HoldThenStepEasingFunction()
00528     {
00529         const auto result = _holdThenStepEasingFunction = _c.CreateStepEasingFunction();
00530         result.IsFinalStepSingleFrame(true);
00531         return result;
00532     }
00533
00534     // - - - PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff
00535     // Controls - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 -
00536     // Dropdown Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00537     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00538     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00539     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00540     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00541     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00542     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00543     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00544     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00545     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00546     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00547     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00548     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00549     // Dropdown Rotate - 18 - PressedOffToNormalOn
00550     // - - Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate
00551     // 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00552     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00553     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00554     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00555     // - ShapeGroup: Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape
00556     // 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00557     // RotationAngleInDegrees
00558     StepEasingFunction StepThenHoldEasingFunction()
00559     {
00560         const auto result = _c.CreateStepEasingFunction();
00561         result.IsInitialStepSingleFrame(true);
00562         return result;
00563     }
00564
00565     // - - PreComp layer: Controls - 07 - Dropdown Rotate - 01 - NormalOnToNormalOff
00566     // Controls - 07 - Dropdown Rotate - 02 - NormalOnToPointerOverOn Controls - 07 -
00567     // Dropdown Rotate - 03 - NormalOnToPressedOn Controls - 07 - Dropdown Rotate - 04 -
00568     // NormalOffToNormalOn Controls - 07 - Dropdown Rotate - 05 -NormalOffToPointerOverOff
00569     // Controls - 07 - Dropdown Rotate - 06 - NormalOffToPressedOff Controls - 07 -
00570     // Dropdown Rotate - 07 - PointerOverOnToPointerOverOff Controls - 07 - Dropdown
00571     // Rotate - 08 - PointerOverOnToNormalOn Controls - 07 - Dropdown Rotate - 09 -
00572     // PointerOverOnToPressedOn Controls - 07 - Dropdown Rotate - 10 -
00573     // PointerOverOffToPointerOverOn Controls - 07 - Dropdown Rotate - 11 -
00574     // PointerOverOffToNormalOff Controls - 07 - Dropdown Rotate - 12 -
00575     // PointerOverOffToPressedOff Controls - 07 - Dropdown Rotate - 13 -
00576     // PressedOnToPressedOff Controls - 07 - Dropdown Rotate - 14 -
00577     // PressedOnToPointerOverOff Controls - 07 - Dropdown Rotate - 15 -
00578     // PressedOnToNormalOff Controls - 07 - Dropdown Rotate - 16 - PressedOffToPressedOn
00579     // Controls - 07 - Dropdown Rotate - 17 - PressedOffToPointerOverOn Controls - 07 -
00580     // Dropdown Rotate - 18 - PressedOffToNormalOn
00581     // - Shape tree root for layer: DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00582     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00583     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00584     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00585     // DownArrowRotate 2 DownArrowRotate 2 DownArrowRotate 2
00586     // ShapeGroup: Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00587     // Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1 Shape 1
00588     // Offset
00589     Vector2KeyFrameAnimation OffsetVector2Animation()
00590     {
00591         // Frame 0.
00592         const auto result = CreateVector2KeyFrameAnimation(0.0F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00593         // Frame 10.
00594         result.InsertKeyFrame(0.0384615399F, { 24.0F, 26.0F }, _cubicBezierEasingFunction_0);
00595         // Frame 15.
00596         result.InsertKeyFrame(0.057692308F, { 24.0F, 18.0F }, CubicBezierEasingFunction_1());
00597         // Frame 29.
00598         result.InsertKeyFrame(0.111538462F, { 24.1709995F, 23.9230003F }, CubicBezierEasingFunction_2());
00599         // Frame 30.
00600         result.InsertKeyFrame(0.115384616F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00601         // Frame 40.
00602         result.InsertKeyFrame(0.15384616F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00603         // Frame 49.
00604         result.InsertKeyFrame(0.188461542F, { 24.0F, 26.0F }, _cubicBezierEasingFunction_0);
00605         // Frame 50.
00606         result.InsertKeyFrame(0.192307696F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00607         // Frame 60.
00608         result.InsertKeyFrame(0.230769232F, { 24.0F, 22.0F }, _cubicBezierEasingFunction_0);
00609         // Frame 65.
00610         result.InsertKeyFrame(0.25F, { 24.0F, 30.0F }, CubicBezierEasingFunction_3());
00611         // Frame 79.
00612         result.InsertKeyFrame(0.303846151F, { 24.0F, 24.0F }, _cubicBezierEasingFunction_2);
00613         // Frame 90.
00614         result.InsertKeyFrame(0.346153855F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00615         // Frame 99.
00616         result.InsertKeyFrame(0.380769223F, { 24.0F, 22.0F }, _cubicBezierEasingFunction_0);
00617         // Frame 100.
00618         result.InsertKeyFrame(0.384615391F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00619         // Frame 120.
00620         result.InsertKeyFrame(0.461538464F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00621         // Frame 129.
00622         result.InsertKeyFrame(0.496153831F, { 24.0F, 26.0F }, _cubicBezierEasingFunction_0);
00623         // Frame 130.
00624         result.InsertKeyFrame(0.5F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00625         // Frame 150.
00626         result.InsertKeyFrame(0.576923072F, { 24.0F, 24.0F }, _holdThenStepEasingFunction);
00627         // Frame 159.
00628         result.InsertKeyFrame(0.61153847F, { 24.0F, 22.0F }, _cubicBezierEasingFunction_0);
00629         // Frame 160.
00630         result.InsertKeyFrame(0.615384638F, { 24.0F, 26.0F }, _holdThenStepEasingFunction);
00631         // Frame 169.
00632         result.InsertKeyFrame(0.649999976F, { 24.0F, 22.0F }, _cubicBezierEasingFunction_0);
00633         // Frame 170.
00634         result.InsertKeyFrame(0.653846145F, { 24.0F, 26.0F }, _holdThenStepEasingFunction);
00635         // Frame 175.
00636         result.InsertKeyFrame(0.673076928F, { 24.0F, 18.0F }, _cubicBezierEasingFunction_1);
00637         // Frame 189.
00638         result.InsertKeyFrame(0.726923048F, { 24.1709995F, 23.9230003F }, _cubicBezierEasingFunction_2);
00639         // Frame 190.
00640         result.InsertKeyFrame(0.730769217F, { 24.0F, 26.0F }, _holdThenStepEasingFunction);
00641         // Frame 195.
00642         result.InsertKeyFrame(0.75F, { 24.0F, 18.0F }, _cubicBezierEasingFunction_1);
00643         // Frame 209.
00644         result.InsertKeyFrame(0.80384618F, { 24.1709995F, 23.9230003F }, _cubicBezierEasingFunction_2);
00645         // Frame 210.
00646         result.InsertKeyFrame(0.807692289F, { 24.0F, 22.0F }, _holdThenStepEasingFunction);
00647         // Frame 219.
00648         result.InsertKeyFrame(0.842307687F, { 24.0F, 26.0F }, _cubicBezierEasingFunction_0);
00649         // Frame 220.
00650         result.InsertKeyFrame(0.846153855F, { 24.0F, 22.0F }, _holdThenStepEasingFunction);
00651         // Frame 225.
00652         result.InsertKeyFrame(0.865384638F, { 24.0F, 30.0F }, _cubicBezierEasingFunction_3);
00653         // Frame 239.
00654         result.InsertKeyFrame(0.919230759F, { 24.0F, 24.0F }, _cubicBezierEasingFunction_2);
00655         // Frame 240.
00656         result.InsertKeyFrame(0.923076928F, { 24.0F, 22.0F }, _holdThenStepEasingFunction);
00657         // Frame 245.
00658         result.InsertKeyFrame(0.942307711F, { 24.0F, 30.0F }, _cubicBezierEasingFunction_3);
00659         // Frame 259.
00660         result.InsertKeyFrame(0.996153831F, { 24.0F, 24.0F }, _cubicBezierEasingFunction_2);
00661         return result;
00662     }
00663
00664     static IGeometrySource2D CanvasGeometryToIGeometrySource2D(winrt::com_ptr<CanvasGeometry> geo)
00665     {
00666         return geo.as<IGeometrySource2D>();
00667     }
00668
00669 public:
00670     AnimatedChevronUpDownSmallVisualSource_AnimatedVisual(
00671         Compositor compositor,
00672         CompositionPropertySet themeProperties)
00673         : _c{compositor}
00674         , _themeProperties{themeProperties}
00675         , _reusableExpressionAnimation(compositor.CreateExpressionAnimation())
00676     {
00677         winrt::check_hresult(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, _d2dFactory.put()));
00678         const auto _ = Root();
00679     }
00680
00681     void Close()
00682     {
00683         if (_root)
00684         {
00685             _root.Close();
00686         }
00687     }
00688
00689     TimeSpan Duration() const
00690     {
00691         return TimeSpan{ c_durationTicks };
00692     }
00693
00694     Visual RootVisual() const
00695     {
00696         return _root;
00697     }
00698
00699     winrt::float2 Size() const
00700     {
00701         return { 48.0F, 48.0F };
00702     }
00703
00704     static bool IsRuntimeCompatible()
00705     {
00706         return winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7);
00707     }
00708 };
00709
00710 winrt::float4 AnimatedChevronUpDownSmallVisualSource::ColorAsVector4(Color color)
00711 {
00712     return { static_cast<float>(color.R), static_cast<float>(color.G), static_cast<float>(color.B), static_cast<float>(color.A) };
00713 }
00714
00715 CompositionPropertySet AnimatedChevronUpDownSmallVisualSource::EnsureThemeProperties(Compositor compositor)
00716 {
00717     if (_themeProperties == nullptr)
00718     {
00719         _themeProperties = compositor.CreatePropertySet();
00720         _themeProperties.InsertVector4(L"Foreground", ColorAsVector4((Color)_themeForeground));
00721     }
00722
00723     return _themeProperties;
00724 }
00725
00726 Color AnimatedChevronUpDownSmallVisualSource::Foreground()
00727 {
00728     return _themeForeground;
00729 }
00730
00731 void AnimatedChevronUpDownSmallVisualSource::Foreground(Color value)
00732 {
00733     _themeForeground = value;
00734     if (_themeProperties != nullptr)
00735     {
00736         _themeProperties.InsertVector4(L"Foreground", ColorAsVector4((Color)_themeForeground));
00737     }
00738 }
00739
00740 winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual AnimatedChevronUpDownSmallVisualSource::TryCreateAnimatedVisual(
00741     Compositor const& compositor)
00742 {
00743     IInspectable diagnostics = nullptr;
00744     return TryCreateAnimatedVisual(compositor, diagnostics);
00745 }
00746
00747 winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual AnimatedChevronUpDownSmallVisualSource::TryCreateAnimatedVisual(
00748     Compositor const& compositor,
00749     IInspectable& diagnostics)
00750 {
00751     const auto _ = EnsureThemeProperties(compositor);
00752     diagnostics = nullptr;
00753
00754     if (AnimatedChevronUpDownSmallVisualSource_AnimatedVisual::IsRuntimeCompatible())
00755     {
00756         return winrt::make<AnimatedChevronUpDownSmallVisualSource_AnimatedVisual>(
00757             compositor,
00758             _themeProperties);
00759     }
00760
00761     return nullptr;
00762 }
00763
00764 double AnimatedChevronUpDownSmallVisualSource::FrameCount()
00765 {
00766     return 260.0;
00767 }
00768
00769 double AnimatedChevronUpDownSmallVisualSource::Framerate()
00770 {
00771     return 60.0;
00772 }
00773
00774 TimeSpan AnimatedChevronUpDownSmallVisualSource::Duration()
00775 {
00776     return TimeSpan{ 43333333L };
00777 }
00778
00779 double AnimatedChevronUpDownSmallVisualSource::FrameToProgress(double frameNumber)
00780 {
00781     return frameNumber / 260.0;
00782 }
00783
00784 winrt::Windows::Foundation::Collections::IMapView<hstring, double> AnimatedChevronUpDownSmallVisualSource::Markers()
00785 {
00786     return winrt::single_threaded_map<winrt::hstring, double>(
00787         std::map<winrt::hstring, double>
00788         {
00789             { L"NormalOnToNormalOff_Start", 0.0 },
00790             { L"NormalOnToNormalOff_End", 0.111730769230769 },
00791             { L"NormalOnToPointerOverOn_Start", 0.115576923076923 },
00792             { L"NormalOnToPointerOverOn_End", 0.150192307692308 },
00793             { L"NormalOnToPressedOn_Start", 0.154038461538462 },
00794             { L"NormalOnToPressedOn_End", 0.188653846153846 },
00795             { L"NormalOffToNormalOn_Start", 0.1925 },
00796             { L"NormalOffToNormalOn_End", 0.304038461538462 },
00797             { L"NormalOffToPointerOverOff_Start", 0.307884615384615 },
00798             { L"NormalOffToPointerOverOff_End", 0.3425 },
00799             { L"NormalOffToPressedOff_Start", 0.346346153846154 },
00800             { L"NormalOffToPressedOff_End", 0.380961538461538 },
00801             { L"PointerOverOnToPointerOverOff_Start", 0.384807692307692 },
00802             { L"PointerOverOnToPointerOverOff_End", 0.419423076923077 },
00803             { L"PointerOverOnToNormalOn_Start", 0.423269230769231 },
00804             { L"PointerOverOnToNormalOn_End", 0.457884615384615 },
00805             { L"PointerOverOnToPressedOn_Start", 0.461730769230769 },
00806             { L"PointerOverOnToPressedOn_End", 0.496346153846154 },
00807             { L"PointerOverOffToPointerOverOn_Start", 0.500192307692308 },
00808             { L"PointerOverOffToPointerOverOn_End", 0.534807692307692 },
00809             { L"PointerOverOffToNormalOff_Start", 0.538653846153846 },
00810             { L"PointerOverOffToNormalOff_End", 0.573269230769231 },
00811             { L"PointerOverOffToPressedOff_Start", 0.577115384615385 },
00812             { L"PointerOverOffToPressedOff_End", 0.611730769230769 },
00813             { L"PressedOnToPressedOff_Start", 0.615576923076923 },
00814             { L"PressedOnToPressedOff_End", 0.650192307692308 },
00815             { L"PressedOnToPointerOverOff_Start", 0.654038461538462 },
00816             { L"PressedOnToPointerOverOff_End", 0.727115384615385 },
00817             { L"PressedOnToNormalOff_Start", 0.730961538461539 },
00818             { L"PressedOnToNormalOff_End", 0.804038461538462 },
00819             { L"PressedOffToPressedOn_Start", 0.807884615384615 },
00820             { L"PressedOffToPressedOn_End", 0.8425 },
00821             { L"PressedOffToPointerOverOn_Start", 0.846346153846154 },
00822             { L"PressedOffToPointerOverOn_End", 0.919423076923077 },
00823             { L"PressedOffToNormalOn_Start", 0.923269230769231 },
00824             { L"PressedOffToNormalOn_End", 0.996346153846154 },
00825         }
00826     ).GetView();
00827 }
00828
00829 void AnimatedChevronUpDownSmallVisualSource::SetColorProperty(hstring const& propertyName, Color value)
00830 {
00831     if (propertyName == L"Foreground")
00832     {
00833         _themeForeground = value;
00834     }
00835     else
00836     {
00837         return;
00838     }
00839
00840     if (_themeProperties != nullptr)
00841     {
00842         _themeProperties.InsertVector4(propertyName, ColorAsVector4(value));
00843     }
00844 }
00845
00846 void AnimatedChevronUpDownSmallVisualSource::SetScalarProperty(hstring const&, double)
00847 {
00848 }
Generated on Sun Dec 1 2024 20:51:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBadge/InfoBadgeTemplateSettings.cpp Source File

  • InfoBadge

InfoBadgeTemplateSettings.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "InfoBadgeTemplateSettings.h"
00007
00008 InfoBadgeTemplateSettings::InfoBadgeTemplateSettings()
00009 {
00010     EnsureProperties();
00011 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/ExtendedSelector.h Source File

  • ItemsView

ExtendedSelector.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SelectorBase.h"
00007
00008 class ExtendedSelector : public SelectorBase
00009 {
00010 public:
00011     ExtendedSelector();
00012     ~ExtendedSelector();
00013
00014     void OnInteractedAction(winrt::IndexPath const& index, bool ctrl, bool shift) override;
00015     void OnFocusedAction(winrt::IndexPath const& index, bool ctrl, bool shift) override;
00016 };
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CompositionScrollController Member List

This is the complete list of members for CompositionScrollController, including all inherited members.
AddScrollVelocity(float offsetVelocity, float?inertiaDecayRate) | CompositionScrollController | [inline]
AddScrollVelocityRequested | CompositionScrollController |
AnimationType enum name | CompositionScrollController |
CanScroll | CompositionScrollController |
CanScrollChanged | CompositionScrollController |
CompositionScrollController() | CompositionScrollController | [inline]
CompositionScrollController_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) | CompositionScrollController | [inline, private]
CompositionScrollController_SizeChanged(object sender, SizeChangedEventArgs e) | CompositionScrollController | [inline, private]
DecrementRepeatButton_Click(object sender, RoutedEventArgs e) | CompositionScrollController | [inline, private]
GetScrollAnimation(int correlationId, Vector2 startPosition, Vector2 endPosition, CompositionAnimation defaultAnimation) | CompositionScrollController | [inline]
horizontalDecrementRepeatButton | CompositionScrollController | [private]
horizontalGrid | CompositionScrollController | [private]
horizontalIncrementRepeatButton | CompositionScrollController | [private]
horizontalThumb | CompositionScrollController | [private]
HorizontalThumbOffset | CompositionScrollController | [private]
IncrementRepeatButton_Click(object sender, RoutedEventArgs e) | CompositionScrollController | [inline, private]
IsAnimatingThumbOffset | CompositionScrollController |
isScrollable | CompositionScrollController | [private]
IsScrollingWithMouse | CompositionScrollController |
IsScrollingWithMouseChanged | CompositionScrollController |
IsThumbPannable | CompositionScrollController |
IsThumbPositionMirrored | CompositionScrollController |
LogMessage | CompositionScrollController |
lstAddScrollVelocityCorrelationIds | CompositionScrollController | [private]
lstAsyncEventMessage | CompositionScrollController | [private]
lstOffsetChangeCorrelationIds | CompositionScrollController | [private]
maxOffset | CompositionScrollController | [private]
minOffset | CompositionScrollController | [private]
NotifyRequestedScrollCompleted(int correlationId) | CompositionScrollController | [inline]
offset | CompositionScrollController | [private]
OffsetChangeAnimationType | CompositionScrollController |
OffsetChangeCompleted | CompositionScrollController |
offsetTarget | CompositionScrollController | [private]
OnApplyTemplate() | CompositionScrollController | [inline, protected]
operations | CompositionScrollController | [private]
Orientation | CompositionScrollController |
orientation | CompositionScrollController | [private]
OverriddenOffsetChangeDuration | CompositionScrollController |
panningFrameworkElement | CompositionScrollController | [private]
PanningFrameworkElement_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) | CompositionScrollController | [inline, private]
PanningFrameworkElement_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) | CompositionScrollController | [inline, private]
PanningFrameworkElement_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e) | CompositionScrollController | [inline, private]
PanningFrameworkElement_PointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) | CompositionScrollController | [inline, private]
PanningInfo | CompositionScrollController |
panningInfo | CompositionScrollController | [private]
PanningInfo_LogMessage(IScrollControllerPanningInfo sender, string message) | CompositionScrollController | [inline, private]
Parent_PointerPressed(object sender, PointerRoutedEventArgs e) | CompositionScrollController | [inline, private]
preManipulationThumbOffset | CompositionScrollController | [private]
RaiseAddScrollVelocityRequested(float offsetVelocity, float?inertiaDecayRate, bool hookupCompletion) | CompositionScrollController | [inline, private]
RaiseCanScrollChanged() | CompositionScrollController | [inline, private]
RaiseIsScrollingWithMouseChanged() | CompositionScrollController | [inline, private]
RaiseLogMessage(string message) | CompositionScrollController | [inline, private]
RaiseScrollByRequested(double offsetDelta, ScrollingAnimationMode animationMode, bool hookupCompletion) | CompositionScrollController | [inline, private]
RaiseScrollToRequested(double offset, ScrollingAnimationMode animationMode, bool hookupCompletion) | CompositionScrollController | [inline, private]
s_IsDebugOutputEnabled | CompositionScrollController | [static]
ScrollBy(double offsetDelta, ScrollingAnimationMode animationMode) | CompositionScrollController | [inline]
ScrollByRequested | CompositionScrollController |
ScrollPresenterOffsetFromThumbOffset(double thumbOffset) | CompositionScrollController | [inline, private]
ScrollTo(double offset, ScrollingAnimationMode animationMode) | CompositionScrollController | [inline]
ScrollToRequested | CompositionScrollController |
SetIsScrollable(bool isScrollable) | CompositionScrollController | [inline]
SetValues(double minOffset, double maxOffset, double offset, double viewportLength) | CompositionScrollController | [inline]
SmallChangeAdditionalVelocity | CompositionScrollController | [private]
SmallChangeInertiaDecayRate | CompositionScrollController | [private]
StockOffsetChangeDuration | CompositionScrollController |
UnhookHandlers() | CompositionScrollController | [inline, private]
UpdateCanScroll() | CompositionScrollController | [inline, private]
UpdateOrientation() | CompositionScrollController | [inline, private]
UpdatePanningFrameworkElementOffset() | CompositionScrollController | [inline, private]
verticalDecrementRepeatButton | CompositionScrollController | [private]
verticalGrid | CompositionScrollController | [private]
verticalIncrementRepeatButton | CompositionScrollController | [private]
verticalThumb | CompositionScrollController | [private]
VerticalThumbOffset | CompositionScrollController | [private]
viewportLength | CompositionScrollController | [private]
Generated on Sun Dec 1 2024 20:54:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollView::AutoHideScrollBarsState Member List

This is the complete list of members for ScrollView::AutoHideScrollBarsState, including all inherited members.
HookUISettingsEvent(ScrollView *scrollView) ScrollView::AutoHideScrollBarsState [inline]
Generated on Sun Dec 1 2024 20:53:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterTestHooksFactory.cpp Source File

  • ScrollPresenter

ScrollPresenterTestHooksFactory.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ScrollPresenterTestHooksFactory.h"
00007 #include "ScrollPresenterTestHooks.properties.cpp"
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarToolButtonAutomationPeer.h Source File

  • InkToolBar

InkToolBarToolButtonAutomationPeer.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarToolButtonAutomationPeer.g.h"
00011
00012 class InkToolBarToolButtonAutomationPeer :
00013     public ReferenceTracker<InkToolBarToolButtonAutomationPeer, winrt::implementation::InkToolBarToolButtonAutomationPeerT>
00014 {
00015 public:
00016     InkToolBarToolButtonAutomationPeer(winrt::InkToolBarToolButton owner) {};
00017 };
00018
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TeachingTipTestPageElements Member List

This is the complete list of members for TeachingTipTestPageElements, including all inherited members.
actionButtonContentComboBox | TeachingTipTestPageElements | [private]
automationNameComboBox | TeachingTipTestPageElements | [private]
AutomationNameOptions enum name | TeachingTipTestPageElements |
bringTargetIntoViewButton | TeachingTipTestPageElements | [private]
btnClearTeachingTipEvents | TeachingTipTestPageElements | [private]
closeButton | TeachingTipTestPageElements | [private]
closeButtonContentComboBox | TeachingTipTestPageElements | [private]
CloseButtonContentOptions enum name | TeachingTipTestPageElements |
effectiveForegroundOfTeachingTipButtonTextBlock | TeachingTipTestPageElements | [private]
effectiveForegroundOfTeachingTipContentTextBlock | TeachingTipTestPageElements | [private]
effectiveOpenTeachingTipOnEdgeButton | TeachingTipTestPageElements | [private]
effectivePageRTLCheckbox | TeachingTipTestPageElements | [private]
effectivePlacementTextBlock | TeachingTipTestPageElements | [private]
effectiveRemoveOpenButton | TeachingTipTestPageElements | [private]
effectiveRemoveTeachingTipButton | TeachingTipTestPageElements | [private]
effectiveTeachingTipContent | TeachingTipTestPageElements | [private]
effectiveTeachingTipContentUnloadedCheckbox | TeachingTipTestPageElements | [private]
effectiveTeachingTipOnEdgeOffsetButton | TeachingTipTestPageElements | [private]
effectiveTeachingTipOnEdgeOffsetTextblock | TeachingTipTestPageElements | [private]
GetActionButtonContentComboBox() | TeachingTipTestPageElements | [inline]
GetAutomationNameComboBox() | TeachingTipTestPageElements | [inline]
GetBringTargetIntoViewButton() | TeachingTipTestPageElements | [inline]
GetBtnClearTeachingTipEvents() | TeachingTipTestPageElements | [inline]
GetCloseButton() | TeachingTipTestPageElements | [inline]
GetCloseButtonContentComboBox() | TeachingTipTestPageElements | [inline]
GetEffectiveForegroundOfTeachingTipButtonTextBlock() | TeachingTipTestPageElements | [inline]
GetEffectiveForegroundOfTeachingTipContentTextBlock() | TeachingTipTestPageElements | [inline]
GetEffectivePlacementTextBlock() | TeachingTipTestPageElements | [inline]
GetElement< T >(ref T element, string elementName) | TeachingTipTestPageElements | [inline, private]
GetHeroContentComboBox() | TeachingTipTestPageElements | [inline]
GetIconComboBox() | TeachingTipTestPageElements | [inline]
GetIsIdleCheckBox() | TeachingTipTestPageElements | [inline]
GetIsLightDismissEnabledButton() | TeachingTipTestPageElements | [inline]
GetIsLightDismissEnabledComboBox() | TeachingTipTestPageElements | [inline]
GetIsOpenCheckBox() | TeachingTipTestPageElements | [inline]
GetLstTeachingTipEvents() | TeachingTipTestPageElements | [inline]
GetOpenTeachingTipOnEdgeButton() | TeachingTipTestPageElements | [inline]
GetPageRTLCheckbox() | TeachingTipTestPageElements | [inline]
GetPopupVerticalOffsetTextBlock() | TeachingTipTestPageElements | [inline]
GetPreferredPlacementComboBox() | TeachingTipTestPageElements | [inline]
GetRemoveOpenButtonFromVisualTreeButton() | TeachingTipTestPageElements | [inline]
GetRemoveTargetButton() | TeachingTipTestPageElements | [inline]
GetRemoveTeachingTipButton() | TeachingTipTestPageElements | [inline]
GetReturnTopForOutOfWindowPlacementCheckBox() | TeachingTipTestPageElements | [inline]
GetScrollViewerOffsetButton() | TeachingTipTestPageElements | [inline]
GetScrollViewerOffsetTextBox() | TeachingTipTestPageElements | [inline]
GetScrollViewerStateTextBox() | TeachingTipTestPageElements | [inline]
GetSetActionButtonContentButton() | TeachingTipTestPageElements | [inline]
GetSetAutomationNameButton() | TeachingTipTestPageElements | [inline]
GetSetCloseButtonContentButton() | TeachingTipTestPageElements | [inline]
GetSetHeroContentButton() | TeachingTipTestPageElements | [inline]
GetSetIconButton() | TeachingTipTestPageElements | [inline]
GetSetPreferredPlacementButton() | TeachingTipTestPageElements | [inline]
GetSetSubtitleButton() | TeachingTipTestPageElements | [inline]
GetSetTargetButton() | TeachingTipTestPageElements | [inline]
GetSetTipLocationButton() | TeachingTipTestPageElements | [inline]
GetSetTitleButton() | TeachingTipTestPageElements | [inline]
GetShouldConstrainToRootBoundsButton() | TeachingTipTestPageElements | [inline]
GetShouldConstrainToRootBoundsComboBox() | TeachingTipTestPageElements | [inline]
GetShowButton() | TeachingTipTestPageElements | [inline]
GetSubtitleComboBox() | TeachingTipTestPageElements | [inline]
GetSubtitleVisibilityTextBlock() | TeachingTipTestPageElements | [inline]
GetSwitchTargetButton() | TeachingTipTestPageElements | [inline]
GetTargetBoundsButton() | TeachingTipTestPageElements | [inline]
GetTargetHeightTextBlock() | TeachingTipTestPageElements | [inline]
GetTargetWidthTextBlock() | TeachingTipTestPageElements | [inline]
GetTargetXOffsetTextBlock() | TeachingTipTestPageElements | [inline]
GetTargetYOffsetTextBlock() | TeachingTipTestPageElements | [inline]
GetTeachingTipAlternateCloseButton() | TeachingTipTestPageElements | [inline]
GetTeachingTipCloseButton() | TeachingTipTestPageElements | [inline]
GetTeachingTipContent() | TeachingTipTestPageElements | [inline]
GetTeachingTipContentUnloadedCheck() | TeachingTipTestPageElements | [inline]
GetTeachingTipOnEdgeHorizontalOffset() | TeachingTipTestPageElements | [inline]
GetTeachingTipOnEdgeOffsetButton() | TeachingTipTestPageElements | [inline]
GetTeachingTipOnEdgeOffsetTextblock() | TeachingTipTestPageElements | [inline]
GetTeachingTipOnEdgeVerticalOffset() | TeachingTipTestPageElements | [inline]
GetTestScreenBoundsHeightTextBox() | TeachingTipTestPageElements | [inline]
GetTestScreenBoundsWidthTextBox() | TeachingTipTestPageElements | [inline]
GetTestScreenBoundsXTextBox() | TeachingTipTestPageElements | [inline]
GetTestScreenBoundsYTextBox() | TeachingTipTestPageElements | [inline]
GetTestWindowBoundsHeightTextBox() | TeachingTipTestPageElements | [inline]
GetTestWindowBoundsWidthTextBox() | TeachingTipTestPageElements | [inline]
GetTestWindowBoundsXTextBox() | TeachingTipTestPageElements | [inline]
GetTestWindowBoundsYTextBox() | TeachingTipTestPageElements | [inline]
GetThemingComboBox() | TeachingTipTestPageElements | [inline]
GetTipFollowsTargetCheckBox() | TeachingTipTestPageElements | [inline]
GetTipLocationComboBox() | TeachingTipTestPageElements | [inline]
GetTipWidthTextBlock() | TeachingTipTestPageElements | [inline]
GetTitleComboBox() | TeachingTipTestPageElements | [inline]
GetTitleVisibilityTextBlock() | TeachingTipTestPageElements | [inline]
GetUseTestScreenBoundsCheckbox() | TeachingTipTestPageElements | [inline]
GetUseTestWindowBoundsCheckbox() | TeachingTipTestPageElements | [inline]
heroContentComboBox | TeachingTipTestPageElements | [private]
HeroContentOptions enum name | TeachingTipTestPageElements |
iconComboBox | TeachingTipTestPageElements | [private]
IconOptions enum name | TeachingTipTestPageElements |
isIdleCheckBox | TeachingTipTestPageElements | [private]
isLightDismissEnabledButton | TeachingTipTestPageElements | [private]
isLightDismissEnabledComboBox | TeachingTipTestPageElements | [private]
isOpenCheckBox | TeachingTipTestPageElements | [private]
lstTeachingTipEvents | TeachingTipTestPageElements | [private]
PlacementOptions enum name | TeachingTipTestPageElements |
popupVerticalOffsetTextBlock | TeachingTipTestPageElements | [private]
preferredPlacementComboBox | TeachingTipTestPageElements | [private]
removeTargetButton | TeachingTipTestPageElements | [private]
returnTopForOutOfWindowPlacementCheckBox | TeachingTipTestPageElements | [private]
scrollViewerOffsetButton | TeachingTipTestPageElements | [private]
scrollViewerOffsetTextBox | TeachingTipTestPageElements | [private]
scrollViewerStateTextBox | TeachingTipTestPageElements | [private]
setActionContentButton | TeachingTipTestPageElements | [private]
setAutomationNameButton | TeachingTipTestPageElements | [private]
setCloseButtonContentButton | TeachingTipTestPageElements | [private]
setHeroContentButton | TeachingTipTestPageElements | [private]
setIconButton | TeachingTipTestPageElements | [private]
setPreferredPlacementButton | TeachingTipTestPageElements | [private]
setSubtitleButton | TeachingTipTestPageElements | [private]
setTargetButton | TeachingTipTestPageElements | [private]
setTipLocationButton | TeachingTipTestPageElements | [private]
setTitleButton | TeachingTipTestPageElements | [private]
shouldConstrainToRootBoundsButton | TeachingTipTestPageElements | [private]
shouldConstrainToRootBoundsComboBox | TeachingTipTestPageElements | [private]
showButton | TeachingTipTestPageElements | [private]
subtitleComboBox | TeachingTipTestPageElements | [private]
SubtitleContentOptions enum name | TeachingTipTestPageElements |
subtitleVisibilityTextBlock | TeachingTipTestPageElements | [private]
SwitchTargetButton | TeachingTipTestPageElements | [private]
targetBoundsButton | TeachingTipTestPageElements | [private]
targetHeightTextBlock | TeachingTipTestPageElements | [private]
targetWidthTextBlock | TeachingTipTestPageElements | [private]
targetXOffsetTextBlock | TeachingTipTestPageElements | [private]
targetYOffsetTextBlock | TeachingTipTestPageElements | [private]
teachingTipAlternateCloseButton | TeachingTipTestPageElements | [private]
teachingTipCloseButton | TeachingTipTestPageElements | [private]
testScreenBoundsHeightTextBox | TeachingTipTestPageElements | [private]
testScreenBoundsWidthTextBox | TeachingTipTestPageElements | [private]
testScreenBoundsXTextBox | TeachingTipTestPageElements | [private]
testScreenBoundsYTextBox | TeachingTipTestPageElements | [private]
testWindowBoundsHeightTextBox | TeachingTipTestPageElements | [private]
testWindowBoundsWidthTextBox | TeachingTipTestPageElements | [private]
testWindowBoundsXTextBox | TeachingTipTestPageElements | [private]
testWindowBoundsYTextBox | TeachingTipTestPageElements | [private]
themingComboBox | TeachingTipTestPageElements | [private]
tipFollowsTargetCheckBox | TeachingTipTestPageElements | [private]
tipLocationComboBox | TeachingTipTestPageElements | [private]
TipLocationOptions enum name | TeachingTipTestPageElements |
tipWidthTextBlock | TeachingTipTestPageElements | [private]
titleComboBox | TeachingTipTestPageElements | [private]
TitleContentOptions enum name | TeachingTipTestPageElements |
titleVisibilityTextBlock | TeachingTipTestPageElements | [private]
useTestScreenBoundsCheckbox | TeachingTipTestPageElements | [private]
useTestWindowBoundsCheckbox | TeachingTipTestPageElements | [private]
Generated on Sun Dec 1 2024 20:53:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ContentDialogPage Member List

This is the complete list of members for ContentDialogPage, including all inherited members.
ContentDialogPage() | ContentDialogPage | [inline]
CreateContentDialog() | ContentDialogPage | [inline, private, static]
ShowBorderThickness_Click(object sender, RoutedEventArgs e) | ContentDialogPage | [inline, private]
ShowDialog_Click(object sender, RoutedEventArgs e) | ContentDialogPage | [inline, private]
ShowInPlaceDialog_Click(object sender, RoutedEventArgs e) | ContentDialogPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InfoBadgeTemplateSettings.properties.h Source File

  • Generated

InfoBadgeTemplateSettings.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InfoBadgeTemplateSettingsProperties
00008 {
00009 public:
00010     InfoBadgeTemplateSettingsProperties();
00011
00012     void IconElement(winrt::IconElement const& value);
00013     winrt::IconElement IconElement();
00014
00015     void InfoBadgeCornerRadius(winrt::CornerRadius const& value);
00016     winrt::CornerRadius InfoBadgeCornerRadius();
00017
00018     static winrt::DependencyProperty IconElementProperty() { return s_IconElementProperty; }
00019     static winrt::DependencyProperty InfoBadgeCornerRadiusProperty() { return s_InfoBadgeCornerRadiusProperty; }
00020
00021     static GlobalDependencyProperty s_IconElementProperty;
00022     static GlobalDependencyProperty s_InfoBadgeCornerRadiusProperty;
00023
00024     static void EnsureProperties();
00025     static void ClearProperties();
00026 };
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/FlatItemsControlPage.xaml.cs Source File

  • CommonStyles
  • TestUI

FlatItemsControlPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Controls;
00006 using Microsoft.UI.Xaml.Controls.Primitives;
00007 using Microsoft.UI.Xaml.Input;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Media.Imaging;
00010 using Microsoft.UI.Xaml.Navigation;
00011 using MUXControlsTestApp.Samples.Model;
00012 using System;
00013 using System.Collections.Generic;
00014 using System.Collections.ObjectModel;
00015 using System.Linq;
00016
00017 namespace MUXControlsTestApp
00018 {
00019     public sealed partial class FlatItemsControlPage : TestPage
00020     {
00021         private ObservableCollection<Entity> _colEntities = null;
00022         private ItemsPanelTemplate _modernPanelTemplate = null;
00023         private DataTemplate[] _itemTemplates = new DataTemplate[3];
00024
00025         public FlatItemsControlPage()
00026         {
00027             this.InitializeComponent();
00028
00029             Loaded += FlatItemsControlPage_Loaded;
00030         }
00031
00032         private void FlatItemsControlPage_Loaded(object sender, RoutedEventArgs e)
00033         {
00034             _colEntities = new ObservableCollection<Entity>();
00035
00036             for (int itemIndex = 0; itemIndex < 250; itemIndex++)
00037             {
00038                 BitmapImage bitmapImage = GetBitmapImage(itemIndex % 126 + 1);
00039
00040                 _colEntities.Add(new Entity()
00041                 {
00042                     BitmapImage = bitmapImage,
00043                     Id = itemIndex
00044                 });
00045             }
00046
00047             UpdateItemsControlIsTabStop();
00048             UpdateItemsControlItemTemplate();
00049             UpdateItemsControlTabNavigation();
00050             UpdateItemsControlXYFocusKeyboardNavigation();
00051             UpdateItemsPanelType();
00052
00053             itemsControl.ItemsSource = _colEntities;
00054         }
00055
00056         private void UpdateItemsPanelType()
00057         {
00058             try
00059             {
00060                 if (itemsControl != null && cmbItemsControlItemsPanelType != null)
00061                 {
00062                     switch (cmbItemsControlItemsPanelType.SelectedIndex)
00063                     {
00064                         case 0:
00065                             if (_modernPanelTemplate == null)
00066                             {
00067                                 _modernPanelTemplate = itemsControl.ItemsPanel;
00068                             }
00069                             else
00070                             {
00071                                 itemsControl.ItemsPanel = _modernPanelTemplate;
00072                             }
00073                             break;
00074                         case 1: // Use the virtualizingStackPanelItemsPanelTemplate resource
00075                             itemsControl.ItemsPanel = Resources["virtualizingStackPanelItemsPanelTemplate"] as ItemsPanelTemplate;
00076                             break;
00077                         case 2: // Use the stackPanelItemsPanelTemplate resource
00078                             itemsControl.ItemsPanel = Resources["stackPanelItemsPanelTemplate"] as ItemsPanelTemplate;
00079                             break;
00080                     }
00081
00082                     // itemsControl.ItemsPanelRoot is only updated asynchronously.
00083                     _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateModernPanelUIVisibility);
00084                     _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateItemsPanelProperties);
00085                 }
00086             }
00087             catch (Exception ex)
00088             {
00089                 txtExceptionReport.Text = ex.ToString();
00090                 AppendEventMessage(ex.ToString());
00091             }
00092         }
00093
00094         private void UpdateItemsPanelProperties()
00095         {
00096             UpdateItemsPanelOrientation();
00097             UpdateItemsPanelMargin();
00098
00099             if (itemsControl.ItemsPanelRoot is ItemsWrapGrid)
00100             {
00101                 UpdateItemsWrapGridMaximumRowsOrColumns();
00102             }
00103         }
00104
00105         private void UpdateItemsControlIsTabStop()
00106         {
00107             if (itemsControl != null && chkItemsControlIsTabStop != null)
00108             {
00109                 chkItemsControlIsTabStop.IsChecked = itemsControl.IsTabStop;
00110             }
00111         }
00112
00113         private void UpdateItemsControlItemTemplate()
00114         {
00115             try
00116             {
00117                 if (itemsControl != null && cmbItemsControlItemTemplate != null)
00118                 {
00119                     if (cmbItemsControlItemTemplate.SelectedIndex == 0)
00120                     {
00121                         itemsControl.ItemTemplate = null;
00122                     }
00123                     else
00124                     {
00125                         int templateIndex = cmbItemsControlItemTemplate.SelectedIndex - 1;
00126
00127                         if (_itemTemplates[templateIndex] == null)
00128                         {
00129                             _itemTemplates[templateIndex] = Resources["itemTemplate" + cmbItemsControlItemTemplate.SelectedIndex.ToString()] as DataTemplate;
00130                         }
00131
00132                         itemsControl.ItemTemplate = _itemTemplates[templateIndex];
00133                     }
00134                 }
00135             }
00136             catch (Exception ex)
00137             {
00138                 txtExceptionReport.Text = ex.ToString();
00139                 AppendEventMessage(ex.ToString());
00140             }
00141         }
00142
00143         private void UpdateItemsControlTabNavigation()
00144         {
00145             if (itemsControl != null && cmbItemsControlTabNavigation != null)
00146             {
00147                 cmbItemsControlTabNavigation.SelectedIndex = (int)itemsControl.TabNavigation;
00148             }
00149         }
00150
00151         private void UpdateItemsControlXYFocusKeyboardNavigation()
00152         {
00153             if (itemsControl != null && cmbItemsControlXYFocusKeyboardNavigation != null)
00154             {
00155                 cmbItemsControlXYFocusKeyboardNavigation.SelectedIndex = (int)itemsControl.XYFocusKeyboardNavigation;
00156             }
00157         }
00158
00159         private void UpdateItemsPanelOrientation()
00160         {
00161             if (itemsControl != null && cmbItemsPanelOrientation != null)
00162             {
00163                 ItemsWrapGrid itemsWrapGrid = itemsControl.ItemsPanelRoot as ItemsWrapGrid;
00164
00165                 if (itemsWrapGrid != null)
00166                 {
00167                     cmbItemsPanelOrientation.SelectedIndex = (int)itemsWrapGrid.Orientation;
00168                 }
00169                 else
00170                 {
00171                     ItemsStackPanel itemsStackPanel = itemsControl.ItemsPanelRoot as ItemsStackPanel;
00172
00173                     if (itemsStackPanel != null)
00174                     {
00175                         cmbItemsPanelOrientation.SelectedIndex = (int)itemsStackPanel.Orientation;
00176                     }
00177                     else
00178                     {
00179                         VirtualizingStackPanel virtualizingStackPanel = itemsControl.ItemsPanelRoot as VirtualizingStackPanel;
00180
00181                         if (virtualizingStackPanel != null)
00182                         {
00183                             cmbItemsPanelOrientation.SelectedIndex = (int)virtualizingStackPanel.Orientation;
00184                         }
00185                         else
00186                         {
00187                             StackPanel stackPanel = itemsControl.ItemsPanelRoot as StackPanel;
00188
00189                             if (stackPanel != null)
00190                             {
00191                                 cmbItemsPanelOrientation.SelectedIndex = (int)stackPanel.Orientation;
00192                             }
00193                         }
00194                     }
00195                 }
00196             }
00197         }
00198
00199         private void UpdateItemsWrapGridMaximumRowsOrColumns()
00200         {
00201             try
00202             {
00203                 if (itemsControl != null && nbItemsWrapGridMaximumRowsOrColumns != null)
00204                 {
00205                     ItemsWrapGrid itemsWrapGrid = itemsControl.ItemsPanelRoot as ItemsWrapGrid;
00206
00207                     if (itemsWrapGrid != null && itemsWrapGrid.MaximumRowsOrColumns != -1)
00208                     {
00209                         nbItemsWrapGridMaximumRowsOrColumns.Value = itemsWrapGrid.MaximumRowsOrColumns;
00210                     }
00211                 }
00212             }
00213             catch (Exception ex)
00214             {
00215                 txtExceptionReport.Text = ex.ToString();
00216                 AppendEventMessage(ex.ToString());
00217             }
00218         }
00219
00220         private void UpdateItemsPanelMargin()
00221         {
00222             try
00223             {
00224                 if (itemsControl != null && txtItemsPanelMargin != null)
00225                 {
00226                     Panel itemsPanel = itemsControl.ItemsPanelRoot;
00227
00228                     if (itemsPanel != null)
00229                     {
00230                         txtItemsPanelMargin.Text = itemsPanel.Margin.ToString();
00231                     }
00232                 }
00233             }
00234             catch (Exception ex)
00235             {
00236                 txtExceptionReport.Text = ex.ToString();
00237                 AppendEventMessage(ex.ToString());
00238             }
00239         }
00240
00241         private void UpdateModernPanelUIVisibility()
00242         {
00243             if (itemsControl.ItemsPanelRoot is ItemsWrapGrid)
00244             {
00245                 tblItemsWrapGridMaximumRowsOrColumns.Visibility = Visibility.Visible;
00246                 nbItemsWrapGridMaximumRowsOrColumns.Visibility = Visibility.Visible;
00247             }
00248             else
00249             {
00250                 tblItemsWrapGridMaximumRowsOrColumns.Visibility = Visibility.Collapsed;
00251                 nbItemsWrapGridMaximumRowsOrColumns.Visibility = Visibility.Collapsed;
00252             }
00253         }
00254
00255         private void UpdateDataSourceItemCount()
00256         {
00257             if (itemsControl != null && txtDataSourceItemCount != null)
00258             {
00259                 if (itemsControl.ItemsSource == null)
00260                 {
00261                     txtDataSourceItemCount.Text = "0";
00262                 }
00263                 else if (itemsControl.ItemsSource == _colEntities)
00264                 {
00265                     txtDataSourceItemCount.Text = _colEntities.Count.ToString();
00266                 }
00267             }
00268         }
00269
00270         private BitmapImage GetBitmapImage(int index)
00271         {
00272             Uri uri = new Uri(string.Format("ms-appx:///Images/vette{0}.jpg", index));
00273             BitmapImage bitmapImage = new BitmapImage();
00274             bitmapImage.DecodePixelWidth = 120;
00275             bitmapImage.DecodePixelHeight = 120;
00276             bitmapImage.UriSource = uri;
00277             return bitmapImage;
00278         }
00279
00280         private void DataSourceAddItem()
00281         {
00282             try
00283             {
00284                 if (itemsControl != null && itemsControl.ItemsSource != null)
00285                 {
00286                     if (itemsControl.ItemsSource == _colEntities)
00287                     {
00288                         BitmapImage bitmapImage = GetBitmapImage(_colEntities.Count % 126 + 1);
00289
00290                         var entity = new Entity()
00291                         {
00292                             BitmapImage = bitmapImage,
00293                             Id = _colEntities.Count
00294                         };
00295
00296                         _colEntities.Add(entity);
00297                     }
00298                 }
00299             }
00300             catch (Exception ex)
00301             {
00302                 txtExceptionReport.Text = ex.ToString();
00303                 AppendEventMessage(ex.ToString());
00304             }
00305         }
00306
00307         private void DataSourceInsertItem(int newItemIndex)
00308         {
00309             try
00310             {
00311                 if (itemsControl != null && itemsControl.ItemsSource != null)
00312                 {
00313                     if (itemsControl.ItemsSource == _colEntities)
00314                     {
00315                         BitmapImage bitmapImage = GetBitmapImage(_colEntities.Count % 126 + 1);
00316
00317                         var entity = new Entity()
00318                         {
00319                             BitmapImage = bitmapImage,
00320                             Id = _colEntities.Count
00321                         };
00322
00323                         _colEntities.Insert(newItemIndex, entity);
00324                     }
00325                 }
00326             }
00327             catch (Exception ex)
00328             {
00329                 txtExceptionReport.Text = ex.ToString();
00330                 AppendEventMessage(ex.ToString());
00331             }
00332         }
00333
00334         private void DataSourceRemoveAllItems()
00335         {
00336             try
00337             {
00338                 if (itemsControl != null && itemsControl.ItemsSource != null)
00339                 {
00340                     if (itemsControl.ItemsSource == _colEntities)
00341                     {
00342                         _colEntities.Clear();
00343                     }
00344                 }
00345             }
00346             catch (Exception ex)
00347             {
00348                 txtExceptionReport.Text = ex.ToString();
00349                 AppendEventMessage(ex.ToString());
00350             }
00351         }
00352
00353         private void DataSourceRemoveItem(int oldItemIndex)
00354         {
00355             try
00356             {
00357                 if (itemsControl != null && itemsControl.ItemsSource != null)
00358                 {
00359                     if (itemsControl.ItemsSource == _colEntities)
00360                     {
00361                         _colEntities.RemoveAt(oldItemIndex);
00362                     }
00363                 }
00364             }
00365             catch (Exception ex)
00366             {
00367                 txtExceptionReport.Text = ex.ToString();
00368                 AppendEventMessage(ex.ToString());
00369             }
00370         }
00371
00372         private void DataSourceReplaceItem(int itemIndex)
00373         {
00374             try
00375             {
00376                 if (itemsControl != null && itemsControl.ItemsSource != null)
00377                 {
00378                     if (itemsControl.ItemsSource == _colEntities)
00379                     {
00380                         BitmapImage bitmapImage = GetBitmapImage(_colEntities.Count % 126 + 1);
00381
00382                         var entity = new Entity()
00383                         {
00384                             BitmapImage = bitmapImage,
00385                             Id = _colEntities.Count
00386                         };
00387
00388                         _colEntities[itemIndex] = entity;
00389                     }
00390                 }
00391             }
00392             catch (Exception ex)
00393             {
00394                 txtExceptionReport.Text = ex.ToString();
00395                 AppendEventMessage(ex.ToString());
00396             }
00397         }
00398
00399         private void BtnGetItemsControlTabNavigation_Click(object sender, RoutedEventArgs e)
00400         {
00401             UpdateItemsControlTabNavigation();
00402         }
00403
00404         private void BtnSetItemsControlTabNavigation_Click(object sender, RoutedEventArgs e)
00405         {
00406             if (itemsControl != null && cmbItemsControlTabNavigation != null)
00407             {
00408                 itemsControl.TabNavigation = (KeyboardNavigationMode)cmbItemsControlTabNavigation.SelectedIndex;
00409             }
00410         }
00411
00412         private void BtnGetItemsControlXYFocusKeyboardNavigation_Click(object sender, RoutedEventArgs e)
00413         {
00414             UpdateItemsControlXYFocusKeyboardNavigation();
00415         }
00416
00417         private void BtnSetItemsControlXYFocusKeyboardNavigation_Click(object sender, RoutedEventArgs e)
00418         {
00419             if (itemsControl != null && cmbItemsControlXYFocusKeyboardNavigation != null)
00420             {
00421                 itemsControl.XYFocusKeyboardNavigation = (XYFocusKeyboardNavigationMode)cmbItemsControlXYFocusKeyboardNavigation.SelectedIndex;
00422             }
00423         }
00424
00425         private void CmbItemsPresenterHeader_SelectionChanged(object sender, SelectionChangedEventArgs e)
00426         {
00427             try
00428             {
00429                 if (itemsControl != null && cmbItemsPresenterHeader != null)
00430                 {
00431                     ItemsPresenter itemsPresenter = FindElementOfTypeInSubtree<ItemsPresenter>(itemsControl);
00432
00433                     if (itemsPresenter != null)
00434                     {
00435                         switch (cmbItemsPresenterHeader.SelectedIndex)
00436                         {
00437                             case 0: /*None*/
00438                                 itemsPresenter.Header = null;
00439                                 break;
00440                             case 1: /*No TabStop*/
00441                                 itemsPresenter.Header = new TextBlock()
00442                                 {
00443                                     FontSize = 18.0,
00444                                     Margin = new Thickness(10.0),
00445                                     Text = "ItemsPresenter Header"
00446                                 };
00447                                 break;
00448                             case 2: /*Single TabStop*/
00449                                 itemsPresenter.Header = new Button()
00450                                 {
00451                                     Content = "ItemsPresenter Header",
00452                                     FontSize = 18.0,
00453                                     Margin = new Thickness(10.0)
00454                                 };
00455                                 break;
00456                             case 3: /*Nested TabStops*/
00457                                 itemsPresenter.Header = new Button()
00458                                 {
00459                                     Content = new Button()
00460                                     {
00461                                         Content = "ItemsPresenter Header",
00462                                         Margin = new Thickness(10.0)
00463                                     },
00464                                     FontSize = 18.0,
00465                                     Margin = new Thickness(10.0)
00466                                 };
00467                                 break;
00468                         }
00469                     }
00470                 }
00471             }
00472             catch (Exception ex)
00473             {
00474                 txtExceptionReport.Text = ex.ToString();
00475                 AppendEventMessage(ex.ToString());
00476             }
00477         }
00478
00479         private void CmbItemsPresenterFooter_SelectionChanged(object sender, SelectionChangedEventArgs e)
00480         {
00481             try
00482             {
00483                 if (itemsControl != null && cmbItemsPresenterFooter != null)
00484                 {
00485                     ItemsPresenter itemsPresenter = FindElementOfTypeInSubtree<ItemsPresenter>(itemsControl);
00486
00487                     if (itemsPresenter != null)
00488                     {
00489                         switch (cmbItemsPresenterFooter.SelectedIndex)
00490                         {
00491                             case 0: /*None*/
00492                                 itemsPresenter.Footer = null;
00493                                 break;
00494                             case 1: /*No TabStop*/
00495                                 itemsPresenter.Footer = new TextBlock()
00496                                 {
00497                                     FontSize = 18.0,
00498                                     Margin = new Thickness(10.0),
00499                                     Text = "ItemsPresenter Footer"
00500                                 };
00501                                 break;
00502                             case 2: /*Single TabStop*/
00503                                 itemsPresenter.Footer = new Button()
00504                                 {
00505                                     Content = "ItemsPresenter Footer",
00506                                     FontSize = 18.0,
00507                                     Margin = new Thickness(10.0)
00508                                 };
00509                                 break;
00510                             case 3: /*Nested TabStops*/
00511                                 itemsPresenter.Footer = new Button()
00512                                 {
00513                                     Content = new Button()
00514                                     {
00515                                         Content = "ItemsPresenter Footer",
00516                                         Margin = new Thickness(10.0)
00517                                     },
00518                                     FontSize = 18.0,
00519                                     Margin = new Thickness(10.0)
00520                                 };
00521                                 break;
00522                         }
00523                     }
00524                 }
00525             }
00526             catch (Exception ex)
00527             {
00528                 txtExceptionReport.Text = ex.ToString();
00529                 AppendEventMessage(ex.ToString());
00530             }
00531         }
00532
00533         private void CmbItemsControlItemTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
00534         {
00535             UpdateItemsControlItemTemplate();
00536         }
00537
00538         private void CmbItemsControlItemsPanelType_SelectionChanged(object sender, SelectionChangedEventArgs e)
00539         {
00540             UpdateItemsPanelType();
00541         }
00542
00543         private void ChkItemsControlIsTabStop_IsCheckedChanged(object sender, RoutedEventArgs e)
00544         {
00545             if (itemsControl != null && chkItemsControlIsTabStop != null)
00546             {
00547                 itemsControl.IsTabStop = (bool)chkItemsControlIsTabStop.IsChecked;
00548             }
00549         }
00550
00551         private void BtnGetItemsPanelOrientation_Click(object sender, RoutedEventArgs e)
00552         {
00553             UpdateItemsPanelOrientation();
00554         }
00555
00556         private void BtnSetItemsPanelOrientation_Click(object sender, RoutedEventArgs e)
00557         {
00558             if (itemsControl != null && cmbItemsPanelOrientation != null)
00559             {
00560                 ItemsWrapGrid itemsWrapGrid = itemsControl.ItemsPanelRoot as ItemsWrapGrid;
00561
00562                 if (itemsWrapGrid != null)
00563                 {
00564                     itemsControl.ItemsSource = null;
00565
00566                     itemsWrapGrid.Orientation = (Orientation)cmbItemsPanelOrientation.SelectedIndex;
00567                 }
00568                 else
00569                 {
00570                     ItemsStackPanel itemsStackPanel = itemsControl.ItemsPanelRoot as ItemsStackPanel;
00571
00572                     if (itemsStackPanel != null)
00573                     {
00574                         itemsControl.ItemsSource = null;
00575
00576                         itemsStackPanel.Orientation = (Orientation)cmbItemsPanelOrientation.SelectedIndex;
00577                     }
00578                     else
00579                     {
00580                         VirtualizingStackPanel virtualizingStackPanel = itemsControl.ItemsPanelRoot as VirtualizingStackPanel;
00581
00582                         if (virtualizingStackPanel != null)
00583                         {
00584                             virtualizingStackPanel.Orientation = (Orientation)cmbItemsPanelOrientation.SelectedIndex;
00585                         }
00586                         else
00587                         {
00588                             StackPanel stackPanel = itemsControl.ItemsPanelRoot as StackPanel;
00589
00590                             if (stackPanel != null)
00591                             {
00592                                 stackPanel.Orientation = (Orientation)cmbItemsPanelOrientation.SelectedIndex;
00593                             }
00594                         }
00595                     }
00596                 }
00597
00598                 itemsControl.ItemsSource = _colEntities;
00599             }
00600         }
00601
00602         private void BtnGetItemsPanelMargin_Click(object sender, RoutedEventArgs e)
00603         {
00604             UpdateItemsPanelMargin();
00605         }
00606
00607         private void BtnSetItemsPanelMargin_Click(object sender, RoutedEventArgs e)
00608         {
00609             try
00610             {
00611                 if (itemsControl != null && txtItemsPanelMargin != null)
00612                 {
00613                     Panel itemsPanel = itemsControl.ItemsPanelRoot;
00614
00615                     if (itemsPanel != null)
00616                     {
00617                         itemsPanel.Margin = GetThicknessFromString(txtItemsPanelMargin.Text);
00618                     }
00619                 }
00620             }
00621             catch (Exception ex)
00622             {
00623                 txtExceptionReport.Text = ex.ToString();
00624                 AppendEventMessage(ex.ToString());
00625             }
00626         }
00627
00628         private void NbItemsWrapGridMaximumRowsOrColumns_ValueChanged(object sender, object e)
00629         {
00630             try
00631             {
00632                 if (itemsControl != null && nbItemsWrapGridMaximumRowsOrColumns != null)
00633                 {
00634                     ItemsWrapGrid itemsWrapGrid = itemsControl.ItemsPanelRoot as ItemsWrapGrid;
00635
00636                     if (itemsWrapGrid != null)
00637                     {
00638                         itemsWrapGrid.MaximumRowsOrColumns = (int)nbItemsWrapGridMaximumRowsOrColumns.Value;
00639                     }
00640                 }
00641             }
00642             catch (Exception ex)
00643             {
00644                 txtExceptionReport.Text = ex.ToString();
00645                 AppendEventMessage(ex.ToString());
00646             }
00647         }
00648
00649         private void BtnDataSourceGetItemCount_Click(object sender, RoutedEventArgs e)
00650         {
00651             UpdateDataSourceItemCount();
00652         }
00653
00654         private void BtnDataSourceSetItemCount_Click(object sender, RoutedEventArgs e)
00655         {
00656             try
00657             {
00658                 if (itemsControl != null && itemsControl.ItemsSource != null && txtDataSourceItemCount != null)
00659                 {
00660                     int newItemCount = int.Parse(txtDataSourceItemCount.Text);
00661
00662                     if (itemsControl.ItemsSource == _colEntities)
00663                     {
00664                         if (_colEntities.Count < newItemCount)
00665                         {
00666                             var colEntitiesEnd = new List<Entity>();
00667
00668                             for (int itemIndex = 0; itemIndex < newItemCount - _colEntities.Count; itemIndex++)
00669                             {
00670                                 BitmapImage bitmapImage = GetBitmapImage(itemIndex % 126 + 1);
00671
00672                                 colEntitiesEnd.Add(new Entity()
00673                                 {
00674                                     BitmapImage = bitmapImage,
00675                                     Id = itemIndex
00676                                 });
00677                             }
00678
00679                             _colEntities = new ObservableCollection<Entity>(_colEntities.Concat(colEntitiesEnd));
00680                         }
00681                         else if (_colEntities.Count > newItemCount)
00682                         {
00683                             _colEntities = new ObservableCollection<Entity>(_colEntities.Take(newItemCount));
00684                         }
00685
00686                         itemsControl.ItemsSource = _colEntities;
00687                     }
00688                 }
00689             }
00690             catch (Exception ex)
00691             {
00692                 txtExceptionReport.Text = ex.ToString();
00693                 AppendEventMessage(ex.ToString());
00694             }
00695         }
00696
00697         private void BtnDataSourceAddItem_Click(object sender, RoutedEventArgs e)
00698         {
00699             AppendEventMessage("DataSourceAdd");
00700             DataSourceAddItem();
00701         }
00702
00703         private void BtnDataSourceInsertItem_Click(object sender, RoutedEventArgs e)
00704         {
00705             try
00706             {
00707                 if (txtDataSourceItemIndex != null)
00708                 {
00709                     int newItemIndex = int.Parse(txtDataSourceItemIndex.Text);
00710
00711                     AppendEventMessage("DataSourceInsert " + newItemIndex);
00712                     DataSourceInsertItem(newItemIndex);
00713                 }
00714             }
00715             catch (Exception ex)
00716             {
00717                 txtExceptionReport.Text = ex.ToString();
00718                 AppendEventMessage(ex.ToString());
00719             }
00720         }
00721
00722         private void BtnDataSourceRemoveAllItems_Click(object sender, RoutedEventArgs e)
00723         {
00724             AppendEventMessage("DataSourceRemoveAll");
00725             DataSourceRemoveAllItems();
00726         }
00727
00728         private void BtnDataSourceRemoveItem_Click(object sender, RoutedEventArgs e)
00729         {
00730             try
00731             {
00732                 if (txtDataSourceItemIndex != null)
00733                 {
00734                     int oldItemIndex = int.Parse(txtDataSourceItemIndex.Text);
00735
00736                     AppendEventMessage("DataSourceRemove " + oldItemIndex);
00737                     DataSourceRemoveItem(oldItemIndex);
00738                 }
00739             }
00740             catch (Exception ex)
00741             {
00742                 txtExceptionReport.Text = ex.ToString();
00743                 AppendEventMessage(ex.ToString());
00744             }
00745         }
00746
00747         private void BtnDataSourceReplaceItem_Click(object sender, RoutedEventArgs e)
00748         {
00749             try
00750             {
00751                 if (txtDataSourceItemIndex != null)
00752                 {
00753                     int itemIndex = int.Parse(txtDataSourceItemIndex.Text);
00754
00755                     AppendEventMessage("DataSourceReplace " + itemIndex);
00756                     DataSourceReplaceItem(itemIndex);
00757                 }
00758             }
00759             catch (Exception ex)
00760             {
00761                 txtExceptionReport.Text = ex.ToString();
00762                 AppendEventMessage(ex.ToString());
00763             }
00764         }
00765
00766         private void ChkItemsControlProperties_Checked(object sender, RoutedEventArgs e)
00767         {
00768             if (svItemsControlProperties != null)
00769                 svItemsControlProperties.Visibility = Visibility.Visible;
00770         }
00771
00772         private void ChkItemsControlProperties_Unchecked(object sender, RoutedEventArgs e)
00773         {
00774             if (svItemsControlProperties != null)
00775                 svItemsControlProperties.Visibility = Visibility.Collapsed;
00776         }
00777
00778         private void ChkDataSource_Checked(object sender, RoutedEventArgs e)
00779         {
00780             if (svDataSource != null)
00781                 svDataSource.Visibility = Visibility.Visible;
00782         }
00783
00784         private void ChkDataSource_Unchecked(object sender, RoutedEventArgs e)
00785         {
00786             if (svDataSource != null)
00787                 svDataSource.Visibility = Visibility.Collapsed;
00788         }
00789
00790         private void ChkLogs_Checked(object sender, RoutedEventArgs e)
00791         {
00792             if (grdLogs != null)
00793                 grdLogs.Visibility = Visibility.Visible;
00794         }
00795
00796         private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
00797         {
00798             if (grdLogs != null)
00799                 grdLogs.Visibility = Visibility.Collapsed;
00800         }
00801
00802         private void AppendEventMessage(string eventMessage)
00803         {
00804             lstLogs.Items.Add(eventMessage);
00805         }
00806
00807         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00808         {
00809             txtExceptionReport.Text = string.Empty;
00810         }
00811
00812         private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
00813         {
00814             lstLogs.Items.Clear();
00815         }
00816
00817         private Thickness GetThicknessFromString(string thickness)
00818         {
00819             string[] lengths = thickness.Split(',');
00820             if (lengths.Length < 4)
00821                 return new Thickness(
00822                     Convert.ToDouble(lengths[0]));
00823             else
00824                 return new Thickness(
00825                     Convert.ToDouble(lengths[0]), Convert.ToDouble(lengths[1]), Convert.ToDouble(lengths[2]), Convert.ToDouble(lengths[3]));
00826         }
00827
00828         private static T FindElementOfTypeInSubtree<T>(DependencyObject element) where T : DependencyObject
00829         {
00830             if (element == null)
00831                 return null;
00832
00833             if (element is T)
00834                 return (T)element;
00835
00836             int childrenCount = VisualTreeHelper.GetChildrenCount(element);
00837             for (int i = 0; i < childrenCount; i++)
00838             {
00839                 var result = FindElementOfTypeInSubtree<T>(VisualTreeHelper.GetChild(element, i));
00840                 if (result != null)
00841                     return result;
00842             }
00843
00844             return null;
00845         }
00846     }
00847 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/PipsPager.properties.h Source File

  • Generated

PipsPager.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class PipsPagerProperties
00008 {
00009 public:
00010     PipsPagerProperties();
00011
00012     void MaxVisiblePips(int value);
00013     int MaxVisiblePips();
00014
00015     void NextButtonStyle(winrt::Style const& value);
00016     winrt::Style NextButtonStyle();
00017
00018     void NextButtonVisibility(winrt::PipsPagerButtonVisibility const& value);
00019     winrt::PipsPagerButtonVisibility NextButtonVisibility();
00020
00021     void NormalPipStyle(winrt::Style const& value);
00022     winrt::Style NormalPipStyle();
00023
00024     void NumberOfPages(int value);
00025     int NumberOfPages();
00026
00027     void Orientation(winrt::Orientation const& value);
00028     winrt::Orientation Orientation();
00029
00030     void PreviousButtonStyle(winrt::Style const& value);
00031     winrt::Style PreviousButtonStyle();
00032
00033     void PreviousButtonVisibility(winrt::PipsPagerButtonVisibility const& value);
00034     winrt::PipsPagerButtonVisibility PreviousButtonVisibility();
00035
00036     void SelectedPageIndex(int value);
00037     int SelectedPageIndex();
00038
00039     void SelectedPipStyle(winrt::Style const& value);
00040     winrt::Style SelectedPipStyle();
00041
00042     void TemplateSettings(winrt::PipsPagerTemplateSettings const& value);
00043     winrt::PipsPagerTemplateSettings TemplateSettings();
00044
00045     void WrapMode(winrt::PipsPagerWrapMode const& value);
00046     winrt::PipsPagerWrapMode WrapMode();
00047
00048     static winrt::DependencyProperty MaxVisiblePipsProperty() { return s_MaxVisiblePipsProperty; }
00049     static winrt::DependencyProperty NextButtonStyleProperty() { return s_NextButtonStyleProperty; }
00050     static winrt::DependencyProperty NextButtonVisibilityProperty() { return s_NextButtonVisibilityProperty; }
00051     static winrt::DependencyProperty NormalPipStyleProperty() { return s_NormalPipStyleProperty; }
00052     static winrt::DependencyProperty NumberOfPagesProperty() { return s_NumberOfPagesProperty; }
00053     static winrt::DependencyProperty OrientationProperty() { return s_OrientationProperty; }
00054     static winrt::DependencyProperty PreviousButtonStyleProperty() { return s_PreviousButtonStyleProperty; }
00055     static winrt::DependencyProperty PreviousButtonVisibilityProperty() { return s_PreviousButtonVisibilityProperty; }
00056     static winrt::DependencyProperty SelectedPageIndexProperty() { return s_SelectedPageIndexProperty; }
00057     static winrt::DependencyProperty SelectedPipStyleProperty() { return s_SelectedPipStyleProperty; }
00058     static winrt::DependencyProperty TemplateSettingsProperty() { return s_TemplateSettingsProperty; }
00059     static winrt::DependencyProperty WrapModeProperty() { return s_WrapModeProperty; }
00060
00061     static GlobalDependencyProperty s_MaxVisiblePipsProperty;
00062     static GlobalDependencyProperty s_NextButtonStyleProperty;
00063     static GlobalDependencyProperty s_NextButtonVisibilityProperty;
00064     static GlobalDependencyProperty s_NormalPipStyleProperty;
00065     static GlobalDependencyProperty s_NumberOfPagesProperty;
00066     static GlobalDependencyProperty s_OrientationProperty;
00067     static GlobalDependencyProperty s_PreviousButtonStyleProperty;
00068     static GlobalDependencyProperty s_PreviousButtonVisibilityProperty;
00069     static GlobalDependencyProperty s_SelectedPageIndexProperty;
00070     static GlobalDependencyProperty s_SelectedPipStyleProperty;
00071     static GlobalDependencyProperty s_TemplateSettingsProperty;
00072     static GlobalDependencyProperty s_WrapModeProperty;
00073
00074     winrt::event_token SelectedIndexChanged(winrt::TypedEventHandler<winrt::PipsPager, winrt::PipsPagerSelectedIndexChangedEventArgs> const& value);
00075     void SelectedIndexChanged(winrt::event_token const& token);
00076
00077     event_source<winrt::TypedEventHandler<winrt::PipsPager, winrt::PipsPagerSelectedIndexChangedEventArgs>> m_selectedIndexChangedEventSource;
00078
00079     static void EnsureProperties();
00080     static void ClearProperties();
00081
00082     static void OnMaxVisiblePipsPropertyChanged(
00083         winrt::DependencyObject const& sender,
00084         winrt::DependencyPropertyChangedEventArgs const& args);
00085
00086     static void OnNextButtonStylePropertyChanged(
00087         winrt::DependencyObject const& sender,
00088         winrt::DependencyPropertyChangedEventArgs const& args);
00089
00090     static void OnNextButtonVisibilityPropertyChanged(
00091         winrt::DependencyObject const& sender,
00092         winrt::DependencyPropertyChangedEventArgs const& args);
00093
00094     static void OnNormalPipStylePropertyChanged(
00095         winrt::DependencyObject const& sender,
00096         winrt::DependencyPropertyChangedEventArgs const& args);
00097
00098     static void OnNumberOfPagesPropertyChanged(
00099         winrt::DependencyObject const& sender,
00100         winrt::DependencyPropertyChangedEventArgs const& args);
00101
00102     static void OnOrientationPropertyChanged(
00103         winrt::DependencyObject const& sender,
00104         winrt::DependencyPropertyChangedEventArgs const& args);
00105
00106     static void OnPreviousButtonStylePropertyChanged(
00107         winrt::DependencyObject const& sender,
00108         winrt::DependencyPropertyChangedEventArgs const& args);
00109
00110     static void OnPreviousButtonVisibilityPropertyChanged(
00111         winrt::DependencyObject const& sender,
00112         winrt::DependencyPropertyChangedEventArgs const& args);
00113
00114     static void OnSelectedPageIndexPropertyChanged(
00115         winrt::DependencyObject const& sender,
00116         winrt::DependencyPropertyChangedEventArgs const& args);
00117
00118     static void OnSelectedPipStylePropertyChanged(
00119         winrt::DependencyObject const& sender,
00120         winrt::DependencyPropertyChangedEventArgs const& args);
00121
00122     static void OnTemplateSettingsPropertyChanged(
00123         winrt::DependencyObject const& sender,
00124         winrt::DependencyPropertyChangedEventArgs const& args);
00125
00126     static void OnWrapModePropertyChanged(
00127         winrt::DependencyObject const& sender,
00128         winrt::DependencyPropertyChangedEventArgs const& args);
00129 };
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TextControlsPage Member List

This is the complete list of members for TextControlsPage, including all inherited members.
isRootGridDefaultSize | TextControlsPage | [private]
ResizeRootGrid(object sender, RoutedEventArgs e) | TextControlsPage | [inline, private]
TextControlsPage() | TextControlsPage | [inline]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewItemExpandingEventArgs Member List

This is the complete list of members for NavigationViewItemExpandingEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
CheckThread() | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< NavigationViewItemExpandingEventArgs > &&self) noexcept | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
ExpandingItem() | NavigationViewItemExpandingEventArgs |
ExpandingItemContainer() | NavigationViewItemExpandingEventArgs |
ExpandingItemContainer(winrt::NavigationViewItemBase const &value) | NavigationViewItemExpandingEventArgs |
final_release(std::unique_ptr< NavigationViewItemExpandingEventArgs > &&self) | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
GetInner() | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
IsOnThread() | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
NavigationViewItemExpandingEventArgs(const winrt::NavigationView &navigationView) | NavigationViewItemExpandingEventArgs |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< NavigationViewItemExpandingEventArgs, winrt::implementation::NavigationViewItemExpandingEventArgsT, winrt::composing, winrt::composable > | [inline]
Generated on Sun Dec 1 2024 20:52:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterAnchoring.cpp Source File

  • ScrollPresenter

ScrollPresenterAnchoring.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "ScrollPresenter.h"
00009 #include "DoubleUtil.h"
00010 #include "ScrollPresenterTestHooks.h"
00011
00012 // Used when ScrollPresenter.HorizontalAnchorRatio or ScrollPresenter.VerticalAnchorRatio is 0.0 or 1.0 to determine whether the Content is scrolled to an edge.
00013 // It is declared at an edge if it's within 1/10th of a pixel.
00014 const double c_edgeDetectionTolerance = 0.1;
00015
00016 void ScrollPresenter::RaiseConfigurationChanged()
00017 {
00018     if (m_configurationChanged)
00019     {
00020         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00021
00022         m_configurationChanged(*this);
00023     }
00024 }
00025
00026 void ScrollPresenter::RaisePostArrange()
00027 {
00028     if (m_postArrange)
00029     {
00030         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00031
00032         m_postArrange(*this);
00033     }
00034 }
00035
00036 void ScrollPresenter::RaiseViewportChanged(const bool isFinal)
00037 {
00038     if (m_viewportChanged)
00039     {
00040         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00041
00042         m_viewportChanged(*this, isFinal);
00043     }
00044 }
00045
00046 void ScrollPresenter::RaiseAnchorRequested()
00047 {
00048     if (m_anchorRequestedEventSource)
00049     {
00050         SCROLLPRESENTER_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00051
00052         if (!m_anchorRequestedEventArgs)
00053         {
00054             m_anchorRequestedEventArgs = tracker_ref<winrt::ScrollingAnchorRequestedEventArgs>(this, winrt::make<ScrollingAnchorRequestedEventArgs>(*this));
00055         }
00056
00057         com_ptr<ScrollingAnchorRequestedEventArgs> anchorRequestedEventArgs = winrt::get_self<ScrollingAnchorRequestedEventArgs>(m_anchorRequestedEventArgs.get())->get_strong();
00058
00059         anchorRequestedEventArgs->SetAnchorElement(nullptr);
00060         anchorRequestedEventArgs->SetAnchorCandidates(m_anchorCandidates);
00061         m_anchorRequestedEventSource(*this, *anchorRequestedEventArgs);
00062     }
00063 }
00064
00065 // Computes the type of anchoring to perform, if any, based on ScrollPresenter.HorizontalAnchorRatio, ScrollPresenter.VerticalAnchorRatio,
00066 // the current offsets, zoomFactor, viewport size, content size and state.
00067 // When all 4 returned booleans are False, no element anchoring is performed, no far edge anchoring is performed. There may still be anchoring at near edges.
00068 void ScrollPresenter::IsAnchoring(
00069     _Out_ bool* isAnchoringElementHorizontally,
00070     _Out_ bool* isAnchoringElementVertically,
00071     _Out_opt_ bool* isAnchoringFarEdgeHorizontally,
00072     _Out_opt_ bool* isAnchoringFarEdgeVertically)
00073 {
00074     *isAnchoringElementHorizontally = false;
00075     *isAnchoringElementVertically = false;
00076     if (isAnchoringFarEdgeHorizontally)
00077     {
00078         *isAnchoringFarEdgeHorizontally = false;
00079     }
00080     if (isAnchoringFarEdgeVertically)
00081     {
00082         *isAnchoringFarEdgeVertically = false;
00083     }
00084
00085     // Mouse wheel comes in as a custom animation, and we are currently not
00086     // anchoring because of the check below. Unfortunately, I cannot validate that
00087     // removing the check is the correct fix due to dcomp bug 17523225. I filed a
00088     // tracking bug to follow up once the dcomp bug is fixed.
00089     // Bug 17523266: ScrollPresenter is not anchoring during mouse wheel
00090     if (!m_interactionTracker || m_state == winrt::ScrollingInteractionState::Animation)
00091     {
00092         // Skip calls to SetContentLayoutOffsetX / SetContentLayoutOffsetY when the InteractionTracker has not been set up yet,
00093         // or when it is performing a custom animation because if would result in a visual flicker.
00094         return;
00095     }
00096
00097     const double horizontalAnchorRatio = HorizontalAnchorRatio();
00098     const double verticalAnchorRatio = VerticalAnchorRatio();
00099
00100     // For edge anchoring, the near edge is considered when HorizontalAnchorRatio or VerticalAnchorRatio is 0.0.
00101     // When the property is 1.0, the far edge is considered.
00102     if (!isnan(horizontalAnchorRatio))
00103     {
00104         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"HorizontalAnchorRatio", horizontalAnchorRatio);
00105
00106         MUX_ASSERT(horizontalAnchorRatio >= 0.0);
00107         MUX_ASSERT(horizontalAnchorRatio <= 1.0);
00108
00109         if (horizontalAnchorRatio == 0.0 || horizontalAnchorRatio == 1.0)
00110         {
00111             if (horizontalAnchorRatio == 1.0 && m_zoomedHorizontalOffset + m_viewportWidth - m_unzoomedExtentWidth * m_zoomFactor > -c_edgeDetectionTolerance)
00112             {
00113                 if (isAnchoringFarEdgeHorizontally)
00114                 {
00115                     *isAnchoringFarEdgeHorizontally = true;
00116                 }
00117             }
00118             else if (!(horizontalAnchorRatio == 0.0 && m_zoomedHorizontalOffset < c_edgeDetectionTolerance))
00119             {
00120                 *isAnchoringElementHorizontally = true;
00121             }
00122         }
00123         else
00124         {
00125             *isAnchoringElementHorizontally = true;
00126         }
00127     }
00128
00129     if (!isnan(verticalAnchorRatio))
00130     {
00131         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"VerticalAnchorRatio", verticalAnchorRatio);
00132
00133         MUX_ASSERT(verticalAnchorRatio >= 0.0);
00134         MUX_ASSERT(verticalAnchorRatio <= 1.0);
00135
00136         if (verticalAnchorRatio == 0.0 || verticalAnchorRatio == 1.0)
00137         {
00138             if (verticalAnchorRatio == 1.0 && m_zoomedVerticalOffset + m_viewportHeight - m_unzoomedExtentHeight * m_zoomFactor > -c_edgeDetectionTolerance)
00139             {
00140                 if (isAnchoringFarEdgeVertically)
00141                 {
00142                     *isAnchoringFarEdgeVertically = true;
00143                 }
00144             }
00145             else if (!(verticalAnchorRatio == 0.0 && m_zoomedVerticalOffset < c_edgeDetectionTolerance))
00146             {
00147                 *isAnchoringElementVertically = true;
00148             }
00149         }
00150         else
00151         {
00152             *isAnchoringElementVertically = true;
00153         }
00154     }
00155
00156 #ifdef DBG
00157     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"isAnchoringElementHorizontally", *isAnchoringElementHorizontally);
00158     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"isAnchoringElementVertically", *isAnchoringElementVertically);
00159
00160     if (isAnchoringFarEdgeHorizontally)
00161     {
00162         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"isAnchoringFarEdgeHorizontally", *isAnchoringFarEdgeHorizontally);
00163     }
00164     if (isAnchoringFarEdgeVertically)
00165     {
00166         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"isAnchoringFarEdgeVertically", *isAnchoringFarEdgeVertically);
00167     }
00168 #endif
00169 }
00170
00171 // Returns:
00172 // - viewportAnchorPointHorizontalOffset: unzoomed horizontal offset of the anchor point within the ScrollPresenter.Content. NaN if there is no horizontal anchoring.
00173 // - viewportAnchorPointVerticalOffset: unzoomed vertical offset of the anchor point within the ScrollPresenter.Content. NaN if there is no vertical anchoring.
00174 void ScrollPresenter::ComputeViewportAnchorPoint(
00175     double viewportWidth,
00176     double viewportHeight,
00177     _Out_ double* viewportAnchorPointHorizontalOffset,
00178     _Out_ double* viewportAnchorPointVerticalOffset)
00179 {
00180     *viewportAnchorPointHorizontalOffset = DoubleUtil::NaN;
00181     *viewportAnchorPointVerticalOffset = DoubleUtil::NaN;
00182
00183     const winrt::Rect viewportAnchorBounds{
00184         static_cast<float>(m_zoomedHorizontalOffset / m_zoomFactor),
00185         static_cast<float>(m_zoomedVerticalOffset / m_zoomFactor),
00186         static_cast<float>(viewportWidth / m_zoomFactor),
00187         static_cast<float>(viewportHeight / m_zoomFactor)
00188     };
00189
00190     ComputeAnchorPoint(viewportAnchorBounds, viewportAnchorPointHorizontalOffset, viewportAnchorPointVerticalOffset);
00191
00192     SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, *viewportAnchorPointHorizontalOffset, *viewportAnchorPointVerticalOffset);
00193 }
00194
00195 // Returns:
00196 // - elementAnchorPointHorizontalOffset: unzoomed horizontal offset of the anchor element's anchor point within the ScrollPresenter.Content. NaN if there is no horizontal anchoring.
00197 // - elementAnchorPointVerticalOffset: unzoomed vertical offset of the anchor element's point within the ScrollPresenter.Content. NaN if there is no vertical anchoring.
00198 void ScrollPresenter::ComputeElementAnchorPoint(
00199     bool isForPreArrange,
00200     _Out_ double* elementAnchorPointHorizontalOffset,
00201     _Out_ double* elementAnchorPointVerticalOffset)
00202 {
00203     *elementAnchorPointHorizontalOffset = DoubleUtil::NaN;
00204     *elementAnchorPointVerticalOffset = DoubleUtil::NaN;
00205
00206     MUX_ASSERT(!m_isAnchorElementDirty);
00207
00208     if (m_anchorElement.get())
00209     {
00210         winrt::Rect anchorElementBounds = isForPreArrange ? m_anchorElementBounds : GetDescendantBounds(Content(), m_anchorElement.get());
00211
00212         ComputeAnchorPoint(anchorElementBounds, elementAnchorPointHorizontalOffset, elementAnchorPointVerticalOffset);
00213
00214         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, *elementAnchorPointHorizontalOffset, *elementAnchorPointVerticalOffset);
00215     }
00216 }
00217
00218 void ScrollPresenter::ComputeAnchorPoint(
00219     const winrt::Rect& anchorBounds,
00220     _Out_ double* anchorPointX,
00221     _Out_ double* anchorPointY)
00222 {
00223     if (isnan(HorizontalAnchorRatio()))
00224     {
00225         *anchorPointX = DoubleUtil::NaN;
00226     }
00227     else
00228     {
00229         MUX_ASSERT(HorizontalAnchorRatio() >= 0.0);
00230         MUX_ASSERT(HorizontalAnchorRatio() <= 1.0);
00231
00232         *anchorPointX = anchorBounds.X + HorizontalAnchorRatio() * anchorBounds.Width;
00233     }
00234
00235     if (isnan(VerticalAnchorRatio()))
00236     {
00237         *anchorPointY = DoubleUtil::NaN;
00238     }
00239     else
00240     {
00241         MUX_ASSERT(VerticalAnchorRatio() >= 0.0);
00242         MUX_ASSERT(VerticalAnchorRatio() <= 1.0);
00243
00244         *anchorPointY = anchorBounds.Y + VerticalAnchorRatio() * anchorBounds.Height;
00245     }
00246 }
00247
00248 // Computes the distance between the viewport's anchor point and the anchor element's anchor point.
00249 winrt::Size ScrollPresenter::ComputeViewportToElementAnchorPointsDistance(
00250     double viewportWidth,
00251     double viewportHeight,
00252     bool isForPreArrange)
00253 {
00254     if (m_anchorElement.get())
00255     {
00256         MUX_ASSERT(!isForPreArrange || IsElementValidAnchor(m_anchorElement.get()));
00257
00258         if (!isForPreArrange && !IsElementValidAnchor(m_anchorElement.get()))
00259         {
00260             return winrt::Size{ FloatUtil::NaN, FloatUtil::NaN };
00261         }
00262
00263         double elementAnchorPointHorizontalOffset{ 0.0 };
00264         double elementAnchorPointVerticalOffset{ 0.0 };
00265         double viewportAnchorPointHorizontalOffset{ 0.0 };
00266         double viewportAnchorPointVerticalOffset{ 0.0 };
00267
00268         ComputeElementAnchorPoint(
00269             isForPreArrange,
00270             &elementAnchorPointHorizontalOffset,
00271             &elementAnchorPointVerticalOffset);
00272         ComputeViewportAnchorPoint(
00273             viewportWidth,
00274             viewportHeight,
00275             &viewportAnchorPointHorizontalOffset,
00276             &viewportAnchorPointVerticalOffset);
00277
00278         MUX_ASSERT(!isnan(viewportAnchorPointHorizontalOffset) || !isnan(viewportAnchorPointVerticalOffset));
00279         MUX_ASSERT(isnan(viewportAnchorPointHorizontalOffset) == isnan(elementAnchorPointHorizontalOffset));
00280         MUX_ASSERT(isnan(viewportAnchorPointVerticalOffset) == isnan(elementAnchorPointVerticalOffset));
00281
00282         // Rounding the distance to 6 precision digits to avoid layout cycles due to float/double conversions.
00283         const winrt::Size viewportToElementAnchorPointsDistance = winrt::Size{
00284             isnan(viewportAnchorPointHorizontalOffset) ?
00285                 FloatUtil::NaN : static_cast<float>(round((elementAnchorPointHorizontalOffset - viewportAnchorPointHorizontalOffset) * 1000000) / 1000000),
00286             isnan(viewportAnchorPointVerticalOffset) ?
00287                 FloatUtil::NaN : static_cast<float>(round((elementAnchorPointVerticalOffset - viewportAnchorPointVerticalOffset) * 1000000) / 1000000)
00288         };
00289
00290         SCROLLPRESENTER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, viewportToElementAnchorPointsDistance.Width, viewportToElementAnchorPointsDistance.Height);
00291
00292         return viewportToElementAnchorPointsDistance;
00293     }
00294     else
00295     {
00296         return winrt::Size{ FloatUtil::NaN, FloatUtil::NaN };
00297     }
00298 }
00299
00300 void ScrollPresenter::ClearAnchorCandidates()
00301 {
00302     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"m_anchorCandidates cleared. m_isAnchorElementDirty set.");
00303
00304     m_anchorCandidates.clear();
00305     m_isAnchorElementDirty = true;
00306 }
00307
00308 void ScrollPresenter::ResetAnchorElement()
00309 {
00310     if (m_anchorElement.get())
00311     {
00312         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"m_anchorElement, m_anchorElementBounds, m_isAnchorElementDirty reset.");
00313
00314         m_anchorElement.set(nullptr);
00315         m_anchorElementBounds = winrt::Rect{};
00316         m_isAnchorElementDirty = false;
00317
00318         com_ptr<ScrollPresenterTestHooks> globalTestHooks = ScrollPresenterTestHooks::GetGlobalTestHooks();
00319
00320         if (globalTestHooks && globalTestHooks->AreAnchorNotificationsRaised())
00321         {
00322             globalTestHooks->NotifyAnchorEvaluated(*this, nullptr /*anchorElement*/, DoubleUtil::NaN /*viewportAnchorPointHorizontalOffset*/, DoubleUtil::NaN /*viewportAnchorPointVerticalOffset*/);
00323         }
00324     }
00325 }
00326
00327 // Raises the ScrollPresenter.AnchorRequested event. If no anchor element was specified, selects an anchor among the candidates vector that may have been altered
00328 // in the AnchorRequested event handler.
00329 void ScrollPresenter::EnsureAnchorElementSelection()
00330 {
00331     if (!m_isAnchorElementDirty)
00332     {
00333         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_anchorElement.get(), L"Early exit as m_isAnchorElementDirty==False.");
00334
00335         return;
00336     }
00337
00338     SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"m_anchorElement, m_anchorElementBounds, m_isAnchorElementDirty reset.");
00339
00340     m_anchorElement.set(nullptr);
00341     m_anchorElementBounds = winrt::Rect{};
00342     m_isAnchorElementDirty = false;
00343
00344     const winrt::UIElement content = Content();
00345
00346     if (!content)
00347     {
00348         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_anchorElement.get(), L"Early exit as Content is null.");
00349
00350         return;
00351     }
00352
00353     com_ptr<ScrollPresenterTestHooks> globalTestHooks = ScrollPresenterTestHooks::GetGlobalTestHooks();
00354     double viewportAnchorPointHorizontalOffset{ 0.0 };
00355     double viewportAnchorPointVerticalOffset{ 0.0 };
00356
00357     ComputeViewportAnchorPoint(
00358         m_viewportWidth,
00359         m_viewportHeight,
00360         &viewportAnchorPointHorizontalOffset,
00361         &viewportAnchorPointVerticalOffset);
00362
00363     MUX_ASSERT(!isnan(viewportAnchorPointHorizontalOffset) || !isnan(viewportAnchorPointVerticalOffset));
00364
00365     RaiseAnchorRequested();
00366
00367     auto anchorRequestedEventArgs = winrt::get_self<ScrollingAnchorRequestedEventArgs>(m_anchorRequestedEventArgs.get());
00368     winrt::UIElement requestedAnchorElement{ nullptr };
00369     winrt::IVector<winrt::UIElement> anchorCandidates{ nullptr };
00370
00371     if (anchorRequestedEventArgs)
00372     {
00373         requestedAnchorElement = anchorRequestedEventArgs->GetAnchorElement();
00374         anchorCandidates = anchorRequestedEventArgs->GetAnchorCandidates();
00375     }
00376
00377     if (requestedAnchorElement)
00378     {
00379         m_anchorElement.set(requestedAnchorElement);
00380         m_anchorElementBounds = GetDescendantBounds(content, requestedAnchorElement);
00381
00382         if (globalTestHooks && globalTestHooks->AreAnchorNotificationsRaised())
00383         {
00384             globalTestHooks->NotifyAnchorEvaluated(*this, requestedAnchorElement, viewportAnchorPointHorizontalOffset, viewportAnchorPointVerticalOffset);
00385         }
00386
00387         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_anchorElement.get(), L"m_anchorElement set from ScrollingAnchorRequestedEventArgs.");
00388         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, TypeLogging::RectToString(m_anchorElementBounds).c_str(), L"m_anchorElementBounds set from ScrollingAnchorRequestedEventArgs.");
00389
00390         return;
00391     }
00392
00393     winrt::Rect bestAnchorCandidateBounds{};
00394     winrt::UIElement bestAnchorCandidate{ nullptr };
00395     double bestAnchorCandidateDistance = std::numeric_limits<float>::max();
00396     const winrt::Rect viewportAnchorBounds{
00397         static_cast<float>(m_zoomedHorizontalOffset / m_zoomFactor),
00398         static_cast<float>(m_zoomedVerticalOffset / m_zoomFactor),
00399         static_cast<float>(m_viewportWidth / m_zoomFactor),
00400         static_cast<float>(m_viewportHeight / m_zoomFactor)
00401     };
00402
00403     MUX_ASSERT(content);
00404
00405     if (anchorCandidates)
00406     {
00407         for (winrt::UIElement anchorCandidate : anchorCandidates)
00408         {
00409             ProcessAnchorCandidate(
00410                 anchorCandidate,
00411                 content,
00412                 viewportAnchorBounds,
00413                 viewportAnchorPointHorizontalOffset,
00414                 viewportAnchorPointVerticalOffset,
00415                 &bestAnchorCandidateDistance,
00416                 &bestAnchorCandidate,
00417                 &bestAnchorCandidateBounds);
00418         }
00419     }
00420     else
00421     {
00422         for (tracker_ref<winrt::UIElement> anchorCandidateTracker : m_anchorCandidates)
00423         {
00424             const winrt::UIElement anchorCandidate = anchorCandidateTracker.get();
00425
00426             ProcessAnchorCandidate(
00427                 anchorCandidate,
00428                 content,
00429                 viewportAnchorBounds,
00430                 viewportAnchorPointHorizontalOffset,
00431                 viewportAnchorPointVerticalOffset,
00432                 &bestAnchorCandidateDistance,
00433                 &bestAnchorCandidate,
00434                 &bestAnchorCandidateBounds);
00435         }
00436     }
00437
00438     if (bestAnchorCandidate)
00439     {
00440         m_anchorElement.set(bestAnchorCandidate);
00441         m_anchorElementBounds = bestAnchorCandidateBounds;
00442
00443         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_anchorElement.get(),
00444             anchorCandidates ? L"m_anchorElement set from anchorCandidates." : L"m_anchorElement set from m_anchorCandidates.");
00445         SCROLLPRESENTER_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, TypeLogging::RectToString(m_anchorElementBounds).c_str(),
00446             anchorCandidates ? L"m_anchorElementBounds set from anchorCandidates." : L"m_anchorElementBounds set from m_anchorCandidates.");
00447     }
00448
00449     if (globalTestHooks && globalTestHooks->AreAnchorNotificationsRaised())
00450     {
00451         globalTestHooks->NotifyAnchorEvaluated(*this, m_anchorElement.get(), viewportAnchorPointHorizontalOffset, viewportAnchorPointVerticalOffset);
00452     }
00453 }
00454
00455 // Checks if the provided anchor candidate is better than the current best, based on its distance to the viewport anchor point,
00456 // and potentially updates the best candidate and its bounds.
00457 void ScrollPresenter::ProcessAnchorCandidate(
00458     const winrt::UIElement& anchorCandidate,
00459     const winrt::UIElement& content,
00460     const winrt::Rect& viewportAnchorBounds,
00461     double viewportAnchorPointHorizontalOffset,
00462     double viewportAnchorPointVerticalOffset,
00463     _Inout_ double* bestAnchorCandidateDistance,
00464     _Inout_ winrt::UIElement* bestAnchorCandidate,
00465     _Inout_ winrt::Rect* bestAnchorCandidateBounds) const
00466 {
00467     MUX_ASSERT(anchorCandidate);
00468     MUX_ASSERT(content);
00469
00470     if (!IsElementValidAnchor(anchorCandidate, content))
00471     {
00472         // Ignore candidates that are collapsed or do not belong to the Content element and are not the Content itself.
00473         return;
00474     }
00475
00476     winrt::Rect anchorCandidateBounds = GetDescendantBounds(content, anchorCandidate);
00477
00478     if (!SharedHelpers::DoRectsIntersect(viewportAnchorBounds, anchorCandidateBounds))
00479     {
00480         // Ignore candidates that do not intersect with the viewport in order to favor those that do.
00481         return;
00482     }
00483
00484     // Using the distances from the viewport anchor point to the four corners of the anchor candidate.
00485     double anchorCandidateDistance{ 0.0 };
00486
00487     if (!isnan(viewportAnchorPointHorizontalOffset))
00488     {
00489         anchorCandidateDistance += std::pow(viewportAnchorPointHorizontalOffset - anchorCandidateBounds.X, 2);
00490         anchorCandidateDistance += std::pow(viewportAnchorPointHorizontalOffset - (static_cast<double>(anchorCandidateBounds.X) + static_cast<double>(anchorCandidateBounds.Width)), 2);
00491     }
00492
00493     if (!isnan(viewportAnchorPointVerticalOffset))
00494     {
00495         anchorCandidateDistance += std::pow(viewportAnchorPointVerticalOffset - anchorCandidateBounds.Y, 2);
00496         anchorCandidateDistance += std::pow(viewportAnchorPointVerticalOffset - (static_cast<double>(anchorCandidateBounds.Y) + static_cast<double>(anchorCandidateBounds.Height)), 2);
00497     }
00498
00499     if (anchorCandidateDistance <= *bestAnchorCandidateDistance)
00500     {
00501         *bestAnchorCandidate = anchorCandidate;
00502         *bestAnchorCandidateBounds = anchorCandidateBounds;
00503         *bestAnchorCandidateDistance = anchorCandidateDistance;
00504     }
00505 }
00506
00507 // Returns the bounds of a ScrollPresenter.Content descendant in respect to that content.
00508 winrt::Rect ScrollPresenter::GetDescendantBounds(
00509     const winrt::UIElement& content,
00510     const winrt::UIElement& descendant)
00511 {
00512     MUX_ASSERT(content);
00513     MUX_ASSERT(IsElementValidAnchor(descendant, content));
00514
00515     const winrt::FrameworkElement descendantAsFE = descendant.as<winrt::FrameworkElement>();
00516     const winrt::Rect descendantRect{
00517         0.0f,
00518         0.0f,
00519         descendantAsFE ? static_cast<float>(descendantAsFE.ActualWidth()) : 0.0f,
00520         descendantAsFE ? static_cast<float>(descendantAsFE.ActualHeight()) : 0.0f
00521     };
00522
00523     return GetDescendantBounds(content, descendant, descendantRect);
00524 }
00525
00526 bool ScrollPresenter::IsElementValidAnchor(const winrt::UIElement& element, const winrt::UIElement& content)
00527 {
00528     MUX_ASSERT(element);
00529     MUX_ASSERT(content);
00530
00531     return element.Visibility() == winrt::Visibility::Visible && (element == content || SharedHelpers::IsAncestor(element, content));
00532 }
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommonStylesVisualTreeTestSamples::CustomizedTranslator Member List

This is the complete list of members for CommonStylesVisualTreeTestSamples::CustomizedTranslator, including all inherited members.
PropertyValueToString(string propertyName, object value) CommonStylesVisualTreeTestSamples::CustomizedTranslator [inline]
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedVisuals/AnimatedChevronDownSmallVisualSource.cpp Source File

  • AnimatedIcon
  • AnimatedVisuals

AnimatedChevronDownSmallVisualSource.cpp

Go to the documentation of this file.
00001 ﻿//------------------------------------------------------------------------------
00002 // <auto-generated>
00003 //     This code was generated by a tool.
00004 //
00005 //       LottieGen version:
00006 //           7.1.0+ge1fa92580f
00007 //
00008 //       Command:
00009 //           LottieGen -Language Cppwinrt -WinUIVersion 2.4 -InputFile AnimatedChevronDownSmallVisualSource.json
00010 //
00011 //       Input file:
00012 //           AnimatedChevronDownSmallVisualSource.json (10093 bytes created 9:26-07:00 Jun 8 2021)
00013 //
00014 //       LottieGen source:
00015 //           http://aka.ms/Lottie
00016 //
00017 //     Changes to this file may cause incorrect behavior and will be lost if
00018 //     the code is regenerated.
00019 // </auto-generated>
00020 //------------------------------------------------------------------------------
00021 // ____________________________________
00022 // |       Object stats       | Count |
00023 // |__________________________|_______|
00024 // | All CompositionObjects   |    53 |
00025 // |--------------------------+-------|
00026 // | Expression animators     |     5 |
00027 // | KeyFrame animators       |     4 |
00028 // | Reference parameters     |     5 |
00029 // | Expression operations    |     4 |
00030 // |--------------------------+-------|
00031 // | Animated brushes         |     1 |
00032 // | Animated gradient stops  |     - |
00033 // | ExpressionAnimations     |     2 |
00034 // | PathKeyFrameAnimations   |     - |
00035 // |--------------------------+-------|
00036 // | ContainerVisuals         |     3 |
00037 // | ShapeVisuals             |     2 |
00038 // |--------------------------+-------|
00039 // | ContainerShapes          |     - |
00040 // | CompositionSpriteShapes  |     2 |
00041 // |--------------------------+-------|
00042 // | Brushes                  |     1 |
00043 // | Gradient stops           |     - |
00044 // | CompositionVisualSurface |     - |
00045 // ------------------------------------
00046 #include "pch.h"
00047 #include "AnimatedVisuals\AnimatedChevronDownSmallVisualSource.h"
00048 #include <winrt/Windows.Foundation.Metadata.h>
00049 #include <winrt/Windows.Foundation.Collections.h>
00050 #include <winrt/Microsoft.UI.Composition.h>
00051 #include "d2d1.h"
00052 #include <d2d1_1.h>
00053 #include <d2d1helper.h>
00054 #include <Windows.Graphics.Interop.h>
00055 #include <Windows.Graphics.Effects.Interop.h>
00056 #include <winrt/Windows.Graphics.Effects.h>
00057
00058 using namespace winrt::Microsoft::UI::Xaml::Controls;
00059 using namespace winrt::Windows::Foundation;
00060 using namespace winrt::Windows::Foundation::Numerics;
00061 using namespace winrt::Windows::Graphics;
00062 using namespace winrt::Windows::UI;
00063 using namespace winrt::Microsoft::UI::Composition;
00064 using TimeSpan = winrt::Windows::Foundation::TimeSpan;
00065
00066 namespace winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals
00067 {
00068     CppWinRTActivatableClassWithBasicFactory(AnimatedChevronDownSmallVisualSource)
00069 }
00070 #include "AnimatedVisuals\AnimatedChevronDownSmallVisualSource.g.cpp"
00071
00072 class CanvasGeometry : public winrt::implements<CanvasGeometry,
00073     IGeometrySource2D,
00074     ::ABI::Windows::Graphics::IGeometrySource2DInterop>
00075 {
00076     winrt::com_ptr<ID2D1Geometry> _geometry{ nullptr };
00077
00078 public:
00079     CanvasGeometry(winrt::com_ptr<ID2D1Geometry> geometry)
00080         : _geometry{ geometry }
00081     { }
00082
00083     // IGeometrySource2D.
00084     winrt::com_ptr<ID2D1Geometry> Geometry() { return _geometry; }
00085
00086     // IGeometrySource2DInterop.
00087     IFACEMETHODIMP GetGeometry(ID2D1Geometry** value) override
00088     {
00089         _geometry.copy_to(value);
00090         return S_OK;
00091     }
00092
00093     // IGeometrySource2DInterop.
00094     IFACEMETHODIMP TryGetGeometryUsingFactory(ID2D1Factory*, ID2D1Geometry**) override
00095     {
00096         return E_NOTIMPL;
00097     }
00098 };
00099 class AnimatedChevronDownSmallVisualSource_AnimatedVisual : public winrt::implements<AnimatedChevronDownSmallVisualSource_AnimatedVisual,
00100         winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual,
00101         IClosable>
00102 {
00103     winrt::com_ptr<ID2D1Factory> _d2dFactory{ nullptr };
00104     static constexpr int64_t c_durationTicks{ 4833333L };
00105     Compositor const _c{ nullptr };
00106     ExpressionAnimation const _reusableExpressionAnimation{ nullptr };
00107     CompositionPropertySet const _themeProperties{ nullptr };
00108     CompositionColorBrush _themeColor_Foreground{ nullptr };
00109     CompositionPathGeometry _pathGeometry{ nullptr };
00110     ContainerVisual _root{ nullptr };
00111     ExpressionAnimation _rootProgress{ nullptr };
00112     InsetClip _insetClip_0{ nullptr };
00113
00114     static void StartProgressBoundAnimation(
00115         CompositionObject target,
00116         winrt::hstring animatedPropertyName,
00117         CompositionAnimation animation,
00118         ExpressionAnimation controllerProgressExpression)
00119     {
00120         target.StartAnimation(animatedPropertyName, animation);
00121         const auto controller = target.TryGetAnimationController(animatedPropertyName);
00122         controller.Pause();
00123         controller.StartAnimation(L"Progress", controllerProgressExpression);
00124     }
00125
00126     void BindProperty(
00127         CompositionObject target,
00128         winrt::hstring animatedPropertyName,
00129         winrt::hstring expression,
00130         winrt::hstring referenceParameterName,
00131         CompositionObject referencedObject)
00132     {
00133         _reusableExpressionAnimation.ClearAllParameters();
00134         _reusableExpressionAnimation.Expression(expression);
00135         _reusableExpressionAnimation.SetReferenceParameter(referenceParameterName, referencedObject);
00136         target.StartAnimation(animatedPropertyName, _reusableExpressionAnimation);
00137     }
00138
00139     BooleanKeyFrameAnimation CreateBooleanKeyFrameAnimation(float initialProgress, bool initialValue)
00140     {
00141         const auto result = _c.CreateBooleanKeyFrameAnimation();
00142         result.Duration(TimeSpan{ c_durationTicks });
00143         result.InsertKeyFrame(initialProgress, initialValue);
00144         return result;
00145     }
00146
00147     Vector2KeyFrameAnimation CreateVector2KeyFrameAnimation(float initialProgress, winrt::float2 initialValue, CompositionEasingFunction initialEasingFunction)
00148     {
00149         const auto result = _c.CreateVector2KeyFrameAnimation();
00150         result.Duration(TimeSpan{ c_durationTicks });
00151         result.InsertKeyFrame(initialProgress, initialValue, initialEasingFunction);
00152         return result;
00153     }
00154
00155     // PreComp layer: Controls - 06 - Dropdown - 05 - PressedToNormal
00156     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_0()
00157     {
00158         // Frame 10.
00159         const auto result = CreateBooleanKeyFrameAnimation(0.344827592F, true);
00160         return result;
00161     }
00162
00163     // PreComp layer: Controls - 06 - Dropdown - 04 - PointerOverToPressed
00164     BooleanKeyFrameAnimation IsVisibleBooleanAnimation_1()
00165     {
00166         // Frame 10.
00167         const auto result = CreateBooleanKeyFrameAnimation(0.344827592F, false);
00168         return result;
00169     }
00170
00171     winrt::com_ptr<CanvasGeometry> Geometry()
00172     {
00173         winrt::com_ptr<ID2D1PathGeometry> path{ nullptr };
00174         winrt::check_hresult(_d2dFactory->CreatePathGeometry(path.put()));
00175         winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
00176         winrt::check_hresult(path->Open(sink.put()));
00177         sink->SetFillMode(D2D1_FILL_MODE_WINDING);
00178         sink->BeginFigure({ -3.85400009F, -2.10400009F }, D2D1_FIGURE_BEGIN_FILLED);
00179         sink->AddBezier({ { -3.65899992F, -2.29900002F }, { -3.34100008F, -2.29900002F }, { -3.14599991F, -2.10400009F } });
00180         sink->AddLine({ 0.0F, 1.04299998F });
00181         sink->AddLine({ 3.14599991F, -2.10400009F });
00182         sink->AddBezier({ { 3.34100008F, -2.29900002F }, { 3.65899992F, -2.29900002F }, { 3.85400009F, -2.10400009F } });
00183         sink->AddBezier({ { 4.04899979F, -1.90900004F }, { 4.04899979F, -1.59099996F }, { 3.85400009F, -1.39600003F } });
00184         sink->AddLine({ 0.354000002F, 2.10400009F });
00185         sink->AddBezier({ { 0.158999994F, 2.29900002F }, { -0.158999994F, 2.29900002F }, { -0.354000002F, 2.10400009F } });
00186         sink->AddLine({ -3.85400009F, -1.39600003F });
00187         sink->AddBezier({ { -4.04899979F, -1.59099996F }, { -4.04899979F, -1.90900004F }, { -3.85400009F, -2.10400009F } });
00188         sink->EndFigure(D2D1_FIGURE_END_CLOSED);
00189         winrt::check_hresult(sink->Close());
00190         auto result = winrt::make_self<CanvasGeometry>(path);
00191         return result;
00192     }
00193
00194     // Color bound to theme property value: Foreground
00195     CompositionColorBrush ThemeColor_Foreground()
00196     {
00197         const auto result = _themeColor_Foreground = _c.CreateColorBrush();
00198         BindProperty(result, L"Color", L"ColorRGB(_theme.Foreground.W,_theme.Foreground.X,_theme.Foreground.Y,_theme.Foreground.Z)", L"_theme", _themeProperties);
00199         return result;
00200     }
00201
00202     CompositionPathGeometry PathGeometry()
00203     {
00204         return _pathGeometry = _c.CreatePathGeometry(CompositionPath(CanvasGeometryToIGeometrySource2D(Geometry())));
00205     }
00206
00207     // - PreComp layer: Controls - 06 - Dropdown - 05 - PressedToNormal
00208     // Transforms for Controls - 06 - Dropdown - 05 - PressedToNormal Scale(1,1,0)
00209     // Path 1
00210     CompositionSpriteShape SpriteShape_0()
00211     {
00212         const auto result = _c.CreateSpriteShape(PathGeometry());
00213         result.Scale({ 4.0F, 4.0F });
00214         result.FillBrush(ThemeColor_Foreground());
00215         StartProgressBoundAnimation(result, L"Offset", OffsetVector2Animation_0(), RootProgress());
00216         return result;
00217     }
00218
00219     // - PreComp layer: Controls - 06 - Dropdown - 04 - PointerOverToPressed
00220     // Transforms for Controls - 06 - Dropdown - 04 - PointerOverToPressed Scale(1,1,0)
00221     // Path 1
00222     CompositionSpriteShape SpriteShape_1()
00223     {
00224         const auto result = _c.CreateSpriteShape(_pathGeometry);
00225         result.Scale({ 4.0F, 4.0F });
00226         result.FillBrush(_themeColor_Foreground);
00227         StartProgressBoundAnimation(result, L"Offset", OffsetVector2Animation_1(), _rootProgress);
00228         return result;
00229     }
00230
00231     // PreComp layer: Controls - 06 - Dropdown - 05 - PressedToNormal
00232     ContainerVisual ContainerVisual_0()
00233     {
00234         const auto result = _c.CreateContainerVisual();
00235         result.Clip(InsetClip_0());
00236         result.IsVisible(false);
00237         result.Size({ 48.0F, 48.0F });
00238         // Scale:<1, 1>
00239         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F });
00240         // Transforms for Controls - 06 - Dropdown - 05 - PressedToNormal Scale(1,1,0)
00241         result.Children().InsertAtTop(ShapeVisual_0());
00242         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_0(), _rootProgress);
00243         return result;
00244     }
00245
00246     // PreComp layer: Controls - 06 - Dropdown - 04 - PointerOverToPressed
00247     ContainerVisual ContainerVisual_1()
00248     {
00249         const auto result = _c.CreateContainerVisual();
00250         result.Clip(_insetClip_0);
00251         result.Size({ 48.0F, 48.0F });
00252         // Scale:<1, 1>
00253         result.TransformMatrix({ 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F });
00254         // Transforms for Controls - 06 - Dropdown - 04 - PointerOverToPressed Scale(1,1,0)
00255         result.Children().InsertAtTop(ShapeVisual_1());
00256         StartProgressBoundAnimation(result, L"IsVisible", IsVisibleBooleanAnimation_1(), _rootProgress);
00257         return result;
00258     }
00259
00260     // The root of the composition.
00261     ContainerVisual Root()
00262     {
00263         const auto result = _root = _c.CreateContainerVisual();
00264         const auto propertySet = result.Properties();
00265         propertySet.InsertScalar(L"Progress", 0.0F);
00266         const auto children = result.Children();
00267         // PreComp layer: Controls - 06 - Dropdown - 05 - PressedToNormal
00268         children.InsertAtTop(ContainerVisual_0());
00269         // PreComp layer: Controls - 06 - Dropdown - 04 - PointerOverToPressed
00270         children.InsertAtTop(ContainerVisual_1());
00271         return result;
00272     }
00273
00274     ExpressionAnimation RootProgress()
00275     {
00276         const auto result = _rootProgress = _c.CreateExpressionAnimation(L"_.Progress");
00277         result.SetReferenceParameter(L"_", _root);
00278         return result;
00279     }
00280
00281     InsetClip InsetClip_0()
00282     {
00283         const auto result = _insetClip_0 = _c.CreateInsetClip();
00284         return result;
00285     }
00286
00287     // PreComp layer: Controls - 06 - Dropdown - 05 - PressedToNormal
00288     // Shape tree root for layer: Layer 2
00289     ShapeVisual ShapeVisual_0()
00290     {
00291         const auto result = _c.CreateShapeVisual();
00292         result.Size({ 48.0F, 48.0F });
00293         // ShapeGroup: Group 1
00294         result.Shapes().Append(SpriteShape_0());
00295         return result;
00296     }
00297
00298     // PreComp layer: Controls - 06 - Dropdown - 04 - PointerOverToPressed
00299     // Shape tree root for layer: Layer 3
00300     ShapeVisual ShapeVisual_1()
00301     {
00302         const auto result = _c.CreateShapeVisual();
00303         result.Size({ 48.0F, 48.0F });
00304         // ShapeGroup: Group 1
00305         result.Shapes().Append(SpriteShape_1());
00306         return result;
00307     }
00308
00309     // - - - PreComp layer: Controls - 06 - Dropdown - 05 - PressedToNormal
00310     // - - Transforms for Controls - 06 - Dropdown - 05 - PressedToNormal Scale(1,1,0)
00311     // - ShapeGroup: Group 1
00312     // Offset
00313     StepEasingFunction HoldThenStepEasingFunction()
00314     {
00315         const auto result = _c.CreateStepEasingFunction();
00316         result.IsFinalStepSingleFrame(true);
00317         return result;
00318     }
00319
00320     // - - PreComp layer: Controls - 06 - Dropdown - 05 - PressedToNormal
00321     // - Transforms for Controls - 06 - Dropdown - 05 - PressedToNormal Scale(1,1,0)
00322     // ShapeGroup: Group 1
00323     // Offset
00324     Vector2KeyFrameAnimation OffsetVector2Animation_0()
00325     {
00326         // Frame 0.
00327         const auto result = CreateVector2KeyFrameAnimation(0.0F, { 24.0F, 24.0F }, HoldThenStepEasingFunction());
00328         // Frame 10.
00329         result.InsertKeyFrame(0.344827592F, { 24.0F, 31.5F }, _c.CreateCubicBezierEasingFunction({ 0.166999996F, 0.166999996F }, { 0.0F, 1.0F }));
00330         // Frame 15.
00331         result.InsertKeyFrame(0.517241359F, { 24.0F, 21.0F }, _c.CreateCubicBezierEasingFunction({ 0.550000012F, 0.0F }, { 0.75F, 1.0F }));
00332         // Frame 29.
00333         result.InsertKeyFrame(1.0F, { 24.0F, 24.0F }, _c.CreateCubicBezierEasingFunction({ 0.349999994F, 0.0F }, { 0.0F, 1.0F }));
00334         return result;
00335     }
00336
00337     // - - PreComp layer: Controls - 06 - Dropdown - 04 - PointerOverToPressed
00338     // - Transforms for Controls - 06 - Dropdown - 04 - PointerOverToPressed Scale(1,1,0)
00339     // ShapeGroup: Group 1
00340     // Offset
00341     Vector2KeyFrameAnimation OffsetVector2Animation_1()
00342     {
00343         // Frame 0.
00344         const auto result = CreateVector2KeyFrameAnimation(0.0F, { 24.0F, 24.0F }, _c.CreateCubicBezierEasingFunction({ 0.166999996F, 0.166999996F }, { 0.833000004F, 0.833000004F }));
00345         // Frame 9.
00346         result.InsertKeyFrame(0.310344815F, { 24.0F, 31.5F }, _c.CreateCubicBezierEasingFunction({ 0.166999996F, 0.166999996F }, { 0.649999976F, 1.0F }));
00347         return result;
00348     }
00349
00350     static IGeometrySource2D CanvasGeometryToIGeometrySource2D(winrt::com_ptr<CanvasGeometry> geo)
00351     {
00352         return geo.as<IGeometrySource2D>();
00353     }
00354
00355 public:
00356     AnimatedChevronDownSmallVisualSource_AnimatedVisual(
00357         Compositor compositor,
00358         CompositionPropertySet themeProperties)
00359         : _c{compositor}
00360         , _themeProperties{themeProperties}
00361         , _reusableExpressionAnimation(compositor.CreateExpressionAnimation())
00362     {
00363         winrt::check_hresult(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, _d2dFactory.put()));
00364         const auto _ = Root();
00365     }
00366
00367     void Close()
00368     {
00369         if (_root)
00370         {
00371             _root.Close();
00372         }
00373     }
00374
00375     TimeSpan Duration() const
00376     {
00377         return TimeSpan{ c_durationTicks };
00378     }
00379
00380     Visual RootVisual() const
00381     {
00382         return _root;
00383     }
00384
00385     winrt::float2 Size() const
00386     {
00387         return { 48.0F, 48.0F };
00388     }
00389
00390     static bool IsRuntimeCompatible()
00391     {
00392         return winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7);
00393     }
00394 };
00395
00396 winrt::float4 AnimatedChevronDownSmallVisualSource::ColorAsVector4(Color color)
00397 {
00398     return { static_cast<float>(color.R), static_cast<float>(color.G), static_cast<float>(color.B), static_cast<float>(color.A) };
00399 }
00400
00401 CompositionPropertySet AnimatedChevronDownSmallVisualSource::EnsureThemeProperties(Compositor compositor)
00402 {
00403     if (_themeProperties == nullptr)
00404     {
00405         _themeProperties = compositor.CreatePropertySet();
00406         _themeProperties.InsertVector4(L"Foreground", ColorAsVector4((Color)_themeForeground));
00407     }
00408
00409     return _themeProperties;
00410 }
00411
00412 Color AnimatedChevronDownSmallVisualSource::Foreground()
00413 {
00414     return _themeForeground;
00415 }
00416
00417 void AnimatedChevronDownSmallVisualSource::Foreground(Color value)
00418 {
00419     _themeForeground = value;
00420     if (_themeProperties != nullptr)
00421     {
00422         _themeProperties.InsertVector4(L"Foreground", ColorAsVector4((Color)_themeForeground));
00423     }
00424 }
00425
00426 winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual AnimatedChevronDownSmallVisualSource::TryCreateAnimatedVisual(
00427     Compositor const& compositor)
00428 {
00429     IInspectable diagnostics = nullptr;
00430     return TryCreateAnimatedVisual(compositor, diagnostics);
00431 }
00432
00433 winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual AnimatedChevronDownSmallVisualSource::TryCreateAnimatedVisual(
00434     Compositor const& compositor,
00435     IInspectable& diagnostics)
00436 {
00437     const auto _ = EnsureThemeProperties(compositor);
00438     diagnostics = nullptr;
00439
00440     if (AnimatedChevronDownSmallVisualSource_AnimatedVisual::IsRuntimeCompatible())
00441     {
00442         return winrt::make<AnimatedChevronDownSmallVisualSource_AnimatedVisual>(
00443             compositor,
00444             _themeProperties);
00445     }
00446
00447     return nullptr;
00448 }
00449
00450 double AnimatedChevronDownSmallVisualSource::FrameCount()
00451 {
00452     return 29.0;
00453 }
00454
00455 double AnimatedChevronDownSmallVisualSource::Framerate()
00456 {
00457     return 60.0;
00458 }
00459
00460 TimeSpan AnimatedChevronDownSmallVisualSource::Duration()
00461 {
00462     return TimeSpan{ 4833333L };
00463 }
00464
00465 double AnimatedChevronDownSmallVisualSource::FrameToProgress(double frameNumber)
00466 {
00467     return frameNumber / 29.0;
00468 }
00469
00470 winrt::Windows::Foundation::Collections::IMapView<hstring, double> AnimatedChevronDownSmallVisualSource::Markers()
00471 {
00472     return winrt::single_threaded_map<winrt::hstring, double>(
00473         std::map<winrt::hstring, double>
00474         {
00475             { L"NormalToPointerOver_Start", 0.0 },
00476             { L"NormalToPointerOver_End", 0.0 },
00477             { L"NormalToPressed_Start", 0.0 },
00478             { L"NormalToPressed_End", 0.312068965517241 },
00479             { L"PointerOverToNormal_Start", 0.0 },
00480             { L"PointerOverToNormal_End", 0.0 },
00481             { L"PointerOverToPressed_Start", 0.0 },
00482             { L"PointerOverToPressed_End", 0.312068965517241 },
00483             { L"PressedToNormal_Start", 0.346551724137931 },
00484             { L"PressedToNormal_End", 0.967241379310345 },
00485             { L"PressedToPointerOver_Start", 0.346551724137931 },
00486             { L"PressedToPointerOver_End", 0.967241379310345 },
00487         }
00488     ).GetView();
00489 }
00490
00491 void AnimatedChevronDownSmallVisualSource::SetColorProperty(hstring const& propertyName, Color value)
00492 {
00493     if (propertyName == L"Foreground")
00494     {
00495         _themeForeground = value;
00496     }
00497     else
00498     {
00499         return;
00500     }
00501
00502     if (_themeProperties != nullptr)
00503     {
00504         _themeProperties.InsertVector4(propertyName, ColorAsVector4(value));
00505     }
00506 }
00507
00508 void AnimatedChevronDownSmallVisualSource::SetScalarProperty(hstring const&, double)
00509 {
00510 }
Generated on Sun Dec 1 2024 20:51:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ProgressBarAxeTestPage Member List

This is the complete list of members for ProgressBarAxeTestPage, including all inherited members.
ProgressBarAxeTestPage() ProgressBarAxeTestPage [inline]
Generated on Sun Dec 1 2024 20:54:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PaneBehaviorTests Member List

This is the complete list of members for PaneBehaviorTests, including all inherited members.
ClassInitialize(TestContext testContext) | PaneBehaviorTests | [inline, static]
ClickClearSelectionButton() | NavigationViewTestsBase | [inline, protected]
ComboBoxName enum name | NavigationViewTestsBase | [protected]
compact | NavigationViewTestsBase | [protected]
CompactModeAutoPaneClosingTest() | PaneBehaviorTests | [inline]
ControlHeight enum name | NavigationViewTestsBase | [protected]
ControlWidth enum name | NavigationViewTestsBase | [protected]
EnsureDynamicSizeForPaneHeaderFooterAndCustomContent() | PaneBehaviorTests | [inline]
EnsureNavViewClosed() | NavigationViewTestsBase | [inline, protected]
EnsurePaneCanBeHidden() | PaneBehaviorTests | [inline]
EnsurePaneCanBeHiddenWithFixedWindowSize() | PaneBehaviorTests | [inline]
EnsurePaneHeaderCanBeModifiedHelper(RegressionTestType navviewMode) | NavigationViewTestsBase | [inline, protected]
expanded | NavigationViewTestsBase | [protected]
ForceIsPaneOpenToFalseOnLeftNavTest() | PaneBehaviorTests | [inline]
GetTopNavigationItems(TopNavPosition position) | NavigationViewTestsBase | [inline, protected]
InvokeNavigationViewAccessKeyAndVerifyKeyTipPlacement(string expectedKeyTipTargetElementId) | NavigationViewTestsBase | [inline, protected]
InvokeOverflowButton() | NavigationViewTestsBase | [inline, protected]
IsItemInTopNavPrimaryList(string text) | NavigationViewTestsBase | [inline, protected]
LightDismissTest() | PaneBehaviorTests | [inline]
minimal | NavigationViewTestsBase | [protected]
OpenOverflowMenuAndInvokeItem(string itemName) | NavigationViewTestsBase | [inline, protected]
PaneClosedUponLaunch() | PaneBehaviorTests | [inline]
PaneDisplayModeLeftLeftCompactLeftMinimalTest() | PaneBehaviorTests | [inline]
PaneFooterContentTest() | PaneBehaviorTests | [inline]
PaneNotOpeningTopMode() | PaneBehaviorTests | [inline]
PaneOpenCloseEventsTest() | PaneBehaviorTests | [inline]
PaneOpenCloseTest() | PaneBehaviorTests | [inline]
PaneOpenCloseTestCaseRetry(int retryNumber, Action action) | NavigationViewTestsBase | [inline, protected]
PaneOpenCloseTestPartTwo() | PaneBehaviorTests | [inline]
PaneOpenForceCloseTest() | PaneBehaviorTests | [inline]
PaneOpenStatus enum name | NavigationViewTestsBase | [protected]
PaneTabNavigationTest() | PaneBehaviorTests | [inline]
SelectingAnItemInLeftCompactOrLeftMinimalClosesPane() | PaneBehaviorTests | [inline]
SetNavViewHeight(ControlHeight height) | NavigationViewTestsBase | [inline, protected]
SetNavViewWidth(ControlWidth width) | NavigationViewTestsBase | [inline, protected]
SetThreshold(Threshold threshold, ComboBoxName name) | NavigationViewTestsBase | [inline, protected]
TestCleanup() | NavigationViewTestsBase | [inline]
Threshold enum name | NavigationViewTestsBase | [protected]
TopNavPosition enum name | NavigationViewTestsBase | [protected]
UIObjectContains(UIObject uIObject, string itemName) | NavigationViewTestsBase | [inline, protected]
UIObjectToString(UIObject uIObject) | NavigationViewTestsBase | [inline, protected]
VerifyBackAndCloseButtonsVisibility(bool inLeftMinimalPanelDisplayMode) | NavigationViewTestsBase | [inline, protected]
VerifyBackAndCloseButtonsVisibilityInAutoPaneDisplayMode() | PaneBehaviorTests | [inline]
VerifyBackAndCloseButtonsVisibilityInLeftMinimalPaneDisplayMode() | PaneBehaviorTests | [inline]
VerifyChangingFooterMenuItemVisibilityAdjustsPaneLayout() | PaneBehaviorTests | [inline]
VerifyCorrectVisualStateWhenChangingPaneDisplayMode() | PaneBehaviorTests | [inline]
VerifyCorrectVisualStateWhenClosingPaneInLeftDisplayMode() | PaneBehaviorTests | [inline]
VerifyExpandedItemsSaveStateWhenClosingAndOpeningPane() | PaneBehaviorTests | [inline]
VerifyIconsRespectCompactPaneLength() | PaneBehaviorTests | [inline]
VerifyPaneIsClosedAfterSelectingItem() | PaneBehaviorTests | [inline]
VerifyPaneIsClosedWhenClickingOnSelectedItem() | PaneBehaviorTests | [inline]
VerifyPaneLayoutDynamicallyUpdatingCollections() | PaneBehaviorTests | [inline]
VerifyPaneLayoutDynamicallyUpdatingCollectionsFooterPrecedence() | PaneBehaviorTests | [inline]
VerifyPaneLayoutSettingsDisabledNoGapFooterItems() | PaneBehaviorTests | [inline]
VerifyPaneLayoutSettingsDisabledNoGapMenuItems() | PaneBehaviorTests | [inline]
VerifyPaneLayoutSwappingCollections() | PaneBehaviorTests | [inline]
VerifyPaneTitlePresentAndUpdates() | PaneBehaviorTests | [inline]
VerifyPaneVisibleOnInit() | PaneBehaviorTests | [inline]
VerifySettingsWidthOnLeftNavMediumMode() | PaneBehaviorTests | [inline]
WaitAndAssertPaneStatus(PaneOpenStatus status) | NavigationViewTestsBase | [inline, protected]
Generated on Sun Dec 1 2024 20:53:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DistantSpecularEffect Member List

This is the complete list of members for DistantSpecularEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1DistantSpecular) | DistantSpecularEffect
DECLARE_NAMED_PROPERTY_MAPPING({L"Azimuth", D2D1_DISTANTSPECULAR_PROP_AZIMUTH, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES},{L"Elevation", D2D1_DISTANTSPECULAR_PROP_ELEVATION, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES},{L"SpecularExponent", D2D1_DISTANTSPECULAR_PROP_SPECULAR_EXPONENT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"SpecularAmount", D2D1_DISTANTSPECULAR_PROP_SPECULAR_CONSTANT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"HeightMapScale", D2D1_DISTANTSPECULAR_PROP_SURFACE_SCALE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"LightColor", D2D1_DISTANTSPECULAR_PROP_COLOR, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3},{L"HeightMapKernelSize", D2D1_DISTANTSPECULAR_PROP_KERNEL_UNIT_LENGTH, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"HeightMapInterpolationMode", D2D1_DISTANTSPECULAR_PROP_SCALE_MODE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},) | DistantSpecularEffect
DECLARE_POD_PROPERTY(Azimuth, float, 0.0f, true) | DistantSpecularEffect
DECLARE_POD_PROPERTY(Elevation, float, 0.0f, true) | DistantSpecularEffect
DECLARE_POD_PROPERTY(SpecularExponent, float, 1.0f, value >=-10000.0f &&value<=10000.0f) | DistantSpecularEffect
DECLARE_POD_PROPERTY(SpecularAmount, float, 1.0f, value >=0.0f &&value<=10000.0f) | DistantSpecularEffect
DECLARE_POD_PROPERTY(HeightMapScale, float, 1.0f, value >=-10000.0f &&value<=10000.0f) | DistantSpecularEffect
DECLARE_POD_PROPERTY(LightColor, UIColor,(UIColor{255, 255, 255, 255}), true) | DistantSpecularEffect
DECLARE_POD_PROPERTY(HeightMapKernelSize, Vector2,(Vector2{1.0f, 1.0f}), value.x >=0.01f &&value.y >=0.01f &&value.x<=100.0f &&value.y<=100.0f) | DistantSpecularEffect
DECLARE_POD_PROPERTY(HeightMapInterpolationMode, winrt::CanvasImageInterpolation, winrt::CanvasImageInterpolation::Linear, true) | DistantSpecularEffect
DECLARE_SINGLE_SOURCE(Source) | DistantSpecularEffect
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | DistantSpecularEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | DistantSpecularEffect | [inline]
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IHueRotationEffect Member List

This is the complete list of members for IHueRotationEffect, including all inherited members.
Angle([out, retval] float *value) | IHueRotationEffect
Angle([in] float value) | IHueRotationEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | IHueRotationEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | IHueRotationEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorPickerSlider::ColorPickerSliderFactory Member List

This is the complete list of members for ColorPickerSlider::ColorPickerSliderFactory, including all inherited members.
Create(UIObject element) ColorPickerSlider::ColorPickerSliderFactory [inline]
Generated on Sun Dec 1 2024 20:53:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/CppWinRTIncludes.h Source File

  • inc

CppWinRTIncludes.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include <winrt\base.h>
00007 #include <winrt\Windows.Foundation.h>
00008 #include <winrt\Windows.Foundation.Collections.h>
00009 #include <winrt\Windows.Foundation.Metadata.h>
00010 #include <winrt\Windows.ApplicationModel.Activation.h>
00011 #include <winrt\Windows.ApplicationModel.Contacts.h>
00012 #include <winrt\Windows.ApplicationModel.Core.h>
00013 #include <winrt\Windows.ApplicationModel.DataTransfer.h>
00014 #include <winrt\Windows.ApplicationModel.DataTransfer.DragDrop.h>
00015 #include <winrt\Windows.ApplicationModel.Resources.h>
00016 #include <winrt\Windows.ApplicationModel.Resources.Core.h>
00017 #include <winrt\Windows.Devices.Geolocation.h>
00018 #include <winrt\Windows.Globalization.h>
00019 #include <winrt\Windows.Globalization.NumberFormatting.h>
00020 #include <winrt\Windows.Graphics.h>
00021 #include <winrt\Windows.Graphics.Imaging.h>
00022 #include <winrt\Windows.Graphics.Display.h>
00023 #include <winrt\Windows.Graphics.Effects.h>
00024 #include <winrt\Windows.Storage.h>
00025 #include <winrt\Windows.Storage.Streams.h>
00026 #include <winrt\Windows.System.h>
00027 #include <winrt\Windows.System.Power.h>
00028 #include <winrt\Windows.System.Profile.h>
00029 #include <winrt\Windows.System.Threading.h>
00030 #include <winrt\Windows.System.UserProfile.h>
00031 #include <winrt\Windows.UI.h>
00032 #include <winrt\Windows.UI.Core.h>
00033 #include <winrt\Windows.UI.Input.h>
00034 #include <winrt\Windows.UI.Input.Inking.h>
00035 #include <winrt\Windows.UI.Text.h>
00036 #include <winrt\Windows.UI.ViewManagement.h>
00037 #include <winrt\Windows.UI.Xaml.Interop.h>
00038 #include <winrt\Windows.Data.Json.h>
00039
00040 #include <winrt\Microsoft.Windows.ApplicationModel.Resources.h>
00041 #include <winrt\Microsoft.UI.Dispatching.h>
00042 #include <winrt\Microsoft.UI.Composition.h>
00043 #include <winrt\Microsoft.UI.Composition.Effects.h>
00044 #include <winrt\Microsoft.UI.Composition.Interactions.h>
00045 #include <winrt\Microsoft.UI.Composition.SystemBackdrops.h>
00046 #include <winrt\Microsoft.UI.Private.Composition.Effects.h>
00047 #include <winrt\Microsoft.UI.Content.h>
00048 #include <winrt\Microsoft.UI.Input.h>
00049 #include <winrt\Microsoft.UI.Input.Experimental.h>
00050 #include <winrt\Microsoft.UI.Text.h>
00051 #include <winrt\Microsoft.UI.Windowing.h>
00052 #include <winrt\Microsoft.UI.Xaml.h>
00053 #include <winrt\Microsoft.UI.Xaml.Automation.Peers.h>
00054 #include <winrt\Microsoft.UI.Xaml.Automation.Provider.h>
00055 #include <winrt\Microsoft.UI.Xaml.Controls.h>
00056 #include <winrt\Microsoft.UI.Xaml.Controls.AnimatedVisuals.h>
00057 #include <winrt\Microsoft.UI.Xaml.Controls.Primitives.h>
00058 #include <winrt\Microsoft.UI.Xaml.Data.h>
00059 #include <winrt\Microsoft.UI.Xaml.Documents.h>
00060 #include <winrt\Microsoft.UI.Xaml.Hosting.h>
00061 #include <winrt\Microsoft.UI.Xaml.Input.h>
00062 #include <winrt\Microsoft.UI.Xaml.Interop.h>
00063 #include <winrt\Microsoft.UI.Xaml.Markup.h>
00064 #include <winrt\Microsoft.UI.Xaml.Media.h>
00065 #include <winrt\Microsoft.UI.Xaml.Media.Animation.h>
00066 #include <winrt\Microsoft.UI.Xaml.Media.Imaging.h>
00067 #include <winrt\Microsoft.UI.Xaml.Shapes.h>
00068 #include <winrt\Microsoft.UI.Xaml.XamlTypeInfo.h>
00069 #include <winrt\Microsoft.UI.Private.Controls.h>
00070 #include <winrt\Microsoft.UI.Private.Media.h>
00071 #include <winrt\Microsoft.Web.WebView2.core.h>
00072
00073 namespace winrt
00074 {
00075     using namespace ::winrt::Windows;
00076     using namespace ::winrt::Windows::ApplicationModel::Activation;
00077     using namespace ::winrt::Windows::ApplicationModel::Contacts;
00078     using namespace ::winrt::Windows::ApplicationModel::Core;
00079     using namespace ::winrt::Windows::ApplicationModel::DataTransfer;
00080     using namespace ::winrt::Windows::ApplicationModel::DataTransfer::DragDrop;
00081     using namespace ::winrt::Windows::ApplicationModel::Resources;
00082     using namespace ::winrt::Windows::ApplicationModel::Resources::Core;
00083     using namespace ::winrt::Windows::Devices::Input;
00084     using namespace ::winrt::Windows::Devices::Geolocation;
00085     using namespace ::winrt::Windows::Foundation;
00086     using namespace ::winrt::Windows::Foundation::Collections;
00087     using namespace ::winrt::Windows::Foundation::Metadata;
00088     using namespace ::winrt::Windows::Foundation::Numerics;
00089     using namespace ::winrt::Windows::Globalization;
00090     using namespace ::winrt::Windows::Globalization::NumberFormatting;
00091     using namespace ::winrt::Windows::Graphics;
00092     using namespace ::winrt::Windows::Graphics::Display;
00093     using namespace ::winrt::Windows::Graphics::Imaging;
00094     using namespace ::winrt::Windows::Graphics::Effects;
00095     using namespace ::winrt::Windows::Storage;
00096     using namespace ::winrt::Windows::Storage::Streams;
00097     using namespace ::winrt::Windows::System::Power;
00098     using namespace ::winrt::Windows::System::Profile;
00099     using namespace ::winrt::Windows::System::Threading;
00100     using namespace ::winrt::Windows::System::UserProfile;
00101     using namespace ::winrt::Windows::UI;
00102     using namespace ::winrt::Windows::UI::Core;
00103     using namespace ::winrt::Windows::UI::Text;
00104     using namespace ::winrt::Windows::UI::ViewManagement;
00105     using namespace ::winrt::Windows::Web;
00106
00107     using namespace ::winrt::Microsoft::UI::Dispatching;
00108     using namespace ::winrt::Microsoft::UI::Composition;
00109     using namespace ::winrt::Microsoft::UI::Private::Composition::Effects;
00110     using namespace ::winrt::Microsoft::UI::Composition::Interactions;
00111     using namespace ::winrt::Microsoft::UI::Composition::SystemBackdrops;
00112     using namespace ::winrt::Microsoft::UI::Content;
00113     using namespace ::winrt::Microsoft::UI::Input;
00114     using namespace ::winrt::Microsoft::UI::Input::Experimental;
00115
00116     using namespace ::winrt::Microsoft::Web::WebView2::Core;
00117
00118     using namespace ::winrt::Microsoft::UI::Xaml;
00119     using namespace ::winrt::Microsoft::UI::Xaml::Automation;
00120     using namespace ::winrt::Microsoft::UI::Xaml::Automation::Provider;
00121     using namespace ::winrt::Microsoft::UI::Xaml::Data;
00122     using namespace ::winrt::Microsoft::UI::Xaml::Documents;
00123     using namespace ::winrt::Microsoft::UI::Xaml::Hosting;
00124     using namespace ::winrt::Microsoft::UI::Xaml::Input;
00125     using namespace ::winrt::Microsoft::UI::Xaml::Interop;
00126     using namespace ::winrt::Microsoft::UI::Xaml::Markup;
00127     using namespace ::winrt::Microsoft::UI::Xaml::Media::Animation;
00128     using namespace ::winrt::Microsoft::UI::Xaml::Media::Imaging;
00129     using namespace ::winrt::Microsoft::UI::Xaml::Shapes;
00130     using namespace ::winrt::Windows::System::Profile;
00131     namespace Microsoft::UI::Xaml::XamlTypeInfo {}
00132     using namespace ::winrt::Microsoft::UI::Xaml::XamlTypeInfo;
00133     namespace Microsoft::UI::Private::Controls {}
00134     using namespace ::winrt::Microsoft::UI::Private::Controls;
00135     namespace Microsoft::UI::Private::Media {}
00136     using namespace ::winrt::Microsoft::UI::Private::Media;
00137     namespace Microsoft::UI::Xaml::Controls {}
00138     using namespace ::winrt::Microsoft::UI::Xaml::Controls;
00139     namespace Microsoft::UI::Xaml::Controls::Primitives {}
00140     using namespace ::winrt::Microsoft::UI::Xaml::Controls::Primitives;
00141     namespace Microsoft::UI::Xaml::Controls::AnimatedVisuals {}
00142     using namespace ::winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals;
00143     namespace Microsoft::UI::Xaml::Media {}
00144     using namespace ::winrt::Microsoft::UI::Xaml::Media;
00145     namespace Microsoft::UI::Xaml::Automation::Peers {}
00146     using namespace ::winrt::Microsoft::UI::Xaml::Automation::Peers;
00147
00148
00149     namespace Microsoft::Experimental::UI::Xaml::XamlTypeInfo {}
00150     using namespace ::winrt::Microsoft::Experimental::UI::Xaml::XamlTypeInfo;
00151     namespace Microsoft::Experimental::UI::Xaml::Controls {}
00152     using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls;
00153     namespace Microsoft::Experimental::UI::Xaml::Controls::Primitives {}
00154     using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls::Primitives;
00155     namespace Microsoft::Experimental::UI::Xaml::Controls::AnimatedVisuals {}
00156     using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls::AnimatedVisuals;
00157     namespace Microsoft::Experimental::UI::Xaml::Media {}
00158     using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Media;
00159     namespace Microsoft::Experimental::UI::Xaml::Automation::Peers {}
00160     using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Automation::Peers;
00161
00162     // using namespace will affect headers included later as well, so crack these namespaces now for convenience
00163     // but in order to avoid "namespace not defined" errors we have to define the namespaces here too.
00164     namespace Microsoft::UI::Private::Controls::implementation {}
00165     namespace Microsoft::UI::Private::Media::implementation {}
00166
00167     namespace Microsoft::UI::Xaml::Controls::implementation {}
00168     namespace Microsoft::UI::Xaml::XamlTypeInfo::implementation {}
00169     namespace Microsoft::UI::Xaml::Controls::Primitives::implementation {}
00170     namespace Microsoft::UI::Xaml::Media::implementation {}
00171     namespace Microsoft::UI::Xaml::Automation::Peers::implementation {}
00172     namespace Microsoft::UI::Xaml::Controls::AnimatedVisuals::implementation {}
00173
00174     namespace Microsoft::Experimental::UI::Xaml::Controls::implementation {}
00175     namespace Microsoft::Experimental::UI::Xaml::Controls::Primitives::implementation {}
00176     namespace Microsoft::Experimental::UI::Xaml::Controls::AnimatedVisuals::implementation {}
00177     namespace Microsoft::Experimental::UI::Xaml::Media::implementation {}
00178     namespace Microsoft::Experimental::UI::Xaml::Automation::Peers::implementation {}
00179     namespace Microsoft::Experimental::UI::Xaml::XamlTypeInfo::implementation {}
00180
00181     namespace implementation
00182     {
00183         using namespace ::winrt::Microsoft::UI::Private::Controls::implementation;
00184         using namespace ::winrt::Microsoft::UI::Private::Media::implementation;
00185         using namespace ::winrt::Microsoft::UI::Xaml::Controls::implementation;
00186         using namespace ::winrt::Microsoft::UI::Xaml::XamlTypeInfo::implementation;
00187         using namespace ::winrt::Microsoft::UI::Xaml::Controls::Primitives::implementation;
00188         using namespace ::winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals::implementation;
00189         using namespace ::winrt::Microsoft::UI::Xaml::Media::implementation;
00190         using namespace ::winrt::Microsoft::UI::Xaml::Automation::Peers::implementation;
00191
00192         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls::implementation;
00193         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls::Primitives::implementation;
00194         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls::AnimatedVisuals::implementation;
00195         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Media::implementation;
00196         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Automation::Peers::implementation;
00197         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::XamlTypeInfo::implementation;
00198     }
00199
00200     namespace Microsoft::UI::Private::Controls::factory_implementation {}
00201     namespace Microsoft::UI::Private::Media::factory_implementation {}
00202     namespace Microsoft::UI::Xaml::Controls::factory_implementation {}
00203     namespace Microsoft::UI::Xaml::XamlTypeInfo::factory_implementation {}
00204     namespace Microsoft::UI::Xaml::Controls::Primitives::factory_implementation {}
00205     namespace Microsoft::UI::Xaml::Controls::AnimatedVisuals::factory_implementation {}
00206     namespace Microsoft::UI::Xaml::Media::factory_implementation {}
00207     namespace Microsoft::UI::Xaml::Automation::Peers::factory_implementation {}
00208
00209     namespace Microsoft::Experimental::UI::Xaml::Controls::factory_implementation {}
00210     namespace Microsoft::Experimental::UI::Xaml::XamlTypeInfo::factory_implementation {}
00211     namespace Microsoft::Experimental::UI::Xaml::Controls::Primitives::factory_implementation {}
00212     namespace Microsoft::Experimental::UI::Xaml::Controls::AnimatedVisuals::factory_implementation {}
00213     namespace Microsoft::Experimental::UI::Xaml::Media::factory_implementation {}
00214     namespace Microsoft::Experimental::UI::Xaml::Automation::Peers::factory_implementation {}
00215
00216     namespace factory_implementation
00217     {
00218         using namespace ::winrt::Microsoft::UI::Private::Controls::factory_implementation;
00219         using namespace ::winrt::Microsoft::UI::Private::Media::factory_implementation;
00220         using namespace ::winrt::Microsoft::UI::Xaml::Controls::factory_implementation;
00221         using namespace ::winrt::Microsoft::UI::Xaml::XamlTypeInfo::factory_implementation;
00222         using namespace ::winrt::Microsoft::UI::Xaml::Controls::Primitives::factory_implementation;
00223         using namespace ::winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals::factory_implementation;
00224         using namespace ::winrt::Microsoft::UI::Xaml::Media::factory_implementation;
00225         using namespace ::winrt::Microsoft::UI::Xaml::Automation::Peers::factory_implementation;
00226
00227         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls::factory_implementation;
00228         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::XamlTypeInfo::factory_implementation;
00229         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls::Primitives::factory_implementation;
00230         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Controls::AnimatedVisuals::factory_implementation;
00231         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Media::factory_implementation;
00232         using namespace ::winrt::Microsoft::Experimental::UI::Xaml::Automation::Peers::factory_implementation;
00233     }
00234
00235     // using namespace ::winrt::Windows::System;
00236     using VirtualKey = ::winrt::Windows::System::VirtualKey;
00237     using VirtualKeyModifiers = ::winrt::Windows::System::VirtualKeyModifiers;
00238
00239     // using namespace ::winrt::Windows::UI::Core;
00240     using CoreCursorType = ::winrt::Windows::UI::Core::CoreCursorType;
00241
00242     // using namespace ::winrt::Windows::UI::Input;
00243     using PointerUpdateKind = ::winrt::Microsoft::UI::Input::PointerUpdateKind;
00244     using PointerDeviceType = ::winrt::Microsoft::UI::Input::PointerDeviceType;
00245     using InputSystemCursorShape = ::winrt::Microsoft::UI::Input::InputSystemCursorShape;
00246
00247     // using namespace ::winrt::Windows::UI::Input::Inking;
00248     using InkDrawingAttributes = ::winrt::Windows::UI::Input::Inking::InkDrawingAttributes;
00249     using InkPresenter = ::winrt::Windows::UI::Input::Inking::InkPresenter;
00250     using InkPresenterProtractor = ::winrt::Windows::UI::Input::Inking::InkPresenterProtractor;
00251     using InkPresenterRuler = ::winrt::Windows::UI::Input::Inking::InkPresenterRuler;
00252
00253     // using namespace ::winrt::Windows::UI::Xaml::Interop;
00254     using TypeName = ::winrt::Windows::UI::Xaml::Interop::TypeName;
00255     using TypeKind = ::winrt::Windows::UI::Xaml::Interop::TypeKind;
00256
00257     // using namespace winrt::Microsoft::UI
00258     using ColorHelper = winrt::Microsoft::UI::ColorHelper;
00259     using IColorHelperStatics = winrt::Microsoft::UI::IColorHelperStatics;
00260     using Colors = winrt::Microsoft::UI::Colors;
00261     using IColorsStatics = winrt::Microsoft::UI::IColorsStatics;
00262     using WindowId = winrt::Microsoft::UI::WindowId;
00263
00264     // using namespace winrt::Microsoft::UI::Text
00265     using FontWeights = winrt::Microsoft::UI::Text::FontWeights;
00266     using FormatEffect = winrt::Microsoft::UI::Text::FormatEffect;
00267     using IFontWeightsStatics = winrt::Microsoft::UI::Text::IFontWeightsStatics;
00268     using ITextSelection = winrt::Microsoft::UI::Text::ITextSelection;
00269     using TextGetOptions = winrt::Microsoft::UI::Text::TextGetOptions;
00270     using TextRangeUnit = winrt::Microsoft::UI::Text::TextRangeUnit;
00271     using UnderlineType = winrt::Microsoft::UI::Text::UnderlineType;
00272
00273     // using namespace winrt::Microsoft::UI::Windowing
00274     using AppWindow = winrt::Microsoft::UI::Windowing::AppWindow;
00275
00276     // using namespace ::winrt::Microsoft::UI::Xaml::Controls;
00277     using FxZoomMode = winrt::Microsoft::UI::Xaml::Controls::ZoomMode;
00278     using FxScrollViewer = winrt::Microsoft::UI::Xaml::Controls::ScrollViewer;
00279 #ifdef REPEATER_INCLUDED
00280     using ElementFactoryGetArgs = winrt::Microsoft::UI::Xaml::ElementFactoryGetArgs;
00281     using ElementFactoryRecycleArgs = winrt::Microsoft::UI::Xaml::ElementFactoryRecycleArgs;
00282     using IElementFactory = winrt::Microsoft::UI::Xaml::IElementFactory;
00283 #endif
00284
00285 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/ScrollViewLightup.cpp Source File

  • ScrollView

ScrollViewLightup.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"    // This is a direct (non-PCH) compile
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "ScrollPresenter.h"
00009 #include "ScrollView.h"
00010 #include "RuntimeProfiler.h"
00011 #include "FocusHelper.h"
00012 #include "RegUtil.h"
00013 #include "ScrollViewTestHooks.h"
00014
00015
00016 // explicitly instantiate deletion of ScrollView::AutoHideScrollBarsState in this translation unit
00017 template void std::default_delete<ScrollView::AutoHideScrollBarsState>::operator()(ScrollView::AutoHideScrollBarsState*) const noexcept;
00018 template void std::default_delete<const ScrollView::AutoHideScrollBarsState>::operator()(const ScrollView::AutoHideScrollBarsState*) const noexcept;
00019
00020 struct ScrollView::AutoHideScrollBarsState
00021 {
00022     winrt::IUISettings5 m_uiSettings5{ nullptr };
00023     winrt::IUISettings5::AutoHideScrollBarsChanged_revoker m_autoHideScrollBarsChangedRevoker{};
00024
00025     void HookUISettingsEvent(ScrollView* scrollView)
00026     {
00027         // Introduced in 19H1, IUISettings5 exposes the AutoHideScrollBars property and AutoHideScrollBarsChanged event.
00028         if (!m_uiSettings5)
00029         {
00030             winrt::UISettings uiSettings;
00031
00032             m_uiSettings5 = uiSettings.try_as<winrt::IUISettings5>();
00033             if (m_uiSettings5)
00034             {
00035                 m_autoHideScrollBarsChangedRevoker = m_uiSettings5.AutoHideScrollBarsChanged(
00036                     winrt::auto_revoke,
00037                     { scrollView, &ScrollView::OnAutoHideScrollBarsChanged });
00038             }
00039         }
00040     }
00041 };
00042
00043 std::unique_ptr<ScrollView::AutoHideScrollBarsState> ScrollView::MakeAutoHideScrollBarsState()
00044 {
00045     return std::make_unique<AutoHideScrollBarsState>();
00046 }
00047
00048 void ScrollView::OnAutoHideScrollBarsChanged(
00049     winrt::UISettings const& uiSettings,
00050     winrt::UISettingsAutoHideScrollBarsChangedEventArgs const& args)
00051 {
00052     // OnAutoHideScrollBarsChanged is called on a non-UI thread, process notification on the UI thread using a dispatcher.
00053     m_dispatcherQueue.TryEnqueue(winrt::DispatcherQueueHandler(
00054         [strongThis = get_strong()]()
00055     {
00056         strongThis->m_autoHideScrollControllersValid = false;
00057         strongThis->UpdateVisualStates(
00058             true  /*useTransitions*/,
00059             false /*showIndicators*/,
00060             false /*hideIndicators*/,
00061             true  /*scrollControllersAutoHidingChanged*/);
00062     }));
00063 }
00064
00065 void ScrollView::HookUISettingsEvent()
00066 {
00067     m_autoHideScrollBarsState->HookUISettingsEvent(this);
00068 }
00069
00070 bool ScrollView::AreScrollControllersAutoHiding()
00071 {
00072     // Use the cached value unless it was invalidated.
00073     if (m_autoHideScrollControllersValid)
00074     {
00075         return m_autoHideScrollControllers;
00076     }
00077
00078     m_autoHideScrollControllersValid = true;
00079
00080     if (auto globalTestHooks = ScrollViewTestHooks::GetGlobalTestHooks())
00081     {
00082         winrt::IReference<bool> autoHideScrollControllers = globalTestHooks->GetAutoHideScrollControllers(*this);
00083
00084         if (autoHideScrollControllers)
00085         {
00086             // Test hook takes precedence over UISettings and registry key settings.
00087             m_autoHideScrollControllers = autoHideScrollControllers.Value();
00088             return m_autoHideScrollControllers;
00089         }
00090     }
00091
00092     if (m_autoHideScrollBarsState->m_uiSettings5)
00093     {
00094         m_autoHideScrollControllers = m_autoHideScrollBarsState->m_uiSettings5.AutoHideScrollBars();
00095     }
00096     else
00097     {
00098         m_autoHideScrollControllers = RegUtil::UseDynamicScrollbars();
00099     }
00100
00101     return m_autoHideScrollControllers;
00102 }
00103
00104 // On RS4 and RS5, update m_autoHideScrollControllers based on the DynamicScrollbars registry key value
00105 // and update the visual states if the value changed.
00106 void ScrollView::UpdateScrollControllersAutoHiding(
00107     bool forceUpdate)
00108 {
00109     if ((forceUpdate || !m_autoHideScrollBarsState->m_uiSettings5) && m_autoHideScrollControllersValid)
00110     {
00111         m_autoHideScrollControllersValid = false;
00112
00113         const bool oldAutoHideScrollControllers = m_autoHideScrollControllers;
00114         const bool newAutoHideScrollControllers = AreScrollControllersAutoHiding();
00115
00116         if (oldAutoHideScrollControllers != newAutoHideScrollControllers)
00117         {
00118             UpdateVisualStates(
00119                 true  /*useTransitions*/,
00120                 false /*showIndicators*/,
00121                 false /*hideIndicators*/,
00122                 true  /*scrollControllersAutoHidingChanged*/);
00123         }
00124     }
00125 }
00126
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

StackLayoutProperties Member List

This is the complete list of members for StackLayoutProperties, including all inherited members.
ClearProperties() | StackLayoutProperties | [static]
EnsureProperties() | StackLayoutProperties | [static]
IsVirtualizationEnabled(bool value) | StackLayoutProperties |
IsVirtualizationEnabled() | StackLayoutProperties |
IsVirtualizationEnabledProperty() | StackLayoutProperties | [inline, static]
OnIsVirtualizationEnabledPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | StackLayoutProperties | [static]
OnOrientationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | StackLayoutProperties | [static]
OnSpacingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | StackLayoutProperties | [static]
Orientation(winrt::Orientation const &value) | StackLayoutProperties |
Orientation() | StackLayoutProperties |
OrientationProperty() | StackLayoutProperties | [inline, static]
s_IsVirtualizationEnabledProperty | StackLayoutProperties | [static]
s_OrientationProperty | StackLayoutProperties | [static]
s_SpacingProperty | StackLayoutProperties | [static]
Spacing(double value) | StackLayoutProperties |
Spacing() | StackLayoutProperties |
SpacingProperty() | StackLayoutProperties | [inline, static]
StackLayoutProperties() | StackLayoutProperties |
Generated on Sun Dec 1 2024 20:53:12 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ICompositeStepEffect Member List

This is the complete list of members for ICompositeStepEffect, including all inherited members.
Destination([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | ICompositeStepEffect
Destination([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | ICompositeStepEffect
Mode([out, retval] Microsoft.UI.Private.Composition.Effects.CanvasComposite *value) | ICompositeStepEffect
Mode([in] Microsoft.UI.Private.Composition.Effects.CanvasComposite value) | ICompositeStepEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | ICompositeStepEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | ICompositeStepEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TestHooks/MUXControlsTestHooks.h Source File

  • TestHooks

MUXControlsTestHooks.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "WinEventLogLevels.h"
00007 #include "MUXControlsTestHooksLoggingMessageEventArgs.h"
00008
00009 // Logging level that results in no logging at all.
00010 #define WINEVENT_LEVEL_NONE 0x0
00011
00012 #include "MUXControlsTestHooks.g.h"
00013
00014 class MUXControlsTestHooks :
00015     public winrt::implementation::MUXControlsTestHooksT<MUXControlsTestHooks>
00016 {
00017 public:
00018     UCHAR GetLoggingLevelForType(const wstring_view& type);
00019     UCHAR GetLoggingLevelForInstance(const winrt::IInspectable& sender);
00020     void SetOutputDebugStringLevelForTypeImpl(const wstring_view& type, bool isLoggingInfoLevel, bool isLoggingVerboseLevel);
00021     void SetLoggingLevelForTypeImpl(const wstring_view& type, bool isLoggingInfoLevel, bool isLoggingVerboseLevel);
00022     void SetLoggingLevelForInstanceImpl(const winrt::IInspectable& sender, bool isLoggingInfoLevel, bool isLoggingVerboseLevel);
00023     void LogMessage(const winrt::IInspectable& sender, const wstring_view& message, bool isVerboseLevel);
00024     winrt::event_token LoggingMessageImpl(winrt::TypedEventHandler<winrt::IInspectable, winrt::MUXControlsTestHooksLoggingMessageEventArgs> const& value);
00025     void LoggingMessageImpl(winrt::event_token const& token);
00026     winrt::event_token BuildTreeCompletedImpl(winrt::TypedEventHandler<winrt::IInspectable, winrt::IInspectable> const& value); // subscribe
00027     void BuildTreeCompletedImpl(winrt::event_token const& token); // unsubscribe
00028     void NotifyBuildTreeCompletedImpl();
00029
00030     static com_ptr<MUXControlsTestHooks> GetGlobalTestHooks()
00031     {
00032         return s_testHooks->get_strong();
00033     }
00034
00035     static void SetOutputDebugStringLevelForType(winrt::hstring const& type, bool isLoggingInfoLevel, bool isLoggingVerboseLevel);
00036     static void SetLoggingLevelForType(winrt::hstring const& type, bool isLoggingInfoLevel, bool isLoggingVerboseLevel);
00037     static void SetLoggingLevelForInstance(winrt::IInspectable const& sender, bool isLoggingInfoLevel, bool isLoggingVerboseLevel);
00038
00039     static winrt::event_token LoggingMessage(winrt::TypedEventHandler<winrt::IInspectable, winrt::MUXControlsTestHooksLoggingMessageEventArgs> const& value);
00040     static void LoggingMessage(winrt::event_token const& token);
00041
00042     static winrt::event_token BuildTreeCompleted(winrt::TypedEventHandler<winrt::IInspectable, winrt::IInspectable> const& value); // subscribe
00043     static void BuildTreeCompleted(winrt::event_token const& token); // unsubscribe
00044     static void NotifyBuildTreeCompleted();
00045
00046 private:
00047     static MUXControlsTestHooks* s_testHooks;
00048
00049     static void EnsureHooks();
00050
00051 private:
00052     winrt::event<winrt::TypedEventHandler<winrt::IInspectable, winrt::MUXControlsTestHooksLoggingMessageEventArgs>> m_loggingMessageEventSource;
00053     std::map<std::wstring /*key:Type*/, UCHAR /*value:LoggingProviderLevel*/, std::less<>> m_typeLoggingLevels;
00054     std::map<winrt::IInspectable /*key:Instance*/, UCHAR /*value:LoggingProviderLevel*/> m_instanceLoggingLevels;
00055     UCHAR m_globalLoggingLevel{ WINEVENT_LEVEL_NONE };
00056     winrt::event<winrt::TypedEventHandler<winrt::IInspectable, winrt::IInspectable>> m_buildTreeCompleted;
00057 };
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshContainer/InteractionTests/RefreshContainerTests.cs Source File

  • PullToRefresh
  • RefreshContainer
  • InteractionTests

RefreshContainerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using System;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00008
00009 using WEX.TestExecution;
00010 using WEX.TestExecution.Markup;
00011 using WEX.Logging.Interop;
00012
00013 using Microsoft.Windows.Apps.Test.Automation;
00014 using Microsoft.Windows.Apps.Test.Foundation;
00015 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00016 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00017 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00018
00019 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00020 {
00021     [TestClass]
00022     public class RefreshContainerTests
00023     {
00024         [ClassInitialize]
00025         [TestProperty("RunAs", "User")]
00026         [TestProperty("Classification", "Integration")]
00027         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00028         public static void ClassInitialize(TestContext testContext)
00029         {
00030             TestEnvironment.Initialize(testContext);
00031         }
00032
00033         [TestCleanup]
00034         public void TestCleanup()
00035         {
00036             TestCleanupHelper.Cleanup();
00037         }
00038
00039         [TestMethod]
00040         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00041         [TestProperty("Ignore", "True")] // TODO 29556471: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00042         public void BasicInteractionTest()
00043         {
00044             using (var setup = new TestSetupHelper("PTR Tests")) // This literally clicks the button corresponding to the test page.
00045             {
00046                 Wait.ForIdle();
00047                 Log.Comment("Retrieve the refresh container page button as generic UIElement");
00048                 UIObject refreshContainerButtonUIObject = FindElement.ByName("RefreshContainerPageButton");
00049                 Verify.IsNotNull(refreshContainerButtonUIObject, "Verifying that we found a UIElement called RefreshContainerPageButton");
00050                 Wait.ForIdle();
00051
00052                 //Navigate to the right page
00053                 InputHelper.Tap(refreshContainerButtonUIObject);
00054                 Wait.ForIdle();
00055
00056                 Log.Comment("Retrieve adapted list view as generic UIElement");
00057                 UIObject lvUIObject = FindElement.ByName("listView");
00058                 Verify.IsNotNull(lvUIObject, "Verifying that we found a UIElement called listView");
00059
00060                 Wait.ForIdle();
00061
00062                 Log.Comment("Retrieve list view item one as generic UIElement");
00063                 UIObject listViewItem1 = FindElement.ByName("listViewItem1");
00064                 Verify.IsNotNull(listViewItem1, "Verifying that we found a UIElement called listViewItem1");
00065
00066                 Wait.ForIdle();
00067
00068                 Log.Comment("Retrieve list view item two as generic UIElement");
00069                 UIObject listViewItem2 = FindElement.ByName("listViewItem2");
00070                 Verify.IsNotNull(listViewItem1, "Verifying that we found a UIElement called listViewItem2");
00071
00072                 Wait.ForIdle();
00073
00074                 Log.Comment("Retrieve list view item ten as generic UIElement");
00075                 UIObject listViewItem10 = FindElement.ByName("listViewItem10");
00076                 Verify.IsNotNull(listViewItem1, "Verifying that we found a UIElement called listViewItem10");
00077
00078                 Wait.ForIdle();
00079
00080                 Log.Comment("Retrieve list view item nine as generic UIElement");
00081                 UIObject listViewItem9 = FindElement.ByName("listViewItem9");
00082                 Verify.IsNotNull(listViewItem1, "Verifying that we found a UIElement called listViewItem9");
00083
00084                 Wait.ForIdle();
00085
00086                 Log.Comment("Retrieve refresh on container button as generic UIElement");
00087                 UIObject refreshOnContainerButtonUIObject = FindElement.ByName("RefreshOnContainerButton");
00088                 Verify.IsNotNull(refreshOnContainerButtonUIObject, "Verifying that we found a UIElement called RefreshOnContainerButton");
00089
00090                 Wait.ForIdle();
00091
00092                 Log.Comment("Retrieve refresh on visualizer button as generic UIElement");
00093                 UIObject refreshOnVisualizerButtonUIObject = FindElement.ByName("RefreshOnVisualizerButton");
00094                 Verify.IsNotNull(refreshOnVisualizerButtonUIObject, "Verifying that we found a UIElement called RefreshOnVisualizerButton");
00095
00096                 Wait.ForIdle();
00097
00098                 Log.Comment("Retrieve rotate refresh visualizer button as generic UIElement");
00099                 UIObject rotateButtonUIObject = FindElement.ByName("RotateButton");
00100                 Verify.IsNotNull(rotateButtonUIObject, "Verifying that we found a UIElement called RotateButton");
00101
00102                 Wait.ForIdle();
00103
00104                 Log.Comment("Retrieve the change alignment button as generic UIElement");
00105                 UIObject changeAlignmentUIObject = FindElement.ByName("ChangeAlignment");
00106                 Verify.IsNotNull(changeAlignmentUIObject, "Verifying that we found a UIElement called ChangeAlignment");
00107
00108                 Wait.ForIdle();
00109
00110                 Log.Comment("Retrieve refresh count text block as generic UIElement");
00111                 UIObject textboxUIObject = FindElement.ByName("RefreshCount");
00112                 Verify.IsNotNull(textboxUIObject, "Verifying that we found a UIElement called RefreshCount");
00113                 Edit textBox = new Edit(textboxUIObject);
00114
00115                 Wait.ForIdle();
00116
00117                 Log.Comment("Retrieve AddOrRemoveRefreshDelay button as generic UIElement");
00118                 UIObject AddOrRemoveRefreshDelayButtonUIObject = FindElement.ByName("AddOrRemoveRefreshDelay");
00119                 Verify.IsNotNull(AddOrRemoveRefreshDelayButtonUIObject, "Verifying that we found a UIElement called AddOrRemoveRefreshDelay");
00120
00121                 Wait.ForIdle();
00122
00123                 InputHelper.Tap(AddOrRemoveRefreshDelayButtonUIObject);
00124                 InputHelper.Tap(refreshOnContainerButtonUIObject);
00125                 WaitForEditValue("RefreshCount", "1");
00126
00127                 InputHelper.Tap(refreshOnVisualizerButtonUIObject);
00128                 WaitForEditValue("RefreshCount", "2");
00129
00130                 InputHelper.Tap(changeAlignmentUIObject);
00131                 Wait.ForIdle();
00132                 InputHelper.DragDistance(listViewItem1, 450, Direction.South, 800);
00133                 WaitForEditValue("RefreshCount", "3");
00134
00135                 InputHelper.Tap(rotateButtonUIObject);
00136                 InputHelper.Tap(changeAlignmentUIObject);
00137                 Wait.ForIdle();
00138                 InputHelper.DragDistance(listViewItem2, 450, Direction.East, 800);
00139                 WaitForEditValue("RefreshCount", "4");
00140
00141                 //The SV won't be at the bottom of its content to start so we will enter the peeking
00142                 //state and not perform a refresh
00143                 InputHelper.Tap(rotateButtonUIObject);
00144                 InputHelper.Tap(changeAlignmentUIObject);
00145                 Wait.ForIdle();
00146                 InputHelper.DragDistance(lvUIObject, 750, Direction.North);
00147                 Wait.ForIdle();
00148                 LogRefreshVisualizerStates();
00149                 Verify.AreEqual("4", textBox.Value);
00150
00151                 InputHelper.DragDistance(listViewItem10, 450, Direction.North, 800);
00152                 WaitForEditValue("RefreshCount", "5");
00153
00154                 InputHelper.Tap(rotateButtonUIObject);
00155                 InputHelper.Tap(changeAlignmentUIObject);
00156                 Wait.ForIdle();
00157                 InputHelper.DragDistance(listViewItem9, 450, Direction.West, 800);
00158                 WaitForEditValue("RefreshCount", "6");
00159
00160                 Log.Comment("Returning to the main PTR test page");
00161                 TestSetupHelper.GoBack();
00162             }
00163         }
00164
00165         [TestMethod]
00166         [TestProperty("Ignore", "True")] // TODO 29556471: Disabled after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00167         public void RefreshRequestedHandlersWorkOnEitherContainerOrVisualizerOrBoth()
00168         {
00169             using (var setup = new TestSetupHelper("PTR Tests")) // This literally clicks the button corresponding to the test page.
00170             {
00171                 Log.Comment("Retrieve the refresh container page button as generic UIElement");
00172                 UIObject refreshContainerButtonUIObject = FindElement.ByName("RefreshContainerPageButton");
00173                 Verify.IsNotNull(refreshContainerButtonUIObject, "Verifying that we found a UIElement called RefreshContainerPageButton");
00174                 Wait.ForIdle();
00175
00176                 //Navigate to the right page
00177                 InputHelper.Tap(refreshContainerButtonUIObject);
00178                 Wait.ForIdle();
00179
00180                 Log.Comment("Retrieve refresh on container button as generic UIElement");
00181                 UIObject refreshOnContainerButtonUIObject = FindElement.ByName("RefreshOnContainerButton");
00182                 Verify.IsNotNull(refreshOnContainerButtonUIObject, "Verifying that we found a UIElement called RefreshOnContainerButton");
00183
00184                 Wait.ForIdle();
00185
00186                 Log.Comment("Retrieve refresh on visualizer button as generic UIElement");
00187                 UIObject refreshOnVisualizerButtonUIObject = FindElement.ByName("RefreshOnVisualizerButton");
00188                 Verify.IsNotNull(refreshOnVisualizerButtonUIObject, "Verifying that we found a UIElement called RefreshOnVisualizerButton");
00189
00190                 Wait.ForIdle();
00191
00192                 Log.Comment("Retrieve refresh count text block as generic UIElement");
00193                 UIObject textboxUIObject = FindElement.ByName("RefreshCount");
00194                 Verify.IsNotNull(textboxUIObject, "Verifying that we found a UIElement called RefreshCount");
00195                 Edit textBox = new Edit(textboxUIObject);
00196
00197                 Wait.ForIdle();
00198
00199                 Log.Comment("Retrieve AddOrRemoveRefreshDelay button as generic UIElement");
00200                 UIObject AddOrRemoveRefreshDelayButtonUIObject = FindElement.ByName("AddOrRemoveRefreshDelay");
00201                 Verify.IsNotNull(AddOrRemoveRefreshDelayButtonUIObject, "Verifying that we found a UIElement called AddOrRemoveRefreshDelay");
00202
00203                 Wait.ForIdle();
00204
00205                 Log.Comment("Retrieve RCRefreshRequestedComboBoxSwitcher button as generic UIElement");
00206                 UIObject RCRefreshRequestedComboBoxSwitcherUIObject = FindElement.ByName("RCRefreshRequestedComboBoxSwitcher");
00207                 Verify.IsNotNull(RCRefreshRequestedComboBoxSwitcherUIObject, "Verifying that we found a UIElement called RCRefreshRequestedComboBoxSwitcher");
00208
00209                 Wait.ForIdle();
00210
00211                 Log.Comment("Retrieve RVRefreshRequestedComboBoxSwitcher button as generic UIElement");
00212                 UIObject RVRefreshRequestedComboBoxSwitcherUIObject = FindElement.ByName("RVRefreshRequestedComboBoxSwitcher");
00213                 Verify.IsNotNull(RVRefreshRequestedComboBoxSwitcherUIObject, "Verifying that we found a UIElement called RVRefreshRequestedComboBoxSwitcher");
00214
00215                 Wait.ForIdle();
00216
00217                 InputHelper.Tap(AddOrRemoveRefreshDelayButtonUIObject);
00218
00219                 InputHelper.Tap(refreshOnContainerButtonUIObject);
00220                 WaitForEditValue("RefreshCount", "1");
00221                 InputHelper.Tap(refreshOnVisualizerButtonUIObject);
00222                 WaitForEditValue("RefreshCount", "2");
00223
00224                 InputHelper.Tap(RVRefreshRequestedComboBoxSwitcherUIObject);
00225
00226                 //Now that both are on, the refresh count will go up twice as fast
00227                 InputHelper.Tap(refreshOnContainerButtonUIObject);
00228                 WaitForEditValue("RefreshCount", "4");
00229                 InputHelper.Tap(refreshOnVisualizerButtonUIObject);
00230                 WaitForEditValue("RefreshCount", "6");
00231
00232                 InputHelper.Tap(RCRefreshRequestedComboBoxSwitcherUIObject);
00233
00234                 InputHelper.Tap(refreshOnContainerButtonUIObject);
00235                 WaitForEditValue("RefreshCount", "7");
00236                 InputHelper.Tap(refreshOnVisualizerButtonUIObject);
00237                 WaitForEditValue("RefreshCount", "8");
00238
00239                 InputHelper.Tap(RVRefreshRequestedComboBoxSwitcherUIObject);
00240
00241                 //Now that neither are on the refresh count won't increase
00242                 InputHelper.Tap(refreshOnContainerButtonUIObject);
00243                 Wait.ForIdle();
00244                 LogRefreshVisualizerStates();
00245                 Verify.AreEqual("8", textBox.Value);
00246                 InputHelper.Tap(refreshOnVisualizerButtonUIObject);
00247                 Wait.ForIdle();
00248                 LogRefreshVisualizerStates();
00249                 Verify.AreEqual("8", textBox.Value);
00250
00251                 Log.Comment("Returning to the main PTR test page");
00252                 TestSetupHelper.GoBack();
00253             }
00254         }
00255
00256         //Issue #6649 Some tests fail when run on OS 21H1
00257         [TestMethod]
00258         [TestProperty("Ignore", "True")] // 24178380
00259         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00260         public void InteractionOnImageTest()
00261         {
00262             InteractionOnImageTestPrivate(withInfoProvider: false);
00263         }
00264
00265         //Issue #6649 Some tests fail when run on OS 21H1
00266         [TestMethod]
00267         [TestProperty("Ignore", "True")] //Task 24429465: DCPP: Multiple MUXControls interaction tests failing after IXP integration.
00268         [TestProperty("TestPass:MinOSVer", WindowsOSVersion.RS5)] // Touch input injection is only supported on RS5 and up
00269         public void InteractionOnImageWithInfoProviderTest()
00270         {
00271             InteractionOnImageTestPrivate(withInfoProvider: true);
00272         }
00273
00274         public void InteractionOnImageTestPrivate(bool withInfoProvider)
00275         {
00276             using (var setup = new TestSetupHelper("PTR Tests")) // This literally clicks the button corresponding to the test page.
00277             {
00278                 if (PlatformConfiguration.IsDevice(DeviceType.Phone))
00279                 {
00280                     Log.Warning("MSFT: 12949886 - Test is disabled on phone due to reliability issues");
00281                     return;
00282                 }
00283
00284                 Wait.ForIdle();
00285
00286                 Log.Comment("Retrieve the refresh container on image page button as generic UIElement");
00287                 UIObject refreshContainerOnImageButtonUIObject = FindElement.ByName("RefreshContainerOnImagePageButton");
00288                 Verify.IsNotNull(refreshContainerOnImageButtonUIObject, "Verifying that we found a UIElement called RefreshContainerOnImagePageButton");
00289                 Wait.ForIdle();
00290
00291                 //Navigate to the right page
00292                 InputHelper.Tap(refreshContainerOnImageButtonUIObject);
00293                 Wait.ForIdle();
00294
00295                 UIObject adaptButtonUIObject = null;
00296
00297                 if (withInfoProvider)
00298                 {
00299                     Log.Comment("Retrieve the adapt button as generic UIElement");
00300                     adaptButtonUIObject = FindElement.ByName("AdaptButton");
00301                     Verify.IsNotNull(adaptButtonUIObject, "Verifying that we found a UIElement called AdaptButton");
00302                     Wait.ForIdle();
00303                 }
00304
00305                 Log.Comment("Retrieve adapted image as generic UIElement");
00306                 UIObject imageUIObject = FindElement.ByName("Image");
00307                 Verify.IsNotNull(imageUIObject, "Verifying that we found a UIElement called Image");
00308
00309                 Wait.ForIdle();
00310
00311                 Log.Comment("Retrieve refresh on container button as generic UIElement");
00312                 UIObject refreshOnContainerButtonUIObject = FindElement.ByName("RefreshOnContainerButton");
00313                 Verify.IsNotNull(refreshOnContainerButtonUIObject, "Verifying that we found a UIElement called RefreshOnContainerButton");
00314
00315                 Wait.ForIdle();
00316
00317                 Log.Comment("Retrieve refresh on visualizer button as generic UIElement");
00318                 UIObject refreshOnVisualizerButtonUIObject = FindElement.ByName("RefreshOnVisualizerButton");
00319                 Verify.IsNotNull(refreshOnVisualizerButtonUIObject, "Verifying that we found a UIElement called RefreshOnVisualizerButton");
00320
00321                 Wait.ForIdle();
00322
00323                 Log.Comment("Retrieve rotate refresh visualizer button as generic UIElement");
00324                 UIObject rotateButtonUIObject = FindElement.ByName("RotateButton");
00325                 Verify.IsNotNull(rotateButtonUIObject, "Verifying that we found a UIElement called RotateButton");
00326
00327                 Wait.ForIdle();
00328
00329                 Log.Comment("Retrieve the change alignment button as generic UIElement");
00330                 UIObject changeAlignmentUIObject = FindElement.ByName("ChangeAlignment");
00331                 Verify.IsNotNull(changeAlignmentUIObject, "Verifying that we found a UIElement called ChangeAlignment");
00332
00333                 Wait.ForIdle();
00334
00335                 Log.Comment("Retrieve AddOrRemoveRefreshDelay button as generic UIElement");
00336                 UIObject AddOrRemoveRefreshDelayButtonUIObject = FindElement.ByName("AddOrRemoveRefreshDelay");
00337                 Verify.IsNotNull(AddOrRemoveRefreshDelayButtonUIObject, "Verifying that we found a UIElement called AddOrRemoveRefreshDelay");
00338
00339                 Wait.ForIdle();
00340
00341                 Log.Comment("Retrieve ChangeRefreshRequested button as generic UIElement");
00342                 UIObject ChangeRefreshRequestedUIObject = FindElement.ByName("ChangeRefreshRequested");
00343                 Verify.IsNotNull(ChangeRefreshRequestedUIObject, "Verifying that we found a UIElement called ChangeRefreshRequested");
00344
00345                 Wait.ForIdle();
00346
00347                 if (withInfoProvider)
00348                 {
00349                     InputHelper.Tap(adaptButtonUIObject);
00350                     Wait.ForIdle();
00351                 }
00352
00353                 InputHelper.Tap(AddOrRemoveRefreshDelayButtonUIObject);
00354                 InputHelper.Tap(refreshOnContainerButtonUIObject);
00355                 WaitForEditValue("RefreshCount", "1", logInteractionRatios: withInfoProvider);
00356
00357                 InputHelper.Tap(ChangeRefreshRequestedUIObject);
00358                 InputHelper.Tap(refreshOnVisualizerButtonUIObject);
00359                 WaitForEditValue("RefreshCount", "2", logInteractionRatios: withInfoProvider);
00360                 InputHelper.Tap(ChangeRefreshRequestedUIObject);
00361
00362                 InputHelper.Tap(changeAlignmentUIObject);
00363                 Wait.ForIdle();
00364                 InputHelper.DragDistance(imageUIObject, 450, Direction.South, 600);
00365                 WaitForEditValue("RefreshCount", "3", logInteractionRatios: withInfoProvider);
00366
00367                 InputHelper.Tap(rotateButtonUIObject);
00368                 InputHelper.Tap(changeAlignmentUIObject);
00369                 Wait.ForIdle();
00370                 if (withInfoProvider)
00371                 {
00372                     InputHelper.Tap(adaptButtonUIObject);
00373                     Wait.ForIdle();
00374                 }
00375                 InputHelper.DragDistance(imageUIObject, 450, Direction.East, 600);
00376                 WaitForEditValue("RefreshCount", "4", logInteractionRatios: withInfoProvider);
00377
00378                 InputHelper.Tap(rotateButtonUIObject);
00379                 InputHelper.Tap(changeAlignmentUIObject);
00380                 Wait.ForIdle();
00381                 if (withInfoProvider)
00382                 {
00383                     InputHelper.Tap(adaptButtonUIObject);
00384                     Wait.ForIdle();
00385                 }
00386                 InputHelper.DragDistance(imageUIObject, 450, Direction.North, 600);
00387                 WaitForEditValue("RefreshCount", "5", logInteractionRatios: withInfoProvider);
00388
00389                 InputHelper.Tap(rotateButtonUIObject);
00390                 InputHelper.Tap(changeAlignmentUIObject);
00391                 Wait.ForIdle();
00392                 if (withInfoProvider)
00393                 {
00394                     InputHelper.Tap(adaptButtonUIObject);
00395                     Wait.ForIdle();
00396                 }
00397                 InputHelper.DragDistance(imageUIObject, 450, Direction.West, 600);
00398                 WaitForEditValue("RefreshCount", "6", logInteractionRatios: withInfoProvider);
00399
00400                 Log.Comment("Returning to the main PTR test page");
00401                 TestSetupHelper.GoBack();
00402             }
00403         }
00404
00405         private void LogRefreshVisualizerStates()
00406         {
00407             Log.Comment("Logging successive refresh visualizer states");
00408             UIObject stateUIObject = FindElement.ById("States");
00409             Verify.IsNotNull(stateUIObject);
00410             ComboBox cmbStateUIObject = new ComboBox(stateUIObject);
00411             foreach (ComboBoxItem item in cmbStateUIObject.AllItems)
00412             {
00413                 Log.Comment(item.Name);
00414             }
00415
00416             Log.Comment("Resetting refresh visualizer states log");
00417             UIObject resetStatesUIObject = FindElement.ById("ResetStates");
00418             Verify.IsNotNull(resetStatesUIObject);
00419             Button resetStatesButton = new Button(resetStatesUIObject);
00420             resetStatesButton.Invoke();
00421             Wait.ForIdle();
00422         }
00423
00424         // Logs the InteractionRatio history stored in the ComboBox.Items collection of
00425         // the ComboBox named "InteractionRatios" then clears those items by invoking the
00426         // Button named "ResetInteractionRatios" to start a new history from scratch.
00427         private void LogInteractionRatios()
00428         {
00429             Log.Comment("Logging successive interaction ratios");
00430             UIObject interactionRatioUIObject = FindElement.ById("InteractionRatios");
00431             Verify.IsNotNull(interactionRatioUIObject);
00432             ComboBox cmbInteractionRatioUIObject = new ComboBox(interactionRatioUIObject);
00433             foreach (ComboBoxItem item in cmbInteractionRatioUIObject.AllItems)
00434             {
00435                 Log.Comment(item.Name);
00436             }
00437
00438             Log.Comment("Resetting interaction ratios log");
00439             UIObject resetInteractionRatiosUIObject = FindElement.ById("ResetInteractionRatios");
00440             Verify.IsNotNull(resetInteractionRatiosUIObject);
00441             Button resetInteractionRatiosButton = new Button(resetInteractionRatiosUIObject);
00442             resetInteractionRatiosButton.Invoke();
00443             Wait.ForIdle();
00444         }
00445
00446         private void WaitForEditValue(string editName, string editValue, bool logInteractionRatios = false)
00447         {
00448             Wait.ForIdle();
00449             Edit edit = new Edit(FindElement.ById(editName));
00450             Verify.IsNotNull(edit);
00451             Log.Comment("Current value for " + editName + ": " + edit.Value);
00452             if (edit.Value != editValue)
00453             {
00454                 using (var waiter = new ValueChangedEventWaiter(edit, editValue))
00455                 {
00456                     Log.Comment("Waiting for " + editName + " to be set to " + editValue);
00457
00458                     bool success = waiter.TryWait(TimeSpan.FromSeconds(3));
00459                     Log.Comment("Current value for " + editName + ": " + edit.Value);
00460
00461                     if (success)
00462                     {
00463                         Log.Comment("Wait succeeded");
00464                     }
00465                     else
00466                     {
00467                         if (edit.Value == editValue)
00468                         {
00469                             Log.Warning("Wait failed but TextBox contains expected Text");
00470                         }
00471                         else
00472                         {
00473                             Log.Error("Wait for edit value failed");
00474                             LogRefreshVisualizerStates();
00475                             if (logInteractionRatios)
00476                             {
00477                                 LogInteractionRatios();
00478                             }
00479                             throw new WaiterException();
00480                         }
00481                     }
00482                 }
00483             }
00484
00485             LogRefreshVisualizerStates();
00486             if (logInteractionRatios)
00487             {
00488                 LogInteractionRatios();
00489             }
00490         }
00491     }
00492 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AnimatedChevronUpDownSmallVisualSource.properties.cpp Source File

  • Generated

AnimatedChevronUpDownSmallVisualSource.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "AnimatedChevronUpDownSmallVisualSource.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(AnimatedChevronUpDownSmallVisualSource)
00012 }
00013
00014 #include "AnimatedChevronUpDownSmallVisualSource.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AnnotatedScrollBar.properties.cpp Source File

  • Generated

AnnotatedScrollBar.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "AnnotatedScrollBar.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(AnnotatedScrollBar)
00012 }
00013
00014 #include "AnnotatedScrollBar.g.cpp"
00015
00016 GlobalDependencyProperty AnnotatedScrollBarProperties::s_DetailLabelTemplateProperty{ nullptr };
00017 GlobalDependencyProperty AnnotatedScrollBarProperties::s_LabelsProperty{ nullptr };
00018 GlobalDependencyProperty AnnotatedScrollBarProperties::s_LabelTemplateProperty{ nullptr };
00019 GlobalDependencyProperty AnnotatedScrollBarProperties::s_SmallChangeProperty{ nullptr };
00020
00021 AnnotatedScrollBarProperties::AnnotatedScrollBarProperties()
00022     : m_detailLabelRequestedEventSource{static_cast<AnnotatedScrollBar*>(this)}
00023     , m_scrollingEventSource{static_cast<AnnotatedScrollBar*>(this)}
00024 {
00025     EnsureProperties();
00026 }
00027
00028 void AnnotatedScrollBarProperties::EnsureProperties()
00029 {
00030     if (!s_DetailLabelTemplateProperty)
00031     {
00032         s_DetailLabelTemplateProperty =
00033             InitializeDependencyProperty(
00034                 L"DetailLabelTemplate",
00035                 winrt::name_of<winrt::IElementFactory>(),
00036                 winrt::name_of<winrt::AnnotatedScrollBar>(),
00037                 false /* isAttached */,
00038                 ValueHelper<winrt::IElementFactory>::BoxedDefaultValue(),
00039                 winrt::PropertyChangedCallback(&OnDetailLabelTemplatePropertyChanged));
00040     }
00041     if (!s_LabelsProperty)
00042     {
00043         s_LabelsProperty =
00044             InitializeDependencyProperty(
00045                 L"Labels",
00046                 winrt::name_of<winrt::IVector<winrt::AnnotatedScrollBarLabel>>(),
00047                 winrt::name_of<winrt::AnnotatedScrollBar>(),
00048                 false /* isAttached */,
00049                 ValueHelper<winrt::IVector<winrt::AnnotatedScrollBarLabel>>::BoxedDefaultValue(),
00050                 winrt::PropertyChangedCallback(&OnLabelsPropertyChanged));
00051     }
00052     if (!s_LabelTemplateProperty)
00053     {
00054         s_LabelTemplateProperty =
00055             InitializeDependencyProperty(
00056                 L"LabelTemplate",
00057                 winrt::name_of<winrt::IElementFactory>(),
00058                 winrt::name_of<winrt::AnnotatedScrollBar>(),
00059                 false /* isAttached */,
00060                 ValueHelper<winrt::IElementFactory>::BoxedDefaultValue(),
00061                 winrt::PropertyChangedCallback(&OnLabelTemplatePropertyChanged));
00062     }
00063     if (!s_SmallChangeProperty)
00064     {
00065         s_SmallChangeProperty =
00066             InitializeDependencyProperty(
00067                 L"SmallChange",
00068                 winrt::name_of<double>(),
00069                 winrt::name_of<winrt::AnnotatedScrollBar>(),
00070                 false /* isAttached */,
00071                 ValueHelper<double>::BoxedDefaultValue(),
00072                 winrt::PropertyChangedCallback(&OnSmallChangePropertyChanged));
00073     }
00074 }
00075
00076 void AnnotatedScrollBarProperties::ClearProperties()
00077 {
00078     s_DetailLabelTemplateProperty = nullptr;
00079     s_LabelsProperty = nullptr;
00080     s_LabelTemplateProperty = nullptr;
00081     s_SmallChangeProperty = nullptr;
00082 }
00083
00084 void AnnotatedScrollBarProperties::OnDetailLabelTemplatePropertyChanged(
00085     winrt::DependencyObject const& sender,
00086     winrt::DependencyPropertyChangedEventArgs const& args)
00087 {
00088     auto owner = sender.as<winrt::AnnotatedScrollBar>();
00089     winrt::get_self<AnnotatedScrollBar>(owner)->OnPropertyChanged(args);
00090 }
00091
00092 void AnnotatedScrollBarProperties::OnLabelsPropertyChanged(
00093     winrt::DependencyObject const& sender,
00094     winrt::DependencyPropertyChangedEventArgs const& args)
00095 {
00096     auto owner = sender.as<winrt::AnnotatedScrollBar>();
00097     winrt::get_self<AnnotatedScrollBar>(owner)->OnPropertyChanged(args);
00098 }
00099
00100 void AnnotatedScrollBarProperties::OnLabelTemplatePropertyChanged(
00101     winrt::DependencyObject const& sender,
00102     winrt::DependencyPropertyChangedEventArgs const& args)
00103 {
00104     auto owner = sender.as<winrt::AnnotatedScrollBar>();
00105     winrt::get_self<AnnotatedScrollBar>(owner)->OnPropertyChanged(args);
00106 }
00107
00108 void AnnotatedScrollBarProperties::OnSmallChangePropertyChanged(
00109     winrt::DependencyObject const& sender,
00110     winrt::DependencyPropertyChangedEventArgs const& args)
00111 {
00112     auto owner = sender.as<winrt::AnnotatedScrollBar>();
00113     winrt::get_self<AnnotatedScrollBar>(owner)->OnPropertyChanged(args);
00114 }
00115
00116 void AnnotatedScrollBarProperties::DetailLabelTemplate(winrt::IElementFactory const& value)
00117 {
00118     [[gsl::suppress(con)]]
00119     {
00120     static_cast<AnnotatedScrollBar*>(this)->SetValue(s_DetailLabelTemplateProperty, ValueHelper<winrt::IElementFactory>::BoxValueIfNecessary(value));
00121     }
00122 }
00123
00124 winrt::IElementFactory AnnotatedScrollBarProperties::DetailLabelTemplate()
00125 {
00126     return ValueHelper<winrt::IElementFactory>::CastOrUnbox(static_cast<AnnotatedScrollBar*>(this)->GetValue(s_DetailLabelTemplateProperty));
00127 }
00128
00129 void AnnotatedScrollBarProperties::Labels(winrt::IVector<winrt::AnnotatedScrollBarLabel> const& value)
00130 {
00131     [[gsl::suppress(con)]]
00132     {
00133     static_cast<AnnotatedScrollBar*>(this)->SetValue(s_LabelsProperty, ValueHelper<winrt::IVector<winrt::AnnotatedScrollBarLabel>>::BoxValueIfNecessary(value));
00134     }
00135 }
00136
00137 winrt::IVector<winrt::AnnotatedScrollBarLabel> AnnotatedScrollBarProperties::Labels()
00138 {
00139     return ValueHelper<winrt::IVector<winrt::AnnotatedScrollBarLabel>>::CastOrUnbox(static_cast<AnnotatedScrollBar*>(this)->GetValue(s_LabelsProperty));
00140 }
00141
00142 void AnnotatedScrollBarProperties::LabelTemplate(winrt::IElementFactory const& value)
00143 {
00144     [[gsl::suppress(con)]]
00145     {
00146     static_cast<AnnotatedScrollBar*>(this)->SetValue(s_LabelTemplateProperty, ValueHelper<winrt::IElementFactory>::BoxValueIfNecessary(value));
00147     }
00148 }
00149
00150 winrt::IElementFactory AnnotatedScrollBarProperties::LabelTemplate()
00151 {
00152     return ValueHelper<winrt::IElementFactory>::CastOrUnbox(static_cast<AnnotatedScrollBar*>(this)->GetValue(s_LabelTemplateProperty));
00153 }
00154
00155 void AnnotatedScrollBarProperties::SmallChange(double value)
00156 {
00157     [[gsl::suppress(con)]]
00158     {
00159     static_cast<AnnotatedScrollBar*>(this)->SetValue(s_SmallChangeProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00160     }
00161 }
00162
00163 double AnnotatedScrollBarProperties::SmallChange()
00164 {
00165     return ValueHelper<double>::CastOrUnbox(static_cast<AnnotatedScrollBar*>(this)->GetValue(s_SmallChangeProperty));
00166 }
00167
00168 winrt::event_token AnnotatedScrollBarProperties::DetailLabelRequested(winrt::TypedEventHandler<winrt::AnnotatedScrollBar, winrt::AnnotatedScrollBarDetailLabelRequestedEventArgs> const& value)
00169 {
00170     return m_detailLabelRequestedEventSource.add(value);
00171 }
00172
00173 void AnnotatedScrollBarProperties::DetailLabelRequested(winrt::event_token const& token)
00174 {
00175     m_detailLabelRequestedEventSource.remove(token);
00176 }
00177
00178 winrt::event_token AnnotatedScrollBarProperties::Scrolling(winrt::TypedEventHandler<winrt::AnnotatedScrollBar, winrt::AnnotatedScrollBarScrollingEventArgs> const& value)
00179 {
00180     return m_scrollingEventSource.add(value);
00181 }
00182
00183 void AnnotatedScrollBarProperties::Scrolling(winrt::event_token const& token)
00184 {
00185     m_scrollingEventSource.remove(token);
00186 }
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommandBarFlyout/APITests/CommandBarFlyoutTests.cs Source File

  • CommandBarFlyout
  • APITests

CommandBarFlyoutTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using MUXControlsTestApp.Utilities;
00006 using System;
00007 using System.Collections.Generic;
00008 using System.Linq;
00009 using System.Threading;
00010 using Windows.Foundation.Metadata;
00011 using Windows.System;
00012 using Microsoft.UI.Xaml;
00013 using Microsoft.UI.Xaml.Controls;
00014 using Microsoft.UI.Xaml.Controls.Primitives;
00015 using Microsoft.UI.Xaml.Input;
00016 using Microsoft.UI.Xaml.Media;
00017
00018 using WEX.TestExecution;
00019 using WEX.TestExecution.Markup;
00020 using WEX.Logging.Interop;
00021
00022 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00023 {
00024     [TestClass]
00025     public class CommandBarFlyoutTests : ApiTestBase
00026     {
00027         [TestMethod]
00028         [TestProperty("Description", "Verifies the CommandBarFlyout's default properties.")]
00029         public void VerifyFlyoutDefaultPropertyValues()
00030         {
00031             RunOnUIThread.Execute(() =>
00032             {
00033                 CommandBarFlyout commandBarFlyout = new CommandBarFlyout();
00034                 Verify.IsNotNull(commandBarFlyout);
00035
00036                 Verify.IsNotNull(commandBarFlyout.PrimaryCommands);
00037                 Verify.AreEqual(0, commandBarFlyout.PrimaryCommands.Count);
00038                 Verify.IsNotNull(commandBarFlyout.SecondaryCommands);
00039                 Verify.AreEqual(0, commandBarFlyout.SecondaryCommands.Count);
00040             });
00041         }
00042
00043         [TestMethod]
00044         [TestProperty("Description", "Verifies that setting commands on CommandBarFlyout causes them to propagate down to its CommandBar.")]
00045         public void VerifyFlyoutCommandsArePropagatedToTheCommandBar()
00046         {
00047             CommandBarFlyout commandBarFlyout = null;
00048             Button commandBarFlyoutTarget = null;
00049
00050             SetupCommandBarFlyoutTest(out commandBarFlyout, out commandBarFlyoutTarget);
00051             OpenFlyout(commandBarFlyout, commandBarFlyoutTarget);
00052
00053             RunOnUIThread.Execute(() =>
00054             {
00055                 Popup flyoutPopup = VisualTreeHelper.GetOpenPopupsForXamlRoot(commandBarFlyout.XamlRoot).Last();
00056                 CommandBar commandBar = TestUtilities.FindDescendents<CommandBar>(flyoutPopup).Single();
00057
00058                 Verify.AreEqual(commandBarFlyout.PrimaryCommands.Count, commandBar.PrimaryCommands.Count);
00059
00060                 for (int i = 0; i < commandBarFlyout.PrimaryCommands.Count; i++)
00061                 {
00062                     Verify.AreEqual(commandBarFlyout.PrimaryCommands[i], commandBar.PrimaryCommands[i]);
00063                 }
00064
00065                 Verify.AreEqual(commandBarFlyout.SecondaryCommands.Count, commandBar.SecondaryCommands.Count);
00066
00067                 for (int i = 0; i < commandBarFlyout.SecondaryCommands.Count; i++)
00068                 {
00069                     Verify.AreEqual(commandBarFlyout.SecondaryCommands[i], commandBar.SecondaryCommands[i]);
00070                 }
00071             });
00072
00073             CloseFlyout(commandBarFlyout);
00074         }
00075
00076         private enum CommandBarSizingOptions
00077         {
00078             PrimaryItemsLarger,
00079             SecondaryItemsLarger,
00080             SecondaryItemsMaxWidth,
00081             SecondaryItemsMaxHeight,
00082         }
00083
00084         [TestMethod]
00085         [TestProperty("Description", "Verifies that the overflow popup sizes itself to be the size of the main command bar if the primary items section width is larger than the secondary items section width.")]
00086         public void VerifyCommandBarSizingPrimaryItemsLarger()
00087         {
00088             VerifyCommandBarSizing(CommandBarSizingOptions.PrimaryItemsLarger);
00089         }
00090
00091         [TestMethod]
00092         [TestProperty("Description", "Verifies that the main command bar sizes itself to be the size of the overflow popup when open if the primary items section width is smaller than the secondary items section width.")]
00093         public void VerifyCommandBarSizingSecondaryItemsLarger()
00094         {
00095             VerifyCommandBarSizing(CommandBarSizingOptions.SecondaryItemsLarger);
00096         }
00097
00098         [TestMethod]
00099         [TestProperty("Description", "Verifies that the command bar and overflow popup do not size themselves to be larger than the max width if a very wide AppBarButton is present.")]
00100         public void VerifyCommandBarSizingSecondaryItemsMaxWidth()
00101         {
00102             VerifyCommandBarSizing(CommandBarSizingOptions.SecondaryItemsMaxWidth);
00103         }
00104
00105         [TestMethod]
00106         [TestProperty("Description", "Verifies that the overflow popup does not size itself to be larger than its max height if a sufficiently large number of AppBarButtons are present.")]
00107         public void VerifyCommandBarSizingSecondaryItemsMaxHeight()
00108         {
00109             VerifyCommandBarSizing(CommandBarSizingOptions.SecondaryItemsMaxHeight);
00110         }
00111
00112         private void VerifyCommandBarSizing(CommandBarSizingOptions sizingOptions)
00113         {
00114             CommandBarFlyout commandBarFlyout = null;
00115             Button commandBarFlyoutTarget = null;
00116
00117             SetupCommandBarFlyoutTest(out commandBarFlyout, out commandBarFlyoutTarget);
00118
00119             RunOnUIThread.Execute(() =>
00120             {
00121                 switch (sizingOptions)
00122                 {
00123                     case CommandBarSizingOptions.SecondaryItemsLarger:
00124                         commandBarFlyout.SecondaryCommands.Add(new AppBarButton() { Label = "Item with a label wider than primary items" });
00125                         break;
00126                     case CommandBarSizingOptions.SecondaryItemsMaxWidth:
00127                         commandBarFlyout.SecondaryCommands.Add(new AppBarButton() { Label = "Item with a really really really long label that will not fit in the space provided" });
00128                         break;
00129                     case CommandBarSizingOptions.SecondaryItemsMaxHeight:
00130                         for (int i = 0; i < 20; i++)
00131                         {
00132                             commandBarFlyout.SecondaryCommands.Add(new AppBarButton() { Label = "Do another thing" });
00133                         }
00134                         break;
00135                 }
00136             });
00137
00138             OpenFlyout(commandBarFlyout, commandBarFlyoutTarget);
00139
00140             CommandBar commandBar = null;
00141
00142             RunOnUIThread.Execute(() =>
00143             {
00144                 Popup flyoutPopup = VisualTreeHelper.GetOpenPopupsForXamlRoot(commandBarFlyout.XamlRoot).Last();
00145                 commandBar = TestUtilities.FindDescendents<CommandBar>(flyoutPopup).Single();
00146             });
00147
00148             IdleSynchronizer.Wait();
00149
00150             RunOnUIThread.Execute(() =>
00151             {
00152                 // Pre-RS5, CommandBarFlyouts always open expanded, so to put us in a known good state,
00153                 // we'll collapse the flyout before we do anything else.
00154                 commandBar.IsOpen = false;
00155             });
00156
00157             IdleSynchronizer.Wait();
00158
00159             double originalWidth = 0;
00160             double originalHeight = 0;
00161
00162             RunOnUIThread.Execute(() =>
00163             {
00164                 Popup flyoutPopup = VisualTreeHelper.GetOpenPopupsForXamlRoot(commandBar.XamlRoot).Last();
00165                 commandBar = TestUtilities.FindDescendents<CommandBar>(flyoutPopup).Single();
00166
00167                 originalWidth = commandBar.ActualWidth;
00168                 originalHeight = commandBar.ActualHeight;
00169
00170                 commandBar.IsOpen = true;
00171             });
00172
00173             IdleSynchronizer.Wait();
00174
00175             RunOnUIThread.Execute(() =>
00176             {
00177                 CommandBarOverflowPresenter overflowPresenter = TestUtilities.FindDescendents<CommandBarOverflowPresenter>(commandBar).Single();
00178
00179                 if (sizingOptions == CommandBarSizingOptions.PrimaryItemsLarger ||
00180                     sizingOptions == CommandBarSizingOptions.SecondaryItemsMaxHeight)
00181                 {
00182                     Verify.AreEqual(originalWidth, commandBar.ActualWidth);
00183                     Verify.AreEqual(originalWidth, overflowPresenter.ActualWidth);
00184                 }
00185                 else
00186                 {
00187                     Verify.IsLessThan(originalWidth, commandBar.ActualWidth);
00188                     Verify.AreEqual(overflowPresenter.ActualWidth, commandBar.ActualWidth);
00189                 }
00190
00191                 Verify.AreEqual(originalHeight, commandBar.ActualHeight);
00192
00193                 if (sizingOptions == CommandBarSizingOptions.SecondaryItemsMaxWidth)
00194                 {
00195                     Verify.AreEqual(commandBar.MaxWidth, commandBar.ActualWidth);
00196                 }
00197                 else if (sizingOptions == CommandBarSizingOptions.SecondaryItemsMaxHeight)
00198                 {
00199                     Verify.AreEqual(overflowPresenter.MaxHeight, overflowPresenter.ActualHeight);
00200                 }
00201
00202                 commandBar.IsOpen = false;
00203             });
00204
00205             IdleSynchronizer.Wait();
00206             CloseFlyout(commandBarFlyout);
00207         }
00208
00209         [TestMethod]
00210         [TestProperty("Description", "Verifies that the overflow popup does not size itself to be larger than its max height if a sufficiently large number of AppBarButtons are present.")]
00211         public void VerifyPrimaryCommandsCanOverflowToSecondaryItemsControl()
00212         {
00213             CommandBarFlyout flyout = null;
00214             Button flyoutTarget = null;
00215
00216             RunOnUIThread.Execute(() =>
00217             {
00218                 flyout = new CommandBarFlyout() { Placement = FlyoutPlacementMode.Right };
00219
00220                 flyout.PrimaryCommands.Add(new AppBarButton());
00221                 flyout.PrimaryCommands.Add(new AppBarButton());
00222                 flyout.PrimaryCommands.Add(new AppBarButton());
00223                 flyout.PrimaryCommands.Add(new AppBarButton());
00224                 flyout.PrimaryCommands.Add(new AppBarButton());
00225                 flyout.PrimaryCommands.Add(new AppBarButton());
00226                 flyout.PrimaryCommands.Add(new AppBarButton());
00227                 flyout.PrimaryCommands.Add(new AppBarButton());
00228                 flyout.PrimaryCommands.Add(new AppBarButton());
00229                 flyout.PrimaryCommands.Add(new AppBarButton());
00230                 flyout.PrimaryCommands.Add(new AppBarButton());
00231                 flyout.PrimaryCommands.Add(new AppBarButton());
00232                 flyout.PrimaryCommands.Add(new AppBarButton());
00233                 flyout.PrimaryCommands.Add(new AppBarButton());
00234                 flyout.PrimaryCommands.Add(new AppBarButton());
00235                 flyout.PrimaryCommands.Add(new AppBarButton());
00236                 flyout.PrimaryCommands.Add(new AppBarButton());
00237                 flyout.PrimaryCommands.Add(new AppBarButton());
00238                 flyout.PrimaryCommands.Add(new AppBarButton());
00239                 flyout.PrimaryCommands.Add(new AppBarButton());
00240
00241                 flyout.SecondaryCommands.Add(new AppBarButton() { Label = "Item 21" });
00242                 flyout.SecondaryCommands.Add(new AppBarButton() { Label = "Item 22" });
00243                 flyout.SecondaryCommands.Add(new AppBarButton() { Label = "Item 23" });
00244                 flyout.SecondaryCommands.Add(new AppBarButton() { Label = "Item 24" });
00245                 flyout.SecondaryCommands.Add(new AppBarButton() { Label = "Item 25" });
00246
00247                 flyoutTarget = new Button() { Content = "Click for flyout" };
00248                 Content = flyoutTarget;
00249                 Content.UpdateLayout();
00250             });
00251
00252             OpenFlyout(flyout, flyoutTarget);
00253
00254             RunOnUIThread.Execute(() =>
00255             {
00256                 Popup flyoutPopup = VisualTreeHelper.GetOpenPopupsForXamlRoot(flyoutTarget.XamlRoot).Last();
00257                 CommandBar commandBar = TestUtilities.FindDescendents<CommandBar>(flyoutPopup).Single();
00258
00259                 IList<ItemsControl> itemsControls = TestUtilities.FindDescendents<ItemsControl>(commandBar);
00260
00261                 Log.Comment("We expect there to be 2 ItemsControls inside the CommandBar; {0} were found.", itemsControls.Count);
00262                 Verify.AreEqual(2, itemsControls.Count);
00263
00264                 ItemsControl primaryItemsControl = itemsControls[0];
00265                 ItemsControl secondaryItemsControl = itemsControls[1];
00266
00267                 Log.Comment("We expect there to be 9 items located inside the primary ItemsControl; {0} were found.", primaryItemsControl.Items.Count);
00268                 Verify.AreEqual(9, primaryItemsControl.Items.Count);
00269                 Log.Comment("We expect there to be 17 items located inside the secondary ItemsControl (16 + autogenerated separator); {0} were found.", secondaryItemsControl.Items.Count);
00270                 Verify.AreEqual(17, secondaryItemsControl.Items.Count);
00271             });
00272
00273             CloseFlyout(flyout);
00274         }
00275
00276         [TestMethod]
00277         [TestProperty("Description", "Verifies that labels cause primary commmands to be wider than without, and to have their labels be visible.")]
00278         public void VerifyPrimaryCommandLabelsAffectLayout()
00279         {
00280             CommandBarFlyout flyout = null;
00281             Button flyoutTarget = null;
00282             AppBarButton button1 = null;
00283             AppBarButton button2 = null;
00284
00285             RunOnUIThread.Execute(() =>
00286             {
00287                 flyout = new CommandBarFlyout() { Placement = FlyoutPlacementMode.Right };
00288
00289                 button1 = new AppBarButton();
00290                 button2 = new AppBarButton();
00291
00292                 flyout.PrimaryCommands.Add(button1);
00293                 flyout.PrimaryCommands.Add(button2);
00294
00295                 flyoutTarget = new Button() { Content = "Click for flyout" };
00296                 Content = flyoutTarget;
00297                 Content.UpdateLayout();
00298             });
00299
00300             OpenFlyout(flyout, flyoutTarget);
00301
00302             double originalWidth = 0;
00303             double originalHeight = 0;
00304
00305             CommandBar commandBar = null;
00306             TextBlock button1TextLabel = null;
00307             TextBlock button2TextLabel = null;
00308
00309             RunOnUIThread.Execute(() =>
00310             {
00311                 button1TextLabel = TestUtilities.FindDescendents<TextBlock>(button1).Where(textBlock => textBlock.Name == "TextLabel").Single();
00312                 button2TextLabel = TestUtilities.FindDescendents<TextBlock>(button2).Where(textBlock => textBlock.Name == "TextLabel").Single();
00313
00314                 Log.Comment("We expect the TextLabel template parts to be collapsed when the Label property is empty.");
00315                 Verify.AreEqual(Visibility.Collapsed, button1TextLabel.Visibility);
00316                 Verify.AreEqual(Visibility.Collapsed, button2TextLabel.Visibility);
00317
00318                 Popup flyoutPopup = VisualTreeHelper.GetOpenPopupsForXamlRoot(flyoutTarget.XamlRoot).Last();
00319                 commandBar = TestUtilities.FindDescendents<CommandBar>(flyoutPopup).Single();
00320
00321                 originalWidth = commandBar.ActualWidth;
00322                 originalHeight = commandBar.ActualHeight;
00323             });
00324
00325             CloseFlyout(flyout);
00326
00327             RunOnUIThread.Execute(() =>
00328             {
00329                 button1.Label = "Item 1";
00330             });
00331
00332             OpenFlyout(flyout, flyoutTarget);
00333
00334             double finalWidth = 0;
00335             double finalHeight = 0;
00336
00337             RunOnUIThread.Execute(() =>
00338             {
00339                 Log.Comment("We expect the TextLabel template parts to be visible when the Label property is set.");
00340                 Verify.AreEqual(Visibility.Visible, button1TextLabel.Visibility);
00341                 Verify.AreEqual(Visibility.Visible, button2TextLabel.Visibility);
00342
00343                 finalWidth = commandBar.ActualWidth;
00344                 finalHeight = commandBar.ActualHeight;
00345
00346                 Log.Comment("We also expect the width and height of the AppBarButtons to be larger when the Label property is set on at least one primary command.");
00347                 Verify.IsGreaterThan(finalWidth, originalWidth);
00348                 Verify.IsGreaterThan(finalHeight, originalHeight);
00349             });
00350
00351             CloseFlyout(flyout);
00352
00353             RunOnUIThread.Execute(() =>
00354             {
00355                 button2.Label = "Item 2";
00356             });
00357
00358             OpenFlyout(flyout, flyoutTarget);
00359
00360             RunOnUIThread.Execute(() =>
00361             {
00362                 Log.Comment("Having all labels set should not make things any wider or taller than only some labels set.");
00363                 Verify.AreEqual(Math.Round(finalWidth), Math.Round(commandBar.ActualWidth));
00364                 Verify.AreEqual(Math.Round(finalHeight), Math.Round(commandBar.ActualHeight));
00365             });
00366
00367             CloseFlyout(flyout);
00368         }
00369
00370         [TestMethod]
00371         [TestProperty("Description", "Verifies that CommandBarFlyoutCommandBar can set its SystemBackdrop without being parented to the tree.")]
00372         public void VerifyDisconnectedFlyoutCommandBar()
00373         {
00374             CommandBarFlyoutCommandBar cbfcb = null;
00375             DesktopAcrylicBackdrop dba = null;
00376
00377             RunOnUIThread.Execute(() =>
00378             {
00379                 cbfcb = new CommandBarFlyoutCommandBar();
00380                 dba = new DesktopAcrylicBackdrop();
00381
00382                 // cbfcb isn't in the tree yet. Setting this shouldn't crash. The parser will do this (set properties before inserting into tree).
00383                 cbfcb.SystemBackdrop = dba;
00384
00385                 // dbfcb shouldn't crash when it's destroyed.
00386                 cbfcb = null;
00387                 GC.Collect();
00388                 GC.WaitForPendingFinalizers();
00389                 GC.Collect();
00390             });
00391
00392             IdleSynchronizer.Wait();
00393         }
00394
00395         private void SetupCommandBarFlyoutTest(out CommandBarFlyout flyout, out Button flyoutTarget)
00396         {
00397             CommandBarFlyout commandBarFlyout = null;
00398             Button commandBarFlyoutTarget = null;
00399
00400             RunOnUIThread.Execute(() =>
00401             {
00402                 commandBarFlyout = new CommandBarFlyout() { Placement = FlyoutPlacementMode.Right };
00403
00404                 commandBarFlyout.PrimaryCommands.Add(new AppBarButton() { Icon = new SymbolIcon(Symbol.Cut) });
00405                 commandBarFlyout.PrimaryCommands.Add(new AppBarButton() { Icon = new SymbolIcon(Symbol.Copy) });
00406                 commandBarFlyout.PrimaryCommands.Add(new AppBarButton() { Icon = new SymbolIcon(Symbol.Paste) });
00407                 commandBarFlyout.PrimaryCommands.Add(new AppBarButton() { Icon = new SymbolIcon(Symbol.Bold) });
00408                 commandBarFlyout.PrimaryCommands.Add(new AppBarButton() { Icon = new SymbolIcon(Symbol.Italic) });
00409                 commandBarFlyout.PrimaryCommands.Add(new AppBarButton() { Icon = new SymbolIcon(Symbol.Underline) });
00410
00411                 AppBarButton undoButton = new AppBarButton() { Label = "Undo", Icon = new SymbolIcon(Symbol.Undo) };
00412                 commandBarFlyout.SecondaryCommands.Add(undoButton);
00413                 AppBarButton redoButton = new AppBarButton() { Label = "Redo", Icon = new SymbolIcon(Symbol.Redo) };
00414                 commandBarFlyout.SecondaryCommands.Add(redoButton);
00415                 AppBarButton selectAllButton = new AppBarButton() { Label = "Select all" };
00416                 commandBarFlyout.SecondaryCommands.Add(selectAllButton);
00417
00418                 undoButton.KeyboardAccelerators.Add(new KeyboardAccelerator() { Key = VirtualKey.Z, Modifiers = VirtualKeyModifiers.Control });
00419                 redoButton.KeyboardAccelerators.Add(new KeyboardAccelerator() { Key = VirtualKey.Y, Modifiers = VirtualKeyModifiers.Control });
00420                 selectAllButton.KeyboardAccelerators.Add(new KeyboardAccelerator() { Key = VirtualKey.A, Modifiers = VirtualKeyModifiers.Control });
00421
00422                 commandBarFlyoutTarget = new Button() { Content = "Click for flyout" };
00423                 Content = commandBarFlyoutTarget;
00424                 Content.UpdateLayout();
00425             });
00426
00427             flyout = commandBarFlyout;
00428             flyoutTarget = commandBarFlyoutTarget;
00429         }
00430
00431         private void OpenFlyout(CommandBarFlyout flyout, Button flyoutTarget)
00432         {
00433             Log.Comment("Opening flyout...");
00434             AutoResetEvent openedEvent = new AutoResetEvent(false);
00435
00436             RunOnUIThread.Execute(() =>
00437             {
00438                 flyout.Opened += (sender, args) => openedEvent.Set();
00439                 flyout.ShowAt(flyoutTarget, new FlyoutShowOptions { ShowMode = FlyoutShowMode.Transient });
00440             });
00441
00442             TestUtilities.WaitForEvent(openedEvent);
00443             IdleSynchronizer.Wait();
00444             Log.Comment("Flyout opened.");
00445         }
00446
00447         private void CloseFlyout(CommandBarFlyout flyout)
00448         {
00449             Log.Comment("Closing flyout...");
00450             AutoResetEvent closedEvent = new AutoResetEvent(false);
00451
00452             RunOnUIThread.Execute(() =>
00453             {
00454                 flyout.Closed += (sender, args) => closedEvent.Set();
00455                 flyout.Hide();
00456             });
00457
00458             TestUtilities.WaitForEvent(closedEvent);
00459             IdleSynchronizer.Wait();
00460             Log.Comment("Flyout closed.");
00461         }
00462     }
00463 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/PhasingTests.cs Source File

  • Repeater
  • APITests

PhasingTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using MUXControlsTestApp.Utilities;
00006 using System;
00007 using System.Collections.Generic;
00008 using System.Linq;
00009 using System.Threading;
00010 using Microsoft.UI.Xaml;
00011 using Microsoft.UI.Xaml.Controls;
00012 using Microsoft.UI.Xaml.Markup;
00013 using Microsoft.UI.Private.Controls;
00014
00015 using WEX.TestExecution;
00016 using WEX.TestExecution.Markup;
00017 using WEX.Logging.Interop;
00018
00019 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests
00020 {
00021     using ElementFactory = Microsoft.UI.Xaml.Controls.ElementFactory;
00022
00023     // Bug 17377723: crash in CControlTemplate::CreateXBindConnector in RS5.
00024     [TestClass]
00025     public class PhasingTests : ApiTestBase
00026     {
00027         const int expectedLastRealizedIndex = 8;
00028
00029         [TestMethod]
00030         public void ValidatePhaseInvokeAndOrdering()
00031         {
00032             ItemsRepeater repeater = null;
00033             int numPhases = 6; // 0 to 5
00034             ManualResetEvent buildTreeCompleted = new ManualResetEvent(false);
00035
00036             RunOnUIThread.Execute(() =>
00037             {
00038                 var itemTemplate = (DataTemplate)XamlReader.Load(
00039                        @"<DataTemplate  xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00040                             <Button Width='100' Height='100'/>
00041                         </DataTemplate>");
00042                 repeater = new ItemsRepeater()
00043                 {
00044                     ItemsSource = Enumerable.Range(0, 10),
00045                     ItemTemplate = new CustomElementFactory(numPhases),
00046                     Layout = new StackLayout(),
00047                 };
00048
00049                 repeater.ElementPrepared += (sender, args) =>
00050                 {
00051                     if (args.Index == expectedLastRealizedIndex)
00052                     {
00053                         Log.Comment("Item 8 Created!" );
00054                         RepeaterTestHooks.BuildTreeCompleted += (sender1, args1) =>
00055                         {
00056                             buildTreeCompleted.Set();
00057                         };
00058                     }
00059                 };
00060
00061                 Content = new ItemsRepeaterScrollHost()
00062                 {
00063                     Width = 400,
00064                     Height = 400,
00065                     ScrollViewer = new ScrollViewer
00066                     {
00067                         Content = repeater
00068                     }
00069                 };
00070
00071                 // CompositionTarget.Rendering += (sender, args) => { Log.Comment("Rendering"); }; // debugging aid
00072             });
00073
00074             if(buildTreeCompleted.WaitOne(TimeSpan.FromMilliseconds(2000)))
00075             {
00076                 RunOnUIThread.Execute(() =>
00077                 {
00078                     var calls = ElementPhasingManager.ProcessedCalls;
00079
00080                     Verify.AreEqual(9, calls.Count);
00081                     calls[0].RemoveAt(0); // Remove the create we did for first measure.
00082                     foreach (var index in calls.Keys)
00083                     {
00084                         var phases = calls[index];
00085                         Verify.AreEqual(6, phases.Count);
00086                         for (int i = 0; i < phases.Count; i++)
00087                         {
00088                             Verify.AreEqual(i, phases[i]);
00089                         }
00090                     }
00091
00092                     ElementPhasingManager.ProcessedCalls.Clear();
00093                 });
00094             }
00095             else
00096             {
00097                 Verify.Fail("Failed on waiting on build tree.");
00098             }
00099         }
00100
00101         [TestMethod]
00102         public void ValidateXBindWithoutPhasing()
00103         {
00104             ItemsRepeater repeater = null;
00105             int numPhases = 1; // Just Phase 0 for x:Bind
00106             ManualResetEvent ElementLoadedCompleted = new ManualResetEvent(false);
00107
00108             RunOnUIThread.Execute(() =>
00109             {
00110                 var itemTemplate = (DataTemplate)XamlReader.Load(
00111                        @"<DataTemplate  xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00112                             <Button Width='100' Height='100'/>
00113                         </DataTemplate>");
00114                 repeater = new ItemsRepeater()
00115                 {
00116                     ItemsSource = Enumerable.Range(0, 10),
00117                     ItemTemplate = new CustomElementFactory(numPhases),
00118                     Layout = new StackLayout(),
00119                 };
00120
00121                 repeater.ElementPrepared += (sender, args) =>
00122                 {
00123                     if (args.Index == expectedLastRealizedIndex)
00124                     {
00125                         Log.Comment("Item 8 Created!");
00126                         ElementLoadedCompleted.Set();
00127                     }
00128                 };
00129
00130                 Content = new ItemsRepeaterScrollHost()
00131                 {
00132                     Width = 400,
00133                     Height = 400,
00134                     ScrollViewer = new ScrollViewer
00135                     {
00136                         Content = repeater
00137                     }
00138                 };
00139             });
00140
00141             if(ElementLoadedCompleted.WaitOne(TimeSpan.FromMilliseconds(2000)))
00142             {
00143                 RunOnUIThread.Execute(() =>
00144                 {
00145                     var calls = ElementPhasingManager.ProcessedCalls;
00146
00147                     Verify.AreEqual(calls.Count, 9);
00148                     calls[0].RemoveAt(0); // Remove the create we did for first measure.
00149                     foreach (var index in calls.Keys)
00150                     {
00151                         var phases = calls[index];
00152                         Verify.AreEqual(1, phases.Count); // Just phase 0
00153                     }
00154
00155                     ElementPhasingManager.ProcessedCalls.Clear();
00156                 });
00157             }
00158             else
00159             {
00160                 Verify.Fail("Failed on waiting on build tree.");
00161             }
00162         }
00163
00164         private class CustomElementFactory : ElementFactory
00165         {
00166             private int _numPhases;
00167             private RecyclePool _recyclePool = new RecyclePool();
00168             private string key = "foobar";
00169
00170             public CustomElementFactory(int numPhases)
00171             {
00172                 _numPhases = numPhases;
00173             }
00174
00175             protected override UIElement GetElementCore(ElementFactoryGetArgs args)
00176             {
00177                 var element = _recyclePool.TryGetElement(key, args.Parent);
00178                 if (element == null)
00179                 {
00180                     element = new Button() { Width = 100, Height = 100 };
00181                 }
00182
00183                 var elementManager = new ElementPhasingManager(_numPhases);
00184                 XamlBindingHelper.SetDataTemplateComponent(element, elementManager);
00185                 return element;
00186             }
00187
00188             protected override void RecycleElementCore(ElementFactoryRecycleArgs args)
00189             {
00190                 XamlBindingHelper.GetDataTemplateComponent(args.Element).Recycle();
00191                 _recyclePool.PutElement(args.Element, key, args.Parent);
00192             }
00193         }
00194
00195         private class ElementPhasingManager : IDataTemplateComponent
00196         {
00197             private int _numPhases = 1; // Default is just phase 0
00198             private int _data = -1;
00199
00200             public List<int> Data { get; private set; }
00201             public bool IsCleared { get; private set; }
00202
00203             // data index -> list<phases>
00204             public static Dictionary<int, List<int>> ProcessedCalls { get; set; }
00205
00206             public ElementPhasingManager(int numPhases)
00207             {
00208                 _numPhases = numPhases;
00209             }
00210
00211             public void Recycle()
00212             {
00213                 IsCleared = true;
00214                 Log.Comment(string.Format("Recycle Index:{0}", _data));
00215             }
00216
00217             public void ProcessBindings(object item, int itemIndex, int phase, out int nextPhase)
00218             {
00219                 if (Data == null)
00220                 {
00221                     Data = new List<int>();
00222                 }
00223
00224                 if (ProcessedCalls == null)
00225                 {
00226                     ProcessedCalls = new Dictionary<int, List<int>>();
00227                 }
00228
00229                 _data = (int)item;
00230                 Data.Add(_data);
00231                 if (!ProcessedCalls.ContainsKey(_data))
00232                 {
00233                     ProcessedCalls.Add(_data, new List<int>());
00234                 }
00235
00236                 ProcessedCalls[_data].Add(phase);
00237
00238                 nextPhase = phase >= _numPhases -1 ? -1 : phase + 1;
00239                 Log.Comment(string.Format("Index:{0}  Phase:{1}  NextPhase:{2}", item.ToString(), phase, nextPhase));
00240             }
00241         }
00242     }
00243 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

UniformGrid2DLayout Member List

This is the complete list of members for UniformGrid2DLayout, including all inherited members.
ArrangeOverride(VirtualizingLayoutContext context, Size finalSize) | UniformGrid2DLayout | [inline, protected]
VirtualizingLayout::ArrangeOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &finalSize) | VirtualizingLayout | [virtual]
Clamp(int index, int count) | UniformGrid2DLayout | [inline, private]
EnlargeFocusedItem | UniformGrid2DLayout |
FirstRealizedRowIndexInRect(Rect realizationRect, int itemCount) | UniformGrid2DLayout | [inline, private]
FirsttRealizedColumnIndexInRect(Rect realizationRect, int itemCount) | UniformGrid2DLayout | [inline, private]
FocusedItemHeight | UniformGrid2DLayout |
FocusedItemWidth | UniformGrid2DLayout |
GetElementIndex(int row, int col, int count) | UniformGrid2DLayout | [inline, private]
InitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | VirtualizingLayout | [virtual]
ItemHeight | UniformGrid2DLayout |
ItemWidth | UniformGrid2DLayout |
LastRealizedColumnIndexInRect(Rect realizationRect, int itemCount) | UniformGrid2DLayout | [inline, private]
LastRealizedRowIndexInRect(Rect realizationRect, int itemCount) | UniformGrid2DLayout | [inline, private]
MeasureOverride(VirtualizingLayoutContext context, Size availableSize) | UniformGrid2DLayout | [inline, protected]
VirtualizingLayout::MeasureOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &availableSize) | VirtualizingLayout | [virtual]
OnItemsChangedCore(winrt::VirtualizingLayoutContext const &context, winrt::IInspectable const &source, winrt::NotifyCollectionChangedEventArgs const &args) | VirtualizingLayout | [virtual]
Spacing | UniformGrid2DLayout |
UninitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | VirtualizingLayout | [virtual]
VirtualizingLayout() | VirtualizingLayout |
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnnotatedScrollBar/AnnotatedScrollBar.h Source File

  • AnnotatedScrollBar

AnnotatedScrollBar.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "AnnotatedScrollBarTrace.h"
00007 #include "AnnotatedScrollBar.g.h"
00008 #include "AnnotatedScrollBar.properties.h"
00009 #include "AnnotatedScrollBarPanningInfo.h"
00010
00011 class AnnotatedScrollBar :
00012     public ReferenceTracker<AnnotatedScrollBar, winrt::implementation::AnnotatedScrollBarT, winrt::cloaked<winrt::IScrollController>>,
00013     public AnnotatedScrollBarProperties
00014 {
00015
00016 public:
00017     AnnotatedScrollBar();
00018     ~AnnotatedScrollBar();
00019
00020     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00021     void OnApplyTemplate();
00022
00023     winrt::IScrollController ScrollController();
00024
00025 #pragma region IScrollController
00026     winrt::IScrollControllerPanningInfo PanningInfo();
00027     bool CanScroll();
00028     bool IsScrollingWithMouse();
00029
00030     void SetIsScrollable(
00031         bool isScrollable);
00032
00033     void SetValues(
00034         double minOffset,
00035         double maxOffset,
00036         double offset,
00037         double viewportLength);
00038
00039     winrt::CompositionAnimation GetScrollAnimation(
00040         int correlationId,
00041         winrt::float2 const& startPosition,
00042         winrt::float2 const& endPosition,
00043         winrt::CompositionAnimation const& defaultAnimation);
00044
00045     void NotifyRequestedScrollCompleted(
00046         int correlationId);
00047
00048     winrt::event_token CanScrollChanged(winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable> const& value);
00049     void CanScrollChanged(winrt::event_token const& token);
00050
00051     winrt::event_token IsScrollingWithMouseChanged(winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable> const& value);
00052     void IsScrollingWithMouseChanged(winrt::event_token const& token);
00053
00054     winrt::event_token ScrollToRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollToRequestedEventArgs> const& value);
00055     void ScrollToRequested(winrt::event_token const& token);
00056
00057     winrt::event_token ScrollByRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollByRequestedEventArgs> const& value);
00058     void ScrollByRequested(winrt::event_token const& token);
00059
00060     winrt::event_token AddScrollVelocityRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerAddScrollVelocityRequestedEventArgs> const& value);
00061     void AddScrollVelocityRequested(winrt::event_token const& token);
00062 #pragma endregion
00063
00064 private:
00065
00066     static constexpr std::wstring_view s_verticalThumbPartName { L"PART_VerticalThumb"sv };
00067     static constexpr std::wstring_view s_verticalThumbGhostPartName { L"PART_VerticalThumbGhost"sv };
00068     static constexpr std::wstring_view s_verticalDecrementRepeatButtonPartName { L"PART_VerticalDecrementRepeatButton"sv };
00069     static constexpr std::wstring_view s_verticalIncrementRepeatButtonPartName { L"PART_VerticalIncrementRepeatButton"sv };
00070     static constexpr std::wstring_view s_verticalGridPartName { L"PART_VerticalGrid"sv };
00071     static constexpr std::wstring_view s_labelsGridPartName { L"PART_LabelsGrid"sv };
00072     static constexpr std::wstring_view s_tooltipContentPresenterPartName { L"PART_TooltipContentPresenter"sv };
00073     static constexpr std::wstring_view s_detailLabelToolTipPartName { L"PART_DetailLabelToolTip"sv };
00074
00075     void ViewportSize(double viewportSize);
00076     double ViewportSize();
00077     double m_viewportSize{ 0.0 };
00078     void Maximum(double maximum);
00079     double Maximum();
00080     double m_maximum{ 0.0 };
00081     void Minimum(double minimum);
00082     double Minimum();
00083     double m_minimum{ 0.0 };
00084     void Value(double value);
00085     double Value();
00086     double m_value{ 0.0 };
00087
00088     double m_scrollOffsetToLabelOffsetFactor{ 0.0 };
00089
00090     // Visual Components
00091     tracker_ref<winrt::Border> m_verticalThumb{ this };
00092     tracker_ref<winrt::Border> m_verticalThumbGhost{ this };
00093     tracker_ref<winrt::RepeatButton> m_verticalDecrementRepeatButton{ this };
00094     tracker_ref<winrt::RepeatButton> m_verticalIncrementRepeatButton{ this };
00095     tracker_ref<winrt::Grid> m_verticalGrid{ this };
00096     tracker_ref<winrt::Grid> m_labelsGrid{ this };
00097     tracker_ref<winrt::ContentPresenter> m_tooltipContentPresenter{ this };
00098     tracker_ref<winrt::ToolTip> m_detailLabelToolTip{ this };
00099
00100     tracker_com_ref<AnnotatedScrollBarPanningInfo> m_panningInfo{ this };
00101
00102     // Visual state tracking
00103     winrt::Pointer m_capturedPointer{ nullptr };
00104     uint32_t m_verticalGridTrackedPointerId{ 0 };
00105     bool m_isPressed{ false };
00106     bool m_isPointerOver{ false };
00107     double m_lastVerticalGridPointerMovedOffset{ 0.0 };
00108
00109     bool m_detailLabelTemplateApplied{ false };
00110
00111     bool m_canScroll{ false };
00112     bool m_isScrollingWithMouse{ false };
00113     bool m_isScrollable{ false };
00114     int m_operationsCount{ 0 };
00115     double m_lastOffset{ 0.0 };
00116     int32_t m_lastOffsetChangeCorrelationIdForAddScrollVelocity{ -1 };
00117     int32_t m_lastOffsetChangeCorrelationIdForScrollBy{ -1 };
00118     int32_t m_lastOffsetChangeCorrelationIdForScrollTo{ -1 };
00119
00120     std::vector<float> m_labelSizes{};
00121     std::atomic_flag m_labelsDebounce{};
00122
00123     // Event Sources for IScrollController
00124     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollToRequestedEventArgs>> m_scrollToRequested { };
00125     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollByRequestedEventArgs>> m_scrollByRequested { };
00126     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerAddScrollVelocityRequestedEventArgs>> m_addScrollVelocityRequested { };
00127     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable>> m_canScrollChanged { };
00128     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable>> m_isScrollingWithMouseChanged { };
00129
00130     // Event Revokers
00131     winrt::UIElement::PointerEntered_revoker m_verticalGridPointerEnteredRevoker{};
00132     winrt::UIElement::PointerMoved_revoker m_verticalGridPointerMovedRevoker{};
00133     RoutedEventHandler_revoker m_verticalGridPointerExitedRevoker{};
00134     winrt::UIElement::PointerPressed_revoker  m_verticalGridPointerPressedRevoker{};
00135     RoutedEventHandler_revoker m_verticalGridPointerReleasedRevoker{};
00136     RoutedEventHandler_revoker m_verticalGridPointerCanceledRevoker{};
00137     RoutedEventHandler_revoker m_verticalGridPointerCaptureLostRevoker{};
00138     winrt::FrameworkElement::SizeChanged_revoker m_sizeChangedRevoker{};
00139 #ifdef DBG
00140     winrt::FrameworkElement::Loaded_revoker m_loadedRevoker{};
00141 #endif
00142     winrt::Control::IsEnabledChanged_revoker m_isEnabledRevoker{};
00143     winrt::IObservableVector<winrt::AnnotatedScrollBarLabel>::VectorChanged_revoker m_labelsVectorChangedRevoker{};
00144     winrt::RepeatButton::Click_revoker m_verticalIncrementRepeatButtonClickRevoker{};
00145     winrt::RepeatButton::Click_revoker m_verticalDecrementRepeatButtonClickRevoker{};
00146     winrt::ToolTip::Opened_revoker m_detailLabelToolTipOpenedRevoker{};
00147
00148     void RaiseCanScrollChanged();
00149     void RaiseIsScrollingWithMouseChanged();
00150     bool RaiseScrolling(double offset, winrt::AnnotatedScrollBarScrollingEventKind scrollingEventKind);
00151     winrt::IInspectable RaiseDetailLabelRequested(double offsetFromTop);
00152     void RaiseScrollToRequested(double offset);
00153     void RaiseScrollByRequested(double offsetDelta);
00154     void RaiseAddScrollVelocityRequested(double offsetDelta);
00155     void ScrollTo(double offset, winrt::AnnotatedScrollBarScrollingEventKind scrollingEventKind);
00156
00157     void ResetTrackedPointerId();
00158     bool IgnorePointerId(const winrt::PointerRoutedEventArgs& args);
00159
00160     void OnVerticalGridPointerEntered(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00161     void OnVerticalGridPointerMoved(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00162     void OnVerticalGridPointerExited(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00163     void OnVerticalGridPointerPressed(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00164     void OnVerticalGridPointerReleased(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00165     void OnVerticalGridPointerCanceled(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00166     void OnVerticalGridPointerCaptureLost(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00167     void ProcessVerticalGridPointerCanceled(const winrt::PointerRoutedEventArgs& args);
00168     bool IsOutOfVerticalGridBounds(const winrt::Point& point);
00169
00170     void OnIncrementRepeatButtonClick(const winrt::IInspectable& sender,  const winrt::RoutedEventArgs& args);
00171     void OnDecrementRepeatButtonClick(const winrt::IInspectable& sender,  const winrt::RoutedEventArgs& args);
00172
00173     void OnSizeChanged(const winrt::IInspectable& sender, const winrt::SizeChangedEventArgs& args);
00174 #ifdef DBG
00175     void OnLoaded(const winrt::IInspectable& sender, const winrt::RoutedEventArgs& args);
00176 #endif
00177     void OnIsEnabledChanged(const winrt::IInspectable& sender, const winrt::DependencyPropertyChangedEventArgs& args);
00178     void OnLabelsCollectionChanged(const winrt::IInspectable&, const winrt::IInspectable&);
00179     void OnLabelsGridSizeChanged(const winrt::IInspectable& sender, const winrt::SizeChangedEventArgs& args);
00180
00181     void UnhookHandlers(bool isFromDestructor);
00182     void HookInputEvents();
00183     void SetUpInteractionElements();
00184     void UpdatePositionsOfAnchoredElements();
00185     void QueueLayoutLabels(unsigned int millisecondWait);
00186     void LayoutLabels();
00187     void CreateLabelContainers();
00188     void UpdateLabelContainersOffsets();
00189     void CollapseCollidingAndOutOfBoundsLabels();
00190     void UpdateScrollOffsetToLabelOffsetFactor();
00191     double GetLabelVerticalOffset(winrt::AnnotatedScrollBarLabel label);
00192     void UpdateCanScroll();
00193     void EnsurePanningInfo();
00194     void EnsureSmallChangeValue();
00195
00196     // Hover visuals logic (ToolTip and ThumbGhost)
00197     void OnDetailLabelToolTipOpened(const winrt::IInspectable& sender, const winrt::RoutedEventArgs& args);
00198     void SetToolTipIsOpen(bool isOpen);
00199     void ShowHoverVisuals(double offsetFromTopToolTip, double offsetFromTopThumbGhost);
00200     void HideHoverVisuals();
00201     void ShowToolTipAtOffset(double offsetFromTop);
00202     void ShowThumbGhostAtOffset(double offsetFromTop);
00203     void SetThumbGhostVisibility(winrt::Visibility visibility);
00204
00205     // Default amount to scroll when hitting the PART_VerticalIncrementRepeatButton/PART_VerticalDecrementRepeatButton buttons: 1/8 of the viewport size.
00206     static constexpr double s_defaultViewportToSmallChangeRatio{ 8.0 };
00207     // Additional velocity required with decay s_smallChangeInertiaDecayRate to move Position by one pixel.
00208     static constexpr double s_velocityNeededPerPixel{ 3.688880455092886 };
00209     // Inertia decay rate for SmallChange animated Value changes.
00210     static constexpr float s_smallChangeInertiaDecayRate{ 0.975f};
00211     // Vertical offset of the tooltip during touch interactions.
00212     static constexpr double s_toolTipTouchOffset{ 22.0 };
00213 };
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Picture Member List

This is the complete list of members for Picture, including all inherited members.
AspectRatio | Picture
Id | Picture
Location | Picture
Path | Picture
Title | Picture
Generated on Sun Dec 1 2024 20:54:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RecipeGroup Member List

This is the complete list of members for RecipeGroup, including all inherited members.
Name | RecipeGroup |
RecipeGroup(IEnumerable< Recipe > recipes) | RecipeGroup | [inline]
ToString() | RecipeGroup | [inline]
Generated on Sun Dec 1 2024 20:54:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/NavigationViewItem.properties.cpp Source File

  • Generated

NavigationViewItem.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "NavigationViewItem.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(NavigationViewItem)
00012 }
00013
00014 #include "NavigationViewItem.g.cpp"
00015
00016 GlobalDependencyProperty NavigationViewItemProperties::s_CompactPaneLengthProperty{ nullptr };
00017 GlobalDependencyProperty NavigationViewItemProperties::s_HasUnrealizedChildrenProperty{ nullptr };
00018 GlobalDependencyProperty NavigationViewItemProperties::s_IconProperty{ nullptr };
00019 GlobalDependencyProperty NavigationViewItemProperties::s_InfoBadgeProperty{ nullptr };
00020 GlobalDependencyProperty NavigationViewItemProperties::s_IsChildSelectedProperty{ nullptr };
00021 GlobalDependencyProperty NavigationViewItemProperties::s_IsExpandedProperty{ nullptr };
00022 GlobalDependencyProperty NavigationViewItemProperties::s_MenuItemsProperty{ nullptr };
00023 GlobalDependencyProperty NavigationViewItemProperties::s_MenuItemsSourceProperty{ nullptr };
00024 GlobalDependencyProperty NavigationViewItemProperties::s_SelectsOnInvokedProperty{ nullptr };
00025
00026 NavigationViewItemProperties::NavigationViewItemProperties()
00027 {
00028     EnsureProperties();
00029 }
00030
00031 void NavigationViewItemProperties::EnsureProperties()
00032 {
00033     NavigationViewItemBase::EnsureProperties();
00034     if (!s_CompactPaneLengthProperty)
00035     {
00036         s_CompactPaneLengthProperty =
00037             InitializeDependencyProperty(
00038                 L"CompactPaneLength",
00039                 winrt::name_of<double>(),
00040                 winrt::name_of<winrt::NavigationViewItem>(),
00041                 false /* isAttached */,
00042                 ValueHelper<double>::BoxValueIfNecessary(48.0),
00043                 nullptr);
00044     }
00045     if (!s_HasUnrealizedChildrenProperty)
00046     {
00047         s_HasUnrealizedChildrenProperty =
00048             InitializeDependencyProperty(
00049                 L"HasUnrealizedChildren",
00050                 winrt::name_of<bool>(),
00051                 winrt::name_of<winrt::NavigationViewItem>(),
00052                 false /* isAttached */,
00053                 ValueHelper<bool>::BoxValueIfNecessary(false),
00054                 winrt::PropertyChangedCallback(&OnHasUnrealizedChildrenPropertyChanged));
00055     }
00056     if (!s_IconProperty)
00057     {
00058         s_IconProperty =
00059             InitializeDependencyProperty(
00060                 L"Icon",
00061                 winrt::name_of<winrt::IconElement>(),
00062                 winrt::name_of<winrt::NavigationViewItem>(),
00063                 false /* isAttached */,
00064                 ValueHelper<winrt::IconElement>::BoxedDefaultValue(),
00065                 winrt::PropertyChangedCallback(&OnIconPropertyChanged));
00066     }
00067     if (!s_InfoBadgeProperty)
00068     {
00069         s_InfoBadgeProperty =
00070             InitializeDependencyProperty(
00071                 L"InfoBadge",
00072                 winrt::name_of<winrt::InfoBadge>(),
00073                 winrt::name_of<winrt::NavigationViewItem>(),
00074                 false /* isAttached */,
00075                 ValueHelper<winrt::InfoBadge>::BoxedDefaultValue(),
00076                 winrt::PropertyChangedCallback(&OnInfoBadgePropertyChanged));
00077     }
00078     if (!s_IsChildSelectedProperty)
00079     {
00080         s_IsChildSelectedProperty =
00081             InitializeDependencyProperty(
00082                 L"IsChildSelected",
00083                 winrt::name_of<bool>(),
00084                 winrt::name_of<winrt::NavigationViewItem>(),
00085                 false /* isAttached */,
00086                 ValueHelper<bool>::BoxValueIfNecessary(false),
00087                 nullptr);
00088     }
00089     if (!s_IsExpandedProperty)
00090     {
00091         s_IsExpandedProperty =
00092             InitializeDependencyProperty(
00093                 L"IsExpanded",
00094                 winrt::name_of<bool>(),
00095                 winrt::name_of<winrt::NavigationViewItem>(),
00096                 false /* isAttached */,
00097                 ValueHelper<bool>::BoxValueIfNecessary(false),
00098                 winrt::PropertyChangedCallback(&OnIsExpandedPropertyChanged));
00099     }
00100     if (!s_MenuItemsProperty)
00101     {
00102         s_MenuItemsProperty =
00103             InitializeDependencyProperty(
00104                 L"MenuItems",
00105                 winrt::name_of<winrt::IVector<winrt::IInspectable>>(),
00106                 winrt::name_of<winrt::NavigationViewItem>(),
00107                 false /* isAttached */,
00108                 ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxedDefaultValue(),
00109                 winrt::PropertyChangedCallback(&OnMenuItemsPropertyChanged));
00110     }
00111     if (!s_MenuItemsSourceProperty)
00112     {
00113         s_MenuItemsSourceProperty =
00114             InitializeDependencyProperty(
00115                 L"MenuItemsSource",
00116                 winrt::name_of<winrt::IInspectable>(),
00117                 winrt::name_of<winrt::NavigationViewItem>(),
00118                 false /* isAttached */,
00119                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00120                 winrt::PropertyChangedCallback(&OnMenuItemsSourcePropertyChanged));
00121     }
00122     if (!s_SelectsOnInvokedProperty)
00123     {
00124         s_SelectsOnInvokedProperty =
00125             InitializeDependencyProperty(
00126                 L"SelectsOnInvoked",
00127                 winrt::name_of<bool>(),
00128                 winrt::name_of<winrt::NavigationViewItem>(),
00129                 false /* isAttached */,
00130                 ValueHelper<bool>::BoxValueIfNecessary(true),
00131                 nullptr);
00132     }
00133 }
00134
00135 void NavigationViewItemProperties::ClearProperties()
00136 {
00137     s_CompactPaneLengthProperty = nullptr;
00138     s_HasUnrealizedChildrenProperty = nullptr;
00139     s_IconProperty = nullptr;
00140     s_InfoBadgeProperty = nullptr;
00141     s_IsChildSelectedProperty = nullptr;
00142     s_IsExpandedProperty = nullptr;
00143     s_MenuItemsProperty = nullptr;
00144     s_MenuItemsSourceProperty = nullptr;
00145     s_SelectsOnInvokedProperty = nullptr;
00146     NavigationViewItemBase::ClearProperties();
00147 }
00148
00149 void NavigationViewItemProperties::OnHasUnrealizedChildrenPropertyChanged(
00150     winrt::DependencyObject const& sender,
00151     winrt::DependencyPropertyChangedEventArgs const& args)
00152 {
00153     auto owner = sender.as<winrt::NavigationViewItem>();
00154     winrt::get_self<NavigationViewItem>(owner)->OnHasUnrealizedChildrenPropertyChanged(args);
00155 }
00156
00157 void NavigationViewItemProperties::OnIconPropertyChanged(
00158     winrt::DependencyObject const& sender,
00159     winrt::DependencyPropertyChangedEventArgs const& args)
00160 {
00161     auto owner = sender.as<winrt::NavigationViewItem>();
00162     winrt::get_self<NavigationViewItem>(owner)->OnIconPropertyChanged(args);
00163 }
00164
00165 void NavigationViewItemProperties::OnInfoBadgePropertyChanged(
00166     winrt::DependencyObject const& sender,
00167     winrt::DependencyPropertyChangedEventArgs const& args)
00168 {
00169     auto owner = sender.as<winrt::NavigationViewItem>();
00170     winrt::get_self<NavigationViewItem>(owner)->OnInfoBadgePropertyChanged(args);
00171 }
00172
00173 void NavigationViewItemProperties::OnIsExpandedPropertyChanged(
00174     winrt::DependencyObject const& sender,
00175     winrt::DependencyPropertyChangedEventArgs const& args)
00176 {
00177     auto owner = sender.as<winrt::NavigationViewItem>();
00178     winrt::get_self<NavigationViewItem>(owner)->OnIsExpandedPropertyChanged(args);
00179 }
00180
00181 void NavigationViewItemProperties::OnMenuItemsPropertyChanged(
00182     winrt::DependencyObject const& sender,
00183     winrt::DependencyPropertyChangedEventArgs const& args)
00184 {
00185     auto owner = sender.as<winrt::NavigationViewItem>();
00186     winrt::get_self<NavigationViewItem>(owner)->OnMenuItemsPropertyChanged(args);
00187 }
00188
00189 void NavigationViewItemProperties::OnMenuItemsSourcePropertyChanged(
00190     winrt::DependencyObject const& sender,
00191     winrt::DependencyPropertyChangedEventArgs const& args)
00192 {
00193     auto owner = sender.as<winrt::NavigationViewItem>();
00194     winrt::get_self<NavigationViewItem>(owner)->OnMenuItemsSourcePropertyChanged(args);
00195 }
00196
00197 void NavigationViewItemProperties::CompactPaneLength(double value)
00198 {
00199     [[gsl::suppress(con)]]
00200     {
00201     static_cast<NavigationViewItem*>(this)->SetValue(s_CompactPaneLengthProperty, ValueHelper<double>::BoxValueIfNecessary(value));
00202     }
00203 }
00204
00205 double NavigationViewItemProperties::CompactPaneLength()
00206 {
00207     return ValueHelper<double>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_CompactPaneLengthProperty));
00208 }
00209
00210 void NavigationViewItemProperties::HasUnrealizedChildren(bool value)
00211 {
00212     [[gsl::suppress(con)]]
00213     {
00214     static_cast<NavigationViewItem*>(this)->SetValue(s_HasUnrealizedChildrenProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00215     }
00216 }
00217
00218 bool NavigationViewItemProperties::HasUnrealizedChildren()
00219 {
00220     return ValueHelper<bool>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_HasUnrealizedChildrenProperty));
00221 }
00222
00223 void NavigationViewItemProperties::Icon(winrt::IconElement const& value)
00224 {
00225     [[gsl::suppress(con)]]
00226     {
00227     static_cast<NavigationViewItem*>(this)->SetValue(s_IconProperty, ValueHelper<winrt::IconElement>::BoxValueIfNecessary(value));
00228     }
00229 }
00230
00231 winrt::IconElement NavigationViewItemProperties::Icon()
00232 {
00233     return ValueHelper<winrt::IconElement>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_IconProperty));
00234 }
00235
00236 void NavigationViewItemProperties::InfoBadge(winrt::InfoBadge const& value)
00237 {
00238     [[gsl::suppress(con)]]
00239     {
00240     static_cast<NavigationViewItem*>(this)->SetValue(s_InfoBadgeProperty, ValueHelper<winrt::InfoBadge>::BoxValueIfNecessary(value));
00241     }
00242 }
00243
00244 winrt::InfoBadge NavigationViewItemProperties::InfoBadge()
00245 {
00246     return ValueHelper<winrt::InfoBadge>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_InfoBadgeProperty));
00247 }
00248
00249 void NavigationViewItemProperties::IsChildSelected(bool value)
00250 {
00251     [[gsl::suppress(con)]]
00252     {
00253     static_cast<NavigationViewItem*>(this)->SetValue(s_IsChildSelectedProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00254     }
00255 }
00256
00257 bool NavigationViewItemProperties::IsChildSelected()
00258 {
00259     return ValueHelper<bool>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_IsChildSelectedProperty));
00260 }
00261
00262 void NavigationViewItemProperties::IsExpanded(bool value)
00263 {
00264     [[gsl::suppress(con)]]
00265     {
00266     static_cast<NavigationViewItem*>(this)->SetValue(s_IsExpandedProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00267     }
00268 }
00269
00270 bool NavigationViewItemProperties::IsExpanded()
00271 {
00272     return ValueHelper<bool>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_IsExpandedProperty));
00273 }
00274
00275 void NavigationViewItemProperties::MenuItems(winrt::IVector<winrt::IInspectable> const& value)
00276 {
00277     [[gsl::suppress(con)]]
00278     {
00279     static_cast<NavigationViewItem*>(this)->SetValue(s_MenuItemsProperty, ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxValueIfNecessary(value));
00280     }
00281 }
00282
00283 winrt::IVector<winrt::IInspectable> NavigationViewItemProperties::MenuItems()
00284 {
00285     return ValueHelper<winrt::IVector<winrt::IInspectable>>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_MenuItemsProperty));
00286 }
00287
00288 void NavigationViewItemProperties::MenuItemsSource(winrt::IInspectable const& value)
00289 {
00290     [[gsl::suppress(con)]]
00291     {
00292     static_cast<NavigationViewItem*>(this)->SetValue(s_MenuItemsSourceProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00293     }
00294 }
00295
00296 winrt::IInspectable NavigationViewItemProperties::MenuItemsSource()
00297 {
00298     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_MenuItemsSourceProperty));
00299 }
00300
00301 void NavigationViewItemProperties::SelectsOnInvoked(bool value)
00302 {
00303     [[gsl::suppress(con)]]
00304     {
00305     static_cast<NavigationViewItem*>(this)->SetValue(s_SelectsOnInvokedProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00306     }
00307 }
00308
00309 bool NavigationViewItemProperties::SelectsOnInvoked()
00310 {
00311     return ValueHelper<bool>::CastOrUnbox(static_cast<NavigationViewItem*>(this)->GetValue(s_SelectsOnInvokedProperty));
00312 }
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Expander::ExpanderFactory Member List

This is the complete list of members for Expander::ExpanderFactory, including all inherited members.
Create(UIObject element) Expander::ExpanderFactory [inline]
Generated on Sun Dec 1 2024 20:53:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/DispatcherHelper.h Source File

  • inc

DispatcherHelper.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "SharedHelpers.h"
00006
00007 class DispatcherHelper
00008 {
00009 public:
00010
00011     DispatcherHelper(const winrt::DependencyObject& dependencyObject = nullptr)
00012     {
00013         dispatcherQueue = winrt::DispatcherQueue::GetForCurrentThread();
00014     }
00015
00016     void RunAsync(std::function<void()> func, bool fallbackToThisThread = false) const
00017     {
00018         auto result = dispatcherQueue.TryEnqueue(winrt::DispatcherQueueHandler(func));
00019         if (!result)
00020         {
00021             if (fallbackToThisThread)
00022             {
00023                 func();
00024             }
00025         }
00026     }
00027
00028 private:
00029     winrt::DispatcherQueue dispatcherQueue{ nullptr };
00030 };
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PersonPicture/InteractionTests/PersonPictureTests.cs Source File

  • PersonPicture
  • InteractionTests

PersonPictureTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00008 using Common;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation;
00016 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00017 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00018 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00019
00020 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00021 {
00022     [TestClass]
00023     public class PersonPictureTests
00024     {
00025
00026         [ClassInitialize]
00027         [TestProperty("RunAs", "User")]
00028         [TestProperty("Classification", "Integration")]
00029         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00030         public static void ClassInitialize(TestContext testContext)
00031         {
00032             TestEnvironment.Initialize(testContext);
00033         }
00034
00035         [TestCleanup]
00036         public void TestCleanup()
00037         {
00038             TestCleanupHelper.Cleanup();
00039         }
00040
00041         [TestMethod]
00042         public void BasicInteractionTest()
00043         {
00044             using (var setup = new TestSetupHelper("PersonPicture Tests"))
00045             {
00046                 TextBlock PersonPictureInitialBlock = new TextBlock(FindElement.ByName("InitialsTextBlock"));
00047
00048                 // Ensure the person glyph is shown
00049                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "\uE77B");
00050
00051                 // Ensure the group glyph is shown
00052                 CheckBox cb = new CheckBox(FindElement.ByName("GroupCheckBox"));
00053                 cb.Check();
00054                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "\uE716");
00055                 cb.Uncheck();
00056
00057                 // Ensure the initals are shown
00058                 TextBlock tb = new TextBlock(FindElement.ByName("InitialTextBox"));
00059                 WriteInTextBox("InitialTextBox", "AS");
00060                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "AS");
00061                 WriteInTextBox("InitialTextBox", "");
00062
00063                 // Ensure display name is converted to initials as expected.
00064                 TextBlock tb1 = new TextBlock(FindElement.ByName("DisplayNameTextBox"));
00065                 WriteInTextBox("DisplayNameTextBox", "Some Name");
00066                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "SN");
00067
00068                 WriteInTextBox("DisplayNameTextBox", "Another Name (OSG)");
00069                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "AN");
00070
00071                 // Ensure the badge number is shown
00072                 TextBlock tb2 = new TextBlock(FindElement.ByName("BadgeNumberTextBox"));
00073                 WriteInTextBox("BadgeNumberTextBox", "1");
00074                 TextBlock PersonPictureBadgeNumberBlock = new TextBlock(FindElement.ByName("BadgeNumberTextBlock"));
00075                 Verify.AreEqual(PersonPictureBadgeNumberBlock.DocumentText, "1");
00076
00077                 // Ensure the badge number is shown 99+
00078                 WriteInTextBox("BadgeNumberTextBox", "125");
00079                 Verify.AreEqual(PersonPictureBadgeNumberBlock.DocumentText, "99+");
00080             }
00081         }
00082
00083         [TestMethod]
00084         public void ControlSizing()
00085         {
00086             using (var setup = new TestSetupHelper("PersonPicture Tests"))
00087             {
00088                 RangeValueSlider heightSlider = new RangeValueSlider(FindElement.ByName("HeightSlider"));
00089                 RangeValueSlider widthSlider = new RangeValueSlider(FindElement.ByName("WidthSlider"));
00090                 CheckBox cb = new CheckBox(FindElement.ByName("DimensionsMatch"));
00091
00092                 using (var waiter = cb.GetToggledWaiter())
00093                 {
00094                     // Confirm expected initial state
00095                     cb.Toggle();
00096                     waiter.Wait();
00097                     Verify.AreEqual(cb.ToggleState, ToggleState.Off);
00098                     waiter.Reset();
00099
00100                     // Update height and verify the width changes to match
00101                     heightSlider.SetValue(85);
00102                     waiter.Wait();
00103                     Verify.AreEqual(cb.ToggleState, ToggleState.On);
00104                     waiter.Reset();
00105
00106                     // Reset to unchecked state
00107                     cb.Toggle();
00108                     waiter.Wait();
00109                     Verify.AreEqual(cb.ToggleState, ToggleState.Off);
00110                     waiter.Reset();
00111
00112                     // Update width and verify the height changes to match
00113                     widthSlider.SetValue(115);
00114                     waiter.Wait();
00115                     Verify.AreEqual(cb.ToggleState, ToggleState.On);
00116                     waiter.Reset();
00117                 }
00118             }
00119         }
00120
00121         [TestMethod]
00122         public void DependencyPropertyOrdering()
00123         {
00124             using (var setup = new TestSetupHelper("PersonPicture Tests"))
00125             {
00126                 TextBlock PersonPictureInitialBlock = new TextBlock(FindElement.ByName("InitialsTextBlock"));
00127                 Button SetContactBtn = new Button(FindElement.ByName("ContactBtn"));
00128                 Button ClearContactBtn = new Button(FindElement.ByName("ClearContactBtn"));
00129
00130                 // Set all properties that can generate initials.
00131                 WriteInTextBox("InitialTextBox", "AL");
00132                 WriteInTextBox("DisplayNameTextBox", "Some Name");
00133                 SetContactBtn.Invoke(); // Contact.DisplayName = "Test Contact"
00134
00135                 // Clear them in priority order and verify displayed initials.
00136                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "AL");
00137                 WriteInTextBox("InitialTextBox", "");
00138                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "SN");
00139                 WriteInTextBox("DisplayNameTextBox", "");
00140                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "TC");
00141                 ClearContactBtn.Invoke();
00142                 Verify.AreEqual(PersonPictureInitialBlock.DocumentText, "\uE77B");
00143             }
00144         }
00145
00146         [TestMethod]
00147         public void ImageLoading()
00148         {
00149             using (var setup = new TestSetupHelper("PersonPicture Tests"))
00150             {
00151                 Button SetContactImageBtn = new Button(FindElement.ByName("ContactImageBtn"));
00152                 Button ClearContactBtn = new Button(FindElement.ByName("ClearContactBtn"));
00153                 Button SetImageBtn = new Button(FindElement.ByName("ImageBtn"));
00154                 Button ClearImageBtn = new Button(FindElement.ByName("ClearImageBtn"));
00155                 CheckBox cb = new CheckBox(FindElement.ByName("BgEllipseFilled"));
00156
00157                 Verify.AreEqual(cb.ToggleState, ToggleState.Off);
00158
00159                 using (var waiter = cb.GetToggledWaiter())
00160                 {
00161                     // Set/Clear contact and ensure contact image is shown/cleared.
00162                     SetContactImageBtn.Invoke();
00163                     waiter.Wait();
00164                     Verify.AreEqual(cb.ToggleState, ToggleState.On);
00165                     waiter.Reset();
00166                     ClearContactBtn.Invoke();
00167                     waiter.Wait();
00168                     Verify.AreEqual(cb.ToggleState, ToggleState.Off);
00169                     waiter.Reset();
00170
00171                     // Set/Clear image and ensure image is shown/cleared.
00172                     SetImageBtn.Invoke();
00173                     waiter.Wait();
00174                     Verify.AreEqual(cb.ToggleState, ToggleState.On);
00175                     waiter.Reset();
00176                     ClearImageBtn.Invoke();
00177                     waiter.Wait();
00178                     Verify.AreEqual(cb.ToggleState, ToggleState.Off);
00179                     waiter.Reset();
00180                 }
00181             }
00182         }
00183
00184         [TestMethod]
00185         [Description("Validates ability to scroll a list of PersonPicture in a ListView with automation.")]
00186         public void ScrollPeopleList()
00187         {
00188             ScrollPeopleListPrivate("PeopleLV");
00189         }
00190
00191         [TestMethod]
00192         [Description("Validates ability to scroll a list of PersonPicture in a grouped ListView with automation.")]
00193         [TestProperty("Ignore", "True")] // Task 35201106
00194         public void ScrollPeopleGroupedList()
00195         {
00196             ScrollPeopleListPrivate("PeopleGLV");
00197         }
00198
00199         private void ScrollPeopleListPrivate(string listViewId)
00200         {
00201             using (var setup = new TestSetupHelper("PersonPicture Tests"))
00202             {
00203                 Log.Comment("Finding ListView");
00204                 ListView peopleListView = new ListView(FindElement.ById(listViewId));
00205                 Verify.IsNotNull(peopleListView, "ListView found");
00206
00207                 Log.Comment("Retrieving first ListView");
00208                 ListViewItem firstLVI = peopleListView.AllItems[0];
00209                 Verify.IsNotNull(firstLVI, "First ListViewItem retrieved");
00210
00211                 Log.Comment("Retrieving fifth ListView at index 4");
00212                 ListViewItem fifthLVI = peopleListView.AllItems[4];
00213                 Verify.IsNotNull(fifthLVI, "Fifth ListViewItem retrieved");
00214
00215                 Verify.IsFalse(firstLVI.IsOffscreen, "First item is on screen");
00216                 Verify.IsTrue(fifthLVI.IsOffscreen, "Fifth item is off screen");
00217
00218                 firstLVI.SetFocus();
00219                 Wait.ForIdle();
00220
00221                 AutomationElement firstItemAE = AutomationElement.FocusedElement;
00222
00223                 fifthLVI.SetFocus();
00224                 Wait.ForIdle();
00225
00226                 AutomationElement fifthItemAE = AutomationElement.FocusedElement;
00227
00228                 Log.Comment("Scroll to the fifth item using the automation ScrollItemPattern");
00229                 ScrollItemPattern fifthItemSIP = fifthItemAE.GetCurrentPattern(ScrollItemPattern.Pattern) as ScrollItemPattern;
00230                 fifthItemSIP.ScrollIntoView();
00231                 Wait.ForIdle();
00232
00233                 Verify.IsTrue(firstLVI.IsOffscreen, "First item is off screen");
00234                 Verify.IsFalse(fifthLVI.IsOffscreen, "Fifth item is on screen");
00235
00236                 Log.Comment("Scroll back to the first item using the automation ScrollItemPattern");
00237                 ScrollItemPattern firstItemSIP = firstItemAE.GetCurrentPattern(ScrollItemPattern.Pattern) as ScrollItemPattern;
00238                 firstItemSIP.ScrollIntoView();
00239                 Wait.ForIdle();
00240
00241                 Verify.IsFalse(firstLVI.IsOffscreen, "First item is on screen");
00242                 Verify.IsTrue(fifthLVI.IsOffscreen, "Fifth item is off screen");
00243             }
00244         }
00245
00246         private void WriteInTextBox(string textBoxName, string s)
00247         {
00248             Log.Comment("Retrieve text box with name '{0}'.", textBoxName);
00249             Edit textBox = new Edit(FindElement.ByName(textBoxName));
00250
00251             if (string.IsNullOrEmpty(s))
00252             {
00253                 s = "{BACKSPACE}";
00254
00255                 Log.Comment("Give it keyboard focus.");
00256                 textBox.SetFocus();
00257                 Wait.ForIdle();
00258                 Log.Comment("Select its current text.");
00259                 textBox.DocumentRange.Select();
00260                 Wait.ForIdle();
00261                 Log.Comment("Type '{0}'.", s);
00262                 textBox.SendKeys(s);
00263                 Wait.ForIdle();
00264             }
00265             else
00266             {
00267                 KeyboardHelper.EnterText(textBox, s);
00268             }
00269         }
00270     }
00271 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressBar/TestUI/ProgressBarPage.xaml.cs Source File

  • ProgressBar
  • TestUI

ProgressBarPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Markup;
00010 using Windows.UI;
00011 using System.Windows.Input;
00012
00013 using Microsoft.UI.Xaml.Data;
00014 using System.Numerics;
00015 using Microsoft.UI.Xaml.Shapes;
00016
00017 namespace MUXControlsTestApp
00018 {
00019     [TopLevelTestPage(Name = "ProgressBar")]
00020     public sealed partial class ProgressBarPage : TestPage
00021     {
00022         public ProgressBarPage()
00023         {
00024             this.InitializeComponent();
00025             Loaded += ProgressBarPage_Loaded;
00026
00027             NavigateToReTemplatePage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ProgressBarReTemplatePage), 0); };
00028         }
00029
00030         private void ProgressBarPage_Loaded(object sender, RoutedEventArgs e)
00031         {
00032             var layoutRoot = (Grid)VisualTreeHelper.GetChild(TestProgressBar, 0);
00033
00034             VisualStateManager.GetVisualStateGroups(layoutRoot)[0].CurrentStateChanged += this.ProgressBarPage_CurrentStateChanged;
00035             VisualStateText.Text = VisualStateManager.GetVisualStateGroups(layoutRoot)[0].CurrentState.Name;
00036
00037             var progressBarRoot = VisualTreeHelper.GetChild(layoutRoot, 0);
00038             var clip = VisualTreeHelper.GetChild(progressBarRoot, 0);
00039             var grid = VisualTreeHelper.GetChild(clip, 0);
00040             Rectangle indicator = null;
00041             int child = 0;
00042
00043             do
00044             {
00045                 indicator = VisualTreeHelper.GetChild(grid, child) as Rectangle;
00046                 child++;
00047             }
00048             while ((indicator == null || indicator.Name != "DeterminateProgressBarIndicator") && child < VisualTreeHelper.GetChildrenCount(grid));
00049
00050             if (indicator != null)
00051             {
00052                 indicator.SizeChanged += this.Indicator_SizeChanged;
00053             }
00054
00055             IndicatorWidthText.Text = indicator.ActualWidth.ToString();
00056             ROValueText.Text = TestProgressBar.Value.ToString();
00057
00058             Loaded -= ProgressBarPage_Loaded;
00059         }
00060
00061         private void Indicator_SizeChanged(object sender, SizeChangedEventArgs e)
00062         {
00063             IndicatorWidthText.Text = ((Rectangle)sender).ActualWidth.ToString();
00064         }
00065
00066         private void ProgressBarPage_CurrentStateChanged(object sender, VisualStateChangedEventArgs e)
00067         {
00068             VisualStateText.Text = e.NewState.Name;
00069         }
00070
00071         public void UpdateMinMax_Click(object sender, RoutedEventArgs e)
00072         {
00073             TestProgressBar.Maximum = String.IsNullOrEmpty(MaximumInput.Text) ? Double.Parse(MaximumInput.PlaceholderText) : Double.Parse(MaximumInput.Text);
00074             TestWUXProgressBar.Maximum = String.IsNullOrEmpty(MaximumInput.Text) ? Double.Parse(MaximumInput.PlaceholderText) : Double.Parse(MaximumInput.Text);
00075             TestProgressBar.Minimum = String.IsNullOrEmpty(MinimumInput.Text) ? Double.Parse(MinimumInput.PlaceholderText) : Double.Parse(MinimumInput.Text);
00076             TestWUXProgressBar.Minimum = String.IsNullOrEmpty(MinimumInput.Text) ? Double.Parse(MinimumInput.PlaceholderText) : Double.Parse(MinimumInput.Text);
00077             ROValueText.Text = TestProgressBar.Value.ToString();
00078         }
00079
00080         public void UpdateWidth_Click(object sender, RoutedEventArgs e)
00081         {
00082             TestProgressBar.Width = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00083             TestWUXProgressBar.Width = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00084         }
00085
00086         public void UpdateValue_Click(object sender, RoutedEventArgs e)
00087         {
00088             TestProgressBar.Value = String.IsNullOrEmpty(ValueInput.Text) ? Double.Parse(ValueInput.PlaceholderText) : Double.Parse(ValueInput.Text);
00089             TestWUXProgressBar.Value = String.IsNullOrEmpty(ValueInput.Text) ? Double.Parse(ValueInput.PlaceholderText) : Double.Parse(ValueInput.Text);
00090             ROValueText.Text = TestProgressBar.Value.ToString();
00091         }
00092
00093         public void ChangeValue_Click(object sender, RoutedEventArgs e)
00094         {
00095             if (TestProgressBar.Value + 1 > TestProgressBar.Maximum)
00096             {
00097                 TestProgressBar.Value = (int)(TestProgressBar.Minimum + 0.5);
00098             }
00099             else
00100             {
00101                 TestProgressBar.Value += 1;
00102             }
00103             ROValueText.Text = TestProgressBar.Value.ToString();
00104
00105             if (TestWUXProgressBar.Value + 1 > TestWUXProgressBar.Maximum)
00106             {
00107                 TestWUXProgressBar.Value = (int)(TestWUXProgressBar.Minimum + 0.5);
00108             }
00109             else
00110             {
00111                 TestWUXProgressBar.Value += 1;
00112             }
00113         }
00114
00115         public void UpdatePadding_Click(object sender, RoutedEventArgs e)
00116         {
00117             double paddingLeft = String.IsNullOrEmpty(PaddingLeftInput.Text) ? Double.Parse(PaddingLeftInput.PlaceholderText) : Double.Parse(PaddingLeftInput.Text);
00118             double paddingRight = String.IsNullOrEmpty(PaddingRightInput.Text) ? Double.Parse(PaddingRightInput.PlaceholderText) : Double.Parse(PaddingRightInput.Text);
00119
00120             TestProgressBar.Padding = new Thickness(paddingLeft, 0, paddingRight, 0);
00121             ROValueText.Text = TestProgressBar.Value.ToString();
00122
00123             TestWUXProgressBar.Padding = new Thickness(paddingLeft, 0, paddingRight, 0);
00124         }
00125         public void IsVisibleCheckBox_CheckChanged(object sender, RoutedEventArgs e)
00126         {
00127             Visibility isVisible = ShowIsVisibleCheckBox.IsChecked ?? false ? Visibility.Visible : Visibility.Collapsed;
00128             TestWUXProgressBar.Visibility = isVisible;
00129             TestProgressBar.Visibility = isVisible;
00130         }
00131     }
00132
00133     public class NullableBooleanToBooleanConverter : IValueConverter
00134     {
00135         public object Convert(object value, Type targetType, object parameter, string language)
00136         {
00137             return value is bool ? (bool)value : (object)false;
00138         }
00139
00140         public object ConvertBack(object value, Type targetType, object parameter, string language)
00141         {
00142             return value is bool ? (bool)value : (object)false;
00143         }
00144     }
00145 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/DataModel/RecipeGroup.cs Source File

  • Repeater
  • TestUI
  • Samples
  • DataModel

RecipeGroup.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.ObjectModel;
00005 using System.Collections.Generic;
00006 using MUXControlsTestApp.Utils;
00007
00008 namespace MUXControlsTestApp.Samples.Model
00009 {
00010     public class RecipeGroup : ResetableCollection<Recipe>
00011     {
00012         public string Name { get; set; }
00013
00014         public RecipeGroup(IEnumerable<Recipe> recipes)
00015             : base(recipes)
00016         { }
00017
00018         public override string ToString()
00019         {
00020             return Name;
00021         }
00022     }
00023 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/ScrollViewerIRefreshInfoProviderAdapter/ScrollViewerIRefreshInfoProviderAdapter.idl Source File

  • PullToRefresh
  • ScrollViewerIRefreshInfoProviderAdapter

ScrollViewerIRefreshInfoProviderAdapter.idl

Go to the documentation of this file.
00001 ﻿namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003
00004 [MUX_PREVIEW]
00005 [webhosthidden]
00006 interface IRefreshInfoProviderAdapter
00007 {
00008     IRefreshInfoProvider AdaptFromTree(Microsoft.UI.Xaml.UIElement root, Windows.Foundation.Size visualizerSize);
00009     void SetAnimations(Microsoft.UI.Xaml.UIElement refreshVisualizerAnimatableContainer);
00010 }
00011
00012 [MUX_PREVIEW]
00013 [webhosthidden]
00014 interface IAdapterAnimationHandler
00015 {
00016     void InteractionTrackerAnimation(Microsoft.UI.Xaml.UIElement refreshVisualizer, Microsoft.UI.Xaml.UIElement infoProvider, Microsoft.UI.Composition.Interactions.InteractionTracker interactionTracker);
00017     void RefreshRequestedAnimation(Microsoft.UI.Xaml.UIElement refreshVisualizer, Microsoft.UI.Xaml.UIElement infoProvider, Double executionRatio);
00018     void RefreshCompletedAnimation(Microsoft.UI.Xaml.UIElement refreshVisualizer, Microsoft.UI.Xaml.UIElement infoProvider);
00019 }
00020
00021 [MUX_PREVIEW]
00022 [webhosthidden]
00023 runtimeclass ScrollViewerIRefreshInfoProviderAdapter : IRefreshInfoProviderAdapter
00024 {
00025     ScrollViewerIRefreshInfoProviderAdapter(MU_XC_NAMESPACE.RefreshPullDirection refreshPullDirection, IAdapterAnimationHandler animationHandler);
00026
00027     IRefreshInfoProvider Adapt(Microsoft.UI.Xaml.Controls.ScrollViewer adaptee, Windows.Foundation.Size visualizerSize);
00028 }
00029
00030 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterRepeaterAnchoringPage Member List

This is the complete list of members for ScrollPresenterRepeaterAnchoringPage, including all inherited members.
anchorElement | ScrollPresenterRepeaterAnchoringPage | [private]
AppendAsyncEventMessage(string asyncEventMessage) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
AppendAsyncEventMessage() | ScrollPresenterRepeaterAnchoringPage | [inline, private]
asyncEventReportingLock | ScrollPresenterRepeaterAnchoringPage | [private]
BtnClearExceptionReport_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnClearScrollPresenterEvents_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnGetAnchorElement_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnGetCurrentAnchor_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnGetHorizontalAnchorRatio_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnGetVerticalAnchorRatio_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnInsert_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnInvalidateArrange_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnRemove_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnReplace_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnReset_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnSetAnchorElement_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnSetHorizontalAnchorRatio_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
BtnSetVerticalAnchorRatio_Click(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ChkLogScrollPresenterEvents_Checked(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ChkLogScrollPresenterEvents_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ChkUseAnimator_Checked(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ChkUseAnimator_Unchecked(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
CmbAnchorElement_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
CmbItemHeightMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
currentAnchor | ScrollPresenterRepeaterAnchoringPage | [private]
dataSource | ScrollPresenterRepeaterAnchoringPage | [private]
ExecuteQueuedOperations() | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ExecuteTriggerableOperations() | ScrollPresenterRepeaterAnchoringPage | [inline, private]
lastScrollPresenterOffset | ScrollPresenterRepeaterAnchoringPage | [private]
lstAsyncEventMessage | ScrollPresenterRepeaterAnchoringPage | [private]
lstQueuedOperations | ScrollPresenterRepeaterAnchoringPage | [private]
lstTriggeredOperations | ScrollPresenterRepeaterAnchoringPage | [private]
MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, protected]
QueuedOperationType enum name | ScrollPresenterRepeaterAnchoringPage | [private]
ScrollPresenter_AnchorRequested(ScrollPresenter sender, ScrollingAnchorRequestedEventArgs args) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ScrollPresenter_ExtentChanged(ScrollPresenter sender, object args) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ScrollPresenter_StateChanged(ScrollPresenter sender, object args) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ScrollPresenter_ViewChanged(ScrollPresenter sender, object args) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ScrollPresenterRepeaterAnchoringPage() | ScrollPresenterRepeaterAnchoringPage | [inline]
ScrollPresenterRepeaterAnchoringPage_Loaded(object sender, RoutedEventArgs e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
ScrollPresenterTestHooks_AnchorEvaluated(ScrollPresenter sender, ScrollPresenterTestHooksAnchorEvaluatedEventArgs args) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
timer | ScrollPresenterRepeaterAnchoringPage | [private]
Timer_Tick(object sender, object e) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
UpdateHorizontalAnchorRatio() | ScrollPresenterRepeaterAnchoringPage | [inline, private]
UpdateRaiseAnchorNotifications(bool raiseAnchorNotifications) | ScrollPresenterRepeaterAnchoringPage | [inline, private]
UpdateVerticalAnchorRatio() | ScrollPresenterRepeaterAnchoringPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:30 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewItemTemplateSelectorTestPage Member List

This is the complete list of members for TreeViewItemTemplateSelectorTestPage, including all inherited members.
TreeViewItemTemplateSelectorTestPage() TreeViewItemTemplateSelectorTestPage [inline]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/NullSelector.cpp Source File

  • ItemsView

NullSelector.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "NullSelector.h"
00007
00008 NullSelector::NullSelector()
00009 {
00010     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00011 }
00012
00013 NullSelector::~NullSelector()
00014 {
00015     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00016 }
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/TestUI/Common/NavigationViewMinimalPage.xaml.cs Source File

  • NavigationView
  • TestUI
  • Common

NavigationViewMinimalPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003 using Microsoft.UI.Xaml.Controls;
00004 using Microsoft.UI.Xaml;
00005
00006 namespace MUXControlsTestApp
00007 {
00008     public sealed partial class NavigationViewMinimalPage : TestPage
00009     {
00010         public NavigationViewMinimalPage()
00011         {
00012             this.InitializeComponent();
00013         }
00014
00015         private void GetNavViewActiveVisualStates_Click(object sender, RoutedEventArgs e)
00016         {
00017             var visualstates = Utilities.VisualStateHelper.GetCurrentVisualStateName(NavView);
00018             NavViewActiveVisualStatesResult.Text = string.Join(",", visualstates);
00019         }
00020
00021         private void TogglePaneOpenButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
00022         {
00023             if (NavView.IsPaneToggleButtonVisible)
00024             {
00025                 NavView.PaneDisplayMode = NavigationViewPaneDisplayMode.Left;
00026                 NavView.IsPaneToggleButtonVisible = false;
00027             }
00028             else
00029             {
00030                 NavView.PaneDisplayMode = NavigationViewPaneDisplayMode.LeftMinimal;
00031                 NavView.IsPaneToggleButtonVisible = true;
00032             }
00033         }
00034     }
00035 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollingZoomOptions.cpp Source File

  • ScrollPresenter

ScrollingZoomOptions.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTypeLogging.h"
00008 #include "ScrollingZoomOptions.h"
00009
00010 #include "ScrollingZoomOptions.properties.cpp"
00011
00012 ScrollingZoomOptions::ScrollingZoomOptions(
00013     winrt::ScrollingAnimationMode const& animationMode)
00014 {
00015     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this,
00016         TypeLogging::AnimationModeToString(animationMode).c_str());
00017
00018     m_animationMode = animationMode;
00019 }
00020
00021 ScrollingZoomOptions::ScrollingZoomOptions(
00022     winrt::ScrollingAnimationMode const& animationMode,
00023     winrt::ScrollingSnapPointsMode const& snapPointsMode)
00024 {
00025     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR_STR, METH_NAME, this,
00026         TypeLogging::AnimationModeToString(animationMode).c_str(),
00027         TypeLogging::SnapPointsModeToString(snapPointsMode).c_str());
00028
00029     m_animationMode = animationMode;
00030     m_snapPointsMode = snapPointsMode;
00031 }
00032
00033 winrt::ScrollingAnimationMode ScrollingZoomOptions::AnimationMode() const
00034 {
00035     return m_animationMode;
00036 }
00037
00038 void ScrollingZoomOptions::AnimationMode(winrt::ScrollingAnimationMode const& animationMode)
00039 {
00040     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this,
00041         TypeLogging::AnimationModeToString(animationMode).c_str());
00042
00043     m_animationMode = animationMode;
00044 }
00045
00046 winrt::ScrollingSnapPointsMode ScrollingZoomOptions::SnapPointsMode() const
00047 {
00048     return m_snapPointsMode;
00049 }
00050
00051 void ScrollingZoomOptions::SnapPointsMode(winrt::ScrollingSnapPointsMode const& snapPointsMode)
00052 {
00053     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this,
00054         TypeLogging::SnapPointsModeToString(snapPointsMode).c_str());
00055
00056     m_snapPointsMode = snapPointsMode;
00057 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/DropDownButton.properties.cpp Source File

  • Generated

DropDownButton.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "DropDownButton.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(DropDownButton)
00012 }
00013
00014 #include "DropDownButton.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RatingItemInfo Member List

This is the complete list of members for RatingItemInfo, including all inherited members.
abi_enter() | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
CheckThread() | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< RatingItemInfo > &&self) noexcept | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
final_release(std::unique_ptr< RatingItemInfo > &&self) | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline, static]
GetBase() | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
GetInner() | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
IsOnThread() | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< RatingItemInfo, winrt::implementation::RatingItemInfoT > | [inline]
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarCustomToggleButton.h Source File

  • InkToolBar

InkToolBarCustomToggleButton.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarCustomToggleButton.g.h"
00011
00012 #include "InkToolBarToggleButton.h"
00013
00014 class InkToolBarCustomToggleButton :
00015     public winrt::implementation::InkToolBarCustomToggleButtonT<InkToolBarCustomToggleButton, InkToolBarToggleButton>
00016 {
00017 public:
00018     ForwardRefToBaseReferenceTracker(InkToolBarToggleButton)
00019 };
00020
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SplitButtonAutomationPeer Member List

This is the complete list of members for SplitButtonAutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
CheckThread() | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
Collapse() | SplitButtonAutomationPeer |
DeleteInstanceOnUIThread(std::unique_ptr< SplitButtonAutomationPeer > &&self) noexcept | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
Expand() | SplitButtonAutomationPeer |
ExpandCollapseState() | SplitButtonAutomationPeer |
final_release(std::unique_ptr< SplitButtonAutomationPeer > &&self) | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline, static]
GetAutomationControlTypeCore() | SplitButtonAutomationPeer |
GetBase() | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
GetClassNameCore() | SplitButtonAutomationPeer |
GetImpl() | SplitButtonAutomationPeer | [private]
GetInner() | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
GetPatternCore(winrt::PatternInterface const &patternInterface) | SplitButtonAutomationPeer |
Invoke() | SplitButtonAutomationPeer |
IsOnThread() | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< SplitButtonAutomationPeer, winrt::implementation::SplitButtonAutomationPeerT > | [inline]
SplitButtonAutomationPeer(winrt::SplitButton const &owner) | SplitButtonAutomationPeer |
Generated on Sun Dec 1 2024 20:53:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Common/LifetimeHandler.h Source File

  • Common

LifetimeHandler.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include <MaterialHelper.h>
00007 #ifdef TWOPANEVIEW_INCLUDED
00008 #include <DisplayRegionHelper.h>
00009 #endif
00010 #ifdef REPEATER_INCLUDED
00011 #include <ItemsRepeater.common.h>
00012 #endif
00013
00014 // Adds objects to CoreApplicationView.Properties so that they get destroyed accordingly and prevent potential deadlocks.
00015 class LifetimeHandler :
00016     public winrt::implements<LifetimeHandler, winrt::IInspectable>
00017 {
00018 private:
00019
00020     // NoRef pointer to this thread's LifetimeHandler.
00021     // We let CoreApplicationView.Properties manage LifetimeHandler's lifetime.
00022     // This is intended to handle all com_ptrs and winrt objects stored in the TLS.
00023     // See Bug 14612819: Disconnecting UiaWindowNotifier blocks the loader lock, deadlocking ShellExperienceHost.
00024     // Also: 15063898: Fix unsafe TLS usage in SplitPanel and ItemsRepeater controls
00025     static thread_local LifetimeHandler* s_tlsInstanceNoRef;
00026     static LifetimeHandler& Instance();
00027
00028 #ifdef REPEATER_INCLUDED
00029     com_ptr<CachedVisualTreeHelpers> m_cachedVisualTreeHelpers;
00030 #endif
00031     com_ptr<MaterialHelper> m_materialHelper;
00032 #ifdef TWOPANEVIEW_INCLUDED
00033     com_ptr<DisplayRegionHelper> m_displayRegionHelper;
00034 #endif
00035 public:
00036     LifetimeHandler() = default;
00037     ~LifetimeHandler();
00038
00039 #ifdef REPEATER_INCLUDED
00040     static com_ptr<CachedVisualTreeHelpers> GetCachedVisualTreeHelpersInstance();
00041 #endif
00042
00043     // MaterialHelper has been factored into common Base and different conditionally compiled derived types for MUX / WUXC
00044     // to support consumption of private API's such as MaterialProperties exclusively in WUXC.
00045     static com_ptr<MaterialHelper> GetMaterialHelperInstance();
00046     static com_ptr<MaterialHelper> TryGetMaterialHelperInstance();
00047     static void ClearMaterialHelperInstance();
00048
00049 #ifdef TWOPANEVIEW_INCLUDED
00050     static com_ptr<DisplayRegionHelper> GetDisplayRegionHelperInstance();
00051 #endif
00052 };
00053
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RevealGridItem Member List

This is the complete list of members for RevealGridItem, including all inherited members.
GetItems() | RevealGridItem | [inline, static]
Header | RevealGridItem |
ImageSource | RevealGridItem |
items | RevealGridItem | [private, static]
SubHeader | RevealGridItem |
Generated on Sun Dec 1 2024 20:54:25 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CollectionChangeDemo::MyDataSource Member List

This is the complete list of members for CollectionChangeDemo::MyDataSource, including all inherited members.
_inner | CollectionChangeDemo::MyDataSource | [private]
Add(object value) | CustomItemsSourceView | [inline]
Clear() | CustomItemsSourceView | [inline]
CollectionChanged | CustomItemsSourceView |
Contains(object value) | CustomItemsSourceView | [inline]
CopyTo(Array array, int index) | CustomItemsSourceView | [inline]
Count | CustomItemsSourceView |
GetAtCore(int index) | CollectionChangeDemo::MyDataSource | [inline, protected, virtual]
GetEnumerator() | CustomItemsSourceView | [inline]
GetSizeCore() | CollectionChangeDemo::MyDataSource | [inline, protected, virtual]
IndexFromKey(string id) | CustomItemsSourceViewWithUniqueIdMapping | [inline]
IndexFromKeyCore(string id) | CustomItemsSourceViewWithUniqueIdMapping | [inline, protected, virtual]
IndexOf(object value) | CustomItemsSourceView | [inline]
Inner | CollectionChangeDemo::MyDataSource |
Insert(int index, int count, bool reset) | CollectionChangeDemo::MyDataSource | [inline]
Microsoft::UI::Xaml::Tests::MUXControls::ApiTests::RepeaterTests::Common::CustomItemsSourceViewWithUniqueIdMapping::Insert(int index, object value) | CustomItemsSourceView | [inline]
IsFixedSize | CustomItemsSourceView |
IsReadOnly | CustomItemsSourceView |
IsSynchronized | CustomItemsSourceView |
KeyFromIndex(int index) | CustomItemsSourceViewWithUniqueIdMapping | [inline]
KeyFromIndexCore(int index) | CollectionChangeDemo::MyDataSource | [inline, protected, virtual]
Move(int oldIndex, int newIndex, int count, bool reset) | CollectionChangeDemo::MyDataSource | [inline]
MyDataSource(List< string > source) | CollectionChangeDemo::MyDataSource | [inline]
OnItemsSourceChanged(NotifyCollectionChangedEventArgs args) | CustomItemsSourceView | [inline, protected]
Remove(int index, int count, bool reset) | CollectionChangeDemo::MyDataSource | [inline]
Microsoft::UI::Xaml::Tests::MUXControls::ApiTests::RepeaterTests::Common::CustomItemsSourceViewWithUniqueIdMapping::Remove(object value) | CustomItemsSourceView | [inline]
RemoveAt(int index) | CustomItemsSourceView | [inline]
Replace(int index, int oldCount, int newCount, bool reset) | CollectionChangeDemo::MyDataSource | [inline]
Reset() | CollectionChangeDemo::MyDataSource | [inline]
SyncRoot | CustomItemsSourceView |
this | CustomItemsSourceView |
Generated on Sun Dec 1 2024 20:54:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DropDownButtonPage Member List

This is the complete list of members for DropDownButtonPage, including all inherited members.
_clickCount | DropDownButtonPage | [private]
_flyout | DropDownButtonPage | [private]
_flyoutClosedCount | DropDownButtonPage | [private]
_flyoutOpenedCount | DropDownButtonPage | [private]
DropDownButtonPage() | DropDownButtonPage | [inline]
SetFlyoutCheckbox_Checked(object sender, RoutedEventArgs e) | DropDownButtonPage | [inline, private]
SetFlyoutCheckbox_Unchecked(object sender, RoutedEventArgs e) | DropDownButtonPage | [inline, private]
TestDropDownButton_Click(object sender, object e) | DropDownButtonPage | [inline, private]
TestDropDownButtonFlyout_Closed(object sender, object e) | DropDownButtonPage | [inline, private]
TestDropDownButtonFlyout_Opened(object sender, object e) | DropDownButtonPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

sealed< T, fallback, RawStorageT > Member List

This is the complete list of members for sealed< T, fallback, RawStorageT >, including all inherited members.
as() const | sealed< T, fallback, RawStorageT > | [inline]
c_assetLoc | sealed< T, fallback, RawStorageT > | [private, static]
c_resourceLoc | sealed< T, fallback, RawStorageT > | [private, static]
c_resourceLocWinUI | sealed< T, fallback, RawStorageT > | [private, static]
get() const | sealed< T, fallback, RawStorageT > | [inline]
GetAssetMap() | sealed< T, fallback, RawStorageT > | [private, static]
GetFileContents(const wstring_view &assetFileName) | sealed< T, fallback, RawStorageT > | [static]
GetImageSurface(const wstring_view &assetName, winrt::Size imageSize) | sealed< T, fallback, RawStorageT > | [static]
GetLocalizedStringResource(const wstring_view &resourceName) | sealed< T, fallback, RawStorageT > | [static]
GetResourceContext() | sealed< T, fallback, RawStorageT > | [private, static]
GetResourceManager() | sealed< T, fallback, RawStorageT > | [private, static]
GetResourceManagerImpl() | sealed< T, fallback, RawStorageT > | [private, static]
GetResourceMap() | sealed< T, fallback, RawStorageT > | [private, static]
IsResourceIdNull(ResourceIdType resourceId) | sealed< T, fallback, RawStorageT > | [inline, static]
m_resourceManagerWinRT | sealed< T, fallback, RawStorageT > | [private, static]
operator bool() const | sealed< T, fallback, RawStorageT > | [inline, explicit]
operator!=(const tracker_ref &rhs) const | sealed< T, fallback, RawStorageT > | [inline]
operator!=(const T &rhs) const | sealed< T, fallback, RawStorageT > | [inline]
operator=(tracker_ref &&other) noexcept | sealed< T, fallback, RawStorageT > | [inline]
operator=(const tracker_ref &other) | sealed< T, fallback, RawStorageT > | [inline]
operator==(const tracker_ref &rhs) const | sealed< T, fallback, RawStorageT > | [inline]
operator==(const T &rhs) const | sealed< T, fallback, RawStorageT > | [inline]
ResourceAccessor() | sealed< T, fallback, RawStorageT > | [private]
ResourceLookup(const winrt::Control &control, const winrt::IInspectable &key) | sealed< T, fallback, RawStorageT > | [static]
safe_get(bool useSafeGet=true) const | sealed< T, fallback, RawStorageT > | [inline]
set(const T &value) | sealed< T, fallback, RawStorageT > | [inline]
SetOwner(const ITrackerHandleManager *owner) | sealed< T, fallback, RawStorageT > | [inline, private]
ShouldFallbackToComPointers() const | sealed< T, fallback, RawStorageT > | [inline, private]
Swap(tracker_ref &other) | sealed< T, fallback, RawStorageT > | [inline]
tracker_ref(const ITrackerHandleManager *owner) | sealed< T, fallback, RawStorageT > | [inline, explicit]
tracker_ref(const ITrackerHandleManager *owner, const T &value) | sealed< T, fallback, RawStorageT > | [inline, explicit]
tracker_ref(nullptr_t) | sealed< T, fallback, RawStorageT > | [inline, explicit]
tracker_ref(tracker_ref &&other) noexcept | sealed< T, fallback, RawStorageT > | [inline]
tracker_ref(const tracker_ref &other) | sealed< T, fallback, RawStorageT > | [inline]
try_as() const | sealed< T, fallback, RawStorageT > | [inline]
~tracker_ref() | sealed< T, fallback, RawStorageT > | [inline]
Generated on Sun Dec 1 2024 20:53:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IPointDiffuseEffect Member List

This is the complete list of members for IPointDiffuseEffect, including all inherited members.
DiffuseAmount([out, retval] float *value) | IPointDiffuseEffect
DiffuseAmount([in] float value) | IPointDiffuseEffect
HeightMapInterpolationMode([out, retval] Microsoft.UI.Private.Composition.Effects.CanvasImageInterpolation *value) | IPointDiffuseEffect
HeightMapInterpolationMode([in] Microsoft.UI.Private.Composition.Effects.CanvasImageInterpolation value) | IPointDiffuseEffect
HeightMapKernelSize([out, retval] Windows.Foundation.Numerics.Vector2 *value) | IPointDiffuseEffect
HeightMapKernelSize([in] Windows.Foundation.Numerics.Vector2 value) | IPointDiffuseEffect
HeightMapScale([out, retval] float *value) | IPointDiffuseEffect
HeightMapScale([in] float value) | IPointDiffuseEffect
LightColor([out, retval] Windows.UI.Color *value) | IPointDiffuseEffect
LightColor([in] Windows.UI.Color value) | IPointDiffuseEffect
LightPosition([out, retval] Windows.Foundation.Numerics.Vector3 *value) | IPointDiffuseEffect
LightPosition([in] Windows.Foundation.Numerics.Vector3 value) | IPointDiffuseEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | IPointDiffuseEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | IPointDiffuseEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemsSourceViewFactory.cpp Source File

  • Repeater

ItemsSourceViewFactory.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ItemsSourceViewFactory.h"
00007
00008 namespace winrt::Microsoft::UI::Xaml::Controls
00009 {
00010     CppWinRTActivatableClassWithFactory(ItemsSourceView, ItemsSourceViewFactory)
00011 }
00012
00013 void* winrt_make_Microsoft_UI_Xaml_Controls_ItemsSourceView()
00014 {
00015     return winrt::detach_abi(winrt::make<winrt::Microsoft::UI::Xaml::Controls::factory_implementation::ItemsSourceView>());
00016 }
00017 namespace winrt::Microsoft::UI::Xaml::Controls
00018 {
00019     ItemsSourceView::ItemsSourceView(winrt::Windows::Foundation::IInspectable const& source) :
00020         ItemsSourceView(winrt::make<InspectingDataSource>(source))
00021     {
00022     }
00023 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ZoomSnapPoint Member List

This is the complete list of members for ZoomSnapPoint, including all inherited members.
Combine(int &combinationCount, winrt::SnapPointBase const &snapPoint) const | ZoomSnapPoint |
CreateConditionalExpression(std::tuple< double, double > actualApplicableZone, std::tuple< double, double > actualImpulseApplicableZone, winrt::InteractionTracker const &interactionTracker, winrt::hstring const &target, winrt::hstring const &scale, bool isInertiaFromImpulse) | ZoomSnapPoint |
CreateRestingPointExpression(double ignoredValue, std::tuple< double, double > actualImpulseApplicableZone, winrt::InteractionTracker const &interactionTracker, winrt::hstring const &target, winrt::hstring const &scale, bool isInertiaFromImpulse) | ZoomSnapPoint |
DetermineActualApplicableZone(const SnapPointBase *previousSnapPoint, const SnapPointBase *nextSnapPoint) | ZoomSnapPoint |
DetermineActualImpulseApplicableZone(const SnapPointBase *previousSnapPoint, const SnapPointBase *nextSnapPoint, double currentIgnoredValue, double previousIgnoredValue, double nextIgnoredValue) | ZoomSnapPoint |
DetermineMaxActualApplicableZone(const SnapPointBase *nextSnapPoint) const | ZoomSnapPoint | [private]
DetermineMaxActualImpulseApplicableZone(const SnapPointBase *nextSnapPoint, double currentIgnoredValue, double nextIgnoredValue) const | ZoomSnapPoint | [private]
DetermineMinActualApplicableZone(const SnapPointBase *previousSnapPoint) const | ZoomSnapPoint | [private]
DetermineMinActualImpulseApplicableZone(const SnapPointBase *previousSnapPoint, double currentIgnoredValue, double previousIgnoredValue) const | ZoomSnapPoint | [private]
Evaluate(std::tuple< double, double > actualApplicableZone, double value) const | ZoomSnapPoint |
ImpulseInfluence(double edgeOfMidpoint, double ignoredValue) const | ZoomSnapPoint |
Influence(double edgeOfMidpoint) const | ZoomSnapPoint |
SnapCount() const | ZoomSnapPoint |
SortPredicate() const | ZoomSnapPoint |
UpdateConditionalExpressionAnimationForImpulse(winrt::ExpressionAnimation const &conditionExpressionAnimation, std::tuple< double, double > actualImpulseApplicableZone) const | ZoomSnapPoint |
UpdateRestingPointExpressionAnimationForImpulse(winrt::ExpressionAnimation const &restingValueExpressionAnimation, double ignoredValue, std::tuple< double, double > actualImpulseApplicableZone) const | ZoomSnapPoint |
Value() | ZoomSnapPoint |
ZoomSnapPoint(double snapPointValue) | ZoomSnapPoint |
Generated on Sun Dec 1 2024 20:53:24 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ListViewPage Member List

This is the complete list of members for ListViewPage, including all inherited members.
ListViewPage() ListViewPage [inline]
Generated on Sun Dec 1 2024 20:54:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MenuBar/MenuBarItemAutomationPeer.h Source File

  • MenuBar

MenuBarItemAutomationPeer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "MenuBarItem.h"
00007 #include "MenuBarItemAutomationPeer.g.h"
00008
00009 class MenuBarItemAutomationPeer :
00010     public ReferenceTracker<MenuBarItemAutomationPeer, winrt::implementation::MenuBarItemAutomationPeerT>
00011 {
00012
00013 public:
00014     MenuBarItemAutomationPeer(winrt::MenuBarItem const& owner);
00015
00016     // IAutomationPeerOverrides
00017     winrt::IInspectable GetPatternCore(winrt::PatternInterface const& patternInterface);
00018     winrt::AutomationControlType GetAutomationControlTypeCore();
00019     winrt::hstring GetNameCore();
00020     winrt::hstring GetClassNameCore();
00021
00022     // IInvokeProvider
00023     void Invoke();
00024
00025     // IExpandCollapseProvider
00026     winrt::ExpandCollapseState ExpandCollapseState();
00027     void Collapse();
00028     void Expand();
00029
00030 };
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarPenConfigurationControl Member List

This is the complete list of members for InkToolBarPenConfigurationControl, including all inherited members.
abi_enter() | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
CheckThread() | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
ClearProperties() | InkToolBarPenConfigurationControlProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< InkToolBarPenConfigurationControl > &&self) noexcept | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline, static]
EnsureProperties() | InkToolBarPenConfigurationControlProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
final_release(std::unique_ptr< InkToolBarPenConfigurationControl > &&self) | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline, static]
GetBase() | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
GetInner() | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
InkToolBarPenConfigurationControlProperties() | InkToolBarPenConfigurationControlProperties |
IsOnThread() | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
PenButton() | InkToolBarPenConfigurationControl | [inline]
InkToolBarPenConfigurationControlProperties::PenButton(winrt::InkToolBarPenButton const &value) | InkToolBarPenConfigurationControlProperties |
PenButtonProperty() | InkToolBarPenConfigurationControlProperties | [inline, static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< InkToolBarPenConfigurationControl, winrt::implementation::InkToolBarPenConfigurationControlT > | [inline]
s_PenButtonProperty | InkToolBarPenConfigurationControlProperties | [static]
Generated on Sun Dec 1 2024 20:52:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InteractionTrackerOwner Member List

This is the complete list of members for InteractionTrackerOwner, including all inherited members.
CustomAnimationStateEntered(const winrt::InteractionTracker &sender, const winrt::InteractionTrackerCustomAnimationStateEnteredArgs &args) | InteractionTrackerOwner
IdleStateEntered(const winrt::InteractionTracker &sender, const winrt::InteractionTrackerIdleStateEnteredArgs &args) | InteractionTrackerOwner
InertiaStateEntered(const winrt::InteractionTracker &sender, const winrt::InteractionTrackerInertiaStateEnteredArgs &args) | InteractionTrackerOwner
InteractingStateEntered(const winrt::InteractionTracker &sender, const winrt::InteractionTrackerInteractingStateEnteredArgs &args) | InteractionTrackerOwner
InteractionTrackerOwner(const winrt::ScrollPresenter &scrollPresenter) | InteractionTrackerOwner
RequestIgnored(const winrt::InteractionTracker &sender, const winrt::InteractionTrackerRequestIgnoredArgs &args) | InteractionTrackerOwner
ValuesChanged(const winrt::InteractionTracker &sender, const winrt::InteractionTrackerValuesChangedArgs &args) | InteractionTrackerOwner
~InteractionTrackerOwner() | InteractionTrackerOwner
Generated on Sun Dec 1 2024 20:52:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemsViewAutomationPeer Member List

This is the complete list of members for ItemsViewAutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
CanSelectMultiple() | ItemsViewAutomationPeer |
CheckThread() | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< ItemsViewAutomationPeer > &&self) noexcept | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
final_release(std::unique_ptr< ItemsViewAutomationPeer > &&self) | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline, static]
GetAutomationControlTypeCore() | ItemsViewAutomationPeer |
GetBase() | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
GetClassNameCore() | ItemsViewAutomationPeer |
GetImpl() | ItemsViewAutomationPeer | [private]
GetInner() | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
GetPatternCore(winrt::PatternInterface const &patternInterface) | ItemsViewAutomationPeer |
GetSelection() | ItemsViewAutomationPeer |
IsOnThread() | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
IsSelectionRequired() | ItemsViewAutomationPeer | [inline]
ItemsViewAutomationPeer(winrt::ItemsView const &owner) | ItemsViewAutomationPeer |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
RaiseSelectionChanged(double oldIndex, double newIndex) | ItemsViewAutomationPeer |
ReferenceTracker(Args &&...args) | ReferenceTracker< ItemsViewAutomationPeer, winrt::implementation::ItemsViewAutomationPeerT > | [inline]
Generated on Sun Dec 1 2024 20:52:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ObservableVectorInnerImpl< VectorOptions, Wrapper > Member List

This is the complete list of members for ObservableVectorInnerImpl< VectorOptions, Wrapper >, including all inherited members.
AddEventHandler(EventHandler const &handler) | ObservableVectorInnerImpl< VectorOptions, Wrapper > | [inline]
Append(typename T_type const &value) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
Clear() | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
GetAt(uint32_t const index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
GetMany(uint32_t const startIndex, winrt::array_view< T_type > values) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
GetTrackerHandlerManager() | VectorInnerImpl< VectorOptions, Wrapper > | [inline, protected]
IndexOf(typename T_type const &value, uint32_t &index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
IndexOf_OptimizedForRemove(typename T_type const &value, uint32_t &index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
InsertAt(uint32_t const index, typename T_type const &value) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
m_optimizedIndexOf_StartNextSearchAt | VectorInnerImpl< VectorOptions, Wrapper > | [protected]
m_vector | VectorInnerImpl< VectorOptions, Wrapper > | [protected]
ObservableVectorInnerImpl(IVectorOwner< EventSource, T_type > *pIVectorExternal) | ObservableVectorInnerImpl< VectorOptions, Wrapper > | [inline]
RaiseChildrenChanged(winrt::CollectionChange collectionChange, unsigned int index) override | ObservableVectorInnerImpl< VectorOptions, Wrapper > | [inline, virtual]
RemoveAt(uint32_t const index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
RemoveAtEnd() | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
RemoveEventHandler(winrt::event_token const &token) | ObservableVectorInnerImpl< VectorOptions, Wrapper > | [inline]
ReplaceAll(winrt::array_view< T_type const > values) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
reserve(unsigned int n) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
SafeGetAt(uint32_t const index) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
SetAt(uint32_t const index, typename T_type const &value) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
Size() | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
unwrap(T_Storage const &hold, bool useSafeGet=false) | VectorInnerImpl< VectorOptions, Wrapper > | [inline, protected]
VectorInnerImpl(ITrackerHandleManager *trackerHandleManager) | VectorInnerImpl< VectorOptions, Wrapper > | [inline]
wrap(typename T_type value) | VectorInnerImpl< VectorOptions, Wrapper > | [inline, protected]
Generated on Sun Dec 1 2024 20:52:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

WebView2Common Member List

This is the complete list of members for WebView2Common, including all inherited members.
_testPage | WebView2Common | [private]
AppendMessage(string message) | WebView2Common | [inline]
ClearStatus() | WebView2Common | [inline]
CopyTestPagesLocally() | WebView2Common | [inline]
GetTestPageUri(string testPageName) | WebView2Common | [inline, static]
LoadWebPage(WebView2 webview, string testPageName) | WebView2Common | [inline, static]
MessageLog | WebView2Common | [private]
NavigateToStringMessage(WebView2 webview) | WebView2Common | [inline, static]
NavigateToUri(WebView2 webview, string UriString) | WebView2Common | [inline, static]
NavigateToUri(WebView2 webview, Uri uri) | WebView2Common | [inline, static]
Status1 | WebView2Common | [private]
Status2 | WebView2Common | [private]
Status3 | WebView2Common | [private]
WebView2Common(TestPage testPage) | WebView2Common | [inline]
Generated on Sun Dec 1 2024 20:54:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CustomItemsSourceView Member List

This is the complete list of members for CustomItemsSourceView, including all inherited members.
Add(object value) | CustomItemsSourceView | [inline]
Clear() | CustomItemsSourceView | [inline]
CollectionChanged | CustomItemsSourceView |
Contains(object value) | CustomItemsSourceView | [inline]
CopyTo(Array array, int index) | CustomItemsSourceView | [inline]
Count | CustomItemsSourceView |
GetAtCore(int index) | CustomItemsSourceView | [inline, protected, virtual]
GetEnumerator() | CustomItemsSourceView | [inline]
GetSizeCore() | CustomItemsSourceView | [inline, protected, virtual]
IndexOf(object value) | CustomItemsSourceView | [inline]
Insert(int index, object value) | CustomItemsSourceView | [inline]
IsFixedSize | CustomItemsSourceView |
IsReadOnly | CustomItemsSourceView |
IsSynchronized | CustomItemsSourceView |
OnItemsSourceChanged(NotifyCollectionChangedEventArgs args) | CustomItemsSourceView | [inline, protected]
Remove(object value) | CustomItemsSourceView | [inline]
RemoveAt(int index) | CustomItemsSourceView | [inline]
SyncRoot | CustomItemsSourceView |
this | CustomItemsSourceView |
Generated on Sun Dec 1 2024 20:53:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/WebView2.properties.cpp Source File

  • Generated

WebView2.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "..\WebView2\WebView2.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(WebView2)
00012 }
00013
00014 #include "WebView2.g.cpp"
00015
00016 GlobalDependencyProperty WebView2Properties::s_CanGoBackProperty{ nullptr };
00017 GlobalDependencyProperty WebView2Properties::s_CanGoForwardProperty{ nullptr };
00018 GlobalDependencyProperty WebView2Properties::s_DefaultBackgroundColorProperty{ nullptr };
00019 GlobalDependencyProperty WebView2Properties::s_SourceProperty{ nullptr };
00020
00021 WebView2Properties::WebView2Properties()
00022     : m_coreProcessFailedEventSource{static_cast<WebView2*>(this)}
00023     , m_coreWebView2InitializedEventSource{static_cast<WebView2*>(this)}
00024     , m_navigationCompletedEventSource{static_cast<WebView2*>(this)}
00025     , m_navigationStartingEventSource{static_cast<WebView2*>(this)}
00026     , m_webMessageReceivedEventSource{static_cast<WebView2*>(this)}
00027 {
00028     EnsureProperties();
00029 }
00030
00031 void WebView2Properties::EnsureProperties()
00032 {
00033     if (!s_CanGoBackProperty)
00034     {
00035         s_CanGoBackProperty =
00036             InitializeDependencyProperty(
00037                 L"CanGoBack",
00038                 winrt::name_of<bool>(),
00039                 winrt::name_of<winrt::WebView2>(),
00040                 false /* isAttached */,
00041                 ValueHelper<bool>::BoxedDefaultValue(),
00042                 winrt::PropertyChangedCallback(&OnCanGoBackPropertyChanged));
00043     }
00044     if (!s_CanGoForwardProperty)
00045     {
00046         s_CanGoForwardProperty =
00047             InitializeDependencyProperty(
00048                 L"CanGoForward",
00049                 winrt::name_of<bool>(),
00050                 winrt::name_of<winrt::WebView2>(),
00051                 false /* isAttached */,
00052                 ValueHelper<bool>::BoxedDefaultValue(),
00053                 winrt::PropertyChangedCallback(&OnCanGoForwardPropertyChanged));
00054     }
00055     if (!s_DefaultBackgroundColorProperty)
00056     {
00057         s_DefaultBackgroundColorProperty =
00058             InitializeDependencyProperty(
00059                 L"DefaultBackgroundColor",
00060                 winrt::name_of<winrt::Color>(),
00061                 winrt::name_of<winrt::WebView2>(),
00062                 false /* isAttached */,
00063                 ValueHelper<winrt::Color>::BoxValueIfNecessary(WebView2::sc_controllerDefaultBackgroundColor),
00064                 winrt::PropertyChangedCallback(&OnDefaultBackgroundColorPropertyChanged));
00065     }
00066     if (!s_SourceProperty)
00067     {
00068         s_SourceProperty =
00069             InitializeDependencyProperty(
00070                 L"Source",
00071                 winrt::name_of<winrt::Uri>(),
00072                 winrt::name_of<winrt::WebView2>(),
00073                 false /* isAttached */,
00074                 ValueHelper<winrt::Uri>::BoxedDefaultValue(),
00075                 winrt::PropertyChangedCallback(&OnSourcePropertyChanged));
00076     }
00077 }
00078
00079 void WebView2Properties::ClearProperties()
00080 {
00081     s_CanGoBackProperty = nullptr;
00082     s_CanGoForwardProperty = nullptr;
00083     s_DefaultBackgroundColorProperty = nullptr;
00084     s_SourceProperty = nullptr;
00085 }
00086
00087 void WebView2Properties::OnCanGoBackPropertyChanged(
00088     winrt::DependencyObject const& sender,
00089     winrt::DependencyPropertyChangedEventArgs const& args)
00090 {
00091     auto owner = sender.as<winrt::WebView2>();
00092     winrt::get_self<WebView2>(owner)->OnPropertyChanged(args);
00093 }
00094
00095 void WebView2Properties::OnCanGoForwardPropertyChanged(
00096     winrt::DependencyObject const& sender,
00097     winrt::DependencyPropertyChangedEventArgs const& args)
00098 {
00099     auto owner = sender.as<winrt::WebView2>();
00100     winrt::get_self<WebView2>(owner)->OnPropertyChanged(args);
00101 }
00102
00103 void WebView2Properties::OnDefaultBackgroundColorPropertyChanged(
00104     winrt::DependencyObject const& sender,
00105     winrt::DependencyPropertyChangedEventArgs const& args)
00106 {
00107     auto owner = sender.as<winrt::WebView2>();
00108     winrt::get_self<WebView2>(owner)->OnPropertyChanged(args);
00109 }
00110
00111 void WebView2Properties::OnSourcePropertyChanged(
00112     winrt::DependencyObject const& sender,
00113     winrt::DependencyPropertyChangedEventArgs const& args)
00114 {
00115     auto owner = sender.as<winrt::WebView2>();
00116     winrt::get_self<WebView2>(owner)->OnPropertyChanged(args);
00117 }
00118
00119 void WebView2Properties::CanGoBack(bool value)
00120 {
00121     [[gsl::suppress(con)]]
00122     {
00123     static_cast<WebView2*>(this)->SetValue(s_CanGoBackProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00124     }
00125 }
00126
00127 bool WebView2Properties::CanGoBack()
00128 {
00129     return ValueHelper<bool>::CastOrUnbox(static_cast<WebView2*>(this)->GetValue(s_CanGoBackProperty));
00130 }
00131
00132 void WebView2Properties::CanGoForward(bool value)
00133 {
00134     [[gsl::suppress(con)]]
00135     {
00136     static_cast<WebView2*>(this)->SetValue(s_CanGoForwardProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00137     }
00138 }
00139
00140 bool WebView2Properties::CanGoForward()
00141 {
00142     return ValueHelper<bool>::CastOrUnbox(static_cast<WebView2*>(this)->GetValue(s_CanGoForwardProperty));
00143 }
00144
00145 void WebView2Properties::DefaultBackgroundColor(winrt::Color const& value)
00146 {
00147     [[gsl::suppress(con)]]
00148     {
00149     static_cast<WebView2*>(this)->SetValue(s_DefaultBackgroundColorProperty, ValueHelper<winrt::Color>::BoxValueIfNecessary(value));
00150     }
00151 }
00152
00153 winrt::Color WebView2Properties::DefaultBackgroundColor()
00154 {
00155     return ValueHelper<winrt::Color>::CastOrUnbox(static_cast<WebView2*>(this)->GetValue(s_DefaultBackgroundColorProperty));
00156 }
00157
00158 void WebView2Properties::Source(winrt::Uri const& value)
00159 {
00160     [[gsl::suppress(con)]]
00161     {
00162     static_cast<WebView2*>(this)->SetValue(s_SourceProperty, ValueHelper<winrt::Uri>::BoxValueIfNecessary(value));
00163     }
00164 }
00165
00166 winrt::Uri WebView2Properties::Source()
00167 {
00168     return ValueHelper<winrt::Uri>::CastOrUnbox(static_cast<WebView2*>(this)->GetValue(s_SourceProperty));
00169 }
00170
00171 winrt::event_token WebView2Properties::CoreProcessFailed(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2ProcessFailedEventArgs> const& value)
00172 {
00173     return m_coreProcessFailedEventSource.add(value);
00174 }
00175
00176 void WebView2Properties::CoreProcessFailed(winrt::event_token const& token)
00177 {
00178     m_coreProcessFailedEventSource.remove(token);
00179 }
00180
00181 winrt::event_token WebView2Properties::CoreWebView2Initialized(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2InitializedEventArgs> const& value)
00182 {
00183     return m_coreWebView2InitializedEventSource.add(value);
00184 }
00185
00186 void WebView2Properties::CoreWebView2Initialized(winrt::event_token const& token)
00187 {
00188     m_coreWebView2InitializedEventSource.remove(token);
00189 }
00190
00191 winrt::event_token WebView2Properties::NavigationCompleted(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2NavigationCompletedEventArgs> const& value)
00192 {
00193     return m_navigationCompletedEventSource.add(value);
00194 }
00195
00196 void WebView2Properties::NavigationCompleted(winrt::event_token const& token)
00197 {
00198     m_navigationCompletedEventSource.remove(token);
00199 }
00200
00201 winrt::event_token WebView2Properties::NavigationStarting(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2NavigationStartingEventArgs> const& value)
00202 {
00203     return m_navigationStartingEventSource.add(value);
00204 }
00205
00206 void WebView2Properties::NavigationStarting(winrt::event_token const& token)
00207 {
00208     m_navigationStartingEventSource.remove(token);
00209 }
00210
00211 winrt::event_token WebView2Properties::WebMessageReceived(winrt::TypedEventHandler<winrt::WebView2, winrt::CoreWebView2WebMessageReceivedEventArgs> const& value)
00212 {
00213     return m_webMessageReceivedEventSource.add(value);
00214 }
00215
00216 void WebView2Properties::WebMessageReceived(winrt::event_token const& token)
00217 {
00218     m_webMessageReceivedEventSource.remove(token);
00219 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ToolTipPage Member List

This is the complete list of members for ToolTipPage, including all inherited members.
ToolTipPage() ToolTipPage [inline]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MenuBar/MenuBarItemFlyout.h Source File

  • MenuBar

MenuBarItemFlyout.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "MenuBarItemFlyout.g.h"
00007
00008 class MenuBarItemFlyout :
00009     public ReferenceTracker<MenuBarItemFlyout, winrt::implementation::MenuBarItemFlyoutT>
00010 {
00011 public:
00012     // Property changed event handler.
00013     static void OnPropertyChanged(
00014         winrt::DependencyObject const& sender,
00015         winrt::DependencyPropertyChangedEventArgs const& args) {}
00016
00017     winrt::Control CreatePresenter();
00018
00019     tracker_ref<winrt::Control> m_presenter{ this };
00020 };
00021
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CheckBoxPage Member List

This is the complete list of members for CheckBoxPage, including all inherited members.
CheckBoxPage() | CheckBoxPage | [inline]
OnReverseButtonClicked(object sender, object args) | CheckBoxPage | [inline]
Generated on Sun Dec 1 2024 20:54:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ElementInfo Member List

This is the complete list of members for ElementInfo, including all inherited members.
Element() const | ElementInfo | [inline]
ElementInfo(const winrt::UIElement &element, const winrt::com_ptr< VirtualizationInfo > &virtInfo) | ElementInfo |
VirtInfo() const | ElementInfo | [inline]
Generated on Sun Dec 1 2024 20:52:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommonStylesApiTests Member List

This is the complete list of members for CommonStylesApiTests, including all inherited members.
AreKeysFromExpectedInActualDictionary(ResourceDictionary expectedDictionary, string expectedDictionaryName, ResourceDictionary actualDictionary, string actualDictionaryName) | CommonStylesApiTests | [inline, private]
CornerRadiusFilterConverterTest() | CommonStylesApiTests | [inline]
DumpThemeResources() | CommonStylesApiTests | [inline]
EnsureNoMissingThemeResources(IList< string > baseline, XamlControlsResources dictionaryToVerify) | CommonStylesApiTests | [inline, private]
GetVisualChildByName(DependencyObject root, string name) | CommonStylesApiTests | [inline, private]
VerifyAllThemesContainSameResourceKeys() | CommonStylesApiTests | [inline]
VerifyAppBarButtonChevronMarginsDoNotCollide() | CommonStylesApiTests | [inline]
VerifyAppBarButtonLightweightStyling() | CommonStylesApiTests | [inline]
VerifyNoResourceKeysWereRemovedFromPreviousStableReleaseInV2Styles() | CommonStylesApiTests | [inline]
VerifyVisualTreeForCommandBarCornerRadius() | CommonStylesApiTests | [inline]
VerifyVisualTreeForCommandBarOverflowMenu() | CommonStylesApiTests | [inline]
VerifyVisualTreeForControlsInCommonStyles() | CommonStylesApiTests | [inline]
XamlStringForControl(string controlName) | CommonStylesApiTests | [inline, private]
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioButtons/RadioButtons.cpp Source File

  • RadioButtons

RadioButtons.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "RadioButtons.h"
00007 #include "RadioButtonsAutomationPeer.h"
00008 #include "Vector.h"
00009 #include "RuntimeProfiler.h"
00010 #include "ResourceAccessor.h"
00011 #include "RadioButtonsTestHooks.h"
00012
00013 RadioButtons::RadioButtons()
00014 {
00015     __RP_Marker_ClassById(RuntimeProfiler::ProfId_RadioButtons);
00016
00017     auto const items = winrt::make<Vector<winrt::IInspectable>>();
00018     SetValue(s_ItemsProperty, items);
00019
00020     SetDefaultStyleKey(this);
00021
00022     // Override normal up/down/left/right behavior -- down should always go to the next item and up to the previous.
00023     // left and right should be spacial but contained to the RadioButtons control. We have to attach to PreviewKeyDown
00024     // because RadioButton has a key down handler for up and down that gets called before we can intercept. Issue #1634.
00025     PreviewKeyDown({ this, &RadioButtons::OnChildPreviewKeyDown });
00026
00027     AccessKeyInvoked({ this, &RadioButtons::OnAccessKeyInvoked });
00028     GettingFocus({ this, &RadioButtons::OnGettingFocus });
00029
00030     m_radioButtonsElementFactory = winrt::make_self<RadioButtonsElementFactory>();
00031
00032     // RadioButtons adds handlers to its child radio button elements' checked and unchecked events.
00033     // To ensure proper lifetime management we create revokers for these elements and attach
00034     // the revokers to the child radio button via this attached property.  This way, if/when the child
00035     // is cleaned up we will automatically revoke the handler.
00036     s_childHandlersProperty =
00037         InitializeDependencyProperty(
00038             s_childHandlersPropertyName,
00039             winrt::name_of<ChildHandlers>(),
00040             winrt::name_of<winrt::RadioButtons>(),
00041             true /* isAttached */,
00042             nullptr,
00043             nullptr);
00044 }
00045
00046 winrt::AutomationPeer RadioButtons::OnCreateAutomationPeer()
00047 {
00048     return winrt::make<RadioButtonsAutomationPeer>(*this);
00049 }
00050
00051
00052 void RadioButtons::OnApplyTemplate()
00053 {
00054     const winrt::IControlProtected controlProtected{ *this };
00055
00056     m_isEnabledChangedRevoker = IsEnabledChanged(winrt::auto_revoke, { this,  &RadioButtons::OnIsEnabledChanged });
00057
00058     m_repeater.set([this, controlProtected]() {
00059         if (auto const repeater = GetTemplateChildT<winrt::ItemsRepeater>(s_repeaterName, controlProtected))
00060         {
00061             repeater.ItemTemplate(*m_radioButtonsElementFactory);
00062
00063             m_repeaterElementPreparedRevoker = repeater.ElementPrepared(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementPrepared });
00064             m_repeaterElementClearingRevoker = repeater.ElementClearing(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementClearing });
00065             m_repeaterElementIndexChangedRevoker = repeater.ElementIndexChanged(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementIndexChanged });
00066             m_repeaterLoadedRevoker = repeater.Loaded(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterLoaded });
00067             return repeater;
00068         }
00069         return static_cast<winrt::ItemsRepeater>(nullptr);
00070     }());
00071
00072     UpdateItemsSource();
00073     UpdateVisualStateForIsEnabledChange();
00074 }
00075
00076 // When focus comes from outside the RadioButtons control we will put focus on the selected radio button.
00077 void RadioButtons::OnGettingFocus(const winrt::IInspectable&, const winrt::GettingFocusEventArgs& args)
00078 {
00079     if (auto const repeater = m_repeater.get())
00080     {
00081         auto const inputDevice = args.InputDevice();
00082         if (inputDevice == winrt::FocusInputDeviceKind::Keyboard)
00083         {
00084             // If focus is coming from outside the repeater, put focus on the selected item.
00085             auto const oldFocusedElement = args.OldFocusedElement();
00086             if (!oldFocusedElement || repeater != winrt::VisualTreeHelper::GetParent(oldFocusedElement))
00087             {
00088                 if (auto const selectedItem = repeater.TryGetElement(m_selectedIndex))
00089                 {
00090                     if (args.TrySetNewFocusedElement(selectedItem))
00091                     {
00092                         args.Handled(true);
00093                     }
00094                 }
00095             }
00096
00097             // Selection follows focus unless control is held down.
00098             else if ((winrt::InputKeyboardSource::GetKeyStateForCurrentThread(winrt::VirtualKey::Control) & winrt::CoreVirtualKeyStates::Down) != winrt::CoreVirtualKeyStates::Down)
00099             {
00100                 if (auto const newFocusedElementAsUIE = args.NewFocusedElement().as<winrt::UIElement>())
00101                 {
00102                     Select(repeater.GetElementIndex(newFocusedElementAsUIE));
00103                     args.Handled(true);
00104                 }
00105             }
00106         }
00107     }
00108 }
00109
00110 void RadioButtons::OnRepeaterLoaded(const winrt::IInspectable&, const winrt::RoutedEventArgs&)
00111 {
00112     if (auto const repeater = m_repeater.get())
00113     {
00114         if (m_testHooksEnabled)
00115         {
00116             AttachToLayoutChanged();
00117         }
00118
00119         m_blockSelecting = false;
00120         if (SelectedIndex() == -1 && SelectedItem())
00121         {
00122             UpdateSelectedItem();
00123         }
00124         else
00125         {
00126             UpdateSelectedIndex();
00127         }
00128
00129         OnRepeaterCollectionChanged(nullptr, nullptr);
00130     }
00131 }
00132
00133 void RadioButtons::OnChildPreviewKeyDown(const winrt::IInspectable&, const winrt::KeyRoutedEventArgs& args)
00134 {
00135     switch (args.Key())
00136     {
00137     case winrt::VirtualKey::Down:
00138         if (MoveFocusNext())
00139         {
00140             return args.Handled(true);
00141         }
00142         else if (args.OriginalKey() == winrt::VirtualKey::GamepadDPadDown)
00143         {
00144             if (winrt::FocusManager::TryMoveFocus(winrt::FocusNavigationDirection::Next, GetFindNextElementOptions(false /*useThisAsSearchRoot*/)))
00145             {
00146                 return args.Handled(true);
00147             }
00148         }
00149         args.Handled(HandleEdgeCaseFocus(false, args.OriginalSource()));
00150         break;
00151     case winrt::VirtualKey::Up:
00152         if (MoveFocusPrevious())
00153         {
00154             return args.Handled(true);
00155         }
00156         else if (args.OriginalKey() == winrt::VirtualKey::GamepadDPadUp)
00157         {
00158             if (winrt::FocusManager::TryMoveFocus(winrt::FocusNavigationDirection::Previous, GetFindNextElementOptions(false /*useThisAsSearchRoot*/)))
00159             {
00160                 return args.Handled(true);
00161             }
00162         }
00163         args.Handled(HandleEdgeCaseFocus(true, args.OriginalSource()));
00164         break;
00165     case winrt::VirtualKey::Right:
00166         if (winrt::FocusManager::TryMoveFocus(winrt::FocusNavigationDirection::Right,
00167                 GetFindNextElementOptions(args.OriginalKey() != winrt::VirtualKey::GamepadDPadRight /*useThisAsSearchRoot*/)))
00168         {
00169             return args.Handled(true);
00170         }
00171         args.Handled(HandleEdgeCaseFocus(false, args.OriginalSource()));
00172         break;
00173
00174     case winrt::VirtualKey::Left:
00175         if (winrt::FocusManager::TryMoveFocus(winrt::FocusNavigationDirection::Left,
00176             GetFindNextElementOptions(args.OriginalKey() != winrt::VirtualKey::GamepadDPadLeft /*useThisAsSearchRoot*/)))
00177         {
00178             return args.Handled(true);
00179         }
00180         args.Handled(HandleEdgeCaseFocus(true, args.OriginalSource()));
00181         break;
00182     }
00183 }
00184
00185 void RadioButtons::OnAccessKeyInvoked(const winrt::UIElement&, const winrt::AccessKeyInvokedEventArgs& args)
00186 {
00187     // If RadioButtons is an AccessKeyScope then we do not want to handle the access
00188     // key invoked event because the user has (probably) set up access keys for the
00189     // RadioButton elements.
00190     if (!IsAccessKeyScope())
00191     {
00192         if (m_selectedIndex)
00193         {
00194             if (auto const repeater = m_repeater.get())
00195             {
00196                 if (auto const selectedItem = repeater.TryGetElement(m_selectedIndex))
00197                 {
00198                     if (auto const selectedItemAsControl = selectedItem.try_as<winrt::Control>())
00199                     {
00200                         return args.Handled(selectedItemAsControl.Focus(winrt::FocusState::Programmatic));
00201                     }
00202                 }
00203             }
00204         }
00205         // If we don't have a selected index, focus the RadioButton's which under normal
00206         // circumstances will put focus on the first radio button.
00207         args.Handled(this->Focus(winrt::FocusState::Programmatic));
00208     }
00209 }
00210
00211 // If we haven't handled the key yet and the original source was the first(for up and left)
00212 // or last(for down and right) element in the repeater we need to handle the key so
00213 // RadioButton doesn't, which would result in the behavior.
00214 bool RadioButtons::HandleEdgeCaseFocus(bool first, const winrt::IInspectable& source)
00215 {
00216     if (auto const repeater = m_repeater.get())
00217     {
00218         if (auto const sourceAsUIElement = source.try_as<winrt::UIElement>())
00219         {
00220             auto const index = [first, repeater]()
00221             {
00222                 if (first)
00223                 {
00224                     return 0;
00225                 }
00226                 if (auto const itemsSourceView = repeater.ItemsSourceView())
00227                 {
00228                     return itemsSourceView.Count() - 1;
00229                 }
00230                 return -1;
00231             }();
00232
00233             if (repeater.GetElementIndex(sourceAsUIElement) == index)
00234             {
00235                 return true;
00236             }
00237         }
00238     }
00239     return false;
00240 }
00241
00242 winrt::FindNextElementOptions RadioButtons::GetFindNextElementOptions(bool useThisAsSearchRoot)
00243 {
00244     auto const findNextElementOptions = winrt::FindNextElementOptions{};
00245     findNextElementOptions.SearchRoot(useThisAsSearchRoot ? *this : this->XamlRoot().Content());
00246     return findNextElementOptions;
00247 }
00248
00249 void RadioButtons::OnRepeaterElementPrepared(const winrt::ItemsRepeater&, const winrt::ItemsRepeaterElementPreparedEventArgs& args)
00250 {
00251     if (auto const element = args.Element())
00252     {
00253         if (auto const toggleButton = element.try_as<winrt::ToggleButton>())
00254         {
00255             auto childHandlers = winrt::make_self<ChildHandlers>();
00256             childHandlers->checkedRevoker = toggleButton.Checked(winrt::auto_revoke, { this, &RadioButtons::OnChildChecked });
00257             childHandlers->uncheckedRevoker = toggleButton.Unchecked(winrt::auto_revoke, { this, &RadioButtons::OnChildUnchecked });
00258
00259             toggleButton.SetValue(s_childHandlersProperty, childHandlers.as<winrt::IInspectable>());
00260
00261             // If the developer adds a checked toggle button to the collection, update selection to this item.
00262             if (SharedHelpers::IsTrue(toggleButton.IsChecked()))
00263             {
00264                 Select(args.Index());
00265             }
00266         }
00267         if (auto const repeater = m_repeater.get())
00268         {
00269             if (auto const itemSourceView = repeater.ItemsSourceView())
00270             {
00271                 element.SetValue(winrt::AutomationProperties::PositionInSetProperty(), box_value(args.Index() + 1));
00272                 element.SetValue(winrt::AutomationProperties::SizeOfSetProperty(), box_value(itemSourceView.Count()));
00273             }
00274         }
00275     }
00276 }
00277
00278 void RadioButtons::OnRepeaterElementClearing(const winrt::ItemsRepeater&, const winrt::ItemsRepeaterElementClearingEventArgs& args)
00279 {
00280     if (auto const element = args.Element())
00281     {
00282         element.SetValue(s_childHandlersProperty, nullptr);
00283
00284         // If the removed element was the selected one, update selection to -1
00285         if (auto const elementAsToggle = element.try_as<winrt::ToggleButton>())
00286         {
00287             if (SharedHelpers::IsTrue(elementAsToggle.IsChecked()))
00288             {
00289                 Select(-1);
00290             }
00291         }
00292     }
00293 }
00294
00295 void RadioButtons::OnRepeaterElementIndexChanged(const winrt::ItemsRepeater&, const winrt::ItemsRepeaterElementIndexChangedEventArgs& args)
00296 {
00297     if (auto const element = args.Element())
00298     {
00299         element.SetValue(winrt::AutomationProperties::PositionInSetProperty(), box_value(args.NewIndex() + 1));
00300
00301         // When the selected item's index changes, update selection to match
00302         if (auto const elementAsToggle = element.try_as<winrt::ToggleButton>())
00303         {
00304             if (SharedHelpers::IsTrue(elementAsToggle.IsChecked()))
00305             {
00306                 Select(args.NewIndex());
00307             }
00308         }
00309     }
00310 }
00311
00312 void RadioButtons::OnRepeaterCollectionChanged(const winrt::IInspectable&, const winrt::IInspectable&)
00313 {
00314     if (auto const repeater = m_repeater.get())
00315     {
00316         if (auto const itemSourceView = repeater.ItemsSourceView())
00317         {
00318             auto const count = itemSourceView.Count();
00319             for (auto index = 0; index < count; index++)
00320             {
00321                 if (auto const element = repeater.TryGetElement(index))
00322                 {
00323                     element.SetValue(winrt::AutomationProperties::SizeOfSetProperty(), box_value(count));
00324                 }
00325             }
00326         }
00327     }
00328 }
00329
00330 void RadioButtons::Select(int index)
00331 {
00332     if(!m_blockSelecting && !m_currentlySelecting && m_selectedIndex != index)
00333     {
00334         // Calling Select updates the checked state on the radio button being selected
00335         // and the radio button being unselected, as well as updates the SelectedIndex
00336         // and SelectedItem DP. All of these things would cause Select to be called so
00337         // we'll prevent reentrency with this m_currentlySelecting boolean.
00338         auto clearSelecting = gsl::finally([this]()
00339             {
00340                 m_currentlySelecting = false;
00341             });
00342         m_currentlySelecting = true;
00343
00344         auto const previousSelectedIndex = m_selectedIndex;
00345         m_selectedIndex = index;
00346
00347         auto const newSelectedItem = GetDataAtIndex(m_selectedIndex, true);
00348         auto const previousSelectedItem = GetDataAtIndex(previousSelectedIndex, false);
00349
00350         SelectedIndex(m_selectedIndex);
00351         SelectedItem(newSelectedItem);
00352         m_selectionChangedEventSource(*this, winrt::SelectionChangedEventArgs({ previousSelectedItem }, { newSelectedItem }));
00353     }
00354 }
00355
00356 winrt::IInspectable RadioButtons::GetDataAtIndex(int index, bool containerIsChecked)
00357 {
00358     if (auto const repeater = m_repeater.get())
00359     {
00360         if (auto const item = repeater.TryGetElement(index))
00361         {
00362             if (auto const itemAsToggleButton = item.try_as<winrt::ToggleButton>())
00363             {
00364                 itemAsToggleButton.IsChecked(containerIsChecked);
00365             }
00366         }
00367         if (index >= 0)
00368         {
00369             if (auto const itemsSourceView = repeater.ItemsSourceView())
00370             {
00371                 if (index < itemsSourceView.Count())
00372                 {
00373                     return itemsSourceView.GetAt(index);
00374                 }
00375             }
00376         }
00377     }
00378     return static_cast<winrt::IInspectable>(nullptr);
00379 }
00380
00381 void RadioButtons::OnChildChecked(const winrt::IInspectable& sender, const winrt::RoutedEventArgs&)
00382 {
00383     if (!m_currentlySelecting)
00384     {
00385         if (auto const repeater = m_repeater.get())
00386         {
00387             if (auto const senderAsUIE = sender.as<winrt::UIElement>())
00388             {
00389                 Select(repeater.GetElementIndex(senderAsUIE));
00390             }
00391         }
00392     }
00393 }
00394
00395 void RadioButtons::OnChildUnchecked(const winrt::IInspectable& sender, const winrt::RoutedEventArgs&)
00396 {
00397     if (!m_currentlySelecting)
00398     {
00399         if (auto const repeater = m_repeater.get())
00400         {
00401             if (auto const senderAsUIE = sender.as<winrt::UIElement>())
00402             {
00403                 if (m_selectedIndex == repeater.GetElementIndex(senderAsUIE))
00404                 {
00405                     Select(-1);
00406                 }
00407             }
00408         }
00409     }
00410 }
00411
00412 bool RadioButtons::MoveFocusNext()
00413 {
00414     return MoveFocus(1);
00415 }
00416
00417 bool RadioButtons::MoveFocusPrevious()
00418 {
00419     return MoveFocus(-1);
00420 }
00421
00422 bool RadioButtons::MoveFocus(int indexIncrement)
00423 {
00424     if (auto const repeater = m_repeater.get())
00425     {
00426         if (auto const focusedElement = winrt::FocusManager::GetFocusedElement(XamlRoot()).try_as<winrt::UIElement>())
00427         {
00428             auto focusedIndex = repeater.GetElementIndex(focusedElement);
00429
00430             if (focusedIndex >= 0)
00431             {
00432                 focusedIndex += indexIncrement;
00433                 auto const itemCount = repeater.ItemsSourceView().Count();
00434                 while (focusedIndex >= 0 && focusedIndex < itemCount)
00435                 {
00436                     if (auto const item = repeater.TryGetElement(focusedIndex))
00437                     {
00438                         if (item.Focus(winrt::FocusState::Programmatic))
00439                         {
00440                             return true;
00441                         }
00442                     }
00443                     focusedIndex += indexIncrement;
00444                 }
00445             }
00446         }
00447     }
00448     return false;
00449 }
00450
00451 void RadioButtons::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00452 {
00453     winrt::IDependencyProperty property = args.Property();
00454
00455     if (property == s_ItemsProperty || property == s_ItemsSourceProperty)
00456     {
00457         UpdateItemsSource();
00458     }
00459     else if (property == s_SelectedIndexProperty)
00460     {
00461         UpdateSelectedIndex();
00462     }
00463     else if (property == s_SelectedItemProperty)
00464     {
00465         UpdateSelectedItem();
00466     }
00467     else if (property == s_ItemTemplateProperty)
00468     {
00469         UpdateItemTemplate();
00470     }
00471 }
00472
00473 void RadioButtons::OnIsEnabledChanged(const winrt::IInspectable&, const winrt::DependencyPropertyChangedEventArgs&)
00474 {
00475     UpdateVisualStateForIsEnabledChange();
00476 }
00477
00478 winrt::UIElement RadioButtons::ContainerFromIndex(int index)
00479 {
00480     if (auto const repeater = m_repeater.get())
00481     {
00482         return repeater.TryGetElement(index);
00483     }
00484     return nullptr;
00485 }
00486
00487 void RadioButtons::UpdateItemsSource()
00488 {
00489     Select(-1);
00490     m_itemsSourceChanged.revoke();
00491     if (auto const repeater = m_repeater.get())
00492     {
00493         repeater.ItemsSource(GetItemsSource());
00494
00495         if (auto const itemsSourceView = repeater.ItemsSourceView())
00496         {
00497             m_itemsSourceChanged = itemsSourceView.CollectionChanged(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterCollectionChanged });
00498         }
00499     }
00500 }
00501
00502 winrt::IInspectable RadioButtons::GetItemsSource()
00503 {
00504     if (auto const itemsSource = ItemsSource())
00505     {
00506         return itemsSource;
00507     }
00508     else
00509     {
00510         return Items();
00511     }
00512 }
00513
00514 void RadioButtons::UpdateSelectedIndex()
00515 {
00516     if (!m_currentlySelecting)
00517     {
00518         Select(SelectedIndex());
00519     }
00520 }
00521
00522 void RadioButtons::UpdateSelectedItem()
00523 {
00524     if (!m_currentlySelecting)
00525     {
00526         if (auto const repeater = m_repeater.get())
00527         {
00528             if (auto const itemsSourceView = repeater.ItemsSourceView())
00529             {
00530                 Select(itemsSourceView.IndexOf(SelectedItem()));
00531             }
00532         }
00533     }
00534 }
00535
00536 void RadioButtons::UpdateItemTemplate()
00537 {
00538     m_radioButtonsElementFactory->UserElementFactory(ItemTemplate());
00539 }
00540
00541 void RadioButtons::UpdateVisualStateForIsEnabledChange()
00542 {
00543     winrt::VisualStateManager::GoToState(*this, IsEnabled() ? L"Normal" : L"Disabled", false);
00544 }
00545
00546 // Test Hooks helpers, only function when m_testHooksEnabled == true
00547 void RadioButtons::SetTestHooksEnabled(bool enabled)
00548 {
00549     if (m_testHooksEnabled != enabled)
00550     {
00551         m_testHooksEnabled = enabled;
00552         if (enabled)
00553         {
00554             AttachToLayoutChanged();
00555         }
00556         else
00557         {
00558             DetatchFromLayoutChanged();
00559         }
00560     }
00561 }
00562
00563 RadioButtons::~RadioButtons()
00564 {
00565     if (m_layoutChangedToken)
00566     {
00567         if (auto const layout = GetLayout())
00568         {
00569             layout->LayoutChanged(m_layoutChangedToken);
00570             m_layoutChangedToken = { 0 };
00571         }
00572     }
00573 }
00574
00575 void RadioButtons::OnLayoutChanged(const winrt::ColumnMajorUniformToLargestGridLayout&, const winrt::IInspectable&)
00576 {
00577     RadioButtonsTestHooks::NotifyLayoutChanged(*this);
00578 }
00579
00580 int RadioButtons::GetRows()
00581 {
00582     if (auto const layout = GetLayout())
00583     {
00584         return layout->GetRows();
00585     }
00586     return -1;
00587 }
00588
00589 int RadioButtons::GetColumns()
00590 {
00591     if (auto const layout = GetLayout())
00592     {
00593         return layout->GetColumns();
00594     }
00595     return -1;
00596 }
00597
00598 int RadioButtons::GetLargerColumns()
00599 {
00600     if (auto const layout = GetLayout())
00601     {
00602         return layout->GetLargerColumns();
00603     }
00604     return -1;
00605 }
00606
00607
00608 void RadioButtons::AttachToLayoutChanged()
00609 {
00610     if (auto const layout = GetLayout())
00611     {
00612         layout->SetTestHooksEnabled(true);
00613         m_layoutChangedToken = layout->LayoutChanged({ this, &RadioButtons::OnLayoutChanged });
00614     }
00615 }
00616
00617 void RadioButtons::DetatchFromLayoutChanged()
00618 {
00619     if (auto const layout = GetLayout())
00620     {
00621         layout->SetTestHooksEnabled(false);
00622         layout->LayoutChanged(m_layoutChangedToken);
00623         m_layoutChangedToken = { 0 };
00624     }
00625 }
00626
00627 com_ptr<ColumnMajorUniformToLargestGridLayout> RadioButtons::GetLayout()
00628 {
00629     if (auto const repeater = m_repeater.get())
00630     {
00631         if (auto const layout = repeater.Layout())
00632         {
00633             if (auto const customLayout = layout.try_as<winrt::ColumnMajorUniformToLargestGridLayout>())
00634             {
00635                 return winrt::get_self<ColumnMajorUniformToLargestGridLayout>(customLayout)->get_strong();
00636             }
00637         }
00638     }
00639     return nullptr;
00640 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MenuBar Member List

This is the complete list of members for MenuBar, including all inherited members.
abi_enter() | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
CheckThread() | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
ClearProperties() | MenuBarProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< MenuBar > &&self) noexcept | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline, static]
EnsureProperties() | MenuBarProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
final_release(std::unique_ptr< MenuBar > &&self) | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline, static]
GetBase() | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
GetInner() | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
IsFlyoutOpen() | MenuBar | [inline]
IsFlyoutOpen(bool state) | MenuBar |
IsOnThread() | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
Items(winrt::IVector< winrt::MenuBarItem > const &value) | MenuBarProperties |
Items() | MenuBarProperties |
ItemsProperty() | MenuBarProperties | [inline, static]
MenuBar() | MenuBar |
MenuBarProperties() | MenuBarProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
OnApplyTemplate() | MenuBar |
OnCreateAutomationPeer() | MenuBar |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< MenuBar, winrt::implementation::MenuBarT > | [inline]
RequestPassThroughElement(const winrt::Microsoft::UI::Xaml::Controls::MenuBarItem &menuBarItem) | MenuBar |
s_ItemsProperty | MenuBarProperties | [static]
SetUpTemplateParts() | MenuBar | [private]
UpdateAutomationSizeAndPosition() | MenuBar | [private]
Generated on Sun Dec 1 2024 20:52:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/MicaBackdrop.properties.h Source File

  • Generated

MicaBackdrop.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class MicaBackdropProperties
00008 {
00009 public:
00010     MicaBackdropProperties();
00011
00012     void Kind(winrt::MicaKind const& value);
00013     winrt::MicaKind Kind();
00014
00015     static winrt::DependencyProperty KindProperty() { return s_KindProperty; }
00016
00017     static GlobalDependencyProperty s_KindProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021
00022     static void OnKindPropertyChanged(
00023         winrt::DependencyObject const& sender,
00024         winrt::DependencyPropertyChangedEventArgs const& args);
00025 };
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: WebView2/WebView2.h Source File

  • WebView2

WebView2.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "CoreWebView2InitializedEventArgs.g.h"
00010
00011 #include "DispatcherHelper.h"
00012
00013 #include <Microsoft.UI.Content.h>
00014
00015 #include "WebView2.g.h"
00016 #include "WebView2.properties.h"
00017 #pragma warning( push )
00018 #pragma warning( disable : 28251)   // warning C28251: Inconsistent annotation for function: this instance has an error
00019 #include <webview2.h>
00020 #include <WebView2EnvironmentOptions.h>
00021 #pragma warning( pop )
00022
00023 MIDL_INTERFACE("2EE738F4-402C-4F6E-9F93-DEDD89F09B49")
00024 IHwndComponentHost : public IUnknown
00025 {
00026 public:
00027     virtual HWND STDMETHODCALLTYPE GetComponentHwnd() = 0;
00028 };
00029
00030 // for making async/await possible
00031 struct AsyncWebViewOperations final : public Awaitable
00032 {
00033     AsyncWebViewOperations() = default;
00034
00035     void StopWaiting()
00036     {
00037         // async operation completed, stop all awaits
00038         CompleteAwaits();
00039     }
00040 };
00041
00042 class CoreWebView2InitializedEventArgs :
00043     public winrt::implementation::CoreWebView2InitializedEventArgsT<CoreWebView2InitializedEventArgs>
00044 {
00045 public:
00046     CoreWebView2InitializedEventArgs(winrt::hresult Exception) : m_exception(Exception) {};
00047
00048     void Exception(winrt::hresult exception) { m_exception = exception; };
00049     winrt::hresult Exception() { return m_exception; }
00050 private:
00051     winrt::hresult m_exception{};
00052 };
00053
00054 // Derive from DeriveFromPanelHelper_base so that we get access to Children collection in Panel.
00055 // (In case we have to show the "Missing Anaheim Warning").
00056 class WebView2 :
00057     public ReferenceTracker<WebView2, DeriveFromPanelHelper_base, winrt::WebView2, winrt::IWebView22, IHwndComponentHost>,
00058     public WebView2Properties
00059 {
00060
00061 public:
00062
00063     WebView2();
00064     virtual ~WebView2();
00065
00066     // IUIElement
00067     winrt::AutomationPeer OnCreateAutomationPeer();
00068
00069     // FrameworkElement overrides
00070     winrt::Size MeasureOverride(winrt::Size const& availableSize);
00071     winrt::Size ArrangeOverride(winrt::Size const& finalSize);
00072
00073     winrt::IUnknown GetWebView2Provider();
00074     winrt::IUnknown GetProviderForHwnd(HWND hwnd);
00075
00076     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00077     void OnLoaded(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00078     void OnUnloaded(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00079
00080     void UpdateCoreWebViewScale();
00081
00082     winrt::IAsyncAction EnsureCoreWebView2Async();
00083     winrt::IAsyncAction EnsureCoreWebView2Async(winrt::CoreWebView2Environment environment);
00084     winrt::IAsyncAction EnsureCoreWebView2Async(winrt::CoreWebView2Environment environment, winrt::CoreWebView2ControllerOptions controllerOptions);
00085     winrt::IAsyncOperation<winrt::hstring> ExecuteScriptAsync(winrt::hstring javascriptCode);
00086     void Reload();
00087     void NavigateToString(winrt::hstring htmlContent);
00088     void GoBack();
00089     void GoForward();
00090     void Close();
00091
00092     winrt::CoreWebView2 CoreWebView2();     // Getter for CoreWebView2 property (read-only)
00093
00094     // Default value on public DP - ok to be public
00095     static const winrt::Color sc_controllerDefaultBackgroundColor;
00096
00097 private:
00098     bool ShouldNavigate(const winrt::Uri& uri);
00099     winrt::IAsyncAction OnSourceChanged(winrt::Uri providedUri);
00100     void OnXamlPointerMessage(UINT message, const winrt::PointerRoutedEventArgs& args) noexcept;
00101     void FillPointerPenInfo(const winrt::PointerPoint& inputPt, winrt::CoreWebView2PointerInfo outputPt);
00102     void FillPointerTouchInfo(const winrt::PointerPoint& inputPt, winrt::CoreWebView2PointerInfo outputPt);
00103     void FillPointerInfo(const winrt::PointerPoint& inputPt, winrt::CoreWebView2PointerInfo outputPt, const winrt::PointerRoutedEventArgs& args);
00104     uint32_t GetPointerFlags(const winrt::PointerPoint& inputPt);
00105     winrt::Rect ScaleRectToPhysicalPixels(winrt::Rect inputRect);
00106     winrt::Point ScalePointToPhysicalPixels(winrt::Point inputPoint);
00107
00108     void ResetMouseInputState();
00109     void OnManipulationModePropertyChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& /*args*/);
00110     void OnVisibilityPropertyChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& /*args*/);
00111
00112     void FireNavigationStarting(const winrt::CoreWebView2NavigationStartingEventArgs& args);
00113     void FireNavigationCompleted(const winrt::CoreWebView2NavigationCompletedEventArgs& args);
00114     void FireWebMessageReceived(const winrt::CoreWebView2WebMessageReceivedEventArgs& args);
00115     void UpdateSourceInternal();
00116     void FireCoreProcessFailedEvent(const winrt::CoreWebView2ProcessFailedEventArgs& args);
00117     void FireCoreWebView2Initialized(winrt::hresult exception);
00118     void MoveFocusIntoCoreWebView2(winrt::CoreWebView2MoveFocusReason reason);
00119     void UpdateDefaultVisualBackgroundColor();
00120
00121     HWND GetHostHwnd() noexcept;
00122     HWND EnsureTemporaryHostHwnd();
00123     void UpdateParentWindow(HWND newParentWindow);
00124
00125     winrt::IAsyncAction CreateCoreObjects(winrt::CoreWebView2Environment environment = nullptr, winrt::CoreWebView2ControllerOptions controllerOptions = nullptr);
00126     winrt::IAsyncOperation<winrt::CoreWebView2Environment> CreateDefaultCoreEnvironment() noexcept;
00127     winrt::IAsyncAction CreateCoreWebViewFromEnvironment(HWND hwndParent, winrt::CoreWebView2ControllerOptions controllerOptions = nullptr);
00128     void CreateMissingAnaheimWarning();
00129
00130     void RegisterXamlEventHandlers();
00131     void UnregisterXamlEventHandlers();
00132     void RegisterCoreEventHandlers();
00133     void UnregisterCoreEventHandlers();
00134
00135     void HandlePointerPressed(const winrt::Windows::Foundation::IInspectable&, const winrt::PointerRoutedEventArgs& args);
00136     void HandlePointerReleased(const winrt::Windows::Foundation::IInspectable&, const winrt::PointerRoutedEventArgs& args);
00137     void HandlePointerMoved(const winrt::Windows::Foundation::IInspectable&, const winrt::PointerRoutedEventArgs& args);
00138     void HandlePointerWheelChanged(const winrt::Windows::Foundation::IInspectable&, const winrt::PointerRoutedEventArgs& args);
00139     void HandlePointerExited(const winrt::Windows::Foundation::IInspectable&, const winrt::PointerRoutedEventArgs& args);
00140     void HandlePointerEntered(const winrt::Windows::Foundation::IInspectable&, const winrt::PointerRoutedEventArgs& args);
00141     void HandlePointerCanceled(const winrt::Windows::Foundation::IInspectable&, const winrt::PointerRoutedEventArgs& args);
00142     void HandlePointerCaptureLost(const winrt::Windows::Foundation::IInspectable&, const winrt::PointerRoutedEventArgs& args);
00143     void HandleGettingFocus(const winrt::Windows::Foundation::IInspectable&, const winrt::GettingFocusEventArgs& args) noexcept;
00144     void HandleGotFocus(const winrt::Windows::Foundation::IInspectable&, const winrt::RoutedEventArgs&) noexcept;
00145     void HandleLosingFocus(const winrt::Windows::Foundation::IInspectable&, const winrt::RoutedEventArgs&) noexcept;
00146     void HandleXamlRootChanged();
00147     void HandleSizeChanged(const winrt::IInspectable& /*sender*/, const winrt::SizeChangedEventArgs& args);
00148     void HandleRendered(const winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*args*/);
00149
00150     void XamlRootChangedHelper(bool forceUpdate);
00151     void TryCompleteInitialization();
00152     void DisconnectFromRootVisualTarget();
00153     void CreateAndSetVisual();
00154
00155     void CheckAndUpdateWebViewPosition();
00156     void CheckAndUpdateWindowPosition();
00157     void CheckAndUpdateVisibility(bool force = false);
00158     void UpdateCoreWebViewVisibility();
00159     bool AreAllAncestorsVisible();
00160     void SetCoreWebViewAndVisualSize(const float width, const float height);
00161     void UpdateRenderedSubscriptionAndVisibility();
00162
00163     void SetControllerDefaultBackgroundColor();
00164     void SetCanGoForward(bool canGoForward);
00165     void SetCanGoBack(bool canGoBack);
00166     void ResetProperties();
00167     void CloseInternal(bool inShutdownPath);
00168
00169     winrt::AccessibilitySettings GetAccessibilitySettings();
00170     winrt::Color GetThemeBackgroundColor();
00171
00172     // IHwndComponentHost
00173     HWND STDMETHODCALLTYPE GetComponentHwnd();
00174
00175     winrt::UISettings GetUISettings();
00176
00177     winrt::DataPackageOperation DataPackageOperationFromDropEffect(DWORD dropEffect);
00178     void ConvertXamlArgsToOle32Args(const winrt::DragEventArgs& args, DWORD& keyState, POINT& cursorPosition, DWORD& dropEffect, IDataObject** dataObject);
00179     void OnDragEnter(const winrt::IInspectable& sender, const winrt::DragEventArgs& args);
00180     void OnDragOver(const winrt::IInspectable& sender, const winrt::DragEventArgs& args);
00181     void OnDragLeave(const winrt::IInspectable& sender, const winrt::DragEventArgs& args);
00182     void OnDrop(const winrt::IInspectable& sender, const winrt::DragEventArgs& args);
00183
00184     // Helpers to gracefully handle ERROR_INVALID_STATE from CWV2 objects that have been internally closed
00185     // (In particular, this occurs when host window is closed via 'x' button and CWV2 processes closure before WebView2)
00186     bool CoreWebView2HasInvalidState();
00187     template <typename Delegate> void CoreWebView2RunIgnoreInvalidStateSync(Delegate delegate);
00188
00189 private:
00190     struct XamlFocusChangeInfo
00191     {
00192         winrt::CoreWebView2MoveFocusReason m_storedMoveFocusReason{};
00193
00194         // Reason gets set in GettingFocus handler, but the focus change can still be cancelled or redirected
00195         bool m_isPending{};
00196     };
00197
00198     bool m_isExplicitEnvironment = false;
00199     bool m_isExplicitControllerOptions = false;
00200     winrt::CoreWebView2Environment m_coreWebViewEnvironment{ nullptr };
00201     winrt::CoreWebView2Controller m_coreWebViewController{ nullptr };
00202     winrt::CoreWebView2ControllerOptions m_customCoreWebViewControllerOptions{ nullptr };
00203     winrt::CoreWebView2CompositionController m_coreWebViewCompositionController{ nullptr };
00204     winrt::CoreWebView2 m_coreWebView{ nullptr };
00205
00206     bool m_isLeftMouseButtonPressed{};
00207     bool m_isMiddleMouseButtonPressed{};
00208     bool m_isRightMouseButtonPressed{};
00209     bool m_isXButton1Pressed{};
00210     bool m_isXButton2Pressed{};
00211     bool m_isMouseLeaveNeeded{};
00212     bool m_hasMouseCapture{};
00213     std::map<int32_t, bool> m_hasTouchCapture{};
00214     bool m_hasPenCapture{};
00215     HWND m_xamlHostHwnd{ nullptr };
00216     HWND m_tempHostHwnd{ nullptr };
00217     HWND m_inputWindowHwnd{ nullptr };
00218     winrt::hstring m_stopNavigateOnUriChanged{};
00219     bool m_canGoPropSetInternally{};
00220     winrt::IContentExternalOutputLink m_systemVisualBridge;
00221
00222     winrt::UIElement::GettingFocus_revoker m_gettingFocusRevoker;
00223     winrt::UIElement::GotFocus_revoker m_gotFocusRevoker;
00224     winrt::UIElement::LosingFocus_revoker m_losingFocusRevoker;
00225     winrt::UIElement::PointerPressed_revoker m_pointerPressedRevoker;
00226     winrt::UIElement::PointerReleased_revoker m_pointerReleasedRevoker;
00227     winrt::UIElement::PointerMoved_revoker m_pointerMovedRevoker;
00228     winrt::UIElement::PointerWheelChanged_revoker m_pointerWheelChangedRevoker;
00229     winrt::UIElement::PointerExited_revoker m_pointerExitedRevoker;
00230     winrt::UIElement::PointerEntered_revoker m_pointerEnteredRevoker;
00231     winrt::UIElement::PointerCanceled_revoker m_pointerCanceledRevoker;
00232     winrt::UIElement::PointerCaptureLost_revoker m_pointerCaptureLostRevoker;
00233     winrt::UIElement::KeyDown_revoker m_keyDownRevoker;
00234     winrt::CoreDispatcher::AcceleratorKeyActivated_revoker m_acceleratorKeyActivatedRevoker;
00235     winrt::FrameworkElement::Loaded_revoker m_loadedRevoker{};
00236     winrt::FrameworkElement::Unloaded_revoker m_unloadedRevoker{};
00237     winrt::FrameworkElement::SizeChanged_revoker m_sizeChangedRevoker;
00238     winrt::Microsoft::UI::Xaml::Media::CompositionTarget::Rendered_revoker m_renderedRevoker{};
00239     winrt::XamlRoot::Changed_revoker m_xamlRootChangedRevoker{};
00240     winrt::event_token m_manipulationModeChangedToken{};
00241     winrt::event_token m_visibilityChangedToken{};
00242
00243     winrt::CoreWebView2::NavigationStarting_revoker m_coreNavigationStartingRevoker;
00244     winrt::CoreWebView2::SourceChanged_revoker m_coreSourceChangedRevoker;
00245     winrt::CoreWebView2::NavigationCompleted_revoker m_coreNavigationCompletedRevoker;
00246     winrt::CoreWebView2::WebMessageReceived_revoker m_coreWebMessageReceivedRevoker;
00247     winrt::CoreWebView2::ProcessFailed_revoker m_coreProcessFailedRevoker;
00248     winrt::CoreWebView2Controller::MoveFocusRequested_revoker m_coreMoveFocusRequestedRevoker;
00249     winrt::CoreWebView2CompositionController::CursorChanged_revoker m_cursorChangedRevoker;
00250
00251     winrt::FrameworkElement::ActualThemeChanged_revoker m_actualThemeChangedRevoker{};
00252     winrt::AccessibilitySettings m_accessibilitySettings;
00253     winrt::AccessibilitySettings::HighContrastChanged_revoker m_highContrastChangedRevoker{};
00254     winrt::UISettings::TextScaleFactorChanged_revoker m_textScaleChangedRevoker{};
00255
00256     winrt::UIElement::DragEnter_revoker m_dragEnterRevoker{};
00257     winrt::UIElement::DragOver_revoker m_dragOverRevoker{};
00258     winrt::UIElement::DragLeave_revoker m_dragLeaveRevoker{};
00259     winrt::UIElement::Drop_revoker m_dropRevoker{};
00260
00261     void OnAppWindowPositionChanged(const winrt::Microsoft::UI::Windowing::AppWindow& sender, const winrt::Microsoft::UI::Windowing::AppWindowChangedEventArgs& args);
00262     winrt::event_token m_appWindowPositionChangedToken{};
00263     winrt::Microsoft::UI::Windowing::AppWindow m_appWindow{ nullptr };
00264
00265     void ResetPointerHelper(const winrt::PointerRoutedEventArgs& args);
00266     void SendMouseLeave();
00267     XamlFocusChangeInfo m_xamlFocusChangeInfo{};
00268
00269     bool m_isVisible{};
00270     bool m_isHostVisible{};
00271     bool m_shouldShowMissingAnaheimWarning{};
00272
00273     bool m_isCoreFailure_BrowserExited_State{};    // True after Edge ProcessFailed event w/ CORE_WEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED
00274     bool m_isClosed{};    // True after WebView2::Close() has been called - no core objects can be created
00275
00276     bool m_isImplicitCreationInProgress{};    // True while we are creating CWV2 due to Source property being set
00277     bool m_isExplicitCreationInProgress{};    // True while we are creating CWV2 due to EnsureCoreWebView2*Async() being called
00278     std::unique_ptr<AsyncWebViewOperations> m_creationInProgressAsync{ nullptr }; // Awaitable object for any currently active creation. There should be only one active operation at a time.
00279
00280     float m_rasterizationScale{};
00281     // The last known WebView rect position, scaled for DPI
00282     winrt::Point m_webViewScaledPosition{};
00283     // Last known WebView rect size, scaled for DPI
00284     winrt::Point m_webViewScaledSize{};
00285     // Last known position of the host window
00286     POINT m_hostWindowPosition{};
00287
00288     DispatcherHelper m_dispatcherHelper{ *this };
00289
00290     winrt::UISettings m_uiSettings;
00291 };
Generated on Sun Dec 1 2024 20:52:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/XamlAmbientLight.properties.cpp Source File

  • Generated

XamlAmbientLight.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "XamlAmbientLight.h"
00008
00009 namespace winrt::Microsoft::UI::Private::Media
00010 {
00011     CppWinRTActivatableClassWithDPFactory(XamlAmbientLight)
00012 }
00013
00014 #include "XamlAmbientLight.g.cpp"
00015
00016 GlobalDependencyProperty XamlAmbientLightProperties::s_ColorProperty{ nullptr };
00017 GlobalDependencyProperty XamlAmbientLightProperties::s_IsTargetProperty{ nullptr };
00018
00019 XamlAmbientLightProperties::XamlAmbientLightProperties()
00020 {
00021     EnsureProperties();
00022 }
00023
00024 void XamlAmbientLightProperties::EnsureProperties()
00025 {
00026     if (!s_ColorProperty)
00027     {
00028         s_ColorProperty =
00029             InitializeDependencyProperty(
00030                 L"Color",
00031                 winrt::name_of<winrt::Color>(),
00032                 winrt::name_of<winrt::XamlAmbientLight>(),
00033                 false /* isAttached */,
00034                 ValueHelper<winrt::Color>::BoxValueIfNecessary({ 255, 255, 255, 255 }),
00035                 winrt::PropertyChangedCallback(&OnColorPropertyChanged));
00036     }
00037     if (!s_IsTargetProperty)
00038     {
00039         s_IsTargetProperty =
00040             InitializeDependencyProperty(
00041                 L"IsTarget",
00042                 winrt::name_of<bool>(),
00043                 winrt::name_of<winrt::XamlAmbientLight>(),
00044                 true /* isAttached */,
00045                 ValueHelper<bool>::BoxedDefaultValue(),
00046                 &XamlAmbientLight::OnIsTargetPropertyChanged);
00047     }
00048 }
00049
00050 void XamlAmbientLightProperties::ClearProperties()
00051 {
00052     s_ColorProperty = nullptr;
00053     s_IsTargetProperty = nullptr;
00054 }
00055
00056 void XamlAmbientLightProperties::OnColorPropertyChanged(
00057     winrt::DependencyObject const& sender,
00058     winrt::DependencyPropertyChangedEventArgs const& args)
00059 {
00060     auto owner = sender.as<winrt::XamlAmbientLight>();
00061     winrt::get_self<XamlAmbientLight>(owner)->OnColorPropertyChanged(args);
00062 }
00063
00064 void XamlAmbientLightProperties::Color(winrt::Color const& value)
00065 {
00066     [[gsl::suppress(con)]]
00067     {
00068     static_cast<XamlAmbientLight*>(this)->SetValue(s_ColorProperty, ValueHelper<winrt::Color>::BoxValueIfNecessary(value));
00069     }
00070 }
00071
00072 winrt::Color XamlAmbientLightProperties::Color()
00073 {
00074     return ValueHelper<winrt::Color>::CastOrUnbox(static_cast<XamlAmbientLight*>(this)->GetValue(s_ColorProperty));
00075 }
00076
00077
00078 void XamlAmbientLightProperties::SetIsTarget(winrt::DependencyObject const& target, bool value)
00079 {
00080     target.SetValue(s_IsTargetProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00081 }
00082
00083 bool XamlAmbientLightProperties::GetIsTarget(winrt::DependencyObject const& target)
00084 {
00085     return ValueHelper<bool>::CastOrUnbox(target.GetValue(s_IsTargetProperty));
00086 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollViewKeyboardAndGamepadNavigationPage Member List

This is the complete list of members for ScrollViewKeyboardAndGamepadNavigationPage, including all inherited members.
AppendAsyncEventMessage(string asyncEventMessage) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
AppendAsyncEventMessage() | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
asyncEventReportingLock | ScrollViewKeyboardAndGamepadNavigationPage | [private]
BtnClearLogs_Click(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ChkLogScrollPresenterEvents_Checked(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ChkLogScrollPresenterEvents_Unchecked(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ChkLogScrollViewEvents_Checked(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ChkLogScrollViewEvents_Unchecked(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ChkLogScrollViewMessages_Checked(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ChkLogScrollViewMessages_Unchecked(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
lstAsyncEventMessage | ScrollViewKeyboardAndGamepadNavigationPage | [private]
MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, protected]
ScrollPresenter_ExtentChanged(ScrollPresenter sender, object args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollPresenter_ScrollAnimationStarting(ScrollPresenter sender, ScrollingScrollAnimationStartingEventArgs args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollPresenter_StateChanged(ScrollPresenter sender, object args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollPresenter_ViewChanged(ScrollPresenter sender, object args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollPresenter_ZoomAnimationStarting(ScrollPresenter sender, ScrollingZoomAnimationStartingEventArgs args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_ExtentChanged(ScrollView sender, object args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_GettingFocus(UIElement sender, Microsoft.UI.Xaml.Input.GettingFocusEventArgs args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_GotFocus(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_LosingFocus(UIElement sender, Microsoft.UI.Xaml.Input.LosingFocusEventArgs args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_LostFocus(object sender, RoutedEventArgs e) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_ScrollAnimationStarting(ScrollView sender, ScrollingScrollAnimationStartingEventArgs args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_StateChanged(ScrollView sender, object args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_ViewChanged(ScrollView sender, object args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollView_ZoomAnimationStarting(ScrollView sender, ScrollingZoomAnimationStartingEventArgs args) | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
ScrollViewKeyboardAndGamepadNavigationPage() | ScrollViewKeyboardAndGamepadNavigationPage | [inline]
~ScrollViewKeyboardAndGamepadNavigationPage() | ScrollViewKeyboardAndGamepadNavigationPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:35 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/VirtualizingLayout.cpp Source File

  • Repeater

VirtualizingLayout.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "VirtualizingLayout.h"
00008 #include "RuntimeProfiler.h"
00009
00010 #include "VirtualizingLayout.properties.cpp"
00011
00012 #pragma region IVirtualizingLayoutOverrides
00013
00014 VirtualizingLayout::VirtualizingLayout()
00015 {
00016     __RP_Marker_ClassById(RuntimeProfiler::ProfId_VirtualizingLayout);
00017 }
00018
00019 void VirtualizingLayout::InitializeForContextCore(winrt::VirtualizingLayoutContext const& context)
00020 {
00021
00022 }
00023
00024 void VirtualizingLayout::UninitializeForContextCore(winrt::VirtualizingLayoutContext const& context)
00025 {
00026
00027 }
00028
00029 winrt::Size VirtualizingLayout::MeasureOverride(winrt::VirtualizingLayoutContext const& context, winrt::Size const& availableSize)
00030 {
00031     throw winrt::hresult_not_implemented();
00032 }
00033
00034 winrt::Size VirtualizingLayout::ArrangeOverride(winrt::VirtualizingLayoutContext const& context, winrt::Size const& finalSize)
00035 {
00036     // Do not throw. If the layout decides to arrange its
00037     // children during measure, then an ArrangeOverride is not required.
00038     return finalSize;
00039 }
00040
00041 void VirtualizingLayout::OnItemsChangedCore(winrt::VirtualizingLayoutContext const& context, winrt::IInspectable const& source, winrt::NotifyCollectionChangedEventArgs const& args)
00042 {
00043     InvalidateMeasure();
00044 }
00045
00046 #pragma endregion
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NonVirtualizingLayout Member List

This is the complete list of members for NonVirtualizingLayout, including all inherited members.
ArrangeOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &finalSize) | NonVirtualizingLayout | [virtual]
InitializeForContextCore(winrt::LayoutContext const &context) | NonVirtualizingLayout | [virtual]
MeasureOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &availableSize) | NonVirtualizingLayout | [virtual]
NonVirtualizingLayout() | NonVirtualizingLayout |
UninitializeForContextCore(winrt::LayoutContext const &context) | NonVirtualizingLayout | [virtual]
Generated on Sun Dec 1 2024 20:52:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedVisuals/AnimatedChevronUpDownSmallVisualSource.h Source File

  • AnimatedIcon
  • AnimatedVisuals

AnimatedChevronUpDownSmallVisualSource.h

Go to the documentation of this file.
00001 ﻿#pragma once
00002 //------------------------------------------------------------------------------
00003 // <auto-generated>
00004 //     This code was generated by a tool.
00005 //
00006 //       LottieGen version:
00007 //           7.1.0+ge1fa92580f
00008 //
00009 //       Command:
00010 //           LottieGen -Language Cppwinrt -WinUIVersion 2.4 -InputFile AnimatedChevronUpDownSmallVisualSource.json
00011 //
00012 //       Input file:
00013 //           AnimatedChevronUpDownSmallVisualSource.json (24992 bytes created 23:37-07:00 Oct 5 2021)
00014 //
00015 //       LottieGen source:
00016 //           http://aka.ms/Lottie
00017 //
00018 //     Changes to this file may cause incorrect behavior and will be lost if
00019 //     the code is regenerated.
00020 // </auto-generated>
00021 //------------------------------------------------------------------------------
00022 #include "common.h"
00023 #include "AnimatedVisuals\AnimatedChevronUpDownSmallVisualSource.g.h"
00024
00025 // Name:        Controls_07_DownChevron_Expand+NavView
00026 // Frame rate:  60 fps
00027 // Frame count: 260
00028 // Duration:    4333.3 mS
00029 // _______________________________________________________________________________________________________________
00030 // |               Marker                |               Constant                | Frame |   mS   |   Progress   |
00031 // |_____________________________________|_______________________________________|_______|________|______________|
00032 // | NormalOnToNormalOff_Start           | M_NormalOnToNormalOff_Start           |     0 |    0.0 | 0.0F         |
00033 // | NormalOnToNormalOff_End             | M_NormalOnToNormalOff_End             |    29 |  483.3 | 0.111730769F |
00034 // | NormalOnToPointerOverOn_Start       | M_NormalOnToPointerOverOn_Start       |    30 |  500.0 | 0.115576923F |
00035 // | NormalOnToPointerOverOn_End         | M_NormalOnToPointerOverOn_End         |    39 |  650.0 | 0.150192305F |
00036 // | NormalOnToPressedOn_Start           | M_NormalOnToPressedOn_Start           |    40 |  666.7 | 0.154038459F |
00037 // | NormalOnToPressedOn_End             | M_NormalOnToPressedOn_End             |    49 |  816.7 | 0.188653842F |
00038 // | NormalOffToNormalOn_Start           | M_NormalOffToNormalOn_Start           |    50 |  833.3 | 0.192499995F |
00039 // | NormalOffToNormalOn_End             | M_NormalOffToNormalOn_End             |    79 | 1316.7 | 0.304038465F |
00040 // | NormalOffToPointerOverOff_Start     | M_NormalOffToPointerOverOff_Start     |    80 | 1333.3 | 0.307884604F |
00041 // | NormalOffToPointerOverOff_End       | M_NormalOffToPointerOverOff_End       |    89 | 1483.3 | 0.342500001F |
00042 // | NormalOffToPressedOff_Start         | M_NormalOffToPressedOff_Start         |    90 | 1500.0 | 0.34634614F  |
00043 // | NormalOffToPressedOff_End           | M_NormalOffToPressedOff_End           |    99 | 1650.0 | 0.380961537F |
00044 // | PointerOverOnToPointerOverOff_Start | M_PointerOverOnToPointerOverOff_Start |   100 | 1666.7 | 0.384807706F |
00045 // | PointerOverOnToPointerOverOff_End   | M_PointerOverOnToPointerOverOff_End   |   109 | 1816.7 | 0.419423074F |
00046 // | PointerOverOnToNormalOn_Start       | M_PointerOverOnToNormalOn_Start       |   110 | 1833.3 | 0.423269242F |
00047 // | PointerOverOnToNormalOn_End         | M_PointerOverOnToNormalOn_End         |   119 | 1983.3 | 0.45788461F  |
00048 // | PointerOverOnToPressedOn_Start      | M_PointerOverOnToPressedOn_Start      |   120 | 2000.0 | 0.461730778F |
00049 // | PointerOverOnToPressedOn_End        | M_PointerOverOnToPressedOn_End        |   129 | 2150.0 | 0.496346146F |
00050 // | PointerOverOffToPointerOverOn_Start | M_PointerOverOffToPointerOverOn_Start |   130 | 2166.7 | 0.500192285F |
00051 // | PointerOverOffToPointerOverOn_End   | M_PointerOverOffToPointerOverOn_End   |   139 | 2316.7 | 0.534807682F |
00052 // | PointerOverOffToNormalOff_Start     | M_PointerOverOffToNormalOff_Start     |   140 | 2333.3 | 0.538653851F |
00053 // | PointerOverOffToNormalOff_End       | M_PointerOverOffToNormalOff_End       |   149 | 2483.3 | 0.573269248F |
00054 // | PointerOverOffToPressedOff_Start    | M_PointerOverOffToPressedOff_Start    |   150 | 2500.0 | 0.577115357F |
00055 // | PointerOverOffToPressedOff_End      | M_PointerOverOffToPressedOff_End      |   159 | 2650.0 | 0.611730754F |
00056 // | PressedOnToPressedOff_Start         | M_PressedOnToPressedOff_Start         |   160 | 2666.7 | 0.615576923F |
00057 // | PressedOnToPressedOff_End           | M_PressedOnToPressedOff_End           |   169 | 2816.7 | 0.65019232F  |
00058 // | PressedOnToPointerOverOff_Start     | M_PressedOnToPointerOverOff_Start     |   170 | 2833.3 | 0.654038489F |
00059 // | PressedOnToPointerOverOff_End       | M_PressedOnToPointerOverOff_End       |   189 | 3150.0 | 0.727115393F |
00060 // | PressedOnToNormalOff_Start          | M_PressedOnToNormalOff_Start          |   190 | 3166.7 | 0.730961561F |
00061 // | PressedOnToNormalOff_End            | M_PressedOnToNormalOff_End            |   209 | 3483.3 | 0.804038465F |
00062 // | PressedOffToPressedOn_Start         | M_PressedOffToPressedOn_Start         |   210 | 3500.0 | 0.807884634F |
00063 // | PressedOffToPressedOn_End           | M_PressedOffToPressedOn_End           |   219 | 3650.0 | 0.842499971F |
00064 // | PressedOffToPointerOverOn_Start     | M_PressedOffToPointerOverOn_Start     |   220 | 3666.7 | 0.84634614F  |
00065 // | PressedOffToPointerOverOn_End       | M_PressedOffToPointerOverOn_End       |   239 | 3983.3 | 0.919423103F |
00066 // | PressedOffToNormalOn_Start          | M_PressedOffToNormalOn_Start          |   240 | 4000.0 | 0.923269212F |
00067 // | PressedOffToNormalOn_End            | M_PressedOffToNormalOn_End            |   259 | 4316.7 | 0.996346176F |
00068 // ---------------------------------------------------------------------------------------------------------------
00069 // _________________________________________________________
00070 // | Theme property |  Accessor  | Type  |  Default value  |
00071 // |________________|____________|_______|_________________|
00072 // | Foreground     | Foreground | Color | #FF000000 Black |
00073 // ---------------------------------------------------------
00074 class AnimatedChevronUpDownSmallVisualSource
00075     : public winrt::implementation::AnimatedChevronUpDownSmallVisualSourceT<AnimatedChevronUpDownSmallVisualSource>
00076 {
00077     winrt::Microsoft::UI::Composition::CompositionPropertySet _themeProperties{ nullptr };
00078     winrt::Windows::UI::Color _themeForeground{ 0xFF, 0x00, 0x00, 0x00 };
00079     winrt::Microsoft::UI::Composition::CompositionPropertySet EnsureThemeProperties(winrt::Microsoft::UI::Composition::Compositor compositor);
00080
00081     static winrt::Windows::Foundation::Numerics::float4 ColorAsVector4(winrt::Windows::UI::Color color);
00082 public:
00083     // Animation duration: 4.333 seconds.
00084     static constexpr int64_t c_durationTicks{ 43333333L };
00085
00086     // Marker: NormalOnToNormalOff_Start.
00087     static constexpr float M_NormalOnToNormalOff_Start{ 0.0F };
00088
00089     // Marker: NormalOnToNormalOff_End.
00090     static constexpr float M_NormalOnToNormalOff_End{ 0.111730769F };
00091
00092     // Marker: NormalOnToPointerOverOn_Start.
00093     static constexpr float M_NormalOnToPointerOverOn_Start{ 0.115576923F };
00094
00095     // Marker: NormalOnToPointerOverOn_End.
00096     static constexpr float M_NormalOnToPointerOverOn_End{ 0.150192305F };
00097
00098     // Marker: NormalOnToPressedOn_Start.
00099     static constexpr float M_NormalOnToPressedOn_Start{ 0.154038459F };
00100
00101     // Marker: NormalOnToPressedOn_End.
00102     static constexpr float M_NormalOnToPressedOn_End{ 0.188653842F };
00103
00104     // Marker: NormalOffToNormalOn_Start.
00105     static constexpr float M_NormalOffToNormalOn_Start{ 0.192499995F };
00106
00107     // Marker: NormalOffToNormalOn_End.
00108     static constexpr float M_NormalOffToNormalOn_End{ 0.304038465F };
00109
00110     // Marker: NormalOffToPointerOverOff_Start.
00111     static constexpr float M_NormalOffToPointerOverOff_Start{ 0.307884604F };
00112
00113     // Marker: NormalOffToPointerOverOff_End.
00114     static constexpr float M_NormalOffToPointerOverOff_End{ 0.342500001F };
00115
00116     // Marker: NormalOffToPressedOff_Start.
00117     static constexpr float M_NormalOffToPressedOff_Start{ 0.34634614F };
00118
00119     // Marker: NormalOffToPressedOff_End.
00120     static constexpr float M_NormalOffToPressedOff_End{ 0.380961537F };
00121
00122     // Marker: PointerOverOnToPointerOverOff_Start.
00123     static constexpr float M_PointerOverOnToPointerOverOff_Start{ 0.384807706F };
00124
00125     // Marker: PointerOverOnToPointerOverOff_End.
00126     static constexpr float M_PointerOverOnToPointerOverOff_End{ 0.419423074F };
00127
00128     // Marker: PointerOverOnToNormalOn_Start.
00129     static constexpr float M_PointerOverOnToNormalOn_Start{ 0.423269242F };
00130
00131     // Marker: PointerOverOnToNormalOn_End.
00132     static constexpr float M_PointerOverOnToNormalOn_End{ 0.45788461F };
00133
00134     // Marker: PointerOverOnToPressedOn_Start.
00135     static constexpr float M_PointerOverOnToPressedOn_Start{ 0.461730778F };
00136
00137     // Marker: PointerOverOnToPressedOn_End.
00138     static constexpr float M_PointerOverOnToPressedOn_End{ 0.496346146F };
00139
00140     // Marker: PointerOverOffToPointerOverOn_Start.
00141     static constexpr float M_PointerOverOffToPointerOverOn_Start{ 0.500192285F };
00142
00143     // Marker: PointerOverOffToPointerOverOn_End.
00144     static constexpr float M_PointerOverOffToPointerOverOn_End{ 0.534807682F };
00145
00146     // Marker: PointerOverOffToNormalOff_Start.
00147     static constexpr float M_PointerOverOffToNormalOff_Start{ 0.538653851F };
00148
00149     // Marker: PointerOverOffToNormalOff_End.
00150     static constexpr float M_PointerOverOffToNormalOff_End{ 0.573269248F };
00151
00152     // Marker: PointerOverOffToPressedOff_Start.
00153     static constexpr float M_PointerOverOffToPressedOff_Start{ 0.577115357F };
00154
00155     // Marker: PointerOverOffToPressedOff_End.
00156     static constexpr float M_PointerOverOffToPressedOff_End{ 0.611730754F };
00157
00158     // Marker: PressedOnToPressedOff_Start.
00159     static constexpr float M_PressedOnToPressedOff_Start{ 0.615576923F };
00160
00161     // Marker: PressedOnToPressedOff_End.
00162     static constexpr float M_PressedOnToPressedOff_End{ 0.65019232F };
00163
00164     // Marker: PressedOnToPointerOverOff_Start.
00165     static constexpr float M_PressedOnToPointerOverOff_Start{ 0.654038489F };
00166
00167     // Marker: PressedOnToPointerOverOff_End.
00168     static constexpr float M_PressedOnToPointerOverOff_End{ 0.727115393F };
00169
00170     // Marker: PressedOnToNormalOff_Start.
00171     static constexpr float M_PressedOnToNormalOff_Start{ 0.730961561F };
00172
00173     // Marker: PressedOnToNormalOff_End.
00174     static constexpr float M_PressedOnToNormalOff_End{ 0.804038465F };
00175
00176     // Marker: PressedOffToPressedOn_Start.
00177     static constexpr float M_PressedOffToPressedOn_Start{ 0.807884634F };
00178
00179     // Marker: PressedOffToPressedOn_End.
00180     static constexpr float M_PressedOffToPressedOn_End{ 0.842499971F };
00181
00182     // Marker: PressedOffToPointerOverOn_Start.
00183     static constexpr float M_PressedOffToPointerOverOn_Start{ 0.84634614F };
00184
00185     // Marker: PressedOffToPointerOverOn_End.
00186     static constexpr float M_PressedOffToPointerOverOn_End{ 0.919423103F };
00187
00188     // Marker: PressedOffToNormalOn_Start.
00189     static constexpr float M_PressedOffToNormalOn_Start{ 0.923269212F };
00190
00191     // Marker: PressedOffToNormalOn_End.
00192     static constexpr float M_PressedOffToNormalOn_End{ 0.996346176F };
00193
00194     // Theme property: Foreground.
00195     static inline const winrt::Windows::UI::Color c_themeForeground{ 0xFF, 0x00, 0x00, 0x00 };
00196
00197
00198     winrt::Windows::UI::Color Foreground();
00199     void Foreground(winrt::Windows::UI::Color value);
00200
00201     winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual(
00202         winrt::Microsoft::UI::Composition::Compositor const& compositor);
00203
00204     winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual(
00205         winrt::Microsoft::UI::Composition::Compositor const& compositor,
00206         winrt::Windows::Foundation::IInspectable& diagnostics);
00207
00208     // Gets the number of frames in the animation.
00209     double FrameCount();
00210
00211     // Gets the framerate of the animation.
00212     double Framerate();
00213
00214     // Gets the duration of the animation.
00215     winrt::Windows::Foundation::TimeSpan Duration();
00216
00217     // Converts a zero-based frame number to the corresponding progress value denoting the
00218     // start of the frame.
00219     double FrameToProgress(double frameNumber);
00220
00221     // Returns a map from marker names to corresponding progress values.
00222     winrt::Windows::Foundation::Collections::IMapView<hstring, double> Markers();
00223
00224     // Sets the color property with the given name, or does nothing if no such property
00225     // exists.
00226     void SetColorProperty(hstring const& propertyName, winrt::Windows::UI::Color value);
00227
00228     // Sets the scalar property with the given name, or does nothing if no such property
00229     // exists.
00230     void SetScalarProperty(hstring const& propertyName, double value);
00231 };
Generated on Sun Dec 1 2024 20:51:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ParallaxView/TestUI/ListViewItemPage.xaml.cs Source File

  • ParallaxView
  • TestUI

ListViewItemPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.ObjectModel;
00005 using MUXControlsTestApp.Utilities;
00006
00007 namespace MUXControlsTestApp
00008 {
00009     public sealed partial class ListViewItemPage : TestPage
00010     {
00011         private ObservableCollection<Ingredient> Ingredients = new ObservableCollection<Ingredient>();
00012
00013         public ListViewItemPage()
00014         {
00015             this.InitializeComponent();
00016             PopulateData();
00017         }
00018
00019         private void PopulateData()
00020         {
00021             this.Ingredients.Add(new Ingredient("Banana", "10 lbs", "Assets/ingredient1.png"));
00022             this.Ingredients.Add(new Ingredient("Strawberry", "27 lbs", "Assets/ingredient2.png"));
00023             this.Ingredients.Add(new Ingredient("Lemon", "12 lbs", "Assets/ingredient5.png"));
00024             this.Ingredients.Add(new Ingredient("Orange", "54 lbs", "Assets/ingredient3.png"));
00025             this.Ingredients.Add(new Ingredient("Vanilla", "2 lbs", "Assets/ingredient8.png"));
00026             this.Ingredients.Add(new Ingredient("Mint", "5 lbs", "Assets/ingredient4.png"));
00027             this.Ingredients.Add(new Ingredient("Banana", "9 lbs", "Assets/ingredient1.png"));
00028             this.Ingredients.Add(new Ingredient("Strawberry", "21 lbs", "Assets/ingredient2.png"));
00029             this.Ingredients.Add(new Ingredient("Lemon", "10 lbs", "Assets/ingredient5.png"));
00030             this.Ingredients.Add(new Ingredient("Orange", "57 lbs", "Assets/ingredient3.png"));
00031             this.Ingredients.Add(new Ingredient("Vanilla", "1 lbs", "Assets/ingredient8.png"));
00032             this.Ingredients.Add(new Ingredient("Mint", "4 lbs", "Assets/ingredient4.png"));
00033             this.Ingredients.Add(new Ingredient("Banana", "7 lbs", "Assets/ingredient1.png"));
00034             this.Ingredients.Add(new Ingredient("Strawberry", "5 lbs", "Assets/ingredient2.png"));
00035             this.Ingredients.Add(new Ingredient("Lemon", "4 lbs", "Assets/ingredient5.png"));
00036             this.Ingredients.Add(new Ingredient("Orange", "76 lbs", "Assets/ingredient3.png"));
00037             this.Ingredients.Add(new Ingredient("Vanilla", "3 lbs", "Assets/ingredient8.png"));
00038             this.Ingredients.Add(new Ingredient("Mint", "3 lbs", "Assets/ingredient4.png"));
00039
00040             this.IngredientList.ItemsSource = this.Ingredients;
00041         }
00042     }
00043 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ElementManager.cpp Source File

  • Repeater

ElementManager.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "ElementManager.h"
00008
00009 void ElementManager::SetContext(const winrt::VirtualizingLayoutContext& virtualContext)
00010 {
00011     m_context = virtualContext;
00012 }
00013
00014 void ElementManager::OnBeginMeasure(const ScrollOrientation& orientation)
00015 {
00016     MUX_ASSERT(m_useLayoutBounds);
00017
00018     if (m_context)
00019     {
00020         if (IsVirtualizingContext())
00021         {
00022             // We proactively clear elements laid out outside of the realizaton
00023             // rect so that they are available for reuse during the current
00024             // measure pass.
00025             // This is useful during fast panning scenarios in which the realization
00026             // window is constantly changing and we want to reuse elements from
00027             // the end that's opposite to the panning direction.
00028             DiscardElementsOutsideWindow(m_context.RealizationRect(), orientation);
00029         }
00030         else
00031         {
00032             // If we are initialized with a non-virtualizing context, make sure that
00033             // we have enough space to hold the bounds for all the elements.
00034             const int count = m_context.ItemCount();
00035             if (static_cast<int>(m_realizedElementLayoutBounds.size()) != count)
00036             {
00037                 // Make sure there is enough space for the bounds.
00038                 // Note: We could optimize when the count becomes smaller, but keeping
00039                 // it always up to date is the simplest option for now.
00040                 m_realizedElementLayoutBounds.resize(count, winrt::Rect());
00041             }
00042         }
00043     }
00044 }
00045
00046 int ElementManager::GetFirstRealizedDataIndex() const
00047 {
00048     return m_firstRealizedDataIndex;
00049 }
00050
00051 int ElementManager::GetRealizedElementCount() const
00052 {
00053     return IsVirtualizingContext() ?
00054         static_cast<int>(m_realizedElements.size()) : m_context.ItemCount();
00055 }
00056
00057 winrt::UIElement ElementManager::GetAt(int realizedIndex)
00058 {
00059     winrt::UIElement element{ nullptr };
00060     if (IsVirtualizingContext())
00061     {
00062         if (!m_realizedElements[realizedIndex])
00063         {
00064             // Sentinel. Create the element now since we need it.
00065             const int dataIndex = GetDataIndexFromRealizedRangeIndex(realizedIndex);
00066             ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"Creating element for sentinal with data index:", dataIndex);
00067             element = m_context.GetOrCreateElementAt(dataIndex, winrt::ElementRealizationOptions::ForceCreate | winrt::ElementRealizationOptions::SuppressAutoRecycle);
00068             m_realizedElements[realizedIndex] = tracker_ref<winrt::UIElement>{ m_owner, element };
00069         }
00070         else
00071         {
00072             element = m_realizedElements[realizedIndex].get();
00073         }
00074     }
00075     else
00076     {
00077         // realizedIndex and dataIndex are the same (everything is realized)
00078         element = m_context.GetOrCreateElementAt(realizedIndex, winrt::ElementRealizationOptions::ForceCreate | winrt::ElementRealizationOptions::SuppressAutoRecycle);
00079     }
00080
00081     return element;
00082 }
00083
00084 void ElementManager::Add(const winrt::UIElement& element, int dataIndex)
00085 {
00086     MUX_ASSERT(IsVirtualizingContext());
00087
00088     if (m_realizedElements.size() == 0)
00089     {
00090         m_firstRealizedDataIndex = dataIndex;
00091     }
00092
00093     m_realizedElements.emplace_back(tracker_ref<winrt::UIElement>{ m_owner, element });
00094
00095     if (m_useLayoutBounds)
00096     {
00097         m_realizedElementLayoutBounds.emplace_back(winrt::Rect());
00098     }
00099 }
00100
00101 void ElementManager::Insert(int realizedIndex, int dataIndex, const winrt::UIElement& element)
00102 {
00103     MUX_ASSERT(IsVirtualizingContext());
00104     if (realizedIndex == 0)
00105     {
00106         m_firstRealizedDataIndex = dataIndex;
00107     }
00108
00109     m_realizedElements.insert(m_realizedElements.begin() + realizedIndex, tracker_ref<winrt::UIElement>{ m_owner, element });
00110
00111     if (m_useLayoutBounds)
00112     {
00113         // Set bounds to an invalid rect since we do not know it yet.
00114         m_realizedElementLayoutBounds.insert(m_realizedElementLayoutBounds.begin() + realizedIndex, winrt::Rect{ -1.f, -1.f, -1.f, -1.f });
00115     }
00116 }
00117
00118 void ElementManager::ClearRealizedRange(int realizedIndex, int count)
00119 {
00120     MUX_ASSERT(IsVirtualizingContext());
00121     for (int i = 0; i < count; i++)
00122     {
00123         // Clear from the edges so that ItemsRepeater can optimize on maintaining
00124         // realized indices without walking through all the children every time.
00125         const int index = realizedIndex == 0 ? realizedIndex + i : (realizedIndex + count - 1) - i;
00126         if (auto elementRef = m_realizedElements[index])
00127         {
00128             m_context.RecycleElement(elementRef.get());
00129         }
00130     }
00131
00132     const int endIndex = realizedIndex + count;
00133     m_realizedElements.erase(m_realizedElements.begin() + realizedIndex, m_realizedElements.begin() + endIndex);
00134
00135     if (m_useLayoutBounds)
00136     {
00137         m_realizedElementLayoutBounds.erase(m_realizedElementLayoutBounds.begin() + realizedIndex, m_realizedElementLayoutBounds.begin() + endIndex);
00138     }
00139
00140     if (realizedIndex == 0)
00141     {
00142         m_firstRealizedDataIndex =
00143             m_realizedElements.size() == 0 ?
00144             -1 :
00145             m_firstRealizedDataIndex + count;
00146     }
00147 }
00148
00149 void ElementManager::DiscardElementsOutsideWindow(bool forward, int startIndex)
00150 {
00151     // Remove layout elements that are outside the realized range.
00152     if (IsDataIndexRealized(startIndex))
00153     {
00154         MUX_ASSERT(IsVirtualizingContext());
00155         const int rangeIndex = GetRealizedRangeIndexFromDataIndex(startIndex);
00156
00157         if (forward)
00158         {
00159             ClearRealizedRange(rangeIndex, GetRealizedElementCount() - rangeIndex);
00160         }
00161         else
00162         {
00163             ClearRealizedRange(0, rangeIndex + 1);
00164         }
00165     }
00166 }
00167
00168 void ElementManager::ClearRealizedRange()
00169 {
00170     MUX_ASSERT(IsVirtualizingContext());
00171     ClearRealizedRange(0, GetRealizedElementCount());
00172 }
00173
00174
00175 winrt::Rect ElementManager::GetLayoutBoundsForDataIndex(int dataIndex) const
00176 {
00177     MUX_ASSERT(m_useLayoutBounds);
00178
00179     const int realizedIndex = GetRealizedRangeIndexFromDataIndex(dataIndex);
00180     return m_realizedElementLayoutBounds[realizedIndex];
00181 }
00182
00183 void ElementManager::SetLayoutBoundsForDataIndex(int dataIndex, const winrt::Rect& bounds)
00184 {
00185     MUX_ASSERT(m_useLayoutBounds);
00186
00187     const int realizedIndex = GetRealizedRangeIndexFromDataIndex(dataIndex);
00188     m_realizedElementLayoutBounds[realizedIndex] = bounds;
00189 }
00190
00191
00192 winrt::Rect ElementManager::GetLayoutBoundsForRealizedIndex(int realizedIndex) const
00193 {
00194     MUX_ASSERT(m_useLayoutBounds);
00195
00196     return m_realizedElementLayoutBounds[realizedIndex];
00197 }
00198
00199 void ElementManager::SetLayoutBoundsForRealizedIndex(int realizedIndex, const winrt::Rect& bounds)
00200 {
00201     MUX_ASSERT(m_useLayoutBounds);
00202
00203     m_realizedElementLayoutBounds[realizedIndex] = bounds;
00204 }
00205
00206
00207 bool ElementManager::IsDataIndexRealized(int index) const
00208 {
00209     if (IsVirtualizingContext())
00210     {
00211         const int realizedCount = GetRealizedElementCount();
00212         return
00213             realizedCount > 0 &&
00214             GetDataIndexFromRealizedRangeIndex(0) <= index &&
00215             GetDataIndexFromRealizedRangeIndex(realizedCount - 1) >= index;
00216     }
00217     else
00218     {
00219         // Non virtualized - everything is realized
00220         return index >= 0 && index < m_context.ItemCount();
00221     }
00222 }
00223
00224 bool ElementManager::IsIndexValidInData(int currentIndex) const
00225 {
00226     return currentIndex >= 0 && currentIndex < m_context.ItemCount();
00227 }
00228
00229
00230 winrt::UIElement ElementManager::GetRealizedElement(int dataIndex)
00231 {
00232     MUX_ASSERT(IsDataIndexRealized(dataIndex));
00233     return IsVirtualizingContext() ?
00234         GetAt(GetRealizedRangeIndexFromDataIndex(dataIndex)) : m_context.GetOrCreateElementAt(dataIndex, winrt::ElementRealizationOptions::ForceCreate | winrt::ElementRealizationOptions::SuppressAutoRecycle);
00235 }
00236
00237 void ElementManager::EnsureElementRealized(bool forward, int dataIndex, const wstring_view& layoutId)
00238 {
00239     if (IsDataIndexRealized(dataIndex) == false)
00240     {
00241         auto element = m_context.GetOrCreateElementAt(dataIndex, winrt::ElementRealizationOptions::ForceCreate | winrt::ElementRealizationOptions::SuppressAutoRecycle);
00242
00243         if (forward)
00244         {
00245             Add(element, dataIndex);
00246         }
00247         else
00248         {
00249             Insert(0, dataIndex, element);
00250         }
00251
00252         MUX_ASSERT(IsDataIndexRealized(dataIndex));
00253         ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_STR_STR_INT, METH_NAME, this, layoutId.data(), L"Created element for index:", dataIndex);
00254     }
00255 }
00256
00257 // Does the given window intersect the range of realized elements
00258 bool ElementManager::IsWindowConnected(const winrt::Rect& window, const ScrollOrientation& orientation, bool scrollOrientationSameAsFlow) const
00259 {
00260     MUX_ASSERT(IsVirtualizingContext());
00261     MUX_ASSERT(m_useLayoutBounds);
00262
00263     bool intersects = false;
00264     if (m_realizedElementLayoutBounds.size() > 0)
00265     {
00266         const auto firstElementBounds = GetLayoutBoundsForRealizedIndex(0);
00267         const auto lastElementBounds = GetLayoutBoundsForRealizedIndex(GetRealizedElementCount() - 1);
00268
00269         const auto effectiveOrientation = scrollOrientationSameAsFlow ?
00270             (orientation == ScrollOrientation::Vertical ? ScrollOrientation::Horizontal : ScrollOrientation::Vertical) :
00271             orientation;
00272
00273
00274         const auto windowStart = effectiveOrientation == ScrollOrientation::Vertical ? window.Y : window.X;
00275         const auto windowEnd = effectiveOrientation == ScrollOrientation::Vertical ? window.Y + window.Height : window.X + window.Width;
00276         const auto firstElementStart = effectiveOrientation == ScrollOrientation::Vertical ? firstElementBounds.Y : firstElementBounds.X;
00277         const auto lastElementEnd = effectiveOrientation == ScrollOrientation::Vertical ? lastElementBounds.Y + lastElementBounds.Height : lastElementBounds.X + lastElementBounds.Width;
00278
00279         intersects =
00280             firstElementStart <= windowEnd &&
00281             lastElementEnd >= windowStart;
00282     }
00283
00284     return intersects;
00285 }
00286
00287 void ElementManager::DataSourceChanged(const winrt::IInspectable& /*source*/, winrt::NotifyCollectionChangedEventArgs const& args)
00288 {
00289     MUX_ASSERT(IsVirtualizingContext());
00290     if (m_realizedElements.size() > 0)
00291     {
00292         switch (args.Action())
00293         {
00294         case winrt::NotifyCollectionChangedAction::Add:
00295         {
00296             OnItemsAdded(args.NewStartingIndex(), args.NewItems().Size());
00297         }
00298         break;
00299
00300         case winrt::NotifyCollectionChangedAction::Replace:
00301         {
00302             const int oldSize = args.OldItems().Size();
00303             const int newSize = args.NewItems().Size();
00304             const int oldStartIndex = args.OldStartingIndex();
00305             const int newStartIndex = args.NewStartingIndex();
00306
00307             if (oldSize == newSize &&
00308                 oldStartIndex == newStartIndex &&
00309                 IsDataIndexRealized(oldStartIndex) &&
00310                 IsDataIndexRealized(oldStartIndex + oldSize - 1))
00311             {
00312                 // Straight up replace of n items within the realization window.
00313                 // Removing and adding might causes us to lose the anchor causing us
00314                 // to throw away all containers and start from scratch.
00315                 // Instead, we can just clear those items and set the element to
00316                 // null (sentinel) and let the next measure get new containers for them.
00317                 const auto startRealizedIndex = GetRealizedRangeIndexFromDataIndex(oldStartIndex);
00318                 for (int realizedIndex = startRealizedIndex; realizedIndex < startRealizedIndex + oldSize; realizedIndex++)
00319                 {
00320                     if (auto elementRef = m_realizedElements[realizedIndex])
00321                     {
00322                         m_context.RecycleElement(elementRef.get());
00323                         m_realizedElements[realizedIndex] = tracker_ref<winrt::UIElement>{ m_owner, nullptr };
00324                     }
00325                 }
00326             }
00327             else
00328             {
00329                 OnItemsRemoved(oldStartIndex, oldSize);
00330                 OnItemsAdded(newStartIndex, newSize);
00331             }
00332         }
00333         break;
00334
00335         case winrt::NotifyCollectionChangedAction::Remove:
00336         {
00337             OnItemsRemoved(args.OldStartingIndex(), args.OldItems().Size());
00338         }
00339         break;
00340
00341         case winrt::NotifyCollectionChangedAction::Reset:
00342             ClearRealizedRange();
00343             break;
00344
00345         case winrt::NotifyCollectionChangedAction::Move:
00346             int size = args.OldItems() != NULL ? args.OldItems().Size() : 1;
00347             OnItemsRemoved(args.OldStartingIndex(), size);
00348             OnItemsAdded(args.NewStartingIndex(), size);
00349             break;
00350         }
00351     }
00352 }
00353
00354 int ElementManager::GetElementDataIndex(const winrt::UIElement& suggestedAnchor) const
00355 {
00356     MUX_ASSERT(suggestedAnchor);
00357     auto it = std::find(m_realizedElements.cbegin(), m_realizedElements.cend(), suggestedAnchor);
00358     return
00359         it != m_realizedElements.cend() ?
00360         GetDataIndexFromRealizedRangeIndex(static_cast<int>(std::distance(m_realizedElements.cbegin(), it))) :
00361         -1;
00362 }
00363
00364 int ElementManager::GetDataIndexFromRealizedRangeIndex(int rangeIndex) const
00365 {
00366     MUX_ASSERT(rangeIndex >= 0 && rangeIndex < GetRealizedElementCount());
00367     return IsVirtualizingContext() ?
00368         rangeIndex + m_firstRealizedDataIndex : rangeIndex;
00369 }
00370
00371 int ElementManager::GetRealizedRangeIndexFromDataIndex(int dataIndex) const
00372 {
00373     MUX_ASSERT(IsDataIndexRealized(dataIndex));
00374     return IsVirtualizingContext() ?
00375         dataIndex - m_firstRealizedDataIndex : dataIndex;
00376 }
00377
00378 void ElementManager::DiscardElementsOutsideWindow(const winrt::Rect& window, const ScrollOrientation& orientation)
00379 {
00380     MUX_ASSERT(IsVirtualizingContext());
00381     MUX_ASSERT(m_useLayoutBounds);
00382     MUX_ASSERT(m_realizedElements.size() == m_realizedElementLayoutBounds.size());
00383
00384     // The following illustration explains the cutoff indices.
00385     // We will clear all the realized elements from both ends
00386     // up to the corresponding cutoff index.
00387     // '-' means the element is outside the cutoff range.
00388     // '*' means the element is inside the cutoff range and will be cleared.
00389     //
00390     // Window:
00391     //        |______________________________|
00392     // Realization range:
00393     // |*****----------------------------------*********|
00394     //      |                                  |
00395     //  frontCutoffIndex                backCutoffIndex
00396     //
00397     // Note that we tolerate at most one element outside of the window
00398     // because the FlowLayoutAlgorithm.Generate routine stops *after*
00399     // it laid out an element outside the realization window.
00400     // This is also convenient because it protects the anchor
00401     // during a BringIntoView operation during which the anchor may
00402     // not be in the realization window (in fact, the realization window
00403     // might be empty if the BringIntoView is issued before the first
00404     // layout pass).
00405
00406     const int realizedRangeSize = GetRealizedElementCount();
00407     int frontCutoffIndex = -1;
00408     int backCutoffIndex = realizedRangeSize;
00409
00410     for (int i = 0;
00411         i < realizedRangeSize &&
00412         !Intersects(window, m_realizedElementLayoutBounds[i], orientation);
00413         ++i)
00414     {
00415         ++frontCutoffIndex;
00416     }
00417
00418     for (int i = realizedRangeSize - 1;
00419         i >= 0 &&
00420         !Intersects(window, m_realizedElementLayoutBounds[i], orientation);
00421         --i)
00422     {
00423         --backCutoffIndex;
00424     }
00425
00426     if (backCutoffIndex < realizedRangeSize - 1)
00427     {
00428         ClearRealizedRange(backCutoffIndex + 1, realizedRangeSize - backCutoffIndex - 1);
00429     }
00430
00431     if (frontCutoffIndex > 0)
00432     {
00433         ClearRealizedRange(0, std::min(frontCutoffIndex, GetRealizedElementCount()));
00434     }
00435 }
00436
00437 /* static */
00438 bool ElementManager::Intersects(const winrt::Rect& lhs, const winrt::Rect& rhs, const ScrollOrientation& orientation)
00439 {
00440     const auto lhsStart = orientation == ScrollOrientation::Vertical ? lhs.Y : lhs.X;
00441     const auto lhsEnd = orientation == ScrollOrientation::Vertical ? lhs.Y + lhs.Height : lhs.X + lhs.Width;
00442     const auto rhsStart = orientation == ScrollOrientation::Vertical ? rhs.Y : rhs.X;
00443     const auto rhsEnd = orientation == ScrollOrientation::Vertical ? rhs.Y + rhs.Height : rhs.X + rhs.Width;
00444
00445     return lhsEnd >= rhsStart && lhsStart <= rhsEnd;
00446 }
00447
00448 void ElementManager::OnItemsAdded(int index, int count)
00449 {
00450     // Using the old indices here (before it was updated by the collection change)
00451     // if the insert data index is between the first and last realized data index, we need
00452     // to insert items.
00453     const int lastRealizedDataIndex = m_firstRealizedDataIndex + GetRealizedElementCount() - 1;
00454     const int newStartingIndex = index;
00455     if (newStartingIndex >= m_firstRealizedDataIndex &&
00456         newStartingIndex <= lastRealizedDataIndex)
00457     {
00458         // Inserted within the realized range
00459         const int insertRangeStartIndex = newStartingIndex - m_firstRealizedDataIndex;
00460         for (int i = 0; i < count; i++)
00461         {
00462             // Insert null (sentinel) here instead of an element, that way we dont
00463             // end up creating a lot of elements only to be thrown out in the next layout.
00464             const int insertRangeIndex = insertRangeStartIndex + i;
00465             const int dataIndex = newStartingIndex + i;
00466             // This is to keep the contiguousness of the mapping
00467             Insert(insertRangeIndex, dataIndex, nullptr);
00468         }
00469     }
00470     else if (index <= m_firstRealizedDataIndex)
00471     {
00472         // Items were inserted before the realized range.
00473         // We need to update m_firstRealizedDataIndex;
00474         m_firstRealizedDataIndex += count;
00475     }
00476 }
00477
00478 void ElementManager::OnItemsRemoved(int index, int count)
00479 {
00480     const int lastRealizedDataIndex = m_firstRealizedDataIndex + static_cast<int>(m_realizedElements.size()) - 1;
00481     const int startIndex = std::max(m_firstRealizedDataIndex, index);
00482     const int endIndex = std::min(lastRealizedDataIndex, index + count - 1);
00483     const bool removeAffectsFirstRealizedDataIndex = (index <= m_firstRealizedDataIndex);
00484
00485     if (endIndex >= startIndex)
00486     {
00487         ClearRealizedRange(GetRealizedRangeIndexFromDataIndex(startIndex), endIndex - startIndex + 1);
00488     }
00489
00490     if (removeAffectsFirstRealizedDataIndex &&
00491         m_firstRealizedDataIndex != -1)
00492     {
00493         m_firstRealizedDataIndex -= count;
00494     }
00495 }
00496
00497
00498 bool ElementManager::IsVirtualizingContext() const
00499 {
00500     if (m_context)
00501     {
00502         const auto rect = m_context.RealizationRect();
00503         const bool hasInfiniteSize = (rect.Height == std::numeric_limits<float>::infinity() || rect.Width == std::numeric_limits<float>::infinity());
00504         return !hasInfiniteSize;
00505     }
00506     return false;
00507 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBar.idl Source File

  • InkToolBar

InkToolBar.idl

Go to the documentation of this file.
00001 namespace MU_XC_NAMESPACE
00002 {
00003     [MUX_PREVIEW]
00004     enum InkToolBarButtonFlyoutPlacement
00005     {
00006         Auto,
00007         Top,
00008         Bottom,
00009         Left,
00010         Right,
00011     };
00012
00013     [MUX_PREVIEW]
00014     enum InkToolBarEraserFlyoutItemKind
00015     {
00016         StrokeEraser,
00017         PrecisionSmallEraser,
00018         PrecisionLargeEraser,
00019         ClearAll,
00020     };
00021
00022     [MUX_PREVIEW]
00023     enum InkToolBarEraserKind
00024     {
00025         Stroke,
00026         PrecisionSmall,
00027         PrecisionLarge,
00028     };
00029
00030     [MUX_PREVIEW]
00031     enum InkToolBarFlyoutItemKind
00032     {
00033         Simple,
00034         Radio,
00035         Check,
00036         RadioCheck,
00037     };
00038
00039     [MUX_PREVIEW]
00040     enum InkToolBarInitialControls
00041     {
00042         All,
00043         None,
00044         PensOnly,
00045         AllExceptPens,
00046     };
00047
00048     [MUX_PREVIEW]
00049     enum InkToolBarMenuKind
00050     {
00051         Stencil,
00052     };
00053
00054     [MUX_PREVIEW]
00055     enum InkToolBarStencilKind
00056     {
00057         Ruler,
00058         Protractor,
00059     };
00060
00061     [MUX_PREVIEW]
00062     enum InkToolBarToggle
00063     {
00064         Ruler,
00065         Custom,
00066     };
00067
00068     [MUX_PREVIEW]
00069     enum InkToolBarTool
00070     {
00071         BallpointPen,
00072         Pencil,
00073         Highlighter,
00074         Eraser,
00075         CustomPen,
00076         CustomTool,
00077     };
00078
00079
00080     [MUX_PREVIEW]
00081     runtimeclass InkToolBarEraserFlyoutItemClickedEventArgs
00082     {
00083         Microsoft.UI.Xaml.Controls.InkToolBarEraserFlyoutItemKind EraserFlyoutItemKind{ get; };
00084         Boolean Handled{ set; get; };
00085     };
00086
00087     [MUX_PREVIEW]
00088     runtimeclass InkToolBarIsStencilButtonCheckedChangedEventArgs
00089     {
00090         Microsoft.UI.Xaml.Controls.InkToolBarStencilButton StencilButton{ get; };
00091         Microsoft.UI.Xaml.Controls.InkToolBarStencilKind StencilKind{ get; };
00092     };
00093
00094     [MUX_PREVIEW]
00095     [constructor_name("Microsoft.UI.Xaml.Controls.IInkToolBarCustomPenFactory")]
00096     unsealed runtimeclass InkToolBarCustomPen
00097         : Microsoft.UI.Xaml.DependencyObject
00098     {
00099         [method_name("CreateInstance")] protected InkToolBarCustomPen();
00100         Windows.UI.Input.Inking.InkDrawingAttributes CreateInkDrawingAttributes(Microsoft.UI.Xaml.Media.Brush brush, Double strokeWidth);
00101         overridable Windows.UI.Input.Inking.InkDrawingAttributes CreateInkDrawingAttributesCore(Microsoft.UI.Xaml.Media.Brush brush, Double strokeWidth);
00102     };
00103
00104     [MUX_PREVIEW]
00105     [contentproperty("Children")]
00106     unsealed runtimeclass InkToolBar
00107         : Microsoft.UI.Xaml.Controls.Control
00108     {
00109         [method_name("CreateInstance")] InkToolBar();
00110         Microsoft.UI.Xaml.Controls.InkToolBarInitialControls InitialControls;
00111         Microsoft.UI.Xaml.DependencyObjectCollection Children{ get; };
00112         Microsoft.UI.Xaml.Controls.InkToolBarToolButton ActiveTool;
00113         Windows.UI.Input.Inking.InkDrawingAttributes InkDrawingAttributes{ get; };
00114         Boolean IsRulerButtonChecked;
00115         Microsoft.UI.Xaml.Controls.InkCanvas TargetInkCanvas;
00116         Boolean IsStencilButtonChecked;
00117         Microsoft.UI.Xaml.Controls.InkToolBarButtonFlyoutPlacement ButtonFlyoutPlacement;
00118         Microsoft.UI.Xaml.Controls.Orientation Orientation;
00119         Object TargetInkPresenter;
00120         event Windows.Foundation.TypedEventHandler<Microsoft.UI.Xaml.Controls.InkToolBar,Object> ActiveToolChanged;
00121         event Windows.Foundation.TypedEventHandler<Microsoft.UI.Xaml.Controls.InkToolBar,Object> InkDrawingAttributesChanged;
00122         event Windows.Foundation.TypedEventHandler<Microsoft.UI.Xaml.Controls.InkToolBar,Object> EraseAllClicked;
00123         event Windows.Foundation.TypedEventHandler<Microsoft.UI.Xaml.Controls.InkToolBarEraserFlyoutItemClickedEventArgs,Object> EraserFlyoutItemClicked;
00124         event Windows.Foundation.TypedEventHandler<Microsoft.UI.Xaml.Controls.InkToolBar,Microsoft.UI.Xaml.Controls.InkToolBarIsStencilButtonCheckedChangedEventArgs> IsStencilButtonCheckedChanged;
00125         Microsoft.UI.Xaml.Controls.InkToolBarToolButton GetToolButton(Microsoft.UI.Xaml.Controls.InkToolBarTool tool);
00126         Microsoft.UI.Xaml.Controls.InkToolBarToggleButton GetToggleButton(Microsoft.UI.Xaml.Controls.InkToolBarToggle tool);
00127         Microsoft.UI.Xaml.Controls.InkToolBarMenuButton GetMenuButton(Microsoft.UI.Xaml.Controls.InkToolBarMenuKind menu);
00128         static Microsoft.UI.Xaml.DependencyProperty InitialControlsProperty{ get; };
00129         static Microsoft.UI.Xaml.DependencyProperty ChildrenProperty{ get; };
00130         static Microsoft.UI.Xaml.DependencyProperty ActiveToolProperty{ get; };
00131         static Microsoft.UI.Xaml.DependencyProperty InkDrawingAttributesProperty{ get; };
00132         static Microsoft.UI.Xaml.DependencyProperty IsRulerButtonCheckedProperty{ get; };
00133         static Microsoft.UI.Xaml.DependencyProperty TargetInkCanvasProperty{ get; };
00134         static Microsoft.UI.Xaml.DependencyProperty IsStencilButtonCheckedProperty{ get; };
00135         static Microsoft.UI.Xaml.DependencyProperty ButtonFlyoutPlacementProperty{ get; };
00136         static Microsoft.UI.Xaml.DependencyProperty OrientationProperty{ get; };
00137         static Microsoft.UI.Xaml.DependencyProperty TargetInkPresenterProperty{ get; };
00138     };
00139
00140     [MUX_PREVIEW]
00141     unsealed runtimeclass InkToolBarPenConfigurationControl
00142         : Microsoft.UI.Xaml.Controls.Control
00143     {
00144         [method_name("CreateInstance")] InkToolBarPenConfigurationControl();
00145         Microsoft.UI.Xaml.Controls.InkToolBarPenButton PenButton{ get; };
00146         static Microsoft.UI.Xaml.DependencyProperty PenButtonProperty{ get; };
00147     };
00148
00149     [MUX_PREVIEW]
00150     unsealed runtimeclass InkToolBarFlyoutItem
00151         : Microsoft.UI.Xaml.Controls.Primitives.ButtonBase
00152     {
00153         [method_name("CreateInstance")] InkToolBarFlyoutItem();
00154         Microsoft.UI.Xaml.Controls.InkToolBarFlyoutItemKind Kind;
00155         Boolean IsChecked;
00156         event Windows.Foundation.TypedEventHandler<Microsoft.UI.Xaml.Controls.InkToolBarFlyoutItem,Object> Checked;
00157         event Windows.Foundation.TypedEventHandler<Microsoft.UI.Xaml.Controls.InkToolBarFlyoutItem,Object> Unchecked;
00158         static Microsoft.UI.Xaml.DependencyProperty KindProperty{ get; };
00159         static Microsoft.UI.Xaml.DependencyProperty IsCheckedProperty{ get; };
00160     };
00161
00162     [MUX_PREVIEW]
00163     [constructor_name("Microsoft.UI.Xaml.Controls.IInkToolBarMenuButtonFactory")]
00164     unsealed runtimeclass InkToolBarMenuButton
00165         : Microsoft.UI.Xaml.Controls.Primitives.ToggleButton
00166     {
00167         Microsoft.UI.Xaml.Controls.InkToolBarMenuKind MenuKind{ get; };
00168         Boolean IsExtensionGlyphShown;
00169         static Microsoft.UI.Xaml.DependencyProperty IsExtensionGlyphShownProperty{ get; };
00170     };
00171
00172     [MUX_PREVIEW]
00173     unsealed runtimeclass InkToolBarStencilButton
00174         : Microsoft.UI.Xaml.Controls.InkToolBarMenuButton
00175     {
00176         [method_name("CreateInstance")] InkToolBarStencilButton();
00177         Windows.UI.Input.Inking.InkPresenterRuler Ruler{ get; };
00178         Windows.UI.Input.Inking.InkPresenterProtractor Protractor{ get; };
00179         Microsoft.UI.Xaml.Controls.InkToolBarStencilKind SelectedStencil;
00180         Boolean IsRulerItemVisible;
00181         Boolean IsProtractorItemVisible;
00182         static Microsoft.UI.Xaml.DependencyProperty RulerProperty{ get; };
00183         static Microsoft.UI.Xaml.DependencyProperty ProtractorProperty{ get; };
00184         static Microsoft.UI.Xaml.DependencyProperty SelectedStencilProperty{ get; };
00185         static Microsoft.UI.Xaml.DependencyProperty IsRulerItemVisibleProperty{ get; };
00186         static Microsoft.UI.Xaml.DependencyProperty IsProtractorItemVisibleProperty{ get; };
00187     };
00188
00189     [MUX_PREVIEW]
00190     [constructor_name("Microsoft.UI.Xaml.Controls.IInkToolBarToggleButtonFactory")]
00191     unsealed runtimeclass InkToolBarToggleButton
00192         : Microsoft.UI.Xaml.Controls.CheckBox
00193     {
00194         Microsoft.UI.Xaml.Controls.InkToolBarToggle ToggleKind{ get; };
00195     };
00196
00197     [MUX_PREVIEW]
00198     [constructor_name("Microsoft.UI.Xaml.Controls.IInkToolBarToolButtonFactory")]
00199     unsealed runtimeclass InkToolBarToolButton
00200         : Microsoft.UI.Xaml.Controls.RadioButton
00201     {
00202         Microsoft.UI.Xaml.Controls.InkToolBarTool ToolKind{ get; };
00203         Boolean IsExtensionGlyphShown;
00204         static Microsoft.UI.Xaml.DependencyProperty IsExtensionGlyphShownProperty{ get; };
00205         Microsoft.UI.Xaml.Controls.InkToolBarToggle ToggleKind{ get; };
00206     };
00207
00208     [MUX_PREVIEW]
00209     [default_interface]
00210     unsealed runtimeclass InkToolBarCustomToggleButton
00211         : Microsoft.UI.Xaml.Controls.InkToolBarToggleButton
00212     {
00213         [method_name("CreateInstance")] InkToolBarCustomToggleButton();
00214     };
00215
00216     [MUX_PREVIEW]
00217     unsealed runtimeclass InkToolBarCustomToolButton
00218         : Microsoft.UI.Xaml.Controls.InkToolBarToolButton
00219     {
00220         [method_name("CreateInstance")] InkToolBarCustomToolButton();
00221         Microsoft.UI.Xaml.UIElement ConfigurationContent;
00222         static Microsoft.UI.Xaml.DependencyProperty ConfigurationContentProperty{ get; };
00223     };
00224
00225     [MUX_PREVIEW]
00226     unsealed runtimeclass InkToolBarEraserButton
00227         : Microsoft.UI.Xaml.Controls.InkToolBarToolButton
00228     {
00229         Microsoft.UI.Xaml.Controls.InkToolBarEraserKind SelectedEraser;
00230         Boolean IsClearAllVisible;
00231         Boolean IsStrokeEraserVisible;
00232         Boolean ArePrecisionErasersVisible;
00233         static Microsoft.UI.Xaml.DependencyProperty IsClearAllVisibleProperty{ get; };
00234         static Microsoft.UI.Xaml.DependencyProperty SelectedEraserProperty{ get; };
00235         static Microsoft.UI.Xaml.DependencyProperty IsStrokeEraserVisibleProperty{ get; };
00236         static Microsoft.UI.Xaml.DependencyProperty ArePrecisionErasersVisibleProperty{ get; };
00237      };
00238
00239     [MUX_PREVIEW]
00240     [constructor_name("Microsoft.UI.Xaml.Controls.IInkToolBarPenButtonFactory")]
00241     unsealed runtimeclass InkToolBarPenButton
00242         : Microsoft.UI.Xaml.Controls.InkToolBarToolButton
00243     {
00244         Windows.Foundation.Collections.IVector<Microsoft.UI.Xaml.Media.Brush> Palette;
00245         Double MinStrokeWidth;
00246         Double MaxStrokeWidth;
00247         Microsoft.UI.Xaml.Media.Brush SelectedBrush{ get; };
00248         Int32 SelectedBrushIndex;
00249         Double SelectedStrokeWidth;
00250         static Microsoft.UI.Xaml.DependencyProperty PaletteProperty{ get; };
00251         static Microsoft.UI.Xaml.DependencyProperty MinStrokeWidthProperty{ get; };
00252         static Microsoft.UI.Xaml.DependencyProperty MaxStrokeWidthProperty{ get; };
00253         static Microsoft.UI.Xaml.DependencyProperty SelectedBrushProperty{ get; };
00254         static Microsoft.UI.Xaml.DependencyProperty SelectedBrushIndexProperty{ get; };
00255         static Microsoft.UI.Xaml.DependencyProperty SelectedStrokeWidthProperty{ get; };
00256     };
00257
00258     [MUX_PREVIEW]
00259     [default_interface]
00260     unsealed runtimeclass InkToolBarBallpointPenButton
00261         : Microsoft.UI.Xaml.Controls.InkToolBarPenButton
00262     {
00263         [method_name("CreateInstance")] InkToolBarBallpointPenButton();
00264     };
00265
00266     [MUX_PREVIEW]
00267     unsealed runtimeclass InkToolBarCustomPenButton
00268         : Microsoft.UI.Xaml.Controls.InkToolBarPenButton
00269     {
00270         [method_name("CreateInstance")] InkToolBarCustomPenButton();
00271         Microsoft.UI.Xaml.Controls.InkToolBarCustomPen CustomPen;
00272         Microsoft.UI.Xaml.UIElement ConfigurationContent;
00273         static Microsoft.UI.Xaml.DependencyProperty CustomPenProperty{ get; };
00274         static Microsoft.UI.Xaml.DependencyProperty ConfigurationContentProperty{ get; };
00275     };
00276
00277     [MUX_PREVIEW]
00278     [default_interface]
00279     unsealed runtimeclass InkToolBarHighlighterButton
00280         : Microsoft.UI.Xaml.Controls.InkToolBarPenButton
00281     {
00282         [method_name("CreateInstance")] InkToolBarHighlighterButton();
00283     };
00284
00285     [MUX_PREVIEW]
00286     [default_interface]
00287     unsealed runtimeclass InkToolBarPencilButton
00288         : Microsoft.UI.Xaml.Controls.InkToolBarPenButton
00289     {
00290         [method_name("CreateInstance")] InkToolBarPencilButton();
00291     };
00292
00293 }
00294
00295
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemCollectionTransition.cpp Source File

  • Repeater

ItemCollectionTransition.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ItemCollectionTransition.h"
00007 #include "ItemCollectionTransitionProgress.h"
00008
00009 ItemCollectionTransition::ItemCollectionTransition(
00010     winrt::ItemCollectionTransitionProvider const& owningProvider,
00011     winrt::UIElement const& element,
00012     winrt::ItemCollectionTransitionOperation const& operation,
00013     winrt::ItemCollectionTransitionTriggers const& triggers)
00014     : ItemCollectionTransition(
00015         owningProvider,
00016         element,
00017         operation,
00018         triggers,
00019         winrt::Rect{},
00020         winrt::Rect{})
00021 {
00022     MUX_ASSERT(operation != winrt::ItemCollectionTransitionOperation::Move);
00023 }
00024
00025 ItemCollectionTransition::ItemCollectionTransition(
00026     winrt::ItemCollectionTransitionProvider const& owningProvider,
00027     winrt::UIElement const& element,
00028     winrt::ItemCollectionTransitionTriggers const& triggers,
00029     winrt::Rect const& oldBounds,
00030     winrt::Rect const& newBounds)
00031     : ItemCollectionTransition(
00032         owningProvider,
00033         element,
00034         winrt::ItemCollectionTransitionOperation::Move,
00035         triggers,
00036         oldBounds,
00037         newBounds)
00038 {
00039 }
00040
00041 ItemCollectionTransition::ItemCollectionTransition(
00042     winrt::ItemCollectionTransitionProvider const& owningProvider,
00043     winrt::UIElement const& element,
00044     winrt::ItemCollectionTransitionOperation const& operation,
00045     winrt::ItemCollectionTransitionTriggers const& triggers,
00046     winrt::Rect const& oldBounds,
00047     winrt::Rect const& newBounds)
00048     : m_operation(operation)
00049     , m_triggers(triggers)
00050     , m_oldBounds(oldBounds)
00051     , m_newBounds(newBounds)
00052 {
00053     m_owningProvider = owningProvider;
00054     m_element.set(element);
00055 }
00056
00057 winrt::ItemCollectionTransitionProgress ItemCollectionTransition::Start()
00058 {
00059     if (!m_progress)
00060     {
00061         m_progress.set(winrt::make<ItemCollectionTransitionProgress>(*this));
00062     }
00063
00064     return m_progress.safe_get();
00065 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ItemCollectionTransitionProvider.properties.cpp Source File

  • Generated

ItemCollectionTransitionProvider.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "ItemCollectionTransitionProvider.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(ItemCollectionTransitionProvider)
00012 }
00013
00014 #include "ItemCollectionTransitionProvider.g.cpp"
00015
00016
00017 ItemCollectionTransitionProviderProperties::ItemCollectionTransitionProviderProperties()
00018     : m_transitionCompletedEventSource{static_cast<ItemCollectionTransitionProvider*>(this)}
00019 {
00020 }
00021
00022 void ItemCollectionTransitionProviderProperties::EnsureProperties()
00023 {
00024 }
00025
00026 void ItemCollectionTransitionProviderProperties::ClearProperties()
00027 {
00028 }
00029
00030 winrt::event_token ItemCollectionTransitionProviderProperties::TransitionCompleted(winrt::TypedEventHandler<winrt::ItemCollectionTransitionProvider, winrt::ItemCollectionTransitionCompletedEventArgs> const& value)
00031 {
00032     return m_transitionCompletedEventSource.add(value);
00033 }
00034
00035 void ItemCollectionTransitionProviderProperties::TransitionCompleted(winrt::event_token const& token)
00036 {
00037     m_transitionCompletedEventSource.remove(token);
00038 }
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemInvokedEventArgs.h Source File

  • NavigationView

NavigationViewItemInvokedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "NavigationViewItemInvokedEventArgs.g.h"
00007
00008 class NavigationViewItemInvokedEventArgs
00009     : public ReferenceTracker<NavigationViewItemInvokedEventArgs, winrt::implementation::NavigationViewItemInvokedEventArgsT, winrt::composing, winrt::composable>
00010 {
00011 public:
00012     winrt::IInspectable InvokedItem();
00013     bool IsSettingsInvoked();
00014
00015     void InvokedItem(const winrt::IInspectable& value);
00016     void IsSettingsInvoked(bool value);
00017
00018     winrt::NavigationViewItemBase InvokedItemContainer();
00019     void InvokedItemContainer(winrt::NavigationViewItemBase const& value);
00020
00021     winrt::NavigationTransitionInfo RecommendedNavigationTransitionInfo();
00022     void RecommendedNavigationTransitionInfo(winrt::NavigationTransitionInfo const& value);
00023
00024 private:
00025     bool m_isSettingsInvoked{ false };
00026     tracker_ref<winrt::IInspectable> m_invokedItem{ this };
00027     tracker_ref<winrt::NavigationViewItemBase> m_invokedItemContainer{ this };
00028     tracker_ref<winrt::NavigationTransitionInfo> m_recommendedNavigationTransitionInfo{ this };
00029 };
00030
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/GlobalDependencyProperty.h Source File

  • inc

GlobalDependencyProperty.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 // Helper to use instead of winrt::DependencyProperty in a static global. Avoids getting a dynamic initializer and
00007 // destructor, so it saves on dll size as well as avoids destructing a WinRT object at dll unload.
00008 struct GlobalDependencyProperty
00009 {
00010     GlobalDependencyProperty() = default;
00011
00012     constexpr GlobalDependencyProperty(nullptr_t)
00013     {
00014     }
00015
00016     // Can assign to nullptr which will free the DP.
00017     GlobalDependencyProperty& operator=(nullptr_t)
00018     {
00019         Property() = nullptr;
00020         return *this;
00021     }
00022
00023     // Can also copy from winrt::DependencyProperty to transfer ownership for initialization.
00024     GlobalDependencyProperty& operator=(winrt::DependencyProperty const& other)
00025     {
00026         Property() = other;
00027         return *this;
00028     }
00029
00030     GlobalDependencyProperty(winrt::DependencyProperty const& other)
00031     {
00032         Property() = other;
00033     }
00034
00035     // Cannot copy or assign this helper because it is only for global static usage.
00036     GlobalDependencyProperty(GlobalDependencyProperty const&) = delete;
00037     GlobalDependencyProperty& operator=(GlobalDependencyProperty const& other) = delete;
00038
00039     operator winrt::DependencyProperty() const
00040     {
00041         return Property();
00042     }
00043
00044     operator bool() const
00045     {
00046         return static_cast<bool>(m_dependencyProperty);
00047     }
00048
00049     bool operator==(winrt::DependencyProperty const& other) const
00050     {
00051         return Property() == other;
00052     }
00053
00054     bool operator==(nullptr_t) const
00055     {
00056         return Property() == nullptr;
00057     }
00058
00059 private:
00060     winrt::DependencyProperty& Property()
00061     {
00062         return reinterpret_cast<winrt::DependencyProperty&>(m_dependencyProperty);
00063     }
00064
00065     winrt::DependencyProperty const& Property() const
00066     {
00067         return reinterpret_cast<winrt::DependencyProperty const&>(m_dependencyProperty);
00068     }
00069
00070     IUnknown* m_dependencyProperty{};
00071 };
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

VectorOptions< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > Member List

This is the complete list of members for VectorOptions< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef >, including all inherited members.
Bindable | VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > | [static]
DependencyObjectBase | VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > | [static]
NoTrackRef | VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > | [static]
Observable | VectorOptionsBase< T, isObservable, isBindable, isDependencyObjectBase, isNoTrackerRef > | [static]
Generated on Sun Dec 1 2024 20:53:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressRing/ProgressRing.cpp Source File

  • ProgressRing

ProgressRing.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ProgressRing.h"
00007 #include "ProgressRingAutomationPeer.h"
00008 #include "RuntimeProfiler.h"
00009 #include "ResourceAccessor.h"
00010 #include "math.h"
00011
00012 static constexpr wstring_view s_LayoutRootName{ L"LayoutRoot"sv };
00013 static constexpr wstring_view s_LottiePlayerName{ L"LottiePlayer"sv };
00014 static constexpr wstring_view s_DefaultForegroundThemeResourceName{ L"SystemControlHighlightAccentBrush"sv };
00015 static constexpr wstring_view s_DefaultBackgroundThemeResourceName{ L"SystemControlBackgroundBaseLowBrush"sv };
00016 static constexpr wstring_view s_ForegroundName{ L"Foreground"sv };
00017 static constexpr wstring_view s_BackgroundName{ L"Background"sv };
00018 static constexpr wstring_view s_ActiveStateName{ L"Active"sv };
00019 static constexpr wstring_view s_DeterminateActiveStateName{ L"DeterminateActive"sv };
00020 static constexpr wstring_view s_InactiveStateName{ L"Inactive"sv };
00021
00022 ProgressRing::ProgressRing()
00023 {
00024     __RP_Marker_ClassById(RuntimeProfiler::ProfId_ProgressRing);
00025
00026     SetDefaultStyleKey(this);
00027
00028     RegisterPropertyChangedCallback(winrt::Control::ForegroundProperty(), { this, &ProgressRing::OnForegroundPropertyChanged });
00029     RegisterPropertyChangedCallback(winrt::Control::BackgroundProperty(), { this, &ProgressRing::OnBackgroundPropertyChanged });
00030
00031     SetValue(s_TemplateSettingsProperty, winrt::make<::ProgressRingTemplateSettings>());
00032
00033     SizeChanged({ this, &ProgressRing::OnSizeChanged });
00034     Loaded({ this, &ProgressRing::OnLoaded });
00035 }
00036
00037 winrt::AutomationPeer ProgressRing::OnCreateAutomationPeer()
00038 {
00039     return winrt::make<ProgressRingAutomationPeer>(*this);
00040 }
00041
00042 void ProgressRing::OnApplyTemplate()
00043 {
00044     winrt::IControlProtected controlProtected{ *this };
00045
00046     m_layoutRoot.set(GetTemplateChildT<winrt::Grid>(s_LayoutRootName, controlProtected));
00047     m_player.set(GetTemplateChildT<winrt::AnimatedVisualPlayer>(s_LottiePlayerName, controlProtected));
00048
00049     SetAnimatedVisualPlayerSource();
00050     UpdateLottieProgress();
00051     UpdateStates();
00052 }
00053
00054 void ProgressRing::OnDeterminateSourcePropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args)
00055 {
00056     SetAnimatedVisualPlayerSource();
00057 }
00058
00059 void ProgressRing::OnIndeterminateSourcePropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args)
00060 {
00061     SetAnimatedVisualPlayerSource();
00062 }
00063
00064 void ProgressRing::OnSizeChanged(const winrt::IInspectable&, const winrt::IInspectable&)
00065 {
00066     ApplyTemplateSettings();
00067 }
00068
00069 void ProgressRing::OnLoaded(const winrt::IInspectable&, const winrt::IInspectable&)
00070 {
00071     UpdateStates();
00072 }
00073
00074 void ProgressRing::OnForegroundPropertyChanged(const winrt::DependencyObject&, const winrt::DependencyProperty&)
00075 {
00076     if (const auto foreground = Foreground().try_as<winrt::SolidColorBrush>())
00077     {
00078         m_foregroundColorPropertyChangedRevoker = RegisterPropertyChanged(foreground, winrt::SolidColorBrush::ColorProperty(), { this, &ProgressRing::OnForegroundColorPropertyChanged });
00079     }
00080
00081     OnForegroundColorPropertyChanged(nullptr, nullptr);
00082 }
00083
00084 void ProgressRing::OnForegroundColorPropertyChanged(const winrt::DependencyObject&, const winrt::DependencyProperty&)
00085 {
00086     if (auto&& player = m_player.get())
00087     {
00088         if (auto const progressRingAnimation = player.Source())
00089         {
00090             if (IsIndeterminate())
00091             {
00092                 if (!IndeterminateSource())
00093                 {
00094                     SetLottieForegroundColor(progressRingAnimation);
00095                 }
00096             }
00097             else
00098             {
00099                 if (!DeterminateSource())
00100                 {
00101                     SetLottieForegroundColor(progressRingAnimation);
00102                 }
00103             }
00104         }
00105     }
00106 }
00107
00108 void ProgressRing::OnBackgroundPropertyChanged(const winrt::DependencyObject&, const winrt::DependencyProperty&)
00109 {
00110     if (const auto background = Background().try_as<winrt::SolidColorBrush>())
00111     {
00112         m_backgroundColorPropertyChangedRevoker = RegisterPropertyChanged(background, winrt::SolidColorBrush::ColorProperty(), { this, &ProgressRing::OnBackgroundColorPropertyChanged });
00113     }
00114
00115     OnBackgroundColorPropertyChanged(nullptr, nullptr);
00116 }
00117
00118 void ProgressRing::OnBackgroundColorPropertyChanged(const winrt::DependencyObject&, const winrt::DependencyProperty&)
00119 {
00120     if (auto&& player = m_player.get())
00121     {
00122         if (auto const progressRingAnimation = player.Source())
00123         {
00124             if (IsIndeterminate())
00125             {
00126                 if (!IndeterminateSource())
00127                 {
00128                     SetLottieBackgroundColor(progressRingAnimation);
00129                 }
00130             }
00131             else
00132             {
00133                 if (!DeterminateSource())
00134                 {
00135                     SetLottieBackgroundColor(progressRingAnimation);
00136                 }
00137             }
00138         }
00139     }
00140 }
00141
00142 void ProgressRing::OnIsActivePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00143 {
00144     UpdateStates();
00145 }
00146
00147 void ProgressRing::OnIsIndeterminatePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00148 {
00149     UpdateStates();
00150 }
00151
00152
00153 void ProgressRing::OnValuePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00154 {
00155     if (!m_rangeBasePropertyUpdating)
00156     {
00157         auto scopeGuard = gsl::finally([this]()
00158             {
00159                 m_rangeBasePropertyUpdating = false;
00160             });
00161         m_rangeBasePropertyUpdating = true;
00162
00163         CoerceValue();
00164
00165         if (!IsIndeterminate())
00166         {
00167             UpdateLottieProgress();
00168         }
00169     }
00170 }
00171
00172 void ProgressRing::OnMaximumPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00173 {
00174     if (!m_rangeBasePropertyUpdating)
00175     {
00176         auto scopeGuard = gsl::finally([this]()
00177             {
00178                 m_rangeBasePropertyUpdating = false;
00179             });
00180         m_rangeBasePropertyUpdating = true;
00181
00182         CoerceMinimum();
00183         CoerceValue();
00184
00185         if (!IsIndeterminate())
00186         {
00187             UpdateLottieProgress();
00188         }
00189     }
00190 }
00191
00192 void ProgressRing::OnMinimumPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00193 {
00194     if (!m_rangeBasePropertyUpdating)
00195     {
00196         auto scopeGuard = gsl::finally([this]()
00197             {
00198                 m_rangeBasePropertyUpdating = false;
00199             });
00200         m_rangeBasePropertyUpdating = true;
00201
00202         CoerceMaximum();
00203         CoerceValue();
00204
00205         if (!IsIndeterminate())
00206         {
00207             UpdateLottieProgress();
00208         }
00209     }
00210 }
00211
00212 void ProgressRing::SetAnimatedVisualPlayerSource()
00213 {
00214     if (auto&& player = m_player.get())
00215     {
00216         if (IsIndeterminate())
00217         {
00218             // Check if custom indeterminate animation source is set.
00219             if (!IndeterminateSource())
00220             {
00221                 // Set default indeterminate animation source.
00222                 player.Source(winrt::make<AnimatedVisuals::ProgressRingIndeterminate>());
00223
00224                 if (const auto progressRingAnimation = player.Source())
00225                 {
00226                     SetLottieForegroundColor(progressRingAnimation);
00227                     SetLottieBackgroundColor(progressRingAnimation);
00228                 }
00229             }
00230             else
00231             {
00232                 // Set custom indeterminate animation source.
00233                 player.Source(IndeterminateSource());
00234             }
00235         }
00236         else
00237         {
00238             // Check if custom determinate animation source is set.
00239             if (!DeterminateSource())
00240             {
00241                 // Set default determinate animation source.
00242                 player.Source(winrt::make<AnimatedVisuals::ProgressRingDeterminate>());
00243
00244                 if (const auto progressRingAnimation = player.Source())
00245                 {
00246                     SetLottieForegroundColor(progressRingAnimation);
00247                     SetLottieBackgroundColor(progressRingAnimation);
00248                 }
00249             }
00250             else
00251             {
00252                 // Set custom determinate animation source.
00253                 player.Source(DeterminateSource());
00254             }
00255         }
00256     }
00257 }
00258
00259 void ProgressRing::SetLottieForegroundColor(const winrt::IAnimatedVisualSource animatedVisualSource)
00260 {
00261     const auto compositor = winrt::CompositionTarget::GetCompositorForCurrentThread();
00262
00263     const auto foregroundColor = [foreground = Foreground().try_as<winrt::SolidColorBrush>()]()
00264     {
00265         if (foreground)
00266         {
00267             return foreground.Color();
00268         }
00269         else
00270         {
00271             // Default color fallback if Foreground() Brush does not contain SolidColorBrush with Color property.
00272             return SharedHelpers::FindInApplicationResources(s_DefaultForegroundThemeResourceName).as<winrt::SolidColorBrush>().Color();
00273         }
00274     }();
00275
00276     if (const auto progressRingAnimation = animatedVisualSource.try_as<AnimatedVisuals::ProgressRingIndeterminate>())
00277     {
00278         progressRingAnimation->GetThemeProperties(compositor).InsertVector4(s_ForegroundName, SharedHelpers::RgbaColor(foregroundColor));
00279     }
00280 }
00281
00282 void ProgressRing::SetLottieBackgroundColor(const winrt::IAnimatedVisualSource animatedVisualSource)
00283 {
00284     const auto compositor = winrt::CompositionTarget::GetCompositorForCurrentThread();
00285
00286     const auto backgroundColor = [background = Background().try_as<winrt::SolidColorBrush>()]()
00287     {
00288         if (background)
00289         {
00290             return background.Color();
00291         }
00292         else
00293         {
00294              //Default color fallback if Background() Brush does not contain SolidColorBrush with Color property.
00295             return SharedHelpers::FindInApplicationResources(s_DefaultBackgroundThemeResourceName).as<winrt::SolidColorBrush>().Color();
00296         }
00297     }();
00298
00299     if (const auto progressRingAnimation = animatedVisualSource.try_as<AnimatedVisuals::ProgressRingIndeterminate>())
00300     {
00301         progressRingAnimation->GetThemeProperties(compositor).InsertVector4(s_BackgroundName, SharedHelpers::RgbaColor(backgroundColor));
00302     }
00303 }
00304
00305 void ProgressRing::UpdateLottieProgress()
00306 {
00307     if (auto&& player = m_player.get())
00308     {
00309         const double value = Value();
00310         const double min = Minimum();
00311         const double range = Maximum() - min;
00312         const double fromProgress = (m_oldValue - min) / range;
00313         const double toProgress = (value - min) / range;
00314         if (fromProgress < toProgress)
00315         {
00316             const auto _ = player.PlayAsync(fromProgress, toProgress, false);
00317         }
00318         else
00319         {
00320             player.SetProgress(toProgress);
00321         }
00322
00323         m_oldValue = value;
00324     }
00325 }
00326
00327 void ProgressRing::UpdateStates()
00328 {
00329     if (IsActive())
00330     {
00331         if (IsIndeterminate())
00332         {
00333             winrt::VisualStateManager::GoToState(*this, s_ActiveStateName, true);
00334
00335             // Swap player source to indeterminate.
00336             SetAnimatedVisualPlayerSource();
00337
00338             if (auto&& player = m_player.get())
00339             {
00340                 const auto _ = player.PlayAsync(0, 1, true);
00341             }
00342         }
00343         else
00344         {
00345             winrt::VisualStateManager::GoToState(*this, s_DeterminateActiveStateName, true);
00346
00347             // Swap player source to determinate.
00348             SetAnimatedVisualPlayerSource();
00349             UpdateLottieProgress();
00350         }
00351         winrt::AutomationProperties::SetAccessibilityView(*this, winrt::AccessibilityView::Content);
00352     }
00353     else
00354     {
00355         winrt::VisualStateManager::GoToState(*this, s_InactiveStateName, true);
00356
00357         if (auto&& player = m_player.get())
00358         {
00359             player.Stop();
00360         }
00361
00362         winrt::AutomationProperties::SetAccessibilityView(*this, winrt::AccessibilityView::Raw);
00363     }
00364 }
00365
00366 void ProgressRing::ApplyTemplateSettings()
00367 {
00368     // TemplateSetting properties from WUXC for backwards compatibility.
00369     const auto templateSettings = winrt::get_self<::ProgressRingTemplateSettings>(TemplateSettings());
00370
00371     const auto [width, diameterValue, anchorPoint] = [this]()
00372     {
00373         if (this->ActualWidth())
00374         {
00375             const float width = static_cast<float>(this->ActualWidth());
00376
00377             const auto diameterAdditive = [width]()
00378             {
00379                 if (width <= 40.0f)
00380                 {
00381                     return 1.0f;
00382                 }
00383                 return 0.0f;
00384             }();
00385
00386             const float diamaterValue = (width * 0.1f) + diameterAdditive;
00387             const float anchorPoint = (width * 0.5f) - diamaterValue;
00388             return std::make_tuple(width, diamaterValue, anchorPoint);
00389         }
00390
00391         return std::make_tuple(0.0f, 0.0f, 0.0f);
00392     }();
00393
00394     templateSettings->EllipseDiameter(diameterValue);
00395
00396     const winrt::Thickness thicknessEllipseOffset = { 0, anchorPoint, 0, 0 };
00397
00398     templateSettings->EllipseOffset(thicknessEllipseOffset);
00399     templateSettings->MaxSideLength(width);
00400 }
00401
00402 void ProgressRing::CoerceMinimum()
00403 {
00404     const auto max = Maximum();
00405     if (Minimum() > max)
00406     {
00407         Minimum(max);
00408     }
00409 }
00410
00411 void ProgressRing::CoerceMaximum()
00412 {
00413     const auto min = Minimum();
00414     if (Maximum() < min)
00415     {
00416         Maximum(min);
00417     }
00418 }
00419
00420 void ProgressRing::CoerceValue()
00421 {
00422     // Validate that the value is in bounds
00423     const auto value = Value();
00424     if (!std::isnan(value) && !IsInBounds(value))
00425     {
00426         // Coerce value to be within range
00427         const auto max = Maximum();
00428         if (value > max)
00429         {
00430             Value(max);
00431         }
00432         else
00433         {
00434             Value(Minimum());
00435         }
00436     }
00437 }
00438
00439 bool ProgressRing::IsInBounds(double value)
00440 {
00441     return (value >= Minimum() && value <= Maximum());
00442 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommandBarFlyout/CommandBarFlyoutCommandBarAutomationProperties.h Source File

  • CommandBarFlyout

CommandBarFlyoutCommandBarAutomationProperties.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "CommandBarFlyoutCommandBarAutomationProperties.g.h"
00007 #include "CommandBarFlyoutCommandBarAutomationProperties.properties.h"
00008
00009 class CommandBarFlyoutCommandBarAutomationProperties :
00010     public CommandBarFlyoutCommandBarAutomationPropertiesProperties
00011 {
00012 public:
00013     static void OnControlTypePropertyChanged(
00014         const winrt::DependencyObject& sender,
00015         const winrt::DependencyPropertyChangedEventArgs& args);
00016 };
00017
00018 class CommandBarFlyoutCommandBarAutomationPropertiesFactory :
00019     public winrt::factory_implementation::CommandBarFlyoutCommandBarAutomationPropertiesT<CommandBarFlyoutCommandBarAutomationPropertiesFactory, CommandBarFlyoutCommandBarAutomationProperties>
00020 {
00021 };
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ZoomSnapPoint.h Source File

  • ScrollPresenter

ZoomSnapPoint.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SnapPoint.h"
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SelectorBar/SelectorBarTrace.h Source File

  • SelectorBar

SelectorBarTrace.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007 #include "MuxcTraceLogging.h"
00008 #include "Utils.h"
00009 #include "MUXControlsTestHooks.h"
00010
00011 inline bool IsSelectorBarTracingEnabled()
00012 {
00013     return g_IsLoggingProviderEnabled &&
00014         g_LoggingProviderLevel >= WINEVENT_LEVEL_INFO &&
00015         (g_LoggingProviderMatchAnyKeyword & KEYWORD_SELECTORBAR || g_LoggingProviderMatchAnyKeyword == 0);
00016 }
00017
00018 inline bool IsSelectorBarVerboseTracingEnabled()
00019 {
00020     return g_IsLoggingProviderEnabled &&
00021         g_LoggingProviderLevel >= WINEVENT_LEVEL_VERBOSE &&
00022         (g_LoggingProviderMatchAnyKeyword & KEYWORD_SELECTORBAR || g_LoggingProviderMatchAnyKeyword == 0);
00023 }
00024
00025 inline bool IsSelectorBarPerfTracingEnabled()
00026 {
00027     return g_IsPerfProviderEnabled &&
00028         g_PerfProviderLevel >= WINEVENT_LEVEL_INFO &&
00029         (g_PerfProviderMatchAnyKeyword & KEYWORD_SELECTORBAR || g_PerfProviderMatchAnyKeyword == 0);
00030 }
00031
00032 #define SELECTORBAR_TRACE_INFO_ENABLED(includeTraceLogging, sender, message, ...) \
00033 SelectorBarTrace::TraceInfo(includeTraceLogging, sender, message, __VA_ARGS__); \
00034
00035 #define SELECTORBAR_TRACE_INFO(sender, message, ...) \
00036 if (IsSelectorBarTracingEnabled()) \
00037 { \
00038     SELECTORBAR_TRACE_INFO_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00039 } \
00040 else if (SelectorBarTrace::s_IsDebugOutputEnabled || SelectorBarTrace::s_IsVerboseDebugOutputEnabled) \
00041 { \
00042     SELECTORBAR_TRACE_INFO_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00043 } \
00044
00045 #define SELECTORBAR_TRACE_VERBOSE_ENABLED(includeTraceLogging, sender, message, ...) \
00046 SelectorBarTrace::TraceVerbose(includeTraceLogging, sender, message, __VA_ARGS__); \
00047
00048 #define SELECTORBAR_TRACE_VERBOSE(sender, message, ...) \
00049 if (IsSelectorBarVerboseTracingEnabled()) \
00050 { \
00051     SELECTORBAR_TRACE_VERBOSE_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00052 } \
00053 else if (SelectorBarTrace::s_IsVerboseDebugOutputEnabled) \
00054 { \
00055     SELECTORBAR_TRACE_VERBOSE_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00056 } \
00057
00058 #define SELECTORBAR_TRACE_PERF(info) \
00059 if (IsSelectorBarPerfTracingEnabled()) \
00060 { \
00061     SelectorBarTrace::TracePerfInfo(info); \
00062 } \
00063
00064 #ifdef DBG
00065 #define SELECTORBAR_TRACE_INFO_DBG(sender, message, ...)    SELECTORBAR_TRACE_INFO(sender, message, __VA_ARGS__)
00066 #define SELECTORBAR_TRACE_VERBOSE_DBG(sender, message, ...) SELECTORBAR_TRACE_VERBOSE(sender, message, __VA_ARGS__)
00067 #define SELECTORBAR_TRACE_PERF_DBG(info)                    SELECTORBAR_TRACE_PERF(info)
00068 #else
00069 #define SELECTORBAR_TRACE_INFO_DBG(sender, message, ...)
00070 #define SELECTORBAR_TRACE_VERBOSE_DBG(sender, message, ...)
00071 #define SELECTORBAR_TRACE_PERF_DBG(info)
00072 #endif // DBG
00073
00074 class SelectorBarTrace
00075 {
00076 public:
00077     static bool s_IsDebugOutputEnabled;
00078     static bool s_IsVerboseDebugOutputEnabled;
00079
00080     static void TraceInfo(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept
00081     {
00082         va_list args;
00083         va_start(args, message);
00084         WCHAR buffer[256]{};
00085         if (SUCCEEDED(StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args)))
00086         {
00087             if (includeTraceLogging)
00088             {
00089                 // TraceViewers
00090                 // http://toolbox/pef
00091                 // http://fastetw/index.aspx
00092                 TraceLoggingWrite(
00093                     g_hLoggingProvider,
00094                     "SelectorBarInfo" /* eventName */,
00095                     TraceLoggingLevel(WINEVENT_LEVEL_INFO),
00096                     TraceLoggingKeyword(KEYWORD_SELECTORBAR),
00097                     TraceLoggingWideString(buffer, "Message"));
00098             }
00099
00100             if (s_IsDebugOutputEnabled)
00101             {
00102                 OutputDebugStringW(buffer);
00103             }
00104
00105             com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks();
00106
00107             if (globalTestHooks &&
00108                 (globalTestHooks->GetLoggingLevelForType(L"SelectorBar") >= WINEVENT_LEVEL_INFO || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_INFO))
00109             {
00110                 globalTestHooks->LogMessage(sender, buffer, false /*isVerboseLevel*/);
00111             }
00112         }
00113         va_end(args);
00114     }
00115
00116     static void TraceVerbose(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept
00117     {
00118         va_list args;
00119         va_start(args, message);
00120         WCHAR buffer[256]{};
00121         if (SUCCEEDED(StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args)))
00122         {
00123             if (includeTraceLogging)
00124             {
00125                 // TraceViewers
00126                 // http://toolbox/pef
00127                 // http://fastetw/index.aspx
00128                 TraceLoggingWrite(
00129                     g_hLoggingProvider,
00130                     "SelectorBarVerbose" /* eventName */,
00131                     TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
00132                     TraceLoggingKeyword(KEYWORD_SELECTORBAR),
00133                     TraceLoggingWideString(buffer, "Message"));
00134             }
00135
00136             if (s_IsDebugOutputEnabled || s_IsVerboseDebugOutputEnabled)
00137             {
00138                 OutputDebugStringW(buffer);
00139             }
00140
00141             com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks();
00142
00143             if (globalTestHooks &&
00144                 (globalTestHooks->GetLoggingLevelForType(L"SelectorBar") >= WINEVENT_LEVEL_VERBOSE || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_VERBOSE))
00145             {
00146                 globalTestHooks->LogMessage(sender, buffer, true /*isVerboseLevel*/);
00147             }
00148         }
00149         va_end(args);
00150     }
00151
00152     static void TracePerfInfo(PCWSTR info) noexcept
00153     {
00154         // TraceViewers
00155         // http://toolbox/pef
00156         // http://fastetw/index.aspx
00157         TraceLoggingWrite(
00158             g_hPerfProvider,
00159             "SelectorBarPerf" /* eventName */,
00160             TraceLoggingLevel(WINEVENT_LEVEL_INFO),
00161             TraceLoggingKeyword(KEYWORD_SELECTORBAR),
00162             TraceLoggingWideString(info, "Info"));
00163     }
00164 };
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TwoPaneViewTests Member List

This is the complete list of members for TwoPaneViewTests, including all inherited members.
c_controlMargin_bottom | TwoPaneViewTests | [private]
c_controlMargin_left | TwoPaneViewTests | [private]
c_controlMargin_right | TwoPaneViewTests | [private]
c_controlMargin_top | TwoPaneViewTests | [private]
c_defaultMinTallModeHeight | TwoPaneViewTests | [private]
c_defaultMinWideModeWidth | TwoPaneViewTests | [private]
c_simulatedMiddle | TwoPaneViewTests | [private]
c_simulatedPaneHeight | TwoPaneViewTests | [private]
c_simulatedPaneWidth | TwoPaneViewTests | [private]
ClassInitialize(TestContext testContext) | TwoPaneViewTests | [inline, static]
ControlHeight enum name | TwoPaneViewTests | [private]
ControlWidth enum name | TwoPaneViewTests | [private]
GetInt(string textBlockName) | TwoPaneViewTests | [inline, private]
InitialPanePriorityTest() | TwoPaneViewTests | [inline]
PaneLengthTest() | TwoPaneViewTests | [inline]
PanePriority enum name | TwoPaneViewTests | [private]
RegionOffsetTest() | TwoPaneViewTests | [inline]
RegionTest() | TwoPaneViewTests | [inline]
SetComboBox(string comboBoxName, string item) | TwoPaneViewTests | [inline, private]
SetControlHeight(ControlHeight height) | TwoPaneViewTests | [inline, private]
SetControlWidth(ControlWidth width) | TwoPaneViewTests | [inline, private]
SetLength(int pane, double value, string type) | TwoPaneViewTests | [inline, private]
SetMinTallModeHeight(double height) | TwoPaneViewTests | [inline, private]
SetMinWideModeWidth(double width) | TwoPaneViewTests | [inline, private]
SetPanePriority(PanePriority priority) | TwoPaneViewTests | [inline, private]
SetTallModeConfiguration(TallModeConfiguration behavior) | TwoPaneViewTests | [inline, private]
SetWideModeConfiguration(WideModeConfiguration behavior) | TwoPaneViewTests | [inline, private]
SingleRegionTest() | TwoPaneViewTests | [inline]
TallModeConfiguration enum name | TwoPaneViewTests | [private]
TestCleanup() | TwoPaneViewTests | [inline]
ThresholdTest() | TwoPaneViewTests | [inline]
TwoPaneViewMode enum name | TwoPaneViewTests | [private]
VerifyIsPrettyClose(int a, int b, string info) | TwoPaneViewTests | [inline, private]
VerifyPaneSize(int paneIndex, double width, double height) | TwoPaneViewTests | [inline, private]
VerifyPaneSpacing(double spacing) | TwoPaneViewTests | [inline, private]
VerifyTabKeyWorks() | TwoPaneViewTests | [inline]
VerifyViewMode(ViewMode mode) | TwoPaneViewTests | [inline, private]
ViewMode enum name | TwoPaneViewTests | [private]
ViewModeTest() | TwoPaneViewTests | [inline]
WideModeConfiguration enum name | TwoPaneViewTests | [private]
Generated on Sun Dec 1 2024 20:53:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/SelectorBarItem.properties.h Source File

  • Generated

SelectorBarItem.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class SelectorBarItemProperties
00008 {
00009 public:
00010     SelectorBarItemProperties();
00011
00012     void Icon(winrt::IconElement const& value);
00013     winrt::IconElement Icon();
00014
00015     void Text(winrt::hstring const& value);
00016     winrt::hstring Text();
00017
00018     static winrt::DependencyProperty IconProperty() { return s_IconProperty; }
00019     static winrt::DependencyProperty TextProperty() { return s_TextProperty; }
00020
00021     static GlobalDependencyProperty s_IconProperty;
00022     static GlobalDependencyProperty s_TextProperty;
00023
00024     static void EnsureProperties();
00025     static void ClearProperties();
00026
00027     static void OnIconPropertyChanged(
00028         winrt::DependencyObject const& sender,
00029         winrt::DependencyPropertyChangedEventArgs const& args);
00030
00031     static void OnTextPropertyChanged(
00032         winrt::DependencyObject const& sender,
00033         winrt::DependencyPropertyChangedEventArgs const& args);
00034 };
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

FlowLayoutDerived Member List

This is the complete list of members for FlowLayoutDerived, including all inherited members.
abi_enter() | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
Algorithm_GetAnchorForRealizationRect(const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context) override | FlowLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetAnchorForRealizationRect(const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_GetAnchorForTargetElement(int targetIndex, const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context) override | FlowLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetAnchorForTargetElement(int targetIndex, const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_GetExtent(const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context, const winrt::UIElement &firstRealized, int firstRealizedItemIndex, const winrt::Rect &firstRealizedLayoutBounds, const winrt::UIElement &lastRealized, int lastRealizedItemIndex, const winrt::Rect &lastRealizedLayoutBounds) override | FlowLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetExtent(const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context, const winrt::UIElement &firstRealized, int firstRealizedItemIndex, const winrt::Rect &firstRealizedLayoutBounds, const winrt::UIElement &lastRealized, int lastRealizedItemIndex, const winrt::Rect &lastRealizedLayoutBounds)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_GetMeasureSize(int index, const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context) override | FlowLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetMeasureSize(int index, const winrt::Size &availableSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_GetProvisionalArrangeSize(int index, const winrt::Size &measureSize, winrt::Size const &desiredSize, const winrt::VirtualizingLayoutContext &context) override | FlowLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_GetProvisionalArrangeSize(int index, const winrt::Size &measureSize, winrt::Size const &desiredSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_OnElementMeasured(const winrt::UIElement &element, const int index, const winrt::Size &availableSize, const winrt::Size &measureSize, const winrt::Size &desiredSize, const winrt::Size &provisionalArrangeSize, const winrt::VirtualizingLayoutContext &context) override | FlowLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_OnElementMeasured(const winrt::UIElement &element, int index, const winrt::Size &availableSize, const winrt::Size &measureSize, const winrt::Size &desiredSize, const winrt::Size &provisionalArrangeSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_OnLineArranged(int startIndex, int countInLine, double lineSize, const winrt::VirtualizingLayoutContext &context) override | FlowLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_OnLineArranged(int startIndex, int countInLine, double lineSize, const winrt::VirtualizingLayoutContext &context)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
Algorithm_ShouldBreakLine(int index, double remainingSpace) override | FlowLayout |
IFlowLayoutAlgorithmDelegates::Algorithm_ShouldBreakLine(int index, double remainingSpace)=0 | IFlowLayoutAlgorithmDelegates | [pure virtual]
ArrangeLayoutFunc | FlowLayoutDerived |
ArrangeOverride(VirtualizingLayoutContext context, Size finalSize) | FlowLayoutDerived | [inline, protected]
FlowLayout::ArrangeOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &finalSize) | FlowLayout |
CheckThread() | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
ClearProperties() | FlowLayoutProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< FlowLayout > &&self) noexcept | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline, static]
EnsureProperties() | FlowLayoutProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
final_release(std::unique_ptr< FlowLayout > &&self) | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline, static]
FlowLayout() | FlowLayout |
FlowLayoutProperties() | FlowLayoutProperties |
GetAnchorForRealizationRect(Size availableSize, VirtualizingLayoutContext context) | FlowLayoutDerived | [inline, protected]
FlowLayout::GetAnchorForRealizationRect(winrt::Size const &availableSize, winrt::VirtualizingLayoutContext const &context) | FlowLayout |
GetAnchorForRealizationRectFunc | FlowLayoutDerived |
GetAnchorForTargetElement(int targetIndex, Size availableSize, VirtualizingLayoutContext context) | FlowLayoutDerived | [inline, protected]
FlowLayout::GetAnchorForTargetElement(int targetIndex, winrt::Size const &availableSize, winrt::VirtualizingLayoutContext const &context) | FlowLayout |
GetAnchorForTargetElementFunc | FlowLayoutDerived |
GetBase() | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
GetExtent(Size availableSize, VirtualizingLayoutContext context, UIElement firstRealized, int firstRealizedItemIndex, Rect firstRealizedLayoutBounds, UIElement lastRealized, int lastRealizedItemIndex, Rect lastRealizedLayoutBounds) | FlowLayoutDerived | [inline, protected]
FlowLayout::GetExtent(winrt::Size const &availableSize, winrt::VirtualizingLayoutContext const &context, winrt::UIElement const &firstRealized, int firstRealizedItemIndex, winrt::Rect const &firstRealizedLayoutBounds, winrt::UIElement const &lastRealized, int lastRealizedItemIndex, winrt::Rect const &lastRealizedLayoutBounds) | FlowLayout |
GetExtentFunc | FlowLayoutDerived |
GetInner() | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
GetMeasureSize(int index, Size availableSize) | FlowLayoutDerived | [inline, protected]
FlowLayout::GetMeasureSize(int index, winrt::Size const &availableSize) | FlowLayout |
GetMeasureSizeFunc | FlowLayoutDerived |
GetProvisionalArrangeSize(int index, Size measureSize, Size desiredSize) | FlowLayoutDerived | [inline, protected]
FlowLayout::GetProvisionalArrangeSize(int index, winrt::Size const &measureSize, winrt::Size const &desiredSize) | FlowLayout |
GetProvisionalArrangeSizeFunc | FlowLayoutDerived |
GetScrollOrientation() const | OrientationBasedMeasures | [inline]
InitializeForContextCore(VirtualizingLayoutContext context) | FlowLayoutDerived | [inline, protected]
FlowLayout::InitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | FlowLayout |
IsOnThread() | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
LineAlignment(winrt::FlowLayoutLineAlignment const &value) | FlowLayoutProperties |
LineAlignment() | FlowLayoutProperties |
LineAlignmentProperty() | FlowLayoutProperties | [inline, static]
Major(const winrt::Size &size) | OrientationBasedMeasures |
MajorEnd(const winrt::Rect &rect) const | OrientationBasedMeasures |
MajorSize(const winrt::Rect &rect) | OrientationBasedMeasures |
MajorStart(const winrt::Rect &rect) | OrientationBasedMeasures |
MeasureLayoutFunc | FlowLayoutDerived |
MeasureOverride(VirtualizingLayoutContext context, Size availableSize) | FlowLayoutDerived | [inline, protected]
FlowLayout::MeasureOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &availableSize) | FlowLayout |
MinColumnSpacing(double value) | FlowLayoutProperties |
MinColumnSpacing() | FlowLayoutProperties |
MinColumnSpacingProperty() | FlowLayoutProperties | [inline, static]
Minor(const winrt::Size &size) | OrientationBasedMeasures |
MinorEnd(const winrt::Rect &rect) const | OrientationBasedMeasures |
MinorMajorPoint(float minor, float major) | OrientationBasedMeasures |
MinorMajorRect(float minor, float major, float minorSize, float majorSize) | OrientationBasedMeasures |
MinorMajorSize(float minor, float major) | OrientationBasedMeasures |
MinorSize(const winrt::Rect &rect) | OrientationBasedMeasures |
MinorStart(const winrt::Rect &rect) | OrientationBasedMeasures |
MinRowSpacing(double value) | FlowLayoutProperties |
MinRowSpacing() | FlowLayoutProperties |
MinRowSpacingProperty() | FlowLayoutProperties | [inline, static]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
OnAttachedFunc | FlowLayoutDerived |
OnDetatchedFunc | FlowLayoutDerived |
OnElementMeasured(UIElement element, int index, Size availableSize, Size measureSize, Size desiredSize, Size provisionalArrangeSize, VirtualizingLayoutContext context) | FlowLayoutDerived | [inline, protected]
FlowLayout::OnElementMeasured(winrt::UIElement const &element, int index, winrt::Size const &availableSize, winrt::Size const &measureSize, winrt::Size const &desiredSize, winrt::Size const &provisionalArrangeSize, winrt::VirtualizingLayoutContext const &context) | FlowLayout |
OnElementMeasuredFunc | FlowLayoutDerived |
OnItemsChangedCore(winrt::VirtualizingLayoutContext const &context, winrt::IInspectable const &source, winrt::NotifyCollectionChangedEventArgs const &args) | FlowLayout |
OnLineAlignmentPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | FlowLayoutProperties | [static]
OnLineArranged(int startIndex, int countInLine, double lineSize, VirtualizingLayoutContext context) | FlowLayoutDerived | [inline, protected]
FlowLayout::OnLineArranged(int startIndex, int countInLine, double lineSize, winrt::VirtualizingLayoutContext const &context) | FlowLayout |
OnLineArrangedFunc | FlowLayoutDerived |
OnMinColumnSpacingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | FlowLayoutProperties | [static]
OnMinRowSpacingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | FlowLayoutProperties | [static]
OnOrientationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | FlowLayoutProperties | [static]
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | FlowLayout |
Orientation(winrt::Orientation const &value) | FlowLayoutProperties |
Orientation() | FlowLayoutProperties |
OrientationProperty() | FlowLayoutProperties | [inline, static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< FlowLayout, winrt::implementation::FlowLayoutT, VirtualizingLayout > | [inline]
s_LineAlignmentProperty | FlowLayoutProperties | [static]
s_MinColumnSpacingProperty | FlowLayoutProperties | [static]
s_MinRowSpacingProperty | FlowLayoutProperties | [static]
s_OrientationProperty | FlowLayoutProperties | [static]
SetScrollOrientation(ScrollOrientation value) | OrientationBasedMeasures | [inline]
ShouldBreakLine(int index, double remainingSpace) | FlowLayoutDerived | [inline, protected]
ShouldBreakLineFunc | FlowLayoutDerived |
UninitializeForContextCore(VirtualizingLayoutContext context) | FlowLayoutDerived | [inline, protected]
FlowLayout::UninitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | FlowLayout |
~IFlowLayoutAlgorithmDelegates() | IFlowLayoutAlgorithmDelegates | [virtual]
Generated on Sun Dec 1 2024 20:53:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InfoBarClosingEventArgs.properties.cpp Source File

  • Generated

InfoBarClosingEventArgs.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InfoBarClosingEventArgs.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(InfoBarClosingEventArgs)
00012 }
00013
00014 #include "InfoBarClosingEventArgs.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewAutomationPeer.h Source File

  • NavigationView

NavigationViewAutomationPeer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "NavigationView.h"
00007 #include "NavigationViewAutomationPeer.g.h"
00008
00009 class NavigationViewAutomationPeer :
00010     public ReferenceTracker<
00011         NavigationViewAutomationPeer,
00012         winrt::implementation::NavigationViewAutomationPeerT,
00013         winrt::ISelectionProvider>
00014 {
00015 public:
00016     NavigationViewAutomationPeer(winrt::NavigationView const& owner);
00017
00018     // IAutomationPeerOverrides
00019     winrt::IInspectable GetPatternCore(winrt::PatternInterface const& patternInterface);
00020
00021     // ISelectionProvider
00022     bool CanSelectMultiple();
00023     bool IsSelectionRequired();
00024     winrt::com_array<winrt::Microsoft::UI::Xaml::Automation::Provider::IRawElementProviderSimple> GetSelection();
00025
00026     void RaiseSelectionChangedEvent(winrt::IInspectable const& oldSelection, winrt::IInspectable const& newSelection);
00027
00028 private:
00029 };
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DataItem Member List

This is the complete list of members for DataItem, including all inherited members.
DataItem(string text, int number) | DataItem | [inline]
Number | DataItem |
Text | DataItem |
Generated on Sun Dec 1 2024 20:54:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

BlendEffect Member List

This is the complete list of members for BlendEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1Blend) | BlendEffect |
DECLARE_DUAL_SOURCES(Background, Foreground) | BlendEffect |
DECLARE_NAMED_PROPERTY_MAPPING({L"Mode", D2D1_BLEND_PROP_MODE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT}) | BlendEffect |
DECLARE_POD_PROPERTY(Mode, winrt::BlendEffectMode, winrt::BlendEffectMode::Multiply, true) | BlendEffect |
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | BlendEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | BlendEffect | [inline]
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterAutomationPeer.idl Source File

  • ScrollPresenter

ScrollPresenterAutomationPeer.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XAP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC_V7]
00005 [webhosthidden]
00006 unsealed runtimeclass ScrollPresenterAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer
00007 {
00008     ScrollPresenterAutomationPeer(MU_XCP_NAMESPACE.ScrollPresenter owner);
00009 }
00010
00011 }
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InfoBarTests Member List

This is the complete list of members for InfoBarTests, including all inherited members.
AccessibilityViewTest() | InfoBarTests | [inline]
Check(string checkboxName) | InfoBarTests | [inline, private]
ClassInitialize(TestContext testContext) | InfoBarTests | [inline, static]
CloseTest() | InfoBarTests | [inline]
FindCloseButton(UIObject parent) | InfoBarTests | [inline, private]
IsClosableTest() | InfoBarTests | [inline]
LayoutTest() | InfoBarTests | [inline]
TestCleanup() | InfoBarTests | [inline]
Uncheck(string checkboxName) | InfoBarTests | [inline, private]
VerifyAxeScanPasses() | InfoBarTests | [inline]
VerifyIsPrettyClose(int a, int b, string message) | InfoBarTests | [inline, private]
Generated on Sun Dec 1 2024 20:53:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollInputHelper Member List

This is the complete list of members for ScrollInputHelper, including all inherited members.
ComputeHorizontalContentAlignment() const | ScrollInputHelper | [private]
ComputeVerticalContentAlignment() const | ScrollInputHelper | [private]
ComputeZoomMode() const | ScrollInputHelper | [private]
EnsureInternalSourcePropertySetAndExpressionAnimations() | ScrollInputHelper | [private]
GetChildScrollPresenterOrScrollViewer(const winrt::DependencyObject &rootElement, _Out_ winrt::ScrollPresenter *scrollPresenter, _Out_ winrt::FxScrollViewer *scrollViewer) | ScrollInputHelper | [private, static]
GetContentSize(winrt::Orientation orientation) const | ScrollInputHelper |
GetEffectiveHorizontalAlignment() const | ScrollInputHelper | [private]
GetEffectiveVerticalAlignment() const | ScrollInputHelper | [private]
GetEffectiveZoomMode() const | ScrollInputHelper | [private]
GetMaxOverpanOffset(winrt::Orientation orientation) const | ScrollInputHelper |
GetMaxUnderpanOffset(winrt::Orientation orientation) const | ScrollInputHelper |
GetOffsetFromScrollContentElement(const winrt::UIElement &element, winrt::Orientation orientation) const | ScrollInputHelper |
GetRichEditBoxParent(const winrt::DependencyObject &childElement) | ScrollInputHelper | [private, static]
GetScrollContentElement() const | ScrollInputHelper | [private]
GetSourceOffsetPropertyName(winrt::Orientation orientation) const | ScrollInputHelper |
GetSourceScalePropertyName() const | ScrollInputHelper |
GetViewportSize(winrt::Orientation orientation) const | ScrollInputHelper |
HookCompositionTargetRendering() | ScrollInputHelper | [private]
HookRichEditBoxTextChanged() | ScrollInputHelper | [private]
HookScrollPresenterContentPropertyChanged() | ScrollInputHelper | [private]
HookScrollPresenterPropertyChanged() | ScrollInputHelper | [private]
HookScrollViewerContentPropertyChanged() | ScrollInputHelper | [private]
HookScrollViewerDirectManipulationCompleted() | ScrollInputHelper | [private]
HookScrollViewerDirectManipulationStarted() | ScrollInputHelper | [private]
HookScrollViewerPropertyChanged() | ScrollInputHelper | [private]
HookSourceControlTemplateChanged() | ScrollInputHelper | [private]
HookSourceElementLoaded() | ScrollInputHelper | [private]
HookTargetElementLoaded() | ScrollInputHelper | [private]
IsScrollContentPresenterIScrollInfoProvider() const | ScrollInputHelper | [private]
IsTargetElementInSource() const | ScrollInputHelper |
m_infoChangedFunction | ScrollInputHelper | [private]
m_owner | ScrollInputHelper | [private]
OnCompositionTargetRendering(const winrt::IInspectable &sender, const winrt::IInspectable &args) | ScrollInputHelper | [private]
OnRichEditBoxTextChanged(const winrt::IInspectable &sender, const winrt::RoutedEventArgs &args) | ScrollInputHelper | [private]
OnScrollPresenterPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | ScrollInputHelper | [private]
OnScrollViewerContentPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | ScrollInputHelper | [private]
OnScrollViewerDirectManipulationCompleted(const winrt::IInspectable &sender, const winrt::IInspectable &args) | ScrollInputHelper | [private]
OnScrollViewerDirectManipulationStarted(const winrt::IInspectable &sender, const winrt::IInspectable &args) | ScrollInputHelper | [private]
OnScrollViewerPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | ScrollInputHelper | [private]
OnSourceContentSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &args) | ScrollInputHelper | [private]
OnSourceElementChanged(bool allowSourceElementLoadedHookup) | ScrollInputHelper | [private]
OnSourceElementLoaded(const winrt::IInspectable &sender, const winrt::RoutedEventArgs &args) | ScrollInputHelper | [private]
OnSourceElementPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | ScrollInputHelper | [private]
OnSourceInfoChanged(bool horizontalInfoChanged, bool verticalInfoChanged, bool zoomInfoChanged) | ScrollInputHelper | [private]
OnSourceSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &args) | ScrollInputHelper | [private]
OnTargetElementChanged() | ScrollInputHelper | [private]
OnTargetElementLoaded(const winrt::IInspectable &sender, const winrt::RoutedEventArgs &args) | ScrollInputHelper | [private]
ProcessContentSizeChange() | ScrollInputHelper | [private]
ProcessScrollPresenterContentChange() | ScrollInputHelper | [private]
ProcessScrollViewerContentChange() | ScrollInputHelper | [private]
ProcessScrollViewerZoomModeChange() | ScrollInputHelper | [private]
ProcessSourceControlTemplateChange() | ScrollInputHelper | [private]
ProcessSourceElementChange(bool allowSourceElementLoadedHookup) | ScrollInputHelper | [private]
ProcessTargetElementChange() | ScrollInputHelper | [private]
s_horizontalOffsetPropertyName | ScrollInputHelper | [private, static]
s_scalePropertyName | ScrollInputHelper | [private, static]
s_verticalOffsetPropertyName | ScrollInputHelper | [private, static]
ScrollInputHelper(const ITrackerHandleManager *owner, std::function< void(bool, bool)> infoChangedFunction) | ScrollInputHelper |
SetScrollPresenter(const winrt::ScrollPresenter &scrollPresenter) | ScrollInputHelper | [private]
SetScrollViewer(const winrt::FxScrollViewer &scrollViewer) | ScrollInputHelper | [private]
SetSourceElement(const winrt::UIElement &sourceElement) | ScrollInputHelper |
SetTargetElement(const winrt::UIElement &targetElement) | ScrollInputHelper |
SourcePropertySet() const | ScrollInputHelper |
StartInternalExpressionAnimations(const winrt::CompositionPropertySet &source) | ScrollInputHelper | [private]
StopInternalExpressionAnimations() | ScrollInputHelper | [private]
TargetElement() const | ScrollInputHelper |
UnhookCompositionTargetRendering() | ScrollInputHelper | [private]
UnhookRichEditBoxTextChanged() | ScrollInputHelper | [private]
UnhookScrollPresenterContentPropertyChanged() | ScrollInputHelper | [private]
UnhookScrollPresenterPropertyChanged() | ScrollInputHelper | [private]
UnhookScrollViewerContentPropertyChanged() | ScrollInputHelper | [private]
UnhookScrollViewerDirectManipulationCompleted() | ScrollInputHelper | [private]
UnhookScrollViewerDirectManipulationStarted() | ScrollInputHelper | [private]
UnhookScrollViewerPropertyChanged() | ScrollInputHelper | [private]
UnhookSourceControlTemplateChanged() | ScrollInputHelper | [private]
UnhookSourceElementLoaded() | ScrollInputHelper | [private]
UnhookTargetElementLoaded() | ScrollInputHelper | [private]
UpdateContentSize() | ScrollInputHelper | [private]
UpdateInternalExpressionAnimations(bool horizontalInfoChanged, bool verticalInfoChanged, bool zoomInfoChanged) | ScrollInputHelper | [private]
UpdateIsTargetElementInSource() | ScrollInputHelper | [private]
UpdateManipulationAlignments() | ScrollInputHelper | [private]
UpdateManipulationZoomMode() | ScrollInputHelper | [private]
UpdateOutOfBoundsPanSize() | ScrollInputHelper | [private]
UpdateSource(bool allowSourceElementLoadedHookup) | ScrollInputHelper | [private]
UpdateViewportSize() | ScrollInputHelper | [private]
~ScrollInputHelper() | ScrollInputHelper |
Generated on Sun Dec 1 2024 20:53:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

WebView2AutomationPeer Member List

This is the complete list of members for WebView2AutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
CheckThread() | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< WebView2AutomationPeer > &&self) noexcept | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
final_release(std::unique_ptr< WebView2AutomationPeer > &&self) | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline, static]
GetAutomationControlTypeCore() | WebView2AutomationPeer |
GetBase() | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
GetClassNameCore() | WebView2AutomationPeer |
GetImpl() | WebView2AutomationPeer | [private]
GetInner() | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
GetRawElementProviderSimple(_Outptr_opt_ IRawElementProviderSimple **value) | WebView2AutomationPeer |
InitProvider() | WebView2AutomationPeer | [private]
IsCorrectPeerForHwnd(HWND hwnd, _Out_ bool *value) | WebView2AutomationPeer |
IsOnThread() | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
m_provider | WebView2AutomationPeer | [private]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< WebView2AutomationPeer, winrt::implementation::WebView2AutomationPeerT, IAutomationPeerHwndInterop > | [inline]
WebView2AutomationPeer(winrt::WebView2 const &owner) | WebView2AutomationPeer |
Generated on Sun Dec 1 2024 20:53:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/Layout.properties.h Source File

  • Generated

Layout.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class LayoutProperties
00008 {
00009 public:
00010     LayoutProperties();
00011
00012
00013
00014     winrt::event_token ArrangeInvalidated(winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable> const& value);
00015     void ArrangeInvalidated(winrt::event_token const& token);
00016     winrt::event_token MeasureInvalidated(winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable> const& value);
00017     void MeasureInvalidated(winrt::event_token const& token);
00018
00019     event_source<winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable>> m_arrangeInvalidatedEventSource;
00020     event_source<winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable>> m_measureInvalidatedEventSource;
00021
00022     static void EnsureProperties();
00023     static void ClearProperties();
00024 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TeachingTipFocusPage Member List

This is the complete list of members for TeachingTipFocusPage, including all inherited members.
ChangeTestFrameVisibility(Visibility visibility) | TeachingTipFocusPage | [inline, private]
CloseTeachingTipButton_Click(object sender, RoutedEventArgs e) | TeachingTipFocusPage | [inline, private]
OnLoaded(object sender, RoutedEventArgs e) | TeachingTipFocusPage | [inline, private]
OpenTeachingTipButton_Click(object sender, RoutedEventArgs e) | TeachingTipFocusPage | [inline, private]
TeachingTipFocusPage() | TeachingTipFocusPage | [inline]
TeachingTipTestHooks_IdleStatusChanged(TeachingTip sender, object args) | TeachingTipFocusPage | [inline, private]
TeachingTipTestHooks_OpenedStatusChanged(TeachingTip sender, object args) | TeachingTipFocusPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:39 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemContainer/ItemContainer.idl Source File

  • ItemContainer

ItemContainer.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [webhosthidden]
00006 [flags]
00007 enum ItemContainerMultiSelectMode
00008 {
00009     Auto = 1,
00010     Single = 2,
00011     Extended = 4,
00012     Multiple = 8
00013 };
00014
00015 [MUX_INTERNAL]
00016 [webhosthidden]
00017 enum ItemContainerInteractionTrigger
00018 {
00019     PointerPressed,
00020     PointerReleased,
00021     Tap,
00022     DoubleTap,
00023     EnterKey,
00024     SpaceKey,
00025     AutomationInvoke
00026 };
00027
00028 [MUX_INTERNAL]
00029 [webhosthidden]
00030 [flags]
00031 enum ItemContainerUserInvokeMode
00032 {
00033     Auto = 1,
00034     UserCanInvoke = 2,
00035     UserCannotInvoke = 4,
00036 };
00037
00038 [MUX_INTERNAL]
00039 [webhosthidden]
00040 [flags]
00041 enum ItemContainerUserSelectMode
00042 {
00043     Auto = 1,
00044     UserCanSelect = 2,
00045     UserCannotSelect = 4,
00046 };
00047
00048 [MUX_INTERNAL]
00049 [webhosthidden]
00050 runtimeclass ItemContainerInvokedEventArgs
00051 {
00052     Object OriginalSource { get; };
00053     ItemContainerInteractionTrigger InteractionTrigger { get; };
00054     Boolean Handled{ get; set; };
00055 }
00056
00057 [MUX_PUBLIC_V5]
00058 [webhosthidden]
00059 [contentproperty("Child")]
00060 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00061 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00062 unsealed runtimeclass ItemContainer : Microsoft.UI.Xaml.Controls.Control
00063 {
00064     ItemContainer();
00065
00066     Microsoft.UI.Xaml.UIElement Child{ get; set; };
00067
00068     [MUX_DEFAULT_VALUE("false")]
00069     Boolean IsSelected{ get; set; };
00070
00071     static Microsoft.UI.Xaml.DependencyProperty ChildProperty{ get; };
00072     static Microsoft.UI.Xaml.DependencyProperty IsSelectedProperty{ get; };
00073
00074     [MUX_INTERNAL]
00075     {
00076         [MUX_DEFAULT_VALUE("winrt::ItemContainerUserSelectMode::Auto")]
00077         ItemContainerUserSelectMode CanUserSelect{ get; set; };
00078
00079         [MUX_DEFAULT_VALUE("winrt::ItemContainerUserInvokeMode::Auto")]
00080         ItemContainerUserInvokeMode CanUserInvoke{ get; set; };
00081
00082         [MUX_DEFAULT_VALUE("winrt::ItemContainerMultiSelectMode::Auto")]
00083         ItemContainerMultiSelectMode MultiSelectMode{ get; set; };
00084
00085         event Windows.Foundation.TypedEventHandler<ItemContainer, ItemContainerInvokedEventArgs> ItemInvoked;
00086
00087         static Microsoft.UI.Xaml.DependencyProperty CanUserSelectProperty{ get; };
00088         static Microsoft.UI.Xaml.DependencyProperty CanUserInvokeProperty{ get; };
00089         static Microsoft.UI.Xaml.DependencyProperty MultiSelectModeProperty{ get; };
00090     }
00091 }
00092
00093 }
00094
00095 namespace MU_XAP_NAMESPACE
00096 {
00097
00098 [MUX_PUBLIC_V5]
00099 [webhosthidden]
00100 unsealed runtimeclass ItemContainerAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer, Microsoft.UI.Xaml.Automation.Provider.ISelectionItemProvider, Microsoft.UI.Xaml.Automation.Provider.IInvokeProvider
00101 {
00102     ItemContainerAutomationPeer(MU_XC_NAMESPACE.ItemContainer owner);
00103 }
00104
00105 }
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/TestUI/CompositionScrollController.cs Source File

  • ScrollPresenter
  • TestUI

CompositionScrollController.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Numerics;
00007 using Windows.Foundation;
00008 using Microsoft.UI.Composition;
00009 using Microsoft.UI.Input;
00010 using Microsoft.UI.Xaml;
00011 using Microsoft.UI.Xaml.Controls;
00012 using Microsoft.UI.Xaml.Controls.Primitives;
00013 using Microsoft.UI.Xaml.Hosting;
00014 using Microsoft.UI.Xaml.Input;
00015 using Microsoft.UI.Dispatching;
00016
00017 namespace MUXControlsTestApp.Utilities
00018 {
00019     internal sealed class CompositionScrollControllerPanningInfo : IScrollControllerPanningInfo
00020     {
00021         private DispatcherQueue dispatcherQueue = null;
00022         private CompositionPropertySet expressionAnimationSources = null;
00023         private ExpressionAnimation thumbOffsetAnimation = null;
00024         private Visual panningVisual = null;
00025         private FrameworkElement panningFrameworkElement = null;
00026         private UIElement panningElementAncestor = null;
00027         private Orientation panOrientation = Orientation.Vertical;
00028         private bool isAnimatingThumbOffset = true;
00029         private bool isThumbPannable = true;
00030         private bool isThumbPositionMirrored = false;
00031         private bool isRailEnabled = true;
00032         private string minOffsetPropertyName;
00033         private string maxOffsetPropertyName;
00034         private string offsetPropertyName;
00035         private string multiplierPropertyName;
00036         private double minOffset;
00037         private double maxOffset;
00038
00039         public event TypedEventHandler<IScrollControllerPanningInfo, String> LogMessage;
00040         public event TypedEventHandler<IScrollControllerPanningInfo, Object> Changed;
00041         public event TypedEventHandler<IScrollControllerPanningInfo, ScrollControllerPanRequestedEventArgs> PanRequested;
00042
00043         internal bool IsAnimatingThumbOffset
00044         {
00045             get
00046             {
00047                 return isAnimatingThumbOffset;
00048             }
00049             set
00050             {
00051                 if (isAnimatingThumbOffset != value)
00052                 {
00053                     isAnimatingThumbOffset = value;
00054                 }
00055             }
00056         }
00057
00058         internal bool IsThumbPannable
00059         {
00060             get
00061             {
00062                 return isThumbPannable;
00063             }
00064             set
00065             {
00066                 if (isThumbPannable != value)
00067                 {
00068                     isThumbPannable = value;
00069                     RaiseChanged();
00070                 }
00071             }
00072         }
00073
00074         internal bool IsThumbPositionMirrored
00075         {
00076             get
00077             {
00078                 return isThumbPositionMirrored;
00079             }
00080             set
00081             {
00082                 if (isThumbPositionMirrored != value)
00083                 {
00084                     if (isAnimatingThumbOffset)
00085                     {
00086                         StopThumbAnimation();
00087                     }
00088
00089                     isThumbPositionMirrored = value;
00090                     UpdatePanningElementOffsetMultiplier();
00091
00092                     if (isAnimatingThumbOffset)
00093                     {
00094                         UpdateThumbExpression();
00095                         StartThumbAnimation();
00096                     }
00097
00098                 }
00099             }
00100         }
00101
00102         internal Visual PanningVisual
00103         {
00104             get
00105             {
00106                 return panningVisual;
00107             }
00108         }
00109
00110         // Returns the thumb track, an ancestor of the pannable thumb.
00111         public UIElement PanningElementAncestor
00112         {
00113             get
00114             {
00115                 // Note: Returning panning UIElement would cause flickers when interacting with it (InteractionTracker issue).
00116                 RaiseLogMessage("CompositionScrollControllerPanningInfo: get_PanningElementAncestor for PanOrientation=" + panOrientation);
00117
00118                 return isThumbPannable ? panningElementAncestor : null;
00119             }
00120             private set
00121             {
00122                 if (panningElementAncestor != value)
00123                 {
00124                     panningElementAncestor = value;
00125                     RaiseChanged();
00126                 }
00127             }
00128         }
00129
00130         // Returns True when the pannable thumb is locked on a track.
00131         public bool IsRailEnabled
00132         {
00133             get
00134             {
00135                 return isRailEnabled;
00136             }
00137             internal set
00138             {
00139                 if (isRailEnabled != value)
00140                 {
00141                     isRailEnabled = value;
00142                     RaiseChanged();
00143                 }
00144             }
00145         }
00146
00147         public Orientation PanOrientation
00148         {
00149             get
00150             {
00151                 RaiseLogMessage("CompositionScrollControllerPanningInfo: get_PanOrientation for PanOrientation=" + panOrientation);
00152
00153                 return panOrientation;
00154             }
00155             internal set
00156             {
00157                 if (panOrientation != value)
00158                 {
00159                     panOrientation = value;
00160                     RaiseChanged();
00161                 }
00162             }
00163         }
00164
00165         public void SetPanningElementExpressionAnimationSources(
00166             CompositionPropertySet propertySet,
00167             string minOffsetPropertyName,
00168             string maxOffsetPropertyName,
00169             string offsetPropertyName,
00170             string multiplierPropertyName)
00171         {
00172             RaiseLogMessage(
00173                 "CompositionScrollControllerPanningInfo: SetPanningElementExpressionAnimationSources for PanOrientation=" + panOrientation +
00174                 " with minOffsetPropertyName=" + minOffsetPropertyName +
00175                 ", maxOffsetPropertyName=" + maxOffsetPropertyName +
00176                 ", offsetPropertyName=" + offsetPropertyName +
00177                 ", multiplierPropertyName=" + multiplierPropertyName);
00178
00179             expressionAnimationSources = propertySet;
00180             if (expressionAnimationSources != null)
00181             {
00182                 this.minOffsetPropertyName = minOffsetPropertyName.Trim();
00183                 this.maxOffsetPropertyName = maxOffsetPropertyName.Trim();
00184                 this.offsetPropertyName = offsetPropertyName.Trim();
00185                 this.multiplierPropertyName = multiplierPropertyName.Trim();
00186
00187                 UpdatePanningElementOffsetMultiplier();
00188
00189                 if (thumbOffsetAnimation == null && IsAnimatingThumbOffset)
00190                 {
00191                     EnsureThumbAnimation();
00192                     UpdateThumbExpression();
00193                     StartThumbAnimation();
00194                 }
00195             }
00196             else
00197             {
00198                 this.minOffsetPropertyName =
00199                 this.maxOffsetPropertyName =
00200                 this.offsetPropertyName =
00201                 this.multiplierPropertyName = string.Empty;
00202
00203                 if (IsAnimatingThumbOffset)
00204                 {
00205                     thumbOffsetAnimation = null;
00206                     StopThumbAnimation();
00207                 }
00208             }
00209         }
00210
00211         internal CompositionScrollControllerPanningInfo(
00212             DispatcherQueue dispatcherQueue,
00213             bool isRailEnabled,
00214             Orientation panOrientation)
00215         {
00216             this.dispatcherQueue = dispatcherQueue;
00217             this.IsRailEnabled = isRailEnabled;
00218             this.PanOrientation = panOrientation;
00219         }
00220
00221         internal void SetPanningFrameworkElement(FrameworkElement value)
00222         {
00223             if (panningFrameworkElement != value)
00224             {
00225                 panningFrameworkElement = value;
00226
00227                 if (panningFrameworkElement == null)
00228                 {
00229                     panningVisual = null;
00230
00231                     PanningElementAncestor = null;
00232                 }
00233                 else
00234                 {
00235                     panningVisual = ElementCompositionPreview.GetElementVisual(panningFrameworkElement);
00236                     ElementCompositionPreview.SetIsTranslationEnabled(panningFrameworkElement, true);
00237
00238                     PanningElementAncestor = panningFrameworkElement.Parent as UIElement;
00239                 }
00240             }
00241         }
00242
00243         // Evaluates the relative speed (mutiplier) between the IScrollController consumer content and
00244         // the pannable thumb. Then updates the expressionAnimationSources's multiplier scalar.
00245         internal void UpdatePanningElementOffsetMultiplier()
00246         {
00247             if (expressionAnimationSources != null && !string.IsNullOrWhiteSpace(multiplierPropertyName))
00248             {
00249                 float panningVisualScrollMultiplier = PanningElementOffsetMultiplier;
00250
00251                 RaiseLogMessage("CompositionScrollControllerPanningInfo: UpdatePanningElementOffsetMultiplier for PanOrientation=" + panOrientation +
00252                     ", PanningElementOffsetMultiplier=" + panningVisualScrollMultiplier);
00253
00254                 expressionAnimationSources.InsertScalar(multiplierPropertyName, panningVisualScrollMultiplier);
00255             }
00256         }
00257
00258         // Updates the pannable thumb's length according to the dimensions given by IScrollController.SetValues(...)
00259         // and IScrollController's UI size.
00260         internal bool UpdatePanningFrameworkElementLength(
00261             double minOffset,
00262             double maxOffset,
00263             double viewportLength)
00264         {
00265             this.minOffset = minOffset;
00266             this.maxOffset = maxOffset;
00267
00268             if (panningFrameworkElement != null)
00269             {
00270                 double parentWidth = 0.0;
00271                 double parentHeight = 0.0;
00272                 FrameworkElement parent = panningFrameworkElement.Parent as FrameworkElement;
00273
00274                 if (parent != null)
00275                 {
00276                     parentWidth = parent.ActualWidth;
00277                     parentHeight = parent.ActualHeight;
00278                 }
00279
00280                 if (panOrientation == Orientation.Horizontal)
00281                 {
00282                     double newWidth;
00283                     if (viewportLength == 0.0)
00284                     {
00285                         newWidth = 40.0;
00286                     }
00287                     else
00288                     {
00289                         newWidth = Math.Max(Math.Min(40.0, parentWidth), viewportLength / (maxOffset - minOffset + viewportLength) * parentWidth);
00290                     }
00291                     if (newWidth != panningFrameworkElement.Width)
00292                     {
00293                         RaiseLogMessage("CompositionScrollControllerPanningInfo: UpdatePanningFrameworkElementLength for PanOrientation=Horizontal, setting Width=" + newWidth);
00294
00295                         panningFrameworkElement.Width = newWidth;
00296                         var ignored = dispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdatePanningElementOffsetMultiplier);
00297                         return true;
00298                     }
00299                 }
00300                 else
00301                 {
00302                     double newHeight;
00303                     if (viewportLength == 0.0)
00304                     {
00305                         newHeight = 40.0;
00306                     }
00307                     else
00308                     {
00309                         newHeight = Math.Max(Math.Min(40.0, parentHeight), viewportLength / (maxOffset - minOffset + viewportLength) * parentHeight);
00310                     }
00311                     if (newHeight != panningFrameworkElement.Height)
00312                     {
00313                         RaiseLogMessage("CompositionScrollControllerPanningInfo: UpdatePanningFrameworkElementLength for PanOrientation=Vertical, setting Height=" + newHeight);
00314
00315                         panningFrameworkElement.Height = newHeight;
00316                         var ignored = dispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdatePanningElementOffsetMultiplier);
00317                         return true;
00318                     }
00319                 }
00320             }
00321             return false;
00322         }
00323
00324         internal void StartThumbAnimation()
00325         {
00326             if (panningVisual != null && thumbOffsetAnimation != null)
00327             {
00328                 if (panOrientation == Orientation.Horizontal)
00329                 {
00330                     panningVisual.StartAnimation("Translation.X", thumbOffsetAnimation);
00331                 }
00332                 else
00333                 {
00334                     panningVisual.StartAnimation("Translation.Y", thumbOffsetAnimation);
00335                 }
00336             }
00337         }
00338
00339         internal void StopThumbAnimation()
00340         {
00341             if (panningVisual != null)
00342             {
00343                 if (panOrientation == Orientation.Horizontal)
00344                 {
00345                     panningVisual.StopAnimation("Translation.X");
00346                 }
00347                 else
00348                 {
00349                     panningVisual.StopAnimation("Translation.Y");
00350                 }
00351             }
00352         }
00353
00354         internal bool RaisePanRequested(PointerPoint pointerPoint)
00355         {
00356             RaiseLogMessage("CompositionScrollControllerPanningInfo: RaisePanRequested for PanOrientation=" + panOrientation + " with pointerPoint=" + pointerPoint);
00357
00358             if (PanRequested != null)
00359             {
00360                 ScrollControllerPanRequestedEventArgs args = new ScrollControllerPanRequestedEventArgs(pointerPoint);
00361
00362                 PanRequested(this, args);
00363                 RaiseLogMessage("CompositionScrollControllerPanningInfo: RaisePanRequested result Handled=" + args.Handled);
00364
00365                 return args.Handled;
00366             }
00367
00368             return false;
00369         }
00370
00371         // Returns the multiplier between the IScrollController content movements and the
00372         // pannable thumb movements.
00373         internal float PanningElementOffsetMultiplier
00374         {
00375             get
00376             {
00377                 if (panningFrameworkElement != null)
00378                 {
00379                     panningFrameworkElement.UpdateLayout();
00380
00381                     double parentLength = 0.0;
00382                     double panningFrameworkElementLength = panOrientation == Orientation.Horizontal ? panningFrameworkElement.ActualWidth : panningFrameworkElement.ActualHeight;
00383                     FrameworkElement parent = panningFrameworkElement.Parent as FrameworkElement;
00384                     if (parent != null)
00385                     {
00386                         parentLength = panOrientation == Orientation.Horizontal ? parent.ActualWidth : parent.ActualHeight;
00387                     }
00388                     if (parentLength != panningFrameworkElementLength)
00389                     {
00390                         RaiseLogMessage("CompositionScrollControllerPanningInfo: PanningElementOffsetMultiplier evaluation:");
00391                         RaiseLogMessage("maxOffset:" + maxOffset);
00392                         RaiseLogMessage("minOffset:" + minOffset);
00393                         RaiseLogMessage("panningFrameworkElementLength:" + panningFrameworkElementLength);
00394                         RaiseLogMessage("parentLength:" + parentLength);
00395
00396                         float multiplier = (float)((maxOffset - minOffset) / (panningFrameworkElementLength - parentLength));
00397
00398                         if (IsThumbPositionMirrored)
00399                             multiplier *= -1.0f;
00400
00401                         return multiplier;
00402                     }
00403                 }
00404
00405                 return 0.0f;
00406             }
00407         }
00408
00409         // Creates the thumbOffsetAnimation Composition expression animation used to
00410         // position the vertical pannable thumb within its track.
00411         private void EnsureThumbAnimation()
00412         {
00413             if (thumbOffsetAnimation == null && expressionAnimationSources != null &&
00414                 !string.IsNullOrWhiteSpace(multiplierPropertyName) &&
00415                 !string.IsNullOrWhiteSpace(offsetPropertyName) &&
00416                 !string.IsNullOrWhiteSpace(minOffsetPropertyName) &&
00417                 !string.IsNullOrWhiteSpace(maxOffsetPropertyName))
00418             {
00419                 thumbOffsetAnimation = expressionAnimationSources.Compositor.CreateExpressionAnimation();
00420                 thumbOffsetAnimation.SetReferenceParameter("sources", expressionAnimationSources);
00421             }
00422         }
00423
00424         // Updates the thumbOffsetAnimation Composition expression animation using the PropertySet provided
00425         // in the SetPanningElementExpressionAnimationSources call.
00426         private void UpdateThumbExpression()
00427         {
00428             if (thumbOffsetAnimation != null)
00429             {
00430                 if (isThumbPositionMirrored)
00431                 {
00432                     thumbOffsetAnimation.Expression =
00433                         "(sources." + maxOffsetPropertyName + " - min(sources." + maxOffsetPropertyName + ",max(sources." + minOffsetPropertyName + ",sources." + offsetPropertyName + ")))/(sources." + multiplierPropertyName + ")";
00434                 }
00435                 else
00436                 {
00437                     thumbOffsetAnimation.Expression =
00438                         "min(sources." + maxOffsetPropertyName + ",max(sources." + minOffsetPropertyName + ",sources." + offsetPropertyName + "))/(-sources." + multiplierPropertyName + ")";
00439                 }
00440             }
00441         }
00442
00443         private void RaiseLogMessage(string logMessage)
00444         {
00445             if (LogMessage != null)
00446             {
00447                 LogMessage(this, logMessage);
00448             }
00449         }
00450
00451         private void RaiseChanged()
00452         {
00453             RaiseLogMessage("CompositionScrollControllerPanningInfo: RaiseChanged for PanOrientation=" + panOrientation);
00454
00455             if (Changed != null)
00456             {
00457                 Changed(this, null);
00458             }
00459         }
00460     }
00461
00462     public class CompositionScrollControllerOffsetChangeCompletedEventArgs
00463     {
00464         internal CompositionScrollControllerOffsetChangeCompletedEventArgs(int offsetChangeCorrelationId)
00465         {
00466             OffsetChangeCorrelationId = offsetChangeCorrelationId;
00467         }
00468
00469         public int OffsetChangeCorrelationId
00470         {
00471             get;
00472             set;
00473         }
00474     }
00475
00476     public sealed class CompositionScrollController : Control, IScrollController
00477     {
00478         public event TypedEventHandler<CompositionScrollController, CompositionScrollControllerOffsetChangeCompletedEventArgs> OffsetChangeCompleted;
00479
00480         public static bool s_IsDebugOutputEnabled = false;
00481
00482         private const float SmallChangeAdditionalVelocity = 144.0f;
00483         private const float SmallChangeInertiaDecayRate = 0.975f;
00484
00485         public enum AnimationType
00486         {
00487             Default,
00488             Accordion,
00489             Teleportation
00490         }
00491
00492         private struct OperationInfo
00493         {
00494             public int CorrelationId;
00495             public double RelativeOffsetChange;
00496             public double OffsetTarget;
00497
00498             public OperationInfo(int correlationId, double relativeOffsetChange, double offsetTarget) : this()
00499             {
00500                 CorrelationId = correlationId;
00501                 RelativeOffsetChange = relativeOffsetChange;
00502                 OffsetTarget = offsetTarget;
00503             }
00504         }
00505
00506         private List<string> lstAsyncEventMessage = new List<string>();
00507         private List<int> lstOffsetChangeCorrelationIds = new List<int>();
00508         private List<int> lstAddScrollVelocityCorrelationIds = new List<int>();
00509         private CompositionScrollControllerPanningInfo panningInfo = null;
00510         private Dictionary<int, OperationInfo> operations = new Dictionary<int, OperationInfo>();
00511         private FrameworkElement panningFrameworkElement = null;
00512         private UIElement horizontalGrid = null;
00513         private UIElement verticalGrid = null;
00514         private UIElement horizontalThumb = null;
00515         private UIElement verticalThumb = null;
00516         private RepeatButton horizontalDecrementRepeatButton = null;
00517         private RepeatButton verticalDecrementRepeatButton = null;
00518         private RepeatButton horizontalIncrementRepeatButton = null;
00519         private RepeatButton verticalIncrementRepeatButton = null;
00520         private Orientation orientation = Orientation.Vertical;
00521         private bool isScrollable = false;
00522         private double minOffset = 0.0;
00523         private double maxOffset = 0.0;
00524         private double offset = 0.0;
00525         private double offsetTarget = 0.0;
00526         private double viewportLength = 0.0;
00527         private double preManipulationThumbOffset = 0.0;
00528
00529         public CompositionScrollController()
00530         {
00531             RaiseLogMessage("CompositionScrollController: CompositionScrollController()");
00532
00533             this.DefaultStyleKey = typeof(CompositionScrollController);
00534             panningInfo = new CompositionScrollControllerPanningInfo(DispatcherQueue, true, orientation);
00535             panningInfo.LogMessage += PanningInfo_LogMessage;
00536             IsScrollingWithMouse = false;
00537             OffsetChangeAnimationType = AnimationType.Default;
00538             StockOffsetChangeDuration = TimeSpan.MinValue;
00539             OverriddenOffsetChangeDuration = TimeSpan.MinValue;
00540             IsEnabledChanged += CompositionScrollController_IsEnabledChanged;
00541             SizeChanged += CompositionScrollController_SizeChanged;
00542         }
00543
00544         protected override void OnApplyTemplate()
00545         {
00546             RaiseLogMessage("CompositionScrollController: OnApplyTemplate()");
00547
00548             UnhookHandlers();
00549
00550             base.OnApplyTemplate();
00551
00552             horizontalGrid = GetTemplateChild("HorizontalGrid") as UIElement;
00553             verticalGrid = GetTemplateChild("VerticalGrid") as UIElement;
00554             horizontalThumb = GetTemplateChild("HorizontalThumb") as UIElement;
00555             verticalThumb = GetTemplateChild("VerticalThumb") as UIElement;
00556             horizontalDecrementRepeatButton = GetTemplateChild("HorizontalDecrementRepeatButton") as RepeatButton;
00557             verticalDecrementRepeatButton = GetTemplateChild("VerticalDecrementRepeatButton") as RepeatButton;
00558             horizontalIncrementRepeatButton = GetTemplateChild("HorizontalIncrementRepeatButton") as RepeatButton;
00559             verticalIncrementRepeatButton = GetTemplateChild("VerticalIncrementRepeatButton") as RepeatButton;
00560
00561             UpdateOrientation();
00562         }
00563
00564         public AnimationType OffsetChangeAnimationType
00565         {
00566             get;
00567             set;
00568         }
00569
00570         public TimeSpan StockOffsetChangeDuration
00571         {
00572             get;
00573             private set;
00574         }
00575
00576         public TimeSpan OverriddenOffsetChangeDuration
00577         {
00578             get;
00579             set;
00580         }
00581
00582         public bool IsAnimatingThumbOffset
00583         {
00584             get
00585             {
00586                 return panningInfo.IsAnimatingThumbOffset;
00587             }
00588             set
00589             {
00590                 RaiseLogMessage("CompositionScrollController: IsAnimatingThumbOffset(" + value + ")");
00591
00592                 panningInfo.IsAnimatingThumbOffset = value;
00593             }
00594         }
00595
00596         public bool IsThumbPannable
00597         {
00598             get
00599             {
00600                 return panningInfo.IsThumbPannable;
00601             }
00602             set
00603             {
00604                 RaiseLogMessage("CompositionScrollController: IsThumbPannable(" + value + ")");
00605
00606                 panningInfo.IsThumbPannable = value;
00607             }
00608         }
00609
00610         public bool IsThumbPositionMirrored
00611         {
00612             get
00613             {
00614                 return panningInfo.IsThumbPositionMirrored;
00615             }
00616             set
00617             {
00618                 RaiseLogMessage("CompositionScrollController: IsThumbPositionMirrored(" + value + ")");
00619
00620                 if (panningInfo.IsThumbPositionMirrored != value)
00621                 {
00622                     panningInfo.IsThumbPositionMirrored = value;
00623
00624                     UpdatePanningFrameworkElementOffset();
00625                 }
00626             }
00627         }
00628
00629         public Orientation Orientation
00630         {
00631             get
00632             {
00633                 return orientation;
00634             }
00635             set
00636             {
00637                 RaiseLogMessage("CompositionScrollController: Orientation(" + value + ")");
00638
00639                 if (orientation != value)
00640                 {
00641                     UnhookHandlers();
00642                     if (IsAnimatingThumbOffset)
00643                     {
00644                         panningInfo.StopThumbAnimation();
00645                     }
00646                     orientation = value;
00647                     UpdateOrientation();
00648                 }
00649             }
00650         }
00651
00652         public void SetIsScrollable(bool isScrollable)
00653         {
00654             RaiseLogMessage(
00655                 "CompositionScrollController: SetIsScrollable for Orientation=" + Orientation +
00656                 " with isScrollable=" + isScrollable);
00657             this.isScrollable = isScrollable;
00658             // CanScroll's evaluation depends on isScrollable.
00659             UpdateCanScroll();
00660         }
00661
00662         public void SetValues(double minOffset, double maxOffset, double offset, double viewportLength)
00663         {
00664             RaiseLogMessage(
00665                 "CompositionScrollController: SetValues for Orientation=" + Orientation +
00666                 " with minOffset=" + minOffset +
00667                 ", maxOffset=" + maxOffset +
00668                 ", offset=" + offset +
00669                 ", viewportLength=" + viewportLength);
00670
00671             if (maxOffset < minOffset)
00672             {
00673                 throw new ArgumentOutOfRangeException("maxOffset");
00674             }
00675
00676             if (viewportLength < 0.0)
00677             {
00678                 throw new ArgumentOutOfRangeException("viewportLength");
00679             }
00680
00681             offset = Math.Max(minOffset, offset);
00682             offset = Math.Min(maxOffset, offset);
00683
00684             if (operations.Count == 0)
00685             {
00686                 offsetTarget = offset;
00687             }
00688             else
00689             {
00690                 offsetTarget = Math.Max(minOffset, offsetTarget);
00691                 offsetTarget = Math.Min(maxOffset, offsetTarget);
00692             }
00693
00694             bool updatePanningFrameworkElementLength =
00695                 this.minOffset != minOffset ||
00696                 this.maxOffset != maxOffset ||
00697                 this.viewportLength != viewportLength;
00698
00699             this.minOffset = minOffset;
00700             this.offset = offset;
00701             this.maxOffset = maxOffset;
00702             this.viewportLength = viewportLength;
00703
00704             if (updatePanningFrameworkElementLength && !panningInfo.UpdatePanningFrameworkElementLength(minOffset, maxOffset, viewportLength))
00705             {
00706                 panningInfo.UpdatePanningElementOffsetMultiplier();
00707             }
00708
00709             UpdatePanningFrameworkElementOffset();
00710
00711             // Potentially changed minOffset / maxOffset value(s) may have an effect
00712             // on the read-only IScrollController.CanScroll property.
00713             UpdateCanScroll();
00714         }
00715
00716         // Builds a custom Vector3KeyFrameAnimation animation that the ScrollPresenter applies when an animated offset change
00717         // is requested by the CompositionScrollController.
00718         public CompositionAnimation GetScrollAnimation(
00719             int correlationId,
00720             Vector2 startPosition,
00721             Vector2 endPosition,
00722             CompositionAnimation defaultAnimation)
00723         {
00724             RaiseLogMessage(
00725                 "CompositionScrollController: GetScrollAnimation for Orientation=" + Orientation +
00726                 " with OffsetsChangeCorrelationId=" + correlationId + ", startPosition=" + startPosition + ", endPosition=" + endPosition);
00727
00728             try
00729             {
00730                 Vector3KeyFrameAnimation stockKeyFrameAnimation = defaultAnimation as Vector3KeyFrameAnimation;
00731
00732                 if (stockKeyFrameAnimation != null)
00733                 {
00734                     Vector3KeyFrameAnimation customKeyFrameAnimation = stockKeyFrameAnimation;
00735
00736                     if (OffsetChangeAnimationType != AnimationType.Default)
00737                     {
00738                         OperationInfo oi = operations[correlationId];
00739                         float positionTarget = (float)oi.OffsetTarget;
00740                         float otherOrientationPosition = orientation == Orientation.Horizontal ? startPosition.Y : startPosition.X;
00741
00742                         customKeyFrameAnimation = stockKeyFrameAnimation.Compositor.CreateVector3KeyFrameAnimation();
00743                         if (OffsetChangeAnimationType == AnimationType.Accordion)
00744                         {
00745                             float deltaPosition = 0.1f * (float)(positionTarget - offset);
00746
00747                             if (orientation == Orientation.Horizontal)
00748                             {
00749                                 for (int step = 0; step < 3; step++)
00750                                 {
00751                                     customKeyFrameAnimation.InsertKeyFrame(
00752                                         1.0f - (0.4f / (float)Math.Pow(2, step)),
00753                                         new Vector3(positionTarget + deltaPosition, otherOrientationPosition, 0.0f));
00754                                     deltaPosition /= -2.0f;
00755                                 }
00756
00757                                 customKeyFrameAnimation.InsertKeyFrame(1.0f, new Vector3(positionTarget, otherOrientationPosition, 0.0f));
00758                             }
00759                             else
00760                             {
00761                                 for (int step = 0; step < 3; step++)
00762                                 {
00763                                     customKeyFrameAnimation.InsertKeyFrame(
00764                                         1.0f - (0.4f / (float)Math.Pow(2, step)),
00765                                         new Vector3(otherOrientationPosition, positionTarget + deltaPosition, 0.0f));
00766                                     deltaPosition /= -2.0f;
00767                                 }
00768
00769                                 customKeyFrameAnimation.InsertKeyFrame(1.0f, new Vector3(otherOrientationPosition, positionTarget, 0.0f));
00770                             }
00771                         }
00772                         else
00773                         {
00774                             // Teleportation case
00775                             float deltaPosition = (float)(positionTarget - offset);
00776
00777                             CubicBezierEasingFunction cubicBezierStart = stockKeyFrameAnimation.Compositor.CreateCubicBezierEasingFunction(
00778                                 new Vector2(1.0f, 0.0f),
00779                                 new Vector2(1.0f, 0.0f));
00780
00781                             StepEasingFunction step = stockKeyFrameAnimation.Compositor.CreateStepEasingFunction(1);
00782
00783                             CubicBezierEasingFunction cubicBezierEnd = stockKeyFrameAnimation.Compositor.CreateCubicBezierEasingFunction(
00784                                 new Vector2(0.0f, 1.0f),
00785                                 new Vector2(0.0f, 1.0f));
00786
00787                             if (orientation == Orientation.Horizontal)
00788                             {
00789                                 customKeyFrameAnimation.InsertKeyFrame(
00790                                     0.499999f,
00791                                     new Vector3(positionTarget - 0.9f * deltaPosition, otherOrientationPosition, 0.0f),
00792                                     cubicBezierStart);
00793                                 customKeyFrameAnimation.InsertKeyFrame(
00794                                     0.5f,
00795                                     new Vector3(positionTarget - 0.1f * deltaPosition, otherOrientationPosition, 0.0f),
00796                                     step);
00797                                 customKeyFrameAnimation.InsertKeyFrame(
00798                                     1.0f,
00799                                     new Vector3(positionTarget, otherOrientationPosition, 0.0f),
00800                                     cubicBezierEnd);
00801                             }
00802                             else
00803                             {
00804                                 customKeyFrameAnimation.InsertKeyFrame(
00805                                     0.499999f,
00806                                     new Vector3(otherOrientationPosition, positionTarget - 0.9f * deltaPosition, 0.0f),
00807                                     cubicBezierStart);
00808                                 customKeyFrameAnimation.InsertKeyFrame(
00809                                     0.5f,
00810                                     new Vector3(otherOrientationPosition, positionTarget - 0.1f * deltaPosition, 0.0f),
00811                                     step);
00812                                 customKeyFrameAnimation.InsertKeyFrame(
00813                                     1.0f,
00814                                     new Vector3(otherOrientationPosition, positionTarget, 0.0f),
00815                                     cubicBezierEnd);
00816                             }
00817                         }
00818                         customKeyFrameAnimation.Duration = stockKeyFrameAnimation.Duration;
00819                     }
00820
00821                     if (OverriddenOffsetChangeDuration != TimeSpan.MinValue)
00822                     {
00823                         StockOffsetChangeDuration = stockKeyFrameAnimation.Duration;
00824                         customKeyFrameAnimation.Duration = OverriddenOffsetChangeDuration;
00825                     }
00826
00827                     return customKeyFrameAnimation;
00828                 }
00829             }
00830             catch (Exception ex)
00831             {
00832                 RaiseLogMessage("CompositionScrollController: GetScrollAnimation exception=" + ex);
00833             }
00834
00835             return null;
00836         }
00837
00838         public void NotifyRequestedScrollCompleted(
00839             int correlationId)
00840         {
00841             int offsetChangeCorrelationId = correlationId;
00842
00843             RaiseLogMessage(
00844                 "CompositionScrollController: NotifyRequestedScrollCompleted for Orientation=" + Orientation +
00845                 " with offsetChangeCorrelationId=" + offsetChangeCorrelationId);
00846
00847             if (lstOffsetChangeCorrelationIds.Contains(offsetChangeCorrelationId))
00848             {
00849                 lstOffsetChangeCorrelationIds.Remove(offsetChangeCorrelationId);
00850
00851                 double relativeOffsetChange = 0.0;
00852
00853                 if (operations.ContainsKey(offsetChangeCorrelationId))
00854                 {
00855                     OperationInfo oi = operations[offsetChangeCorrelationId];
00856                     relativeOffsetChange = oi.RelativeOffsetChange;
00857                     operations.Remove(offsetChangeCorrelationId);
00858                 }
00859
00860                 RaiseLogMessage("CompositionScrollController: ScrollTo/By completed. CorrelationId=" + offsetChangeCorrelationId);
00861             }
00862             else if (lstAddScrollVelocityCorrelationIds.Contains(offsetChangeCorrelationId))
00863             {
00864                 lstAddScrollVelocityCorrelationIds.Add(offsetChangeCorrelationId);
00865
00866                 RaiseLogMessage("CompositionScrollController: AddScrollVelocityRequest completed. CorrelationId=" + offsetChangeCorrelationId);
00867             }
00868
00869             if (OffsetChangeCompleted != null)
00870             {
00871                 RaiseLogMessage(
00872                     "CompositionScrollController: NotifyRequestedScrollCompleted raising OffsetChangeCompleted event.");
00873                 OffsetChangeCompleted(this, new CompositionScrollControllerOffsetChangeCompletedEventArgs(offsetChangeCorrelationId));
00874             }
00875         }
00876
00877         public IScrollControllerPanningInfo PanningInfo
00878         {
00879             get
00880             {
00881                 // Returning non-null instance because this IScrollController implementation
00882                 // supports UI-thread-independent panning with touch or pen.
00883                 return panningInfo;
00884             }
00885         }
00886
00887         public bool CanScroll
00888         {
00889             get;
00890             private set;
00891         }
00892
00893         public bool IsScrollingWithMouse
00894         {
00895             get;
00896             private set;
00897         }
00898
00899         public event TypedEventHandler<CompositionScrollController, string> LogMessage;
00900
00901         public event TypedEventHandler<IScrollController, Object> CanScrollChanged;
00902         public event TypedEventHandler<IScrollController, Object> IsScrollingWithMouseChanged;
00903         public event TypedEventHandler<IScrollController, ScrollControllerScrollToRequestedEventArgs> ScrollToRequested;
00904         public event TypedEventHandler<IScrollController, ScrollControllerScrollByRequestedEventArgs> ScrollByRequested;
00905         public event TypedEventHandler<IScrollController, ScrollControllerAddScrollVelocityRequestedEventArgs> AddScrollVelocityRequested;
00906
00907         public int ScrollTo(
00908             double offset, ScrollingAnimationMode animationMode)
00909         {
00910             RaiseLogMessage("CompositionScrollController: ScrollTo for Orientation=" + Orientation + " with offset=" + offset + ", animationMode=" + animationMode);
00911
00912             return RaiseScrollToRequested(
00913                 offset, animationMode, false /*hookupCompletion*/);
00914         }
00915
00916         public int ScrollBy(
00917             double offsetDelta, ScrollingAnimationMode animationMode)
00918         {
00919             RaiseLogMessage("CompositionScrollController: ScrollBy for Orientation=" + Orientation + " with offsetDelta=" + offsetDelta + ", animationMode=" + animationMode);
00920
00921             return RaiseScrollByRequested(
00922                 offsetDelta, animationMode, false /*hookupCompletion*/);
00923         }
00924
00925         public int AddScrollVelocity(
00926             float offsetVelocity, float? inertiaDecayRate)
00927         {
00928             RaiseLogMessage("CompositionScrollController: AddScrollVelocity for Orientation=" + Orientation + " with offsetVelocity=" + offsetVelocity + ", inertiaDecayRate=" + inertiaDecayRate);
00929
00930             return RaiseAddScrollVelocityRequested(
00931                 offsetVelocity, inertiaDecayRate, false /*hookupCompletion*/);
00932         }
00933
00934         private void PanningInfo_LogMessage(IScrollControllerPanningInfo sender, string message)
00935         {
00936             RaiseLogMessage(message);
00937         }
00938
00939         private void RaiseLogMessage(string message)
00940         {
00941             if (s_IsDebugOutputEnabled)
00942                 System.Diagnostics.Debug.WriteLine(message);
00943
00944             if (LogMessage != null)
00945             {
00946                 LogMessage(this, message);
00947             }
00948         }
00949
00950         private void RaiseCanScrollChanged()
00951         {
00952             RaiseLogMessage("CompositionScrollController: RaiseCanScrollChanged for Orientation=" + Orientation);
00953             if (CanScrollChanged != null)
00954             {
00955                 CanScrollChanged(this, null);
00956             }
00957         }
00958
00959         private void RaiseIsScrollingWithMouseChanged()
00960         {
00961             RaiseLogMessage("CompositionScrollController: RaiseIsScrollingWithMouseChanged for Orientation=" + Orientation);
00962             if (IsScrollingWithMouseChanged != null)
00963             {
00964                 IsScrollingWithMouseChanged(this, null);
00965             }
00966         }
00967
00968         private int RaiseScrollToRequested(
00969             double offset,
00970             ScrollingAnimationMode animationMode,
00971             bool hookupCompletion)
00972         {
00973             RaiseLogMessage("CompositionScrollController: RaiseScrollToRequested for Orientation=" + Orientation + " with offset=" + offset + ", animationMode=" + animationMode);
00974
00975             try
00976             {
00977                 if (ScrollToRequested != null)
00978                 {
00979                     ScrollControllerScrollToRequestedEventArgs e =
00980                         new ScrollControllerScrollToRequestedEventArgs(
00981                             offset,
00982                             new ScrollingScrollOptions(animationMode, ScrollingSnapPointsMode.Ignore));
00983                     ScrollToRequested(this, e);
00984                     if (e.CorrelationId != -1)
00985                     {
00986                         RaiseLogMessage("CompositionScrollController: ScrollToRequest started. OffsetsChangeCorrelationId=" + e.CorrelationId);
00987
00988                         if (hookupCompletion && !lstOffsetChangeCorrelationIds.Contains(e.CorrelationId))
00989                         {
00990                             lstOffsetChangeCorrelationIds.Add(e.CorrelationId);
00991                         }
00992                     }
00993                     return e.CorrelationId;
00994                 }
00995             }
00996             catch (Exception ex)
00997             {
00998                 RaiseLogMessage("CompositionScrollController: RaiseScrollToRequested - exception=" + ex);
00999             }
01000
01001             return -1;
01002         }
01003
01004         private int RaiseScrollByRequested(
01005             double offsetDelta,
01006             ScrollingAnimationMode animationMode,
01007             bool hookupCompletion)
01008         {
01009             RaiseLogMessage("CompositionScrollController: RaiseScrollByRequested for Orientation=" + Orientation + " with offsetDelta=" + offsetDelta + ", animationMode=" + animationMode);
01010
01011             try
01012             {
01013                 if (ScrollByRequested != null)
01014                 {
01015                     ScrollControllerScrollByRequestedEventArgs e =
01016                         new ScrollControllerScrollByRequestedEventArgs(
01017                             offsetDelta,
01018                             new ScrollingScrollOptions(animationMode, ScrollingSnapPointsMode.Ignore));
01019                     ScrollByRequested(this, e);
01020                     if (e.CorrelationId != -1)
01021                     {
01022                         RaiseLogMessage("CompositionScrollController: ScrollByRequest started. OffsetsChangeCorrelationId=" + e.CorrelationId);
01023
01024                         if (hookupCompletion && !lstOffsetChangeCorrelationIds.Contains(e.CorrelationId))
01025                         {
01026                             lstOffsetChangeCorrelationIds.Add(e.CorrelationId);
01027                         }
01028                     }
01029                     return e.CorrelationId;
01030                 }
01031             }
01032             catch (Exception ex)
01033             {
01034                 RaiseLogMessage("CompositionScrollController: RaiseScrollByRequested - exception=" + ex);
01035             }
01036
01037             return -1;
01038         }
01039
01040         private int RaiseAddScrollVelocityRequested(
01041             float offsetVelocity, float? inertiaDecayRate, bool hookupCompletion)
01042         {
01043             RaiseLogMessage("CompositionScrollController: RaiseAddScrollVelocityRequested for Orientation=" + Orientation + " with offsetVelocity=" + offsetVelocity + ", inertiaDecayRate=" + inertiaDecayRate);
01044
01045             if (AddScrollVelocityRequested != null)
01046             {
01047                 ScrollControllerAddScrollVelocityRequestedEventArgs e =
01048                     new ScrollControllerAddScrollVelocityRequestedEventArgs(
01049                         offsetVelocity,
01050                         inertiaDecayRate);
01051                 AddScrollVelocityRequested(this, e);
01052                 if (e.CorrelationId != -1)
01053                 {
01054                     RaiseLogMessage("CompositionScrollController: AddScrollVelocityRequest started. OffsetsChangeCorrelationId=" + e.CorrelationId);
01055
01056                     if (hookupCompletion && !lstAddScrollVelocityCorrelationIds.Contains(e.CorrelationId))
01057                     {
01058                         lstAddScrollVelocityCorrelationIds.Add(e.CorrelationId);
01059                     }
01060                 }
01061                 return e.CorrelationId;
01062             }
01063             return -1;
01064         }
01065
01066         private void PanningFrameworkElement_PointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
01067         {
01068             Point pt = e.GetCurrentPoint(sender as UIElement).Position;
01069             RaiseLogMessage("CompositionScrollController: PanningFrameworkElement_PointerPressed for Orientation=" + Orientation + ", position=" + pt);
01070
01071             if (!CanScroll)
01072                 return;
01073
01074             switch (e.Pointer.PointerDeviceType)
01075             {
01076                 case Microsoft.UI.Input.PointerDeviceType.Touch:
01077                 case Microsoft.UI.Input.PointerDeviceType.Pen:
01078                     // Attempt an UI-thread-independent pan.
01079                     panningInfo.RaisePanRequested(e.GetCurrentPoint(null));
01080                     break;
01081                 case Microsoft.UI.Input.PointerDeviceType.Mouse:
01082                     if (!IsScrollingWithMouse)
01083                     {
01084                         // Starting a mouse-driven thumb drag.
01085                         IsScrollingWithMouse = true;
01086                         RaiseIsScrollingWithMouseChanged();
01087                     }
01088                     break;
01089             }
01090         }
01091
01092         private void PanningFrameworkElement_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
01093         {
01094             if (IsScrollingWithMouse)
01095             {
01096                 preManipulationThumbOffset = Orientation == Orientation.Horizontal ? HorizontalThumbOffset : VerticalThumbOffset;
01097             }
01098         }
01099
01100         private void PanningFrameworkElement_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
01101         {
01102             if (IsScrollingWithMouse)
01103             {
01104                 double targetThumbOffset = preManipulationThumbOffset + (Orientation == Orientation.Horizontal ? e.Cumulative.Translation.X : e.Cumulative.Translation.Y);
01105                 double scrollPresenterOffset = ScrollPresenterOffsetFromThumbOffset(targetThumbOffset);
01106
01107                 int offsetChangeCorrelationId = RaiseScrollToRequested(
01108                     scrollPresenterOffset, ScrollingAnimationMode.Disabled, true /*hookupCompletion*/);
01109             }
01110         }
01111
01112         private void PanningFrameworkElement_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
01113         {
01114             if (IsScrollingWithMouse)
01115             {
01116                 // Ending a mouse-driven thumb drag.
01117                 IsScrollingWithMouse = false;
01118                 RaiseIsScrollingWithMouseChanged();
01119             }
01120         }
01121
01122         private void UnhookHandlers()
01123         {
01124             if (horizontalDecrementRepeatButton != null)
01125             {
01126                 horizontalDecrementRepeatButton.Click -= DecrementRepeatButton_Click;
01127             }
01128
01129             if (horizontalIncrementRepeatButton != null)
01130             {
01131                 horizontalIncrementRepeatButton.Click -= IncrementRepeatButton_Click;
01132             }
01133
01134             if (verticalDecrementRepeatButton != null)
01135             {
01136                 verticalDecrementRepeatButton.Click -= DecrementRepeatButton_Click;
01137             }
01138
01139             if (verticalIncrementRepeatButton != null)
01140             {
01141                 verticalIncrementRepeatButton.Click -= IncrementRepeatButton_Click;
01142             }
01143
01144             if (panningFrameworkElement != null)
01145             {
01146                 panningFrameworkElement.PointerPressed -= PanningFrameworkElement_PointerPressed;
01147                 panningFrameworkElement.ManipulationStarting -= PanningFrameworkElement_ManipulationStarting;
01148                 panningFrameworkElement.ManipulationDelta -= PanningFrameworkElement_ManipulationDelta;
01149                 panningFrameworkElement.ManipulationCompleted -= PanningFrameworkElement_ManipulationCompleted;
01150
01151                 FrameworkElement parent = panningFrameworkElement.Parent as FrameworkElement;
01152                 if (parent != null)
01153                 {
01154                     parent.PointerPressed -= Parent_PointerPressed;
01155                 }
01156             }
01157         }
01158
01159         private bool UpdateCanScroll()
01160         {
01161             bool oldCanScroll = CanScroll;
01162
01163             CanScroll =
01164                 maxOffset > minOffset && isScrollable && IsEnabled;
01165
01166             if (oldCanScroll != CanScroll)
01167             {
01168                 RaiseCanScrollChanged();
01169                 return true;
01170             }
01171             return false;
01172         }
01173
01174         private void UpdateOrientation()
01175         {
01176             panningFrameworkElement = null;
01177
01178             if (Orientation == Orientation.Horizontal)
01179             {
01180                 if (horizontalGrid != null)
01181                     horizontalGrid.Visibility = Visibility.Visible;
01182                 if (verticalGrid != null)
01183                     verticalGrid.Visibility = Visibility.Collapsed;
01184                 panningFrameworkElement = horizontalThumb as FrameworkElement;
01185                 if (panningFrameworkElement != null)
01186                 {
01187                     panningFrameworkElement.ManipulationMode = ManipulationModes.TranslateX;
01188                 }
01189
01190                 if (horizontalDecrementRepeatButton != null)
01191                 {
01192                     horizontalDecrementRepeatButton.Click += DecrementRepeatButton_Click;
01193                 }
01194
01195                 if (horizontalIncrementRepeatButton != null)
01196                 {
01197                     horizontalIncrementRepeatButton.Click += IncrementRepeatButton_Click;
01198                 }
01199             }
01200             else
01201             {
01202                 if (verticalGrid != null)
01203                     verticalGrid.Visibility = Visibility.Visible;
01204                 if (horizontalGrid != null)
01205                     horizontalGrid.Visibility = Visibility.Collapsed;
01206                 panningFrameworkElement = verticalThumb as FrameworkElement;
01207                 if (panningFrameworkElement != null)
01208                 {
01209                     panningFrameworkElement.ManipulationMode = ManipulationModes.TranslateY;
01210                 }
01211
01212                 if (verticalDecrementRepeatButton != null)
01213                 {
01214                     verticalDecrementRepeatButton.Click += DecrementRepeatButton_Click;
01215                 }
01216
01217                 if (verticalIncrementRepeatButton != null)
01218                 {
01219                     verticalIncrementRepeatButton.Click += IncrementRepeatButton_Click;
01220                 }
01221             }
01222
01223             panningInfo.PanOrientation = Orientation;
01224
01225             if (panningFrameworkElement != null)
01226             {
01227                 // Setting up the pannable thumb for mouse-driven drags.
01228                 panningFrameworkElement.PointerPressed += PanningFrameworkElement_PointerPressed;
01229                 panningFrameworkElement.ManipulationStarting += PanningFrameworkElement_ManipulationStarting;
01230                 panningFrameworkElement.ManipulationDelta += PanningFrameworkElement_ManipulationDelta;
01231                 panningFrameworkElement.ManipulationCompleted += PanningFrameworkElement_ManipulationCompleted;
01232
01233                 FrameworkElement parent = panningFrameworkElement.Parent as FrameworkElement;
01234
01235                 if (parent != null)
01236                 {
01237                     parent.PointerPressed += Parent_PointerPressed;
01238                     panningInfo.SetPanningFrameworkElement(panningFrameworkElement);
01239                     panningInfo.StartThumbAnimation();
01240                 }
01241                 else
01242                 {
01243                     panningInfo.SetPanningFrameworkElement(null);
01244                 }
01245             }
01246             else
01247             {
01248                 panningInfo.SetPanningFrameworkElement(null);
01249             }
01250         }
01251
01252         private void UpdatePanningFrameworkElementOffset()
01253         {
01254             Visual panningVisual = panningInfo.PanningVisual;
01255
01256             if (!IsAnimatingThumbOffset && panningVisual != null)
01257             {
01258                 if (orientation == Orientation.Horizontal)
01259                 {
01260                     float horizontalThumbOffset = (float)HorizontalThumbOffset;
01261                     Vector3 currentHorizontalThumbOffset;
01262
01263                     panningVisual.Properties.TryGetVector3("Translation", out currentHorizontalThumbOffset);
01264                     if (currentHorizontalThumbOffset.X != horizontalThumbOffset)
01265                     {
01266                         RaiseLogMessage("CompositionScrollController: UpdatePanningFrameworkElementOffset for Orientation=Horizontal, HorizontalThumbOffset=" + horizontalThumbOffset);
01267                         panningVisual.Properties.InsertVector3("Translation", new Vector3(horizontalThumbOffset, 0.0f, 0.0f));
01268                     }
01269                 }
01270                 else
01271                 {
01272                     float verticalThumbOffset = (float)VerticalThumbOffset;
01273                     Vector3 currentVerticalThumbOffset;
01274
01275                     panningVisual.Properties.TryGetVector3("Translation", out currentVerticalThumbOffset);
01276                     if (currentVerticalThumbOffset.Y != verticalThumbOffset)
01277                     {
01278                         RaiseLogMessage("CompositionScrollController: UpdatePanningFrameworkElementOffset for Orientation=Vertical, VerticalThumbOffset=" + verticalThumbOffset);
01279                         panningVisual.Properties.InsertVector3("Translation", new Vector3(0.0f, verticalThumbOffset, 0.0f));
01280                     }
01281                 }
01282             }
01283             else if (!IsThumbPannable && panningFrameworkElement != null)
01284             {
01285                 Thickness margin;
01286
01287                 if (orientation == Orientation.Horizontal)
01288                 {
01289                     if (IsThumbPositionMirrored)
01290                     {
01291                         margin = new Thickness((maxOffset - offset) / panningInfo.PanningElementOffsetMultiplier, 0, 0, 0);
01292                     }
01293                     else
01294                     {
01295                         margin = new Thickness((minOffset - offset) / panningInfo.PanningElementOffsetMultiplier, 0, 0, 0);
01296                     }
01297                 }
01298                 else
01299                 {
01300                     if (IsThumbPositionMirrored)
01301                     {
01302                         margin = new Thickness(0, (maxOffset - offset) / panningInfo.PanningElementOffsetMultiplier, 0, 0);
01303                     }
01304                     else
01305                     {
01306                         margin = new Thickness(0, (minOffset - offset) / panningInfo.PanningElementOffsetMultiplier, 0, 0);
01307                     }
01308                 }
01309
01310                 panningFrameworkElement.Margin = margin;
01311             }
01312         }
01313
01314         private void DecrementRepeatButton_Click(object sender, RoutedEventArgs e)
01315         {
01316             RaiseLogMessage("CompositionScrollController: DecrementRepeatButton_Click for Orientation=" + Orientation);
01317
01318             if (!CanScroll)
01319                 return;
01320
01321             int offsetChangeCorrelationId =
01322                 RaiseAddScrollVelocityRequested(IsThumbPositionMirrored ? SmallChangeAdditionalVelocity : -SmallChangeAdditionalVelocity, SmallChangeInertiaDecayRate, true /*hookupCompletion*/);
01323         }
01324
01325         private void IncrementRepeatButton_Click(object sender, RoutedEventArgs e)
01326         {
01327             RaiseLogMessage("CompositionScrollController: IncrementRepeatButton_Click for Orientation=" + Orientation);
01328
01329             if (!CanScroll)
01330                 return;
01331
01332             int offsetChangeCorrelationId =
01333                 RaiseAddScrollVelocityRequested(IsThumbPositionMirrored ? -SmallChangeAdditionalVelocity : SmallChangeAdditionalVelocity, SmallChangeInertiaDecayRate, true /*hookupCompletion*/);
01334         }
01335
01336         // Returns the thumb offset within the track based on values provided in SetValues(...),
01337         // when the Orientation is horizontal.
01338         private double HorizontalThumbOffset
01339         {
01340             get
01341             {
01342                 if (panningFrameworkElement != null)
01343                 {
01344                     double parentWidth = 0.0;
01345                     FrameworkElement parent = panningFrameworkElement.Parent as FrameworkElement;
01346                     if (parent != null)
01347                     {
01348                         parentWidth = parent.ActualWidth;
01349                     }
01350                     if (maxOffset != minOffset)
01351                     {
01352                         if (IsThumbPositionMirrored)
01353                         {
01354                             return (maxOffset - offset) / (maxOffset - minOffset) * (parentWidth - panningFrameworkElement.Width);
01355                         }
01356                         else
01357                         {
01358                             return (offset - minOffset) / (maxOffset - minOffset) * (parentWidth - panningFrameworkElement.Width);
01359                         }
01360                     }
01361                 }
01362
01363                 return 0.0;
01364             }
01365         }
01366
01367         // Returns the thumb offset within the track based on values provided in SetValues(...),
01368         // when the Orientation is vertical.
01369         private double VerticalThumbOffset
01370         {
01371             get
01372             {
01373                 if (panningFrameworkElement != null)
01374                 {
01375                     double parentHeight = 0.0;
01376                     FrameworkElement parent = panningFrameworkElement.Parent as FrameworkElement;
01377                     if (parent != null)
01378                     {
01379                         parentHeight = parent.ActualHeight;
01380                     }
01381                     if (maxOffset != minOffset)
01382                     {
01383                         if (IsThumbPositionMirrored)
01384                         {
01385                             return (maxOffset - offset) / (maxOffset - minOffset) * (parentHeight - panningFrameworkElement.Height);
01386                         }
01387                         else
01388                         {
01389                             return (offset - minOffset) / (maxOffset - minOffset) * (parentHeight - panningFrameworkElement.Height);
01390                         }
01391                     }
01392                 }
01393
01394                 return 0.0;
01395             }
01396         }
01397
01398         private double ScrollPresenterOffsetFromThumbOffset(double thumbOffset)
01399         {
01400             double scrollPresenterOffset = 0.0;
01401
01402             if (panningFrameworkElement != null)
01403             {
01404                 double parentLength = 0.0;
01405                 double panningFrameworkElementLength =
01406                     Orientation == Orientation.Horizontal ? panningFrameworkElement.ActualWidth : panningFrameworkElement.ActualHeight;
01407                 FrameworkElement parent = panningFrameworkElement.Parent as FrameworkElement;
01408                 if (parent != null)
01409                 {
01410                     parentLength = Orientation == Orientation.Horizontal ? parent.ActualWidth : parent.ActualHeight;
01411                 }
01412                 if (parentLength != panningFrameworkElementLength)
01413                 {
01414                     if (IsThumbPositionMirrored)
01415                     {
01416                         scrollPresenterOffset = (parentLength - panningFrameworkElementLength - thumbOffset) * (maxOffset - minOffset) / (parentLength - panningFrameworkElementLength);
01417                     }
01418                     else
01419                     {
01420                         scrollPresenterOffset = thumbOffset * (maxOffset - minOffset) / (parentLength - panningFrameworkElementLength);
01421                     }
01422                 }
01423             }
01424
01425             return scrollPresenterOffset;
01426         }
01427
01428         private void CompositionScrollController_SizeChanged(object sender, SizeChangedEventArgs e)
01429         {
01430             panningInfo.UpdatePanningFrameworkElementLength(minOffset, maxOffset, viewportLength);
01431             UpdatePanningFrameworkElementOffset();
01432         }
01433
01434         private void CompositionScrollController_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
01435         {
01436             RaiseLogMessage("CompositionScrollController: IsEnabledChanged for Orientation=" + Orientation + ", IsEnabled=" + IsEnabled);
01437
01438             // CanScroll's evaluation depends on IsEnabled.
01439             UpdateCanScroll();
01440         }
01441
01442         private void Parent_PointerPressed(object sender, PointerRoutedEventArgs e)
01443         {
01444             Point pt = e.GetCurrentPoint(sender as UIElement).Position;
01445             RaiseLogMessage("CompositionScrollController: Parent_PointerPressed for Orientation=" + Orientation + ", position=" + pt);
01446
01447             if (!CanScroll)
01448                 return;
01449
01450             double relativeOffsetChange = 0.0;
01451             double newOffsetTarget = 0.0;
01452
01453             if (Orientation == Orientation.Horizontal)
01454             {
01455                 if (pt.X < HorizontalThumbOffset)
01456                 {
01457                     if (IsThumbPositionMirrored)
01458                         relativeOffsetChange = viewportLength;
01459                     else
01460                         relativeOffsetChange = -viewportLength;
01461                 }
01462                 else if (pt.X > HorizontalThumbOffset + panningFrameworkElement.ActualWidth)
01463                 {
01464                     if (IsThumbPositionMirrored)
01465                         relativeOffsetChange = -viewportLength;
01466                     else
01467                         relativeOffsetChange = viewportLength;
01468                 }
01469                 else
01470                 {
01471                     return;
01472                 }
01473             }
01474             else
01475             {
01476                 if (pt.Y < VerticalThumbOffset)
01477                 {
01478                     if (IsThumbPositionMirrored)
01479                         relativeOffsetChange = viewportLength;
01480                     else
01481                         relativeOffsetChange = -viewportLength;
01482                 }
01483                 else if (pt.Y > VerticalThumbOffset + panningFrameworkElement.ActualHeight)
01484                 {
01485                     if (IsThumbPositionMirrored)
01486                         relativeOffsetChange = -viewportLength;
01487                     else
01488                         relativeOffsetChange = viewportLength;
01489                 }
01490                 else
01491                 {
01492                     return;
01493                 }
01494             }
01495
01496             newOffsetTarget = offsetTarget + relativeOffsetChange;
01497             newOffsetTarget = Math.Max(minOffset, newOffsetTarget);
01498             newOffsetTarget = Math.Min(maxOffset, newOffsetTarget);
01499             relativeOffsetChange = newOffsetTarget - offsetTarget;
01500             offsetTarget = newOffsetTarget;
01501
01502             int offsetChangeCorrelationId = RaiseScrollToRequested(
01503                 offsetTarget, ScrollingAnimationMode.Auto, true /*hookupCompletion*/);
01504             if (offsetChangeCorrelationId != -1 && !operations.ContainsKey(offsetChangeCorrelationId))
01505             {
01506                 operations.Add(offsetChangeCorrelationId, new OperationInfo(offsetChangeCorrelationId, relativeOffsetChange, offsetTarget));
01507             }
01508         }
01509     }
01510 }
Generated on Sun Dec 1 2024 20:52:16 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/GroupedListViewBasePage.xaml.cs Source File

  • CommonStyles
  • TestUI

GroupedListViewBasePage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Controls;
00006 using Microsoft.UI.Xaml.Controls.Primitives;
00007 using Microsoft.UI.Xaml.Data;
00008 using Microsoft.UI.Xaml.Input;
00009 using Microsoft.UI.Xaml.Media;
00010 using Microsoft.UI.Xaml.Media.Imaging;
00011 using Microsoft.UI.Xaml.Navigation;
00012 using MUXControlsTestApp.Samples.Model;
00013 using System;
00014 using System.Collections.Generic;
00015 using System.Collections.ObjectModel;
00016 using System.Linq;
00017
00018 namespace MUXControlsTestApp
00019 {
00020     public sealed partial class GroupedListViewBasePage : TestPage
00021     {
00022         private GroupedListViewBaseViewModel _groupedListViewBaseViewModel = new GroupedListViewBaseViewModel();
00023         private CollectionViewSource _cvs = new CollectionViewSource();
00024         private ListViewBase _listViewBase = null;
00025         private ScrollViewer _scrollViewer = null;
00026
00027         public GroupedListViewBasePage()
00028         {
00029             this.InitializeComponent();
00030
00031             _cvs.Source = _groupedListViewBaseViewModel.Items;
00032             _cvs.IsSourceGrouped = true;
00033             _cvs.ItemsPath = new PropertyPath("Items");
00034
00035             Loaded += GroupedListViewBasePage_Loaded;
00036         }
00037
00038         protected override void OnNavigatedTo(NavigationEventArgs e)
00039         {
00040             bool useGridView = (bool)e.Parameter;
00041
00042             tblGroupedListViewBasePageTitle.Text = useGridView ? "Grouped GridView" : "Grouped ListView";
00043             _listViewBase = useGridView ? gridView : listView;
00044             _listViewBase.Visibility = Visibility.Visible;
00045             _listViewBase.ItemsSource = _cvs.View;
00046
00047             if (cmbListViewBaseItemsPanelType != null)
00048             {
00049                 cmbListViewBaseItemsPanelType.SelectedIndex = useGridView ? 0 : 1;
00050             }
00051
00052             base.OnNavigatedTo(e);
00053         }
00054
00055         private void GroupedListViewBasePage_Loaded(object sender, RoutedEventArgs e)
00056         {
00057             _scrollViewer = FindElementOfTypeInSubtree<ScrollViewer>(_listViewBase);
00058
00059             if (_scrollViewer != null)
00060             {
00061                 _scrollViewer.ViewChanged += ScrollViewer_ViewChanged;
00062             }
00063
00064             UpdateItemsPanelType();
00065             UpdateListViewBaseProperties();
00066         }
00067
00068         private void ListViewBase_ItemClick(object sender, ItemClickEventArgs e)
00069         {
00070             try
00071             {
00072                 AppendEventMessage($"ListViewBase_ItemClick ClickedItem={e.ClickedItem.ToString()}");
00073             }
00074             catch (Exception ex)
00075             {
00076                 txtExceptionReport.Text = ex.ToString();
00077                 AppendEventMessage(ex.ToString());
00078             }
00079         }
00080
00081         private void ScrollViewer_ViewChanged(object sender, object e)
00082         {
00083             try
00084             {
00085                 if (_scrollViewer != null && txtScrollViewerHorizontalOffset != null && txtScrollViewerVerticalOffset != null)
00086                 {
00087                     txtScrollViewerHorizontalOffset.Text = _scrollViewer.HorizontalOffset.ToString();
00088                     txtScrollViewerVerticalOffset.Text = _scrollViewer.VerticalOffset.ToString();
00089                 }
00090             }
00091             catch (Exception ex)
00092             {
00093                 txtExceptionReport.Text = ex.ToString();
00094                 AppendEventMessage(ex.ToString());
00095             }
00096         }
00097
00098         // Workaround to avoid the ListViewBase not being scrollable after an ItemsPanel change to VirtualizingStackPanel.
00099         private void RestoreScrollViewerWidth()
00100         {
00101             if (_scrollViewer != null)
00102             {
00103                 _scrollViewer.Width = double.NaN;
00104
00105                 _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateScrollViewerSizeProperties);
00106             }
00107         }
00108
00109         private void UpdateItemsWrapGridUIVisibility(Visibility visibility)
00110         {
00111             tblItemsWrapGridProperties.Visibility = visibility;
00112             tblItemsWrapGridMaximumRowsOrColumns.Visibility = visibility;
00113             nbItemsWrapGridMaximumRowsOrColumns.Visibility = visibility;
00114             tblItemsWrapGridItemWidth.Visibility = visibility;
00115             txtItemsWrapGridItemWidth.Visibility = visibility;
00116             btnGetItemsWrapGridItemWidth.Visibility = visibility;
00117             btnSetItemsWrapGridItemWidth.Visibility = visibility;
00118             tblItemsWrapGridItemHeight.Visibility = visibility;
00119             txtItemsWrapGridItemHeight.Visibility = visibility;
00120             btnGetItemsWrapGridItemHeight.Visibility = visibility;
00121             btnSetItemsWrapGridItemHeight.Visibility = visibility;
00122         }
00123
00124         private void UpdateItemsPanelType()
00125         {
00126             try
00127             {
00128                 if (_listViewBase != null && cmbListViewBaseItemsPanelType != null)
00129                 {
00130                     switch (cmbListViewBaseItemsPanelType.SelectedIndex)
00131                     {
00132                         case 0: // Use the itemsWrapGridItemsPanelTemplate resource
00133                             _listViewBase.ItemsPanel = Resources["itemsWrapGridItemsPanelTemplate"] as ItemsPanelTemplate;
00134                             UpdateItemsWrapGridUIVisibility(Visibility.Visible);
00135                             break;
00136                         case 1: // Use the itemsStackPanelItemsPanelTemplate resource
00137                             _listViewBase.ItemsPanel = Resources["itemsStackPanelItemsPanelTemplate"] as ItemsPanelTemplate;
00138                             UpdateItemsWrapGridUIVisibility(Visibility.Collapsed);
00139                             break;
00140                         case 2: // Use the virtualizingStackPanelItemsPanelTemplate resource
00141                             _listViewBase.ItemsPanel = Resources["virtualizingStackPanelItemsPanelTemplate"] as ItemsPanelTemplate;
00142                             UpdateItemsWrapGridUIVisibility(Visibility.Collapsed);
00143                             break;
00144                     }
00145
00146                     // _listViewBase.ItemsPanelRoot is only updated asynchronously.
00147                     _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateItemsPanelProperties);
00148                 }
00149             }
00150             catch (Exception ex)
00151             {
00152                 txtExceptionReport.Text = ex.ToString();
00153                 AppendEventMessage(ex.ToString());
00154             }
00155         }
00156
00157         private void UpdateItemsPanelProperties()
00158         {
00159             UpdateItemsPanelOrientation();
00160             UpdateItemsPanelGroupHeaderPlacement();
00161             UpdateItemsPanelMargin();
00162             UpdateItemsPanelGroupPadding();
00163             UpdateItemsPanelAreStickyGroupHeadersEnabled();
00164             UpdateItemsPanelCacheLength();
00165             UpdateItemsWrapGridItemWidth();
00166             UpdateItemsWrapGridItemHeight();
00167
00168             // _listViewBase.ItemsPanelRoot is only updated asynchronously.
00169             _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateScrollViewerScrollOrientation);
00170             _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateScrollViewerProperties);
00171         }
00172
00173         private void UpdateListViewBaseProperties()
00174         {
00175             UpdateListViewBaseSelectionMode();
00176             UpdateListViewBaseSingleSelectionFollowsFocus();
00177             UpdateListViewBaseTabNavigation();
00178         }
00179
00180         private void UpdateScrollViewerSizeProperties()
00181         {
00182             UpdateScrollViewerViewportWidth();
00183             UpdateScrollViewerViewportHeight();
00184             UpdateScrollViewerExtentWidth();
00185             UpdateScrollViewerExtentHeight();
00186             UpdateScrollViewerHorizontalOffset();
00187             UpdateScrollViewerVerticalOffset();
00188         }
00189
00190         private void UpdateScrollViewerProperties()
00191         {
00192             if (_listViewBase != null && _scrollViewer != null && _listViewBase.ItemsPanelRoot is VirtualizingStackPanel)
00193             {
00194                 // Workaround to avoid the ListViewBase not being scrollable after an ItemsPanel change to VirtualizingStackPanel.
00195                 // Resizing the ScrollViewer temporarily fixes its manipulability.
00196                 _scrollViewer.Width = _scrollViewer.ActualWidth + 1;
00197
00198                 _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, RestoreScrollViewerWidth);
00199             }
00200
00201             UpdateScrollViewerSizeProperties();
00202             UpdateScrollViewerHorizontalScrollMode();
00203             UpdateScrollViewerVerticalScrollMode();
00204             UpdateScrollViewerHorizontalSnapPointsType();
00205             UpdateScrollViewerVerticalSnapPointsType();
00206         }
00207
00208         private void UpdateListViewBaseSelectionMode()
00209         {
00210             if (_listViewBase != null && cmbListViewBaseSelectionMode != null)
00211             {
00212                 cmbListViewBaseSelectionMode.SelectedIndex = (int)_listViewBase.SelectionMode;
00213             }
00214         }
00215
00216         private void UpdateListViewBaseSingleSelectionFollowsFocus()
00217         {
00218             if (_listViewBase != null && chkListViewBaseSingleSelectionFollowsFocus != null)
00219             {
00220                 chkListViewBaseSingleSelectionFollowsFocus.IsChecked = _listViewBase.SingleSelectionFollowsFocus;
00221             }
00222         }
00223
00224         private void UpdateListViewBaseTabNavigation()
00225         {
00226             if (_listViewBase != null && cmbListViewBaseTabNavigation != null)
00227             {
00228                 cmbListViewBaseTabNavigation.SelectedIndex = (int)_listViewBase.TabNavigation;
00229             }
00230         }
00231
00232         private void UpdateItemsPanelOrientation()
00233         {
00234             try
00235             {
00236                 if (_listViewBase != null && cmbItemsPanelOrientation != null)
00237                 {
00238                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00239
00240                     if (itemsWrapGrid != null)
00241                     {
00242                         cmbItemsPanelOrientation.SelectedIndex = (int)itemsWrapGrid.Orientation;
00243                     }
00244                     else
00245                     {
00246                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00247
00248                         if (itemsStackPanel != null)
00249                         {
00250                             cmbItemsPanelOrientation.SelectedIndex = (int)itemsStackPanel.Orientation;
00251                         }
00252                         else
00253                         {
00254                             VirtualizingStackPanel virtualizingStackPanel = _listViewBase.ItemsPanelRoot as VirtualizingStackPanel;
00255
00256                             if (virtualizingStackPanel != null)
00257                             {
00258                                 cmbItemsPanelOrientation.SelectedIndex = (int)virtualizingStackPanel.Orientation;
00259                             }
00260                         }
00261                     }
00262                 }
00263             }
00264             catch (Exception ex)
00265             {
00266                 txtExceptionReport.Text = ex.ToString();
00267                 AppendEventMessage(ex.ToString());
00268             }
00269         }
00270
00271         private void UpdateItemsPanelGroupHeaderPlacement()
00272         {
00273             try
00274             {
00275                 if (_listViewBase != null && cmbItemsPanelGroupHeaderPlacement != null)
00276                 {
00277                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00278
00279                     if (itemsWrapGrid != null)
00280                     {
00281                         cmbItemsPanelGroupHeaderPlacement.SelectedIndex = (int)itemsWrapGrid.GroupHeaderPlacement;
00282                     }
00283                     else
00284                     {
00285                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00286
00287                         if (itemsStackPanel != null)
00288                         {
00289                             cmbItemsPanelGroupHeaderPlacement.SelectedIndex = (int)itemsStackPanel.GroupHeaderPlacement;
00290                         }
00291                     }
00292                 }
00293             }
00294             catch (Exception ex)
00295             {
00296                 txtExceptionReport.Text = ex.ToString();
00297                 AppendEventMessage(ex.ToString());
00298             }
00299         }
00300
00301         private void UpdateItemsPanelMargin()
00302         {
00303             try
00304             {
00305                 if (_listViewBase != null && txtItemsPanelMargin != null)
00306                 {
00307                     Panel itemsPanel = _listViewBase.ItemsPanelRoot;
00308
00309                     if (itemsPanel != null)
00310                     {
00311                         txtItemsPanelMargin.Text = itemsPanel.Margin.ToString();
00312                     }
00313                 }
00314             }
00315             catch (Exception ex)
00316             {
00317                 txtExceptionReport.Text = ex.ToString();
00318                 AppendEventMessage(ex.ToString());
00319             }
00320         }
00321
00322         private void UpdateItemsPanelGroupPadding()
00323         {
00324             try
00325             {
00326                 if (_listViewBase != null && txtItemsPanelGroupPadding != null)
00327                 {
00328                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00329
00330                     if (itemsWrapGrid != null)
00331                     {
00332                         txtItemsPanelGroupPadding.Text = itemsWrapGrid.GroupPadding.ToString();
00333                     }
00334                     else
00335                     {
00336                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00337
00338                         if (itemsStackPanel != null)
00339                         {
00340                             txtItemsPanelGroupPadding.Text = itemsStackPanel.GroupPadding.ToString();
00341                         }
00342                     }
00343                 }
00344             }
00345             catch (Exception ex)
00346             {
00347                 txtExceptionReport.Text = ex.ToString();
00348                 AppendEventMessage(ex.ToString());
00349             }
00350         }
00351
00352         private void UpdateItemsPanelAreStickyGroupHeadersEnabled()
00353         {
00354             try
00355             {
00356                 if (_listViewBase != null && chkItemsPanelAreStickyGroupHeadersEnabled != null)
00357                 {
00358                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00359
00360                     if (itemsWrapGrid != null)
00361                     {
00362                         chkItemsPanelAreStickyGroupHeadersEnabled.IsChecked = itemsWrapGrid.AreStickyGroupHeadersEnabled;
00363                     }
00364                     else
00365                     {
00366                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00367
00368                         if (itemsStackPanel != null)
00369                         {
00370                             chkItemsPanelAreStickyGroupHeadersEnabled.IsChecked = itemsStackPanel.AreStickyGroupHeadersEnabled;
00371                         }
00372                     }
00373                 }
00374             }
00375             catch (Exception ex)
00376             {
00377                 txtExceptionReport.Text = ex.ToString();
00378                 AppendEventMessage(ex.ToString());
00379             }
00380         }
00381
00382         private void UpdateItemsPanelCacheLength()
00383         {
00384             try
00385             {
00386                 if (_listViewBase != null && txtItemsPanelCacheLength != null)
00387                 {
00388                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00389
00390                     if (itemsWrapGrid != null)
00391                     {
00392                         txtItemsPanelCacheLength.Text = itemsWrapGrid.CacheLength.ToString();
00393                     }
00394                     else
00395                     {
00396                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00397
00398                         if (itemsStackPanel != null)
00399                         {
00400                             txtItemsPanelCacheLength.Text = itemsStackPanel.CacheLength.ToString();
00401                         }
00402                     }
00403                 }
00404             }
00405             catch (Exception ex)
00406             {
00407                 txtExceptionReport.Text = ex.ToString();
00408                 AppendEventMessage(ex.ToString());
00409             }
00410         }
00411
00412         private void UpdateItemsWrapGridItemWidth()
00413         {
00414             try
00415             {
00416                 if (_listViewBase != null && txtItemsWrapGridItemWidth != null)
00417                 {
00418                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00419
00420                     if (itemsWrapGrid != null)
00421                     {
00422                         txtItemsWrapGridItemWidth.Text = itemsWrapGrid.ItemWidth.ToString();
00423                     }
00424                 }
00425             }
00426             catch (Exception ex)
00427             {
00428                 txtExceptionReport.Text = ex.ToString();
00429                 AppendEventMessage(ex.ToString());
00430             }
00431         }
00432
00433         private void UpdateItemsWrapGridItemHeight()
00434         {
00435             try
00436             {
00437                 if (_listViewBase != null && txtItemsWrapGridItemHeight != null)
00438                 {
00439                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00440
00441                     if (itemsWrapGrid != null)
00442                     {
00443                         txtItemsWrapGridItemHeight.Text = itemsWrapGrid.ItemHeight.ToString();
00444                     }
00445                 }
00446             }
00447             catch (Exception ex)
00448             {
00449                 txtExceptionReport.Text = ex.ToString();
00450                 AppendEventMessage(ex.ToString());
00451             }
00452         }
00453
00454         private void UpdateScrollViewerScrollOrientation()
00455         {
00456             try
00457             {
00458                 if (_listViewBase != null)
00459                 {
00460                     Orientation scrollOrientation = Orientation.Horizontal;
00461
00462                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00463
00464                     if (itemsWrapGrid != null)
00465                     {
00466                         if (itemsWrapGrid.Orientation == Orientation.Horizontal)
00467                         {
00468                             scrollOrientation = Orientation.Vertical;
00469                         }
00470                     }
00471                     else
00472                     {
00473                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00474
00475                         if (itemsStackPanel != null)
00476                         {
00477                             if (itemsStackPanel.Orientation == Orientation.Vertical)
00478                             {
00479                                 scrollOrientation = Orientation.Vertical;
00480                             }
00481                         }
00482                         else
00483                         {
00484                             VirtualizingStackPanel virtualizingStackPanel = _listViewBase.ItemsPanelRoot as VirtualizingStackPanel;
00485
00486                             if (virtualizingStackPanel != null)
00487                             {
00488                                 if (virtualizingStackPanel.Orientation == Orientation.Vertical)
00489                                 {
00490                                     scrollOrientation = Orientation.Vertical;
00491                                 }
00492                             }
00493                         }
00494                     }
00495
00496                     if (scrollOrientation == Orientation.Vertical)
00497                     {
00498                         ScrollViewer.SetHorizontalScrollBarVisibility(_listViewBase, ScrollBarVisibility.Disabled);
00499                         ScrollViewer.SetVerticalScrollBarVisibility(_listViewBase, ScrollBarVisibility.Auto);
00500                         ScrollViewer.SetHorizontalScrollMode(_listViewBase, ScrollMode.Disabled);
00501                         ScrollViewer.SetVerticalScrollMode(_listViewBase, ScrollMode.Enabled);
00502                         ScrollViewer.SetIsHorizontalRailEnabled(_listViewBase, false);
00503                         ScrollViewer.SetIsVerticalRailEnabled(_listViewBase, true);
00504                     }
00505                     else
00506                     {
00507                         ScrollViewer.SetHorizontalScrollBarVisibility(_listViewBase, ScrollBarVisibility.Auto);
00508                         ScrollViewer.SetVerticalScrollBarVisibility(_listViewBase, ScrollBarVisibility.Disabled);
00509                         ScrollViewer.SetHorizontalScrollMode(_listViewBase, ScrollMode.Enabled);
00510                         ScrollViewer.SetVerticalScrollMode(_listViewBase, ScrollMode.Disabled);
00511                         ScrollViewer.SetIsHorizontalRailEnabled(_listViewBase, true);
00512                         ScrollViewer.SetIsVerticalRailEnabled(_listViewBase, false);
00513                     }
00514
00515                     // Let the ScrollViewer layout itself before reading its updated properties.
00516                     _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateScrollViewerProperties);
00517                 }
00518             }
00519             catch (Exception ex)
00520             {
00521                 txtExceptionReport.Text = ex.ToString();
00522                 AppendEventMessage(ex.ToString());
00523             }
00524         }
00525
00526         private void UpdateScrollViewerHorizontalScrollMode()
00527         {
00528             try
00529             {
00530                 if (_scrollViewer != null && cmbScrollViewerHorizontalScrollMode != null)
00531                 {
00532                     cmbScrollViewerHorizontalScrollMode.SelectedIndex = (int)_scrollViewer.HorizontalScrollMode;
00533                 }
00534             }
00535             catch (Exception ex)
00536             {
00537                 txtExceptionReport.Text = ex.ToString();
00538                 AppendEventMessage(ex.ToString());
00539             }
00540         }
00541
00542         private void UpdateScrollViewerVerticalScrollMode()
00543         {
00544             try
00545             {
00546                 if (_scrollViewer != null && cmbScrollViewerVerticalScrollMode != null)
00547                 {
00548                     cmbScrollViewerVerticalScrollMode.SelectedIndex = (int)_scrollViewer.VerticalScrollMode;
00549                 }
00550             }
00551             catch (Exception ex)
00552             {
00553                 txtExceptionReport.Text = ex.ToString();
00554                 AppendEventMessage(ex.ToString());
00555             }
00556         }
00557
00558         private void UpdateScrollViewerHorizontalSnapPointsType()
00559         {
00560             try
00561             {
00562                 if (_scrollViewer != null && cmbScrollViewerHorizontalSnapPointsType != null)
00563                 {
00564                     cmbScrollViewerHorizontalSnapPointsType.SelectedIndex = (int)_scrollViewer.HorizontalSnapPointsType;
00565                 }
00566             }
00567             catch (Exception ex)
00568             {
00569                 txtExceptionReport.Text = ex.ToString();
00570                 AppendEventMessage(ex.ToString());
00571             }
00572         }
00573
00574         private void UpdateScrollViewerVerticalSnapPointsType()
00575         {
00576             try
00577             {
00578                 if (_scrollViewer != null && cmbScrollViewerVerticalSnapPointsType != null)
00579                 {
00580                     cmbScrollViewerVerticalSnapPointsType.SelectedIndex = (int)_scrollViewer.VerticalSnapPointsType;
00581                 }
00582             }
00583             catch (Exception ex)
00584             {
00585                 txtExceptionReport.Text = ex.ToString();
00586                 AppendEventMessage(ex.ToString());
00587             }
00588         }
00589
00590         private void UpdateScrollViewerViewportWidth()
00591         {
00592             try
00593             {
00594                 if (_scrollViewer != null && txtScrollViewerViewportWidth != null)
00595                 {
00596                     txtScrollViewerViewportWidth.Text = _scrollViewer.ViewportWidth.ToString();
00597                 }
00598             }
00599             catch (Exception ex)
00600             {
00601                 txtExceptionReport.Text = ex.ToString();
00602                 AppendEventMessage(ex.ToString());
00603             }
00604         }
00605
00606         private void UpdateScrollViewerViewportHeight()
00607         {
00608             try
00609             {
00610                 if (_scrollViewer != null && txtScrollViewerViewportHeight != null)
00611                 {
00612                     txtScrollViewerViewportHeight.Text = _scrollViewer.ViewportHeight.ToString();
00613                 }
00614             }
00615             catch (Exception ex)
00616             {
00617                 txtExceptionReport.Text = ex.ToString();
00618                 AppendEventMessage(ex.ToString());
00619             }
00620         }
00621
00622         private void UpdateScrollViewerExtentWidth()
00623         {
00624             try
00625             {
00626                 if (_scrollViewer != null && txtScrollViewerExtentWidth != null)
00627                 {
00628                     txtScrollViewerExtentWidth.Text = _scrollViewer.ExtentWidth.ToString();
00629                 }
00630             }
00631             catch (Exception ex)
00632             {
00633                 txtExceptionReport.Text = ex.ToString();
00634                 AppendEventMessage(ex.ToString());
00635             }
00636         }
00637
00638         private void UpdateScrollViewerExtentHeight()
00639         {
00640             try
00641             {
00642                 if (_scrollViewer != null && txtScrollViewerExtentHeight != null)
00643                 {
00644                     txtScrollViewerExtentHeight.Text = _scrollViewer.ExtentHeight.ToString();
00645                 }
00646             }
00647             catch (Exception ex)
00648             {
00649                 txtExceptionReport.Text = ex.ToString();
00650                 AppendEventMessage(ex.ToString());
00651             }
00652         }
00653
00654         private void UpdateScrollViewerHorizontalOffset()
00655         {
00656             try
00657             {
00658                 if (_scrollViewer != null && txtScrollViewerHorizontalOffset != null)
00659                 {
00660                     txtScrollViewerHorizontalOffset.Text = _scrollViewer.HorizontalOffset.ToString();
00661                 }
00662             }
00663             catch (Exception ex)
00664             {
00665                 txtExceptionReport.Text = ex.ToString();
00666                 AppendEventMessage(ex.ToString());
00667             }
00668         }
00669
00670         private void UpdateScrollViewerVerticalOffset()
00671         {
00672             try
00673             {
00674                 if (_scrollViewer != null && txtScrollViewerVerticalOffset != null)
00675                 {
00676                     txtScrollViewerVerticalOffset.Text = _scrollViewer.VerticalOffset.ToString();
00677                 }
00678             }
00679             catch (Exception ex)
00680             {
00681                 txtExceptionReport.Text = ex.ToString();
00682                 AppendEventMessage(ex.ToString());
00683             }
00684         }
00685
00686         private void CmbListViewBaseItemsPanelType_SelectionChanged(object sender, SelectionChangedEventArgs e)
00687         {
00688             UpdateItemsPanelType();
00689         }
00690
00691         private void BtnGetListViewBaseSelectionMode_Click(object sender, RoutedEventArgs e)
00692         {
00693             UpdateListViewBaseSelectionMode();
00694         }
00695
00696         private void BtnSetListViewBaseSelectionMode_Click(object sender, RoutedEventArgs e)
00697         {
00698             if (_listViewBase != null && cmbListViewBaseSelectionMode != null)
00699             {
00700                 _listViewBase.SelectionMode = (ListViewSelectionMode) cmbListViewBaseSelectionMode.SelectedIndex;
00701             }
00702         }
00703
00704         private void BtnGetListViewBaseTabNavigation_Click(object sender, RoutedEventArgs e)
00705         {
00706             UpdateListViewBaseTabNavigation();
00707         }
00708
00709         private void BtnSetListViewBaseTabNavigation_Click(object sender, RoutedEventArgs e)
00710         {
00711             if (_listViewBase != null && cmbListViewBaseTabNavigation != null)
00712             {
00713                 _listViewBase.TabNavigation = (KeyboardNavigationMode)cmbListViewBaseTabNavigation.SelectedIndex;
00714             }
00715         }
00716
00717         private void ChkListViewBaseIsItemClickEnabled_IsCheckedChanged(object sender, RoutedEventArgs e)
00718         {
00719             try
00720             {
00721                 if (_listViewBase != null)
00722                 {
00723                     _listViewBase.IsItemClickEnabled = (bool)chkListViewBaseIsItemClickEnabled.IsChecked;
00724                 }
00725             }
00726             catch (Exception ex)
00727             {
00728                 txtExceptionReport.Text = ex.ToString();
00729                 AppendEventMessage(ex.ToString());
00730             }
00731         }
00732
00733         private void ChkListViewBaseSingleSelectionFollowsFocus_IsCheckedChanged(object sender, RoutedEventArgs e)
00734         {
00735             try
00736             {
00737                 if (_listViewBase != null)
00738                 {
00739                     _listViewBase.SingleSelectionFollowsFocus = (bool)chkListViewBaseSingleSelectionFollowsFocus.IsChecked;
00740                 }
00741             }
00742             catch (Exception ex)
00743             {
00744                 txtExceptionReport.Text = ex.ToString();
00745                 AppendEventMessage(ex.ToString());
00746             }
00747         }
00748
00749         private void CmbListViewBaseHeader_SelectionChanged(object sender, SelectionChangedEventArgs e)
00750         {
00751             try
00752             {
00753                 if (_listViewBase != null && cmbListViewBaseHeader != null)
00754                 {
00755                     switch (cmbListViewBaseHeader.SelectedIndex)
00756                     {
00757                         case 0: /*None*/
00758                             _listViewBase.Header = null;
00759                             break;
00760                         case 1: /*Non-focusable*/
00761                             _listViewBase.Header = new TextBlock()
00762                             {
00763                                 FontSize = 18.0,
00764                                 Margin = new Thickness(10.0),
00765                                 Text = "Header"
00766                             };
00767                             break;
00768                         case 2: /*Non-focusable*/
00769                             _listViewBase.Header = new Button()
00770                             {
00771                                 Content = "Header",
00772                                 FontSize = 18.0,
00773                                 Margin = new Thickness(10.0)
00774                             };
00775                             break;
00776                     }
00777                 }
00778             }
00779             catch (Exception ex)
00780             {
00781                 txtExceptionReport.Text = ex.ToString();
00782                 AppendEventMessage(ex.ToString());
00783             }
00784         }
00785
00786         private void CmbListViewBaseFooter_SelectionChanged(object sender, SelectionChangedEventArgs e)
00787         {
00788             try
00789             {
00790                 if (_listViewBase != null && cmbListViewBaseFooter != null)
00791                 {
00792                     switch (cmbListViewBaseFooter.SelectedIndex)
00793                     {
00794                         case 0: /*None*/
00795                             _listViewBase.Footer = null;
00796                             break;
00797                         case 1: /*Non-focusable*/
00798                             _listViewBase.Footer = new TextBlock()
00799                             {
00800                                 FontSize = 18.0,
00801                                 Margin = new Thickness(10.0),
00802                                 Text = "Footer"
00803                             };
00804                             break;
00805                         case 2: /*Non-focusable*/
00806                             _listViewBase.Footer = new Button()
00807                             {
00808                                 Content = "Footer",
00809                                 FontSize = 18.0,
00810                                 Margin = new Thickness(10.0)
00811                             };
00812                             break;
00813                     }
00814                 }
00815             }
00816             catch (Exception ex)
00817             {
00818                 txtExceptionReport.Text = ex.ToString();
00819                 AppendEventMessage(ex.ToString());
00820             }
00821         }
00822
00823         private void ChkItemsPanelAreStickyGroupHeadersEnabled_IsCheckedChanged(object sender, RoutedEventArgs e)
00824         {
00825             try
00826             {
00827                 if (_listViewBase != null)
00828                 {
00829                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00830
00831                     if (itemsWrapGrid != null)
00832                     {
00833                         itemsWrapGrid.AreStickyGroupHeadersEnabled = (bool)chkItemsPanelAreStickyGroupHeadersEnabled.IsChecked;
00834                     }
00835                     else
00836                     {
00837                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00838
00839                         if (itemsStackPanel != null)
00840                         {
00841                             itemsStackPanel.AreStickyGroupHeadersEnabled = (bool)chkItemsPanelAreStickyGroupHeadersEnabled.IsChecked;
00842                         }
00843                     }
00844                 }
00845             }
00846             catch (Exception ex)
00847             {
00848                 txtExceptionReport.Text = ex.ToString();
00849                 AppendEventMessage(ex.ToString());
00850             }
00851         }
00852
00853         private void BtnGetItemsPanelOrientation_Click(object sender, RoutedEventArgs e)
00854         {
00855             UpdateItemsPanelOrientation();
00856         }
00857
00858         private void BtnSetItemsPanelOrientation_Click(object sender, RoutedEventArgs e)
00859         {
00860             try
00861             {
00862                 if (_listViewBase != null && cmbItemsPanelOrientation != null)
00863                 {
00864                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00865
00866                     if (itemsWrapGrid != null)
00867                     {
00868                         if (itemsWrapGrid != null && itemsWrapGrid.Orientation != (Orientation)cmbItemsPanelOrientation.SelectedIndex)
00869                         {
00870                             _listViewBase.ItemsSource = null;
00871
00872                             itemsWrapGrid.Orientation = (Orientation)cmbItemsPanelOrientation.SelectedIndex;
00873                         }
00874                     }
00875                     else
00876                     {
00877                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00878
00879                         if (itemsStackPanel != null)
00880                         {
00881                             if (itemsStackPanel != null && itemsStackPanel.Orientation != (Orientation)cmbItemsPanelOrientation.SelectedIndex)
00882                             {
00883                                 _listViewBase.ItemsSource = null;
00884
00885                                 itemsStackPanel.Orientation = (Orientation)cmbItemsPanelOrientation.SelectedIndex;
00886                             }
00887                         }
00888                         else
00889                         {
00890                             VirtualizingStackPanel virtualizingStackPanel = _listViewBase.ItemsPanelRoot as VirtualizingStackPanel;
00891
00892                             if (virtualizingStackPanel != null && virtualizingStackPanel.Orientation != (Orientation)cmbItemsPanelOrientation.SelectedIndex)
00893                             {
00894                                 _listViewBase.ItemsSource = null;
00895
00896                                 virtualizingStackPanel.Orientation = (Orientation)cmbItemsPanelOrientation.SelectedIndex;
00897                             }
00898                         }
00899                     }
00900
00901                     if (_listViewBase.ItemsSource != _cvs.View)
00902                     {
00903                         _listViewBase.ItemsSource = _cvs.View;
00904                     }
00905
00906                     // _listViewBase.ItemsPanelRoot is only updated asynchronously.
00907                     _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateScrollViewerScrollOrientation);
00908                     _ = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, UpdateScrollViewerProperties);
00909                 }
00910             }
00911             catch (Exception ex)
00912             {
00913                 txtExceptionReport.Text = ex.ToString();
00914                 AppendEventMessage(ex.ToString());
00915             }
00916         }
00917
00918         private void BtnGetItemsPanelGroupHeaderPlacement_Click(object sender, RoutedEventArgs e)
00919         {
00920             UpdateItemsPanelGroupHeaderPlacement();
00921         }
00922
00923         private void BtnSetItemsPanelGroupHeaderPlacement_Click(object sender, RoutedEventArgs e)
00924         {
00925             try
00926             {
00927                 if (_listViewBase != null && cmbItemsPanelGroupHeaderPlacement != null)
00928                 {
00929                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00930
00931                     if (itemsWrapGrid != null)
00932                     {
00933                         itemsWrapGrid.GroupHeaderPlacement = (GroupHeaderPlacement)cmbItemsPanelGroupHeaderPlacement.SelectedIndex;
00934                     }
00935                     else
00936                     {
00937                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00938
00939                         if (itemsStackPanel != null)
00940                         {
00941                             itemsStackPanel.GroupHeaderPlacement = (GroupHeaderPlacement)cmbItemsPanelGroupHeaderPlacement.SelectedIndex;
00942                         }
00943                     }
00944                 }
00945             }
00946             catch (Exception ex)
00947             {
00948                 txtExceptionReport.Text = ex.ToString();
00949                 AppendEventMessage(ex.ToString());
00950             }
00951         }
00952
00953         private void BtnGetItemsPanelMargin_Click(object sender, RoutedEventArgs e)
00954         {
00955             UpdateItemsPanelMargin();
00956         }
00957
00958         private void BtnSetItemsPanelMargin_Click(object sender, RoutedEventArgs e)
00959         {
00960             try
00961             {
00962                 if (_listViewBase != null && txtItemsPanelMargin != null)
00963                 {
00964                     Panel itemsPanel = _listViewBase.ItemsPanelRoot;
00965
00966                     if (itemsPanel != null)
00967                     {
00968                         itemsPanel.Margin = GetThicknessFromString(txtItemsPanelMargin.Text);
00969                     }
00970                 }
00971             }
00972             catch (Exception ex)
00973             {
00974                 txtExceptionReport.Text = ex.ToString();
00975                 AppendEventMessage(ex.ToString());
00976             }
00977         }
00978
00979         private void BtnGetItemsPanelGroupPadding_Click(object sender, RoutedEventArgs e)
00980         {
00981             UpdateItemsPanelGroupPadding();
00982         }
00983
00984         private void BtnSetItemsPanelGroupPadding_Click(object sender, RoutedEventArgs e)
00985         {
00986             try
00987             {
00988                 if (_listViewBase != null && txtItemsPanelGroupPadding != null)
00989                 {
00990                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
00991
00992                     if (itemsWrapGrid != null)
00993                     {
00994                         itemsWrapGrid.GroupPadding = GetThicknessFromString(txtItemsPanelGroupPadding.Text);
00995                     }
00996                     else
00997                     {
00998                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
00999
01000                         if (itemsStackPanel != null)
01001                         {
01002                             itemsStackPanel.GroupPadding = GetThicknessFromString(txtItemsPanelGroupPadding.Text);
01003                         }
01004                     }
01005                 }
01006             }
01007             catch (Exception ex)
01008             {
01009                 txtExceptionReport.Text = ex.ToString();
01010                 AppendEventMessage(ex.ToString());
01011             }
01012         }
01013
01014         private void BtnGetItemsPanelCacheLength_Click(object sender, RoutedEventArgs e)
01015         {
01016             UpdateItemsPanelCacheLength();
01017         }
01018
01019         private void BtnSetItemsPanelCacheLength_Click(object sender, RoutedEventArgs e)
01020         {
01021             try
01022             {
01023                 if (_listViewBase != null && txtItemsPanelCacheLength != null)
01024                 {
01025                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
01026
01027                     if (itemsWrapGrid != null)
01028                     {
01029                         itemsWrapGrid.CacheLength = double.Parse(txtItemsPanelCacheLength.Text);
01030                     }
01031                     else
01032                     {
01033                         ItemsStackPanel itemsStackPanel = _listViewBase.ItemsPanelRoot as ItemsStackPanel;
01034
01035                         if (itemsStackPanel != null)
01036                         {
01037                             itemsStackPanel.CacheLength = double.Parse(txtItemsPanelCacheLength.Text);
01038                         }
01039                     }
01040                 }
01041             }
01042             catch (Exception ex)
01043             {
01044                 txtExceptionReport.Text = ex.ToString();
01045                 AppendEventMessage(ex.ToString());
01046             }
01047         }
01048
01049         private void BtnGetItemsWrapGridItemWidth_Click(object sender, RoutedEventArgs e)
01050         {
01051             UpdateItemsWrapGridItemWidth();
01052         }
01053
01054         private void BtnSetItemsWrapGridItemWidth_Click(object sender, RoutedEventArgs e)
01055         {
01056             try
01057             {
01058                 if (_listViewBase != null && txtItemsWrapGridItemWidth != null)
01059                 {
01060                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
01061
01062                     if (itemsWrapGrid != null)
01063                     {
01064                         itemsWrapGrid.ItemWidth = double.Parse(txtItemsWrapGridItemWidth.Text);
01065                     }
01066                 }
01067             }
01068             catch (Exception ex)
01069             {
01070                 txtExceptionReport.Text = ex.ToString();
01071                 AppendEventMessage(ex.ToString());
01072             }
01073         }
01074
01075         private void BtnGetItemsWrapGridItemHeight_Click(object sender, RoutedEventArgs e)
01076         {
01077             UpdateItemsWrapGridItemHeight();
01078         }
01079
01080         private void BtnSetItemsWrapGridItemHeight_Click(object sender, RoutedEventArgs e)
01081         {
01082             try
01083             {
01084                 if (_listViewBase != null && txtItemsWrapGridItemHeight != null)
01085                 {
01086                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
01087
01088                     if (itemsWrapGrid != null)
01089                     {
01090                         itemsWrapGrid.ItemHeight = double.Parse(txtItemsWrapGridItemHeight.Text);
01091                     }
01092                 }
01093             }
01094             catch (Exception ex)
01095             {
01096                 txtExceptionReport.Text = ex.ToString();
01097                 AppendEventMessage(ex.ToString());
01098             }
01099         }
01100
01101         private void BtnScrollIntoView_Click(object sender, RoutedEventArgs e)
01102         {
01103             try
01104             {
01105                 if (_listViewBase != null && _listViewBase.ItemsSource != null &&
01106                     _groupedListViewBaseViewModel != null &&
01107                     txtMethodsItemIndex != null && cmbScrollIntoViewAlignment != null)
01108                 {
01109                     object item = GetDataSourceItemFromIndex(int.Parse(txtMethodsItemIndex.Text));
01110                     _listViewBase.ScrollIntoView(item, (ScrollIntoViewAlignment)cmbScrollIntoViewAlignment.SelectedIndex); ;
01111                 }
01112             }
01113             catch (Exception ex)
01114             {
01115                 txtExceptionReport.Text = ex.ToString();
01116                 AppendEventMessage(ex.ToString());
01117             }
01118         }
01119
01120         private void BtnResetItemsSource_Click(object sender, RoutedEventArgs e)
01121         {
01122             if (_listViewBase != null && _listViewBase.ItemsSource != null)
01123             {
01124                 _listViewBase.ItemsSource = null;
01125             }
01126         }
01127
01128         private void BtnSetItemsSource_Click(object sender, RoutedEventArgs e)
01129         {
01130             if (_listViewBase != null && _listViewBase.ItemsSource != _cvs.View)
01131             {
01132                 _listViewBase.ItemsSource = _cvs.View;
01133             }
01134         }
01135
01136         private void BtnGetCollectionViewCurrentItem_Click(object sender, RoutedEventArgs e)
01137         {
01138             if (txtCollectionViewCurrentItem != null && _cvs != null && _cvs.View != null)
01139             {
01140                 string currentItemAsStr = _cvs.View.CurrentItem == null ? "null" : _cvs.View.CurrentItem.ToString();
01141                 txtCollectionViewCurrentItem.Text = currentItemAsStr.Length > 60 ? currentItemAsStr.Substring(0, 59) : currentItemAsStr;
01142             }
01143         }
01144
01145         private void BtnGetCollectionViewCurrentPosition_Click(object sender, RoutedEventArgs e)
01146         {
01147             if (txtCollectionViewCurrentPosition != null && _cvs != null && _cvs.View != null)
01148             {
01149                 txtCollectionViewCurrentPosition.Text = _cvs.View.CurrentPosition.ToString();
01150             }
01151         }
01152
01153         private void BtnCollectionViewMoveCurrentToPosition_Click(object sender, RoutedEventArgs e)
01154         {
01155             try
01156             {
01157                 if (txtCollectionViewMovePosition != null && _cvs != null && _cvs.View != null)
01158                 {
01159                     bool result = _cvs.View.MoveCurrentToPosition(int.Parse(txtCollectionViewMovePosition.Text));
01160                     AppendEventMessage("ICollectionView.MoveCurrentToPosition result: " + result);
01161                 }
01162             }
01163             catch (Exception ex)
01164             {
01165                 txtExceptionReport.Text = ex.ToString();
01166                 AppendEventMessage(ex.ToString());
01167             }
01168         }
01169
01170         private async void BtnFocusManagerCollectionViewCurrentItemProgrammaticFocus_Click(object sender, RoutedEventArgs e)
01171         {
01172             try
01173             {
01174                 if (_listViewBase != null && _cvs != null && _cvs.View != null && _cvs.View.CurrentItem != null)
01175                 {
01176                     DependencyObject container = _listViewBase.ContainerFromItem(_cvs.View.CurrentItem);
01177
01178                     if (container != null)
01179                     {
01180                         FocusMovementResult result = await FocusManager.TryFocusAsync(container, FocusState.Programmatic);
01181                         AppendEventMessage("FocusManager.TryFocusAsync FocusMovementResult.Succeeded: " + result.Succeeded);
01182                     }
01183                 }
01184             }
01185             catch (Exception ex)
01186             {
01187                 txtExceptionReport.Text = ex.ToString();
01188                 AppendEventMessage(ex.ToString());
01189             }
01190         }
01191
01192         private void BtnGetScrollViewerHorizontalScrollMode_Click(object sender, RoutedEventArgs e)
01193         {
01194             UpdateScrollViewerHorizontalScrollMode();
01195         }
01196
01197         private void BtnSetScrollViewerHorizontalScrollMode_Click(object sender, RoutedEventArgs e)
01198         {
01199             if (_scrollViewer != null && cmbScrollViewerHorizontalScrollMode != null)
01200             {
01201                 _scrollViewer.HorizontalScrollMode = (ScrollMode)cmbScrollViewerHorizontalScrollMode.SelectedIndex;
01202             }
01203         }
01204
01205         private void BtnGetScrollViewerVerticalScrollMode_Click(object sender, RoutedEventArgs e)
01206         {
01207             UpdateScrollViewerVerticalScrollMode();
01208         }
01209
01210         private void BtnSetScrollViewerVerticalScrollMode_Click(object sender, RoutedEventArgs e)
01211         {
01212             if (_scrollViewer != null && cmbScrollViewerVerticalScrollMode != null)
01213             {
01214                 _scrollViewer.VerticalScrollMode = (ScrollMode)cmbScrollViewerVerticalScrollMode.SelectedIndex;
01215             }
01216         }
01217
01218         private void BtnGetScrollViewerViewportWidth_Click(object sender, RoutedEventArgs e)
01219         {
01220             UpdateScrollViewerViewportWidth();
01221         }
01222
01223         private void BtnGetScrollViewerViewportHeight_Click(object sender, RoutedEventArgs e)
01224         {
01225             UpdateScrollViewerViewportHeight();
01226         }
01227
01228         private void BtnGetScrollViewerExtentWidth_Click(object sender, RoutedEventArgs e)
01229         {
01230             UpdateScrollViewerExtentWidth();
01231         }
01232
01233         private void BtnGetScrollViewerExtentHeight_Click(object sender, RoutedEventArgs e)
01234         {
01235             UpdateScrollViewerExtentHeight();
01236         }
01237
01238         private void BtnGetScrollViewerHorizontalOffset_Click(object sender, RoutedEventArgs e)
01239         {
01240             UpdateScrollViewerHorizontalOffset();
01241         }
01242
01243         private void BtnGetScrollViewerVerticalOffset_Click(object sender, RoutedEventArgs e)
01244         {
01245             UpdateScrollViewerVerticalOffset();
01246         }
01247
01248         private void CmbScrollViewerHorizontalSnapPointsType_SelectionChanged(object sender, SelectionChangedEventArgs e)
01249         {
01250             try
01251             {
01252                 if (_scrollViewer != null && cmbScrollViewerHorizontalSnapPointsType != null)
01253                 {
01254                     _scrollViewer.HorizontalSnapPointsType = (SnapPointsType)cmbScrollViewerHorizontalSnapPointsType.SelectedIndex;
01255                 }
01256             }
01257             catch (Exception ex)
01258             {
01259                 txtExceptionReport.Text = ex.ToString();
01260                 AppendEventMessage(ex.ToString());
01261             }
01262         }
01263
01264         private void CmbScrollViewerVerticalSnapPointsType_SelectionChanged(object sender, SelectionChangedEventArgs e)
01265         {
01266             try
01267             {
01268                 if (_scrollViewer != null && cmbScrollViewerVerticalSnapPointsType != null)
01269                 {
01270                     _scrollViewer.VerticalSnapPointsType = (SnapPointsType)cmbScrollViewerVerticalSnapPointsType.SelectedIndex;
01271                 }
01272             }
01273             catch (Exception ex)
01274             {
01275                 txtExceptionReport.Text = ex.ToString();
01276                 AppendEventMessage(ex.ToString());
01277             }
01278         }
01279
01280         private void CmbScrollViewerHorizontalSnapPointsAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e)
01281         {
01282             try
01283             {
01284                 if (_scrollViewer != null && cmbScrollViewerHorizontalSnapPointsAlignment != null)
01285                 {
01286                     _scrollViewer.HorizontalSnapPointsAlignment = (SnapPointsAlignment)cmbScrollViewerHorizontalSnapPointsAlignment.SelectedIndex;
01287                 }
01288             }
01289             catch (Exception ex)
01290             {
01291                 txtExceptionReport.Text = ex.ToString();
01292                 AppendEventMessage(ex.ToString());
01293             }
01294         }
01295
01296         private void CmbScrollViewerVerticalSnapPointsAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e)
01297         {
01298             try
01299             {
01300                 if (_scrollViewer != null && cmbScrollViewerVerticalSnapPointsAlignment != null)
01301                 {
01302                     _scrollViewer.VerticalSnapPointsAlignment = (SnapPointsAlignment)cmbScrollViewerVerticalSnapPointsAlignment.SelectedIndex;
01303                 }
01304             }
01305             catch (Exception ex)
01306             {
01307                 txtExceptionReport.Text = ex.ToString();
01308                 AppendEventMessage(ex.ToString());
01309             }
01310         }
01311
01312         private void NbItemsWrapGridMaximumRowsOrColumns_ValueChanged(object sender, object e)
01313         {
01314             try
01315             {
01316                 if (_listViewBase != null && nbItemsWrapGridMaximumRowsOrColumns != null)
01317                 {
01318                     ItemsWrapGrid itemsWrapGrid = _listViewBase.ItemsPanelRoot as ItemsWrapGrid;
01319
01320                     if (itemsWrapGrid != null)
01321                     {
01322                         itemsWrapGrid.MaximumRowsOrColumns = (int)nbItemsWrapGridMaximumRowsOrColumns.Value;
01323                     }
01324                 }
01325             }
01326             catch (Exception ex)
01327             {
01328                 txtExceptionReport.Text = ex.ToString();
01329                 AppendEventMessage(ex.ToString());
01330             }
01331         }
01332
01333         private void ChkProperties_Checked(object sender, RoutedEventArgs e)
01334         {
01335             if (svProperties != null)
01336                 svProperties.Visibility = Visibility.Visible;
01337         }
01338
01339         private void ChkProperties_Unchecked(object sender, RoutedEventArgs e)
01340         {
01341             if (svProperties != null)
01342                 svProperties.Visibility = Visibility.Collapsed;
01343         }
01344
01345         private void ChkMethods_Checked(object sender, RoutedEventArgs e)
01346         {
01347             if (svMethods != null)
01348                 svMethods.Visibility = Visibility.Visible;
01349         }
01350
01351         private void ChkMethods_Unchecked(object sender, RoutedEventArgs e)
01352         {
01353             if (svMethods != null)
01354                 svMethods.Visibility = Visibility.Collapsed;
01355         }
01356
01357         private void ChkDataSource_Checked(object sender, RoutedEventArgs e)
01358         {
01359             if (svDataSource != null)
01360                 svDataSource.Visibility = Visibility.Visible;
01361         }
01362
01363         private void ChkDataSource_Unchecked(object sender, RoutedEventArgs e)
01364         {
01365             if (svDataSource != null)
01366                 svDataSource.Visibility = Visibility.Collapsed;
01367         }
01368
01369         private void ChkLogs_Checked(object sender, RoutedEventArgs e)
01370         {
01371             if (grdLogs != null)
01372                 grdLogs.Visibility = Visibility.Visible;
01373         }
01374
01375         private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
01376         {
01377             if (grdLogs != null)
01378                 grdLogs.Visibility = Visibility.Collapsed;
01379         }
01380
01381         private void AppendEventMessage(string eventMessage)
01382         {
01383             lstLogs.Items.Add(eventMessage);
01384         }
01385
01386         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
01387         {
01388             txtExceptionReport.Text = string.Empty;
01389         }
01390
01391         private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
01392         {
01393             lstLogs.Items.Clear();
01394         }
01395
01396         private Thickness GetThicknessFromString(string thickness)
01397         {
01398             string[] lengths = thickness.Split(',');
01399             if (lengths.Length < 4)
01400                 return new Thickness(
01401                     Convert.ToDouble(lengths[0]));
01402             else
01403                 return new Thickness(
01404                     Convert.ToDouble(lengths[0]), Convert.ToDouble(lengths[1]), Convert.ToDouble(lengths[2]), Convert.ToDouble(lengths[3]));
01405         }
01406
01407         private object GetDataSourceItemFromIndex(int itemIndex)
01408         {
01409             // itemIndex:0 means the first group GroupedListViewBaseGroupItem
01410             // itemIndex:1 means the first item GroupedListViewBaseItem in the first group GroupedListViewBaseGroupItem
01411             if (itemIndex < 0 || _groupedListViewBaseViewModel.Items.Count == 0) return null;
01412
01413             int groupCount = _groupedListViewBaseViewModel.Items.Count;
01414             int groupIndex = 0;
01415             object item = null;
01416
01417             while (itemIndex >= 0 && groupIndex < groupCount)
01418             {
01419                 GroupedListViewBaseGroupItem groupedListViewBaseGroupItem = _groupedListViewBaseViewModel.Items[groupIndex];
01420                 item = groupedListViewBaseGroupItem;
01421
01422                 if (itemIndex == 0)
01423                 {
01424                     return item;
01425                 }
01426                 else
01427                 {
01428                     itemIndex--;
01429
01430                     int groupItemCount = groupedListViewBaseGroupItem.Items.Count;
01431                     int groupItemIndex = 0;
01432
01433                     while (itemIndex >= 0 && groupItemIndex < groupItemCount)
01434                     {
01435                         GroupedListViewBaseItem groupedListViewBaseItem = groupedListViewBaseGroupItem.Items[groupItemIndex];
01436                         item = groupedListViewBaseItem;
01437
01438                         if (itemIndex == 0)
01439                         {
01440                             return item;
01441                         }
01442                         else
01443                         {
01444                             itemIndex--;
01445                             groupItemIndex++;
01446                         }
01447                     }
01448
01449                     groupIndex++;
01450                 }
01451             }
01452
01453             return null;
01454         }
01455
01456         private static T FindElementOfTypeInSubtree<T>(DependencyObject element) where T : DependencyObject
01457         {
01458             if (element == null)
01459                 return null;
01460
01461             if (element is T)
01462                 return (T)element;
01463
01464             int childrenCount = VisualTreeHelper.GetChildrenCount(element);
01465             for (int i = 0; i < childrenCount; i++)
01466             {
01467                 var result = FindElementOfTypeInSubtree<T>(VisualTreeHelper.GetChild(element, i));
01468                 if (result != null)
01469                     return result;
01470             }
01471
01472             return null;
01473         }
01474     }
01475
01476     public class GroupedListViewBaseItem
01477     {
01478         public GroupedListViewBaseItem() : this(">EmptyId<") { }
01479
01480         public GroupedListViewBaseItem(string id)
01481         {
01482             Id = id;
01483         }
01484
01485         public string Id
01486         {
01487             get;
01488             set;
01489         }
01490     }
01491
01492     public class GroupedListViewBaseGroupItem
01493     {
01494         public GroupedListViewBaseGroupItem() : this(">EmptyName<") { }
01495
01496         public GroupedListViewBaseGroupItem(string name)
01497         {
01498             Name = name;
01499             Items = new ObservableCollection<GroupedListViewBaseItem>();
01500         }
01501
01502         public string Name
01503         {
01504             get;
01505             set;
01506         }
01507
01508         public ObservableCollection<GroupedListViewBaseItem> Items
01509         {
01510             get;
01511             set;
01512         }
01513     }
01514
01515     public class GroupedListViewBaseViewModel
01516     {
01517         public GroupedListViewBaseViewModel()
01518         {
01519             Items = new ObservableCollection<GroupedListViewBaseGroupItem>();
01520
01521             GroupedListViewBaseGroupItem groupA = new GroupedListViewBaseGroupItem("Group A");
01522             groupA.Items.Add(new GroupedListViewBaseItem("idA1"));
01523             groupA.Items.Add(new GroupedListViewBaseItem("idA2"));
01524             groupA.Items.Add(new GroupedListViewBaseItem("idA3"));
01525             groupA.Items.Add(new GroupedListViewBaseItem("idA4"));
01526             groupA.Items.Add(new GroupedListViewBaseItem("idA5"));
01527             groupA.Items.Add(new GroupedListViewBaseItem("idA6"));
01528             Items.Add(groupA);
01529
01530             GroupedListViewBaseGroupItem groupB = new GroupedListViewBaseGroupItem("Group B");
01531             groupB.Items.Add(new GroupedListViewBaseItem("idB1"));
01532             groupB.Items.Add(new GroupedListViewBaseItem("idB2"));
01533             groupB.Items.Add(new GroupedListViewBaseItem("idB3"));
01534             groupB.Items.Add(new GroupedListViewBaseItem("idB4"));
01535             groupB.Items.Add(new GroupedListViewBaseItem("idB5"));
01536             groupB.Items.Add(new GroupedListViewBaseItem("idB6"));
01537             groupB.Items.Add(new GroupedListViewBaseItem("idB7"));
01538             groupB.Items.Add(new GroupedListViewBaseItem("idB8"));
01539             Items.Add(groupB);
01540
01541             GroupedListViewBaseGroupItem groupC = new GroupedListViewBaseGroupItem("Group C");
01542             groupC.Items.Add(new GroupedListViewBaseItem("idC1"));
01543             groupC.Items.Add(new GroupedListViewBaseItem("idC2"));
01544             groupC.Items.Add(new GroupedListViewBaseItem("idC3"));
01545             groupC.Items.Add(new GroupedListViewBaseItem("idC4"));
01546             groupC.Items.Add(new GroupedListViewBaseItem("idC5"));
01547             groupC.Items.Add(new GroupedListViewBaseItem("idC6"));
01548             groupC.Items.Add(new GroupedListViewBaseItem("idC7"));
01549             groupC.Items.Add(new GroupedListViewBaseItem("idC8"));
01550             groupC.Items.Add(new GroupedListViewBaseItem("idC9"));
01551             Items.Add(groupC);
01552
01553             GroupedListViewBaseGroupItem groupD = new GroupedListViewBaseGroupItem("Group D");
01554             groupD.Items.Add(new GroupedListViewBaseItem("idD1"));
01555             groupD.Items.Add(new GroupedListViewBaseItem("idD2"));
01556             groupD.Items.Add(new GroupedListViewBaseItem("idD3"));
01557             groupD.Items.Add(new GroupedListViewBaseItem("idD4"));
01558             groupD.Items.Add(new GroupedListViewBaseItem("idD5"));
01559             groupD.Items.Add(new GroupedListViewBaseItem("idD6"));
01560             Items.Add(groupD);
01561
01562             GroupedListViewBaseGroupItem groupE = new GroupedListViewBaseGroupItem("Group E");
01563             groupE.Items.Add(new GroupedListViewBaseItem("idE1"));
01564             groupE.Items.Add(new GroupedListViewBaseItem("idE2"));
01565             groupE.Items.Add(new GroupedListViewBaseItem("idE3"));
01566             groupE.Items.Add(new GroupedListViewBaseItem("idE4"));
01567             groupE.Items.Add(new GroupedListViewBaseItem("idE5"));
01568             groupE.Items.Add(new GroupedListViewBaseItem("idE6"));
01569             groupE.Items.Add(new GroupedListViewBaseItem("idE7"));
01570             groupE.Items.Add(new GroupedListViewBaseItem("idE8"));
01571             groupE.Items.Add(new GroupedListViewBaseItem("idE9"));
01572             groupE.Items.Add(new GroupedListViewBaseItem("idEA"));
01573             groupE.Items.Add(new GroupedListViewBaseItem("idEB"));
01574             groupE.Items.Add(new GroupedListViewBaseItem("idEC"));
01575             groupE.Items.Add(new GroupedListViewBaseItem("idED"));
01576             groupE.Items.Add(new GroupedListViewBaseItem("idEE"));
01577             groupE.Items.Add(new GroupedListViewBaseItem("idEF"));
01578             Items.Add(groupE);
01579
01580             GroupedListViewBaseGroupItem groupF = new GroupedListViewBaseGroupItem("Group F");
01581             groupF.Items.Add(new GroupedListViewBaseItem("idF1"));
01582             groupF.Items.Add(new GroupedListViewBaseItem("idF2"));
01583             groupF.Items.Add(new GroupedListViewBaseItem("idF3"));
01584             Items.Add(groupF);
01585
01586             GroupedListViewBaseGroupItem groupG = new GroupedListViewBaseGroupItem("Group G");
01587             groupG.Items.Add(new GroupedListViewBaseItem("idG1"));
01588             groupG.Items.Add(new GroupedListViewBaseItem("idG2"));
01589             groupG.Items.Add(new GroupedListViewBaseItem("idG3"));
01590             groupG.Items.Add(new GroupedListViewBaseItem("idG4"));
01591             groupG.Items.Add(new GroupedListViewBaseItem("idG5"));
01592             groupG.Items.Add(new GroupedListViewBaseItem("idG6"));
01593             groupG.Items.Add(new GroupedListViewBaseItem("idG7"));
01594             groupG.Items.Add(new GroupedListViewBaseItem("idG8"));
01595             groupG.Items.Add(new GroupedListViewBaseItem("idG9"));
01596             groupG.Items.Add(new GroupedListViewBaseItem("idGA"));
01597             groupG.Items.Add(new GroupedListViewBaseItem("idGB"));
01598             groupG.Items.Add(new GroupedListViewBaseItem("idGC"));
01599             groupG.Items.Add(new GroupedListViewBaseItem("idGD"));
01600             groupG.Items.Add(new GroupedListViewBaseItem("idGE"));
01601             groupG.Items.Add(new GroupedListViewBaseItem("idGF"));
01602             groupG.Items.Add(new GroupedListViewBaseItem("idGG"));
01603             groupG.Items.Add(new GroupedListViewBaseItem("idGH"));
01604             groupG.Items.Add(new GroupedListViewBaseItem("idGI"));
01605             groupG.Items.Add(new GroupedListViewBaseItem("idGJ"));
01606             groupG.Items.Add(new GroupedListViewBaseItem("idGK"));
01607             groupG.Items.Add(new GroupedListViewBaseItem("idGL"));
01608             groupG.Items.Add(new GroupedListViewBaseItem("idGM"));
01609             groupG.Items.Add(new GroupedListViewBaseItem("idGN"));
01610             groupG.Items.Add(new GroupedListViewBaseItem("idGO"));
01611             Items.Add(groupG);
01612
01613             GroupedListViewBaseGroupItem groupH = new GroupedListViewBaseGroupItem("Group H");
01614             groupH.Items.Add(new GroupedListViewBaseItem("idH1"));
01615             groupH.Items.Add(new GroupedListViewBaseItem("idH2"));
01616             groupH.Items.Add(new GroupedListViewBaseItem("idH3"));
01617             groupH.Items.Add(new GroupedListViewBaseItem("idH4"));
01618             groupH.Items.Add(new GroupedListViewBaseItem("idH5"));
01619             groupH.Items.Add(new GroupedListViewBaseItem("idH6"));
01620             groupH.Items.Add(new GroupedListViewBaseItem("idH7"));
01621             groupH.Items.Add(new GroupedListViewBaseItem("idH8"));
01622             groupH.Items.Add(new GroupedListViewBaseItem("idH9"));
01623             groupH.Items.Add(new GroupedListViewBaseItem("idhA"));
01624             groupH.Items.Add(new GroupedListViewBaseItem("idHB"));
01625             groupH.Items.Add(new GroupedListViewBaseItem("idHC"));
01626             groupH.Items.Add(new GroupedListViewBaseItem("idHD"));
01627             groupH.Items.Add(new GroupedListViewBaseItem("idHE"));
01628             groupH.Items.Add(new GroupedListViewBaseItem("idHF"));
01629             groupH.Items.Add(new GroupedListViewBaseItem("idHG"));
01630             groupH.Items.Add(new GroupedListViewBaseItem("idHH"));
01631             groupH.Items.Add(new GroupedListViewBaseItem("idHI"));
01632             groupH.Items.Add(new GroupedListViewBaseItem("idHJ"));
01633             groupH.Items.Add(new GroupedListViewBaseItem("idHK"));
01634             groupH.Items.Add(new GroupedListViewBaseItem("idHL"));
01635             groupH.Items.Add(new GroupedListViewBaseItem("idHM"));
01636             groupH.Items.Add(new GroupedListViewBaseItem("idHN"));
01637             groupH.Items.Add(new GroupedListViewBaseItem("idHO"));
01638             groupH.Items.Add(new GroupedListViewBaseItem("idhP"));
01639             groupH.Items.Add(new GroupedListViewBaseItem("idHQ"));
01640             groupH.Items.Add(new GroupedListViewBaseItem("idHR"));
01641             groupH.Items.Add(new GroupedListViewBaseItem("idHS"));
01642             groupH.Items.Add(new GroupedListViewBaseItem("idHT"));
01643             groupH.Items.Add(new GroupedListViewBaseItem("idHU"));
01644             groupH.Items.Add(new GroupedListViewBaseItem("idHV"));
01645             groupH.Items.Add(new GroupedListViewBaseItem("idHW"));
01646             groupH.Items.Add(new GroupedListViewBaseItem("idHX"));
01647             groupH.Items.Add(new GroupedListViewBaseItem("idHY"));
01648             groupH.Items.Add(new GroupedListViewBaseItem("idHZ"));
01649             Items.Add(groupH);
01650
01651             GroupedListViewBaseGroupItem groupI = new GroupedListViewBaseGroupItem("Group I");
01652             groupI.Items.Add(new GroupedListViewBaseItem("idI1"));
01653             groupI.Items.Add(new GroupedListViewBaseItem("idI2"));
01654             groupI.Items.Add(new GroupedListViewBaseItem("idI3"));
01655             Items.Add(groupI);
01656         }
01657
01658         public ObservableCollection<GroupedListViewBaseGroupItem> Items
01659         {
01660             get;
01661             set;
01662         }
01663     }
01664 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/VirtualizingLayout.h Source File

  • Repeater

VirtualizingLayout.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "Layout.h"
00007 #include "VirtualizingLayout.g.h"
00008
00009 class VirtualizingLayout :
00010     public winrt::implementation::VirtualizingLayoutT<VirtualizingLayout, Layout>
00011 {
00012 public:
00013     VirtualizingLayout();
00014
00015 #pragma region IVirtualizingLayoutOverrides
00016     virtual void InitializeForContextCore(winrt::VirtualizingLayoutContext const& context);
00017     virtual void UninitializeForContextCore(winrt::VirtualizingLayoutContext const& context);
00018
00019     virtual winrt::Size MeasureOverride(winrt::VirtualizingLayoutContext const& context, winrt::Size const& availableSize);
00020     virtual winrt::Size ArrangeOverride(winrt::VirtualizingLayoutContext const& context, winrt::Size const& finalSize);
00021
00022     virtual void OnItemsChangedCore(winrt::VirtualizingLayoutContext const& context, winrt::IInspectable const& source, winrt::NotifyCollectionChangedEventArgs const& args);
00023 #pragma endregion
00024 };
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Interactions/ButtonInteraction/TestUI/TargetElement.xaml.cs Source File

  • Interactions
  • ButtonInteraction
  • TestUI

TargetElement.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.IO;
00007 using System.Linq;
00008 using System.Runtime.InteropServices.WindowsRuntime;
00009 using Windows.Foundation;
00010 using Windows.Foundation.Collections;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Automation.Peers;
00013 using Microsoft.UI.Xaml.Controls;
00014 using Microsoft.UI.Xaml.Controls.Primitives;
00015 using Microsoft.UI.Xaml.Data;
00016 using Microsoft.UI.Xaml.Input;
00017 using Microsoft.UI.Xaml.Media;
00018 using Microsoft.UI.Xaml.Navigation;
00019
00020 // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
00021
00022 namespace MUXControlsTestApp
00023 {
00024     public sealed partial class TargetElement : UserControl
00025     {
00026         public TargetElement()
00027         {
00028             this.InitializeComponent();
00029         }
00030
00031         protected override AutomationPeer OnCreateAutomationPeer()
00032         {
00033             return new FrameworkElementAutomationPeer(this);
00034         }
00035     }
00036 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RatingControl/RatingControlAutomationPeer.cpp Source File

  • RatingControl

RatingControlAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "RatingControlAutomationPeer.h"
00008 #include "Utils.h"
00009
00010 #include "RatingControlAutomationPeer.properties.cpp"
00011
00012 RatingControlAutomationPeer::RatingControlAutomationPeer(winrt::FrameworkElement const& owner)
00013     : ReferenceTracker(owner)
00014 {
00015 }
00016
00017 hstring RatingControlAutomationPeer::GetLocalizedControlTypeCore()
00018 {
00019     return ResourceAccessor::GetLocalizedStringResource(SR_RatingLocalizedControlType);
00020 }
00021
00022 // Properties.
00023 bool RatingControlAutomationPeer::IsReadOnly()
00024 {
00025     return GetRatingControl().IsReadOnly();
00026 }
00027
00028 hstring RatingControlAutomationPeer::IValueProvider_Value()
00029 {
00030     double ratingValue = GetRatingControl().Value();
00031     winrt::hstring valueString;
00032
00033     winrt::hstring ratingString;
00034
00035     if (ratingValue == -1)
00036     {
00037         double placeholderValue = GetRatingControl().PlaceholderValue();
00038         if (placeholderValue == -1)
00039         {
00040             valueString = ResourceAccessor::GetLocalizedStringResource(SR_RatingUnset);
00041         }
00042         else
00043         {
00044             valueString = GenerateValue_ValueString(ResourceAccessor::GetLocalizedStringResource(SR_CommunityRatingString), placeholderValue);
00045         }
00046     }
00047     else
00048     {
00049         valueString = GenerateValue_ValueString(ResourceAccessor::GetLocalizedStringResource(SR_BasicRatingString), ratingValue);
00050     }
00051
00052     return valueString;
00053 }
00054
00055 void RatingControlAutomationPeer::SetValue(hstring const& value)
00056 {
00057     winrt::DecimalFormatter formatter;
00058     auto potentialRating = formatter.ParseDouble(value);
00059     if (potentialRating)
00060     {
00061         GetRatingControl().Value(potentialRating.Value());
00062     }
00063 }
00064
00065 // IRangeValueProvider overrides
00066 double RatingControlAutomationPeer::SmallChange()
00067 {
00068     return 1.0;
00069 }
00070
00071 double RatingControlAutomationPeer::LargeChange()
00072 {
00073     return 1.0;
00074 }
00075
00076 double RatingControlAutomationPeer::Maximum()
00077 {
00078     return GetRatingControl().MaxRating();
00079 }
00080
00081 double RatingControlAutomationPeer::Minimum()
00082 {
00083     return 0;
00084 }
00085
00086 double RatingControlAutomationPeer::Value()
00087 {
00088     // Change this to provide a placeholder value too.
00089     double value = GetRatingControl().Value();
00090     if (value == -1)
00091     {
00092         return 0;
00093     }
00094     else
00095     {
00096         return value;
00097     }
00098 }
00099
00100 void RatingControlAutomationPeer::SetValue(double value)
00101 {
00102     GetRatingControl().Value(value);
00103 }
00104
00105 //IAutomationPeerOverrides
00106
00107 winrt::IInspectable RatingControlAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00108 {
00109     if (patternInterface == winrt::PatternInterface::Value || patternInterface == winrt::PatternInterface::RangeValue)
00110     {
00111         return *this;
00112     }
00113
00114     return __super::GetPatternCore(patternInterface);
00115 }
00116
00117 winrt::AutomationControlType RatingControlAutomationPeer::GetAutomationControlTypeCore()
00118 {
00119     return winrt::AutomationControlType::Slider;
00120 }
00121
00122 // Protected methods
00123 void RatingControlAutomationPeer::RaisePropertyChangedEvent(double newValue)
00124 {
00125     // UIA doesn't tolerate a null doubles, so we convert them to zeroes.
00126     double oldValue = GetRatingControl().Value();
00127     auto oldValueProp = winrt::PropertyValue::CreateDouble(oldValue);
00128
00129     if (newValue == -1)
00130     {
00131         auto newValueProp = winrt::PropertyValue::CreateDouble(0.0);
00132         __super::RaisePropertyChangedEvent(winrt::ValuePatternIdentifiers::ValueProperty(), oldValueProp, newValueProp);
00133         __super::RaisePropertyChangedEvent(winrt::RangeValuePatternIdentifiers::ValueProperty(), oldValueProp, newValueProp);
00134     }
00135     else
00136     {
00137         auto newValueProp = winrt::PropertyValue::CreateDouble(newValue);
00138         __super::RaisePropertyChangedEvent(winrt::ValuePatternIdentifiers::ValueProperty(), oldValueProp, newValueProp); // make these strings
00139         __super::RaisePropertyChangedEvent(winrt::RangeValuePatternIdentifiers::ValueProperty(), oldValueProp, newValueProp);
00140     }
00141 }
00142
00143 // private methods
00144
00145 winrt::RatingControl RatingControlAutomationPeer::GetRatingControl()
00146 {
00147     winrt::UIElement owner = Owner();
00148     return owner.as<winrt::RatingControl>();
00149 }
00150
00151 int RatingControlAutomationPeer::DetermineFractionDigits(double value)
00152 {
00153     value = value * 100;
00154     const int intValue = (int)value;
00155
00156     // When reading out the Value_Value, we want clients to read out the least number of digits
00157     // possible. We don't want a 3 (represented as a double) to be read out as 3.00...
00158     // Here we determine the number of digits past the decimal point we care about,
00159     // and this number is used by the caller to truncate the Value_Value string.
00160
00161     if (intValue % 100 == 0)
00162     {
00163         return 0;
00164     }
00165     else if (intValue % 10 == 0)
00166     {
00167         return 1;
00168     }
00169     else
00170     {
00171         return 2;
00172     }
00173 }
00174
00175 int RatingControlAutomationPeer::DetermineSignificantDigits(double value, int fractionDigits)
00176 {
00177     int sigFigsInt = (int)value;
00178     int length = 0;
00179
00180     while (sigFigsInt > 0)
00181     {
00182         sigFigsInt /= 10;
00183         length++;
00184     }
00185
00186     return length + fractionDigits;
00187 }
00188
00189 winrt::hstring RatingControlAutomationPeer::GenerateValue_ValueString(const winrt::hstring& resourceString, double ratingValue)
00190 {
00191     winrt::DecimalFormatter formatter;
00192     winrt::SignificantDigitsNumberRounder rounder;
00193     formatter.NumberRounder(rounder);
00194
00195     std::wstring maxRatingString = std::to_wstring(GetRatingControl().MaxRating());
00196
00197     const int fractionDigits = DetermineFractionDigits(ratingValue);
00198     const int sigDigits = DetermineSignificantDigits(ratingValue, fractionDigits);
00199     formatter.FractionDigits(fractionDigits);
00200     rounder.SignificantDigits(sigDigits);
00201     winrt::hstring ratingString = formatter.Format(ratingValue);
00202
00203     return StringUtil::FormatString(resourceString, ratingString.c_str(), maxRatingString.c_str());
00204 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/CornerRadiusPage.xaml.cs Source File

  • CommonStyles
  • TestUI

CornerRadiusPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003 using System.Collections.ObjectModel;
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Controls;
00006 using MUXControlsTestApp.Utilities;
00007
00008 namespace MUXControlsTestApp
00009 {
00010     [TopLevelTestPage(Name = "CornerRadius")]
00011     public sealed partial class CornerRadiusPage : TestPage
00012     {
00013         public double ControlCornerRadiusSize
00014         {
00015             get { return _controlCornerRadius;  }
00016             set
00017             {
00018                 if (_controlCornerRadius != value)
00019                 {
00020                     _controlCornerRadius = value;
00021                     ControlCornerRadius = new CornerRadius(value);
00022                 }
00023             }
00024         }
00025         private double _controlCornerRadius = 2;
00026
00027         public double OverlayCornerRadiusSize
00028         {
00029             get { return _overlayCornerRadius; }
00030             set
00031             {
00032                 if (_overlayCornerRadius != value)
00033                 {
00034                     _overlayCornerRadius = value;
00035                     OverlayCornerRadius = new CornerRadius(value);
00036                 }
00037             }
00038         }
00039         private double _overlayCornerRadius = 4;
00040
00041         public CornerRadius ControlCornerRadius
00042         {
00043             get { return (CornerRadius)GetValue(ControlCornerRadiusProperty); }
00044             set { SetValue(ControlCornerRadiusProperty, value); }
00045         }
00046
00047         public static readonly DependencyProperty ControlCornerRadiusProperty =
00048             DependencyProperty.Register("ControlCornerRadius", typeof(CornerRadius), typeof(CornerRadiusPage), new PropertyMetadata(new CornerRadius(4)));
00049
00050
00051         public CornerRadius OverlayCornerRadius
00052         {
00053             get { return (CornerRadius)GetValue(OverlayCornerRadiusProperty); }
00054             set { SetValue(OverlayCornerRadiusProperty, value); }
00055         }
00056
00057         public static readonly DependencyProperty OverlayCornerRadiusProperty =
00058             DependencyProperty.Register("OverlayCornerRadius", typeof(CornerRadius), typeof(CornerRadiusPage), new PropertyMetadata(new CornerRadius(4)));
00059
00060
00061
00062         public ObservableCollection<string> AutoSuggestSource { get; private set; } = new ObservableCollection<string>();
00063
00064         public CornerRadiusPage()
00065         {
00066             AutoSuggestSource.Add("Item 1");
00067             AutoSuggestSource.Add("Item 2");
00068             AutoSuggestSource.Add("Item 3");
00069
00070             ControlCornerRadius = new CornerRadius(ControlCornerRadiusSize);
00071             OverlayCornerRadius = new CornerRadius(OverlayCornerRadiusSize);
00072
00073             this.InitializeComponent();
00074         }
00075
00076         private void ShowDialog_Click(object sender, RoutedEventArgs e)
00077         {
00078             var dialog = new ContentDialog { Title = "Title", Content = "Content", IsPrimaryButtonEnabled = true, PrimaryButtonText = "PrimaryButton" };
00079             var result = dialog.ShowAsync();
00080         }
00081
00082
00083         private void ShowRoundedDialog_Click(object sender, RoutedEventArgs e)
00084         {
00085             var dialog = new ContentDialog { Title = "Title", Content = "Content", IsPrimaryButtonEnabled = true, PrimaryButtonText = "PrimaryButton", CornerRadius = OverlayCornerRadius };
00086             var result = dialog.ShowAsync();
00087         }
00088     }
00089 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewCompactPaneLengthTestPage Member List

This is the complete list of members for NavigationViewCompactPaneLengthTestPage, including all inherited members.
BackButtonEnabledCheckbox_Checked(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
BackButtonEnabledCheckbox_Unchecked(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
BackButtonVisibilityCheckbox_Checked(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
BackButtonVisibilityCheckbox_Unchecked(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
CheckMenuItemsOffset_Click(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
CompactPaneLength_SelectionChanged(object sender, SelectionChangedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
GetContentBox(NavigationViewItem element) | NavigationViewCompactPaneLengthTestPage | [inline, private]
IsPaneFooterVisibleCheckBox_CheckedChanged(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
IsSettingsVisibleCheckbox_CheckedChanged(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
NavigationViewCompactPaneLengthTestPage() | NavigationViewCompactPaneLengthTestPage | [inline]
NavView_ItemInvoked(object sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
OpenPaneLength_SelectionChanged(object sender, SelectionChangedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
PaneDisplayModeCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
PaneToggleButtonVisiblityCheckbox_Checked(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
PaneToggleButtonVisiblityCheckbox_Unchecked(object sender, RoutedEventArgs e) | NavigationViewCompactPaneLengthTestPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbBarItemClickedEventArgs.h Source File

  • Breadcrumb

BreadcrumbBarItemClickedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "BreadcrumbBarItemClickedEventArgs.g.h"
00007
00008 class BreadcrumbBarItemClickedEventArgs :
00009     public winrt::implementation::BreadcrumbBarItemClickedEventArgsT<BreadcrumbBarItemClickedEventArgs>
00010 {
00011 public:
00012     winrt::IInspectable Item();
00013     void Item(const winrt::IInspectable& item);
00014
00015     int Index();
00016     void Index(const int& index);
00017
00018 private:
00019     int m_index{ -1 };
00020     winrt::IInspectable m_item{ };
00021 };
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/LayoutContext.cpp Source File

  • Repeater

LayoutContext.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "LayoutContext.h"
00008
00009 #pragma region ILayoutContext
00010
00011 winrt::IInspectable LayoutContext::LayoutState()
00012 {
00013     return overridable().LayoutStateCore();
00014 }
00015
00016 void LayoutContext::LayoutState(winrt::IInspectable const& value)
00017 {
00018     overridable().LayoutStateCore(value);
00019 }
00020
00021 #pragma endregion
00022
00023 #pragma region ILayoutContextOverrides
00024
00025 winrt::IInspectable LayoutContext::LayoutStateCore()
00026 {
00027     throw winrt::hresult_not_implemented();
00028 }
00029
00030 void LayoutContext::LayoutStateCore(winrt::IInspectable const& /*state*/)
00031 {
00032     throw winrt::hresult_not_implemented();
00033 }
00034
00035 #pragma endregion
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarFlyoutItemProperties Member List

This is the complete list of members for InkToolBarFlyoutItemProperties, including all inherited members.
Checked(winrt::TypedEventHandler< winrt::InkToolBarFlyoutItem, winrt::IInspectable > const &value) | InkToolBarFlyoutItemProperties |
Checked(winrt::event_token const &token) | InkToolBarFlyoutItemProperties |
ClearProperties() | InkToolBarFlyoutItemProperties | [static]
EnsureProperties() | InkToolBarFlyoutItemProperties | [static]
InkToolBarFlyoutItemProperties() | InkToolBarFlyoutItemProperties |
IsChecked(bool value) | InkToolBarFlyoutItemProperties |
IsChecked() | InkToolBarFlyoutItemProperties |
IsCheckedProperty() | InkToolBarFlyoutItemProperties | [inline, static]
Kind(winrt::InkToolBarFlyoutItemKind const &value) | InkToolBarFlyoutItemProperties |
Kind() | InkToolBarFlyoutItemProperties |
KindProperty() | InkToolBarFlyoutItemProperties | [inline, static]
m_checkedEventSource | InkToolBarFlyoutItemProperties |
m_uncheckedEventSource | InkToolBarFlyoutItemProperties |
s_IsCheckedProperty | InkToolBarFlyoutItemProperties | [static]
s_KindProperty | InkToolBarFlyoutItemProperties | [static]
Unchecked(winrt::TypedEventHandler< winrt::InkToolBarFlyoutItem, winrt::IInspectable > const &value) | InkToolBarFlyoutItemProperties |
Unchecked(winrt::event_token const &token) | InkToolBarFlyoutItemProperties |
Generated on Sun Dec 1 2024 20:52:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RatingControl/APITests/RatingControlTests.cs Source File

  • RatingControl
  • APITests

RatingControlTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Threading;
00006
00007 using MUXControlsTestApp.Utilities;
00008
00009 using Microsoft.UI.Xaml.Controls;
00010 using Microsoft.UI.Xaml.Media.Imaging;
00011
00012 using WEX.TestExecution;
00013 using WEX.TestExecution.Markup;
00014
00015 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00016 {
00017     [TestClass]
00018     public class RatingControlTests : ApiTestBase
00019     {
00020         [TestMethod]
00021         public void VerifyDefaultsAndBasicSetting()
00022         {
00023             RatingControl ratingControl = null;
00024             RunOnUIThread.Execute(() =>
00025             {
00026                 ratingControl = new RatingControl();
00027                 Verify.IsNotNull(ratingControl);
00028
00029                 Verify.AreEqual(ratingControl.Caption, "");
00030                 Verify.AreEqual(ratingControl.InitialSetValue, 1);
00031                 Verify.AreEqual(ratingControl.IsClearEnabled, true);
00032                 Verify.AreEqual(ratingControl.IsReadOnly, false);
00033                 Verify.AreEqual(ratingControl.MaxRating, 5);
00034                 Verify.AreEqual(ratingControl.PlaceholderValue, -1);
00035                 Verify.AreEqual(ratingControl.Value, -1);
00036
00037                 // Disabled due to 12359255 reliability issue
00038                 // Verify.IsTrue(ratingControl.ItemInfo is RatingItemFontInfo, "Verify default type of ItemInfo");
00039                 // Verify.IsTrue((ratingControl.ItemInfo as RatingItemFontInfo).Glyph.Equals("\uE735"));
00040
00041                 // Now verify basic setting the value, and reaccessing it:
00042
00043                 ratingControl.Caption = "Rating API Test Caption";
00044                 ratingControl.InitialSetValue = 2;
00045                 ratingControl.IsClearEnabled = false;
00046                 ratingControl.IsReadOnly = true;
00047                 ratingControl.MaxRating = 10;
00048                 ratingControl.PlaceholderValue = 3.0;
00049                 ratingControl.Value = 2.0;
00050
00051                 var imageInfo = new RatingItemImageInfo();
00052                 imageInfo.Image = new BitmapImage(new Uri("ms-appx:/Assets/rating_set.png"));
00053                 ratingControl.ItemInfo = imageInfo;
00054             });
00055
00056             IdleSynchronizer.Wait();
00057
00058             RunOnUIThread.Execute(() =>
00059             {
00060                 Verify.AreEqual(ratingControl.Caption, "Rating API Test Caption");
00061                 Verify.AreEqual(ratingControl.InitialSetValue, 2);
00062                 Verify.AreEqual(ratingControl.IsClearEnabled, false);
00063                 Verify.AreEqual(ratingControl.IsReadOnly, true);
00064                 Verify.AreEqual(ratingControl.MaxRating, 10);
00065                 Verify.AreEqual(ratingControl.PlaceholderValue, 3.0);
00066                 Verify.AreEqual(ratingControl.Value, 2.0);
00067                 Verify.IsTrue(ratingControl.ItemInfo is RatingItemImageInfo, "Verify default type of ItemInfo [2]");
00068                 Verify.IsTrue(((ratingControl.ItemInfo as RatingItemImageInfo).Image as BitmapImage).UriSource.Equals("ms-appx:/Assets/rating_set.png"));
00069             });
00070         }
00071
00072         // Setting the value on a collapsed control can cause it to try and
00073         // interact with a non-existent AutomationPeer, causing a crash.
00074         [TestMethod]
00075         public void VerifyDontCrashWhenCollapsedAndValueSet()
00076         {
00077             RunOnUIThread.Execute(() =>
00078             {
00079                 RatingControl ratingControl = new RatingControl();
00080                 ratingControl.Visibility = Visibility.Collapsed;
00081                 ratingControl.Value = 3.3;
00082             });
00083         }
00084
00085         // Test just verifies the API contraaaact
00086         [TestMethod]
00087         public void VerifyValuesCoercion()
00088         {
00089             RunOnUIThread.Execute(() =>
00090             {
00091                 RatingControl ratingControl = new RatingControl();
00092                 Verify.IsNotNull(ratingControl);
00093                 Verify.AreEqual(ratingControl.PlaceholderValue, -1);
00094                 Verify.AreEqual(ratingControl.Value, -1);
00095
00096                 ratingControl.PlaceholderValue = 0.1;
00097                 ratingControl.Value = 0.1;
00098                 Verify.AreEqual(ratingControl.PlaceholderValue, 1.0, "Should coerce small PlaceholderValue values to 1.0");
00099                 Verify.AreEqual(ratingControl.Value, 1.0, "Should coerce small Value values to 1.0");
00100
00101                 ratingControl.PlaceholderValue = 6.0;
00102                 ratingControl.Value = 6.0;
00103                 Verify.AreEqual(ratingControl.PlaceholderValue, 5.0, "Should coerce PlaceholderValue above MaxRating back to MaxRating");
00104                 Verify.AreEqual(ratingControl.Value, 5.0, "Should coerce Value above MaxRating back to MaxRating");
00105
00106                 ratingControl.MaxRating = -2;
00107                 Verify.AreEqual(ratingControl.MaxRating, 1, "Should coerce MaxRating below 1 back up to 1.");
00108
00109                 Verify.AreEqual(ratingControl.PlaceholderValue, 1.0, "Should auto-coerce now outdated PlaceholderValue above MaxRating back to MaxRating [2]");
00110                 Verify.AreEqual(ratingControl.Value, 1.0, "Should auto-coerce now outdated Value above MaxRating back to MaxRating [2]");
00111
00112                 ratingControl.PlaceholderValue = 6.0;
00113                 ratingControl.Value = 6.0;
00114                 Verify.AreEqual(ratingControl.PlaceholderValue, 1.0, "Should coerce set PlaceholderValue above MaxRating back to MaxRating");
00115                 Verify.AreEqual(ratingControl.Value, 1.0, "Should coerce set Value above MaxRating back to MaxRating");
00116             });
00117         }
00118
00119         [TestMethod]
00120         [TestProperty("IsolationLevel", "Method")] // This test alters the application resources, so it's isolated from other tests.
00121         public void VerifySizeIsChangeableFromResource()
00122         {
00123             ManualResetEvent loadedEvent = new(false);
00124             ManualResetEvent unloadedEvent = new(false);
00125             double originalWidth = 0;
00126             double previousWidth = 0;
00127
00128             RunOnUIThread.Execute(() =>
00129             {
00130                 var ratingControl = new RatingControl();
00131
00132                 ratingControl.Loaded += (sender, e) =>
00133                 {
00134                     originalWidth = ratingControl.ActualWidth;
00135                     previousWidth = originalWidth;
00136                     loadedEvent.Set();
00137                 };
00138
00139                 ratingControl.Unloaded += (sender, e) => unloadedEvent.Set();
00140
00141                 Content = ratingControl;
00142             });
00143
00144             loadedEvent.WaitOne();
00145             IdleSynchronizer.Wait();
00146
00147             RunOnUIThread.Execute(() =>
00148             {
00149                 Content = null;
00150             });
00151
00152             unloadedEvent.WaitOne();
00153             IdleSynchronizer.Wait();
00154
00155             RunOnUIThread.Execute(() =>
00156             {
00157                 Application.Current.Resources["RatingControlFontSizeForRendering"] = 20.0;
00158
00159                 var ratingControl = new RatingControl();
00160
00161                 ratingControl.Loaded += (sender, e) =>
00162                 {
00163                     Verify.IsLessThan(ratingControl.ActualWidth, previousWidth);
00164                     previousWidth = ratingControl.ActualWidth;
00165                     loadedEvent.Set();
00166                 };
00167
00168                 ratingControl.Unloaded += (sender, e) => unloadedEvent.Set();
00169
00170                 Content = ratingControl;
00171             });
00172
00173             loadedEvent.WaitOne();
00174             IdleSynchronizer.Wait();
00175
00176             RunOnUIThread.Execute(() =>
00177             {
00178                 Content = null;
00179             });
00180
00181             unloadedEvent.WaitOne();
00182             IdleSynchronizer.Wait();
00183
00184             RunOnUIThread.Execute(() =>
00185             {
00186                 Application.Current.Resources["RatingControlItemSpacing"] = 20.0;
00187
00188                 var ratingControl = new RatingControl();
00189
00190                 ratingControl.Loaded += (sender, e) =>
00191                 {
00192                     Verify.IsGreaterThan(ratingControl.ActualWidth, previousWidth);
00193                     previousWidth = ratingControl.ActualWidth;
00194                     loadedEvent.Set();
00195                 };
00196
00197                 ratingControl.Unloaded += (sender, e) => unloadedEvent.Set();
00198
00199                 Content = ratingControl;
00200             });
00201
00202             loadedEvent.WaitOne();
00203             IdleSynchronizer.Wait();
00204
00205             RunOnUIThread.Execute(() =>
00206             {
00207                 Content = null;
00208             });
00209
00210             unloadedEvent.WaitOne();
00211             IdleSynchronizer.Wait();
00212
00213             RunOnUIThread.Execute(() =>
00214             {
00215                 Application.Current.Resources["RatingControlFontSizeForRendering"] = 48.0;
00216                 Application.Current.Resources.Remove("RatingControlItemSpacing");
00217
00218                 var ratingControl = new RatingControl();
00219
00220                 ratingControl.Loaded += (sender, e) =>
00221                 {
00222                     Verify.IsGreaterThan(ratingControl.ActualWidth, originalWidth);
00223                     Verify.IsGreaterThan(ratingControl.ActualWidth, previousWidth);
00224                     previousWidth = ratingControl.ActualWidth;
00225                     loadedEvent.Set();
00226                 };
00227
00228                 ratingControl.Unloaded += (sender, e) => unloadedEvent.Set();
00229
00230                 Content = ratingControl;
00231             });
00232
00233             loadedEvent.WaitOne();
00234             IdleSynchronizer.Wait();
00235
00236             RunOnUIThread.Execute(() =>
00237             {
00238                 Content = null;
00239             });
00240
00241             unloadedEvent.WaitOne();
00242             IdleSynchronizer.Wait();
00243
00244             RunOnUIThread.Execute(() =>
00245             {
00246                 Application.Current.Resources["RatingControlItemSpacing"] = 2.0;
00247
00248                 var ratingControl = new RatingControl();
00249
00250                 ratingControl.Loaded += (sender, e) =>
00251                 {
00252                     Verify.IsLessThan(ratingControl.ActualWidth, previousWidth);
00253                     loadedEvent.Set();
00254                 };
00255
00256                 ratingControl.Unloaded += (sender, e) => unloadedEvent.Set();
00257
00258                 Content = ratingControl;
00259             });
00260
00261             loadedEvent.WaitOne();
00262             IdleSynchronizer.Wait();
00263
00264             RunOnUIThread.Execute(() =>
00265             {
00266                 Content = null;
00267             });
00268
00269             unloadedEvent.WaitOne();
00270             IdleSynchronizer.Wait();
00271         }
00272     }
00273 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/TopNavigationViewDataProvider.h Source File

  • NavigationView

TopNavigationViewDataProvider.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SplitDataSourceBase.h"
00007 enum class NavigationViewSplitVectorID
00008 {
00009     NotInitialized = 0,
00010     PrimaryList = 1,
00011     OverflowList = 2,
00012     SkippedList = 3,
00013     Size = 4
00014 };
00015
00016 using SplitDataSourceT = SplitDataSourceBase<winrt::IInspectable, NavigationViewSplitVectorID, float>;
00017 using SplitVectorT = SplitVector<winrt::IInspectable, NavigationViewSplitVectorID>;
00018
00019 class TopNavigationViewDataProvider: public SplitDataSourceT
00020 {
00021 public:
00022
00023     TopNavigationViewDataProvider(const ITrackerHandleManager* m_owner);
00024
00025     winrt::IVector<winrt::IInspectable> GetPrimaryItems();
00026     winrt::IVector<winrt::IInspectable> GetOverflowItems();
00027
00028     // The raw data is from MenuItems or MenuItemsSource
00029     void SetDataSource(const winrt::IInspectable& rawData);
00030     bool ShouldChangeDataSource(winrt::IInspectable const& rawData);
00031
00032     void OnRawDataChanged(std::function<void(winrt::NotifyCollectionChangedEventArgs const& args)> const& dataChangeCallback);
00033
00034     // override SplitDataSourceBase
00035     int IndexOf(const winrt::IInspectable& value) override;
00036     winrt::IInspectable GetAt(int index) override;
00037     int Size() override;
00038     NavigationViewSplitVectorID DefaultVectorIDOnInsert() override;
00039     float DefaultAttachedData() override;
00040
00041     void MoveAllItemsToPrimaryList();
00042     std::vector<int> ConvertPrimaryIndexToIndex(std::vector<int> const& indexesInPrimary);
00043     int ConvertOriginalIndexToIndex(int originalIndex);
00044     void MoveItemsOutOfPrimaryList(std::vector<int> const& indexes);
00045     void MoveItemsToPrimaryList(std::vector<int> const& indexes);
00046     void MoveItemsToList(std::vector<int> const& indexes, NavigationViewSplitVectorID vectorID);
00047
00048     int IndexOf(const winrt::IInspectable& value, NavigationViewSplitVectorID vectorID);
00049
00050     int GetPrimaryListSize();
00051     int GetNavigationViewItemCountInPrimaryList();
00052     int GetNavigationViewItemCountInTopNav();
00053
00054     void UpdateWidthForPrimaryItem(int indexInPrimary, float width);
00055     float WidthRequiredToRecoveryAllItemsToPrimary();
00056     float CalculateWidthForItems(std::vector<int> &items);
00057     float GetWidthForItem(int index);
00058     void InvalidWidthCache();
00059     float OverflowButtonWidth();
00060     void OverflowButtonWidth(float width);
00061     bool IsItemInPrimaryList(int index);
00062     bool HasInvalidWidth(std::vector<int> & items);
00063     bool IsValidWidthForItem(int index);
00064
00065     // If value is not in the raw data set or can't be move to primarylist, then return false
00066     bool IsItemSelectableInPrimaryList(const winrt::IInspectable& value);
00067 protected:
00068     void OnDataSourceChanged(const winrt::IInspectable& sender, const winrt::NotifyCollectionChangedEventArgs& args);
00069
00070 private:
00071     bool IsValidWidth(float width);
00072     void SetWidthForItem(int index, float width);
00073     void ChangeDataSource(winrt::ItemsSourceView dataSource);
00074     bool IsContainerNavigationViewItem(int index);
00075     bool IsContainerNavigationViewHeader(int index);
00076
00077     tracker_ref<winrt::ItemsSourceView> m_dataSource;
00078     // If the raw datasource is the same, we don't need to create new winrt::ItemsSourceView object.
00079     tracker_ref<winrt::IInspectable> m_rawDataSource;
00080     // Event tokens
00081     winrt::event_token m_dataSourceChanged{};
00082     std::function<void(const winrt::NotifyCollectionChangedEventArgs& args)> m_dataChangeCallback;
00083     float m_overflowButtonCachedWidth{};
00084 };
00085
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

XamlAmbientLight Member List

This is the complete list of members for XamlAmbientLight, including all inherited members.
abi_enter() | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
CheckThread() | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
ClearProperties() | XamlAmbientLightProperties | [static]
Color(winrt::Color const &value) | XamlAmbientLightProperties |
Color() | XamlAmbientLightProperties |
ColorProperty() | XamlAmbientLightProperties | [inline, static]
DeleteInstanceOnUIThread(std::unique_ptr< XamlAmbientLight > &&self) noexcept | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline, static]
EnsureCompositionResources() | XamlAmbientLight | [private]
EnsureProperties() | XamlAmbientLightProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
final_release(std::unique_ptr< XamlAmbientLight > &&self) | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline, static]
GetBase() | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
GetId() | XamlAmbientLight |
GetInner() | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
GetIsTarget(winrt::DependencyObject const &target) | XamlAmbientLightProperties | [static]
GetLightIdStatic() | XamlAmbientLight | [static]
IsOnThread() | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
IsTargetProperty() | XamlAmbientLightProperties | [inline, static]
MaterialHelper | XamlAmbientLight | [private]
MaterialHelperBase | XamlAmbientLight | [private]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
OnColorPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | XamlAmbientLight |
XamlAmbientLightProperties::OnColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | XamlAmbientLightProperties | [static]
OnConnected(winrt::UIElement const &newElement) | XamlAmbientLight |
OnDisconnected(winrt::UIElement const &oldElement) | XamlAmbientLight |
OnIsTargetPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyPropertyChangedEventArgs &args) | XamlAmbientLight | [static]
OnMaterialPolicyStatusChanged(const com_ptr< MaterialHelperBase > &sender, bool isDisabledByMaterialPolicy) | XamlAmbientLight |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< XamlAmbientLight, winrt::implementation::XamlAmbientLightT > | [inline]
ReleaseCompositionResources() | XamlAmbientLight | [private]
s_ColorProperty | XamlAmbientLightProperties | [static]
s_IsTargetProperty | XamlAmbientLightProperties | [static]
sc_defaultColor | XamlAmbientLight | [static]
SetIsTarget(winrt::DependencyObject const &target, bool value) | XamlAmbientLightProperties | [static]
XamlAmbientLight() | XamlAmbientLight |
XamlAmbientLightProperties() | XamlAmbientLightProperties |
Generated on Sun Dec 1 2024 20:53:23 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: DropDownButton/InteractionTests/DropDownButtonTests.cs Source File

  • DropDownButton
  • InteractionTests

DropDownButtonTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005
00006 using Common;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00008 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation;
00016 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00017 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00018 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00019
00020 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00021 {
00022     public class DropDownButton : UIObject, IExpandCollapse
00023     {
00024         public DropDownButton(UIObject uiObject)
00025             : base(uiObject)
00026         {
00027             this.Initialize();
00028         }
00029
00030         private void Initialize()
00031         {
00032             _expandCollapsePattern = new ExpandCollapseImplementation(this);
00033         }
00034
00035         public void ExpandAndWait()
00036         {
00037             using (var waiter = GetExpandedWaiter())
00038             {
00039                 Expand();
00040                 waiter.Wait();
00041             }
00042
00043             Wait.ForIdle();
00044         }
00045
00046         public void CollapseAndWait()
00047         {
00048             using (var waiter = GetCollapsedWaiter())
00049             {
00050                 Collapse();
00051                 waiter.Wait();
00052             }
00053
00054             Wait.ForIdle();
00055         }
00056
00057         public void Expand()
00058         {
00059             _expandCollapsePattern.Expand();
00060         }
00061
00062         public void Collapse()
00063         {
00064             _expandCollapsePattern.Collapse();
00065         }
00066
00067         public UIEventWaiter GetExpandedWaiter()
00068         {
00069             return _expandCollapsePattern.GetExpandedWaiter();
00070         }
00071
00072         public UIEventWaiter GetCollapsedWaiter()
00073         {
00074             return _expandCollapsePattern.GetCollapsedWaiter();
00075         }
00076
00077         public ExpandCollapseState ExpandCollapseState
00078         {
00079             get { return _expandCollapsePattern.ExpandCollapseState; }
00080         }
00081
00082         new public static IFactory<DropDownButton> Factory
00083         {
00084             get
00085             {
00086                 if (null == DropDownButton._factory)
00087                 {
00088                     DropDownButton._factory = new DropDownButtonFactory();
00089                 }
00090                 return DropDownButton._factory;
00091             }
00092         }
00093
00094         private IExpandCollapse _expandCollapsePattern;
00095         private static IFactory<DropDownButton> _factory = null;
00096
00097         private class DropDownButtonFactory : IFactory<DropDownButton>
00098         {
00099             public DropDownButton Create(UIObject element)
00100             {
00101                 return new DropDownButton(element);
00102             }
00103         }
00104     }
00105
00106     [TestClass]
00107     public class DropDownButtonTests
00108     {
00109         [ClassInitialize]
00110         [TestProperty("RunAs", "User")]
00111         [TestProperty("Classification", "Integration")]
00112         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00113         public static void ClassInitialize(TestContext testContext)
00114         {
00115             TestEnvironment.Initialize(testContext);
00116         }
00117
00118         public void TestCleanup()
00119         {
00120             TestCleanupHelper.Cleanup();
00121         }
00122
00123         [TestMethod]
00124         public void AccessibilityTest()
00125         {
00126             using (var setup = new TestSetupHelper("DropDownButton Tests"))
00127             {
00128                 DropDownButton dropDownButton = FindElement.ByName<DropDownButton>("TestDropDownButton");
00129
00130                 TextBlock flyoutOpenedCountTextBlock = FindElement.ByName<TextBlock>("FlyoutOpenedCountTextBlock");
00131                 TextBlock flyoutClosedCountTextBlock = FindElement.ByName<TextBlock>("FlyoutClosedCountTextBlock");
00132
00133                 Log.Comment("Verify that DropDownButton implements IExpandCollapseProvider");
00134                 Verify.AreEqual("0", flyoutOpenedCountTextBlock.DocumentText);
00135                 Log.Comment("IExpandCollapseProvider.Expand");
00136                 dropDownButton.ExpandAndWait();
00137                 Verify.AreEqual("1", flyoutOpenedCountTextBlock.DocumentText);
00138                 VerifyElement.Found("TestFlyout", FindBy.Name);
00139                 Verify.AreEqual(dropDownButton.ExpandCollapseState, ExpandCollapseState.Expanded);
00140
00141                 Verify.AreEqual("0", flyoutClosedCountTextBlock.DocumentText);
00142                 Log.Comment("IExpandCollapseProvider.Collapse");
00143                 dropDownButton.CollapseAndWait();
00144                 Wait.ForIdle();
00145                 Verify.AreEqual("1", flyoutClosedCountTextBlock.DocumentText);
00146                 Verify.AreEqual(dropDownButton.ExpandCollapseState, ExpandCollapseState.Collapsed);
00147
00148                 Log.Comment("Change to a different flyout");
00149                 CheckBox setFlyoutCheckBox = FindElement.ByName<CheckBox>("SetFlyoutCheckbox");
00150                 setFlyoutCheckBox.Check();
00151                 Wait.ForIdle();
00152
00153                 Verify.AreEqual("1", flyoutOpenedCountTextBlock.DocumentText);
00154                 Log.Comment("IExpandCollapseProvider.Expand");
00155                 dropDownButton.ExpandAndWait();
00156                 Wait.ForIdle();
00157                 Verify.AreEqual("2", flyoutOpenedCountTextBlock.DocumentText);
00158                 Verify.AreEqual(dropDownButton.ExpandCollapseState, ExpandCollapseState.Expanded);
00159
00160                 Verify.AreEqual("1", flyoutClosedCountTextBlock.DocumentText);
00161                 Log.Comment("IExpandCollapseProvider.Collapse");
00162                 dropDownButton.CollapseAndWait();
00163                 Wait.ForIdle();
00164                 Verify.AreEqual("2", flyoutClosedCountTextBlock.DocumentText);
00165                 Verify.AreEqual(dropDownButton.ExpandCollapseState, ExpandCollapseState.Collapsed);
00166             }
00167         }
00168     }
00169 }
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemContainer/ItemContainer.h Source File

  • ItemContainer

ItemContainer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ItemContainerTrace.h"
00007 #include "ItemContainer.g.h"
00008 #include "ItemContainer.properties.h"
00009 #include "PointerInfo.h"
00010
00011 class ItemContainer :
00012     public ReferenceTracker<ItemContainer, winrt::implementation::ItemContainerT>,
00013     public ItemContainerProperties
00014 {
00015
00016 public:
00017     ItemContainer();
00018     ~ItemContainer();
00019
00020     // IFrameworkElement
00021     virtual void OnApplyTemplate();
00022
00023     // IUIElement
00024     virtual winrt::AutomationPeer OnCreateAutomationPeer();
00025
00026     void OnDoubleTapped(winrt::DoubleTappedRoutedEventArgs const& args);
00027     void OnKeyDown(winrt::KeyRoutedEventArgs const& args);
00028     void OnPointerEntered(winrt::PointerRoutedEventArgs const& args);
00029     void OnPointerMoved(winrt::PointerRoutedEventArgs const& args);
00030     void OnPointerExited(winrt::PointerRoutedEventArgs const& args);
00031     void OnPointerPressed(winrt::PointerRoutedEventArgs const& args);
00032     void OnPointerReleased(winrt::PointerRoutedEventArgs const& args);
00033     void OnPointerCanceled(winrt::PointerRoutedEventArgs const& args);
00034     void OnPointerCaptureLost(winrt::PointerRoutedEventArgs const& args);
00035     void OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00036     void OnTapped(winrt::TappedRoutedEventArgs const& args);
00037
00038     bool RaiseItemInvoked(const winrt::ItemContainerInteractionTrigger& interactionTrigger, const winrt::IInspectable& originalSource);
00039
00040 #ifndef MUX_PRERELEASE
00041     winrt::ItemContainerUserSelectMode CanUserSelectInternal() const
00042     {
00043         return m_canUserSelectInternal;
00044     }
00045
00046     winrt::ItemContainerUserInvokeMode CanUserInvokeInternal() const
00047     {
00048         return m_canUserInvokeInternal;
00049     }
00050
00051     winrt::ItemContainerMultiSelectMode MultiSelectModeInternal() const
00052     {
00053         return m_multiSelectModeInternal;
00054     }
00055
00056     void CanUserSelectInternal(const winrt::ItemContainerUserSelectMode& value)
00057     {
00058         if (m_canUserSelectInternal != value)
00059         {
00060             m_canUserSelectInternal = value;
00061         }
00062     }
00063
00064     void CanUserInvokeInternal(const winrt::ItemContainerUserInvokeMode& value)
00065     {
00066         if (m_canUserInvokeInternal != value)
00067         {
00068             m_canUserInvokeInternal = value;
00069         }
00070     }
00071
00072     void MultiSelectModeInternal(const winrt::ItemContainerMultiSelectMode& value)
00073     {
00074         if (m_multiSelectModeInternal != value)
00075         {
00076             m_multiSelectModeInternal = value;
00077
00078             // Same code as in ItemContainer::OnPropertyChanged, when MultiSelectMode changed.
00079             if (m_pointerInfo != nullptr)
00080             {
00081                 UpdateVisualState(true);
00082                 UpdateMultiSelectState(true);
00083             }
00084         }
00085     }
00086 #endif
00087
00088 #ifdef DBG
00089     winrt::Size MeasureOverride(winrt::Size const& availableSize);
00090     winrt::Size ArrangeOverride(winrt::Size const& finalSize);
00091 #endif
00092
00093 private:
00094     void OnIsEnabledChanged(winrt::IInspectable const& sender, winrt::DependencyPropertyChangedEventArgs const& args);
00095
00096     void GoToState(std::wstring_view const& stateName, bool useTransitions);
00097     void UpdateVisualState(bool useTransitions);
00098     void UpdateMultiSelectState(bool useTransitions);
00099
00100     void ProcessPointerOver(winrt::PointerRoutedEventArgs const& args, bool isPointerOver);
00101     void ProcessPointerCanceled(winrt::PointerRoutedEventArgs const& args);
00102
00103     bool CanRaiseItemInvoked();
00104
00105     void LoadSelectionCheckbox();
00106     void OnCheckToggle(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
00107     void UpdateCheckboxState();
00108     void UpdateMousePointerOverInstance(bool isPointerOver);
00109
00110 #ifdef DBG
00111     static winrt::hstring DependencyPropertyToString(const winrt::IDependencyProperty& dependencyProperty);
00112 #endif
00113
00114     winrt::Control::IsEnabledChanged_revoker m_isEnabledChangedRevoker{};
00115     winrt::CheckBox::Checked_revoker m_checked_revoker{};
00116     winrt::CheckBox::Unchecked_revoker m_unchecked_revoker{};
00117     std::shared_ptr<PointerInfo<ItemContainer>> m_pointerInfo{ nullptr };
00118
00119     tracker_ref<winrt::CheckBox> m_selectionCheckbox{ this };
00120     tracker_ref<winrt::Panel> m_rootPanel{ this };
00121
00122 #ifndef MUX_PRERELEASE
00123     winrt::ItemContainerUserSelectMode  m_canUserSelectInternal{ winrt::ItemContainerUserSelectMode::Auto };
00124     winrt::ItemContainerUserInvokeMode  m_canUserInvokeInternal{ winrt::ItemContainerUserInvokeMode::Auto };
00125     winrt::ItemContainerMultiSelectMode m_multiSelectModeInternal{ winrt::ItemContainerMultiSelectMode::Auto };
00126 #endif
00127
00128     static constexpr std::wstring_view s_disabledStateName{ L"Disabled"sv };
00129     static constexpr std::wstring_view s_enabledStateName{ L"Enabled"sv };
00130     static constexpr std::wstring_view s_selectedPressedStateName{ L"SelectedPressed"sv };
00131     static constexpr std::wstring_view s_unselectedPressedStateName{ L"UnselectedPressed"sv };
00132     static constexpr std::wstring_view s_selectedPointerOverStateName{ L"SelectedPointerOver"sv };
00133     static constexpr std::wstring_view s_unselectedPointerOverStateName{ L"UnselectedPointerOver"sv };
00134     static constexpr std::wstring_view s_selectedNormalStateName{ L"SelectedNormal"sv };
00135     static constexpr std::wstring_view s_unselectedNormalStateName{ L"UnselectedNormal"sv };
00136     static constexpr std::wstring_view s_multipleStateName{ L"Multiple"sv };
00137     static constexpr std::wstring_view s_singleStateName{ L"Single"sv };
00138     static constexpr std::wstring_view s_selectionCheckboxName{ L"PART_SelectionCheckbox" };
00139     static constexpr std::wstring_view s_containerRootName{ L"PART_ContainerRoot" };
00140 };
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IDistantDiffuseEffect Member List

This is the complete list of members for IDistantDiffuseEffect, including all inherited members.
Azimuth([out, retval] float *value) | IDistantDiffuseEffect
Azimuth([in] float value) | IDistantDiffuseEffect
DiffuseAmount([out, retval] float *value) | IDistantDiffuseEffect
DiffuseAmount([in] float value) | IDistantDiffuseEffect
Elevation([out, retval] float *value) | IDistantDiffuseEffect
Elevation([in] float value) | IDistantDiffuseEffect
HeightMapInterpolationMode([out, retval] Microsoft.UI.Private.Composition.Effects.CanvasImageInterpolation *value) | IDistantDiffuseEffect
HeightMapInterpolationMode([in] Microsoft.UI.Private.Composition.Effects.CanvasImageInterpolation value) | IDistantDiffuseEffect
HeightMapKernelSize([out, retval] Windows.Foundation.Numerics.Vector2 *value) | IDistantDiffuseEffect
HeightMapKernelSize([in] Windows.Foundation.Numerics.Vector2 value) | IDistantDiffuseEffect
HeightMapScale([out, retval] float *value) | IDistantDiffuseEffect
HeightMapScale([in] float value) | IDistantDiffuseEffect
LightColor([out, retval] Windows.UI.Color *value) | IDistantDiffuseEffect
LightColor([in] Windows.UI.Color value) | IDistantDiffuseEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | IDistantDiffuseEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | IDistantDiffuseEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InspectingDataSourceTests::CollectionChangeRecorder Member List

This is the complete list of members for InspectingDataSourceTests::CollectionChangeRecorder, including all inherited members.
_recordedArgs | InspectingDataSourceTests::CollectionChangeRecorder | [private]
Clone(NotifyCollectionChangedEventArgs args) | InspectingDataSourceTests::CollectionChangeRecorder | [inline, private, static]
CollectionChangeRecorder(ItemsSourceView source) | InspectingDataSourceTests::CollectionChangeRecorder | [inline]
RecordedArgs | InspectingDataSourceTests::CollectionChangeRecorder |
Generated on Sun Dec 1 2024 20:53:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ProgressRingTests Member List

This is the complete list of members for ProgressRingTests, including all inherited members.
ChangeStateTest() | ProgressRingTests | [inline]
ChangeValueTest() | ProgressRingTests | [inline]
ClassInitialize(TestContext testContext) | ProgressRingTests | [inline, static]
LottieCustomSourceTest() | ProgressRingTests | [inline]
StoryboardAnimationRetemplateTest() | ProgressRingTests | [inline]
TestCleanup() | ProgressRingTests | [inline]
UpdateMinMaxTest() | ProgressRingTests | [inline]
VerifyAxeScanPasses() | ProgressRingTests | [inline]
VerifyIndeterminateProgressRingDoesNotImplementRangeValuePattern() | ProgressRingTests | [inline]
Generated on Sun Dec 1 2024 20:53:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterTrace.h Source File

  • ScrollPresenter

ScrollPresenterTrace.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007 #include "MuxcTraceLogging.h"
00008 #include "Utils.h"
00009 #include "MUXControlsTestHooks.h"
00010
00011 inline bool IsScrollPresenterTracingEnabled()
00012 {
00013     return g_IsLoggingProviderEnabled &&
00014         g_LoggingProviderLevel >= WINEVENT_LEVEL_INFO &&
00015         (g_LoggingProviderMatchAnyKeyword & KEYWORD_SCROLLPRESENTER || g_LoggingProviderMatchAnyKeyword == 0);
00016 }
00017
00018 inline bool IsScrollPresenterVerboseTracingEnabled()
00019 {
00020     return g_IsLoggingProviderEnabled &&
00021         g_LoggingProviderLevel >= WINEVENT_LEVEL_VERBOSE &&
00022         (g_LoggingProviderMatchAnyKeyword & KEYWORD_SCROLLPRESENTER || g_LoggingProviderMatchAnyKeyword == 0);
00023 }
00024
00025 inline bool IsScrollPresenterPerfTracingEnabled()
00026 {
00027     return g_IsPerfProviderEnabled &&
00028         g_PerfProviderLevel >= WINEVENT_LEVEL_INFO &&
00029         (g_PerfProviderMatchAnyKeyword & KEYWORD_SCROLLPRESENTER || g_PerfProviderMatchAnyKeyword == 0);
00030 }
00031
00032 #define SCROLLPRESENTER_TRACE_INFO_ENABLED(includeTraceLogging, sender, message, ...) \
00033 ScrollPresenterTrace::TraceInfo(includeTraceLogging, sender, message, __VA_ARGS__); \
00034
00035 #define SCROLLPRESENTER_TRACE_INFO(sender, message, ...) \
00036 if (IsScrollPresenterTracingEnabled()) \
00037 { \
00038     SCROLLPRESENTER_TRACE_INFO_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00039 } \
00040 else if (ScrollPresenterTrace::s_IsDebugOutputEnabled || ScrollPresenterTrace::s_IsVerboseDebugOutputEnabled) \
00041 { \
00042     SCROLLPRESENTER_TRACE_INFO_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00043 } \
00044
00045 #define SCROLLPRESENTER_TRACE_VERBOSE_ENABLED(includeTraceLogging, sender, message, ...) \
00046 ScrollPresenterTrace::TraceVerbose(includeTraceLogging, sender, message, __VA_ARGS__); \
00047
00048 #define SCROLLPRESENTER_TRACE_VERBOSE(sender, message, ...) \
00049 if (IsScrollPresenterVerboseTracingEnabled()) \
00050 { \
00051     SCROLLPRESENTER_TRACE_VERBOSE_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00052 } \
00053 else if (ScrollPresenterTrace::s_IsVerboseDebugOutputEnabled) \
00054 { \
00055     SCROLLPRESENTER_TRACE_VERBOSE_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00056 } \
00057
00058 #define SCROLLPRESENTER_TRACE_PERF(info) \
00059 if (IsScrollPresenterPerfTracingEnabled()) \
00060 { \
00061     ScrollPresenterTrace::TracePerfInfo(info); \
00062 } \
00063
00064 #ifdef DBG
00065 #define SCROLLPRESENTER_TRACE_INFO_DBG(sender, message, ...)    SCROLLPRESENTER_TRACE_INFO(sender, message, __VA_ARGS__)
00066 #define SCROLLPRESENTER_TRACE_VERBOSE_DBG(sender, message, ...) SCROLLPRESENTER_TRACE_VERBOSE(sender, message, __VA_ARGS__)
00067 #define SCROLLPRESENTER_TRACE_PERF_DBG(info)                    SCROLLPRESENTER_TRACE_PERF(info)
00068 #else
00069 #define SCROLLPRESENTER_TRACE_INFO_DBG(sender, message, ...)
00070 #define SCROLLPRESENTER_TRACE_VERBOSE_DBG(sender, message, ...)
00071 #define SCROLLPRESENTER_TRACE_PERF_DBG(info)
00072 #endif // DBG
00073
00074 class ScrollPresenterTrace
00075 {
00076 public:
00077     static bool s_IsDebugOutputEnabled;
00078     static bool s_IsVerboseDebugOutputEnabled;
00079
00080     static void TraceInfo(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept
00081     {
00082         va_list args;
00083         va_start(args, message);
00084         WCHAR buffer[384]{};
00085         if (SUCCEEDED(StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args)))
00086         {
00087             if (includeTraceLogging)
00088             {
00089                 // TraceViewers
00090                 // http://toolbox/pef
00091                 // http://fastetw/index.aspx
00092                 TraceLoggingWrite(
00093                     g_hLoggingProvider,
00094                     "ScrollPresenterInfo" /* eventName */,
00095                     TraceLoggingLevel(WINEVENT_LEVEL_INFO),
00096                     TraceLoggingKeyword(KEYWORD_SCROLLPRESENTER),
00097                     TraceLoggingWideString(buffer, "Message"));
00098             }
00099
00100             if (s_IsDebugOutputEnabled)
00101             {
00102                 OutputDebugStringW(buffer);
00103             }
00104
00105             com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks();
00106
00107             if (globalTestHooks &&
00108                 (globalTestHooks->GetLoggingLevelForType(L"ScrollPresenter") >= WINEVENT_LEVEL_INFO || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_INFO))
00109             {
00110                 globalTestHooks->LogMessage(sender, buffer, false /*isVerboseLevel*/);
00111             }
00112         }
00113         va_end(args);
00114     }
00115
00116     static void TraceVerbose(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept
00117     {
00118         va_list args;
00119         va_start(args, message);
00120         WCHAR buffer[1024]{};
00121         const HRESULT hr = StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args);
00122         if (SUCCEEDED(hr) || hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
00123         {
00124             if (includeTraceLogging)
00125             {
00126                 // TraceViewers
00127                 // http://toolbox/pef
00128                 // http://fastetw/index.aspx
00129                 TraceLoggingWrite(
00130                     g_hLoggingProvider,
00131                     "ScrollPresenterVerbose" /* eventName */,
00132                     TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
00133                     TraceLoggingKeyword(KEYWORD_SCROLLPRESENTER),
00134                     TraceLoggingWideString(buffer, "Message"));
00135             }
00136
00137             if (s_IsDebugOutputEnabled || s_IsVerboseDebugOutputEnabled)
00138             {
00139                 OutputDebugStringW(buffer);
00140             }
00141
00142             com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks();
00143
00144             if (globalTestHooks &&
00145                 (globalTestHooks->GetLoggingLevelForType(L"ScrollPresenter") >= WINEVENT_LEVEL_VERBOSE || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_VERBOSE))
00146             {
00147                 globalTestHooks->LogMessage(sender, buffer, true /*isVerboseLevel*/);
00148             }
00149         }
00150         va_end(args);
00151     }
00152
00153     static void TracePerfInfo(PCWSTR info) noexcept
00154     {
00155         // TraceViewers
00156         // http://toolbox/pef
00157         // http://fastetw/index.aspx
00158         TraceLoggingWrite(
00159             g_hPerfProvider,
00160             "ScrollPresenterPerf" /* eventName */,
00161             TraceLoggingLevel(WINEVENT_LEVEL_INFO),
00162             TraceLoggingKeyword(KEYWORD_SCROLLPRESENTER),
00163             TraceLoggingWideString(info, "Info"));
00164     }
00165 };
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectedItems< T >::Iterator Member List

This is the complete list of members for SelectedItems< T >::Iterator, including all inherited members.
abi_enter() | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
CheckThread() | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
Current() | SelectedItems< T >::Iterator | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< Iterator > &&self) noexcept | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
final_release(std::unique_ptr< Iterator > &&self) | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline, static]
GetBase() | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
GetInner() | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
GetMany(winrt::array_view< T > values) | SelectedItems< T >::Iterator | [inline]
HasCurrent() | SelectedItems< T >::Iterator | [inline]
IsOnThread() | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
Iterator(const winrt::IVectorView< T > &selectedItems) | SelectedItems< T >::Iterator | [inline]
m_currentIndex | SelectedItems< T >::Iterator | [private]
MoveNext() | SelectedItems< T >::Iterator | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< Iterator, reference_tracker_implements_t< winrt::IIterator< T > >::type > | [inline]
~Iterator() | SelectedItems< T >::Iterator | [inline]
Generated on Sun Dec 1 2024 20:53:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/Layout.h Source File

  • Repeater

Layout.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "Layout.g.h"
00007 #include "NonVirtualizingLayout.g.h"
00008
00009 class Layout :
00010     public winrt::implementation::LayoutT<Layout, winrt::composable>
00011 {
00012 public:
00013 #pragma region ILayout
00014     // For debugging purposes only.
00015     winrt::hstring LayoutId();
00016     void LayoutId(winrt::hstring const& state);
00017     // Invoked by LayoutsTestHooks only.
00018     winrt::IndexBasedLayoutOrientation GetForcedIndexBasedLayoutOrientation();
00019     void SetForcedIndexBasedLayoutOrientation(winrt::IndexBasedLayoutOrientation forcedIndexBasedLayoutOrientation);
00020     void ResetForcedIndexBasedLayoutOrientation();
00021
00022     winrt::IndexBasedLayoutOrientation IndexBasedLayoutOrientation();
00023
00024     void InitializeForContext(winrt::LayoutContext const& context);
00025     void UninitializeForContext(winrt::LayoutContext const& context);
00026
00027     winrt::Size Measure(winrt::LayoutContext const& context, winrt::Size const& availableSize);
00028     winrt::Size Arrange(winrt::LayoutContext const& context, winrt::Size const& finalSize);
00029
00030     winrt::event_token MeasureInvalidated(winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable> const& value);
00031     void MeasureInvalidated(winrt::event_token const& token);
00032
00033     winrt::event_token ArrangeInvalidated(winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable> const& value);
00034     void ArrangeInvalidated(winrt::event_token const& token);
00035
00036     virtual winrt::ItemCollectionTransitionProvider CreateDefaultItemTransitionProvider() { return nullptr; }
00037 #pragma endregion
00038
00039 #pragma region ILayoutProtected
00040     void InvalidateMeasure();
00041     void InvalidateArrange();
00042     void SetIndexBasedLayoutOrientation(winrt::IndexBasedLayoutOrientation orientation);
00043 #pragma endregion
00044
00045 private:
00046     event<winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable>> m_measureInvalidatedEventSource{ };
00047     event<winrt::TypedEventHandler<winrt::Layout, winrt::IInspectable>> m_arrangeInvalidatedEventSource { };
00048
00049     // TODO: This is for debugging purposes only. It should be removed when
00050     // the Layout.LayoutId API is removed.
00051     winrt::hstring m_layoutId;
00052
00053     winrt::IndexBasedLayoutOrientation m_indexBasedLayoutOrientation{ winrt::IndexBasedLayoutOrientation::None };
00054
00055     // Used by LayoutsTestHooks only for testing purposes.
00056     winrt::IndexBasedLayoutOrientation m_forcedIndexBasedLayoutOrientationDbg{ winrt::IndexBasedLayoutOrientation::None };
00057     bool m_isForcedIndexBasedLayoutOrientationSetDbg{ false };
00058 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MenuBar/MenuBarItemAutomationPeer.cpp Source File

  • MenuBar

MenuBarItemAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MenuBar.h"
00007 #include "MenuBarItem.h"
00008 #include "ResourceAccessor.h"
00009 #include "MenuBarItemAutomationPeer.h"
00010 #include "Utils.h"
00011
00012 #include "MenuBarItemAutomationPeer.properties.cpp"
00013
00014 MenuBarItemAutomationPeer::MenuBarItemAutomationPeer(winrt::MenuBarItem const& owner) : ReferenceTracker(owner)
00015 {
00016 }
00017
00018 winrt::AutomationControlType MenuBarItemAutomationPeer::GetAutomationControlTypeCore()
00019 {
00020     return winrt::AutomationControlType::MenuItem;
00021 }
00022
00023 winrt::IInspectable MenuBarItemAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00024 {
00025     if (patternInterface == winrt::PatternInterface::Invoke || patternInterface == winrt::PatternInterface::ExpandCollapse)
00026     {
00027         return *this;
00028     }
00029     return __super::GetPatternCore(patternInterface);
00030 }
00031
00032 winrt::hstring MenuBarItemAutomationPeer::GetNameCore()
00033 {
00034     //Check to see if the item has a defined AutomationProperties.Name
00035     winrt::hstring name = __super::GetNameCore();
00036
00037     if (name.empty())
00038     {
00039         auto owner = Owner().as<winrt::MenuBarItem>();
00040         name = owner.Title();
00041     }
00042
00043     return name;
00044 }
00045
00046 winrt::hstring MenuBarItemAutomationPeer::GetClassNameCore()
00047 {
00048     return winrt::hstring_name_of<winrt::MenuBarItem>();
00049 }
00050
00051 void MenuBarItemAutomationPeer::Invoke()
00052 {
00053     auto owner = Owner().as<winrt::MenuBarItem>();
00054     winrt::get_self<MenuBarItem>(owner)->Invoke();
00055 }
00056
00057 winrt::ExpandCollapseState MenuBarItemAutomationPeer::ExpandCollapseState()
00058 {
00059     winrt::UIElement owner = Owner();
00060     auto menuBarItem = owner.as<winrt::MenuBarItem>();
00061     if (winrt::get_self<MenuBarItem>(menuBarItem)->IsFlyoutOpen())
00062     {
00063         return winrt::ExpandCollapseState::Expanded;
00064     }
00065     else
00066     {
00067         return winrt::ExpandCollapseState::Collapsed;
00068     }
00069 }
00070
00071 void MenuBarItemAutomationPeer::Collapse()
00072 {
00073     auto owner = Owner().as<winrt::MenuBarItem>();
00074     winrt::get_self<MenuBarItem>(owner)->CloseMenuFlyout();
00075 }
00076
00077 void MenuBarItemAutomationPeer::Expand()
00078 {
00079     auto owner = Owner().as<winrt::MenuBarItem>();
00080     winrt::get_self<MenuBarItem>(owner)->ShowMenuFlyout();
00081 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarMenuButtonAutomationPeer.properties.cpp Source File

  • Generated

InkToolBarMenuButtonAutomationPeer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InkToolBarMenuButtonAutomationPeer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Automation::Peers
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(InkToolBarMenuButtonAutomationPeer)
00012 }
00013
00014 #include "InkToolBarMenuButtonAutomationPeer.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewPaneClosingEventArgs.h Source File

  • NavigationView

NavigationViewPaneClosingEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "NavigationViewPaneClosingEventArgs.g.h"
00007
00008 class NavigationViewPaneClosingEventArgs :
00009     public ReferenceTracker<NavigationViewPaneClosingEventArgs, winrt::implementation::NavigationViewPaneClosingEventArgsT, winrt::composing, winrt::composable>
00010 {
00011 public:
00012     bool Cancel();
00013     void Cancel(bool value);
00014
00015     void SplitViewClosingArgs(winrt::SplitViewPaneClosingEventArgs const& value);
00016
00017 private:
00018     tracker_ref<winrt::SplitViewPaneClosingEventArgs> m_splitViewClosingArgs{ this };
00019
00020     bool m_cancelled{};
00021 };
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewAutomationPeer Member List

This is the complete list of members for NavigationViewAutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
CanSelectMultiple() | NavigationViewAutomationPeer |
CheckThread() | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< NavigationViewAutomationPeer > &&self) noexcept | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
final_release(std::unique_ptr< NavigationViewAutomationPeer > &&self) | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline, static]
GetBase() | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
GetInner() | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
GetPatternCore(winrt::PatternInterface const &patternInterface) | NavigationViewAutomationPeer |
GetSelection() | NavigationViewAutomationPeer |
IsOnThread() | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
IsSelectionRequired() | NavigationViewAutomationPeer |
NavigationViewAutomationPeer(winrt::NavigationView const &owner) | NavigationViewAutomationPeer |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
RaiseSelectionChangedEvent(winrt::IInspectable const &oldSelection, winrt::IInspectable const &newSelection) | NavigationViewAutomationPeer |
ReferenceTracker(Args &&...args) | ReferenceTracker< NavigationViewAutomationPeer, winrt::implementation::NavigationViewAutomationPeerT, winrt::ISelectionProvider > | [inline]
Generated on Sun Dec 1 2024 20:52:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/TabViewItemTemplateSettings.properties.cpp Source File

  • Generated

TabViewItemTemplateSettings.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "TabViewItemTemplateSettings.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(TabViewItemTemplateSettings)
00012 }
00013
00014 #include "TabViewItemTemplateSettings.g.cpp"
00015
00016 GlobalDependencyProperty TabViewItemTemplateSettingsProperties::s_IconElementProperty{ nullptr };
00017 GlobalDependencyProperty TabViewItemTemplateSettingsProperties::s_TabGeometryProperty{ nullptr };
00018
00019 TabViewItemTemplateSettingsProperties::TabViewItemTemplateSettingsProperties()
00020 {
00021     EnsureProperties();
00022 }
00023
00024 void TabViewItemTemplateSettingsProperties::EnsureProperties()
00025 {
00026     if (!s_IconElementProperty)
00027     {
00028         s_IconElementProperty =
00029             InitializeDependencyProperty(
00030                 L"IconElement",
00031                 winrt::name_of<winrt::IconElement>(),
00032                 winrt::name_of<winrt::TabViewItemTemplateSettings>(),
00033                 false /* isAttached */,
00034                 ValueHelper<winrt::IconElement>::BoxedDefaultValue(),
00035                 nullptr);
00036     }
00037     if (!s_TabGeometryProperty)
00038     {
00039         s_TabGeometryProperty =
00040             InitializeDependencyProperty(
00041                 L"TabGeometry",
00042                 winrt::name_of<winrt::Geometry>(),
00043                 winrt::name_of<winrt::TabViewItemTemplateSettings>(),
00044                 false /* isAttached */,
00045                 ValueHelper<winrt::Geometry>::BoxedDefaultValue(),
00046                 nullptr);
00047     }
00048 }
00049
00050 void TabViewItemTemplateSettingsProperties::ClearProperties()
00051 {
00052     s_IconElementProperty = nullptr;
00053     s_TabGeometryProperty = nullptr;
00054 }
00055
00056 void TabViewItemTemplateSettingsProperties::IconElement(winrt::IconElement const& value)
00057 {
00058     [[gsl::suppress(con)]]
00059     {
00060     static_cast<TabViewItemTemplateSettings*>(this)->SetValue(s_IconElementProperty, ValueHelper<winrt::IconElement>::BoxValueIfNecessary(value));
00061     }
00062 }
00063
00064 winrt::IconElement TabViewItemTemplateSettingsProperties::IconElement()
00065 {
00066     return ValueHelper<winrt::IconElement>::CastOrUnbox(static_cast<TabViewItemTemplateSettings*>(this)->GetValue(s_IconElementProperty));
00067 }
00068
00069 void TabViewItemTemplateSettingsProperties::TabGeometry(winrt::Geometry const& value)
00070 {
00071     [[gsl::suppress(con)]]
00072     {
00073     static_cast<TabViewItemTemplateSettings*>(this)->SetValue(s_TabGeometryProperty, ValueHelper<winrt::Geometry>::BoxValueIfNecessary(value));
00074     }
00075 }
00076
00077 winrt::Geometry TabViewItemTemplateSettingsProperties::TabGeometry()
00078 {
00079     return ValueHelper<winrt::Geometry>::CastOrUnbox(static_cast<TabViewItemTemplateSettings*>(this)->GetValue(s_TabGeometryProperty));
00080 }
Generated on Sun Dec 1 2024 20:51:54 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SplitButton/SplitButtonTestApiFactory.cpp Source File

  • SplitButton

SplitButtonTestApiFactory.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "DisplayRegionHelper.h"
00007 #include "DisplayRegionHelperTestApiFactory.h"
00008
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewTrace Member List

This is the complete list of members for TabViewTrace, including all inherited members.
s_IsDebugOutputEnabled | TabViewTrace | [static]
s_IsVerboseDebugOutputEnabled | TabViewTrace | [static]
TraceInfo(bool includeTraceLogging, const winrt::IInspectable &sender, PCWSTR message,...) noexcept | TabViewTrace | [inline, static]
TracePerfInfo(PCWSTR info) noexcept | TabViewTrace | [inline, static]
TraceVerbose(bool includeTraceLogging, const winrt::IInspectable &sender, PCWSTR message,...) noexcept | TabViewTrace | [inline, static]
Generated on Sun Dec 1 2024 20:53:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InfoBadge.properties.cpp Source File

  • Generated

InfoBadge.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InfoBadge.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(InfoBadge)
00012 }
00013
00014 #include "InfoBadge.g.cpp"
00015
00016 GlobalDependencyProperty InfoBadgeProperties::s_IconSourceProperty{ nullptr };
00017 GlobalDependencyProperty InfoBadgeProperties::s_TemplateSettingsProperty{ nullptr };
00018 GlobalDependencyProperty InfoBadgeProperties::s_ValueProperty{ nullptr };
00019
00020 InfoBadgeProperties::InfoBadgeProperties()
00021 {
00022     EnsureProperties();
00023 }
00024
00025 void InfoBadgeProperties::EnsureProperties()
00026 {
00027     if (!s_IconSourceProperty)
00028     {
00029         s_IconSourceProperty =
00030             InitializeDependencyProperty(
00031                 L"IconSource",
00032                 winrt::name_of<winrt::IconSource>(),
00033                 winrt::name_of<winrt::InfoBadge>(),
00034                 false /* isAttached */,
00035                 ValueHelper<winrt::IconSource>::BoxedDefaultValue(),
00036                 winrt::PropertyChangedCallback(&OnIconSourcePropertyChanged));
00037     }
00038     if (!s_TemplateSettingsProperty)
00039     {
00040         s_TemplateSettingsProperty =
00041             InitializeDependencyProperty(
00042                 L"TemplateSettings",
00043                 winrt::name_of<winrt::InfoBadgeTemplateSettings>(),
00044                 winrt::name_of<winrt::InfoBadge>(),
00045                 false /* isAttached */,
00046                 ValueHelper<winrt::InfoBadgeTemplateSettings>::BoxedDefaultValue(),
00047                 winrt::PropertyChangedCallback(&OnTemplateSettingsPropertyChanged));
00048     }
00049     if (!s_ValueProperty)
00050     {
00051         s_ValueProperty =
00052             InitializeDependencyProperty(
00053                 L"Value",
00054                 winrt::name_of<int>(),
00055                 winrt::name_of<winrt::InfoBadge>(),
00056                 false /* isAttached */,
00057                 ValueHelper<int>::BoxValueIfNecessary(-1),
00058                 winrt::PropertyChangedCallback(&OnValuePropertyChanged));
00059     }
00060 }
00061
00062 void InfoBadgeProperties::ClearProperties()
00063 {
00064     s_IconSourceProperty = nullptr;
00065     s_TemplateSettingsProperty = nullptr;
00066     s_ValueProperty = nullptr;
00067 }
00068
00069 void InfoBadgeProperties::OnIconSourcePropertyChanged(
00070     winrt::DependencyObject const& sender,
00071     winrt::DependencyPropertyChangedEventArgs const& args)
00072 {
00073     auto owner = sender.as<winrt::InfoBadge>();
00074     winrt::get_self<InfoBadge>(owner)->OnPropertyChanged(args);
00075 }
00076
00077 void InfoBadgeProperties::OnTemplateSettingsPropertyChanged(
00078     winrt::DependencyObject const& sender,
00079     winrt::DependencyPropertyChangedEventArgs const& args)
00080 {
00081     auto owner = sender.as<winrt::InfoBadge>();
00082     winrt::get_self<InfoBadge>(owner)->OnPropertyChanged(args);
00083 }
00084
00085 void InfoBadgeProperties::OnValuePropertyChanged(
00086     winrt::DependencyObject const& sender,
00087     winrt::DependencyPropertyChangedEventArgs const& args)
00088 {
00089     auto owner = sender.as<winrt::InfoBadge>();
00090     winrt::get_self<InfoBadge>(owner)->OnPropertyChanged(args);
00091 }
00092
00093 void InfoBadgeProperties::IconSource(winrt::IconSource const& value)
00094 {
00095     [[gsl::suppress(con)]]
00096     {
00097     static_cast<InfoBadge*>(this)->SetValue(s_IconSourceProperty, ValueHelper<winrt::IconSource>::BoxValueIfNecessary(value));
00098     }
00099 }
00100
00101 winrt::IconSource InfoBadgeProperties::IconSource()
00102 {
00103     return ValueHelper<winrt::IconSource>::CastOrUnbox(static_cast<InfoBadge*>(this)->GetValue(s_IconSourceProperty));
00104 }
00105
00106 void InfoBadgeProperties::TemplateSettings(winrt::InfoBadgeTemplateSettings const& value)
00107 {
00108     [[gsl::suppress(con)]]
00109     {
00110     static_cast<InfoBadge*>(this)->SetValue(s_TemplateSettingsProperty, ValueHelper<winrt::InfoBadgeTemplateSettings>::BoxValueIfNecessary(value));
00111     }
00112 }
00113
00114 winrt::InfoBadgeTemplateSettings InfoBadgeProperties::TemplateSettings()
00115 {
00116     return ValueHelper<winrt::InfoBadgeTemplateSettings>::CastOrUnbox(static_cast<InfoBadge*>(this)->GetValue(s_TemplateSettingsProperty));
00117 }
00118
00119 void InfoBadgeProperties::Value(int value)
00120 {
00121     [[gsl::suppress(con)]]
00122     {
00123     static_cast<InfoBadge*>(this)->SetValue(s_ValueProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00124     }
00125 }
00126
00127 int InfoBadgeProperties::Value()
00128 {
00129     return ValueHelper<int>::CastOrUnbox(static_cast<InfoBadge*>(this)->GetValue(s_ValueProperty));
00130 }
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MapControl/MapControlMapServiceErrorOccurredEventArgs.cpp Source File

  • MapControl

MapControlMapServiceErrorOccurredEventArgs.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MapControlMapServiceErrorOccurredEventArgs.h"
00007 #include "RuntimeProfiler.h"
00008 #include "ResourceAccessor.h"
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ParallaxView/TestUI/DynamicPage.xaml.cs Source File

  • ParallaxView
  • TestUI

DynamicPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using Windows.Foundation;
00007 using Windows.UI;
00008 using Microsoft.UI.Xaml.Automation;
00009 using Microsoft.UI.Xaml.Media;
00010 using Microsoft.UI.Xaml.Shapes;
00011 using Microsoft.UI.Composition;
00012 using Microsoft.UI.Xaml;
00013 using Microsoft.UI.Xaml.Controls;
00014 using Microsoft.UI.Xaml.Controls.Primitives;
00015 using Microsoft.UI.Xaml.Hosting;
00016
00017 namespace MUXControlsTestApp
00018 {
00019     public sealed partial class DynamicPage : TestPage
00020     {
00021         ScrollPresenter scrollPresenter = null;
00022         Rectangle rectSC = null;
00023
00024         public DynamicPage()
00025         {
00026             this.InitializeComponent();
00027
00028             this.ParallaxView = this.parallaxView;
00029             this.ScrollViewer = null;
00030             this.ScrollPresenter = null;
00031             SetupScrollPresenter();
00032             this.TargetElement = null;
00033             this.DynamicParallaxView = null;
00034             this.AnimatedValuesSpy = null;
00035             this.HorizontalOffsetAnimation = null;
00036             this.VerticalOffsetAnimation = null;
00037             this.HasDirectManipulation = false;
00038             this.UIThreadTicksForValuesSpy = 0;
00039             this.IsRenderingHooked = false;
00040
00041             this.chkIsRTL.IsChecked = (this.spInner.FlowDirection == FlowDirection.RightToLeft);
00042
00043             this.chkAreHorizontalSourceOffsetsRelative.IsChecked = this.parallaxView.HorizontalSourceOffsetKind == ParallaxSourceOffsetKind.Relative;
00044             this.chkAreVerticalSourceOffsetsRelative.IsChecked = this.parallaxView.VerticalSourceOffsetKind == ParallaxSourceOffsetKind.Relative;
00045             this.chkIsHorizontalShiftClamped.IsChecked = this.parallaxView.IsHorizontalShiftClamped;
00046             this.chkIsVerticalShiftClamped.IsChecked = this.parallaxView.IsVerticalShiftClamped;
00047
00048             btnGetHorizontalShift_Click(null, null);
00049             btnGetMaxHorizontalShiftRatio_Click(null, null);
00050             btnGetHorizontalSourceStartOffset_Click(null, null);
00051             btnGetHorizontalSourceEndOffset_Click(null, null);
00052
00053             btnGetVerticalShift_Click(null, null);
00054             btnGetMaxVerticalShiftRatio_Click(null, null);
00055             btnGetVerticalSourceStartOffset_Click(null, null);
00056             btnGetVerticalSourceEndOffset_Click(null, null);
00057         }
00058
00059         private ParallaxView ParallaxView
00060         {
00061             get;
00062             set;
00063         }
00064
00065         private ParallaxView DynamicParallaxView
00066         {
00067             get;
00068             set;
00069         }
00070
00071         private ScrollViewer ScrollViewer
00072         {
00073             get;
00074             set;
00075         }
00076
00077         private ScrollPresenter ScrollPresenter
00078         {
00079             get;
00080             set;
00081         }
00082
00083         private FrameworkElement TargetElement
00084         {
00085             get;
00086             set;
00087         }
00088
00089         private CompositionPropertySet AnimatedValuesSpy
00090         {
00091             get;
00092             set;
00093         }
00094
00095         private ExpressionAnimation HorizontalOffsetAnimation
00096         {
00097             get;
00098             set;
00099         }
00100
00101         private ExpressionAnimation VerticalOffsetAnimation
00102         {
00103             get;
00104             set;
00105         }
00106
00107         private bool HasDirectManipulation
00108         {
00109             get;
00110             set;
00111         }
00112
00113         private bool IsRenderingHooked
00114         {
00115             get;
00116             set;
00117         }
00118
00119         private uint UIThreadTicksForValuesSpy
00120         {
00121             get;
00122             set;
00123         }
00124
00125         private void SetupAnimatedValuesSpy()
00126         {
00127             StopAnimatedValuesSpy();
00128
00129             this.AnimatedValuesSpy = null;
00130             this.HorizontalOffsetAnimation = null;
00131             this.VerticalOffsetAnimation = null;
00132
00133             if (this.ParallaxView != null && this.ParallaxView.Child is UIElement &&
00134                 (this.ParallaxView.HorizontalShift != 0 || this.ParallaxView.VerticalShift != 0))
00135             {
00136                 string visualHorizontalTargetedPropertyName = "visual.Translation.X";
00137                 string visualVerticalTargetedPropertyName = "visual.Translation.Y";
00138
00139                 UIElement ppChild = this.ParallaxView.Child as UIElement;
00140                 Visual visualPPChild = ElementCompositionPreview.GetElementVisual(ppChild);
00141
00142                 Compositor compositor = visualPPChild.Compositor;
00143
00144                 this.AnimatedValuesSpy = compositor.CreatePropertySet();
00145                 this.AnimatedValuesSpy.InsertScalar("HorizontalOffset", 0.0f);
00146                 this.AnimatedValuesSpy.InsertScalar("VerticalOffset", 0.0f);
00147
00148                 this.HorizontalOffsetAnimation = compositor.CreateExpressionAnimation(visualHorizontalTargetedPropertyName);
00149                 this.VerticalOffsetAnimation = compositor.CreateExpressionAnimation(visualVerticalTargetedPropertyName);
00150
00151                 this.HorizontalOffsetAnimation.SetReferenceParameter("visual", visualPPChild);
00152                 this.VerticalOffsetAnimation.SetReferenceParameter("visual", visualPPChild);
00153
00154                 CheckSpyingTicksRequirement();
00155
00156                 TickForValuesSpy();
00157             }
00158             else
00159             {
00160                 ResetSpyOutput();
00161             }
00162         }
00163
00164         private void StartAnimatedValuesSpy()
00165         {
00166             if (this.AnimatedValuesSpy != null)
00167             {
00168                 this.AnimatedValuesSpy.StartAnimation("HorizontalOffset", this.HorizontalOffsetAnimation);
00169                 this.AnimatedValuesSpy.StartAnimation("VerticalOffset", this.VerticalOffsetAnimation);
00170             }
00171         }
00172
00173         private void StopAnimatedValuesSpy()
00174         {
00175             if (this.AnimatedValuesSpy != null)
00176             {
00177                 this.AnimatedValuesSpy.StopAnimation("HorizontalOffset");
00178                 this.AnimatedValuesSpy.StopAnimation("VerticalOffset");
00179             }
00180         }
00181
00182         private void SpyAnimatedValues()
00183         {
00184             if (this.AnimatedValuesSpy != null)
00185             {
00186                 StopAnimatedValuesSpy();
00187
00188                 float offset = 0.0f;
00189                 CompositionGetValueStatus status = this.AnimatedValuesSpy.TryGetScalar("HorizontalOffset", out offset);
00190                 if (CompositionGetValueStatus.Succeeded == status)
00191                 {
00192                     this.tbHorizontalOutput.Text = offset.ToString();
00193                 }
00194                 else
00195                 {
00196                     this.tbHorizontalOutput.Text = "status=" + status.ToString();
00197                 }
00198
00199                 status = this.AnimatedValuesSpy.TryGetScalar("VerticalOffset", out offset);
00200                 if (CompositionGetValueStatus.Succeeded == status)
00201                 {
00202                     this.tbVerticalOutput.Text = offset.ToString();
00203                 }
00204                 else
00205                 {
00206                     this.tbVerticalOutput.Text = "status=" + status.ToString();
00207                 }
00208
00209                 StartAnimatedValuesSpy();
00210
00211                 System.Diagnostics.Debug.WriteLine("Spied values: " + this.tbHorizontalOutput.Text + ", " + this.tbVerticalOutput.Text);
00212             }
00213         }
00214
00215         private void ResetSpyOutput()
00216         {
00217             this.tbHorizontalOutput.Text = "0";
00218             this.tbVerticalOutput.Text = "0";
00219         }
00220
00221         private void RefreshContentAlignments()
00222         {
00223             if (this.ScrollViewer != null)
00224             {
00225                 this.cmbHorizontalContentAlignment.SelectedIndex = (int)this.ScrollViewer.HorizontalContentAlignment;
00226                 this.cmbVerticalContentAlignment.SelectedIndex = (int)this.ScrollViewer.VerticalContentAlignment;
00227             }
00228         }
00229
00230         private void cmbHorizontalContentAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e)
00231         {
00232             if (this.ScrollViewer != null)
00233             {
00234                 this.ScrollViewer.HorizontalContentAlignment = (HorizontalAlignment)this.cmbHorizontalContentAlignment.SelectedIndex;
00235             }
00236         }
00237
00238         private void cmbVerticalContentAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e)
00239         {
00240             if (this.ScrollViewer != null)
00241             {
00242                 this.ScrollViewer.VerticalContentAlignment = (VerticalAlignment)this.cmbVerticalContentAlignment.SelectedIndex;
00243             }
00244         }
00245
00246         private void RefreshSourceContent()
00247         {
00248             if (
00249                 (this.ScrollPresenter != null && this.ScrollPresenter.Content != null) ||
00250                 (this.ScrollViewer != null && this.ScrollViewer.Content != null))
00251             {
00252                 this.cmbSourceContent.SelectedIndex = 1;
00253             }
00254             else
00255             {
00256                 this.cmbSourceContent.SelectedIndex = 0;
00257             }
00258         }
00259
00260         private void cmbSourceContent_SelectionChanged(object sender, SelectionChangedEventArgs e)
00261         {
00262             if (this.ScrollViewer != null)
00263             {
00264                 switch (this.cmbSourceContent.SelectedIndex)
00265                 {
00266                     case 0:
00267                         this.ScrollViewer.Content = null;
00268                         break;
00269                     case 1:
00270                         if (this.ScrollViewer == this.scrollViewer)
00271                             this.ScrollViewer.Content = this.spSV;
00272                         break;
00273                 }
00274             }
00275
00276             if (this.ScrollPresenter != null)
00277             {
00278                 switch (this.cmbSourceContent.SelectedIndex)
00279                 {
00280                     case 0:
00281                         this.ScrollPresenter.Content = null;
00282                         break;
00283                     case 1:
00284                         if (this.ScrollPresenter == this.scrollPresenter)
00285                             this.ScrollPresenter.Content = this.rectSC;
00286                         break;
00287                 }
00288             }
00289         }
00290
00291         private void RefreshSVCAlignments()
00292         {
00293             FrameworkElement feSourceContent = null;
00294
00295             if (this.ScrollViewer != null && this.ScrollViewer.Content is FrameworkElement)
00296             {
00297                 feSourceContent = this.ScrollViewer.Content as FrameworkElement;
00298             }
00299             else if (this.ScrollPresenter != null && this.ScrollPresenter.Content is FrameworkElement)
00300             {
00301                 feSourceContent = this.ScrollPresenter.Content as FrameworkElement;
00302             }
00303
00304             if (feSourceContent != null)
00305             {
00306                 this.cmbSCHorizontalAlignment.SelectedIndex = (int)feSourceContent.HorizontalAlignment;
00307                 this.cmbSCVerticalAlignment.SelectedIndex = (int)feSourceContent.VerticalAlignment;
00308             }
00309         }
00310
00311         private void cmbSCHorizontalAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e)
00312         {
00313             FrameworkElement feSourceContent = null;
00314
00315             if (this.ScrollViewer != null && this.ScrollViewer.Content is FrameworkElement)
00316             {
00317                 feSourceContent = this.ScrollViewer.Content as FrameworkElement;
00318             }
00319             else if (this.ScrollPresenter != null && this.ScrollPresenter.Content is FrameworkElement)
00320             {
00321                 feSourceContent = this.ScrollPresenter.Content as FrameworkElement;
00322             }
00323
00324             if (feSourceContent != null)
00325             {
00326                 feSourceContent.HorizontalAlignment = (HorizontalAlignment)this.cmbSCHorizontalAlignment.SelectedIndex;
00327             }
00328         }
00329
00330         private void cmbSCVerticalAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e)
00331         {
00332             FrameworkElement feSourceContent = null;
00333
00334             if (this.ScrollViewer != null && this.ScrollViewer.Content is FrameworkElement)
00335             {
00336                 feSourceContent = this.ScrollViewer.Content as FrameworkElement;
00337             }
00338             else if (this.ScrollPresenter != null && this.ScrollPresenter.Content is FrameworkElement)
00339             {
00340                 feSourceContent = this.ScrollPresenter.Content as FrameworkElement;
00341             }
00342
00343             if (feSourceContent != null)
00344             {
00345                 feSourceContent.VerticalAlignment = (VerticalAlignment)this.cmbSCVerticalAlignment.SelectedIndex;
00346             }
00347         }
00348
00349         private void RefreshSourceContentSizes()
00350         {
00351             btnGetSCWidth_Click(null, null);
00352             btnGetSCHeight_Click(null, null);
00353         }
00354
00355         private void btnGetSCWidth_Click(object sender, RoutedEventArgs e)
00356         {
00357             FrameworkElement feSourceContent = null;
00358
00359             if (this.ScrollViewer != null && this.ScrollViewer.Content is FrameworkElement)
00360             {
00361                 feSourceContent = this.ScrollViewer.Content as FrameworkElement;
00362             }
00363             else if (this.ScrollPresenter != null && this.ScrollPresenter.Content is FrameworkElement)
00364             {
00365                 feSourceContent = this.ScrollPresenter.Content as FrameworkElement;
00366             }
00367
00368             if (feSourceContent != null)
00369             {
00370                 this.txtSCWidth.Text = feSourceContent.Width.ToString();
00371             }
00372         }
00373
00374         private void btnSetSCWidth_Click(object sender, RoutedEventArgs e)
00375         {
00376             try
00377             {
00378                 FrameworkElement feSourceContent = null;
00379
00380                 if (this.ScrollViewer != null && this.ScrollViewer.Content is FrameworkElement)
00381                 {
00382                     feSourceContent = this.ScrollViewer.Content as FrameworkElement;
00383                 }
00384                 else if (this.ScrollPresenter != null && this.ScrollPresenter.Content is FrameworkElement)
00385                 {
00386                     feSourceContent = this.ScrollPresenter.Content as FrameworkElement;
00387                 }
00388
00389                 if (feSourceContent != null)
00390                 {
00391                     feSourceContent.Width = Convert.ToDouble(this.txtSCWidth.Text);
00392                 }
00393             }
00394             catch (FormatException)
00395             {
00396             }
00397         }
00398
00399         private void btnGetSCHeight_Click(object sender, RoutedEventArgs e)
00400         {
00401             FrameworkElement feSourceContent = null;
00402
00403             if (this.ScrollViewer != null && this.ScrollViewer.Content is FrameworkElement)
00404             {
00405                 feSourceContent = this.ScrollViewer.Content as FrameworkElement;
00406             }
00407             else if (this.ScrollPresenter != null && this.ScrollPresenter.Content is FrameworkElement)
00408             {
00409                 feSourceContent = this.ScrollPresenter.Content as FrameworkElement;
00410             }
00411
00412             if (feSourceContent != null)
00413             {
00414                 this.txtSCHeight.Text = feSourceContent.Height.ToString();
00415             }
00416         }
00417
00418         private void btnSetSCHeight_Click(object sender, RoutedEventArgs e)
00419         {
00420             try
00421             {
00422                 FrameworkElement feSourceContent = null;
00423
00424                 if (this.ScrollViewer != null && this.ScrollViewer.Content is FrameworkElement)
00425                 {
00426                     feSourceContent = this.ScrollViewer.Content as FrameworkElement;
00427                 }
00428                 else if (this.ScrollPresenter != null && this.ScrollPresenter.Content is FrameworkElement)
00429                 {
00430                     feSourceContent = this.ScrollPresenter.Content as FrameworkElement;
00431                 }
00432
00433                 if (feSourceContent != null)
00434                 {
00435                     feSourceContent.Height = Convert.ToDouble(this.txtSCHeight.Text);
00436                 }
00437             }
00438             catch (FormatException)
00439             {
00440             }
00441         }
00442
00443         private void RefreshTEAlignments()
00444         {
00445             this.cmbTEHorizontalAlignment.SelectedIndex = (int)this.TargetElement.HorizontalAlignment;
00446             this.cmbTEVerticalAlignment.SelectedIndex = (int)this.TargetElement.VerticalAlignment;
00447         }
00448
00449         private void RefreshTESizes()
00450         {
00451             btnGetTEWidth_Click(null, null);
00452             btnGetTEHeight_Click(null, null);
00453             btnGetTEMaxWidth_Click(null, null);
00454             btnGetTEMaxHeight_Click(null, null);
00455             btnGetTEActualWidth_Click(null, null);
00456             btnGetTEActualHeight_Click(null, null);
00457             btnGetTEMargin_Click(null, null);
00458         }
00459
00460         private void cmbTEHorizontalAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e)
00461         {
00462             if (this.TargetElement != null)
00463             {
00464                 this.TargetElement.HorizontalAlignment = (HorizontalAlignment)this.cmbTEHorizontalAlignment.SelectedIndex;
00465             }
00466
00467             this.refImg.HorizontalAlignment = (HorizontalAlignment)this.cmbTEHorizontalAlignment.SelectedIndex;
00468         }
00469
00470         private void cmbTEVerticalAlignment_SelectionChanged(object sender, SelectionChangedEventArgs e)
00471         {
00472             if (this.TargetElement != null)
00473             {
00474                 this.TargetElement.VerticalAlignment = (VerticalAlignment)this.cmbTEVerticalAlignment.SelectedIndex;
00475             }
00476
00477             this.refImg.VerticalAlignment = (VerticalAlignment)this.cmbTEVerticalAlignment.SelectedIndex;
00478         }
00479
00480         private void btnGetTEWidth_Click(object sender, RoutedEventArgs e)
00481         {
00482             if (this.TargetElement is FrameworkElement)
00483             {
00484                 this.txtTEWidth.Text = (this.TargetElement as FrameworkElement).Width.ToString();
00485             }
00486         }
00487
00488         private void btnSetTEWidth_Click(object sender, RoutedEventArgs e)
00489         {
00490             try
00491             {
00492                 if (this.TargetElement is FrameworkElement)
00493                 {
00494                     (this.TargetElement as FrameworkElement).Width = Convert.ToDouble(this.txtTEWidth.Text);
00495                 }
00496
00497                 this.refImg.Width = Convert.ToDouble(this.txtTEWidth.Text);
00498             }
00499             catch (FormatException)
00500             {
00501             }
00502         }
00503
00504         private void btnGetTEHeight_Click(object sender, RoutedEventArgs e)
00505         {
00506             if (this.TargetElement is FrameworkElement)
00507             {
00508                 this.txtTEHeight.Text = (this.TargetElement as FrameworkElement).Height.ToString();
00509             }
00510         }
00511
00512         private void btnSetTEHeight_Click(object sender, RoutedEventArgs e)
00513         {
00514             try
00515             {
00516                 if (this.TargetElement is FrameworkElement)
00517                 {
00518                     (this.TargetElement as FrameworkElement).Height = Convert.ToDouble(this.txtTEHeight.Text);
00519                 }
00520
00521                 this.refImg.Height = Convert.ToDouble(this.txtTEHeight.Text);
00522             }
00523             catch (FormatException)
00524             {
00525             }
00526         }
00527
00528         private void btnGetTEMaxWidth_Click(object sender, RoutedEventArgs e)
00529         {
00530             if (this.TargetElement is FrameworkElement)
00531             {
00532                 this.txtTEMaxWidth.Text = (this.TargetElement as FrameworkElement).MaxWidth.ToString();
00533             }
00534         }
00535
00536         private void btnSetTEMaxWidth_Click(object sender, RoutedEventArgs e)
00537         {
00538             try
00539             {
00540                 if (this.TargetElement is FrameworkElement)
00541                 {
00542                     (this.TargetElement as FrameworkElement).MaxWidth = Convert.ToDouble(this.txtTEMaxWidth.Text);
00543                 }
00544
00545                 this.refImg.MaxWidth = Convert.ToDouble(this.txtTEMaxWidth.Text);
00546             }
00547             catch (FormatException)
00548             {
00549             }
00550         }
00551
00552         private void btnGetTEMaxHeight_Click(object sender, RoutedEventArgs e)
00553         {
00554             if (this.TargetElement is FrameworkElement)
00555             {
00556                 this.txtTEMaxHeight.Text = (this.TargetElement as FrameworkElement).MaxHeight.ToString();
00557             }
00558         }
00559
00560         private void btnSetTEMaxHeight_Click(object sender, RoutedEventArgs e)
00561         {
00562             try
00563             {
00564                 if (this.TargetElement is FrameworkElement)
00565                 {
00566                     (this.TargetElement as FrameworkElement).MaxHeight = Convert.ToDouble(this.txtTEMaxHeight.Text);
00567                 }
00568
00569                 this.refImg.MaxHeight = Convert.ToDouble(this.txtTEMaxHeight.Text);
00570             }
00571             catch (FormatException)
00572             {
00573             }
00574         }
00575
00576         private void btnGetTEActualWidth_Click(object sender, RoutedEventArgs e)
00577         {
00578             if (this.TargetElement is FrameworkElement)
00579             {
00580                 this.txtTEActualWidth.Text = (this.TargetElement as FrameworkElement).ActualWidth.ToString();
00581             }
00582         }
00583
00584         private void btnGetTEActualHeight_Click(object sender, RoutedEventArgs e)
00585         {
00586             if (this.TargetElement is FrameworkElement)
00587             {
00588                 this.txtTEActualHeight.Text = (this.TargetElement as FrameworkElement).ActualHeight.ToString();
00589             }
00590         }
00591
00592         private void btnGetTEMargin_Click(object sender, RoutedEventArgs e)
00593         {
00594             if (this.TargetElement != null)
00595             {
00596                 this.txtTEMarginLeft.Text = this.TargetElement.Margin.Left.ToString();
00597                 this.txtTEMarginTop.Text = this.TargetElement.Margin.Top.ToString();
00598                 this.txtTEMarginRight.Text = this.TargetElement.Margin.Right.ToString();
00599                 this.txtTEMarginBottom.Text = this.TargetElement.Margin.Bottom.ToString();
00600             }
00601         }
00602
00603         private void btnSetTEMargin_Click(object sender, RoutedEventArgs e)
00604         {
00605             if (this.TargetElement != null)
00606             {
00607                 try
00608                 {
00609                     this.TargetElement.Margin = new Thickness(
00610                         Convert.ToDouble(this.txtTEMarginLeft.Text),
00611                         Convert.ToDouble(this.txtTEMarginTop.Text),
00612                         Convert.ToDouble(this.txtTEMarginRight.Text),
00613                         Convert.ToDouble(this.txtTEMarginBottom.Text));
00614                 }
00615                 catch (FormatException)
00616                 {
00617                 }
00618             }
00619         }
00620
00621         private void RefreshHorizontalScrollMode()
00622         {
00623             if (this.ScrollViewer != null)
00624             {
00625                 this.cmbHorizontalScrollMode.SelectedIndex = (int)this.ScrollViewer.HorizontalScrollMode;
00626             }
00627             else if (this.ScrollPresenter != null)
00628             {
00629                 switch (this.ScrollPresenter.HorizontalScrollMode)
00630                 {
00631                     case ScrollingScrollMode.Disabled:
00632                         this.cmbHorizontalScrollMode.SelectedIndex = 0;
00633                         break;
00634                     case ScrollingScrollMode.Enabled:
00635                         this.cmbHorizontalScrollMode.SelectedIndex = 1;
00636                         break;
00637                     case ScrollingScrollMode.Auto:
00638                         this.cmbHorizontalScrollMode.SelectedIndex = 2;
00639                         break;
00640                 }
00641             }
00642             else
00643             {
00644                 this.cmbHorizontalScrollMode.SelectedIndex = 0;
00645             }
00646         }
00647
00648         private void cmbHorizontalScrollMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
00649         {
00650             if (this.ScrollViewer != null)
00651             {
00652                 this.ScrollViewer.HorizontalScrollMode = (Microsoft.UI.Xaml.Controls.ScrollMode)this.cmbHorizontalScrollMode.SelectedIndex;
00653             }
00654             else if (this.ScrollPresenter != null)
00655             {
00656                 switch (this.cmbHorizontalScrollMode.SelectedIndex)
00657                 {
00658                     case 0:
00659                         this.ScrollPresenter.HorizontalScrollMode = ScrollingScrollMode.Disabled;
00660                         break;
00661                     case 1:
00662                         this.ScrollPresenter.HorizontalScrollMode = ScrollingScrollMode.Enabled;
00663                         break;
00664                     case 2:
00665                         this.ScrollPresenter.HorizontalScrollMode = ScrollingScrollMode.Auto;
00666                         break;
00667                 }
00668             }
00669         }
00670
00671         private void RefreshVerticalScrollMode()
00672         {
00673             if (this.ScrollViewer != null)
00674             {
00675                 this.cmbVerticalScrollMode.SelectedIndex = (int)this.ScrollViewer.VerticalScrollMode;
00676             }
00677             else if (this.ScrollPresenter != null)
00678             {
00679                 switch (this.ScrollPresenter.VerticalScrollMode)
00680                 {
00681                     case ScrollingScrollMode.Disabled:
00682                         this.cmbVerticalScrollMode.SelectedIndex = 0;
00683                         break;
00684                     case ScrollingScrollMode.Enabled:
00685                         this.cmbVerticalScrollMode.SelectedIndex = 1;
00686                         break;
00687                     case ScrollingScrollMode.Auto:
00688                         this.cmbVerticalScrollMode.SelectedIndex = 2;
00689                         break;
00690                 }
00691             }
00692             else
00693             {
00694                 this.cmbVerticalScrollMode.SelectedIndex = 0;
00695             }
00696         }
00697
00698         private void cmbVerticalScrollMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
00699         {
00700             if (this.ScrollViewer != null)
00701             {
00702                 this.ScrollViewer.VerticalScrollMode = (Microsoft.UI.Xaml.Controls.ScrollMode)this.cmbVerticalScrollMode.SelectedIndex;
00703             }
00704             else if (this.ScrollPresenter != null)
00705             {
00706                 switch (this.cmbVerticalScrollMode.SelectedIndex)
00707                 {
00708                     case 0:
00709                         this.ScrollPresenter.VerticalScrollMode = ScrollingScrollMode.Disabled;
00710                         break;
00711                     case 1:
00712                         this.ScrollPresenter.VerticalScrollMode = ScrollingScrollMode.Enabled;
00713                         break;
00714                     case 2:
00715                         this.ScrollPresenter.VerticalScrollMode = ScrollingScrollMode.Auto;
00716                         break;
00717                 }
00718             }
00719         }
00720
00721         private void RefreshZoomMode()
00722         {
00723             if (this.ScrollViewer != null)
00724             {
00725                 this.cmbZoomMode.SelectedIndex = (int)this.ScrollViewer.ZoomMode;
00726             }
00727             else if (this.ScrollPresenter != null)
00728             {
00729                 switch (this.ScrollPresenter.ZoomMode)
00730                 {
00731                     case ScrollingZoomMode.Disabled:
00732                         this.cmbZoomMode.SelectedIndex = 0;
00733                         break;
00734                     case ScrollingZoomMode.Enabled:
00735                         this.cmbZoomMode.SelectedIndex = 1;
00736                         break;
00737                 }
00738             }
00739             else
00740             {
00741                 this.cmbZoomMode.SelectedIndex = 0;
00742             }
00743         }
00744
00745         private void cmbZoomMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
00746         {
00747             if (this.ScrollViewer != null)
00748             {
00749                 this.ScrollViewer.ZoomMode = (Microsoft.UI.Xaml.Controls.ZoomMode)this.cmbZoomMode.SelectedIndex;
00750             }
00751             else if (this.ScrollPresenter != null)
00752             {
00753                 switch (this.cmbZoomMode.SelectedIndex)
00754                 {
00755                     case 0:
00756                         this.ScrollPresenter.ZoomMode = ScrollingZoomMode.Disabled;
00757                         break;
00758                     case 1:
00759                         this.ScrollPresenter.ZoomMode = ScrollingZoomMode.Enabled;
00760                         break;
00761                 }
00762             }
00763         }
00764
00765         private void cmbSource_SelectionChanged(object sender, SelectionChangedEventArgs e)
00766         {
00767             if (this.ParallaxView != null)
00768             {
00769                 if (this.ScrollViewer != null)
00770                 {
00771                     this.ScrollViewer.ViewChanged -= ScrollViewer_ViewChanged;
00772                     this.ScrollViewer.DirectManipulationStarted -= ScrollViewer_DirectManipulationStarted;
00773                     this.ScrollViewer.DirectManipulationCompleted -= ScrollViewer_DirectManipulationCompleted;
00774                 }
00775                 else if (this.ScrollPresenter != null)
00776                 {
00777                     this.ScrollPresenter.ViewChanged -= ScrollPresenter_ViewChanged;
00778                 }
00779                 switch (this.cmbSource.SelectedIndex)
00780                 {
00781                     case 0:
00782                         this.ParallaxView.Source = null;
00783                         this.ScrollViewer = null;
00784                         this.ScrollPresenter = null;
00785                         break;
00786                     case 1:
00787                         this.ParallaxView.Source = this.scrollViewer;
00788                         this.ScrollViewer = this.scrollViewer;
00789                         this.ScrollPresenter = null;
00790                         if (this.cmbSourceContent.Items.Count > 1)
00791                             this.cmbSourceContent.Items.RemoveAt(1);
00792                         this.cmbSourceContent.Items.Add("stackPanel");
00793                         RefreshSourceContent();
00794                         RefreshSourceContentSizes();
00795                         RefreshSVCAlignments();
00796                         RefreshContentAlignments();
00797                         RefreshHorizontalScrollMode();
00798                         RefreshVerticalScrollMode();
00799                         RefreshZoomMode();
00800                         btnGetHorizontalOffset_Click(null, null);
00801                         btnGetVerticalOffset_Click(null, null);
00802                         btnGetZoomFactor_Click(null, null);
00803                         break;
00804                     case 2:
00805                         this.ParallaxView.Source = this.scrollPresenter;
00806                         this.ScrollPresenter = this.scrollPresenter;
00807                         this.ScrollViewer = null;
00808                         if (this.cmbSourceContent.Items.Count > 1)
00809                             this.cmbSourceContent.Items.RemoveAt(1);
00810                         this.cmbSourceContent.Items.Add("rectangle");
00811                         RefreshSourceContent();
00812                         RefreshSourceContentSizes();
00813                         RefreshSVCAlignments();
00814                         RefreshContentAlignments();
00815                         RefreshHorizontalScrollMode();
00816                         RefreshVerticalScrollMode();
00817                         RefreshZoomMode();
00818                         btnGetHorizontalOffset_Click(null, null);
00819                         btnGetVerticalOffset_Click(null, null);
00820                         btnGetZoomFactor_Click(null, null);
00821                         break;
00822                 }
00823
00824                 SetupAnimatedValuesSpy();
00825
00826                 if (this.ScrollViewer != null)
00827                 {
00828                     this.ScrollViewer.ViewChanged += ScrollViewer_ViewChanged;
00829                     this.ScrollViewer.DirectManipulationStarted += ScrollViewer_DirectManipulationStarted;
00830                     this.ScrollViewer.DirectManipulationCompleted += ScrollViewer_DirectManipulationCompleted;
00831                 }
00832                 else if (this.ScrollPresenter != null)
00833                 {
00834                     this.ScrollPresenter.ViewChanged += ScrollPresenter_ViewChanged;
00835                 }
00836             }
00837         }
00838
00839         private void ScrollViewer_DirectManipulationCompleted(object sender, object e)
00840         {
00841             TickForValuesSpy();
00842             this.HasDirectManipulation = false;
00843         }
00844
00845         private void ScrollViewer_DirectManipulationStarted(object sender, object e)
00846         {
00847             this.HasDirectManipulation = true;
00848             CheckSpyingTicksRequirement();
00849         }
00850
00851         private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
00852         {
00853             CheckSpyingTicksRequirement();
00854             SpyAnimatedValues();
00855         }
00856
00857         private void ScrollPresenter_ViewChanged(ScrollPresenter sender, object args)
00858         {
00859             SpyAnimatedValues();
00860         }
00861
00862         private void TickForValuesSpy()
00863         {
00864             this.UIThreadTicksForValuesSpy = 6;
00865             CheckSpyingTicksRequirement();
00866         }
00867
00868         private void CheckSpyingTicksRequirement()
00869         {
00870             if (this.ScrollViewer != null &&
00871                 (this.HasDirectManipulation || this.UIThreadTicksForValuesSpy > 0) &&
00872                 this.AnimatedValuesSpy != null &&
00873                 (this.ScrollViewer.HorizontalOffset == 0 || this.ScrollViewer.VerticalOffset == 0 ||
00874                  this.ScrollViewer.HorizontalOffset == this.ScrollViewer.ScrollableWidth || this.ScrollViewer.VerticalOffset == this.ScrollViewer.ScrollableHeight))
00875             {
00876                 if (!this.IsRenderingHooked)
00877                 {
00878                     this.IsRenderingHooked = true;
00879                     Microsoft.UI.Xaml.Media.CompositionTarget.Rendering += CompositionTarget_Rendering;
00880                 }
00881             }
00882             else
00883             {
00884                 if (this.IsRenderingHooked)
00885                 {
00886                     Microsoft.UI.Xaml.Media.CompositionTarget.Rendering -= CompositionTarget_Rendering;
00887                     this.IsRenderingHooked = false;
00888                 }
00889             }
00890         }
00891
00892         private void CompositionTarget_Rendering(object sender, object e)
00893         {
00894             if (this.UIThreadTicksForValuesSpy > 0)
00895             {
00896                 this.UIThreadTicksForValuesSpy--;
00897             }
00898             CheckSpyingTicksRequirement();
00899             SpyAnimatedValues();
00900         }
00901
00902         private void cmbTargetElement_SelectionChanged(object sender, SelectionChangedEventArgs e)
00903         {
00904             if (this.ParallaxView != null)
00905             {
00906                 switch (this.cmbTargetElement.SelectedIndex)
00907                 {
00908                     case 0:
00909                         this.ParallaxView.Child = null;
00910                         this.TargetElement = null;
00911                         break;
00912                     case 1:
00913                     case 2:
00914                     case 3:
00915                         FrameworkElement targetFE = null;
00916
00917                         if (this.cmbTargetElement.SelectedIndex == 1)
00918                             targetFE = this.border;
00919                         else if (this.cmbTargetElement.SelectedIndex == 2)
00920                             targetFE = this.img;
00921                         else
00922                             targetFE = this.rect;
00923
00924                         if (targetFE.Parent != null)
00925                             (targetFE.Parent as Panel).Children.Remove(targetFE);
00926                         targetFE.Visibility = Visibility.Visible;
00927                         this.ParallaxView.Child = targetFE;
00928                         this.TargetElement = targetFE;
00929                         RefreshTEAlignments();
00930                         RefreshTESizes();
00931                         break;
00932                 }
00933
00934                 SetupAnimatedValuesSpy();
00935             }
00936         }
00937
00938         private void btnGetWidth_Click(object sender, RoutedEventArgs e)
00939         {
00940             this.txtWidth.Text = this.ParallaxView.Width.ToString();
00941         }
00942
00943         private void btnSetWidth_Click(object sender, RoutedEventArgs e)
00944         {
00945             try
00946             {
00947                 this.ParallaxView.Width = Convert.ToDouble(this.txtWidth.Text);
00948             }
00949             catch (FormatException)
00950             {
00951             }
00952         }
00953
00954         private void btnGetHorizontalShift_Click(object sender, RoutedEventArgs e)
00955         {
00956             this.txtHorizontalShift.Text = this.ParallaxView.HorizontalShift.ToString();
00957         }
00958
00959         private void btnSetHorizontalShift_Click(object sender, RoutedEventArgs e)
00960         {
00961             try
00962             {
00963                 this.ParallaxView.HorizontalShift = Convert.ToDouble(this.txtHorizontalShift.Text);
00964                 SetupAnimatedValuesSpy();
00965             }
00966             catch (FormatException)
00967             {
00968             }
00969         }
00970
00971         private void btnGetMaxHorizontalShiftRatio_Click(object sender, RoutedEventArgs e)
00972         {
00973             this.txtMaxHorizontalShiftRatio.Text = this.ParallaxView.MaxHorizontalShiftRatio.ToString();
00974         }
00975
00976         private void btnSetMaxHorizontalShiftRatio_Click(object sender, RoutedEventArgs e)
00977         {
00978             try
00979             {
00980                 this.ParallaxView.MaxHorizontalShiftRatio = Convert.ToDouble(this.txtMaxHorizontalShiftRatio.Text);
00981                 TickForValuesSpy();
00982             }
00983             catch (FormatException)
00984             {
00985             }
00986         }
00987
00988         private void btnGetHorizontalSourceStartOffset_Click(object sender, RoutedEventArgs e)
00989         {
00990             this.txtHorizontalSourceStartOffset.Text = this.ParallaxView.HorizontalSourceStartOffset.ToString();
00991         }
00992
00993         private void btnSetHorizontalSourceStartOffset_Click(object sender, RoutedEventArgs e)
00994         {
00995             try
00996             {
00997                 this.ParallaxView.HorizontalSourceStartOffset = Convert.ToDouble(this.txtHorizontalSourceStartOffset.Text);
00998                 TickForValuesSpy();
00999             }
01000             catch (FormatException)
01001             {
01002             }
01003         }
01004
01005         private void btnGetHorizontalSourceEndOffset_Click(object sender, RoutedEventArgs e)
01006         {
01007             this.txtHorizontalSourceEndOffset.Text = this.ParallaxView.HorizontalSourceEndOffset.ToString();
01008         }
01009
01010         private void btnSetHorizontalSourceEndOffset_Click(object sender, RoutedEventArgs e)
01011         {
01012             try
01013             {
01014                 this.ParallaxView.HorizontalSourceEndOffset = Convert.ToDouble(this.txtHorizontalSourceEndOffset.Text);
01015                 TickForValuesSpy();
01016             }
01017             catch (FormatException)
01018             {
01019             }
01020         }
01021
01022         private void chkIsRTL_Unchecked(object sender, RoutedEventArgs e)
01023         {
01024             this.spInner.FlowDirection = FlowDirection.LeftToRight;
01025         }
01026
01027         private void chkIsRTL_Checked(object sender, RoutedEventArgs e)
01028         {
01029             this.spInner.FlowDirection = FlowDirection.RightToLeft;
01030         }
01031
01032         private void cmbParallaxView_SelectionChanged(object sender, SelectionChangedEventArgs e)
01033         {
01034             switch (this.cmbParallaxView.SelectedIndex)
01035             {
01036                 case 0:
01037                     this.ParallaxView = this.parallaxView;
01038                     break;
01039                 case 1:
01040                     if (this.DynamicParallaxView != null)
01041                         this.ParallaxView = this.DynamicParallaxView;
01042                     else
01043                         this.cmbParallaxView.SelectedIndex = 0;
01044                     break;
01045             }
01046
01047             this.chkAreHorizontalSourceOffsetsRelative.IsChecked = this.ParallaxView.HorizontalSourceOffsetKind == ParallaxSourceOffsetKind.Relative;
01048             this.chkAreVerticalSourceOffsetsRelative.IsChecked = this.ParallaxView.VerticalSourceOffsetKind == ParallaxSourceOffsetKind.Relative;
01049             this.chkIsHorizontalShiftClamped.IsChecked = this.ParallaxView.IsHorizontalShiftClamped;
01050             this.chkIsVerticalShiftClamped.IsChecked = this.ParallaxView.IsVerticalShiftClamped;
01051         }
01052
01053         private void chkAreHorizontalSourceOffsetsRelative_Unchecked(object sender, RoutedEventArgs e)
01054         {
01055             this.ParallaxView.HorizontalSourceOffsetKind = ParallaxSourceOffsetKind.Absolute;
01056             TickForValuesSpy();
01057         }
01058
01059         private void chkAreHorizontalSourceOffsetsRelative_Checked(object sender, RoutedEventArgs e)
01060         {
01061             this.ParallaxView.HorizontalSourceOffsetKind = ParallaxSourceOffsetKind.Relative;
01062             TickForValuesSpy();
01063         }
01064
01065         private void chkIsHorizontalShiftClamped_Unchecked(object sender, RoutedEventArgs e)
01066         {
01067             this.ParallaxView.IsHorizontalShiftClamped = false;
01068             TickForValuesSpy();
01069         }
01070
01071         private void chkIsHorizontalShiftClamped_Checked(object sender, RoutedEventArgs e)
01072         {
01073             this.ParallaxView.IsHorizontalShiftClamped = true;
01074             TickForValuesSpy();
01075         }
01076
01077         private void btnGetHeight_Click(object sender, RoutedEventArgs e)
01078         {
01079             this.txtHeight.Text = this.ParallaxView.Height.ToString();
01080         }
01081
01082         private void btnSetHeight_Click(object sender, RoutedEventArgs e)
01083         {
01084             try
01085             {
01086                 this.ParallaxView.Height = Convert.ToDouble(this.txtHeight.Text);
01087             }
01088             catch (FormatException)
01089             {
01090             }
01091         }
01092
01093         private void btnGetVerticalShift_Click(object sender, RoutedEventArgs e)
01094         {
01095             this.txtVerticalShift.Text = this.ParallaxView.VerticalShift.ToString();
01096         }
01097
01098         private void btnSetVerticalShift_Click(object sender, RoutedEventArgs e)
01099         {
01100             try
01101             {
01102                 this.ParallaxView.VerticalShift = Convert.ToDouble(this.txtVerticalShift.Text);
01103                 SetupAnimatedValuesSpy();
01104             }
01105             catch (FormatException)
01106             {
01107             }
01108         }
01109
01110         private void btnGetMaxVerticalShiftRatio_Click(object sender, RoutedEventArgs e)
01111         {
01112             this.txtMaxVerticalShiftRatio.Text = this.ParallaxView.MaxVerticalShiftRatio.ToString();
01113         }
01114
01115         private void btnSetMaxVerticalShiftRatio_Click(object sender, RoutedEventArgs e)
01116         {
01117             try
01118             {
01119                 this.ParallaxView.MaxVerticalShiftRatio = Convert.ToDouble(this.txtMaxVerticalShiftRatio.Text);
01120                 TickForValuesSpy();
01121             }
01122             catch (FormatException)
01123             {
01124             }
01125         }
01126
01127         private void btnGetVerticalSourceStartOffset_Click(object sender, RoutedEventArgs e)
01128         {
01129             this.txtVerticalSourceStartOffset.Text = this.ParallaxView.VerticalSourceStartOffset.ToString();
01130             TickForValuesSpy();
01131         }
01132
01133         private void btnSetVerticalSourceStartOffset_Click(object sender, RoutedEventArgs e)
01134         {
01135             try
01136             {
01137                 this.ParallaxView.VerticalSourceStartOffset = Convert.ToDouble(this.txtVerticalSourceStartOffset.Text);
01138                 TickForValuesSpy();
01139             }
01140             catch (FormatException)
01141             {
01142             }
01143         }
01144
01145         private void btnGetVerticalSourceEndOffset_Click(object sender, RoutedEventArgs e)
01146         {
01147             this.txtVerticalSourceEndOffset.Text = this.ParallaxView.VerticalSourceEndOffset.ToString();
01148         }
01149
01150         private void btnSetVerticalSourceEndOffset_Click(object sender, RoutedEventArgs e)
01151         {
01152             try
01153             {
01154                 this.ParallaxView.VerticalSourceEndOffset = Convert.ToDouble(this.txtVerticalSourceEndOffset.Text);
01155                 TickForValuesSpy();
01156             }
01157             catch (FormatException)
01158             {
01159             }
01160         }
01161
01162         private void chkAreVerticalSourceOffsetsRelative_Unchecked(object sender, RoutedEventArgs e)
01163         {
01164             this.ParallaxView.VerticalSourceOffsetKind = ParallaxSourceOffsetKind.Absolute;
01165             TickForValuesSpy();
01166         }
01167
01168         private void chkAreVerticalSourceOffsetsRelative_Checked(object sender, RoutedEventArgs e)
01169         {
01170             this.ParallaxView.VerticalSourceOffsetKind = ParallaxSourceOffsetKind.Relative;
01171             TickForValuesSpy();
01172         }
01173
01174         private void chkIsVerticalShiftClamped_Unchecked(object sender, RoutedEventArgs e)
01175         {
01176             this.ParallaxView.IsVerticalShiftClamped = false;
01177             TickForValuesSpy();
01178         }
01179
01180         private void chkIsVerticalShiftClamped_Checked(object sender, RoutedEventArgs e)
01181         {
01182             this.ParallaxView.IsVerticalShiftClamped = true;
01183             TickForValuesSpy();
01184         }
01185
01186         private void btnGetHorizontalOffset_Click(object sender, RoutedEventArgs e)
01187         {
01188             if (this.ScrollViewer != null)
01189             {
01190                 this.txtHorizontalOffset.Text = this.ScrollViewer.HorizontalOffset.ToString();
01191             }
01192             else if (this.ScrollPresenter != null)
01193             {
01194                 this.txtHorizontalOffset.Text = this.ScrollPresenter.HorizontalOffset.ToString();
01195             }
01196         }
01197
01198         private void btnSetHorizontalOffset_Click(object sender, RoutedEventArgs e)
01199         {
01200             try
01201             {
01202                 if (this.ScrollViewer != null)
01203                 {
01204                     this.ScrollViewer.ChangeView(Convert.ToSingle(this.txtHorizontalOffset.Text), null, null, true);
01205                 }
01206                 else if (this.ScrollPresenter != null)
01207                 {
01208                     this.ScrollPresenter.ScrollTo(
01209                         Convert.ToSingle(this.txtHorizontalOffset.Text),
01210                         this.ScrollPresenter.VerticalOffset,
01211                         new ScrollingScrollOptions(ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore));
01212                 }
01213             }
01214             catch (FormatException)
01215             {
01216             }
01217         }
01218
01219         private void btnGetVerticalOffset_Click(object sender, RoutedEventArgs e)
01220         {
01221             if (this.ScrollViewer != null)
01222             {
01223                 this.txtVerticalOffset.Text = this.ScrollViewer.VerticalOffset.ToString();
01224             }
01225             else if (this.ScrollPresenter != null)
01226             {
01227                 this.txtVerticalOffset.Text = this.ScrollPresenter.VerticalOffset.ToString();
01228             }
01229         }
01230
01231         private void btnSetVerticalOffset_Click(object sender, RoutedEventArgs e)
01232         {
01233             try
01234             {
01235                 if (this.ScrollViewer != null)
01236                 {
01237                     this.ScrollViewer.ChangeView(null, Convert.ToSingle(this.txtVerticalOffset.Text), null, true);
01238                 }
01239                 else if (this.ScrollPresenter != null)
01240                 {
01241                     this.ScrollPresenter.ScrollTo(
01242                         this.ScrollPresenter.HorizontalOffset,
01243                         Convert.ToSingle(this.txtVerticalOffset.Text),
01244                         new ScrollingScrollOptions(
01245                             ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore));
01246                 }
01247             }
01248             catch (FormatException)
01249             {
01250             }
01251         }
01252
01253         private void btnGetZoomFactor_Click(object sender, RoutedEventArgs e)
01254         {
01255             if (this.ScrollViewer != null)
01256             {
01257                 this.txtZoomFactor.Text = this.ScrollViewer.ZoomFactor.ToString();
01258             }
01259             else if (this.ScrollPresenter != null)
01260             {
01261                 this.txtZoomFactor.Text = this.ScrollPresenter.ZoomFactor.ToString();
01262             }
01263         }
01264
01265         private void btnSetZoomFactor_Click(object sender, RoutedEventArgs e)
01266         {
01267             try
01268             {
01269                 if (this.ScrollViewer != null)
01270                 {
01271                     this.ScrollViewer.ChangeView(null, null, Convert.ToSingle(this.txtZoomFactor.Text), true);
01272                 }
01273                 else if (this.ScrollPresenter != null)
01274                 {
01275                     this.ScrollPresenter.ZoomTo(
01276                         Convert.ToSingle(this.txtZoomFactor.Text),
01277                         System.Numerics.Vector2.Zero,
01278                         new ScrollingZoomOptions(ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore));
01279                 }
01280             }
01281             catch (FormatException)
01282             {
01283             }
01284         }
01285
01286         private void btnUnparentSource_Click(object sender, RoutedEventArgs e)
01287         {
01288             try
01289             {
01290                 FrameworkElement source = this.ScrollViewer == null ?
01291                     this.ScrollPresenter as FrameworkElement :
01292                     this.ScrollViewer as FrameworkElement;
01293
01294                 if (source != null && source.Parent != null)
01295                 {
01296                     this.spInner.Children.Remove(source);
01297                 }
01298             }
01299             catch
01300             {
01301             }
01302         }
01303
01304         private void btnReparentSource_Click(object sender, RoutedEventArgs e)
01305         {
01306             try
01307             {
01308                 FrameworkElement source = this.ScrollViewer == null ?
01309                     this.ScrollPresenter as FrameworkElement :
01310                     this.ScrollViewer as FrameworkElement;
01311
01312                 if (source != null && source.Parent == null)
01313                 {
01314                     this.spInner.Children.Add(source);
01315                 }
01316             }
01317             catch
01318             {
01319             }
01320         }
01321
01322         private void btnCreateParallaxView_Click(object sender, RoutedEventArgs e)
01323         {
01324             try
01325             {
01326                 if (this.DynamicParallaxView == null)
01327                 {
01328                     this.DynamicParallaxView = new ParallaxView();
01329                     this.spInner.Children.Add(this.DynamicParallaxView);
01330                 }
01331             }
01332             catch
01333             {
01334             }
01335         }
01336         private void btnReleaseParallaxView_Click(object sender, RoutedEventArgs e)
01337         {
01338             try
01339             {
01340                 if (this.DynamicParallaxView != null)
01341                 {
01342                     this.spInner.Children.Remove(this.DynamicParallaxView);
01343                     this.DynamicParallaxView = null;
01344
01345                     this.ParallaxView = this.parallaxView;
01346                     this.cmbParallaxView.SelectedIndex = 0;
01347                     this.chkAreHorizontalSourceOffsetsRelative.IsChecked = this.ParallaxView.HorizontalSourceOffsetKind == ParallaxSourceOffsetKind.Relative;
01348                     this.chkAreVerticalSourceOffsetsRelative.IsChecked = this.ParallaxView.VerticalSourceOffsetKind == ParallaxSourceOffsetKind.Relative;
01349                     this.chkIsHorizontalShiftClamped.IsChecked = this.ParallaxView.IsHorizontalShiftClamped;
01350                     this.chkIsVerticalShiftClamped.IsChecked = this.ParallaxView.IsVerticalShiftClamped;
01351
01352                     System.GC.Collect();
01353                     System.GC.WaitForPendingFinalizers();
01354                 }
01355             }
01356             catch
01357             {
01358             }
01359         }
01360
01361         private void btnRefreshAutomaticHorizontalOffsets_Click(object sender, RoutedEventArgs e)
01362         {
01363             try
01364             {
01365                 if (this.DynamicParallaxView != null)
01366                 {
01367                     this.DynamicParallaxView.RefreshAutomaticHorizontalOffsets();
01368                 }
01369             }
01370             catch
01371             {
01372             }
01373         }
01374
01375         private void btnRefreshAutomaticVerticalOffsets_Click(object sender, RoutedEventArgs e)
01376         {
01377             try
01378             {
01379                 if (this.DynamicParallaxView != null)
01380                 {
01381                     this.DynamicParallaxView.RefreshAutomaticVerticalOffsets();
01382                 }
01383             }
01384             catch
01385             {
01386             }
01387         }
01388
01389         private void SetupScrollPresenter()
01390         {
01391             LinearGradientBrush threeColorsLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
01392
01393             GradientStop blueGS = new GradientStop() { Color = Microsoft.UI.Colors.Blue, Offset = 0.0 };
01394             threeColorsLGB.GradientStops.Add(blueGS);
01395
01396             GradientStop yellowGS = new GradientStop() { Color = Microsoft.UI.Colors.Yellow, Offset = 0.5 };
01397             threeColorsLGB.GradientStops.Add(yellowGS);
01398
01399             GradientStop redGS = new GradientStop() { Color = Microsoft.UI.Colors.Red, Offset = 1.0 };
01400             threeColorsLGB.GradientStops.Add(redGS);
01401
01402             this.rectSC = new Rectangle();
01403             this.rectSC.Width = 400;
01404             this.rectSC.Height = 900;
01405             this.rectSC.Fill = threeColorsLGB;
01406
01407             this.scrollPresenter = new ScrollPresenter();
01408             this.scrollPresenter.Name = "scrollPresenter";
01409             this.scrollPresenter.Width = 400;
01410             this.scrollPresenter.Height = 300;
01411             this.scrollPresenter.Background = new SolidColorBrush(Microsoft.UI.Colors.Magenta);
01412             this.scrollPresenter.Margin = new Thickness(6);
01413             this.scrollPresenter.HorizontalScrollMode = ScrollingScrollMode.Disabled;
01414             this.scrollPresenter.VerticalScrollMode = ScrollingScrollMode.Enabled;
01415             this.scrollPresenter.ZoomMode = ScrollingZoomMode.Enabled;
01416             this.scrollPresenter.Content = this.rectSC;
01417             this.scrollPresenter.ViewChanged += ScrollPresenter_ViewChanged;
01418             this.scrollPresenter.SetValue(AutomationProperties.NameProperty, "scrollPresenter");
01419
01420             this.spInner.Children.Add(this.scrollPresenter);
01421
01422             ComboBoxItem cmbItem = new ComboBoxItem();
01423             cmbItem.Content = "scrollPresenter";
01424             cmbItem.SetValue(AutomationProperties.NameProperty, "scrollPresenter");
01425             cmbSource.Items.Add(cmbItem);
01426         }
01427     }
01428 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: AnimatedIcon/AnimatedVisuals/AnimatedFindVisualSource.idl Source File

  • AnimatedIcon
  • AnimatedVisuals

AnimatedFindVisualSource.idl

Go to the documentation of this file.
00001 ﻿//------------------------------------------------------------------------------
00002 // <auto-generated>
00003 //     This code was generated by a tool.
00004 //
00005 //       LottieGen version:
00006 //           7.1.0+ge1fa92580f
00007 //
00008 //       Command:
00009 //           LottieGen -Language Cppwinrt -WinUIVersion 2.4 -InputFile AnimatedFindVisualSource.json
00010 //
00011 //       Input file:
00012 //           AnimatedFindVisualSource.json (14456 bytes created 23:37-07:00 Oct 5 2021)
00013 //
00014 //       LottieGen source:
00015 //           http://aka.ms/Lottie
00016 //
00017 //     Changes to this file may cause incorrect behavior and will be lost if
00018 //     the code is regenerated.
00019 // </auto-generated>
00020 //------------------------------------------------------------------------------
00021 namespace MU_XCAV_NAMESPACE
00022 {
00023     [MUX_PUBLIC]
00024     [webhosthidden]
00025     runtimeclass AnimatedFindVisualSource
00026         : [default] Microsoft.UI.Xaml.Controls.IAnimatedVisualSource, Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2
00027     {
00028         AnimatedFindVisualSource();
00029     };
00030 }
Generated on Sun Dec 1 2024 20:51:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/LayoutSamples/NonVirtualLayoutPages/Flex.cs Source File

  • Repeater
  • TestUI
  • Samples
  • LayoutSamples
  • NonVirtualLayoutPages

Flex.cs

Go to the documentation of this file.
00001 ﻿using Microsoft.UI.Xaml.Controls;
00002 using System;
00003 using System.Collections.Generic;
00004 using Windows.Foundation;
00005 using Microsoft.UI.Xaml;
00006
00007 // Notes:
00008 // (1) Item's Horizontal and Vertical Alignment conflict
00009 // with align-content stretch and align-items stretch
00010 // For these two to work, we need to have the xaml alignments be set to stretch.
00011 //
00012 // (2) Is there equivalent of align-items baseline in xaml ?
00013 //
00014 // (3) order is not impl - don't think it is valuable, we
00015 // can just change the order of the children, needs a sort of children :/
00016 //
00017 // (4) FlexWrap-WrapReverse not impl - not sure if it is valuable. Need one more pass?
00018 //
00019 // todo for perf - possibly cache dependency properties since they dont change often.
00020 //
00021 namespace Flick
00022 {
00023     public class Flex : NonVirtualizingLayout
00024     {
00025
00026         #region Dependency Properties
00027
00028         public FlexDirection FlexDirection
00029         {
00030             get { return (FlexDirection)GetValue(FlexDirectionProperty); }
00031             set { SetValue(FlexDirectionProperty, value); }
00032         }
00033
00034         public static readonly DependencyProperty FlexDirectionProperty =
00035             DependencyProperty.Register("FlexDirection", typeof(FlexDirection), typeof(Flex), new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
00036
00037         public FlexWrap FlexWrap
00038         {
00039             get { return (FlexWrap)GetValue(FlexWrapProperty); }
00040             set { SetValue(FlexWrapProperty, value); }
00041         }
00042
00043         public static readonly DependencyProperty FlexWrapProperty =
00044             DependencyProperty.Register("FlexWrap", typeof(FlexWrap), typeof(Flex), new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
00045
00046
00047         public JustifyContent JustifyContent
00048         {
00049             get { return (JustifyContent)GetValue(JustifyContentProperty); }
00050             set { SetValue(JustifyContentProperty, value); }
00051         }
00052
00053         public static readonly DependencyProperty JustifyContentProperty =
00054             DependencyProperty.Register("JustifyContent", typeof(JustifyContent), typeof(Flex), new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
00055
00056         public AlignItems AlignItems
00057         {
00058             get { return (AlignItems)GetValue(AlignItemsProperty); }
00059             set { SetValue(AlignItemsProperty, value); }
00060         }
00061
00062         public static readonly DependencyProperty AlignItemsProperty =
00063             DependencyProperty.Register("AlignItems", typeof(AlignItems), typeof(Flex), new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
00064
00065         public AlignContent AlignContent
00066         {
00067             get { return (AlignContent)GetValue(AlignContentProperty); }
00068             set { SetValue(AlignContentProperty, value); }
00069         }
00070
00071         public static readonly DependencyProperty AlignContentProperty =
00072             DependencyProperty.Register("AlignContent", typeof(AlignContent), typeof(Flex), new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
00073
00074         public static AlignItems GetAlignSelf(DependencyObject obj)
00075         {
00076             return (AlignItems)obj.GetValue(AlignSelfProperty);
00077         }
00078
00079         public static void SetAlignSelf(DependencyObject obj, AlignItems value)
00080         {
00081             obj.SetValue(AlignSelfProperty, value);
00082         }
00083
00084         public static readonly DependencyProperty AlignSelfProperty =
00085             DependencyProperty.RegisterAttached("AlignSelf", typeof(AlignItems), typeof(Flex), new PropertyMetadata(0));
00086
00087
00088         public static int GetFlexGrow(DependencyObject obj)
00089         {
00090             return (int)obj.GetValue(FlexGrowProperty);
00091         }
00092
00093         public static void SetFlexGrow(DependencyObject obj, int value)
00094         {
00095             obj.SetValue(FlexGrowProperty, value);
00096         }
00097
00098         public static readonly DependencyProperty FlexGrowProperty =
00099             DependencyProperty.RegisterAttached("FlexGrow", typeof(int), typeof(Flex), new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
00100
00101
00102         public static int GetFlexShrink(DependencyObject obj)
00103         {
00104             return (int)obj.GetValue(FlexShrinkProperty);
00105         }
00106
00107         public static void SetFlexShrink(DependencyObject obj, int value)
00108         {
00109             obj.SetValue(FlexShrinkProperty, value);
00110         }
00111
00112         public static readonly DependencyProperty FlexShrinkProperty =
00113             DependencyProperty.RegisterAttached("FlexShrink", typeof(int), typeof(Flex), new PropertyMetadata(1, new PropertyChangedCallback(OnPropertyChanged)));
00114
00115
00116         public static int GetFlexBasis(DependencyObject obj)
00117         {
00118             return (int)obj.GetValue(FlexBasisProperty);
00119         }
00120
00121         public static void SetFlexBasis(DependencyObject obj, int value)
00122         {
00123             obj.SetValue(FlexBasisProperty, value);
00124         }
00125
00126         public static readonly DependencyProperty FlexBasisProperty =
00127             DependencyProperty.RegisterAttached("FlexBasis", typeof(int), typeof(Flex), new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
00128
00129         #endregion
00130
00131         protected override void InitializeForContextCore(NonVirtualizingLayoutContext context)
00132         {
00133             context.LayoutState = new FlexState();
00134         }
00135
00136         protected override void UninitializeForContextCore(NonVirtualizingLayoutContext context)
00137         {
00138             context.LayoutState = null;
00139         }
00140
00141         private FlexState State(NonVirtualizingLayoutContext context)
00142         {
00143             return context.LayoutState as FlexState;
00144         }
00145
00146         // TODO: Separate concern of order/iteration away from here to simplify
00147         protected override Size MeasureOverride(NonVirtualizingLayoutContext context, Size availableSize)
00148         {
00149             var state = State(context);
00150             double mainPosition = 0.0;
00151             double crossPosition = 0.0;
00152             var children = context.Children;
00153             bool isReverse = FlexDirection == FlexDirection.RowReverse || FlexDirection == FlexDirection.ColumnReverse;
00154             state.Lines.Clear();
00155             var currentLine = new LineInfo();
00156             currentLine.StartIndex = isReverse ? children.Count - 1 : 0;
00157             for (int i = 0; i < children.Count; i++)
00158             {
00159                 var childIndex = isReverse ? children.Count - 1 - i : i;
00160                 var child = children[childIndex];
00161                 var basis = GetFlexBasis(child);
00162                 var measureSize = basis != 0 ? Size(Math.Min(basis, Main(availableSize)), Cross(availableSize)) : availableSize;
00163                 child.Measure(measureSize);
00164
00165                 if (FlexWrap == FlexWrap.Wrap)
00166                 {
00167                     if (Main(availableSize) - (mainPosition + Main(child.DesiredSize)) < 0)
00168                     {
00169                         // wrap since the current item will not fit.
00170                         currentLine.MainSize = mainPosition;
00171                         GrowLineIfNeeded(ref currentLine, children, availableSize, isReverse);
00172                         ShrinkLineIfNeeded(ref currentLine, children, availableSize, isReverse);
00173                         state.Lines.Add(currentLine);
00174                         mainPosition = 0.0;
00175                         crossPosition += currentLine.CrossSize;
00176                         currentLine = new LineInfo();
00177                         currentLine.StartIndex = childIndex;
00178                         currentLine.CrossPosition = crossPosition;
00179                     }
00180                 }
00181
00182                 // Let's position child at mainPosition, crossPosition
00183                 currentLine.SumGrow += GetFlexGrow(child);
00184                 currentLine.SumShrink += GetFlexShrink(child);
00185                 currentLine.CountInLine++;
00186
00187                 // Now calculate position for next child.
00188                 mainPosition += Main(child.DesiredSize);
00189                 currentLine.CrossSize = Math.Max(currentLine.CrossSize, Cross(child.DesiredSize));
00190             }
00191
00192             if (currentLine.CountInLine > 0)
00193             {
00194                 currentLine.MainSize = mainPosition;
00195                 GrowLineIfNeeded(ref currentLine, children, availableSize, isReverse);
00196                 ShrinkLineIfNeeded(ref currentLine, children, availableSize, isReverse);
00197                 state.Lines.Add(currentLine);
00198             }
00199
00200             state.LastExtent = Size(mainPosition, crossPosition + currentLine.CrossSize);
00201             return state.LastExtent;
00202         }
00203
00204         protected override Size ArrangeOverride(NonVirtualizingLayoutContext context, Size finalSize)
00205         {
00206             var state = State(context);
00207             bool isReverse = FlexDirection == FlexDirection.RowReverse || FlexDirection == FlexDirection.ColumnReverse;
00208             int step = isReverse ? -1 : 1;
00209             int childIndex = isReverse ? context.Children.Count - 1 : 0;
00210             var layoutItemAlignment = AlignItems;
00211             double extraCrossSpaceInExtent = Cross(finalSize) - Cross(state.LastExtent);
00212             for (int lineIndex = 0; lineIndex < state.Lines.Count; lineIndex++)
00213             {
00214                 var currentLine = state.Lines[lineIndex];
00215                 var mainPosition = 0.0;
00216
00217                 double crossContentOffset = GetContentAlignedCrossOffset(extraCrossSpaceInExtent, lineIndex, state);
00218                 double extraMainSpaceInLine = Main(finalSize) - currentLine.MainSize;
00219
00220                 for (int indexInLine = 0; indexInLine < currentLine.CountInLine; indexInLine++)
00221                 {
00222                     var currentChild = context.Children[childIndex];
00223                     var childAlign = GetAlignSelf(currentChild);
00224                     var itemAlignment = childAlign == AlignItems.Auto ? layoutItemAlignment : childAlign;
00225                     double itemMainSize = Main(currentChild.DesiredSize);
00226                     double itemCrossSize = Cross(currentChild.DesiredSize);
00227
00228                     double mainOffset = mainPosition;
00229                     if (extraMainSpaceInLine > 0)
00230                     {
00231                         mainOffset += GetContentJustifiedMainOffset(currentLine.CountInLine, extraMainSpaceInLine, indexInLine);
00232                     }
00233
00234                     double crossOffset = currentLine.CrossPosition + crossContentOffset + GetItemsAlignedCrossOffset(currentLine, itemCrossSize, itemAlignment);
00235
00236                     if (AlignContent == AlignContent.Stretch)
00237                     {
00238                         itemCrossSize = currentLine.CrossSize + extraCrossSpaceInExtent / state.Lines.Count;
00239                     }
00240                     else if (itemAlignment == AlignItems.Stretch)
00241                     {
00242                         itemCrossSize = currentLine.CrossSize;
00243                     }
00244
00245                     currentChild.Arrange(Rect(mainOffset, crossOffset, itemMainSize, itemCrossSize));
00246                     mainPosition += Main(currentChild.DesiredSize);
00247
00248                     childIndex += step;
00249                 }
00250             }
00251
00252             return finalSize;
00253         }
00254
00255         private void GrowLineIfNeeded(ref LineInfo currentLine, IReadOnlyList<UIElement> children, Size availableSize, bool isReverse)
00256         {
00257             var mainAvailableSize = Main(availableSize);
00258             if (currentLine.SumGrow > 0 && mainAvailableSize > currentLine.MainSize)
00259             {
00260                 var extraMainSpaceInLine = mainAvailableSize - currentLine.MainSize;
00261                 // Line eats up all the space.
00262                 currentLine.MainSize = Main(availableSize);
00263                 currentLine.CrossSize = 0.0;
00264                 for (int i = 0; i < currentLine.CountInLine; i++)
00265                 {
00266                     // grow the item
00267                     var childIndex = isReverse ? currentLine.StartIndex - i : currentLine.StartIndex + i;
00268                     var currentChild = children[childIndex];
00269                     var currentChildFlexGrow = GetFlexGrow(currentChild);
00270                     // no need to re-measure if we are not going to grow this item.
00271                     if (currentChildFlexGrow > 0)
00272                     {
00273                         var growBy = (extraMainSpaceInLine / currentLine.SumGrow) * currentChildFlexGrow;
00274                         var basis = GetFlexBasis(currentChild);
00275                         var measureSize = basis != 0 ? Size(Math.Min(basis + growBy, Main(availableSize)), Cross(availableSize)) : availableSize;
00276                         currentChild.Measure(measureSize);
00277                     }
00278                     currentLine.CrossSize = Math.Max(currentLine.CrossSize, Cross(currentChild.DesiredSize));
00279                 }
00280             }
00281         }
00282
00283         private void ShrinkLineIfNeeded(ref LineInfo currentLine, IReadOnlyList<UIElement> children, Size availableSize, bool isReverse)
00284         {
00285             var mainAvailableSize = Main(availableSize);
00286             if (currentLine.SumShrink > 0 && mainAvailableSize < currentLine.MainSize)
00287             {
00288                 var deficitMainSpaceInLine = currentLine.MainSize - mainAvailableSize;
00289                 // Line eats up all the space.
00290                 currentLine.MainSize = Main(availableSize);
00291                 currentLine.CrossSize = 0.0;
00292                 for (int i = 0; i < currentLine.CountInLine; i++)
00293                 {
00294                     // grow the item
00295                     var childIndex = isReverse ? currentLine.StartIndex - i : currentLine.StartIndex + i;
00296                     var currentChild = children[childIndex];
00297                     var currentChildFlexShrink = GetFlexShrink(currentChild);
00298                     // no need to re-measure if we are not going to grow this item.
00299                     if (currentChildFlexShrink > 0)
00300                     {
00301                         var shrinkBy = (deficitMainSpaceInLine / currentLine.SumShrink) * currentChildFlexShrink;
00302                         var basis = GetFlexBasis(currentChild);
00303                         var measureSize = basis != 0 ? Size(Math.Min(basis - shrinkBy, Main(availableSize)), Cross(availableSize)) : availableSize;
00304                         currentChild.Measure(measureSize);
00305                     }
00306                     currentLine.CrossSize = Math.Max(currentLine.CrossSize, Cross(currentChild.DesiredSize));
00307                 }
00308             }
00309         }
00310
00311         private double GetContentAlignedCrossOffset(double extraCrossSpaceInExtent, int lineIndex, FlexState state)
00312         {
00313             double crossContentOffset = 0;
00314             if (extraCrossSpaceInExtent > 0)
00315             {
00316                 switch (AlignContent)
00317                 {
00318                     case AlignContent.FlexStart:
00319                         break;
00320                     case AlignContent.FlexEnd:
00321                         crossContentOffset = extraCrossSpaceInExtent;
00322                         break;
00323                     case AlignContent.Center:
00324                         crossContentOffset = extraCrossSpaceInExtent / 2;
00325                         break;
00326                     case AlignContent.Stretch:
00327                         crossContentOffset = lineIndex * extraCrossSpaceInExtent / (state.Lines.Count);
00328                         break;
00329                     case AlignContent.SpaceBetween:
00330                         if (state.Lines.Count > 1)
00331                         {
00332                             crossContentOffset = lineIndex * (extraCrossSpaceInExtent / (state.Lines.Count - 1));
00333                         }
00334                         break;
00335                     case AlignContent.SpaceAround:
00336                         crossContentOffset = (lineIndex * 2 + 1) * extraCrossSpaceInExtent / (state.Lines.Count * 2);
00337                         break;
00338                 }
00339             }
00340
00341             return crossContentOffset;
00342         }
00343
00344         private double GetItemsAlignedCrossOffset(LineInfo line, double itemCrossSize, AlignItems alignment)
00345         {
00346             double crossOffset = 0.0;
00347             double extraCrossSpace = line.CrossSize - itemCrossSize;
00348             switch (alignment)
00349             {
00350                 case AlignItems.Auto:
00351                 case AlignItems.FlexStart:
00352                     break;
00353                 case AlignItems.FlexEnd:
00354                     crossOffset = extraCrossSpace;
00355                     break;
00356                 case AlignItems.Center:
00357                     crossOffset = extraCrossSpace / 2;
00358                     break;
00359                 case AlignItems.Stretch:
00360                     break;
00361                 default:
00362                     throw new NotImplementedException();
00363             }
00364
00365             return crossOffset;
00366         }
00367
00368         private double GetContentJustifiedMainOffset(int countInLine, double extraMainSpace, int itemIndex)
00369         {
00370             double mainOffset = 0;
00371             switch (JustifyContent)
00372             {
00373                 case JustifyContent.FlexStart:
00374                     break;
00375                 case JustifyContent.FlexEnd:
00376                     mainOffset = extraMainSpace;
00377                     break;
00378                 case JustifyContent.Center:
00379                     mainOffset = extraMainSpace / 2;
00380                     break;
00381                 case JustifyContent.SpaceBetween:
00382                     mainOffset = countInLine > 1 ?
00383                         itemIndex * (extraMainSpace / (countInLine - 1)) :
00384                         0;
00385                     break;
00386                 case JustifyContent.SpaceAround:
00387                     mainOffset = extraMainSpace / (countInLine * 2) + (itemIndex) * (extraMainSpace / countInLine);
00388                     break;
00389                 case JustifyContent.SpaceEvenly:
00390                     mainOffset = (itemIndex + 1) * (extraMainSpace / (countInLine + 1));
00391                     break;
00392
00393                 default:
00394                     throw new NotImplementedException();
00395             }
00396
00397             return mainOffset;
00398         }
00399
00400         private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
00401         {
00402             var layout = (d as Flex);
00403             if (layout != null)
00404             {
00405                 layout.InvalidateMeasure();
00406             }
00407             else if (d is UIElement)
00408             {
00409                 (d as UIElement).InvalidateMeasure();
00410             }
00411         }
00412
00413         #region Axis Helpers
00414
00415         private double Main(Size size)
00416         {
00417             double value = 0.0;
00418             switch (FlexDirection)
00419             {
00420                 case FlexDirection.Row:
00421                 case FlexDirection.RowReverse:
00422                     value = size.Width;
00423                     break;
00424                 case FlexDirection.Column:
00425                 case FlexDirection.ColumnReverse:
00426                     value = size.Height;
00427                     break;
00428                 default:
00429                     throw new NotImplementedException();
00430             }
00431
00432             return value;
00433         }
00434
00435         private double Cross(Size size)
00436         {
00437             double value = 0.0;
00438             switch (FlexDirection)
00439             {
00440                 case FlexDirection.Row:
00441                 case FlexDirection.RowReverse:
00442                     value = size.Height;
00443                     break;
00444                 case FlexDirection.Column:
00445                 case FlexDirection.ColumnReverse:
00446                     value = size.Width;
00447                     break;
00448                 default:
00449                     throw new NotImplementedException();
00450             }
00451
00452             return value;
00453         }
00454
00455         private Size Size(double main, double cross)
00456         {
00457             switch (FlexDirection)
00458             {
00459                 case FlexDirection.Row:
00460                 case FlexDirection.RowReverse:
00461                     return new Size(main, cross);
00462                 case FlexDirection.Column:
00463                 case FlexDirection.ColumnReverse:
00464                     return new Size(cross, main);
00465                 default:
00466                     throw new NotImplementedException();
00467             }
00468         }
00469
00470         private Rect Rect(double main, double cross, double mainSize, double crossSize)
00471         {
00472             switch (FlexDirection)
00473             {
00474                 case FlexDirection.Row:
00475                 case FlexDirection.RowReverse:
00476                     return new Rect(main, cross, mainSize, crossSize);
00477                 case FlexDirection.Column:
00478                 case FlexDirection.ColumnReverse:
00479                     return new Rect(cross, main, crossSize, mainSize);
00480                 default:
00481                     throw new NotImplementedException();
00482             }
00483         }
00484
00485         #endregion
00486
00487         class LineInfo
00488         {
00489             public double CrossPosition { get; set; }
00490             public int StartIndex { get; set; }
00491             public int CountInLine { get; set; }
00492             public double MainSize { get; set; }
00493             public double CrossSize { get; set; }
00494             public int SumGrow { get; set; }
00495             public int SumShrink { get; set; }
00496
00497             public override string ToString()
00498             {
00499                 return $"Offset:{CrossPosition} Count:{CountInLine} Main:{MainSize} Cross:{CrossSize}";
00500             }
00501         };
00502
00503         class FlexState
00504         {
00505             public List<LineInfo> Lines { get; set; } = new List<LineInfo>();
00506             public Size LastExtent { get; set; }
00507         }
00508
00509     }
00510
00511     #region Enums
00512     public enum FlexDirection
00513     {
00514         Row,
00515         RowReverse,
00516         Column,
00517         ColumnReverse
00518     };
00519
00520     public enum FlexWrap
00521     {
00522         NoWrap,
00523         Wrap,
00524         // WrapReverse
00525     };
00526
00527     public enum JustifyContent
00528     {
00529         FlexStart,
00530         FlexEnd,
00531         Center,
00532         SpaceBetween,
00533         SpaceAround,
00534         SpaceEvenly
00535     };
00536
00537     public enum AlignItems
00538     {
00539         Auto,
00540         FlexStart,
00541         FlexEnd,
00542         Center,
00543         Stretch,
00544         // Baseline
00545     };
00546
00547     public enum AlignContent
00548     {
00549         FlexStart,
00550         FlexEnd,
00551         Center,
00552         Stretch,
00553         SpaceBetween,
00554         SpaceAround
00555     }
00556
00557     #endregion
00558 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/ScrollBarController.h Source File

  • ScrollView

ScrollBarController.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007
00008 class ScrollView;
00009
00010 using namespace std;
00011
00012 class ScrollBarController:
00013     public winrt::implements<ScrollBarController, winrt::IScrollController>
00014 {
00015 public:
00016     ScrollBarController();
00017     ~ScrollBarController();
00018
00019     void SetScrollBar(const winrt::ScrollBar& scrollBar);
00020
00021 #pragma region IScrollController
00022     winrt::IScrollControllerPanningInfo PanningInfo();
00023
00024     bool CanScroll();
00025     bool IsScrollingWithMouse();
00026
00027     void SetIsScrollable(
00028         bool isScrollable);
00029
00030     void SetValues(
00031         double minOffset,
00032         double maxOffset,
00033         double offset,
00034         double viewportLength);
00035
00036     winrt::CompositionAnimation GetScrollAnimation(
00037         int correlationId,
00038         winrt::float2 const& startPosition,
00039         winrt::float2 const& endPosition,
00040         winrt::CompositionAnimation const& defaultAnimation);
00041
00042     void NotifyRequestedScrollCompleted(
00043         int correlationId);
00044
00045     winrt::event_token ScrollToRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollToRequestedEventArgs> const& value);
00046     void ScrollToRequested(winrt::event_token const& token);
00047
00048     winrt::event_token ScrollByRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollByRequestedEventArgs> const& value);
00049     void ScrollByRequested(winrt::event_token const& token);
00050
00051     winrt::event_token AddScrollVelocityRequested(winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerAddScrollVelocityRequestedEventArgs> const& value);
00052     void AddScrollVelocityRequested(winrt::event_token const& token);
00053
00054     winrt::event_token CanScrollChanged(winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable> const& value);
00055     void CanScrollChanged(winrt::event_token const& token);
00056
00057     winrt::event_token IsScrollingWithMouseChanged(winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable> const& value);
00058     void IsScrollingWithMouseChanged(winrt::event_token const& token);
00059 #pragma endregion
00060
00061 private:
00062     void UpdateCanScroll();
00063
00064     void HookScrollBarEvent();
00065     void UnhookScrollBarEvent();
00066     void HookScrollBarPropertyChanged();
00067     void UnhookScrollBarPropertyChanged();
00068
00069     void OnScrollBarPropertyChanged(
00070         const winrt::DependencyObject& sender,
00071         const winrt::DependencyProperty& args);
00072     void OnScroll(
00073         const winrt::IInspectable& sender,
00074         const winrt::ScrollEventArgs& args);
00075
00076     bool RaiseScrollToRequested(
00077         double offset);
00078     bool RaiseScrollByRequested(
00079         double offsetChange);
00080     bool RaiseAddScrollVelocityRequested(
00081         double offsetChange);
00082     void RaiseCanScrollChanged();
00083     void RaiseIsScrollingWithMouseChanged();
00084
00085 private:
00086     // Private constants
00087
00088     // Default amount to scroll when hitting the SmallIncrement/SmallDecrement buttons: 1/8 of the viewport size.
00089     // This amount can be overridden by setting the ScrollBar.SmallChange property to something else than double.NaN.
00090     static constexpr double s_defaultViewportToSmallChangeRatio{ 8.0 };
00091
00092     // Inertia decay rate for SmallChange / LargeChange animated Value changes.
00093     static constexpr float s_inertiaDecayRate = 0.9995f;
00094
00095     // Additional velocity required with decay s_inertiaDecayRate to move Position by one pixel.
00096     static constexpr double s_velocityNeededPerPixel{ 7.600855902349023 };
00097
00098     // Additional velocity at Minimum and Maximum positions to ensure hitting the extreme Value.
00099     static constexpr double s_minMaxEpsilon{ 0.001 };
00100
00101     winrt::ScrollBar m_scrollBar;
00102     int32_t m_lastOffsetChangeCorrelationIdForScrollTo{ -1 };
00103     int32_t m_lastOffsetChangeCorrelationIdForScrollBy{ -1 };
00104     int32_t m_lastOffsetChangeCorrelationIdForAddScrollVelocity{ -1 };
00105     int m_operationsCount{ 0 };
00106     double m_lastScrollBarValue{ 0.0 };
00107     double m_lastOffset{ 0.0 };
00108     bool m_canScroll{ false };
00109     bool m_isScrollingWithMouse{ false };
00110     bool m_isScrollable{ false };
00111
00112     // Event Sources
00113     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollToRequestedEventArgs>> m_scrollToRequested { };
00114     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerScrollByRequestedEventArgs>> m_scrollByRequested { };
00115     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::ScrollControllerAddScrollVelocityRequestedEventArgs>> m_addScrollVelocityRequested { };
00116     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable>> m_canScrollChanged { };
00117     event<winrt::TypedEventHandler<winrt::IScrollController, winrt::IInspectable>> m_isScrollingWithMouseChanged { };
00118
00119     // Event Tokens
00120     winrt::event_token m_scrollBarScrollToken{};
00121     winrt::event_token m_visibilityChangedToken{};
00122     winrt::event_token m_scrollBarIsEnabledChangedToken{};
00123 #ifdef DBG
00124     // For testing purposes only
00125     winrt::event_token m_scrollBarIndicatorModeChangedToken{};
00126     winrt::event_token m_scrollBarVisibilityChangedToken{};
00127 #endif //DBG
00128 };
00129
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: dll/RegUtil.cpp Source File

  • dll

RegUtil.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include "RegUtil.h"
00006
00007 // Used on RS4 and RS5 to indicate whether ScrollBars must auto-hide or not.
00008 bool RegUtil::UseDynamicScrollbars() noexcept
00009 {
00010     LPCWSTR subKey = L"Control Panel\\Accessibility";
00011     LPCWSTR value = L"DynamicScrollbars";
00012     DWORD keyValue = 0;
00013     DWORD keySize = sizeof(DWORD);
00014
00015     if (SUCCEEDED(HRESULT_FROM_WIN32(::RegGetValueW(HKEY_CURRENT_USER, subKey, value, RRF_RT_REG_DWORD, nullptr, &keyValue, &keySize))))
00016     {
00017         return keyValue != 0;
00018     }
00019
00020     return true;
00021 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorPickerTests::ColorPickerTestSetupHelper Member List

This is the complete list of members for ColorPickerTests::ColorPickerTestSetupHelper, including all inherited members.
[instance initializer] | ColorPickerTests::ColorPickerTestSetupHelper | [inline, private]
alphaEventSource | ColorPickerTests::ColorPickerTestSetupHelper | [private]
blueEventSource | ColorPickerTests::ColorPickerTestSetupHelper | [private]
Color | ColorPickerTests::ColorPickerTestSetupHelper |
colorChangedEvent | ColorPickerTests::ColorPickerTestSetupHelper | [private]
ColorPickerTestSetupHelper(string testName, string languageOverride="") | ColorPickerTests::ColorPickerTestSetupHelper | [inline]
Current | ColorPickerTests::ColorPickerTestSetupHelper | [static]
Dispose(bool isDisposing) | ColorPickerTests::ColorPickerTestSetupHelper | [inline, protected]
ExecuteAndWaitForColorChange(Action action) | ColorPickerTests::ColorPickerTestSetupHelper | [inline]
greenEventSource | ColorPickerTests::ColorPickerTestSetupHelper | [private]
lockObject | ColorPickerTests::ColorPickerTestSetupHelper | [private]
ParseAlphaTextBoxValue(object value) | ColorPickerTests::ColorPickerTestSetupHelper | [inline, private]
redEventSource | ColorPickerTests::ColorPickerTestSetupHelper | [private]
SinkEvent(WaiterEventArgs eventArgs) | ColorPickerTests::ColorPickerTestSetupHelper | [inline]
StartTrackingColorChanges() | ColorPickerTests::ColorPickerTestSetupHelper | [inline]
waitingForColorChanged | ColorPickerTests::ColorPickerTestSetupHelper | [private]
Generated on Sun Dec 1 2024 20:53:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/Common/AspectRatioRespectingControl.cs Source File

  • Repeater
  • APITests
  • Common

AspectRatioRespectingControl.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004 using Microsoft.UI.Xaml.Data;
00005 using Windows.Foundation;
00006 using Microsoft.UI.Xaml.Controls;
00007
00008 namespace MUXControls.ApiTests.RepeaterTests.Common
00009 {
00010     [Microsoft.UI.Xaml.Data.Bindable]
00011     public class AspectRatioRespectingControl : ContentPresenter
00012     {
00013         protected override Size MeasureOverride(Size availableSize)
00014         {
00015             return TwoByOneifySize(availableSize);
00016         }
00017
00018         /// <inheritdoc/>
00019         protected override Size ArrangeOverride(Size finalSize)
00020         {
00021             return TwoByOneifySize(finalSize);
00022         }
00023
00024         private Size TwoByOneifySize(Size initialSize)
00025         {
00026             if (Double.IsNaN(initialSize.Height) || Double.IsInfinity(initialSize.Height))
00027             {
00028                 return new Size(initialSize.Width/ 2, initialSize.Width);
00029             }
00030             if (Double.IsNaN(initialSize.Width) || Double.IsInfinity(initialSize.Width))
00031             {
00032                 return new Size(initialSize.Height / 2, initialSize.Height);
00033             }
00034             return new Size(Math.Min(100,initialSize.Height / 2), Math.Min(100,initialSize.Height));
00035         }
00036     }
00037 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarAutomationPeer Member List

This is the complete list of members for InkToolBarAutomationPeer, including all inherited members.
abi_enter() | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
CheckThread() | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< InkToolBarAutomationPeer > &&self) noexcept | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
final_release(std::unique_ptr< InkToolBarAutomationPeer > &&self) | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline, static]
GetBase() | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
GetInner() | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
InkToolBarAutomationPeer(winrt::InkToolBar owner) | InkToolBarAutomationPeer | [inline]
IsOnThread() | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< InkToolBarAutomationPeer, winrt::implementation::InkToolBarAutomationPeerT > | [inline]
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TeachingTip/TestUI/TeachingTipInXamlPage.xaml.cs Source File

  • TeachingTip
  • TestUI

TeachingTipInXamlPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Private.Controls;
00005 using Microsoft.UI.Xaml.Controls;
00006 using Microsoft.UI.Xaml;
00007
00008 namespace MUXControlsTestApp
00009 {
00010     public sealed partial class TeachingTipInXamlPage : TestPage
00011     {
00012         public TeachingTipInXamlPage()
00013         {
00014             this.InitializeComponent();
00015             TeachingTipTestHooks.IdleStatusChanged += TeachingTipTestHooks_IdleStatusChanged;
00016             TeachingTipTestHooks.OpenedStatusChanged += TeachingTipTestHooks_OpenedStatusChanged;
00017         }
00018
00019         private void OpenTeachingTipButton_Click(object sender, RoutedEventArgs e)
00020         {
00021             this.TestTeachingTip.IsOpen = true;
00022         }
00023
00024         private void CloseTeachingTipButton_Click(object sender, RoutedEventArgs e)
00025         {
00026             this.TestTeachingTip.IsOpen = false;
00027         }
00028
00029         private void TeachingTipTestHooks_OpenedStatusChanged(TeachingTip sender, object args)
00030         {
00031             if (this.TestTeachingTip.IsOpen)
00032             {
00033                 this.IsOpenCheckBox.IsChecked = true;
00034             }
00035             else
00036             {
00037                 this.IsOpenCheckBox.IsChecked = false;
00038             }
00039         }
00040
00041         private void TeachingTipTestHooks_IdleStatusChanged(TeachingTip sender, object args)
00042         {
00043             if (TeachingTipTestHooks.GetIsIdle(this.TestTeachingTip))
00044             {
00045                 this.IsIdleCheckBox.IsChecked = true;
00046             }
00047             else
00048             {
00049                 this.IsIdleCheckBox.IsChecked = false;
00050             }
00051         }
00052     }
00053 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

VirtualizingStackLayout Member List

This is the complete list of members for VirtualizingStackLayout, including all inherited members.
ArrangeOverride(VirtualizingLayoutContext context, Size finalSize) | VirtualizingStackLayout | [inline, protected]
VirtualizingLayout::ArrangeOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &finalSize) | VirtualizingLayout | [virtual]
ClearRealizedRange(int startRealizedIndex, int count) | VirtualizingStackLayout | [inline, private]
ClearRealizedRange() | VirtualizingStackLayout | [inline, private]
DebugTrace(string message, params object[] args) | VirtualizingStackLayout | [inline, private]
EnsureRealized(int dataIndex) | VirtualizingStackLayout | [inline, private]
EstimateExtent(VirtualizingLayoutContext context, Size availableSize) | VirtualizingStackLayout | [inline, private]
EstimateIndexForViewport(Rect viewport, int dataCount) | VirtualizingStackLayout | [inline, private]
Generate(VirtualizingLayoutContext context, Size availableSize, int anchorDataIndex, bool forward) | VirtualizingStackLayout | [inline, private]
GetCachedBoundsForDataIndex(int dataIndex) | VirtualizingStackLayout | [inline, private]
GetCachedBoundsForRealizationIndex(int relativeIndex) | VirtualizingStackLayout | [inline, private]
GetFirstRealizedDataIndexInViewport(Rect viewport) | VirtualizingStackLayout | [inline, private]
GetStartIndex(VirtualizingLayoutContext context, Size availableSize) | VirtualizingStackLayout | [inline, private]
InitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | VirtualizingLayout | [virtual]
Intersects(Rect bounds, Rect viewport) | VirtualizingStackLayout | [inline, private]
IsDataIndexValid(int currentDataIndex, int itemCount) | VirtualizingStackLayout | [inline, private]
IsRealized(int dataIndex) | VirtualizingStackLayout | [inline, private]
m_estimationBuffer | VirtualizingStackLayout | [private]
m_firstRealizedDataIndex | VirtualizingStackLayout | [private]
m_lastExtent | VirtualizingStackLayout | [private]
m_numItemsUsedForEstimation | VirtualizingStackLayout | [private]
m_realizedElementBounds | VirtualizingStackLayout | [private]
m_totalHeightForEstimation | VirtualizingStackLayout | [private]
MeasureElement(VirtualizingLayoutContext context, int index, Size availableSize) | VirtualizingStackLayout | [inline, private]
MeasureOverride(VirtualizingLayoutContext context, Size availableSize) | VirtualizingStackLayout | [inline, protected]
VirtualizingLayout::MeasureOverride(winrt::VirtualizingLayoutContext const &context, winrt::Size const &availableSize) | VirtualizingLayout | [virtual]
OnItemsAdded(int index, int count) | VirtualizingStackLayout | [inline, private]
OnItemsChangedCore(VirtualizingLayoutContext context, object source, NotifyCollectionChangedEventArgs args) | VirtualizingStackLayout | [inline, protected]
VirtualizingLayout::OnItemsChangedCore(winrt::VirtualizingLayoutContext const &context, winrt::IInspectable const &source, winrt::NotifyCollectionChangedEventArgs const &args) | VirtualizingLayout | [virtual]
OnItemsRemoved(int index, int count) | VirtualizingStackLayout | [inline, private]
RealizationIndex(int dataIndex) | VirtualizingStackLayout | [inline, private]
RemoveCachedBoundsOutsideViewport(Rect viewport) | VirtualizingStackLayout | [inline, private]
SetCachedBoundsForDataIndex(int dataIndex, Rect bounds) | VirtualizingStackLayout | [inline, private]
ShouldContinueFillingUpSpace(int dataIndex, bool forward, Rect viewport) | VirtualizingStackLayout | [inline, private]
UninitializeForContextCore(winrt::VirtualizingLayoutContext const &context) | VirtualizingLayout | [virtual]
VirtualizingLayout() | VirtualizingLayout |
Generated on Sun Dec 1 2024 20:54:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

is_flags_enum< PointerPressedStatus > Member List

This is the complete list of members for is_flags_enum< PointerPressedStatus >, including all inherited members.
value is_flags_enum< PointerPressedStatus > [static]
Generated on Sun Dec 1 2024 20:52:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PagerControl/PagerControl.h Source File

  • PagerControl

PagerControl.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "PagerControl.g.h"
00010 #include "PagerControl.properties.h"
00011
00012 class PagerControl :
00013     public ReferenceTracker<PagerControl, winrt::implementation::PagerControlT>,
00014     public PagerControlProperties
00015 {
00016
00017 public:
00018     /* Common functions */
00019     PagerControl();
00020     ~PagerControl();
00021
00022     /* IFrameworkElement */
00023     void OnApplyTemplate();
00024     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00025     winrt::AutomationPeer OnCreateAutomationPeer();
00026
00027     /* Property changed handlers */
00028     void OnDisplayModeChanged();
00029     void UpdateDisplayModeAutoState();
00030     void OnNumberOfPagesChanged(const int oldValue);
00031     void OnSelectedPageIndexChange(const int oldValue);
00032     void OnButtonVisibilityChanged(const winrt::PagerControlButtonVisibility visibility,
00033         const wstring_view visibleStateName,
00034         const wstring_view collapsedStateName,
00035         const wstring_view hiddenStateName,
00036         const int hiddenOnEdgePageCriteria);
00037
00038 private:
00039
00040     /* UI updating */
00041     void UpdateTemplateSettingElementLists();
00042     void FillComboBoxCollectionToSize(const int numberOfPages);
00043     void UpdateOnEdgeButtonVisualStates();
00044
00045     /* Eventing */
00046     void RaiseSelectedIndexChanged();
00047
00048     /* NumberPanel logic */
00049     void UpdateNumberPanel(const int numberOfPages);
00050     void UpdateNumberOfPanelCollectionInfiniteItems();
00051     void UpdateNumberPanelCollectionAllItems(const int numberOfPages);
00052     void UpdateNumberPanelCollectionStartWithEllipsis(const int numberOfPages, const int selectedIndex);
00053     void UpdateNumberPanelCollectionEndWithEllipsis(const int numberOfPages, const int selectedIndex);
00054     void UpdateNumberPanelCollectionCenterWithEllipsis(const int numberOfPages, const int selectedIndex);
00055     void MoveIdentifierToElement(const int index);
00056     void AppendButtonToNumberPanelList(const int pageNumber, const int numberOfPages);
00057     void AppendEllipsisIconToNumberPanelList();
00058
00059     /* Interaction event listeners */
00060     void OnRootGridKeyDown(const winrt::IInspectable& sender, const winrt::KeyRoutedEventArgs& args);
00061     void NumberBoxValueChanged(const winrt::IInspectable& sender, const winrt::NumberBoxValueChangedEventArgs& args);
00062     void ComboBoxSelectionChanged(const winrt::IInspectable& sender, const winrt::SelectionChangedEventArgs& args);
00063     void FirstButtonClicked(const IInspectable& sender, const winrt::RoutedEventArgs& args);
00064     void PreviousButtonClicked(const IInspectable& sender, const winrt::RoutedEventArgs& args);
00065     void NextButtonClicked(const IInspectable& sender, const winrt::RoutedEventArgs& args);
00066     void LastButtonClicked(const IInspectable& sender, const winrt::RoutedEventArgs& args);
00067
00068
00069     int m_lastSelectedPageIndex = -1;
00070     int m_lastNumberOfPagesCount = 0;
00071
00072     tracker_ref<winrt::ComboBox> m_comboBox{ this };
00073     tracker_ref<winrt::NumberBox> m_numberBox{ this };
00074     tracker_ref<winrt::ItemsRepeater> m_numberPanelRepeater{ this };
00075     tracker_ref<winrt::FrameworkElement> m_selectedPageIndicator{ this };
00076
00077     winrt::FrameworkElement::KeyDown_revoker m_rootGridKeyDownRevoker{};
00078     winrt::ComboBox::SelectionChanged_revoker m_comboBoxSelectionChangedRevoker{};
00079     winrt::NumberBox::ValueChanged_revoker m_numberBoxValueChangedRevoker{};
00080     winrt::Button::Click_revoker m_firstPageButtonClickRevoker{};
00081     winrt::Button::Click_revoker m_previousPageButtonClickRevoker{};
00082     winrt::Button::Click_revoker m_nextPageButtonClickRevoker{};
00083     winrt::Button::Click_revoker m_lastPageButtonClickRevoker{};
00084
00085     winrt::IObservableVector<IInspectable> m_comboBoxEntries{};
00086     winrt::IObservableVector<IInspectable> m_numberPanelElements{};
00087
00088 };
00089
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterTypeLogging.cpp Source File

  • ScrollPresenter

ScrollPresenterTypeLogging.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "ScrollPresenterTypeLogging.h"
00006 #include "Utils.h"
00007
00008 namespace TypeLogging
00009 {
00010
00011 winrt::hstring ScrollBarVisibilityToString(const winrt::ScrollingScrollBarVisibility& scrollBarVisibility)
00012 {
00013     switch (scrollBarVisibility)
00014     {
00015     case winrt::ScrollingScrollBarVisibility::Visible:
00016         return L"Visible";
00017     case winrt::ScrollingScrollBarVisibility::Hidden:
00018         return L"Hidden";
00019     case winrt::ScrollingScrollBarVisibility::Auto:
00020         return L"Auto";
00021     default:
00022         MUX_ASSERT(false);
00023         return L"";
00024     }
00025 }
00026
00027 winrt::hstring ChainingModeToString(const winrt::ScrollingChainMode& chainingMode)
00028 {
00029     switch (chainingMode)
00030     {
00031     case winrt::ScrollingChainMode::Always:
00032         return L"Always";
00033     case winrt::ScrollingChainMode::Auto:
00034         return L"Auto";
00035     case winrt::ScrollingChainMode::Never:
00036         return L"Never";
00037     default:
00038         MUX_ASSERT(false);
00039         return L"";
00040     }
00041 }
00042
00043 winrt::hstring RailingModeToString(const winrt::ScrollingRailMode& railingMode)
00044 {
00045     switch (railingMode)
00046     {
00047     case winrt::ScrollingRailMode::Disabled:
00048         return L"Disabled";
00049     case winrt::ScrollingRailMode::Enabled:
00050         return L"Enabled";
00051     default:
00052         MUX_ASSERT(false);
00053         return L"";
00054     }
00055 }
00056
00057 winrt::hstring ScrollModeToString(const winrt::ScrollingScrollMode& scrollMode)
00058 {
00059     switch (scrollMode)
00060     {
00061     case winrt::ScrollingScrollMode::Disabled:
00062         return L"Disabled";
00063     case winrt::ScrollingScrollMode::Enabled:
00064         return L"Enabled";
00065     case winrt::ScrollingScrollMode::Auto:
00066         return L"Auto";
00067     default:
00068         MUX_ASSERT(false);
00069         return L"";
00070     }
00071 }
00072
00073 winrt::hstring ZoomModeToString(const winrt::ScrollingZoomMode& zoomMode)
00074 {
00075     switch (zoomMode)
00076     {
00077     case winrt::ScrollingZoomMode::Disabled:
00078         return L"Disabled";
00079     case winrt::ScrollingZoomMode::Enabled:
00080         return L"Enabled";
00081     default:
00082         MUX_ASSERT(false);
00083         return L"";
00084     }
00085 }
00086
00087 winrt::hstring InputKindToString(const winrt::ScrollingInputKinds& inputKind)
00088 {
00089     switch (static_cast<int>(inputKind))
00090     {
00091     case static_cast<int>(winrt::ScrollingInputKinds::None) :
00092         return L"None";
00093     case static_cast<int>(winrt::ScrollingInputKinds::All) :
00094         return L"All";
00095     case static_cast<int>(winrt::ScrollingInputKinds::Touch):
00096         return L"Touch";
00097     case static_cast<int>(winrt::ScrollingInputKinds::Pen):
00098         return L"Pen";
00099     case static_cast<int>(winrt::ScrollingInputKinds::Keyboard):
00100         return L"Keyboard";
00101     case static_cast<int>(winrt::ScrollingInputKinds::Gamepad):
00102         return L"Gamepad";
00103     default:
00104         return L"InputKind combination";
00105     }
00106 }
00107
00108 winrt::hstring AnimationModeToString(const winrt::ScrollingAnimationMode& animationMode)
00109 {
00110     switch (animationMode)
00111     {
00112     case winrt::ScrollingAnimationMode::Disabled:
00113         return L"Disabled";
00114     case winrt::ScrollingAnimationMode::Enabled:
00115         return L"Enabled";
00116     case winrt::ScrollingAnimationMode::Auto:
00117         return L"Auto";
00118     default:
00119         MUX_ASSERT(false);
00120         return L"";
00121     }
00122 }
00123
00124 winrt::hstring SnapPointsModeToString(const winrt::ScrollingSnapPointsMode& snapPointsMode)
00125 {
00126     switch (snapPointsMode)
00127     {
00128     case winrt::ScrollingSnapPointsMode::Default:
00129         return L"Default";
00130     case winrt::ScrollingSnapPointsMode::Ignore:
00131         return L"Ignore";
00132     default:
00133         MUX_ASSERT(false);
00134         return L"";
00135     }
00136 }
00137
00138 winrt::hstring ScrollPresenterViewKindToString(ScrollPresenterViewKind viewKind)
00139 {
00140     switch (viewKind)
00141     {
00142     case ScrollPresenterViewKind::Absolute:
00143         return L"Absolute";
00144     case ScrollPresenterViewKind::RelativeToCurrentView:
00145         return L"RelativeToCurrentView";
00146 #ifdef ScrollPresenterViewKind_RelativeToEndOfInertiaView
00147     case ScrollPresenterViewKind::RelativeToEndOfInertiaView:
00148         return L"RelativeToEndOfInertiaView";
00149 #endif
00150     default:
00151         MUX_ASSERT(false);
00152         return L"";
00153     }
00154 }
00155
00156 winrt::hstring ScrollPresenterViewChangeResultToString(ScrollPresenterViewChangeResult result)
00157 {
00158     switch (result)
00159     {
00160     case ScrollPresenterViewChangeResult::Completed:
00161         return L"Completed";
00162     case ScrollPresenterViewChangeResult::Ignored:
00163         return L"Ignored";
00164     case ScrollPresenterViewChangeResult::Interrupted:
00165         return L"Interrupted";
00166     default:
00167         MUX_ASSERT(false);
00168         return L"";
00169     }
00170 }
00171
00172 winrt::hstring ScrollAmountToString(const winrt::ScrollAmount& scrollAmount)
00173 {
00174     switch (scrollAmount)
00175     {
00176     case winrt::ScrollAmount::LargeDecrement:
00177         return L"LargeDecrement";
00178     case winrt::ScrollAmount::LargeIncrement:
00179         return L"LargeIncrement";
00180     case winrt::ScrollAmount::SmallDecrement:
00181         return L"SmallDecrement";
00182     case winrt::ScrollAmount::SmallIncrement:
00183         return L"SmallIncrement";
00184     case winrt::ScrollAmount::NoAmount:
00185         return L"NoAmount";
00186     default:
00187         MUX_ASSERT(false);
00188         return L"";
00189     }
00190 }
00191
00192 winrt::hstring ScrollOptionsToString(const winrt::ScrollingScrollOptions& options)
00193 {
00194     if (options)
00195     {
00196         return StringUtil::FormatString(L"ScrollingScrollOptions[0x%1!p!]: AnimationMode: %2!s!, SnapPointsMode: %3!s!",
00197             options,
00198             AnimationModeToString(options.AnimationMode()).c_str(),
00199             SnapPointsModeToString(options.SnapPointsMode()).c_str());
00200     }
00201     else
00202     {
00203         return L"ScrollingScrollOptions[null]";
00204     }
00205 }
00206
00207 winrt::hstring ZoomOptionsToString(const winrt::ScrollingZoomOptions& options)
00208 {
00209     if (options)
00210     {
00211         return StringUtil::FormatString(L"ScrollingZoomOptions[0x%1!p!]: AnimationMode: %2!s!, SnapPointsMode: %3!s!",
00212             options,
00213             AnimationModeToString(options.AnimationMode()).c_str(),
00214             SnapPointsModeToString(options.SnapPointsMode()).c_str());
00215     }
00216     else
00217     {
00218         return L"ScrollingZoomOptions[null]";
00219     }
00220 }
00221
00222 winrt::hstring InteractionTrackerAsyncOperationTypeToString(InteractionTrackerAsyncOperationType operationType)
00223 {
00224     switch (operationType)
00225     {
00226     case InteractionTrackerAsyncOperationType::None:
00227         return L"None";
00228     case InteractionTrackerAsyncOperationType::TryUpdatePosition:
00229         return L"TryUpdatePosition";
00230     case InteractionTrackerAsyncOperationType::TryUpdatePositionBy:
00231         return L"TryUpdatePositionBy";
00232     case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAdditionalVelocity:
00233         return L"TryUpdatePositionWithAdditionalVelocity";
00234     case InteractionTrackerAsyncOperationType::TryUpdatePositionWithAnimation:
00235         return L"TryUpdatePositionWithAnimation";
00236     case InteractionTrackerAsyncOperationType::TryUpdateScale:
00237         return L"TryUpdateScale";
00238     case InteractionTrackerAsyncOperationType::TryUpdateScaleWithAdditionalVelocity:
00239         return L"TryUpdateScaleWithAdditionalVelocity";
00240     case InteractionTrackerAsyncOperationType::TryUpdateScaleWithAnimation:
00241         return L"TryUpdateScaleWithAnimation";
00242     default:
00243         MUX_ASSERT(false);
00244         return L"";
00245     }
00246 }
00247
00248 winrt::hstring InteractionTrackerAsyncOperationTriggerToString(InteractionTrackerAsyncOperationTrigger operationTrigger)
00249 {
00250     switch (static_cast<int>(operationTrigger))
00251     {
00252     case static_cast<int>(InteractionTrackerAsyncOperationTrigger::DirectViewChange):
00253         return L"DirectViewChange";
00254     case static_cast<int>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest):
00255         return L"HorizontalScrollControllerRequest";
00256     case static_cast<int>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest):
00257         return L"VerticalScrollControllerRequest";
00258     case static_cast<int>(InteractionTrackerAsyncOperationTrigger::BringIntoViewRequest):
00259         return L"BringIntoViewRequest";
00260     case static_cast<int>(InteractionTrackerAsyncOperationTrigger::HorizontalScrollControllerRequest) |
00261          static_cast<int>(InteractionTrackerAsyncOperationTrigger::VerticalScrollControllerRequest):
00262         return L"HorizontalScrollControllerRequest | VerticalScrollControllerRequest";
00263     default:
00264         MUX_ASSERT(false);
00265         return L"";
00266     }
00267 }
00268
00269 }
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ScrollView.properties.h Source File

  • Generated

ScrollView.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class ScrollViewProperties
00008 {
00009 public:
00010     ScrollViewProperties();
00011
00012     void ComputedHorizontalScrollBarVisibility(winrt::Visibility const& value);
00013     winrt::Visibility ComputedHorizontalScrollBarVisibility();
00014
00015     void ComputedHorizontalScrollMode(winrt::ScrollingScrollMode const& value);
00016     winrt::ScrollingScrollMode ComputedHorizontalScrollMode();
00017
00018     void ComputedVerticalScrollBarVisibility(winrt::Visibility const& value);
00019     winrt::Visibility ComputedVerticalScrollBarVisibility();
00020
00021     void ComputedVerticalScrollMode(winrt::ScrollingScrollMode const& value);
00022     winrt::ScrollingScrollMode ComputedVerticalScrollMode();
00023
00024     void Content(winrt::UIElement const& value);
00025     winrt::UIElement Content();
00026
00027     void ContentOrientation(winrt::ScrollingContentOrientation const& value);
00028     winrt::ScrollingContentOrientation ContentOrientation();
00029
00030     void HorizontalAnchorRatio(double value);
00031     double HorizontalAnchorRatio();
00032
00033     void HorizontalScrollBarVisibility(winrt::ScrollingScrollBarVisibility const& value);
00034     winrt::ScrollingScrollBarVisibility HorizontalScrollBarVisibility();
00035
00036     void HorizontalScrollChainMode(winrt::ScrollingChainMode const& value);
00037     winrt::ScrollingChainMode HorizontalScrollChainMode();
00038
00039     void HorizontalScrollMode(winrt::ScrollingScrollMode const& value);
00040     winrt::ScrollingScrollMode HorizontalScrollMode();
00041
00042     void HorizontalScrollRailMode(winrt::ScrollingRailMode const& value);
00043     winrt::ScrollingRailMode HorizontalScrollRailMode();
00044
00045     void IgnoredInputKinds(winrt::ScrollingInputKinds const& value);
00046     winrt::ScrollingInputKinds IgnoredInputKinds();
00047
00048     void MaxZoomFactor(double value);
00049     double MaxZoomFactor();
00050
00051     void MinZoomFactor(double value);
00052     double MinZoomFactor();
00053
00054     void ScrollPresenter(winrt::ScrollPresenter const& value);
00055     winrt::ScrollPresenter ScrollPresenter();
00056
00057     void VerticalAnchorRatio(double value);
00058     double VerticalAnchorRatio();
00059
00060     void VerticalScrollBarVisibility(winrt::ScrollingScrollBarVisibility const& value);
00061     winrt::ScrollingScrollBarVisibility VerticalScrollBarVisibility();
00062
00063     void VerticalScrollChainMode(winrt::ScrollingChainMode const& value);
00064     winrt::ScrollingChainMode VerticalScrollChainMode();
00065
00066     void VerticalScrollMode(winrt::ScrollingScrollMode const& value);
00067     winrt::ScrollingScrollMode VerticalScrollMode();
00068
00069     void VerticalScrollRailMode(winrt::ScrollingRailMode const& value);
00070     winrt::ScrollingRailMode VerticalScrollRailMode();
00071
00072     void ZoomChainMode(winrt::ScrollingChainMode const& value);
00073     winrt::ScrollingChainMode ZoomChainMode();
00074
00075     void ZoomMode(winrt::ScrollingZoomMode const& value);
00076     winrt::ScrollingZoomMode ZoomMode();
00077
00078     static winrt::DependencyProperty ComputedHorizontalScrollBarVisibilityProperty() { return s_ComputedHorizontalScrollBarVisibilityProperty; }
00079     static winrt::DependencyProperty ComputedHorizontalScrollModeProperty() { return s_ComputedHorizontalScrollModeProperty; }
00080     static winrt::DependencyProperty ComputedVerticalScrollBarVisibilityProperty() { return s_ComputedVerticalScrollBarVisibilityProperty; }
00081     static winrt::DependencyProperty ComputedVerticalScrollModeProperty() { return s_ComputedVerticalScrollModeProperty; }
00082     static winrt::DependencyProperty ContentProperty() { return s_ContentProperty; }
00083     static winrt::DependencyProperty ContentOrientationProperty() { return s_ContentOrientationProperty; }
00084     static winrt::DependencyProperty HorizontalAnchorRatioProperty() { return s_HorizontalAnchorRatioProperty; }
00085     static winrt::DependencyProperty HorizontalScrollBarVisibilityProperty() { return s_HorizontalScrollBarVisibilityProperty; }
00086     static winrt::DependencyProperty HorizontalScrollChainModeProperty() { return s_HorizontalScrollChainModeProperty; }
00087     static winrt::DependencyProperty HorizontalScrollModeProperty() { return s_HorizontalScrollModeProperty; }
00088     static winrt::DependencyProperty HorizontalScrollRailModeProperty() { return s_HorizontalScrollRailModeProperty; }
00089     static winrt::DependencyProperty IgnoredInputKindsProperty() { return s_IgnoredInputKindsProperty; }
00090     static winrt::DependencyProperty MaxZoomFactorProperty() { return s_MaxZoomFactorProperty; }
00091     static winrt::DependencyProperty MinZoomFactorProperty() { return s_MinZoomFactorProperty; }
00092     static winrt::DependencyProperty ScrollPresenterProperty() { return s_ScrollPresenterProperty; }
00093     static winrt::DependencyProperty VerticalAnchorRatioProperty() { return s_VerticalAnchorRatioProperty; }
00094     static winrt::DependencyProperty VerticalScrollBarVisibilityProperty() { return s_VerticalScrollBarVisibilityProperty; }
00095     static winrt::DependencyProperty VerticalScrollChainModeProperty() { return s_VerticalScrollChainModeProperty; }
00096     static winrt::DependencyProperty VerticalScrollModeProperty() { return s_VerticalScrollModeProperty; }
00097     static winrt::DependencyProperty VerticalScrollRailModeProperty() { return s_VerticalScrollRailModeProperty; }
00098     static winrt::DependencyProperty ZoomChainModeProperty() { return s_ZoomChainModeProperty; }
00099     static winrt::DependencyProperty ZoomModeProperty() { return s_ZoomModeProperty; }
00100
00101     static GlobalDependencyProperty s_ComputedHorizontalScrollBarVisibilityProperty;
00102     static GlobalDependencyProperty s_ComputedHorizontalScrollModeProperty;
00103     static GlobalDependencyProperty s_ComputedVerticalScrollBarVisibilityProperty;
00104     static GlobalDependencyProperty s_ComputedVerticalScrollModeProperty;
00105     static GlobalDependencyProperty s_ContentProperty;
00106     static GlobalDependencyProperty s_ContentOrientationProperty;
00107     static GlobalDependencyProperty s_HorizontalAnchorRatioProperty;
00108     static GlobalDependencyProperty s_HorizontalScrollBarVisibilityProperty;
00109     static GlobalDependencyProperty s_HorizontalScrollChainModeProperty;
00110     static GlobalDependencyProperty s_HorizontalScrollModeProperty;
00111     static GlobalDependencyProperty s_HorizontalScrollRailModeProperty;
00112     static GlobalDependencyProperty s_IgnoredInputKindsProperty;
00113     static GlobalDependencyProperty s_MaxZoomFactorProperty;
00114     static GlobalDependencyProperty s_MinZoomFactorProperty;
00115     static GlobalDependencyProperty s_ScrollPresenterProperty;
00116     static GlobalDependencyProperty s_VerticalAnchorRatioProperty;
00117     static GlobalDependencyProperty s_VerticalScrollBarVisibilityProperty;
00118     static GlobalDependencyProperty s_VerticalScrollChainModeProperty;
00119     static GlobalDependencyProperty s_VerticalScrollModeProperty;
00120     static GlobalDependencyProperty s_VerticalScrollRailModeProperty;
00121     static GlobalDependencyProperty s_ZoomChainModeProperty;
00122     static GlobalDependencyProperty s_ZoomModeProperty;
00123
00124     winrt::event_token AnchorRequested(winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingAnchorRequestedEventArgs> const& value);
00125     void AnchorRequested(winrt::event_token const& token);
00126     winrt::event_token BringingIntoView(winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingBringingIntoViewEventArgs> const& value);
00127     void BringingIntoView(winrt::event_token const& token);
00128     winrt::event_token ExtentChanged(winrt::TypedEventHandler<winrt::ScrollView, winrt::IInspectable> const& value);
00129     void ExtentChanged(winrt::event_token const& token);
00130     winrt::event_token ScrollAnimationStarting(winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingScrollAnimationStartingEventArgs> const& value);
00131     void ScrollAnimationStarting(winrt::event_token const& token);
00132     winrt::event_token ScrollCompleted(winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingScrollCompletedEventArgs> const& value);
00133     void ScrollCompleted(winrt::event_token const& token);
00134     winrt::event_token ScrollStarting(winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingScrollStartingEventArgs> const& value);
00135     void ScrollStarting(winrt::event_token const& token);
00136     winrt::event_token StateChanged(winrt::TypedEventHandler<winrt::ScrollView, winrt::IInspectable> const& value);
00137     void StateChanged(winrt::event_token const& token);
00138     winrt::event_token ViewChanged(winrt::TypedEventHandler<winrt::ScrollView, winrt::IInspectable> const& value);
00139     void ViewChanged(winrt::event_token const& token);
00140     winrt::event_token ZoomAnimationStarting(winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingZoomAnimationStartingEventArgs> const& value);
00141     void ZoomAnimationStarting(winrt::event_token const& token);
00142     winrt::event_token ZoomCompleted(winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingZoomCompletedEventArgs> const& value);
00143     void ZoomCompleted(winrt::event_token const& token);
00144     winrt::event_token ZoomStarting(winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingZoomStartingEventArgs> const& value);
00145     void ZoomStarting(winrt::event_token const& token);
00146
00147     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingAnchorRequestedEventArgs>> m_anchorRequestedEventSource;
00148     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingBringingIntoViewEventArgs>> m_bringingIntoViewEventSource;
00149     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::IInspectable>> m_extentChangedEventSource;
00150     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingScrollAnimationStartingEventArgs>> m_scrollAnimationStartingEventSource;
00151     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingScrollCompletedEventArgs>> m_scrollCompletedEventSource;
00152     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingScrollStartingEventArgs>> m_scrollStartingEventSource;
00153     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::IInspectable>> m_stateChangedEventSource;
00154     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::IInspectable>> m_viewChangedEventSource;
00155     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingZoomAnimationStartingEventArgs>> m_zoomAnimationStartingEventSource;
00156     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingZoomCompletedEventArgs>> m_zoomCompletedEventSource;
00157     event_source<winrt::TypedEventHandler<winrt::ScrollView, winrt::ScrollingZoomStartingEventArgs>> m_zoomStartingEventSource;
00158
00159     static void EnsureProperties();
00160     static void ClearProperties();
00161
00162     static void OnComputedHorizontalScrollBarVisibilityPropertyChanged(
00163         winrt::DependencyObject const& sender,
00164         winrt::DependencyPropertyChangedEventArgs const& args);
00165
00166     static void OnComputedHorizontalScrollModePropertyChanged(
00167         winrt::DependencyObject const& sender,
00168         winrt::DependencyPropertyChangedEventArgs const& args);
00169
00170     static void OnComputedVerticalScrollBarVisibilityPropertyChanged(
00171         winrt::DependencyObject const& sender,
00172         winrt::DependencyPropertyChangedEventArgs const& args);
00173
00174     static void OnComputedVerticalScrollModePropertyChanged(
00175         winrt::DependencyObject const& sender,
00176         winrt::DependencyPropertyChangedEventArgs const& args);
00177
00178     static void OnContentPropertyChanged(
00179         winrt::DependencyObject const& sender,
00180         winrt::DependencyPropertyChangedEventArgs const& args);
00181
00182     static void OnContentOrientationPropertyChanged(
00183         winrt::DependencyObject const& sender,
00184         winrt::DependencyPropertyChangedEventArgs const& args);
00185
00186     static void OnHorizontalAnchorRatioPropertyChanged(
00187         winrt::DependencyObject const& sender,
00188         winrt::DependencyPropertyChangedEventArgs const& args);
00189
00190     static void OnHorizontalScrollBarVisibilityPropertyChanged(
00191         winrt::DependencyObject const& sender,
00192         winrt::DependencyPropertyChangedEventArgs const& args);
00193
00194     static void OnHorizontalScrollChainModePropertyChanged(
00195         winrt::DependencyObject const& sender,
00196         winrt::DependencyPropertyChangedEventArgs const& args);
00197
00198     static void OnHorizontalScrollModePropertyChanged(
00199         winrt::DependencyObject const& sender,
00200         winrt::DependencyPropertyChangedEventArgs const& args);
00201
00202     static void OnHorizontalScrollRailModePropertyChanged(
00203         winrt::DependencyObject const& sender,
00204         winrt::DependencyPropertyChangedEventArgs const& args);
00205
00206     static void OnIgnoredInputKindsPropertyChanged(
00207         winrt::DependencyObject const& sender,
00208         winrt::DependencyPropertyChangedEventArgs const& args);
00209
00210     static void OnMaxZoomFactorPropertyChanged(
00211         winrt::DependencyObject const& sender,
00212         winrt::DependencyPropertyChangedEventArgs const& args);
00213
00214     static void OnMinZoomFactorPropertyChanged(
00215         winrt::DependencyObject const& sender,
00216         winrt::DependencyPropertyChangedEventArgs const& args);
00217
00218     static void OnScrollPresenterPropertyChanged(
00219         winrt::DependencyObject const& sender,
00220         winrt::DependencyPropertyChangedEventArgs const& args);
00221
00222     static void OnVerticalAnchorRatioPropertyChanged(
00223         winrt::DependencyObject const& sender,
00224         winrt::DependencyPropertyChangedEventArgs const& args);
00225
00226     static void OnVerticalScrollBarVisibilityPropertyChanged(
00227         winrt::DependencyObject const& sender,
00228         winrt::DependencyPropertyChangedEventArgs const& args);
00229
00230     static void OnVerticalScrollChainModePropertyChanged(
00231         winrt::DependencyObject const& sender,
00232         winrt::DependencyPropertyChangedEventArgs const& args);
00233
00234     static void OnVerticalScrollModePropertyChanged(
00235         winrt::DependencyObject const& sender,
00236         winrt::DependencyPropertyChangedEventArgs const& args);
00237
00238     static void OnVerticalScrollRailModePropertyChanged(
00239         winrt::DependencyObject const& sender,
00240         winrt::DependencyPropertyChangedEventArgs const& args);
00241
00242     static void OnZoomChainModePropertyChanged(
00243         winrt::DependencyObject const& sender,
00244         winrt::DependencyPropertyChangedEventArgs const& args);
00245
00246     static void OnZoomModePropertyChanged(
00247         winrt::DependencyObject const& sender,
00248         winrt::DependencyPropertyChangedEventArgs const& args);
00249 };
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RepeaterTestUIPage Member List

This is the complete list of members for RepeaterTestUIPage, including all inherited members.
_flowLayout | RepeaterTestUIPage | [private]
_gridLayout | RepeaterTestUIPage | [private]
_stackLayout | RepeaterTestUIPage | [private]
CmbOutputDebugStringLevels_SelectionChanged(object sender, SelectionChangedEventArgs e) | RepeaterTestUIPage | [inline, private]
GetFlowLayout() | RepeaterTestUIPage | [inline, private]
GetGridLayout() | RepeaterTestUIPage | [inline, private]
GetStackLayout() | RepeaterTestUIPage | [inline, private]
RepeaterTestUIPage() | RepeaterTestUIPage | [inline]
Generated on Sun Dec 1 2024 20:54:25 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterTestHooksInteractionSourcesChangedEventArgs.h Source File

  • ScrollPresenter

ScrollPresenterTestHooksInteractionSourcesChangedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ScrollPresenterTestHooksInteractionSourcesChangedEventArgs.g.h"
00007
00008 class ScrollPresenterTestHooksInteractionSourcesChangedEventArgs :
00009     public winrt::implementation::ScrollPresenterTestHooksInteractionSourcesChangedEventArgsT<ScrollPresenterTestHooksInteractionSourcesChangedEventArgs>
00010 {
00011 public:
00012     ScrollPresenterTestHooksInteractionSourcesChangedEventArgs(const winrt::Microsoft::UI::Composition::Interactions::CompositionInteractionSourceCollection& interactionSources);
00013
00014     // IScrollPresenterTestHooksInteractionSourcesChangedEventArgs overrides
00015     winrt::Microsoft::UI::Composition::Interactions::CompositionInteractionSourceCollection InteractionSources();
00016
00017 private:
00018     winrt::Microsoft::UI::Composition::Interactions::CompositionInteractionSourceCollection m_interactionSources{ nullptr };
00019 };
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterTestHooksAnchorEvaluatedEventArgs Member List

This is the complete list of members for ScrollPresenterTestHooksAnchorEvaluatedEventArgs, including all inherited members.
AnchorElement() | ScrollPresenterTestHooksAnchorEvaluatedEventArgs |
m_anchorElement | ScrollPresenterTestHooksAnchorEvaluatedEventArgs | [private]
ScrollPresenterTestHooksAnchorEvaluatedEventArgs(const winrt::UIElement &anchorElement, double viewportAnchorPointHorizontalOffset, double viewportAanchorPointVerticalOffset) | ScrollPresenterTestHooksAnchorEvaluatedEventArgs |
ViewportAnchorPointHorizontalOffset() | ScrollPresenterTestHooksAnchorEvaluatedEventArgs |
ViewportAnchorPointVerticalOffset() | ScrollPresenterTestHooksAnchorEvaluatedEventArgs |
Generated on Sun Dec 1 2024 20:53:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ThreadData Member List

This is the complete list of members for ThreadData, including all inherited members.
m_compositionDevice | ThreadData
m_hmodDComp | ThreadData
m_inkHost | ThreadData
Generated on Sun Dec 1 2024 20:53:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TestControlAutomationPeer Member List

This is the complete list of members for TestControlAutomationPeer, including all inherited members.
GetAutomationControlTypeCore() | TestControlAutomationPeer | [inline, protected]
GetLocalizedControlTypeCore() | TestControlAutomationPeer | [inline, protected]
TestControlAutomationPeer(TestControl owner) | TestControlAutomationPeer | [inline]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/TestUI/ColorPickerPage.xaml.cs Source File

  • ColorPicker
  • TestUI

ColorPickerPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Windows.UI;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Automation;
00008 using Microsoft.UI.Xaml.Controls;
00009 using Microsoft.UI.Xaml.Controls.Primitives;
00010 using Microsoft.UI.Xaml.Media;
00011 using Microsoft.UI.Xaml.Shapes;
00012
00013 namespace MUXControlsTestApp
00014 {
00015     [TopLevelTestPage(Name="ColorPicker", Icon="ColorPicker.png")]
00016     public sealed partial class ColorPickerPage : TestPage
00017     {
00018         ToolTip colorNameToolTip;
00019         Rectangle spectrumRectangle;
00020         FrameworkElement colorSpectrumInputTarget;
00021         Rectangle previousColorRectangle;
00022         Panel selectionEllipsePanel;
00023         Ellipse selectionEllipse;
00024         ButtonBase moreButton;
00025
00026         public ColorPickerPage()
00027         {
00028             this.InitializeComponent();
00029
00030             // Initialize the ColorPicker to a known default color so we have a known starting point.
00031             this.ColorPicker.Color = Microsoft.UI.Colors.Red;
00032
00033             this.ColorPicker.Loaded += ColorPicker_Loaded;
00034
00035             spectrumRectangle = null;
00036             colorSpectrumInputTarget = null;
00037             previousColorRectangle = null;
00038             moreButton = null;
00039
00040             this.RedTextBlock.Text = this.ColorPicker.Color.R.ToString();
00041             this.GreenTextBlock.Text = this.ColorPicker.Color.G.ToString();
00042             this.BlueTextBlock.Text = this.ColorPicker.Color.B.ToString();
00043             this.AlphaTextBlock.Text = this.ColorPicker.Color.A.ToString();
00044
00045             var verifySubclass = new MyColorSpectrum();
00046         }
00047
00048         private void ColorPicker_Loaded(object sender, RoutedEventArgs e)
00049         {
00050             FindAndGiveAutomationIdToVisualChild("ColorSpectrum");
00051
00052             spectrumRectangle = FindVisualChildByName(this.ColorPicker, "SpectrumRectangle") as Rectangle;
00053
00054             if (spectrumRectangle != null)
00055             {
00056                 spectrumRectangle.RegisterPropertyChangedCallback(Shape.FillProperty, new DependencyPropertyChangedCallback(SpectrumRectangleFillChanged));
00057             }
00058
00059             colorSpectrumInputTarget = FindVisualChildByName(this.ColorPicker, "InputTarget") as FrameworkElement;
00060
00061             if (colorSpectrumInputTarget != null)
00062             {
00063                 UpdateHeightFromInputTarget();
00064                 colorSpectrumInputTarget.SizeChanged += ColorSpectrumImage_SizeChanged;
00065             }
00066
00067             ComboBox comboBox = FindVisualChildByName(this.ColorPicker, "ColorRepresentationComboBox") as ComboBox;
00068
00069             if (comboBox != null)
00070             {
00071                 AutomationProperties.SetAutomationId(comboBox.Items[0] as DependencyObject, "RGBComboBoxItem");
00072                 AutomationProperties.SetAutomationId(comboBox.Items[1] as DependencyObject, "HSVComboBoxItem");
00073             }
00074
00075             previousColorRectangle = FindVisualChildByName(this.ColorPicker, "PreviousColorRectangle") as Rectangle;
00076
00077             if (previousColorRectangle != null)
00078             {
00079                 previousColorRectangle.RegisterPropertyChangedCallback(Rectangle.FillProperty, new DependencyPropertyChangedCallback(PreviousColorRectangleFillChanged));
00080             }
00081
00082             selectionEllipsePanel = FindVisualChildByName(this.ColorPicker, "SelectionEllipsePanel") as Panel;
00083
00084             if (selectionEllipsePanel != null)
00085             {
00086                 selectionEllipsePanel.RegisterPropertyChangedCallback(Canvas.LeftProperty, new DependencyPropertyChangedCallback(SelectionEllipsePositionChanged));
00087                 selectionEllipsePanel.RegisterPropertyChangedCallback(Canvas.TopProperty, new DependencyPropertyChangedCallback(SelectionEllipsePositionChanged));
00088
00089                 UpdateSelectionEllipsePosition();
00090             }
00091
00092             selectionEllipse = FindVisualChildByName(this.ColorPicker, "SelectionEllipse") as Ellipse;
00093
00094             if (selectionEllipse != null)
00095             {
00096                 selectionEllipse.RegisterPropertyChangedCallback(Ellipse.StrokeProperty, new DependencyPropertyChangedCallback(SelectionEllipseStrokeChanged));
00097
00098                 UpdateSelectionEllipseColor();
00099
00100                 colorNameToolTip = ToolTipService.GetToolTip(selectionEllipse) as ToolTip;
00101
00102                 if (colorNameToolTip != null)
00103                 {
00104                     colorNameToolTip.RegisterPropertyChangedCallback(ToolTip.ContentProperty, new DependencyPropertyChangedCallback(ColorNameToolTipContentChanged));
00105                     UpdateSelectedColorName();
00106                 }
00107             }
00108
00109             moreButton = FindVisualChildByName(this.ColorPicker, "MoreButton") as ButtonBase;
00110
00111             if (moreButton != null)
00112             {
00113                 AutomationProperties.SetAutomationId(moreButton, "MoreButton");
00114             }
00115
00116             FindAndGiveAutomationIdToVisualChild("ThirdDimensionSlider");
00117             FindAndGiveAutomationIdToVisualChild("AlphaSlider");
00118             FindAndGiveAutomationIdToVisualChild("MoreButtonLabel");
00119             FindAndGiveAutomationIdToVisualChild("ColorRepresentationComboBox");
00120             FindAndGiveAutomationIdToVisualChild("RedTextBox");
00121             FindAndGiveAutomationIdToVisualChild("RedLabel");
00122             FindAndGiveAutomationIdToVisualChild("GreenTextBox");
00123             FindAndGiveAutomationIdToVisualChild("GreenLabel");
00124             FindAndGiveAutomationIdToVisualChild("BlueTextBox");
00125             FindAndGiveAutomationIdToVisualChild("BlueLabel");
00126             FindAndGiveAutomationIdToVisualChild("HueTextBox");
00127             FindAndGiveAutomationIdToVisualChild("HueLabel");
00128             FindAndGiveAutomationIdToVisualChild("SaturationTextBox");
00129             FindAndGiveAutomationIdToVisualChild("SaturationLabel");
00130             FindAndGiveAutomationIdToVisualChild("ValueTextBox");
00131             FindAndGiveAutomationIdToVisualChild("ValueLabel");
00132             FindAndGiveAutomationIdToVisualChild("AlphaTextBox");
00133             FindAndGiveAutomationIdToVisualChild("AlphaLabel");
00134             FindAndGiveAutomationIdToVisualChild("HexTextBox");
00135         }
00136
00137         private void SpectrumRectangleFillChanged(DependencyObject o, DependencyProperty p)
00138         {
00139             if (spectrumRectangle != null && spectrumRectangle.Fill != null)
00140             {
00141                 this.ColorSpectrumLoadedCheckBox.IsChecked = true;
00142             }
00143         }
00144
00145         private void PreviousColorRectangleFillChanged(DependencyObject o, DependencyProperty p)
00146         {
00147             if (previousColorRectangle != null)
00148             {
00149                 SolidColorBrush previousColorBrush = previousColorRectangle.Fill as SolidColorBrush;
00150
00151                 if (previousColorBrush == null)
00152                 {
00153                     this.PreviousRedTextBlock.Text = "";
00154                     this.PreviousGreenTextBlock.Text = "";
00155                     this.PreviousBlueTextBlock.Text = "";
00156                     this.PreviousAlphaTextBlock.Text = "";
00157                 }
00158                 else
00159                 {
00160                     Color previousColor = previousColorBrush.Color;
00161
00162                     this.PreviousRedTextBlock.Text = previousColor.R.ToString();
00163                     this.PreviousGreenTextBlock.Text = previousColor.G.ToString();
00164                     this.PreviousBlueTextBlock.Text = previousColor.B.ToString();
00165                     this.PreviousAlphaTextBlock.Text = previousColor.A.ToString();
00166                 }
00167             }
00168         }
00169
00170         private void SelectionEllipseStrokeChanged(DependencyObject o, DependencyProperty p)
00171         {
00172             UpdateSelectionEllipseColor();
00173         }
00174
00175         private void UpdateSelectionEllipseColor()
00176         {
00177             if (selectionEllipse != null)
00178             {
00179                 SolidColorBrush selectionEllipseStrokeBrush = selectionEllipse.Stroke as SolidColorBrush;
00180
00181                 if (selectionEllipseStrokeBrush != null)
00182                 {
00183                     Color selectionEllipseColor = selectionEllipseStrokeBrush.Color;
00184
00185                     this.EllipseRedTextBlock.Text = selectionEllipseColor.R.ToString();
00186                     this.EllipseGreenTextBlock.Text = selectionEllipseColor.G.ToString();
00187                     this.EllipseBlueTextBlock.Text = selectionEllipseColor.B.ToString();
00188                     this.EllipseAlphaTextBlock.Text = selectionEllipseColor.A.ToString();
00189                 }
00190             }
00191         }
00192
00193         private void SelectionEllipsePositionChanged(DependencyObject o, DependencyProperty p)
00194         {
00195             UpdateSelectionEllipsePosition();
00196         }
00197
00198         private void UpdateSelectionEllipsePosition()
00199         {
00200             if (selectionEllipse != null)
00201             {
00202                 double ellipseX = Canvas.GetLeft(selectionEllipsePanel) + selectionEllipsePanel.Width / 2;
00203                 double ellipseY = Canvas.GetTop(selectionEllipsePanel) + selectionEllipsePanel.Height / 2;
00204
00205                 this.EllipseXTextBlock.Text = Math.Round(ellipseX).ToString();
00206                 this.EllipseYTextBlock.Text = Math.Round(ellipseY).ToString();
00207             }
00208         }
00209
00210         private void ColorNameToolTipContentChanged(DependencyObject o, DependencyProperty p)
00211         {
00212             UpdateSelectedColorName();
00213         }
00214
00215         private void UpdateSelectedColorName()
00216         {
00217             this.SelectedColorNameTextBlock.Text = colorNameToolTip.Content as string ?? "";
00218         }
00219
00220         private void ColorSpectrumImage_SizeChanged(object sender, SizeChangedEventArgs e)
00221         {
00222             UpdateHeightFromInputTarget();
00223         }
00224
00225         private void UpdateHeightFromInputTarget()
00226         {
00227             if (colorSpectrumInputTarget != null)
00228             {
00229                 this.WidthTextBlock.Text = colorSpectrumInputTarget.ActualWidth.ToString();
00230                 this.HeightTextBlock.Text = colorSpectrumInputTarget.ActualHeight.ToString();
00231             }
00232         }
00233
00234         private void ColorSpectrumShapeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00235         {
00236             ComboBox comboBox = (ComboBox)sender;
00237
00238             switch (comboBox.SelectedIndex)
00239             {
00240                 case 0:
00241                     this.ColorPicker.ColorSpectrumShape = ColorSpectrumShape.Box;
00242                     break;
00243                 case 1:
00244                     this.ColorPicker.ColorSpectrumShape = ColorSpectrumShape.Ring;
00245                     break;
00246             }
00247         }
00248
00249         private void ColorSpectrumComponentsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00250         {
00251             ComboBox comboBox = (ComboBox)sender;
00252
00253             switch (comboBox.SelectedIndex)
00254             {
00255                 case 0:
00256                     this.ColorPicker.ColorSpectrumComponents = ColorSpectrumComponents.HueSaturation;
00257                     break;
00258                 case 1:
00259                     this.ColorPicker.ColorSpectrumComponents = ColorSpectrumComponents.HueValue;
00260                     break;
00261                 case 2:
00262                     this.ColorPicker.ColorSpectrumComponents = ColorSpectrumComponents.SaturationHue;
00263                     break;
00264                 case 3:
00265                     this.ColorPicker.ColorSpectrumComponents = ColorSpectrumComponents.SaturationValue;
00266                     break;
00267                 case 4:
00268                     this.ColorPicker.ColorSpectrumComponents = ColorSpectrumComponents.ValueHue;
00269                     break;
00270                 case 5:
00271                     this.ColorPicker.ColorSpectrumComponents = ColorSpectrumComponents.ValueSaturation;
00272                     break;
00273             }
00274         }
00275
00276         private void ColorPicker_ColorChanged(ColorPicker sender, ColorChangedEventArgs args)
00277         {
00278             this.ColorFromEventRectangle.Fill = new SolidColorBrush(args.NewColor);
00279
00280             this.RedTextBlock.Text = args.NewColor.R.ToString();
00281             this.GreenTextBlock.Text = args.NewColor.G.ToString();
00282             this.BlueTextBlock.Text = args.NewColor.B.ToString();
00283             this.AlphaTextBlock.Text = args.NewColor.A.ToString();
00284
00285             this.OldRedTextBlock.Text = args.OldColor.R.ToString();
00286             this.OldGreenTextBlock.Text = args.OldColor.G.ToString();
00287             this.OldBlueTextBlock.Text = args.OldColor.B.ToString();
00288             this.OldAlphaTextBlock.Text = args.OldColor.A.ToString();
00289         }
00290
00291         private void FindAndGiveAutomationIdToVisualChild(string childName)
00292         {
00293             DependencyObject obj = FindVisualChildByName(this.ColorPicker, childName);
00294
00295             if (obj != null)
00296             {
00297                 AutomationProperties.SetAutomationId(obj, childName);
00298             }
00299         }
00300
00301         private void ThemeLightButton_Click(object sender, RoutedEventArgs e)
00302         {
00303             this.RequestedTheme = ElementTheme.Light;
00304             this.MoreButtonBackgroundTextBlock.Text = (moreButton.Background as SolidColorBrush).Color.ToString();
00305             this.MoreButtonForegroundTextBlock.Text = (moreButton.Foreground as SolidColorBrush).Color.ToString();
00306             this.MoreButtonBorderBrushTextBlock.Text = (moreButton.BorderBrush as SolidColorBrush).Color.ToString();
00307         }
00308
00309         private void ThemeDarkButton_Click(object sender, RoutedEventArgs e)
00310         {
00311             this.RequestedTheme = ElementTheme.Dark;
00312             this.MoreButtonBackgroundTextBlock.Text = (moreButton.Background as SolidColorBrush).Color.ToString();
00313             this.MoreButtonForegroundTextBlock.Text = (moreButton.Foreground as SolidColorBrush).Color.ToString();
00314             this.MoreButtonBorderBrushTextBlock.Text = (moreButton.BorderBrush as SolidColorBrush).Color.ToString();
00315         }
00316
00317         private void ColorWhiteButton_Click(object sender, RoutedEventArgs e)
00318         {
00319             this.ColorPicker.Color = Microsoft.UI.Colors.White;
00320         }
00321
00322         private void ColorRedButton_Click(object sender, RoutedEventArgs e)
00323         {
00324             this.ColorPicker.Color = Microsoft.UI.Colors.Red;
00325         }
00326
00327         private void ColorGreenButton_Click(object sender, RoutedEventArgs e)
00328         {
00329             this.ColorPicker.Color = Microsoft.UI.Colors.Green;
00330         }
00331
00332         private void ColorBlueButton_Click(object sender, RoutedEventArgs e)
00333         {
00334             this.ColorPicker.Color = Microsoft.UI.Colors.Blue;
00335         }
00336
00337         private void PreviousColorNullButton_Click(object sender, RoutedEventArgs e)
00338         {
00339             this.ColorPicker.PreviousColor = null;
00340         }
00341
00342         private void PreviousColorRedButton_Click(object sender, RoutedEventArgs e)
00343         {
00344             this.ColorPicker.PreviousColor = Microsoft.UI.Colors.Red;
00345         }
00346
00347         private void PreviousColorGreenButton_Click(object sender, RoutedEventArgs e)
00348         {
00349             this.ColorPicker.PreviousColor = Microsoft.UI.Colors.Green;
00350         }
00351
00352         private void PreviousColorBlueButton_Click(object sender, RoutedEventArgs e)
00353         {
00354             this.ColorPicker.PreviousColor = Microsoft.UI.Colors.Blue;
00355         }
00356
00357         private void PreviousColorCurrentColorButton_Click(object sender, RoutedEventArgs e)
00358         {
00359             this.ColorPicker.PreviousColor = this.ColorPicker.Color;
00360         }
00361
00362         private void TestPage_GotFocus(object sender, RoutedEventArgs e)
00363         {
00364             FrameworkElement focusedElement = e.OriginalSource as FrameworkElement;
00365
00366             if (focusedElement != null)
00367             {
00368                 this.CurrentlyFocusedElementTextBlock.Text = string.IsNullOrEmpty(focusedElement.Name) ? "(an unnamed element)" : focusedElement.Name;
00369             }
00370             else
00371             {
00372                 this.CurrentlyFocusedElementTextBlock.Text = "(nothing)";
00373             }
00374         }
00375
00376         private void RTLCheckBox_Checked(object sender, RoutedEventArgs e)
00377         {
00378             this.ColorPicker.FlowDirection = FlowDirection.RightToLeft;
00379         }
00380
00381         private void RTLCheckBox_Unchecked(object sender, RoutedEventArgs e)
00382         {
00383             this.ColorPicker.FlowDirection = FlowDirection.LeftToRight;
00384         }
00385
00386         private void OrientationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00387         {
00388             this.ColorPicker.Orientation = ((e.AddedItems[0] as ComboBoxItem).Content as string) == "Horizontal" ? Orientation.Horizontal : Orientation.Vertical;
00389         }
00390     }
00391
00392     public class MyColorSpectrum : ColorSpectrum
00393     {
00394         protected override void OnApplyTemplate()
00395         {
00396             // add an override just to exercise the override chaining.
00397             base.OnApplyTemplate();
00398         }
00399     }
00400 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/InfoBarClosingEventArgs.cpp Source File

  • InfoBar

InfoBarClosingEventArgs.cpp

Go to the documentation of this file.
00001 ﻿#include "pch.h"
00002 #include "common.h"
00003 #include "InfoBarClosingEventArgs.h"
00004
00005 winrt::InfoBarCloseReason InfoBarClosingEventArgs::Reason()
00006 {
00007     return m_reason;
00008 }
00009
00010 void InfoBarClosingEventArgs::Reason(const winrt::InfoBarCloseReason& reason)
00011 {
00012     m_reason = reason;
00013 }
00014
00015 bool InfoBarClosingEventArgs::Cancel()
00016 {
00017     return m_cancel;
00018 }
00019
00020 void InfoBarClosingEventArgs::Cancel(const bool cancel)
00021 {
00022     m_cancel = cancel;
00023 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/SelectorBarItemAutomationPeer.properties.cpp Source File

  • Generated

SelectorBarItemAutomationPeer.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "SelectorBarItemAutomationPeer.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Automation::Peers
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(SelectorBarItemAutomationPeer)
00012 }
00013
00014 #include "SelectorBarItemAutomationPeer.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Breadcrumb/BreadcrumbBarItemAutomationPeer.cpp Source File

  • Breadcrumb

BreadcrumbBarItemAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "BreadcrumbBarItem.h"
00008 #include "BreadcrumbBarItemAutomationPeer.h"
00009 #include "BreadcrumbBarItemAutomationPeer.properties.cpp"
00010
00011 BreadcrumbBarItemAutomationPeer::BreadcrumbBarItemAutomationPeer(winrt::BreadcrumbBarItem const& owner)
00012     : ReferenceTracker(owner)
00013 {
00014 }
00015
00016 // IAutomationPeerOverrides
00017 hstring BreadcrumbBarItemAutomationPeer::GetLocalizedControlTypeCore()
00018 {
00019     return ResourceAccessor::GetLocalizedStringResource(SR_BreadcrumbBarItemLocalizedControlType);
00020 }
00021
00022 winrt::IInspectable BreadcrumbBarItemAutomationPeer::GetPatternCore(winrt::PatternInterface const& patternInterface)
00023 {
00024     if (patternInterface == winrt::PatternInterface::Invoke)
00025     {
00026         return *this;
00027     }
00028
00029     return __super::GetPatternCore(patternInterface);
00030 }
00031
00032 hstring BreadcrumbBarItemAutomationPeer::GetClassNameCore()
00033 {
00034     return winrt::hstring_name_of<winrt::BreadcrumbBarItem>();
00035 }
00036
00037 winrt::AutomationControlType BreadcrumbBarItemAutomationPeer::GetAutomationControlTypeCore()
00038 {
00039     return winrt::AutomationControlType::Button;
00040 }
00041
00042 com_ptr<BreadcrumbBarItem> BreadcrumbBarItemAutomationPeer::GetImpl()
00043 {
00044     com_ptr<BreadcrumbBarItem> impl = nullptr;
00045
00046     if (auto breadcrumbItem = Owner().try_as<winrt::BreadcrumbBarItem>())
00047     {
00048         impl = winrt::get_self<BreadcrumbBarItem>(breadcrumbItem)->get_strong();
00049     }
00050
00051     return impl;
00052 }
00053
00054 // IInvokeProvider
00055 void BreadcrumbBarItemAutomationPeer::Invoke()
00056 {
00057     if (auto breadcrumbItem = GetImpl())
00058     {
00059         breadcrumbItem->OnClickEvent(nullptr, nullptr);
00060     }
00061 }
Generated on Sun Dec 1 2024 20:51:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InfoBadge.properties.h Source File

  • Generated

InfoBadge.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InfoBadgeProperties
00008 {
00009 public:
00010     InfoBadgeProperties();
00011
00012     void IconSource(winrt::IconSource const& value);
00013     winrt::IconSource IconSource();
00014
00015     void TemplateSettings(winrt::InfoBadgeTemplateSettings const& value);
00016     winrt::InfoBadgeTemplateSettings TemplateSettings();
00017
00018     void Value(int value);
00019     int Value();
00020
00021     static winrt::DependencyProperty IconSourceProperty() { return s_IconSourceProperty; }
00022     static winrt::DependencyProperty TemplateSettingsProperty() { return s_TemplateSettingsProperty; }
00023     static winrt::DependencyProperty ValueProperty() { return s_ValueProperty; }
00024
00025     static GlobalDependencyProperty s_IconSourceProperty;
00026     static GlobalDependencyProperty s_TemplateSettingsProperty;
00027     static GlobalDependencyProperty s_ValueProperty;
00028
00029     static void EnsureProperties();
00030     static void ClearProperties();
00031
00032     static void OnIconSourcePropertyChanged(
00033         winrt::DependencyObject const& sender,
00034         winrt::DependencyPropertyChangedEventArgs const& args);
00035
00036     static void OnTemplateSettingsPropertyChanged(
00037         winrt::DependencyObject const& sender,
00038         winrt::DependencyPropertyChangedEventArgs const& args);
00039
00040     static void OnValuePropertyChanged(
00041         winrt::DependencyObject const& sender,
00042         winrt::DependencyPropertyChangedEventArgs const& args);
00043 };
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CommandBarSummaryPage Member List

This is the complete list of members for CommandBarSummaryPage, including all inherited members.
CB_Closed(object sender, object e) | CommandBarSummaryPage | [inline, private]
CB_Opened(object sender, object e) | CommandBarSummaryPage | [inline, private]
CmbClosedDisplayMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CmbDefaultLabelPosition_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CmbFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CmbHasSecondaryCommand_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CmbHasSplitButton_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CmbHasToggleSplitButton_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CmbIsDynamicOverflowEnabled_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CmbIsOpen_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CmbLabelLength_SelectionChanged(object sender, SelectionChangedEventArgs e) | CommandBarSummaryPage | [inline, private]
CommandBarSummaryPage() | CommandBarSummaryPage | [inline]
Generated on Sun Dec 1 2024 20:54:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InkToolBar/InkToolBarMenuButton.h Source File

  • InkToolBar

InkToolBarMenuButton.h

Go to the documentation of this file.
00001 // AUTOGENERATED_FOR_WINRT
00002 // Copyright (c) Microsoft Corporation. All rights reserved.
00003 // Licensed under the MIT License. See LICENSE in the project root for license information.
00004
00005 #pragma once
00006
00007 #include "pch.h"
00008 #include "common.h"
00009
00010 #include "InkToolBarMenuButton.g.h"
00011 #include "InkToolBarMenuButton.properties.h"
00012
00013 class InkToolBarMenuButton :
00014     public ReferenceTracker<InkToolBarMenuButton, winrt::implementation::InkToolBarMenuButtonT, winrt::composable>,
00015     public InkToolBarMenuButtonProperties
00016 {
00017 public:
00018
00019     winrt::InkToolBarMenuKind MenuKind() { winrt::throw_hresult(E_NOTIMPL); }
00020     bool IsExtensionGlyphShown() { winrt::throw_hresult(E_NOTIMPL); }
00021     void IsExtensionGlyphShown(bool value) { winrt::throw_hresult(E_NOTIMPL); }
00022 };
00023
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/IFlowLayoutAlgorithmDelegates.h Source File

  • Repeater

IFlowLayoutAlgorithmDelegates.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 class IFlowLayoutAlgorithmDelegates
00007 {
00008 public:
00009     virtual ~IFlowLayoutAlgorithmDelegates() = default;
00010
00011     virtual winrt::Size Algorithm_GetMeasureSize(int index, const winrt::Size& availableSize, const winrt::VirtualizingLayoutContext& context) = 0;
00012     virtual winrt::Size Algorithm_GetProvisionalArrangeSize(int index, const winrt::Size& measureSize, winrt::Size const& desiredSize, const winrt::VirtualizingLayoutContext& context) = 0;
00013     virtual bool Algorithm_ShouldBreakLine(int index, double remainingSpace) = 0;
00014     virtual winrt::FlowLayoutAnchorInfo Algorithm_GetAnchorForRealizationRect(const winrt::Size& availableSize, const winrt::VirtualizingLayoutContext& context) = 0;
00015     virtual winrt::FlowLayoutAnchorInfo Algorithm_GetAnchorForTargetElement(int targetIndex, const winrt::Size& availableSize, const winrt::VirtualizingLayoutContext& context) = 0;
00016     virtual winrt::Rect Algorithm_GetExtent(const winrt::Size& availableSize,
00017         const winrt::VirtualizingLayoutContext& context,
00018         const winrt::UIElement& firstRealized,
00019         int firstRealizedItemIndex,
00020         const winrt::Rect& firstRealizedLayoutBounds,
00021         const winrt::UIElement& lastRealized,
00022         int lastRealizedItemIndex,
00023         const winrt::Rect& lastRealizedLayoutBounds) = 0;
00024     virtual void Algorithm_OnElementMeasured(
00025         const winrt::UIElement& element,
00026         int index,
00027         const winrt::Size& availableSize,
00028         const winrt::Size& measureSize,
00029         const winrt::Size& desiredSize,
00030         const winrt::Size& provisionalArrangeSize,
00031         const winrt::VirtualizingLayoutContext& context) = 0;
00032     virtual void Algorithm_OnLineArranged(
00033         int startIndex,
00034         int countInLine,
00035         double lineSize,
00036         const winrt::VirtualizingLayoutContext& context) = 0;
00037 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/ScrollPresenter.properties.h Source File

  • Generated

ScrollPresenter.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class ScrollPresenterProperties
00008 {
00009 public:
00010     ScrollPresenterProperties();
00011
00012     void Background(winrt::Brush const& value);
00013     winrt::Brush Background();
00014
00015     void ComputedHorizontalScrollMode(winrt::ScrollingScrollMode const& value);
00016     winrt::ScrollingScrollMode ComputedHorizontalScrollMode();
00017
00018     void ComputedVerticalScrollMode(winrt::ScrollingScrollMode const& value);
00019     winrt::ScrollingScrollMode ComputedVerticalScrollMode();
00020
00021     void Content(winrt::UIElement const& value);
00022     winrt::UIElement Content();
00023
00024     void ContentOrientation(winrt::ScrollingContentOrientation const& value);
00025     winrt::ScrollingContentOrientation ContentOrientation();
00026
00027     void HorizontalAnchorRatio(double value);
00028     double HorizontalAnchorRatio();
00029
00030     void HorizontalScrollChainMode(winrt::ScrollingChainMode const& value);
00031     winrt::ScrollingChainMode HorizontalScrollChainMode();
00032
00033     void HorizontalScrollMode(winrt::ScrollingScrollMode const& value);
00034     winrt::ScrollingScrollMode HorizontalScrollMode();
00035
00036     void HorizontalScrollRailMode(winrt::ScrollingRailMode const& value);
00037     winrt::ScrollingRailMode HorizontalScrollRailMode();
00038
00039     void IgnoredInputKinds(winrt::ScrollingInputKinds const& value);
00040     winrt::ScrollingInputKinds IgnoredInputKinds();
00041
00042     void MaxZoomFactor(double value);
00043     double MaxZoomFactor();
00044
00045     void MinZoomFactor(double value);
00046     double MinZoomFactor();
00047
00048     void VerticalAnchorRatio(double value);
00049     double VerticalAnchorRatio();
00050
00051     void VerticalScrollChainMode(winrt::ScrollingChainMode const& value);
00052     winrt::ScrollingChainMode VerticalScrollChainMode();
00053
00054     void VerticalScrollMode(winrt::ScrollingScrollMode const& value);
00055     winrt::ScrollingScrollMode VerticalScrollMode();
00056
00057     void VerticalScrollRailMode(winrt::ScrollingRailMode const& value);
00058     winrt::ScrollingRailMode VerticalScrollRailMode();
00059
00060     void ZoomChainMode(winrt::ScrollingChainMode const& value);
00061     winrt::ScrollingChainMode ZoomChainMode();
00062
00063     void ZoomMode(winrt::ScrollingZoomMode const& value);
00064     winrt::ScrollingZoomMode ZoomMode();
00065
00066     static winrt::DependencyProperty BackgroundProperty() { return s_BackgroundProperty; }
00067     static winrt::DependencyProperty ComputedHorizontalScrollModeProperty() { return s_ComputedHorizontalScrollModeProperty; }
00068     static winrt::DependencyProperty ComputedVerticalScrollModeProperty() { return s_ComputedVerticalScrollModeProperty; }
00069     static winrt::DependencyProperty ContentProperty() { return s_ContentProperty; }
00070     static winrt::DependencyProperty ContentOrientationProperty() { return s_ContentOrientationProperty; }
00071     static winrt::DependencyProperty HorizontalAnchorRatioProperty() { return s_HorizontalAnchorRatioProperty; }
00072     static winrt::DependencyProperty HorizontalScrollChainModeProperty() { return s_HorizontalScrollChainModeProperty; }
00073     static winrt::DependencyProperty HorizontalScrollModeProperty() { return s_HorizontalScrollModeProperty; }
00074     static winrt::DependencyProperty HorizontalScrollRailModeProperty() { return s_HorizontalScrollRailModeProperty; }
00075     static winrt::DependencyProperty IgnoredInputKindsProperty() { return s_IgnoredInputKindsProperty; }
00076     static winrt::DependencyProperty MaxZoomFactorProperty() { return s_MaxZoomFactorProperty; }
00077     static winrt::DependencyProperty MinZoomFactorProperty() { return s_MinZoomFactorProperty; }
00078     static winrt::DependencyProperty VerticalAnchorRatioProperty() { return s_VerticalAnchorRatioProperty; }
00079     static winrt::DependencyProperty VerticalScrollChainModeProperty() { return s_VerticalScrollChainModeProperty; }
00080     static winrt::DependencyProperty VerticalScrollModeProperty() { return s_VerticalScrollModeProperty; }
00081     static winrt::DependencyProperty VerticalScrollRailModeProperty() { return s_VerticalScrollRailModeProperty; }
00082     static winrt::DependencyProperty ZoomChainModeProperty() { return s_ZoomChainModeProperty; }
00083     static winrt::DependencyProperty ZoomModeProperty() { return s_ZoomModeProperty; }
00084
00085     static GlobalDependencyProperty s_BackgroundProperty;
00086     static GlobalDependencyProperty s_ComputedHorizontalScrollModeProperty;
00087     static GlobalDependencyProperty s_ComputedVerticalScrollModeProperty;
00088     static GlobalDependencyProperty s_ContentProperty;
00089     static GlobalDependencyProperty s_ContentOrientationProperty;
00090     static GlobalDependencyProperty s_HorizontalAnchorRatioProperty;
00091     static GlobalDependencyProperty s_HorizontalScrollChainModeProperty;
00092     static GlobalDependencyProperty s_HorizontalScrollModeProperty;
00093     static GlobalDependencyProperty s_HorizontalScrollRailModeProperty;
00094     static GlobalDependencyProperty s_IgnoredInputKindsProperty;
00095     static GlobalDependencyProperty s_MaxZoomFactorProperty;
00096     static GlobalDependencyProperty s_MinZoomFactorProperty;
00097     static GlobalDependencyProperty s_VerticalAnchorRatioProperty;
00098     static GlobalDependencyProperty s_VerticalScrollChainModeProperty;
00099     static GlobalDependencyProperty s_VerticalScrollModeProperty;
00100     static GlobalDependencyProperty s_VerticalScrollRailModeProperty;
00101     static GlobalDependencyProperty s_ZoomChainModeProperty;
00102     static GlobalDependencyProperty s_ZoomModeProperty;
00103
00104     winrt::event_token AnchorRequested(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingAnchorRequestedEventArgs> const& value);
00105     void AnchorRequested(winrt::event_token const& token);
00106     winrt::event_token BringingIntoView(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingBringingIntoViewEventArgs> const& value);
00107     void BringingIntoView(winrt::event_token const& token);
00108     winrt::event_token ExtentChanged(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable> const& value);
00109     void ExtentChanged(winrt::event_token const& token);
00110     winrt::event_token ScrollAnimationStarting(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingScrollAnimationStartingEventArgs> const& value);
00111     void ScrollAnimationStarting(winrt::event_token const& token);
00112     winrt::event_token ScrollCompleted(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingScrollCompletedEventArgs> const& value);
00113     void ScrollCompleted(winrt::event_token const& token);
00114     winrt::event_token ScrollStarting(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingScrollStartingEventArgs> const& value);
00115     void ScrollStarting(winrt::event_token const& token);
00116     winrt::event_token StateChanged(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable> const& value);
00117     void StateChanged(winrt::event_token const& token);
00118     winrt::event_token ViewChanged(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable> const& value);
00119     void ViewChanged(winrt::event_token const& token);
00120     winrt::event_token ZoomAnimationStarting(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingZoomAnimationStartingEventArgs> const& value);
00121     void ZoomAnimationStarting(winrt::event_token const& token);
00122     winrt::event_token ZoomCompleted(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingZoomCompletedEventArgs> const& value);
00123     void ZoomCompleted(winrt::event_token const& token);
00124     winrt::event_token ZoomStarting(winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingZoomStartingEventArgs> const& value);
00125     void ZoomStarting(winrt::event_token const& token);
00126
00127     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingAnchorRequestedEventArgs>> m_anchorRequestedEventSource;
00128     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingBringingIntoViewEventArgs>> m_bringingIntoViewEventSource;
00129     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable>> m_extentChangedEventSource;
00130     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingScrollAnimationStartingEventArgs>> m_scrollAnimationStartingEventSource;
00131     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingScrollCompletedEventArgs>> m_scrollCompletedEventSource;
00132     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingScrollStartingEventArgs>> m_scrollStartingEventSource;
00133     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable>> m_stateChangedEventSource;
00134     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::IInspectable>> m_viewChangedEventSource;
00135     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingZoomAnimationStartingEventArgs>> m_zoomAnimationStartingEventSource;
00136     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingZoomCompletedEventArgs>> m_zoomCompletedEventSource;
00137     event_source<winrt::TypedEventHandler<winrt::ScrollPresenter, winrt::ScrollingZoomStartingEventArgs>> m_zoomStartingEventSource;
00138
00139     static void EnsureProperties();
00140     static void ClearProperties();
00141
00142     static void OnBackgroundPropertyChanged(
00143         winrt::DependencyObject const& sender,
00144         winrt::DependencyPropertyChangedEventArgs const& args);
00145
00146     static void OnComputedHorizontalScrollModePropertyChanged(
00147         winrt::DependencyObject const& sender,
00148         winrt::DependencyPropertyChangedEventArgs const& args);
00149
00150     static void OnComputedVerticalScrollModePropertyChanged(
00151         winrt::DependencyObject const& sender,
00152         winrt::DependencyPropertyChangedEventArgs const& args);
00153
00154     static void OnContentPropertyChanged(
00155         winrt::DependencyObject const& sender,
00156         winrt::DependencyPropertyChangedEventArgs const& args);
00157
00158     static void OnContentOrientationPropertyChanged(
00159         winrt::DependencyObject const& sender,
00160         winrt::DependencyPropertyChangedEventArgs const& args);
00161
00162     static void OnHorizontalAnchorRatioPropertyChanged(
00163         winrt::DependencyObject const& sender,
00164         winrt::DependencyPropertyChangedEventArgs const& args);
00165
00166     static void OnHorizontalScrollChainModePropertyChanged(
00167         winrt::DependencyObject const& sender,
00168         winrt::DependencyPropertyChangedEventArgs const& args);
00169
00170     static void OnHorizontalScrollModePropertyChanged(
00171         winrt::DependencyObject const& sender,
00172         winrt::DependencyPropertyChangedEventArgs const& args);
00173
00174     static void OnHorizontalScrollRailModePropertyChanged(
00175         winrt::DependencyObject const& sender,
00176         winrt::DependencyPropertyChangedEventArgs const& args);
00177
00178     static void OnIgnoredInputKindsPropertyChanged(
00179         winrt::DependencyObject const& sender,
00180         winrt::DependencyPropertyChangedEventArgs const& args);
00181
00182     static void OnMaxZoomFactorPropertyChanged(
00183         winrt::DependencyObject const& sender,
00184         winrt::DependencyPropertyChangedEventArgs const& args);
00185
00186     static void OnMinZoomFactorPropertyChanged(
00187         winrt::DependencyObject const& sender,
00188         winrt::DependencyPropertyChangedEventArgs const& args);
00189
00190     static void OnVerticalAnchorRatioPropertyChanged(
00191         winrt::DependencyObject const& sender,
00192         winrt::DependencyPropertyChangedEventArgs const& args);
00193
00194     static void OnVerticalScrollChainModePropertyChanged(
00195         winrt::DependencyObject const& sender,
00196         winrt::DependencyPropertyChangedEventArgs const& args);
00197
00198     static void OnVerticalScrollModePropertyChanged(
00199         winrt::DependencyObject const& sender,
00200         winrt::DependencyPropertyChangedEventArgs const& args);
00201
00202     static void OnVerticalScrollRailModePropertyChanged(
00203         winrt::DependencyObject const& sender,
00204         winrt::DependencyPropertyChangedEventArgs const& args);
00205
00206     static void OnZoomChainModePropertyChanged(
00207         winrt::DependencyObject const& sender,
00208         winrt::DependencyPropertyChangedEventArgs const& args);
00209
00210     static void OnZoomModePropertyChanged(
00211         winrt::DependencyObject const& sender,
00212         winrt::DependencyPropertyChangedEventArgs const& args);
00213 };
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/MultipleSelector.cpp Source File

  • ItemsView

MultipleSelector.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MultipleSelector.h"
00007
00008 MultipleSelector::MultipleSelector()
00009 {
00010     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00011 }
00012
00013 MultipleSelector::~MultipleSelector()
00014 {
00015     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00016 }
00017
00018 void MultipleSelector::OnInteractedAction(winrt::IndexPath const &index, bool ctrl, bool shift)
00019 {
00020     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, ctrl, shift);
00021
00022     auto selectionModel = GetSelectionModel();
00023     if (shift)
00024     {
00025         auto anchorIndex = selectionModel.AnchorIndex();
00026         if (anchorIndex)
00027         {
00028             winrt::IReference<bool> isAnchorSelectedNullable = selectionModel.IsSelectedAt(anchorIndex);
00029             bool isAnchorSelected = false;
00030             if (isAnchorSelectedNullable != nullptr)
00031             {
00032                 isAnchorSelected = isAnchorSelectedNullable.Value();
00033             }
00034
00035             winrt::IReference<bool> isIndexSelectedNullable = selectionModel.IsSelectedAt(index);
00036             bool isIndexSelected = false;
00037             if (isIndexSelectedNullable != nullptr)
00038             {
00039                 isIndexSelected = isIndexSelectedNullable.Value();
00040             }
00041
00042             if (isAnchorSelected != isIndexSelected)
00043             {
00044                 if (isAnchorSelected)
00045                 {
00046                     selectionModel.SelectRangeFromAnchorTo(index);
00047                 }
00048                 else
00049                 {
00050                     selectionModel.DeselectRangeFromAnchorTo(index);
00051                 }
00052             }
00053         }
00054     }
00055     else if (IsSelected(index))
00056     {
00057         selectionModel.DeselectAt(index);
00058     }
00059     else
00060     {
00061         selectionModel.SelectAt(index);
00062     }
00063 }
00064
00065 void MultipleSelector::OnFocusedAction(winrt::IndexPath const &index, bool ctrl, bool shift)
00066 {
00067     ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT_INT, METH_NAME, this, ctrl, shift);
00068
00069     if (shift)
00070     {
00071         auto selectionModel = GetSelectionModel();
00072         auto anchorIndex = selectionModel.AnchorIndex();
00073         if (anchorIndex)
00074         {
00075             winrt::IReference<bool> isAnchorSelectedNullable = selectionModel.IsSelectedAt(anchorIndex);
00076             bool isAnchorSelected = false;
00077             if (isAnchorSelectedNullable != nullptr)
00078             {
00079                 isAnchorSelected = isAnchorSelectedNullable.Value();
00080             }
00081
00082             if (isAnchorSelected)
00083             {
00084                 selectionModel.SelectRangeFromAnchorTo(index);
00085             }
00086             else
00087             {
00088                 selectionModel.DeselectRangeFromAnchorTo(index);
00089             }
00090         }
00091     }
00092 }
Generated on Sun Dec 1 2024 20:51:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/TestUI/RevealStatesPage.xaml.cs Source File

  • Materials
  • Reveal
  • TestUI

RevealStatesPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Linq;
00006 using System.Collections.Generic;
00007 using System.Threading;
00008 using System.Threading.Tasks;
00009 using Windows.Foundation.Metadata;
00010 using Microsoft.UI.Composition;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Automation;
00013 using Microsoft.UI.Xaml.Controls;
00014 using Microsoft.UI.Xaml.Media;
00015 using Microsoft.UI.Xaml.Media.Animation;
00016 using Microsoft.UI.Xaml.Navigation;
00017 using Microsoft.UI.Private.Media;
00018 using MUXControlsTestApp.Utilities;
00019 using Common;
00020
00021 namespace MUXControlsTestApp
00022 {
00023     public sealed partial class RevealStatesPage : TestPage
00024     {
00025         RevealTestApi _revealTestApi;
00026         RevealBrushTestApi _revealBrushTestApi;
00027         int _normalStateCheckNumber = 1;
00028         CompositionPropertyLogger _compositionPropertyLogger;
00029         SpotLight _hoverSpotlight;
00030         SpotLight _pressSpotlight;
00031
00032         // Expressions used to animate RevealHoverLight's Spotlight.Offset for pointer and keyboard input, respectively
00033 #if DEBUG
00034         string revealHoverLightOffset_PointerExpression = "pointer.Position + Vector3(0, 0, props.SpotlightHeight)";
00035         string revealHoverLightOffset_KeyboardExpression = "Vector3((visual.Size.X / 2), (visual.Size.Y / 2), props.SpotlightHeight)";
00036 #else
00037         string revealHoverLightOffset_PointerExpression = "pointer.Position + Vector3(0, 0, 256)";
00038         string revealHoverLightOffset_KeyboardExpression = "Vector3((visual.Size.X / 2), (visual.Size.Y / 2), 256)";
00039 #endif
00040
00041         const float coneIntensityTolerance = 0.1F;
00042         const float coneAngleTolerance = 0.1F;
00043         const float angleInRadiansTolerance = 0.1F;
00044         const float offsetCoordinateTolerance = 3.0F;
00045
00046         const float c_hoverLight_OuterConeAngle_Expected = 0.469878F;         // Does not change for any state.
00047
00048         public RevealStatesPage()
00049         {
00050             this.InitializeComponent();
00051
00052             AutomationProperties.SetName(this, "RevealStatesPage");
00053             AutomationProperties.SetAutomationId(this, "RevealStatesPage");
00054
00055             _revealTestApi = new RevealTestApi();
00056             _revealBrushTestApi = new RevealBrushTestApi();
00057
00058             _compositionPropertyLogger = new CompositionPropertyLogger(this.XamlRoot);
00059
00060             MaterialHelperTestApi.IgnoreAreEffectsFast = true;
00061             MaterialHelperTestApi.SimulateDisabledByPolicy = false;
00062         }
00063
00064         protected override void OnNavigatedFrom(NavigationEventArgs e)
00065         {
00066             // Unset all override flags to avoid impacting subsequent tests
00067             MaterialHelperTestApi.IgnoreAreEffectsFast = false;
00068             MaterialHelperTestApi.SimulateDisabledByPolicy = false;
00069             base.OnNavigatedFrom(e);
00070         }
00071
00072         private void ValidationActionsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
00073         {
00074             var selectedText = ValidationActionsComboBox.GetSelectedText();
00075             switch (selectedText)
00076             {
00077                 case "HoverLight: Validate Normal state": HoverLight_ValidateNormalState(); break;
00078                 case "HoverLight: Validate PointerOver state": HoverLight_ValidatePointerOverState(); break;
00079                 case "BorderLight: Validate after panning away": BorderLight_ValidateBorderLightPanAway(); break;
00080             }
00081         }
00082
00083         private void StartLoggingValues_Click(object sender, RoutedEventArgs e)
00084         {
00085             var selectedText = ValidationActionsComboBox.GetSelectedText();
00086             switch (selectedText)
00087             {
00088                 case "HoverLight: Validate PointerOver state (Values)": HoverLight_ValidatePointerOverState_Values(); break;
00089                 case "HoverLight: Validate Pressed state (Values)": HoverLight_ValidatePressedState_Values(); break;
00090                 case "HoverLight: Validate SlowRelease state (Values)": HoverLight_ValidateSlowRelease_Values(); break;
00091                 case "HoverLight: Validate FastRelease state (Values)": HoverLight_ValidateFastRelease_Values(); break;
00092                 case "HoverLight: Validate Position Offset1 (Values)": HoverLight_ValidatePosition_Offset1_Values(); break;
00093                 case "HoverLight: Validate Position Offset2 (Values)": HoverLight_ValidatePosition_Offset2_Values(); break;
00094                 case "HoverLight: Validate Position Offset3 (Values)": HoverLight_ValidatePosition_Offset3_Values(); break;
00095             }
00096         }
00097
00098         private UIElement GetElementForHoverLight(object element)
00099         {
00100             var target = element as Control;
00101             return VisualTreeHelper.GetChild(target, 0) as UIElement;
00102         }
00103
00104         private void HoverLight_ValidateNormalState()
00105         {
00106             if (!ValidateEffectsPresent()) { return; }
00107
00108             using (var logger = new ResultsLogger("Normal", TestResult))
00109             {
00110                 if (_normalStateCheckNumber < 1 || _normalStateCheckNumber > 2)
00111                 {
00112                     logger.LogError("Error: unpexected call to HoverLight_ValidateNormalState");
00113                     return;
00114                 }
00115
00116                 bool isInitialCheck = _normalStateCheckNumber == 1;
00117                 _normalStateCheckNumber++;
00118
00119                 string targetText = TargetComboBox.GetSelectedText();
00120                 Control target = FindName(targetText) as Control;
00121
00122                 // It is more complex to validate Reveal hover bursh targeting on ListViewItem
00123                 // since it uses several brushes applied to the internal ListViewItemChrome. Skip the check here.
00124                 bool lightTargetingResult = true;
00125                 if (targetText != "NormalListViewItem")
00126                 {
00127                     RevealBrush revealHoverBrush = target.Background as RevealBrush;
00128                     lightTargetingResult = VerifyHoverBrushTargeting(revealHoverBrush);
00129                 }
00130                 logger.Verify(lightTargetingResult, "lightTargetingResult:" + lightTargetingResult);
00131
00132                 var lights = GetElementForHoverLight(target).Lights;
00133
00134                 // No lights expected if we've never hovered over this Button
00135                 bool lightCountResult = isInitialCheck ? lights.Count == 0 : lights.Count == 2;
00136                 logger.Verify(lightCountResult, "lightCountResult:" + lightCountResult);
00137                 bool lightValidationResult = true;
00138
00139                 // If we have hovered over the target, validate Reveal light is properly in normal state
00140                 if (!isInitialCheck)
00141                 {
00142                     var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[0]);
00143                     lightValidationResult = HoverLight_ValidateNormal(hoverLight);
00144                 }
00145                 logger.Verify(lightValidationResult, "lightValidationResult: " + lightValidationResult);
00146             }
00147         }
00148
00149         private void HoverLight_ValidatePointerOverState()
00150         {
00151             if (!ValidateEffectsPresent()) { return; }
00152
00153             using (var logger = new ResultsLogger("PointerOver", TestResult))
00154             {
00155                 string targetText = TargetComboBox.GetSelectedText();
00156                 Control target = FindName(targetText) as Control;
00157
00158                 // It is more complex to validate Reveal hover brush targeting on ListViewItem
00159                 // since it uses several brushes applied to the internal ListViewItemChrome. Skip the check here.
00160                 bool lightTargetingResult = true;
00161                 if (targetText != "NormalListViewItem")
00162                 {
00163                     RevealBrush revealHoverBrush = target.Background as RevealBrush;
00164                     lightTargetingResult = VerifyHoverBrushTargeting(revealHoverBrush);
00165                 }
00166
00167                 logger.Verify(lightTargetingResult, "lightTargetingResult:" + lightTargetingResult);
00168
00169                 var lights = GetElementForHoverLight(target).Lights;
00170
00171                 bool lightCountResult = lights.Count == 2;          // Reveal Press light is also present
00172                 logger.Verify(lightCountResult, "lightCountResult:" + lightCountResult);
00173
00174                 var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[0]);
00175                 logger.Verify(hoverLight != null, "HoverLight should be non-null");
00176
00177                 bool lightValidationResult = HoverLight_ValidatePointerOver(hoverLight);
00178                 logger.Verify(lightValidationResult, "lightValidationResult: " + lightValidationResult);
00179             }
00180         }
00181
00182         private void LargeButton_Click(object sender, RoutedEventArgs e)
00183         {
00184             ValidateLightsOnPressed();
00185         }
00186
00187         private void TestListView_ItemClick(object sender, Microsoft.UI.Xaml.Controls.ItemClickEventArgs e)
00188         {
00189             ValidateLightsOnPressed();
00190         }
00191
00192         private void ValidateLightsOnPressed()
00193         {
00194             if (!ValidateEffectsPresent()) { return; }
00195
00196             string targetText = TargetComboBox.GetSelectedText();
00197             if (targetText == "OneMoreListViewItem") { return; }            // We don't run this test for OneMoreListViewItem
00198
00199             using (var logger = new ResultsLogger("Pressed", TestResult))
00200             {
00201                 Control target = FindName(targetText) as Control;
00202
00203                 // It is more complex to validate Reveal hover brush targeting on ListViewItem
00204                 // since it uses several brushes applied to the internal ListViewItemChrome. Skip the check here.
00205                 bool lightTargetingResult = true;
00206                 if (targetText != "NormalListViewItem")
00207                 {
00208                     RevealBrush revealHoverBrush = target.Background as RevealBrush;
00209                     lightTargetingResult = VerifyHoverBrushTargeting(revealHoverBrush);
00210                 }
00211                 logger.Verify(lightTargetingResult, "lightTargetingResult:" + lightTargetingResult);
00212
00213                 var lights = GetElementForHoverLight(target).Lights;
00214
00215                 bool lightCountResult = lights.Count == 2;   // Reveal Press light is also present
00216                 logger.Verify(lightCountResult, "lightCountResult:" + lightCountResult);
00217                 var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[0]);
00218                 bool lightValidationResult = HoverLight_ValidatePressed(hoverLight);
00219                 logger.Verify(lightValidationResult, "lightValidationResult: " + lightValidationResult);
00220             }
00221         }
00222
00223         bool ValidateEffectsPresent()
00224         {
00225             _revealBrushTestApi.RevealBrush = LargeButton.Background as RevealBrush;
00226             if (_revealBrushTestApi.IsInFallbackMode)
00227             {
00228                 TestResult.Text = "RevealStates: Skipped";
00229                 return false;
00230             }
00231
00232             return true;
00233         }
00234
00235         bool VerifyHoverBrushTargeting(RevealBrush testBrush)
00236         {
00237             return VerifyAmbientLight(testBrush, true) &&
00238                    VerifyBorderLight(testBrush, false) &&
00239                    VerifyHoverLight(testBrush, true);
00240         }
00241
00242         bool VerifyAmbientLight(RevealBrush testBrush, bool value)
00243         {
00244             _revealBrushTestApi.RevealBrush = testBrush;
00245             bool ambientLightSet = _revealBrushTestApi.IsAmbientLightSet;
00246             return value ? ambientLightSet : !ambientLightSet;
00247         }
00248
00249         bool VerifyBorderLight(RevealBrush testBrush, bool value)
00250         {
00251             _revealBrushTestApi.RevealBrush = testBrush;
00252             bool borderLightSet = _revealBrushTestApi.IsBorderLightSet;
00253             return value ? borderLightSet : !borderLightSet;
00254         }
00255
00256         bool VerifyHoverLight(RevealBrush testBrush, bool value)
00257         {
00258             _revealBrushTestApi.RevealBrush = testBrush;
00259             bool hoverLightSet = _revealBrushTestApi.IsHoverLightSet;
00260             return value ? hoverLightSet : !hoverLightSet;
00261         }
00262
00263         private void ElementTheme_Changed(object sender, SelectionChangedEventArgs e)
00264         {
00265             var selectedText = ElementThemeComboBox.GetSelectedText();
00266             switch (selectedText)
00267             {
00268                 case "Default": this.RequestedTheme = ElementTheme.Default; break;
00269                 case "Light": this.RequestedTheme = ElementTheme.Light; break;
00270                 case "Dark": this.RequestedTheme = ElementTheme.Dark; break;
00271             }
00272         }
00273
00274         private void AnotherListViewItem_Holding(object sender, Microsoft.UI.Xaml.Input.HoldingRoutedEventArgs e)
00275         {
00276             if (!ValidateEffectsPresent()) { return; }
00277             using (var logger = new ResultsLogger("BorderLight_TapAndHold", TestResult))
00278             {
00279                 bool shouldBorderLightBeOn = ShouldBorderLightBeOn();
00280                 logger.Verify(shouldBorderLightBeOn == true, "ShouldBorderLightBeOn: " + shouldBorderLightBeOn);
00281             }
00282         }
00283
00284         private void NarrowButton_Holding(object sender, Microsoft.UI.Xaml.Input.HoldingRoutedEventArgs e)
00285         {
00286             if (!ValidateEffectsPresent()) { return; }
00287
00288             using (var logger = new ResultsLogger("HoverLightExpression_Button_Touch", TestResult))
00289             {
00290                 Control target = FindName("NarrowButton") as Control;
00291                 var lights = GetElementForHoverLight(target).Lights;
00292
00293                 var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[0]);
00294                 var offsetExpression = _revealTestApi.GetHoverLightOffsetExpression(hoverLight);
00295                 logger.Verify(String.Equals(offsetExpression.Expression, revealHoverLightOffset_PointerExpression), "HoverLightOffset using incorrect expression: " + offsetExpression.Expression + ", expected: " + revealHoverLightOffset_PointerExpression);
00296             }
00297         }
00298
00299         private void AnotherButton_Click(object sender, RoutedEventArgs e)
00300         {
00301             if (!ValidateEffectsPresent()) { return; }
00302
00303             using (var logger = new ResultsLogger("HoverLightExpression_Button_Keyboard", TestResult))
00304             {
00305                 Control target = FindName("AnotherButton") as Control;
00306                 var lights = GetElementForHoverLight(target).Lights;
00307
00308                 var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[1]);           // Look at the press light
00309                 var offsetExpression = _revealTestApi.GetHoverLightOffsetExpression(hoverLight);
00310                 logger.Verify(String.Equals(offsetExpression.Expression, revealHoverLightOffset_KeyboardExpression), "HoverLightOffset using incorrect expression: " + offsetExpression.Expression + ", expected: " + revealHoverLightOffset_KeyboardExpression);
00311             }
00312         }
00313
00314         private void OneMoreListViewItem_Holding(object sender, Microsoft.UI.Xaml.Input.HoldingRoutedEventArgs e)
00315         {
00316             if (!ValidateEffectsPresent()) { return; }
00317
00318             using (var logger = new ResultsLogger("HoverLightExpression_ListViewItem_Touch", TestResult))
00319             {
00320                 Control target = FindName("OneMoreListViewItem") as Control;
00321                 var lights = GetElementForHoverLight(target).Lights;
00322
00323                 var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[0]);
00324                 var offsetExpression = _revealTestApi.GetHoverLightOffsetExpression(hoverLight);
00325                 logger.Verify(String.Equals(offsetExpression.Expression, revealHoverLightOffset_PointerExpression), "HoverLightOffset using incorrect expression: " + offsetExpression.Expression + ", expected: " + revealHoverLightOffset_PointerExpression);
00326             }
00327         }
00328
00329         private void BorderLight_ValidateBorderLightPanAway()
00330         {
00331             if (!ValidateEffectsPresent()) { return; }
00332
00333             using (var logger = new ResultsLogger("BorderLight_PanAway", TestResult))
00334             {
00335                 bool shouldBorderLightBeOn = ShouldBorderLightBeOn();
00336                 logger.Verify(shouldBorderLightBeOn == false, "ShouldBorderLightBeOn: " + shouldBorderLightBeOn);
00337             }
00338         }
00339
00340         private bool HoverLight_ValidateNormal(RevealHoverLight hoverLight)
00341         {
00342             bool isPressed = _revealTestApi.HoverLight_IsPressed(hoverLight);
00343             bool isPointerOver = _revealTestApi.HoverLight_IsPointerOver(hoverLight);
00344             bool shouldLightBeOn = _revealTestApi.HoverLight_ShouldBeOn(hoverLight);
00345
00346             return !isPressed && !isPointerOver && !shouldLightBeOn;
00347         }
00348
00349         private bool HoverLight_ValidatePointerOver(RevealHoverLight hoverLight)
00350         {
00351             bool isPressed = _revealTestApi.HoverLight_IsPressed(hoverLight);
00352             bool isPointerOver = _revealTestApi.HoverLight_IsPointerOver(hoverLight);
00353             bool shouldLightBeOn = _revealTestApi.HoverLight_ShouldBeOn(hoverLight);
00354
00355             return !isPressed && isPointerOver && shouldLightBeOn;
00356         }
00357
00358         private bool HoverLight_ValidatePressed(RevealHoverLight hoverLight)
00359         {
00360             bool isPressed = _revealTestApi.HoverLight_IsPressed(hoverLight);
00361             bool isPointerOver = _revealTestApi.HoverLight_IsPointerOver(hoverLight);
00362             bool shouldLightBeOn = _revealTestApi.HoverLight_ShouldBeOn(hoverLight);
00363
00364             return isPressed && isPointerOver && shouldLightBeOn;
00365         }
00366
00367         bool ShouldBorderLightBeOn()
00368         {
00369             Microsoft.UI.Xaml.Media.XamlLight xamlLight = _revealTestApi.BorderLight;
00370             RevealBorderLight borderLight = _revealTestApi.GetAsRevealBorderLight(xamlLight);
00371             return _revealTestApi.BorderLight_ShouldBeOn(borderLight);
00372         }
00373
00374         private void SetState_Click(object sender, RoutedEventArgs e)
00375         {
00376             RevealBrushState state = RevealBrushState.Pressed;
00377             RevealBrush.SetState(Border4SetStatePressed, state);
00378             TestResult.Text = "SetState_Click: Clicked";
00379         }
00380
00381         private void HoverLight_ValidatePointerOverState_Values()
00382         {
00383             HoverLightStateValuesValidationHelper(
00384                 1.0F, 1.0F, c_hoverLight_OuterConeAngle_Expected,
00385                 0.0F, 0.0F, 0.1845F,
00386                 "PointerOver_Values",
00387                 "LargeButton2");
00388         }
00389
00390         private void HoverLight_ValidatePressedState_Values()
00391         {
00392             HoverLightStateValuesValidationHelper(
00393                 1.0F, 1.0F, c_hoverLight_OuterConeAngle_Expected,
00394                 1.0F, 1.0F, 0.1845F,
00395                 "Pressed_Values",
00396                 "LargeButton2");
00397         }
00398
00399         private void HoverLight_ValidateSlowRelease_Values()
00400         {
00401             ChainedHoverLightStateValuesValidationHelper(
00402                 1.0F, 1.0F, c_hoverLight_OuterConeAngle_Expected,
00403                 1.0F, 1.0F, 0.1845F,
00404                 1.0F, 1.0F, c_hoverLight_OuterConeAngle_Expected,
00405                 0.0F, 0.0F, 0.6865F,
00406                 "SlowRelease_Values",
00407                 "LargeButton2");
00408         }
00409
00410         private void HoverLight_ValidateFastRelease_Values()
00411         {
00412             // Note that for FastRelease, we expect to go through the same intermiedate and final values
00413             // as SlowReleaseabove, it just happens more quickly.
00414             ChainedHoverLightStateValuesValidationHelper(
00415                 1.0F, 1.0F, c_hoverLight_OuterConeAngle_Expected,
00416                 1.0F, 1.0F, 0.1845F,
00417                 1.0F, 1.0F, c_hoverLight_OuterConeAngle_Expected,
00418                 0.0F, 0.0F, 0.6865F,
00419                 "FastRelease_Values",
00420                 "LargeButton2");
00421         }
00422
00423         private void HoverLightStateValuesValidationHelper(
00424             float hoverLight_InnerConeIntensityExpected, float hoverLight_outerConeIntensityExpected, float hoverLight_outerConeAngleExpected,
00425             float pressLight_InnerConeIntensityExpected, float pressLight_outerConeIntensityExpected, float pressLight_outerConeAngleExpected,
00426             string testName,
00427             string targetName)
00428         {
00429             if (!ValidateEffectsPresent()) { return; }
00430
00431             WaitHandle[] hoverLight_ValueValidationEvents = new WaitHandle[3];
00432             WaitHandle[] pressLight_ValueValidationEvents = new WaitHandle[3];
00433
00434             Control target = FindName(targetName) as Control;
00435             var lights = GetElementForHoverLight(target).Lights;
00436
00437             var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[0]);
00438             var pressLight = _revealTestApi.GetAsRevealHoverLight(lights[1]);
00439             _hoverSpotlight = _revealTestApi.GetSpotLight(hoverLight as Microsoft.UI.Xaml.Media.XamlLight);
00440             _pressSpotlight = _revealTestApi.GetSpotLight(pressLight as Microsoft.UI.Xaml.Media.XamlLight);
00441
00442             hoverLight_ValueValidationEvents[0] = _compositionPropertyLogger.RegisterProperty(_hoverSpotlight, "InnerConeIntensity", CompositionPropertyLogger.LoggableType.Float, 0.0f, hoverLight_InnerConeIntensityExpected, coneIntensityTolerance);
00443             hoverLight_ValueValidationEvents[1] = _compositionPropertyLogger.RegisterProperty(_hoverSpotlight, "OuterConeIntensity", CompositionPropertyLogger.LoggableType.Float, 0.0f, hoverLight_outerConeIntensityExpected, coneIntensityTolerance);
00444             hoverLight_ValueValidationEvents[2] = _compositionPropertyLogger.RegisterProperty(_hoverSpotlight, "OuterConeAngle", CompositionPropertyLogger.LoggableType.Float, 0.0f, hoverLight_outerConeAngleExpected, coneAngleTolerance);
00445
00446             pressLight_ValueValidationEvents[0] = _compositionPropertyLogger.RegisterProperty(_pressSpotlight, "InnerConeIntensity", CompositionPropertyLogger.LoggableType.Float, 0.0f, pressLight_InnerConeIntensityExpected, coneIntensityTolerance);
00447             pressLight_ValueValidationEvents[1] = _compositionPropertyLogger.RegisterProperty(_pressSpotlight, "OuterConeIntensity", CompositionPropertyLogger.LoggableType.Float, 0.0f, pressLight_outerConeIntensityExpected, coneIntensityTolerance);
00448             pressLight_ValueValidationEvents[2] = _compositionPropertyLogger.RegisterProperty(_pressSpotlight, "OuterConeAngle", CompositionPropertyLogger.LoggableType.Float, 0.0f, pressLight_outerConeAngleExpected, coneAngleTolerance);
00449
00450
00451             // Off-thread validation waits until each registered property hits its expected value
00452             Task.Run(() =>
00453             {
00454                 var combined = hoverLight_ValueValidationEvents.Concat(pressLight_ValueValidationEvents).ToArray();
00455                 bool hoverLight_Result = WaitHandle.WaitAll(hoverLight_ValueValidationEvents, 10000);
00456                 bool pressLight_Result = WaitHandle.WaitAll(pressLight_ValueValidationEvents, 10000);
00457                 RunOnUIThread.Execute(() =>
00458                 {
00459                     using (var logger = new ResultsLogger(testName, TestResult))
00460                     {
00461                         var hoverLight_InnerConeIntensityValues = _compositionPropertyLogger.GetValues(_hoverSpotlight, "InnerConeIntensity");
00462                         var hoverLight_OuterConeIntensityValues = _compositionPropertyLogger.GetValues(_hoverSpotlight, "OuterConeIntensity");
00463                         var hoverLight_OuterConeAngleValues = _compositionPropertyLogger.GetValues(_hoverSpotlight, "OuterConeAngle");
00464
00465                         logger.LogMessage("HoverLight - InnerConeIntensity: " + string.Join(", ", hoverLight_InnerConeIntensityValues));
00466                         logger.LogMessage("HoverLight - OuterConeIntensity: " + string.Join(", ", hoverLight_OuterConeIntensityValues));
00467                         logger.LogMessage("HoverLight - OuterConeAngle: " + string.Join(", ", hoverLight_OuterConeAngleValues));
00468
00469                         var pressLight_InnerConeIntensityValues = _compositionPropertyLogger.GetValues(_pressSpotlight, "InnerConeIntensity");
00470                         var pressLight_OuterConeIntensityValues = _compositionPropertyLogger.GetValues(_pressSpotlight, "OuterConeIntensity");
00471                         var pressLight_OuterConeAngleValues = _compositionPropertyLogger.GetValues(_pressSpotlight, "OuterConeAngle");
00472
00473                         logger.LogMessage("PressLight - InnerConeIntensity: " + string.Join(", ", pressLight_InnerConeIntensityValues));
00474                         logger.LogMessage("PressLight - OuterConeIntensity: " + string.Join(", ", pressLight_OuterConeIntensityValues));
00475                         logger.LogMessage("PressLight - OuterConeAngle: " + string.Join(", ", pressLight_OuterConeAngleValues));
00476
00477                         _compositionPropertyLogger.UnregisterProperty(_hoverSpotlight, "InnerConeIntensity", CompositionPropertyLogger.LoggableType.Float);
00478                         _compositionPropertyLogger.UnregisterProperty(_hoverSpotlight, "OuterConeIntensity", CompositionPropertyLogger.LoggableType.Float);
00479                         _compositionPropertyLogger.UnregisterProperty(_hoverSpotlight, "OuterConeAngle", CompositionPropertyLogger.LoggableType.Float);
00480                         Array.Clear(hoverLight_ValueValidationEvents, 0, 3);
00481
00482                         _compositionPropertyLogger.UnregisterProperty(_pressSpotlight, "InnerConeIntensity", CompositionPropertyLogger.LoggableType.Float);
00483                         _compositionPropertyLogger.UnregisterProperty(_pressSpotlight, "OuterConeIntensity", CompositionPropertyLogger.LoggableType.Float);
00484                         _compositionPropertyLogger.UnregisterProperty(_pressSpotlight, "OuterConeAngle", CompositionPropertyLogger.LoggableType.Float);
00485                         Array.Clear(pressLight_ValueValidationEvents, 0, 3);
00486
00487                         logger.Verify(hoverLight_Result && hoverLight_Result, "StateValidationResult: error occured");
00488                     }
00489                 });
00490             });
00491         }
00492
00493         // Validates that we hit expected values for a sequence of two states
00494         // TODO: Generalize and convert to more elegant pattern (if required by test scenarios)
00495         private void ChainedHoverLightStateValuesValidationHelper(
00496             float hoverLight_InnerConeIntensityExpected, float hoverLight_outerConeIntensityExpected, float hoverLight_outerConeAngleExpected,
00497             float pressLight_InnerConeIntensityExpected, float pressLight_outerConeIntensityExpected, float pressLight_outerConeAngleExpected,
00498             float hoverLight_InnerConeIntensityExpected2, float hoverLight_outerConeIntensityExpected2, float hoverLight_outerConeAngleExpected2,
00499             float pressLight_InnerConeIntensityExpected2, float pressLight_outerConeIntensityExpected2, float pressLight_outerConeAngleExpected2,
00500             string testName,
00501             string targetName)
00502         {
00503             if (!ValidateEffectsPresent()) { return; }
00504
00505             WaitHandle[] hoverLight_ValueValidationEvents = new WaitHandle[3];
00506             WaitHandle[] pressLight_ValueValidationEvents = new WaitHandle[3];
00507
00508             Control target = FindName(targetName) as Control;
00509             var lights = GetElementForHoverLight(target).Lights;
00510
00511             var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[0]);
00512             var pressLight = _revealTestApi.GetAsRevealHoverLight(lights[1]);
00513             _hoverSpotlight = _revealTestApi.GetSpotLight(hoverLight as Microsoft.UI.Xaml.Media.XamlLight);
00514             _pressSpotlight = _revealTestApi.GetSpotLight(pressLight as Microsoft.UI.Xaml.Media.XamlLight);
00515
00516             hoverLight_ValueValidationEvents[0] = _compositionPropertyLogger.RegisterProperty(_hoverSpotlight, "InnerConeIntensity", CompositionPropertyLogger.LoggableType.Float, 0.0f, hoverLight_InnerConeIntensityExpected, coneIntensityTolerance);
00517             hoverLight_ValueValidationEvents[1] = _compositionPropertyLogger.RegisterProperty(_hoverSpotlight, "OuterConeIntensity", CompositionPropertyLogger.LoggableType.Float, 0.0f, hoverLight_outerConeIntensityExpected, coneIntensityTolerance);
00518             hoverLight_ValueValidationEvents[2] = _compositionPropertyLogger.RegisterProperty(_hoverSpotlight, "OuterConeAngle", CompositionPropertyLogger.LoggableType.Float, 0.0f, hoverLight_outerConeAngleExpected, coneAngleTolerance);
00519
00520             pressLight_ValueValidationEvents[0] = _compositionPropertyLogger.RegisterProperty(_pressSpotlight, "InnerConeIntensity", CompositionPropertyLogger.LoggableType.Float, 0.0f, pressLight_InnerConeIntensityExpected, coneIntensityTolerance);
00521             pressLight_ValueValidationEvents[1] = _compositionPropertyLogger.RegisterProperty(_pressSpotlight, "OuterConeIntensity", CompositionPropertyLogger.LoggableType.Float, 0.0f, pressLight_outerConeIntensityExpected, coneIntensityTolerance);
00522             pressLight_ValueValidationEvents[2] = _compositionPropertyLogger.RegisterProperty(_pressSpotlight, "OuterConeAngle", CompositionPropertyLogger.LoggableType.Float, 0.0f, pressLight_outerConeAngleExpected, coneAngleTolerance);
00523
00524
00525             // Off-thread validation waits until each registered property hits its expected value
00526             Task.Run(() =>
00527             {
00528                 var combined = hoverLight_ValueValidationEvents.Concat(pressLight_ValueValidationEvents).ToArray();
00529                 bool hoverLight_Result = WaitHandle.WaitAll(hoverLight_ValueValidationEvents, 10000);
00530                 bool pressLight_Result = WaitHandle.WaitAll(pressLight_ValueValidationEvents, 10000);
00531                 RunOnUIThread.Execute(() =>
00532                 {
00533                     // We will log values when we hit the secod expected state, so don't log at this point.
00534                     _compositionPropertyLogger.UnregisterProperty(_hoverSpotlight, "InnerConeIntensity", CompositionPropertyLogger.LoggableType.Float);
00535                     _compositionPropertyLogger.UnregisterProperty(_hoverSpotlight, "OuterConeIntensity", CompositionPropertyLogger.LoggableType.Float);
00536                     _compositionPropertyLogger.UnregisterProperty(_hoverSpotlight, "OuterConeAngle", CompositionPropertyLogger.LoggableType.Float);
00537                     Array.Clear(hoverLight_ValueValidationEvents, 0, 3);
00538
00539                     _compositionPropertyLogger.UnregisterProperty(_pressSpotlight, "InnerConeIntensity", CompositionPropertyLogger.LoggableType.Float);
00540                     _compositionPropertyLogger.UnregisterProperty(_pressSpotlight, "OuterConeIntensity", CompositionPropertyLogger.LoggableType.Float);
00541                     _compositionPropertyLogger.UnregisterProperty(_pressSpotlight, "OuterConeAngle", CompositionPropertyLogger.LoggableType.Float);
00542                     Array.Clear(pressLight_ValueValidationEvents, 0, 3);
00543
00544                     // Now validate we hit values for the second expected state
00545                     HoverLightStateValuesValidationHelper(
00546                         hoverLight_InnerConeIntensityExpected2, hoverLight_outerConeIntensityExpected2, hoverLight_outerConeAngleExpected2,
00547                         pressLight_InnerConeIntensityExpected2, pressLight_outerConeIntensityExpected2, pressLight_outerConeAngleExpected2,
00548                         testName,
00549                         targetName);
00550                 });
00551             });
00552         }
00553
00554         private void HoverLight_ValidatePosition_Offset1_Values()
00555         {
00556             HoverLightPositionValuesValidationHelper(new System.Numerics.Vector3(10F, 90F, 256F), "Offset1_Values", "LargeButton2");
00557         }
00558
00559         private void HoverLight_ValidatePosition_Offset2_Values()
00560         {
00561             HoverLightPositionValuesValidationHelper(new System.Numerics.Vector3(50F, 50F, 256F), "Offset2_Values", "LargeButton2");
00562         }
00563
00564         private void HoverLight_ValidatePosition_Offset3_Values()
00565         {
00566             HoverLightPositionValuesValidationHelper(new System.Numerics.Vector3(10F, 40F, 256F), "Offset3_Values", "NarrowButton2");
00567         }
00568
00569         private void HoverLightPositionValuesValidationHelper(System.Numerics.Vector3 positionExpected, string testName, string targetName)
00570         {
00571             if (!ValidateEffectsPresent()) { return; }
00572
00573             WaitHandle[] valueValidationEvents = new WaitHandle[1];
00574
00575             Control target = FindName(targetName) as Control;
00576             var lights = GetElementForHoverLight(target).Lights;
00577
00578             var hoverLight = _revealTestApi.GetAsRevealHoverLight(lights[0]);
00579             _hoverSpotlight = _revealTestApi.GetSpotLight(hoverLight as Microsoft.UI.Xaml.Media.XamlLight);
00580
00581             valueValidationEvents[0] = _compositionPropertyLogger.RegisterProperty(_hoverSpotlight, "Offset", CompositionPropertyLogger.LoggableType.Vector3, new System.Numerics.Vector3(0F, 0F, 0F), positionExpected, offsetCoordinateTolerance);
00582
00583             // Off-thread validation waits until each registered property hits its expected value
00584             Task.Run(() =>
00585             {
00586                 bool result = WaitHandle.WaitAll(valueValidationEvents, 10000);
00587                 RunOnUIThread.Execute(() =>
00588                 {
00589                     using (var logger = new ResultsLogger(testName, TestResult))
00590                     {
00591                         var positionValues = _compositionPropertyLogger.GetValues(_hoverSpotlight, "Offset");
00592                         logger.LogMessage("Offset: " + string.Join(", ", positionValues));
00593
00594                         _compositionPropertyLogger.UnregisterProperty(_hoverSpotlight, "Offset", CompositionPropertyLogger.LoggableType.Vector3);
00595                         Array.Clear(valueValidationEvents, 0, 1);
00596
00597                         logger.Verify(result, "PositionValidationResult: error occured");
00598                     }
00599                 });
00600             });
00601         }
00602
00603         private float DegreesToRadians(float angle)
00604         {
00605             return ((float)Math.PI) * angle / 180.0F;
00606         }
00607
00608         private float RadiansToDegrees(float angle)
00609         {
00610             return 180.0F * angle / ((float)Math.PI);
00611         }
00612
00613
00614         private void NotificationsTestButton_Click(object sender, RoutedEventArgs e)
00615         {
00616
00617         }
00618     }
00619 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PersonPicture Member List

This is the complete list of members for PersonPicture, including all inherited members.
abi_enter() | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
BadgeGlyph(winrt::hstring const &value) | PersonPictureProperties |
BadgeGlyph() | PersonPictureProperties |
BadgeGlyphProperty() | PersonPictureProperties | [inline, static]
BadgeImageSource(winrt::ImageSource const &value) | PersonPictureProperties |
BadgeImageSource() | PersonPictureProperties |
BadgeImageSourceProperty() | PersonPictureProperties | [inline, static]
BadgeNumber(int value) | PersonPictureProperties |
BadgeNumber() | PersonPictureProperties |
BadgeNumberProperty() | PersonPictureProperties | [inline, static]
BadgeText(winrt::hstring const &value) | PersonPictureProperties |
BadgeText() | PersonPictureProperties |
BadgeTextProperty() | PersonPictureProperties | [inline, static]
CheckThread() | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
ClearProperties() | PersonPictureProperties | [static]
Contact(winrt::Contact const &value) | PersonPictureProperties |
Contact() | PersonPictureProperties |
ContactProperty() | PersonPictureProperties | [inline, static]
DeleteInstanceOnUIThread(std::unique_ptr< PersonPicture > &&self) noexcept | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline, static]
DisplayName(winrt::hstring const &value) | PersonPictureProperties |
DisplayName() | PersonPictureProperties |
DisplayNameProperty() | PersonPictureProperties | [inline, static]
EnsureProperties() | PersonPictureProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
final_release(std::unique_ptr< PersonPicture > &&self) | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline, static]
GetBase() | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
GetImageSource() | PersonPicture | [private]
GetInitials() | PersonPicture | [private]
GetInner() | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
GetLocalizedPluralBadgeItemStringResource(unsigned int numericValue) | PersonPicture | [private]
Initials(winrt::hstring const &value) | PersonPictureProperties |
Initials() | PersonPictureProperties |
InitialsProperty() | PersonPictureProperties | [inline, static]
IsGroup(bool value) | PersonPictureProperties |
IsGroup() | PersonPictureProperties |
IsGroupProperty() | PersonPictureProperties | [inline, static]
IsOnThread() | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
LoadImageAsync(std::shared_ptr< winrt::IRandomAccessStreamReference > thumbStreamReference, std::function< void(winrt::BitmapImage)> completedFunction) | PersonPicture | [private]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
OnApplyTemplate() | PersonPicture |
OnBadgeGlyphPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnBadgeImageSourcePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnBadgeNumberPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnBadgeTextPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnContactChanged(const winrt::DependencyPropertyChangedEventArgs &args) | PersonPicture | [private]
OnContactPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnCreateAutomationPeer() | PersonPicture |
OnDisplayNameChanged(const winrt::DependencyPropertyChangedEventArgs &args) | PersonPicture | [private]
OnDisplayNamePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnInitialsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnIsGroupPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnPreferSmallImagePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnProfilePicturePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | PersonPicture |
OnSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &e) | PersonPicture | [private]
OnTemplateSettingsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | PersonPictureProperties | [static]
OnUnloaded(const winrt::IInspectable &sender, const winrt::RoutedEventArgs &e) | PersonPicture | [private]
PersonPicture() | PersonPicture |
PersonPictureProperties() | PersonPictureProperties |
PreferSmallImage(bool value) | PersonPictureProperties |
PreferSmallImage() | PersonPictureProperties |
PreferSmallImageProperty() | PersonPictureProperties | [inline, static]
ProfilePicture(winrt::ImageSource const &value) | PersonPictureProperties |
ProfilePicture() | PersonPictureProperties |
ProfilePictureProperty() | PersonPictureProperties | [inline, static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< PersonPicture, winrt::implementation::PersonPictureT > | [inline]
s_BadgeGlyphProperty | PersonPictureProperties | [static]
s_BadgeImageSourceProperty | PersonPictureProperties | [static]
s_BadgeNumberProperty | PersonPictureProperties | [static]
s_BadgeTextProperty | PersonPictureProperties | [static]
s_ContactProperty | PersonPictureProperties | [static]
s_DisplayNameProperty | PersonPictureProperties | [static]
s_InitialsProperty | PersonPictureProperties | [static]
s_IsGroupProperty | PersonPictureProperties | [static]
s_PreferSmallImageProperty | PersonPictureProperties | [static]
s_ProfilePictureProperty | PersonPictureProperties | [static]
s_TemplateSettingsProperty | PersonPictureProperties | [static]
TemplateSettings(winrt::PersonPictureTemplateSettings const &value) | PersonPictureProperties |
TemplateSettings() | PersonPictureProperties |
TemplateSettingsProperty() | PersonPictureProperties | [inline, static]
UpdateAutomationName() | PersonPicture | [private]
UpdateBadge() | PersonPicture | [private]
UpdateBadgeGlyph() | PersonPicture | [private]
UpdateBadgeImageSource() | PersonPicture | [private]
UpdateBadgeNumber() | PersonPicture | [private]
UpdateControlForContact(bool isNewContact) | PersonPicture | [private]
UpdateIfReady() | PersonPicture | [private]
Generated on Sun Dec 1 2024 20:53:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/RefreshVisualizer/TestUI/SliderAsRefreshInfoProvider.cs Source File

  • PullToRefresh
  • RefreshVisualizer
  • TestUI

SliderAsRefreshInfoProvider.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Text;
00007 using Windows.Foundation;
00008 using Microsoft.UI.Composition;
00009 using Microsoft.UI.Xaml;
00010 using Microsoft.UI.Xaml.Controls;
00011 using Microsoft.UI.Xaml.Controls.Primitives;
00012 using Microsoft.UI.Xaml.Hosting;
00013 using Microsoft.UI.Xaml.Input;
00014 using Microsoft.UI.Xaml.Navigation;
00015 using Microsoft.UI.Private.Controls;
00016
00017 namespace RefreshVizualizer_TestUI
00018 {
00019     public class SliderRefreshInfoProviderAdapter
00020     {
00021         Slider mySlider;
00022         DispatcherTimer myTimer;
00023
00024         public SliderRefreshInfoProviderAdapter(Slider slider, DispatcherTimer timer)
00025         {
00026             mySlider = slider;
00027             myTimer = timer;
00028         }
00029
00030         public RefreshInfoProviderImplementation adapt()
00031         {
00032             return new RefreshInfoProviderImplementation(mySlider, myTimer);
00033         }
00034     }
00035
00036     public class RefreshInfoProviderImplementation : IRefreshInfoProvider
00037     {
00038         private DispatcherTimer timer;
00039         private Slider slider;
00040         private double executionRatio;
00041         private CompositionPropertySet compositionProperties;
00042         private Boolean isInteractingForRefresh;
00043         public RefreshInfoProviderImplementation(Slider slider, DispatcherTimer timer)
00044         {
00045             this.timer = timer;
00046             this.slider = slider;
00047             var visual = ElementCompositionPreview.GetElementVisual(slider);
00048             var compositor = visual.Compositor;
00049
00050             this.ExecutionRatio = 0.8f;
00051             this.CompositionProperties = compositor.CreatePropertySet();
00052             this.CompositionProperties.InsertScalar(InteractionRatioCompositionProperty, 0.0f);
00053
00054             this.timer.Interval = TimeSpan.FromMilliseconds(1);
00055             this.timer.Tick += timerTick;
00056
00057             this.slider.ManipulationMode = ManipulationModes.TranslateX;
00058             this.slider.ValueChanged += onSliderValueChanged;
00059             this.slider.ManipulationStarting += onSliderPointerPressed;
00060             this.slider.ManipulationCompleted += onSliderPointerReleased;
00061         }
00062
00063         public double ExecutionRatio
00064         {
00065             get
00066             {
00067                 return this.executionRatio;
00068             }
00069
00070             set
00071             {
00072                 this.executionRatio = value;
00073             }
00074         }
00075
00076         public CompositionPropertySet CompositionProperties
00077         {
00078             get
00079             {
00080                 return this.compositionProperties;
00081             }
00082             private set
00083             {
00084                 this.compositionProperties = value;
00085             }
00086         }
00087
00088         public string InteractionRatioCompositionProperty
00089         {
00090             get
00091             {
00092                 return "InteractionRatio";
00093             }
00094         }
00095
00096         public bool IsInteractingForRefresh
00097         {
00098             get
00099             {
00100                 return this.isInteractingForRefresh;
00101             }
00102             private set
00103             {
00104                 this.isInteractingForRefresh = value;
00105             }
00106         }
00107         public event TypedEventHandler<IRefreshInfoProvider, RefreshInteractionRatioChangedEventArgs> InteractionRatioChanged;
00108         public event TypedEventHandler<IRefreshInfoProvider, object> IsInteractingForRefreshChanged;
00109         public event TypedEventHandler<IRefreshInfoProvider, object> RefreshCompleted;
00110         public event TypedEventHandler<IRefreshInfoProvider, object> RefreshStarted;
00111
00112         public void OnRefreshCompleted()
00113         {
00114             if (this.RefreshCompleted != null)
00115             {
00116                 this.RefreshCompleted.Invoke(this, new EventArgs());
00117             }
00118
00119             this.slider.Value = 0;
00120         }
00121
00122         public void OnRefreshStarted()
00123         {
00124             if (this.RefreshStarted != null)
00125             {
00126                 this.RefreshStarted.Invoke(this, new EventArgs());
00127             }
00128             this.timer.Stop();
00129             this.slider.Value = this.slider.Maximum;
00130         }
00131
00132         private void onSliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
00133         {
00134             float interactionRatio = (float)(e.NewValue / this.slider.Maximum);
00135             this.CompositionProperties.InsertScalar(InteractionRatioCompositionProperty, (float)e.NewValue / (float)this.slider.Maximum);
00136             RaiseInteractionRatioChanged((float)e.NewValue);
00137         }
00138
00139         private void onSliderPointerPressed(object sender, ManipulationStartingRoutedEventArgs e)
00140         {
00141             this.timer.Stop();
00142             UpdateIsInteractingForRefresh(true);
00143         }
00144
00145         private void onSliderPointerReleased(object sender, ManipulationCompletedRoutedEventArgs e)
00146         {
00147             UpdateIsInteractingForRefresh(false);
00148         }
00149
00150         private void RaiseInteractionRatioChanged(float interactionRatio)
00151         {
00152             if (this.InteractionRatioChanged != null)
00153             {
00154                 this.InteractionRatioChanged.Invoke(this, PullToRefreshHelperTestApi.CreateRefreshInteractionRatioChangedEventArgsInstance((interactionRatio / (float)this.slider.Maximum)));
00155             }
00156         }
00157
00158         private void UpdateIsInteractingForRefresh(Boolean value)
00159         {
00160             if (value != this.IsInteractingForRefresh)
00161             {
00162                 this.IsInteractingForRefresh = value;
00163                 if (this.IsInteractingForRefresh == false)
00164                 {
00165                     this.timer.Start();
00166                 }
00167                 RaiseInteractingForRefreshChanged();
00168             }
00169         }
00170
00171         private void RaiseInteractingForRefreshChanged()
00172         {
00173             if (this.IsInteractingForRefreshChanged != null)
00174             {
00175                 this.IsInteractingForRefreshChanged.Invoke(this, new EventArgs());
00176             }
00177         }
00178
00179         private void timerTick(object sender, object e)
00180         {
00181             if(this.slider.Value == 0)
00182             {
00183                 this.timer.Stop();
00184             }
00185             else
00186             {
00187                 this.slider.Value -= 1;
00188             }
00189         }
00190     }
00191 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/APITests/ScrollViewTests.cs Source File

  • ScrollView
  • APITests

ScrollViewTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using Microsoft.UI.Private.Controls;
00006 using MUXControlsTestApp.Utilities;
00007 using System;
00008 using System.Threading;
00009 using Windows.Foundation;
00010 using Windows.UI.ViewManagement;
00011 using Microsoft.UI.Xaml.Controls;
00012 using Microsoft.UI.Xaml.Shapes;
00013 using Microsoft.UI.Xaml.Media;
00014
00015 using System.Runtime.InteropServices;
00016 using System.Diagnostics;
00017
00018 using WEX.TestExecution;
00019 using WEX.TestExecution.Markup;
00020 using WEX.Logging.Interop;
00021
00022 using ScrollView = Microsoft.UI.Xaml.Controls.ScrollView;
00023 using ScrollBarVisibility = Microsoft.UI.Xaml.Controls.ScrollingScrollBarVisibility;
00024 using ScrollPresenter = Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter;
00025 using ScrollingContentOrientation = Microsoft.UI.Xaml.Controls.ScrollingContentOrientation;
00026 using ScrollingScrollMode = Microsoft.UI.Xaml.Controls.ScrollingScrollMode;
00027 using ScrollingInputKinds = Microsoft.UI.Xaml.Controls.ScrollingInputKinds;
00028 using ScrollingChainMode = Microsoft.UI.Xaml.Controls.ScrollingChainMode;
00029 using ScrollingRailMode = Microsoft.UI.Xaml.Controls.ScrollingRailMode;
00030 using ScrollingZoomMode = Microsoft.UI.Xaml.Controls.ScrollingZoomMode;
00031 using ScrollingAnchorRequestedEventArgs = Microsoft.UI.Xaml.Controls.ScrollingAnchorRequestedEventArgs;
00032 using MUXControlsTestHooksLoggingMessageEventArgs = Microsoft.UI.Private.Controls.MUXControlsTestHooksLoggingMessageEventArgs;
00033 using ScrollViewTestHooks = Microsoft.UI.Private.Controls.ScrollViewTestHooks;
00034
00035 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00036 {
00037     [TestClass]
00038     public class ScrollViewTests : ApiTestBase
00039     {
00040         private const int c_MaxWaitDuration = 5000;
00041         private const double c_epsilon = 0.0000001;
00042
00043         private const ScrollingInputKinds c_defaultIgnoredInputKinds = ScrollingInputKinds.None;
00044         private const ScrollingChainMode c_defaultHorizontalScrollChainMode = ScrollingChainMode.Auto;
00045         private const ScrollingChainMode c_defaultVerticalScrollChainMode = ScrollingChainMode.Auto;
00046         private const ScrollingRailMode c_defaultHorizontalScrollRailMode = ScrollingRailMode.Enabled;
00047         private const ScrollingRailMode c_defaultVerticalScrollRailMode = ScrollingRailMode.Enabled;
00048         private const ScrollingScrollMode c_defaultComputedHorizontalScrollMode = ScrollingScrollMode.Disabled;
00049         private const ScrollingScrollMode c_defaultComputedVerticalScrollMode = ScrollingScrollMode.Disabled;
00050         private const ScrollingScrollMode c_defaultHorizontalScrollMode = ScrollingScrollMode.Auto;
00051         private const ScrollingScrollMode c_defaultVerticalScrollMode = ScrollingScrollMode.Auto;
00052         private const ScrollingChainMode c_defaultZoomChainMode = ScrollingChainMode.Auto;
00053         private const ScrollingZoomMode c_defaultZoomMode = ScrollingZoomMode.Disabled;
00054         private const ScrollingContentOrientation c_defaultContentOrientation = ScrollingContentOrientation.Vertical;
00055         private const double c_defaultMinZoomFactor = 0.1;
00056         private const double c_defaultMaxZoomFactor = 10.0;
00057         private const double c_defaultAnchorRatio = 0.0;
00058
00059         private const double c_defaultUIScrollViewContentWidth = 1200.0;
00060         private const double c_defaultUIScrollViewContentHeight = 600.0;
00061         private const double c_defaultUIScrollViewWidth = 300.0;
00062         private const double c_defaultUIScrollViewHeight = 200.0;
00063
00064         private bool m_trackScrollViewStateChanges = false;
00065         private ScrollViewVisualStateCounts m_scrollViewVisualStateCounts;
00066
00067         [TestMethod]
00068         [TestProperty("Description", "Verifies the ScrollView default properties.")]
00069         public void VerifyDefaultPropertyValues()
00070         {
00071             RunOnUIThread.Execute(() =>
00072             {
00073                 ScrollView scrollView = new ScrollView();
00074                 Verify.IsNotNull(scrollView);
00075
00076                 Log.Comment("Verifying ScrollView default property values");
00077                 Verify.IsNull(scrollView.Content);
00078                 Verify.IsNull(scrollView.CurrentAnchor);
00079                 Verify.IsNull(scrollView.ScrollPresenter);
00080                 Verify.AreEqual(c_defaultComputedHorizontalScrollMode, scrollView.ComputedHorizontalScrollMode);
00081                 Verify.AreEqual(c_defaultComputedVerticalScrollMode, scrollView.ComputedVerticalScrollMode);
00082                 Verify.AreEqual(c_defaultIgnoredInputKinds, scrollView.IgnoredInputKinds);
00083                 Verify.AreEqual(c_defaultContentOrientation, scrollView.ContentOrientation);
00084                 Verify.AreEqual(c_defaultHorizontalScrollChainMode, scrollView.HorizontalScrollChainMode);
00085                 Verify.AreEqual(c_defaultVerticalScrollChainMode, scrollView.VerticalScrollChainMode);
00086                 Verify.AreEqual(c_defaultHorizontalScrollRailMode, scrollView.HorizontalScrollRailMode);
00087                 Verify.AreEqual(c_defaultVerticalScrollRailMode, scrollView.VerticalScrollRailMode);
00088                 Verify.AreEqual(c_defaultHorizontalScrollMode, scrollView.HorizontalScrollMode);
00089                 Verify.AreEqual(c_defaultVerticalScrollMode, scrollView.VerticalScrollMode);
00090                 Verify.AreEqual(c_defaultZoomMode, scrollView.ZoomMode);
00091                 Verify.AreEqual(c_defaultZoomChainMode, scrollView.ZoomChainMode);
00092                 Verify.IsGreaterThan(scrollView.MinZoomFactor, c_defaultMinZoomFactor - c_epsilon);
00093                 Verify.IsLessThan(scrollView.MinZoomFactor, c_defaultMinZoomFactor + c_epsilon);
00094                 Verify.IsGreaterThan(scrollView.MaxZoomFactor, c_defaultMaxZoomFactor - c_epsilon);
00095                 Verify.IsLessThan(scrollView.MaxZoomFactor, c_defaultMaxZoomFactor + c_epsilon);
00096                 Verify.AreEqual(c_defaultAnchorRatio, scrollView.HorizontalAnchorRatio);
00097                 Verify.AreEqual(c_defaultAnchorRatio, scrollView.VerticalAnchorRatio);
00098                 Verify.AreEqual(0.0, scrollView.ExtentWidth);
00099                 Verify.AreEqual(0.0, scrollView.ExtentHeight);
00100                 Verify.AreEqual(0.0, scrollView.ViewportWidth);
00101                 Verify.AreEqual(0.0, scrollView.ViewportHeight);
00102                 Verify.AreEqual(0.0, scrollView.ScrollableWidth);
00103                 Verify.AreEqual(0.0, scrollView.ScrollableHeight);
00104             });
00105         }
00106
00107         [TestMethod]
00108         [TestProperty("Description", "Verifies the ScrollView properties after template application.")]
00109         public void VerifyScrollPresenterAttachedProperties()
00110         {
00111             using (PrivateLoggingHelper privateSVLoggingHelper = new PrivateLoggingHelper("ScrollView", "ScrollPresenter"))
00112             {
00113                 ScrollView scrollView = null;
00114                 Rectangle rectangleScrollViewContent = null;
00115                 AutoResetEvent scrollViewLoadedEvent = new AutoResetEvent(false);
00116                 AutoResetEvent scrollViewUnloadedEvent = new AutoResetEvent(false);
00117
00118                 RunOnUIThread.Execute(() =>
00119                 {
00120                     rectangleScrollViewContent = new Rectangle();
00121                     scrollView = new ScrollView();
00122
00123                     SetupDefaultUI(scrollView, rectangleScrollViewContent, scrollViewLoadedEvent, scrollViewUnloadedEvent);
00124                 });
00125
00126                 WaitForEvent("Waiting for Loaded event", scrollViewLoadedEvent);
00127
00128                 RunOnUIThread.Execute(() =>
00129                 {
00130                     Log.Comment("Setting ScrollPresenter-cloned properties to non-default values");
00131                     scrollView.IgnoredInputKinds = ScrollingInputKinds.MouseWheel | ScrollingInputKinds.Pen;
00132                     scrollView.ContentOrientation = ScrollingContentOrientation.Horizontal;
00133                     scrollView.HorizontalScrollChainMode = ScrollingChainMode.Always;
00134                     scrollView.VerticalScrollChainMode = ScrollingChainMode.Never;
00135                     scrollView.HorizontalScrollRailMode = ScrollingRailMode.Disabled;
00136                     scrollView.VerticalScrollRailMode = ScrollingRailMode.Disabled;
00137                     scrollView.HorizontalScrollMode = ScrollingScrollMode.Enabled;
00138                     scrollView.VerticalScrollMode = ScrollingScrollMode.Disabled;
00139                     scrollView.ZoomMode = ScrollingZoomMode.Enabled;
00140                     scrollView.ZoomChainMode = ScrollingChainMode.Never;
00141                     scrollView.MinZoomFactor = 2.0;
00142                     scrollView.MaxZoomFactor = 8.0;
00143
00144                     Log.Comment("Verifying ScrollPresenter-cloned non-default properties");
00145                     Verify.AreEqual(ScrollingInputKinds.MouseWheel | ScrollingInputKinds.Pen, scrollView.IgnoredInputKinds);
00146                     Verify.AreEqual(ScrollingContentOrientation.Horizontal, scrollView.ContentOrientation);
00147                     Verify.AreEqual(ScrollingChainMode.Always, scrollView.HorizontalScrollChainMode);
00148                     Verify.AreEqual(ScrollingChainMode.Never, scrollView.VerticalScrollChainMode);
00149                     Verify.AreEqual(ScrollingRailMode.Disabled, scrollView.HorizontalScrollRailMode);
00150                     Verify.AreEqual(ScrollingRailMode.Disabled, scrollView.VerticalScrollRailMode);
00151                     Verify.AreEqual(ScrollingScrollMode.Enabled, scrollView.HorizontalScrollMode);
00152                     Verify.AreEqual(ScrollingScrollMode.Disabled, scrollView.VerticalScrollMode);
00153                     Verify.AreEqual(ScrollingScrollMode.Enabled, scrollView.ComputedHorizontalScrollMode);
00154                     Verify.AreEqual(ScrollingScrollMode.Disabled, scrollView.ComputedVerticalScrollMode);
00155                     Verify.AreEqual(ScrollingZoomMode.Enabled, scrollView.ZoomMode);
00156                     Verify.AreEqual(ScrollingChainMode.Never, scrollView.ZoomChainMode);
00157                     Verify.IsGreaterThan(scrollView.MinZoomFactor, 2.0 - c_epsilon);
00158                     Verify.IsLessThan(scrollView.MinZoomFactor, 2.0 + c_epsilon);
00159                     Verify.IsGreaterThan(scrollView.MaxZoomFactor, 8.0 - c_epsilon);
00160                     Verify.IsLessThan(scrollView.MaxZoomFactor, 8.0 + c_epsilon);
00161
00162                     Log.Comment("Resetting window content and ScrollView");
00163                     Content = null;
00164                     scrollView = null;
00165                 });
00166
00167                 WaitForEvent("Waiting for Unloaded event", scrollViewUnloadedEvent);
00168
00169                 IdleSynchronizer.Wait();
00170                 Log.Comment("Garbage collecting...");
00171                 GC.Collect();
00172                 GC.WaitForPendingFinalizers();
00173                 GC.Collect();
00174                 Log.Comment("Done");
00175             }
00176         }
00177
00178         [TestMethod]
00179         [TestProperty("Description", "Verifies the ScrollPresenter attached properties.")]
00180         public void VerifyPropertyValuesAfterTemplateApplication()
00181         {
00182             using (PrivateLoggingHelper privateSVLoggingHelper = new PrivateLoggingHelper("ScrollView", "ScrollPresenter"))
00183             {
00184                 ScrollView scrollView = null;
00185                 Rectangle rectangleScrollViewContent = null;
00186                 AutoResetEvent scrollViewLoadedEvent = new AutoResetEvent(false);
00187                 AutoResetEvent scrollViewUnloadedEvent = new AutoResetEvent(false);
00188
00189                 RunOnUIThread.Execute(() =>
00190                 {
00191                     rectangleScrollViewContent = new Rectangle();
00192                     scrollView = new ScrollView();
00193
00194                     SetupDefaultUI(scrollView, rectangleScrollViewContent, scrollViewLoadedEvent, scrollViewUnloadedEvent);
00195                 });
00196
00197                 WaitForEvent("Waiting for Loaded event", scrollViewLoadedEvent);
00198
00199                 RunOnUIThread.Execute(() =>
00200                 {
00201                     Log.Comment("Verifying ScrollView property values after Loaded event");
00202                     Verify.AreEqual(rectangleScrollViewContent, scrollView.Content);
00203                     Verify.IsNull(scrollView.CurrentAnchor);
00204                     Verify.IsNotNull(scrollView.ScrollPresenter);
00205                     Verify.AreEqual(rectangleScrollViewContent, scrollView.ScrollPresenter.Content);
00206                     Verify.AreEqual(c_defaultUIScrollViewContentWidth, scrollView.ExtentWidth);
00207                     Verify.AreEqual(c_defaultUIScrollViewContentHeight, scrollView.ExtentHeight);
00208                     Verify.AreEqual(c_defaultUIScrollViewWidth, scrollView.ViewportWidth);
00209                     Verify.AreEqual(c_defaultUIScrollViewHeight, scrollView.ViewportHeight);
00210                     Verify.AreEqual(c_defaultUIScrollViewContentWidth - c_defaultUIScrollViewWidth, scrollView.ScrollableWidth);
00211                     Verify.AreEqual(c_defaultUIScrollViewContentHeight - c_defaultUIScrollViewHeight, scrollView.ScrollableHeight);
00212
00213                     Log.Comment("Resetting window content and ScrollView");
00214                     Content = null;
00215                     scrollView = null;
00216                 });
00217
00218                 WaitForEvent("Waiting for Unloaded event", scrollViewUnloadedEvent);
00219
00220                 IdleSynchronizer.Wait();
00221                 Log.Comment("Garbage collecting...");
00222                 GC.Collect();
00223                 GC.WaitForPendingFinalizers();
00224                 GC.Collect();
00225                 Log.Comment("Done");
00226             }
00227         }
00228
00229         [TestMethod]
00230         [TestProperty("Description", "Verifies the ScrollView visual state changes based on the AutoHideScrollBars, IsEnabled and ScrollBarVisibility settings.")]
00231         [TestProperty("Ignore", "True")] // Disabled due to #41343576
00232         public void VerifyVisualStates()
00233         {
00234             UISettings settings = new UISettings();
00235             if (!settings.AnimationsEnabled)
00236             {
00237                 Log.Warning("Test is disabled when animations are turned off.");
00238                 return;
00239             }
00240
00241             using (PrivateLoggingHelper privateSVLoggingHelper = new PrivateLoggingHelper("ScrollView"))
00242             {
00243                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessageForVisualStateChange;
00244
00245                 VerifyVisualStates(ScrollBarVisibility.Auto, autoHideScrollControllers: true);
00246                 VerifyVisualStates(ScrollBarVisibility.Visible, autoHideScrollControllers: true);
00247
00248                 VerifyVisualStates(ScrollBarVisibility.Auto, autoHideScrollControllers: false);
00249                 VerifyVisualStates(ScrollBarVisibility.Visible, autoHideScrollControllers: false);
00250
00251                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessageForVisualStateChange;
00252             }
00253         }
00254
00255         private void VerifyVisualStates(ScrollBarVisibility scrollBarVisibility, bool autoHideScrollControllers)
00256         {
00257             ScrollView scrollView = null;
00258
00259             RunOnUIThread.Execute(() =>
00260             {
00261                 m_trackScrollViewStateChanges = true;
00262                 m_scrollViewVisualStateCounts = new ScrollViewVisualStateCounts();
00263                 scrollView = new ScrollView();
00264             });
00265
00266             using (ScrollViewTestHooksHelper scrollViewTestHooksHelper = new ScrollViewTestHooksHelper(scrollView, autoHideScrollControllers))
00267             {
00268                 Rectangle rectangleScrollViewContent = null;
00269                 AutoResetEvent scrollViewLoadedEvent = new AutoResetEvent(false);
00270                 AutoResetEvent scrollViewUnloadedEvent = new AutoResetEvent(false);
00271
00272                 RunOnUIThread.Execute(() =>
00273                 {
00274                     rectangleScrollViewContent = new Rectangle();
00275                     scrollView.HorizontalScrollBarVisibility = scrollBarVisibility;
00276                     scrollView.VerticalScrollBarVisibility = scrollBarVisibility;
00277
00278                     SetupDefaultUI(
00279                         scrollView: scrollView,
00280                         rectangleScrollViewContent: rectangleScrollViewContent,
00281                         scrollViewLoadedEvent: scrollViewLoadedEvent,
00282                         scrollViewUnloadedEvent: scrollViewUnloadedEvent,
00283                         setAsContentRoot: true,
00284                         useParentGrid: true);
00285                 });
00286
00287                 WaitForEvent("Waiting for Loaded event", scrollViewLoadedEvent);
00288
00289                 RunOnUIThread.Execute(() =>
00290                 {
00291                     m_trackScrollViewStateChanges = false;
00292                     Log.Comment($"VerifyVisualStates: isEnabled:True, scrollBarVisibility:{scrollBarVisibility}, autoHideScrollControllers:{autoHideScrollControllers}");
00293
00294                     VerifyVisualStates(
00295                         expectedMouseIndicatorStateCount: autoHideScrollControllers ? 0u : (scrollBarVisibility == ScrollBarVisibility.Auto ? 2u : 3u),
00296                         expectedTouchIndicatorStateCount: 0,
00297                         expectedNoIndicatorStateCount: autoHideScrollControllers ? (scrollBarVisibility == ScrollBarVisibility.Auto ? 2u : 3u) : 0u,
00298                         expectedScrollBarsSeparatorCollapsedStateCount: autoHideScrollControllers ? (scrollBarVisibility == ScrollBarVisibility.Auto ? 1u : 3u) : 0u,
00299                         expectedScrollBarsSeparatorCollapsedDisabledStateCount: 0,
00300                         expectedScrollBarsSeparatorExpandedStateCount: autoHideScrollControllers ? 0u : (scrollBarVisibility == ScrollBarVisibility.Auto ? 1u : 3u),
00301                         expectedScrollBarsSeparatorDisplayedWithoutAnimationStateCount: 0,
00302                         expectedScrollBarsSeparatorExpandedWithoutAnimationStateCount: 0,
00303                         expectedScrollBarsSeparatorCollapsedWithoutAnimationStateCount: 0);
00304
00305                     m_scrollViewVisualStateCounts.ResetStateCounts();
00306                     m_trackScrollViewStateChanges = true;
00307
00308                     Log.Comment("Disabling ScrollView");
00309                     scrollView.IsEnabled = false;
00310                 });
00311
00312                 IdleSynchronizer.Wait();
00313
00314                 RunOnUIThread.Execute(() =>
00315                 {
00316                     m_trackScrollViewStateChanges = false;
00317                     Log.Comment($"VerifyVisualStates: isEnabled:False, scrollBarVisibility:{scrollBarVisibility}, autoHideScrollControllers:{autoHideScrollControllers}");
00318
00319                     VerifyVisualStates(
00320                         expectedMouseIndicatorStateCount: autoHideScrollControllers ? 0u : (scrollBarVisibility == ScrollBarVisibility.Auto ? 1u : 3u),
00321                         expectedTouchIndicatorStateCount: 0,
00322                         expectedNoIndicatorStateCount: autoHideScrollControllers ? (scrollBarVisibility == ScrollBarVisibility.Auto ? 1u : 3u) : 0u,
00323                         expectedScrollBarsSeparatorCollapsedStateCount: 0,
00324                         expectedScrollBarsSeparatorCollapsedDisabledStateCount: scrollBarVisibility == ScrollBarVisibility.Auto ? 0u : 3u,
00325                         expectedScrollBarsSeparatorExpandedStateCount: 0,
00326                         expectedScrollBarsSeparatorDisplayedWithoutAnimationStateCount: 0,
00327                         expectedScrollBarsSeparatorExpandedWithoutAnimationStateCount: 0,
00328                         expectedScrollBarsSeparatorCollapsedWithoutAnimationStateCount: 0);
00329
00330                     m_scrollViewVisualStateCounts.ResetStateCounts();
00331                     m_trackScrollViewStateChanges = true;
00332
00333                     Log.Comment("Enabling ScrollView");
00334                     scrollView.IsEnabled = true;
00335                 });
00336
00337                 IdleSynchronizer.Wait();
00338
00339                 RunOnUIThread.Execute(() =>
00340                 {
00341                     m_trackScrollViewStateChanges = false;
00342                     Log.Comment($"VerifyVisualStates: isEnabled:True, scrollBarVisibility:{scrollBarVisibility}, autoHideScrollControllers:{autoHideScrollControllers}");
00343
00344                     VerifyVisualStates(
00345                         expectedMouseIndicatorStateCount: autoHideScrollControllers ? 0u : 3u,
00346                         expectedTouchIndicatorStateCount: 0,
00347                         expectedNoIndicatorStateCount: autoHideScrollControllers ? 3u : 0u,
00348                         expectedScrollBarsSeparatorCollapsedStateCount: autoHideScrollControllers ? (scrollBarVisibility == ScrollBarVisibility.Auto ? 2u : 3u) : 0u,
00349                         expectedScrollBarsSeparatorCollapsedDisabledStateCount: 0,
00350                         expectedScrollBarsSeparatorExpandedStateCount: autoHideScrollControllers ? 0u : (scrollBarVisibility == ScrollBarVisibility.Auto ? 2u : 3u),
00351                         expectedScrollBarsSeparatorDisplayedWithoutAnimationStateCount: 0,
00352                         expectedScrollBarsSeparatorExpandedWithoutAnimationStateCount: 0,
00353                         expectedScrollBarsSeparatorCollapsedWithoutAnimationStateCount: 0);
00354
00355                     Log.Comment("Resetting window content");
00356                     Content = null;
00357                     m_scrollViewVisualStateCounts = null;
00358                 });
00359
00360                 WaitForEvent("Waiting for Unloaded event", scrollViewUnloadedEvent);
00361             }
00362         }
00363
00364         private void MUXControlsTestHooks_LoggingMessageForVisualStateChange(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
00365         {
00366             if(m_trackScrollViewStateChanges)
00367             {
00368                 if (args.IsVerboseLevel)
00369                 {
00370                     if (args.Message.Contains("ScrollView::GoToState"))
00371                     {
00372                         if (args.Message.Contains("NoIndicator"))
00373                         {
00374                             m_scrollViewVisualStateCounts.NoIndicatorStateCount++;
00375                         }
00376                         else if (args.Message.Contains("TouchIndicator"))
00377                         {
00378                             m_scrollViewVisualStateCounts.TouchIndicatorStateCount++;
00379                         }
00380                         else if (args.Message.Contains("MouseIndicator"))
00381                         {
00382                             m_scrollViewVisualStateCounts.MouseIndicatorStateCount++;
00383                         }
00384                         else if (args.Message.Contains("ScrollBarsSeparatorCollapsedDisabled"))
00385                         {
00386                             m_scrollViewVisualStateCounts.ScrollBarsSeparatorCollapsedDisabledStateCount++;
00387                         }
00388                         else if (args.Message.Contains("ScrollBarsSeparatorCollapsedWithoutAnimation"))
00389                         {
00390                             m_scrollViewVisualStateCounts.ScrollBarsSeparatorCollapsedWithoutAnimationStateCount++;
00391                         }
00392                         else if (args.Message.Contains("ScrollBarsSeparatorDisplayedWithoutAnimation"))
00393                         {
00394                             m_scrollViewVisualStateCounts.ScrollBarsSeparatorDisplayedWithoutAnimationStateCount++;
00395                         }
00396                         else if (args.Message.Contains("ScrollBarsSeparatorExpandedWithoutAnimation"))
00397                         {
00398                             m_scrollViewVisualStateCounts.ScrollBarsSeparatorExpandedWithoutAnimationStateCount++;
00399                         }
00400                         else if (args.Message.Contains("ScrollBarsSeparatorCollapsed"))
00401                         {
00402                             m_scrollViewVisualStateCounts.ScrollBarsSeparatorCollapsedStateCount++;
00403                         }
00404                         else if (args.Message.Contains("ScrollBarsSeparatorExpanded"))
00405                         {
00406                             m_scrollViewVisualStateCounts.ScrollBarsSeparatorExpandedStateCount++;
00407                         }
00408                     }
00409                 }
00410             }
00411         }
00412
00413         private void VerifyVisualStates(
00414             uint expectedMouseIndicatorStateCount,
00415             uint expectedTouchIndicatorStateCount,
00416             uint expectedNoIndicatorStateCount,
00417             uint expectedScrollBarsSeparatorCollapsedStateCount,
00418             uint expectedScrollBarsSeparatorCollapsedDisabledStateCount,
00419             uint expectedScrollBarsSeparatorExpandedStateCount,
00420             uint expectedScrollBarsSeparatorDisplayedWithoutAnimationStateCount,
00421             uint expectedScrollBarsSeparatorExpandedWithoutAnimationStateCount,
00422             uint expectedScrollBarsSeparatorCollapsedWithoutAnimationStateCount)
00423         {
00424             Log.Comment($"expectedMouseIndicatorStateCount:{expectedMouseIndicatorStateCount}, mouseIndicatorStateCount:{m_scrollViewVisualStateCounts.MouseIndicatorStateCount}");
00425             Log.Comment($"expectedNoIndicatorStateCount:{expectedNoIndicatorStateCount}, noIndicatorStateCount:{m_scrollViewVisualStateCounts.NoIndicatorStateCount}");
00426             Log.Comment($"expectedScrollBarsSeparatorCollapsedStateCount:{expectedScrollBarsSeparatorCollapsedStateCount}, scrollBarsSeparatorCollapsedStateCount:{m_scrollViewVisualStateCounts.ScrollBarsSeparatorCollapsedStateCount}");
00427             Log.Comment($"expectedScrollBarsSeparatorCollapsedDisabledStateCount:{expectedScrollBarsSeparatorCollapsedDisabledStateCount}, scrollBarsSeparatorCollapsedDisabledStateCount:{m_scrollViewVisualStateCounts.ScrollBarsSeparatorCollapsedDisabledStateCount}");
00428             Log.Comment($"expectedScrollBarsSeparatorExpandedStateCount:{expectedScrollBarsSeparatorExpandedStateCount}, scrollBarsSeparatorExpandedStateCount:{m_scrollViewVisualStateCounts.ScrollBarsSeparatorExpandedStateCount}");
00429
00430             Verify.AreEqual(expectedMouseIndicatorStateCount, m_scrollViewVisualStateCounts.MouseIndicatorStateCount, "MouseIndicatorStateCount");
00431             Verify.AreEqual(expectedTouchIndicatorStateCount, m_scrollViewVisualStateCounts.TouchIndicatorStateCount, "TouchIndicatorStateCount");
00432             Verify.AreEqual(expectedNoIndicatorStateCount, m_scrollViewVisualStateCounts.NoIndicatorStateCount, "NoIndicatorStateCount");
00433             Verify.AreEqual(expectedScrollBarsSeparatorCollapsedStateCount, m_scrollViewVisualStateCounts.ScrollBarsSeparatorCollapsedStateCount, "ScrollBarsSeparatorCollapsedStateCount");
00434             Verify.AreEqual(expectedScrollBarsSeparatorCollapsedDisabledStateCount, m_scrollViewVisualStateCounts.ScrollBarsSeparatorCollapsedDisabledStateCount, "ScrollBarsSeparatorCollapsedDisabledStateCount");
00435             Verify.AreEqual(expectedScrollBarsSeparatorExpandedStateCount, m_scrollViewVisualStateCounts.ScrollBarsSeparatorExpandedStateCount, "ScrollBarsSeparatorExpandedStateCount");
00436             Verify.AreEqual(expectedScrollBarsSeparatorDisplayedWithoutAnimationStateCount, m_scrollViewVisualStateCounts.ScrollBarsSeparatorDisplayedWithoutAnimationStateCount, "ScrollBarsSeparatorDisplayedWithoutAnimationStateCount");
00437             Verify.AreEqual(expectedScrollBarsSeparatorExpandedWithoutAnimationStateCount, m_scrollViewVisualStateCounts.ScrollBarsSeparatorExpandedWithoutAnimationStateCount, "ScrollBarsSeparatorExpandedWithoutAnimationStateCount");
00438             Verify.AreEqual(expectedScrollBarsSeparatorCollapsedWithoutAnimationStateCount, m_scrollViewVisualStateCounts.ScrollBarsSeparatorCollapsedWithoutAnimationStateCount, "ScrollBarsSeparatorCollapsedWithoutAnimationStateCount");
00439         }
00440
00441         [TestMethod]
00442         [TestProperty("Description", "Verifies anchor candidate registration and unregistration.")]
00443         public void VerifyAnchorCandidateRegistration()
00444         {
00445             using (PrivateLoggingHelper privateSVLoggingHelper = new PrivateLoggingHelper("ScrollView", "ScrollPresenter"))
00446             {
00447                 int expectedAnchorCandidatesCount = 0;
00448                 ScrollPresenter scrollPresenter = null;
00449                 ScrollView scrollView = null;
00450                 Rectangle rectangleScrollViewContent = null;
00451                 AutoResetEvent scrollViewLoadedEvent = new AutoResetEvent(false);
00452                 AutoResetEvent scrollViewAnchorRequestedEvent = new AutoResetEvent(false);
00453
00454                 RunOnUIThread.Execute(() =>
00455                 {
00456                     rectangleScrollViewContent = new Rectangle();
00457                     scrollView = new ScrollView();
00458                     scrollView.HorizontalAnchorRatio = 0.1;
00459
00460                     SetupDefaultUI(scrollView, rectangleScrollViewContent, scrollViewLoadedEvent);
00461
00462                     scrollView.AnchorRequested += (ScrollView sender, ScrollingAnchorRequestedEventArgs args) =>
00463                     {
00464                         Log.Comment("ScrollView.AnchorRequested event handler. args.AnchorCandidates.Count: " + args.AnchorCandidates.Count);
00465                         Verify.IsNull(args.AnchorElement);
00466                         Verify.IsNull(sender.CurrentAnchor);
00467                         Verify.AreEqual(expectedAnchorCandidatesCount, args.AnchorCandidates.Count);
00468                         scrollViewAnchorRequestedEvent.Set();
00469                     };
00470                 });
00471
00472                 WaitForEvent("Waiting for Loaded event", scrollViewLoadedEvent);
00473
00474                 RunOnUIThread.Execute(() =>
00475                 {
00476                     Log.Comment("Accessing inner ScrollPresenter control");
00477                     scrollPresenter = scrollView.ScrollPresenter;
00478
00479                     Log.Comment("Registering Rectangle as anchor candidate");
00480                     scrollView.RegisterAnchorCandidate(rectangleScrollViewContent);
00481                     expectedAnchorCandidatesCount = 1;
00482
00483                     Log.Comment("Forcing ScrollPresenter layout");
00484                     scrollPresenter.InvalidateArrange();
00485                 });
00486
00487                 WaitForEvent("Waiting for AnchorRequested event", scrollViewAnchorRequestedEvent);
00488
00489                 RunOnUIThread.Execute(() =>
00490                 {
00491                     Log.Comment("Unregistering Rectangle as anchor candidate");
00492                     scrollView.UnregisterAnchorCandidate(rectangleScrollViewContent);
00493                     expectedAnchorCandidatesCount = 0;
00494
00495                     Log.Comment("Forcing ScrollPresenter layout");
00496                     scrollPresenter.InvalidateArrange();
00497                 });
00498
00499                 WaitForEvent("Waiting for AnchorRequested event", scrollViewAnchorRequestedEvent);
00500
00501                 RunOnUIThread.Execute(() =>
00502                 {
00503                     Log.Comment("ScrollView CurrentAnchor is " + (scrollView.CurrentAnchor == null ? "null" : "non-null"));
00504                     Verify.IsNull(scrollView.CurrentAnchor);
00505                     Verify.AreEqual(scrollView.CurrentAnchor, scrollPresenter.CurrentAnchor);
00506                 });
00507             }
00508         }
00509
00510         private void SetupDefaultUI(
00511             ScrollView scrollView,
00512             Rectangle rectangleScrollViewContent = null,
00513             AutoResetEvent scrollViewLoadedEvent = null,
00514             AutoResetEvent scrollViewUnloadedEvent = null,
00515             bool setAsContentRoot = true,
00516             bool useParentGrid = false)
00517         {
00518             Log.Comment("Setting up default UI with ScrollView" + (rectangleScrollViewContent == null ? "" : " and Rectangle"));
00519
00520             LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) };
00521
00522             GradientStop brownGS = new GradientStop() { Color = Colors.Brown, Offset = 0.0 };
00523             twoColorLGB.GradientStops.Add(brownGS);
00524
00525             GradientStop orangeGS = new GradientStop() { Color = Colors.Orange, Offset = 1.0 };
00526             twoColorLGB.GradientStops.Add(orangeGS);
00527
00528             if (rectangleScrollViewContent != null)
00529             {
00530                 rectangleScrollViewContent.Width = c_defaultUIScrollViewContentWidth;
00531                 rectangleScrollViewContent.Height = c_defaultUIScrollViewContentHeight;
00532                 rectangleScrollViewContent.Fill = twoColorLGB;
00533             }
00534
00535             Verify.IsNotNull(scrollView);
00536             scrollView.Name = "scrollView";
00537             scrollView.Width = c_defaultUIScrollViewWidth;
00538             scrollView.Height = c_defaultUIScrollViewHeight;
00539             if (rectangleScrollViewContent != null)
00540             {
00541                 scrollView.Content = rectangleScrollViewContent;
00542             }
00543
00544             if (scrollViewLoadedEvent != null)
00545             {
00546                 scrollView.Loaded += (object sender, RoutedEventArgs e) =>
00547                 {
00548                     Log.Comment("ScrollView.Loaded event handler");
00549                     scrollViewLoadedEvent.Set();
00550                 };
00551             }
00552
00553             if (scrollViewUnloadedEvent != null)
00554             {
00555                 scrollView.Unloaded += (object sender, RoutedEventArgs e) =>
00556                 {
00557                     Log.Comment("ScrollView.Unloaded event handler");
00558                     scrollViewUnloadedEvent.Set();
00559                 };
00560             }
00561
00562             Grid parentGrid = null;
00563
00564             if (useParentGrid)
00565             {
00566                 parentGrid = new Grid();
00567                 parentGrid.Width = c_defaultUIScrollViewWidth * 3;
00568                 parentGrid.Height = c_defaultUIScrollViewHeight * 3;
00569
00570                 scrollView.HorizontalAlignment = HorizontalAlignment.Left;
00571                 scrollView.VerticalAlignment = VerticalAlignment.Top;
00572
00573                 parentGrid.Children.Add(scrollView);
00574             }
00575
00576             if (setAsContentRoot)
00577             {
00578                 Log.Comment("Setting window content");
00579                 if (useParentGrid)
00580                 {
00581                     Content = parentGrid;
00582                 }
00583                 else
00584                 {
00585                     Content = scrollView;
00586                 }
00587             }
00588         }
00589
00590         private void WaitForEvent(string logComment, EventWaitHandle eventWaitHandle)
00591         {
00592             Log.Comment(logComment);
00593             if (!IsDebuggerPresent())
00594             {
00595                 if (!eventWaitHandle.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration)))
00596                 {
00597                     throw new Exception("Timeout expiration in WaitForEvent.");
00598                 }
00599             }
00600             else
00601             {
00602                 eventWaitHandle.WaitOne();
00603             }
00604         }
00605
00606         [DllImport("kernel32.dll")]
00607         private static extern bool IsDebuggerPresent();
00608     }
00609
00610     // Custom ScrollView that records its visual state changes.
00611     public class ScrollViewVisualStateCounts
00612     {
00613         public uint NoIndicatorStateCount
00614         {
00615             get;
00616             set;
00617         }
00618
00619         public uint TouchIndicatorStateCount
00620         {
00621             get;
00622             set;
00623         }
00624
00625         public uint MouseIndicatorStateCount
00626         {
00627             get;
00628             set;
00629         }
00630
00631         public uint ScrollBarsSeparatorExpandedStateCount
00632         {
00633             get;
00634             set;
00635         }
00636
00637         public uint ScrollBarsSeparatorCollapsedStateCount
00638         {
00639             get;
00640             set;
00641         }
00642
00643         public uint ScrollBarsSeparatorCollapsedDisabledStateCount
00644         {
00645             get;
00646             set;
00647         }
00648
00649         public uint ScrollBarsSeparatorCollapsedWithoutAnimationStateCount
00650         {
00651             get;
00652             set;
00653         }
00654
00655         public uint ScrollBarsSeparatorDisplayedWithoutAnimationStateCount
00656         {
00657             get;
00658             set;
00659         }
00660
00661         public uint ScrollBarsSeparatorExpandedWithoutAnimationStateCount
00662         {
00663             get;
00664             set;
00665         }
00666
00667         public void ResetStateCounts()
00668         {
00669             NoIndicatorStateCount = 0;
00670             TouchIndicatorStateCount = 0;
00671             MouseIndicatorStateCount = 0;
00672             ScrollBarsSeparatorExpandedStateCount = 0;
00673             ScrollBarsSeparatorCollapsedStateCount = 0;
00674             ScrollBarsSeparatorCollapsedDisabledStateCount = 0;
00675             ScrollBarsSeparatorCollapsedWithoutAnimationStateCount = 0;
00676             ScrollBarsSeparatorDisplayedWithoutAnimationStateCount = 0;
00677             ScrollBarsSeparatorExpandedWithoutAnimationStateCount = 0;
00678         }
00679     }
00680 }
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ObservableTraits< T, isObservable, isBindable > Member List

This is the complete list of members for ObservableTraits< T, isObservable, isBindable >, including all inherited members.
EventSource typedef ObservableTraits< T, isObservable, isBindable >
Generated on Sun Dec 1 2024 20:52:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TeachingTip/TeachingTipAutomationPeer.cpp Source File

  • TeachingTip

TeachingTipAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ResourceAccessor.h"
00007 #include "TeachingTipAutomationPeer.h"
00008 #include <UIAutomationCore.h>
00009 #include <UIAutomationCoreApi.h>
00010
00011 #include "TeachingTipAutomationPeer.properties.cpp"
00012
00013 TeachingTipAutomationPeer::TeachingTipAutomationPeer(winrt::TeachingTip const& owner) : ReferenceTracker(owner)
00014 {
00015 }
00016
00017 winrt::AutomationControlType TeachingTipAutomationPeer::GetAutomationControlTypeCore()
00018 {
00019     if (winrt::get_self<TeachingTip>(GetTeachingTip())->IsLightDismissEnabled())
00020     {
00021         return winrt::AutomationControlType::Window;
00022     }
00023     else
00024     {
00025         return winrt::AutomationControlType::Pane;
00026     }
00027 }
00028
00029 winrt::hstring TeachingTipAutomationPeer::GetClassNameCore()
00030 {
00031     return winrt::hstring_name_of<winrt::TeachingTip>();
00032 }
00033
00034 winrt::WindowInteractionState TeachingTipAutomationPeer::InteractionState()
00035 {
00036     auto teachingTip = winrt::get_self<TeachingTip>(GetTeachingTip());
00037     if (teachingTip->m_isIdle && teachingTip->IsOpen())
00038     {
00039         return winrt::WindowInteractionState::ReadyForUserInteraction;
00040     }
00041     else if (teachingTip->m_isIdle && !teachingTip->IsOpen())
00042     {
00043         return winrt::WindowInteractionState::BlockedByModalWindow;
00044     }
00045     else if (!teachingTip->m_isIdle && !teachingTip->IsOpen())
00046     {
00047         return winrt::WindowInteractionState::Closing;
00048     }
00049     else
00050     {
00051         return winrt::WindowInteractionState::Running;
00052     }
00053 }
00054
00055 bool TeachingTipAutomationPeer::IsModal()
00056 {
00057     return winrt::get_self<TeachingTip>(GetTeachingTip())->IsLightDismissEnabled();
00058 }
00059
00060 bool TeachingTipAutomationPeer::IsTopmost()
00061 {
00062     return winrt::get_self<TeachingTip>(GetTeachingTip())->IsOpen();
00063 }
00064
00065 bool TeachingTipAutomationPeer::Maximizable()
00066 {
00067     return false;
00068 }
00069
00070 bool TeachingTipAutomationPeer::Minimizable()
00071 {
00072     return false;
00073 }
00074
00075 winrt::WindowVisualState TeachingTipAutomationPeer::VisualState()
00076 {
00077     return winrt::WindowVisualState::Normal;
00078 }
00079
00080 void TeachingTipAutomationPeer::Close()
00081 {
00082     winrt::get_self<TeachingTip>(GetTeachingTip())->IsOpen(false);
00083 }
00084
00085 void TeachingTipAutomationPeer::SetVisualState(winrt::WindowVisualState state)
00086 {
00087
00088 }
00089
00090 bool TeachingTipAutomationPeer::WaitForInputIdle(int32_t milliseconds)
00091 {
00092     return true;
00093 }
00094
00095 void TeachingTipAutomationPeer::RaiseWindowClosedEvent()
00096 {
00097     // We only report as a window when light dismiss is enabled.
00098     if (winrt::get_self<TeachingTip>(GetTeachingTip())->IsLightDismissEnabled() &&
00099         winrt::AutomationPeer::ListenerExists(winrt::AutomationEvents::WindowClosed))
00100     {
00101         RaiseAutomationEvent(winrt::AutomationEvents::WindowClosed);
00102     }
00103 }
00104
00105 void TeachingTipAutomationPeer::RaiseWindowOpenedEvent(wstring_view const& displayString)
00106 {
00107     if (winrt::IAutomationPeer automationPeer = *this)
00108     {
00109         automationPeer.RaiseNotificationEvent(winrt::Automation::Peers::AutomationNotificationKind::Other,
00110             winrt::Peers::AutomationNotificationProcessing::CurrentThenMostRecent,
00111             displayString,
00112             L"TeachingTipOpenedActivityId");
00113     }
00114
00115     // We only report as a window when light dismiss is enabled.
00116     if (winrt::get_self<TeachingTip>(GetTeachingTip())->IsLightDismissEnabled() &&
00117         winrt::AutomationPeer::ListenerExists(winrt::AutomationEvents::WindowOpened))
00118     {
00119         RaiseAutomationEvent(winrt::AutomationEvents::WindowOpened);
00120     }
00121 }
00122
00123 winrt::TeachingTip TeachingTipAutomationPeer::GetTeachingTip()
00124 {
00125     winrt::UIElement owner = Owner();
00126     return owner.as<winrt::TeachingTip>();
00127 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IUnknownAccessor< com_ptr< T > > Member List

This is the complete list of members for IUnknownAccessor< com_ptr< T > >, including all inherited members.
get(com_ptr< T > const &value) IUnknownAccessor< com_ptr< T > > [inline, static]
Generated on Sun Dec 1 2024 20:52:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/InfoBarClosedEventArgs.cpp Source File

  • InfoBar

InfoBarClosedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿#include "pch.h"
00002 #include "common.h"
00003 #include "InfoBarClosedEventArgs.h"
00004
00005 winrt::InfoBarCloseReason InfoBarClosedEventArgs::Reason()
00006 {
00007     return m_reason;
00008 }
00009
00010 void InfoBarClosedEventArgs::Reason(const winrt::InfoBarCloseReason& reason)
00011 {
00012     m_reason = reason;
00013 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarToggleButton.properties.cpp Source File

  • Generated

InkToolBarToggleButton.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "InkToolBarToggleButton.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(InkToolBarToggleButton)
00012 }
00013
00014 #include "InkToolBarToggleButton.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/NonVirtualizingLayout.cpp Source File

  • Repeater

NonVirtualizingLayout.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "Layout.h"
00008 #include "NonVirtualizingLayout.h"
00009 #include "RuntimeProfiler.h"
00010
00011 #include "NonVirtualizingLayout.properties.cpp"
00012
00013 #pragma region INonVirtualizingLayoutOverrides
00014
00015 NonVirtualizingLayout::NonVirtualizingLayout()
00016 {
00017     __RP_Marker_ClassById(RuntimeProfiler::ProfId_NonVirtualizingLayout);
00018 }
00019
00020 void NonVirtualizingLayout::InitializeForContextCore(winrt::LayoutContext const& context)
00021 {
00022
00023 }
00024
00025 void NonVirtualizingLayout::UninitializeForContextCore(winrt::LayoutContext const& context)
00026 {
00027
00028 }
00029
00030 winrt::Size NonVirtualizingLayout::MeasureOverride(winrt::NonVirtualizingLayoutContext const& context, winrt::Size const& availableSize)
00031 {
00032     throw winrt::hresult_not_implemented();
00033 }
00034
00035 winrt::Size NonVirtualizingLayout::ArrangeOverride(winrt::NonVirtualizingLayoutContext const& context, winrt::Size const& finalSize)
00036 {
00037     throw winrt::hresult_not_implemented();
00038 }
00039
00040 #pragma endregion
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RefreshContainer Member List

This is the complete list of members for RefreshContainer, including all inherited members.
abi_enter() | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
CheckThread() | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
ClearProperties() | RefreshContainerProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< RefreshContainer > &&self) noexcept | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline, static]
EnsureProperties() | RefreshContainerProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
final_release(std::unique_ptr< RefreshContainer > &&self) | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline, static]
GetBase() | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
GetInner() | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
IsOnThread() | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
m_refreshRequestedEventSource | RefreshContainerProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
OnApplyTemplate() | RefreshContainer |
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RefreshContainer |
OnPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyPropertyChangedEventArgs &args) | RefreshContainer | [private, static]
OnPullDirectionChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RefreshContainer | [private]
OnPullDirectionChangedImpl() | RefreshContainer | [private]
OnPullDirectionPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RefreshContainerProperties | [static]
OnRefreshInfoProviderAdapterChanged() | RefreshContainer | [private]
OnRefreshInfoProviderAdapterChangedImpl() | RefreshContainer | [private]
OnRefreshVisualizerChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RefreshContainer | [private]
OnRefreshVisualizerChangedImpl() | RefreshContainer | [private]
OnVisualizerPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RefreshContainerProperties | [static]
OnVisualizerRefreshRequested(const winrt::IInspectable &sender, const winrt::RefreshRequestedEventArgs &args) | RefreshContainer | [private]
OnVisualizerSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &args) | RefreshContainer | [private]
PullDirection(winrt::RefreshPullDirection const &value) | RefreshContainerProperties |
PullDirection() | RefreshContainerProperties |
PullDirectionProperty() | RefreshContainerProperties | [inline, static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
RaiseRefreshRequested() | RefreshContainer | [private]
ReferenceTracker(Args &&...args) | ReferenceTracker< RefreshContainer, winrt::implementation::RefreshContainerT, winrt::IRefreshContainerPrivate > | [inline]
RefreshCompleted() | RefreshContainer | [private]
RefreshContainer() | RefreshContainer |
RefreshContainerProperties() | RefreshContainerProperties |
RefreshInfoProviderAdapter() | RefreshContainer |
RefreshInfoProviderAdapter(winrt::IRefreshInfoProviderAdapter const &value) | RefreshContainer |
RefreshRequested(winrt::TypedEventHandler< winrt::RefreshContainer, winrt::RefreshRequestedEventArgs > const &value) | RefreshContainerProperties |
RefreshRequested(winrt::event_token const &token) | RefreshContainerProperties |
RequestRefresh() | RefreshContainer |
s_PullDirectionProperty | RefreshContainerProperties | [static]
s_VisualizerProperty | RefreshContainerProperties | [static]
SearchTreeForIRefreshInfoProvider() | RefreshContainer | [private]
SearchTreeForIRefreshInfoProviderRecursiveHelper(winrt::DependencyObject root, int depth) | RefreshContainer | [private]
Visualizer(winrt::RefreshVisualizer const &value) | RefreshContainerProperties |
Visualizer() | RefreshContainerProperties |
VisualizerProperty() | RefreshContainerProperties | [inline, static]
~RefreshContainer() | RefreshContainer |
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Common/CornerRadiusToThicknessConverter.cpp Source File

  • Common

CornerRadiusToThicknessConverter.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "CornerRadiusToThicknessConverter.h"
00007
00008 winrt::Thickness CornerRadiusToThicknessConverter::Convert(winrt::CornerRadius const& radius,
00009     winrt::CornerRadiusToThicknessConverterKind const& filterKind,
00010     double multiplier)
00011 {
00012     auto result = winrt::Thickness{};
00013
00014     switch (filterKind)
00015     {
00016     case winrt::CornerRadiusToThicknessConverterKind::FilterLeftAndRightFromTop:
00017         result.Left = radius.TopLeft * multiplier;
00018         result.Right = radius.TopRight * multiplier;
00019         result.Top = 0;
00020         result.Bottom = 0;
00021         break;
00022     case winrt::CornerRadiusToThicknessConverterKind::FilterLeftAndRightFromBottom:
00023         result.Left = radius.BottomLeft * multiplier;
00024         result.Right = radius.BottomRight * multiplier;
00025         result.Top = 0;
00026         result.Bottom = 0;
00027         break;
00028     case winrt::CornerRadiusToThicknessConverterKind::FilterTopAndBottomFromLeft:
00029         result.Left = 0;
00030         result.Right = 0;
00031         result.Top = radius.TopLeft * multiplier;
00032         result.Bottom = radius.BottomLeft * multiplier;
00033         break;
00034     case winrt::CornerRadiusToThicknessConverterKind::FilterTopAndBottomFromRight:
00035         result.Left = 0;
00036         result.Right = 0;
00037         result.Top = radius.TopRight * multiplier;
00038         result.Bottom = radius.BottomRight * multiplier;
00039         break;
00040     case winrt::CornerRadiusToThicknessConverterKind::FilterTopFromTopLeft:
00041         result.Left = 0;
00042         result.Right = 0;
00043         result.Top = radius.TopLeft * multiplier;
00044         result.Bottom = 0;
00045         break;
00046     case winrt::CornerRadiusToThicknessConverterKind::FilterTopFromTopRight:
00047         result.Left = 0;
00048         result.Right = 0;
00049         result.Top = radius.TopRight * multiplier;
00050         result.Bottom = 0;
00051         break;
00052     case winrt::CornerRadiusToThicknessConverterKind::FilterRightFromTopRight:
00053         result.Left = 0;
00054         result.Right = radius.TopRight * multiplier;
00055         result.Top = 0;
00056         result.Bottom = 0;
00057         break;
00058     case winrt::CornerRadiusToThicknessConverterKind::FilterRightFromBottomRight:
00059         result.Left = 0;
00060         result.Right = radius.BottomRight * multiplier;
00061         result.Top = 0;
00062         result.Bottom = 0;
00063         break;
00064     case winrt::CornerRadiusToThicknessConverterKind::FilterBottomFromBottomRight:
00065         result.Left = 0;
00066         result.Right = 0;
00067         result.Top = 0;
00068         result.Bottom = radius.BottomRight * multiplier;
00069         break;
00070     case winrt::CornerRadiusToThicknessConverterKind::FilterBottomFromBottomLeft:
00071         result.Left = 0;
00072         result.Right = 0;
00073         result.Top = 0;
00074         result.Bottom = radius.BottomLeft * multiplier;
00075         break;
00076     case winrt::CornerRadiusToThicknessConverterKind::FilterLeftFromBottomLeft:
00077         result.Left = radius.BottomLeft * multiplier;
00078         result.Right = 0;
00079         result.Top = 0;
00080         result.Bottom = 0;
00081         break;
00082     case winrt::CornerRadiusToThicknessConverterKind::FilterLeftFromTopLeft:
00083         result.Left = radius.TopLeft * multiplier;
00084         result.Right = 0;
00085         result.Top = 0;
00086         result.Bottom = 0;
00087         break;
00088     }
00089
00090     return result;
00091 }
00092
00093 winrt::IInspectable CornerRadiusToThicknessConverter::Convert(
00094     winrt::IInspectable const& value,
00095     winrt::TypeName const& targetType,
00096     winrt::IInspectable const& parameter,
00097     winrt::hstring const& language)
00098 {
00099     auto radius = unbox_value<winrt::CornerRadius>(value);
00100     const auto multiplier = Multiplier();
00101     return box_value(Convert(radius, ConversionKind(),multiplier));
00102 }
00103
00104 winrt::IInspectable CornerRadiusToThicknessConverter::ConvertBack(
00105     winrt::IInspectable const& value,
00106     winrt::TypeName const& targetType,
00107     winrt::IInspectable const& parameter,
00108     winrt::hstring const& language)
00109 {
00110     winrt::throw_hresult(E_NOTIMPL);
00111
00112 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TwoPaneView/TwoPaneView.h Source File

  • TwoPaneView

TwoPaneView.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "DisplayRegionHelper.h"
00007
00008 #include "TwoPaneView.g.h"
00009 #include "TwoPaneView.properties.h"
00010
00011 static constexpr double c_defaultMinWideModeWidth{ 641.0 };
00012 static constexpr double c_defaultMinTallModeHeight{ 641.0 };
00013
00014 static constexpr winrt::GridLength c_pane1LengthDefault{ 1, winrt::GridUnitType::Auto };
00015 static constexpr winrt::GridLength c_pane2LengthDefault{ 1, winrt::GridUnitType::Star };
00016
00017 enum class ViewMode
00018 {
00019     Pane1Only,
00020     Pane2Only,
00021     LeftRight,
00022     RightLeft,
00023     TopBottom,
00024     BottomTop,
00025     None
00026 };
00027
00028 class TwoPaneView :
00029     public ReferenceTracker<TwoPaneView, winrt::implementation::TwoPaneViewT>,
00030     public TwoPaneViewProperties
00031 {
00032 public:
00033     TwoPaneView();
00034
00035     // IFrameworkElement
00036     void OnApplyTemplate();
00037
00038
00039     void OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const& args);
00040
00041 private:
00042     void SetScrollViewerProperties(std::wstring_view const& scrollViewerName, winrt::Control::Loaded_revoker& revoker);
00043     void OnScrollViewerLoaded(const winrt::IInspectable& sender, const winrt::RoutedEventArgs& args);
00044
00045     void OnSizeChanged(const winrt::IInspectable& sender, const winrt::SizeChangedEventArgs& args);
00046     void OnXamlRootChanged(const winrt::IInspectable& sender, const winrt::Microsoft::UI::Xaml::XamlRootChangedEventArgs& args);
00047
00048     void UpdateRowsColumns(ViewMode newMode, DisplayRegionHelperInfo info, winrt::Rect rcControl);
00049     void UpdateMode();
00050
00051     winrt::Rect GetControlRect();
00052     bool IsInMultipleRegions(DisplayRegionHelperInfo info, winrt::Rect rcControl);
00053
00054     ViewMode m_currentMode { ViewMode::None } ;
00055
00056     bool m_loaded { false };
00057
00058     winrt::Control::Loaded_revoker m_pane1LoadedRevoker{};
00059     winrt::Control::Loaded_revoker m_pane2LoadedRevoker{};
00060
00061     tracker_ref<winrt::ColumnDefinition> m_columnLeft{ this };
00062     tracker_ref<winrt::ColumnDefinition> m_columnMiddle{ this };
00063     tracker_ref<winrt::ColumnDefinition> m_columnRight{ this };
00064     tracker_ref<winrt::RowDefinition> m_rowTop{ this };
00065     tracker_ref<winrt::RowDefinition> m_rowMiddle{ this };
00066     tracker_ref<winrt::RowDefinition> m_rowBottom{ this };
00067     winrt::IXamlRoot::Changed_revoker m_xamlRootChangedRevoker{};
00068
00069 };
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBadge/APITests/InfoBadgeTests.cs Source File

  • InfoBadge
  • APITests

InfoBadgeTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using System.Collections.Generic;
00007 using Windows.Foundation;
00008 using Microsoft.UI.Xaml.Controls;
00009 using MUXControlsTestApp.Utilities;
00010 using Microsoft.UI.Xaml.Controls;
00011 using SymbolIconSource = Microsoft.UI.Xaml.Controls.SymbolIconSource;
00012 using PathIconSource = Microsoft.UI.Xaml.Controls.PathIconSource;
00013 using BitmapIconSource = Microsoft.UI.Xaml.Controls.BitmapIconSource;
00014 using FontIconSource = Microsoft.UI.Xaml.Controls.FontIconSource;
00015 using Microsoft.UI.Xaml.Media;
00016 using Microsoft.UI.Xaml.Media.Imaging;
00017 using Microsoft.UI.Xaml.Controls.AnimatedVisuals;
00018 using System.Runtime.InteropServices;
00019
00020 using WEX.TestExecution;
00021 using WEX.TestExecution.Markup;
00022 using WEX.Logging.Interop;
00023
00024 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00025 {
00026
00027     [TestClass]
00028     public class InfoBadgeTests : ApiTestBase
00029     {
00030         [TestMethod]
00031         public void InfoBadgeDisplayKindTest()
00032         {
00033             InfoBadge infoBadge = null;
00034             SymbolIconSource symbolIconSource = null;
00035             RunOnUIThread.Execute(() =>
00036             {
00037                 infoBadge = new InfoBadge();
00038                 symbolIconSource = new SymbolIconSource();
00039                 symbolIconSource.Symbol = Symbol.Setting;
00040
00041                 Content = infoBadge;
00042                 Content.UpdateLayout();
00043             });
00044
00045             IdleSynchronizer.Wait();
00046
00047             RunOnUIThread.Execute(() =>
00048             {
00049                 FrameworkElement textBlock = infoBadge.FindVisualChildByName("ValueTextBlock");
00050                 Verify.IsNotNull(textBlock, "The underlying value text block could not be retrieved");
00051
00052                 FrameworkElement iconViewBox = infoBadge.FindVisualChildByName("IconPresenter");
00053                 Verify.IsNotNull(textBlock, "The underlying icon presenter view box could not be retrieved");
00054
00055                 Verify.AreEqual(Visibility.Collapsed, textBlock.Visibility, "The value text block should be initally collapsed since the default value is -1");
00056                 Verify.AreEqual(Visibility.Collapsed, iconViewBox.Visibility, "The icon presenter should be initally collapsed since the default value is null");
00057
00058                 infoBadge.IconSource = symbolIconSource;
00059                 Content.UpdateLayout();
00060
00061                 Verify.AreEqual(Visibility.Collapsed, textBlock.Visibility, "The value text block should be initally collapsed since the default value is -1");
00062                 Verify.AreEqual(Visibility.Visible, iconViewBox.Visibility, "The icon presenter should be visible since we've set the icon source property and value is -1");
00063
00064                 infoBadge.Value = 10;
00065                 Content.UpdateLayout();
00066
00067                 Verify.AreEqual(Visibility.Visible, textBlock.Visibility, "The value text block should be visible since the value is set to 10");
00068                 Verify.AreEqual(Visibility.Collapsed, iconViewBox.Visibility, "The icon presenter should be collapsed since we've set the icon source property but value is not -1");
00069
00070                 infoBadge.IconSource = null;
00071                 Content.UpdateLayout();
00072
00073                 Verify.AreEqual(Visibility.Visible, textBlock.Visibility, "The value text block should be visible since the value is set to 10");
00074                 Verify.AreEqual(Visibility.Collapsed, iconViewBox.Visibility, "The icon presenter should be collapsed since the icon source property is null");
00075
00076                 infoBadge.Value = -1;
00077                 Content.UpdateLayout();
00078
00079                 Verify.AreEqual(Visibility.Collapsed, textBlock.Visibility, "The value text block should be collapsed since the value is set to -1");
00080                 Verify.AreEqual(Visibility.Collapsed, iconViewBox.Visibility, "The icon presenter should be collapsed since the value is set to null");
00081             });
00082         }
00083
00084         [TestMethod]
00085         public void InfoBadgeSupportsAllIconTypes()
00086         {
00087             InfoBadge infoBadge = null;
00088             SymbolIconSource symbolIconSource = null;
00089             PathIconSource pathIconSource = null;
00090             AnimatedIconSource animatedIconSource = null;
00091             BitmapIconSource bitmapIconSource = null;
00092             ImageIconSource imageIconSource = null;
00093             FontIconSource fontIconSource = null;
00094
00095             RunOnUIThread.Execute(() =>
00096             {
00097                 infoBadge = new InfoBadge();
00098                 symbolIconSource = new SymbolIconSource();
00099                 symbolIconSource.Symbol = Symbol.Setting;
00100
00101                 fontIconSource = new FontIconSource();
00102                 fontIconSource.Glyph = "99+";
00103                 fontIconSource.FontFamily = new FontFamily("XamlAutoFontFamily");
00104
00105                 bitmapIconSource = new BitmapIconSource();
00106                 bitmapIconSource.ShowAsMonochrome = false;
00107                 Uri bitmapUri = new Uri("ms-appx:/Assets/ingredient1.png");
00108                 bitmapIconSource.UriSource = bitmapUri;
00109
00110                 imageIconSource = new ImageIconSource();
00111                 var imageUri = new Uri("https://raw.githubusercontent.com/DiemenDesign/LibreICONS/master/svg-color/libre-camera-panorama.svg");
00112                 imageIconSource.ImageSource = new SvgImageSource(imageUri);
00113
00114                 pathIconSource = new PathIconSource();
00115                 var geometry = new RectangleGeometry();
00116                 geometry.Rect = new Rect { Width = 5, Height = 2, X = 0, Y = 0 };
00117                 pathIconSource.Data = geometry;
00118
00119                 animatedIconSource = new AnimatedIconSource();
00120                 animatedIconSource.Source = new AnimatedSettingsVisualSource();
00121
00122                 Content = infoBadge;
00123                 Content.UpdateLayout();
00124             });
00125
00126             IdleSynchronizer.Wait();
00127
00128             RunOnUIThread.Execute(() =>
00129             {
00130                 Log.Comment("Switch to Symbol Icon");
00131                 infoBadge.IconSource = symbolIconSource;
00132                 Content.UpdateLayout();
00133
00134                 Log.Comment("Switch to Path Icon");
00135                 infoBadge.IconSource = pathIconSource;
00136                 Content.UpdateLayout();
00137
00138                 Log.Comment("Switch to Font Icon");
00139                 infoBadge.IconSource = fontIconSource;
00140                 Content.UpdateLayout();
00141
00142                 Log.Comment("Switch to bitmap Icon");
00143                 infoBadge.IconSource = bitmapIconSource;
00144                 Content.UpdateLayout();
00145
00146                 Log.Comment("Switch to Image Icon");
00147                 infoBadge.IconSource = imageIconSource;
00148                 Content.UpdateLayout();
00149
00150                 Log.Comment("Switch to Animated Icon");
00151                 infoBadge.IconSource = animatedIconSource;
00152                 Content.UpdateLayout();
00153             });
00154         }
00155
00156         [TestMethod]
00157         public void InfoBadgeValueLessThanNegativeOneCrashes()
00158         {
00159             InfoBadge infoBadge = null;
00160             RunOnUIThread.Execute(() =>
00161             {
00162                 infoBadge = new InfoBadge();
00163                 Content = infoBadge;
00164                 Content.UpdateLayout();
00165             });
00166
00167             IdleSynchronizer.Wait();
00168
00169             RunOnUIThread.Execute(() =>
00170             {
00171                 Verify.Throws<Exception>(() => { infoBadge.Value = -10; });
00172             });
00173         }
00174     }
00175 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioButtons/InteractionTests/RadioButtonsFocusTestPageElements.cs Source File

  • RadioButtons
  • InteractionTests

RadioButtonsFocusTestPageElements.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00006 using System;
00007 using System.Numerics;
00008 using Common;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00016 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00017 using Microsoft.Windows.Apps.Test.Foundation;
00018
00019 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00020 {
00021     class RadioButtonsFocusTestPageElements
00022     {
00023         public UIObject GetTestRadioButtons1()
00024         {
00025             return GetElement(ref TestRadioButtons1, "TestRadioButtons1");
00026         }
00027         private UIObject TestRadioButtons1;
00028
00029         public UIObject GetTestRadioButtons2()
00030         {
00031             return GetElement(ref TestRadioButtons2, "TestRadioButtons2");
00032         }
00033         private UIObject TestRadioButtons2;
00034
00035         public TextBlock GetSelectedIndexTextBlock1()
00036         {
00037             return GetElement(ref SelectedIndexTextBlock1, "SelectedIndexTextBlock1");
00038         }
00039         private TextBlock SelectedIndexTextBlock1;
00040
00041         public TextBlock GetSelectedIndexTextBlock2()
00042         {
00043             return GetElement(ref SelectedIndexTextBlock2, "SelectedIndexTextBlock2");
00044         }
00045         private TextBlock SelectedIndexTextBlock2;
00046
00047         public TextBlock GetFocusedIndexTextBlock1()
00048         {
00049             return GetElement(ref FocusedIndexTextBlock1, "FocusedIndexTextBlock1");
00050         }
00051         private TextBlock FocusedIndexTextBlock1;
00052
00053         public TextBlock GetFocusedIndexTextBlock2()
00054         {
00055             return GetElement(ref FocusedIndexTextBlock2, "FocusedIndexTextBlock2");
00056         }
00057         private TextBlock FocusedIndexTextBlock2;
00058
00059         public CheckBox GetRadioButtons1HasFocusCheckBox()
00060         {
00061             return GetElement(ref RadioButtons1HasFocusCheckBox, "TestRadioButtons1HasFocusCheckBox");
00062         }
00063         private CheckBox RadioButtons1HasFocusCheckBox;
00064
00065         public CheckBox GetRadioButtons2HasFocusCheckBox()
00066         {
00067             return GetElement(ref RadioButtons2HasFocusCheckBox, "TestRadioButtons2HasFocusCheckBox");
00068         }
00069         private CheckBox RadioButtons2HasFocusCheckBox;
00070
00071         public Edit GetIndexToSelectTextBox1()
00072         {
00073             return GetElement(ref IndexToSelectTextBox1, "IndexToSelectTextBox1");
00074         }
00075         private Edit IndexToSelectTextBox1;
00076
00077         public Edit GetIndexToSelectTextBox2()
00078         {
00079             return GetElement(ref IndexToSelectTextBox2, "IndexToSelectTextBox2");
00080         }
00081         private Edit IndexToSelectTextBox2;
00082
00083         public Button GetSelectByIndexButton1()
00084         {
00085             return GetElement(ref SelectByIndexButton, "SelectByIndexButton1");
00086         }
00087         private Button SelectByIndexButton;
00088
00089         public Button GetSelectByIndexButton2()
00090         {
00091             return GetElement(ref SelectByIndexButton2, "SelectByIndexButton2");
00092         }
00093         private Button SelectByIndexButton2;
00094
00095         private T GetElement<T>(ref T element, string elementName) where T : UIObject
00096         {
00097             if (element == null)
00098             {
00099                 Log.Comment("Find the " + elementName);
00100                 element = FindElement.ByNameOrId<T>(elementName);
00101                 Verify.IsNotNull(element);
00102             }
00103             return element;
00104         }
00105     }
00106 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewSizingPage Member List

This is the complete list of members for TabViewSizingPage, including all inherited members.
_newTabNumber | TabViewSizingPage | [private]
GetWidthsButton_Click(object sender, object args) | TabViewSizingPage | [inline, private]
SetLargeWidth_Click(object sender, object args) | TabViewSizingPage | [inline, private]
SetSmallWidth_Click(object sender, object args) | TabViewSizingPage | [inline, private]
Tabs_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs e) | TabViewSizingPage | [inline, private]
Tabview_AddTabButtonClick(TabView sender, object args) | TabViewSizingPage | [inline, private]
TabViewSizingPage() | TabViewSizingPage | [inline]
Generated on Sun Dec 1 2024 20:54:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/APITests/ScrollPresenterAnchoringTests.cs Source File

  • ScrollPresenter
  • APITests

ScrollPresenterAnchoringTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using MUXControlsTestApp.Utilities;
00006 using System;
00007 using System.Collections.Generic;
00008 using System.Linq;
00009 using System.Threading;
00010 using Windows.UI;
00011 using Microsoft.UI.Xaml;
00012 using Microsoft.UI.Xaml.Controls;
00013 using Microsoft.UI.Xaml.Controls.Primitives;
00014 using Microsoft.UI.Xaml.Media;
00015 using Microsoft.UI.Xaml.Markup;
00016 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common;
00017 using System.Collections.Specialized;
00018
00019 using WEX.TestExecution;
00020 using WEX.TestExecution.Markup;
00021 using WEX.Logging.Interop;
00022
00023 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00024 {
00025     partial class ScrollPresenterTests : ApiTestBase
00026     {
00027         private const double c_defaultAnchoringUIScrollPresenterNonConstrainedSize = 600.0;
00028         private const double c_defaultAnchoringUIScrollPresenterConstrainedSize = 300.0;
00029         private const int c_defaultAnchoringUIStackPanelChildrenCount = 16;
00030         private const int c_defaultAnchoringUIRepeaterChildrenCount = 16;
00031
00032         [TestMethod]
00033         [TestProperty("Description", "Verifies HorizontalOffset remains at 0 when inserting an item at the beginning (HorizontalAnchorRatio=0).")]
00034         public void AnchoringAtLeftEdge()
00035         {
00036             AnchoringAtNearEdge(Orientation.Horizontal);
00037         }
00038
00039         [TestMethod]
00040         [TestProperty("Description", "Verifies VerticalOffset remains at 0 when inserting an item at the beginning (VerticalAnchorRatio=0).")]
00041         public void AnchoringAtTopEdge()
00042         {
00043             AnchoringAtNearEdge(Orientation.Vertical);
00044         }
00045
00046         private void AnchoringAtNearEdge(Orientation orientation)
00047         {
00048             using (ScrollPresenterTestHooksHelper scrollPresenterTestHooksHelper = new ScrollPresenterTestHooksHelper(
00049                 enableAnchorNotifications: true,
00050                 enableInteractionSourcesNotifications: true,
00051                 enableExpressionAnimationStatusNotifications: false))
00052             {
00053                 ScrollPresenter scrollPresenter = null;
00054                 AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00055
00056                 RunOnUIThread.Execute(() =>
00057                 {
00058                     scrollPresenter = new ScrollPresenter();
00059
00060                     SetupDefaultAnchoringUI(orientation, scrollPresenter, scrollPresenterLoadedEvent);
00061                 });
00062
00063                 WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00064
00065                 RunOnUIThread.Execute(() =>
00066                 {
00067                     Log.Comment("Inserting child at near edge");
00068                     InsertStackPanelChild((scrollPresenter.Content as Border).Child as StackPanel, 1 /*operationCount*/, 0 /*newIndex*/, 1 /*newCount*/);
00069                 });
00070
00071                 IdleSynchronizer.Wait();
00072
00073                 RunOnUIThread.Execute(() =>
00074                 {
00075                     Log.Comment("No ScrollPresenter offset change expected");
00076                     if (orientation == Orientation.Vertical)
00077                     {
00078                         Verify.AreEqual(0, scrollPresenter.VerticalOffset);
00079                     }
00080                     else
00081                     {
00082                         Verify.AreEqual(0, scrollPresenter.HorizontalOffset);
00083                     }
00084                 });
00085             }
00086         }
00087
00088         [TestMethod]
00089         [TestProperty("Description", "Verifies HorizontalOffset growns to max value when inserting an item at the end (HorizontalAnchorRatio=1).")]
00090         public void AnchoringAtRightEdgeWhileIncreasingContentWidth()
00091         {
00092             AnchoringAtFarEdgeWhileIncreasingContent(Orientation.Horizontal, 0 /*viewportSizeChange*/, 3876 /*expectedFinalOffset*/);
00093         }
00094
00095         [TestMethod]
00096         [TestProperty("Description", "Verifies VerticalOffset grows to max value when inserting an item at the end (VerticalAnchorRatio=1).")]
00097         public void AnchoringAtBottomEdgeWhileIncreasingContentHeight()
00098         {
00099             AnchoringAtFarEdgeWhileIncreasingContent(Orientation.Vertical, 0 /*viewportSizeChange*/, 3876 /*expectedFinalOffset*/);
00100         }
00101
00102         [TestMethod]
00103         [TestProperty("Description", "Verifies HorizontalOffset growns to max value when inserting an item at the end and growing viewport (HorizontalAnchorRatio=1).")]
00104         public void AnchoringAtRightEdgeWhileIncreasingContentAndViewportWidth()
00105         {
00106             AnchoringAtFarEdgeWhileIncreasingContent(Orientation.Horizontal, 10 /*viewportSizeChange*/, 3866 /*expectedFinalOffset*/);
00107         }
00108
00109         [TestMethod]
00110         [TestProperty("Description", "Verifies VerticalOffset grows to max value when inserting an item at the end and growning viewport (VerticalAnchorRatio=1).")]
00111         public void AnchoringAtBottomEdgeWhileIncreasingContentAndViewportHeight()
00112         {
00113             AnchoringAtFarEdgeWhileIncreasingContent(Orientation.Vertical, 10 /*viewportSizeChange*/, 3866 /*expectedFinalOffset*/);
00114         }
00115
00116         [TestMethod]
00117         [TestProperty("Description", "Verifies HorizontalOffset growns to max value when inserting an item at the end and shrinking viewport (HorizontalAnchorRatio=1).")]
00118         public void AnchoringAtRightEdgeWhileIncreasingContentAndDecreasingViewportWidth()
00119         {
00120             AnchoringAtFarEdgeWhileIncreasingContent(Orientation.Horizontal, -10 /*viewportSizeChange*/, 3886 /*expectedFinalOffset*/);
00121         }
00122
00123         [TestMethod]
00124         [TestProperty("Description", "Verifies VerticalOffset grows to max value when inserting an item at the end and shrinking viewport (VerticalAnchorRatio=1).")]
00125         public void AnchoringAtBottomEdgeWhileIncreasingContentAndDecreasingViewportHeight()
00126         {
00127             AnchoringAtFarEdgeWhileIncreasingContent(Orientation.Vertical, -10 /*viewportSizeChange*/, 3886 /*expectedFinalOffset*/);
00128         }
00129
00130         private void AnchoringAtFarEdgeWhileIncreasingContent(Orientation orientation, double viewportSizeChange, double expectedFinalOffset)
00131         {
00132             using (ScrollPresenterTestHooksHelper scrollPresenterTestHooksHelper = new ScrollPresenterTestHooksHelper(
00133                 enableAnchorNotifications: true,
00134                 enableInteractionSourcesNotifications: true,
00135                 enableExpressionAnimationStatusNotifications: false))
00136             {
00137                 ScrollPresenter scrollPresenter = null;
00138                 AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00139                 AutoResetEvent scrollPresenterViewChangedEvent = new AutoResetEvent(false);
00140
00141                 RunOnUIThread.Execute(() =>
00142                 {
00143                     scrollPresenter = new ScrollPresenter();
00144
00145                     SetupDefaultAnchoringUI(orientation, scrollPresenter, scrollPresenterLoadedEvent);
00146                 });
00147
00148                 WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00149
00150                 ZoomTo(scrollPresenter, 2.0f, 0.0f, 0.0f, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore);
00151
00152                 double horizontalOffset = 0.0;
00153                 double verticalOffset = 0.0;
00154
00155                 RunOnUIThread.Execute(() =>
00156                 {
00157                     if (orientation == Orientation.Vertical)
00158                     {
00159                         verticalOffset = scrollPresenter.ExtentHeight * 2.0 - scrollPresenter.Height;
00160                         scrollPresenter.VerticalAnchorRatio = 1.0;
00161                     }
00162                     else
00163                     {
00164                         horizontalOffset = scrollPresenter.ExtentWidth * 2.0 - scrollPresenter.Width;
00165                         scrollPresenter.HorizontalAnchorRatio = 1.0;
00166                     }
00167                 });
00168
00169                 ScrollTo(scrollPresenter, horizontalOffset, verticalOffset, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore, false /*hookViewChangingAndChanged*/);
00170
00171                 RunOnUIThread.Execute(() =>
00172                 {
00173                     scrollPresenter.ViewChanged += delegate (ScrollPresenter sender, object args)
00174                     {
00175                         Log.Comment("ViewChanged - HorizontalOffset={0}, VerticalOffset={1}, ZoomFactor={2}",
00176                             sender.HorizontalOffset, sender.VerticalOffset, sender.ZoomFactor);
00177                         Log.Comment("ViewChanged - CurrentAnchor is " + (sender.CurrentAnchor == null ? "null" : "non-null"));
00178                         if ((orientation == Orientation.Vertical && expectedFinalOffset == sender.VerticalOffset) ||
00179                             (orientation == Orientation.Horizontal && expectedFinalOffset == sender.HorizontalOffset))
00180                         {
00181                             scrollPresenterViewChangedEvent.Set();
00182                         }
00183                     };
00184
00185                     scrollPresenter.AnchorRequested += delegate (ScrollPresenter sender, ScrollingAnchorRequestedEventArgs args)
00186                     {
00187                         Log.Comment("AnchorRequested - AnchorCandidates.Count={0}", args.AnchorCandidates.Count);
00188                     };
00189
00190                     Log.Comment("Inserting child at far edge");
00191                     InsertStackPanelChild((scrollPresenter.Content as Border).Child as StackPanel, 1 /*operationCount*/, c_defaultAnchoringUIStackPanelChildrenCount /*newIndex*/, 1 /*newCount*/);
00192
00193                     if (viewportSizeChange != 0)
00194                     {
00195                         if (orientation == Orientation.Vertical)
00196                         {
00197                             Log.Comment("Changing viewport height");
00198                             scrollPresenter.Height += viewportSizeChange;
00199                         }
00200                         else
00201                         {
00202                             Log.Comment("Changing viewport width");
00203                             scrollPresenter.Width += viewportSizeChange;
00204                         }
00205                     }
00206                 });
00207
00208                 WaitForEvent("Waiting for ScrollPresenter.ViewChanged event", scrollPresenterViewChangedEvent);
00209                 IdleSynchronizer.Wait();
00210
00211                 RunOnUIThread.Execute(() =>
00212                 {
00213                     if (orientation == Orientation.Vertical)
00214                     {
00215                         verticalOffset = scrollPresenter.ExtentHeight * 2.0 - scrollPresenter.Height;
00216                     }
00217                     else
00218                     {
00219                         horizontalOffset = scrollPresenter.ExtentWidth * 2.0 - scrollPresenter.Width;
00220                     }
00221
00222                     Log.Comment("ScrollPresenter offset change expected");
00223                     Verify.AreEqual(scrollPresenter.HorizontalOffset, horizontalOffset);
00224                     Verify.AreEqual(scrollPresenter.VerticalOffset, verticalOffset);
00225
00226                     Log.Comment("ScrollPresenter CurrentAnchor is " + (scrollPresenter.CurrentAnchor == null ? "null" : "non-null"));
00227                     Verify.IsNull(scrollPresenter.CurrentAnchor);
00228                 });
00229             }
00230         }
00231
00232         [TestMethod]
00233         [TestProperty("Description", "Verifies HorizontalOffset shrinks to max value when decreasing viewport width (HorizontalAnchorRatio=1).")]
00234         public void AnchoringAtRightEdgeWhileDecreasingViewportWidth()
00235         {
00236             AnchoringAtFarEdgeWhileDecreasingViewport(Orientation.Horizontal);
00237         }
00238
00239         [TestMethod]
00240         [TestProperty("Description", "Verifies VerticalOffset shrinks to max value when decreasing viewport height (VerticalAnchorRatio=1).")]
00241         public void AnchoringAtBottomEdgeWhileDecreasingViewportHeight()
00242         {
00243             AnchoringAtFarEdgeWhileDecreasingViewport(Orientation.Vertical);
00244         }
00245
00246         private void AnchoringAtFarEdgeWhileDecreasingViewport(Orientation orientation)
00247         {
00248             using (ScrollPresenterTestHooksHelper scrollPresenterTestHooksHelper = new ScrollPresenterTestHooksHelper(
00249                 enableAnchorNotifications: true,
00250                 enableInteractionSourcesNotifications: true,
00251                 enableExpressionAnimationStatusNotifications: false))
00252             {
00253                 ScrollPresenter scrollPresenter = null;
00254                 AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00255                 AutoResetEvent scrollPresenterViewChangedEvent = new AutoResetEvent(false);
00256
00257                 RunOnUIThread.Execute(() =>
00258                 {
00259                     scrollPresenter = new ScrollPresenter();
00260
00261                     SetupDefaultAnchoringUI(orientation, scrollPresenter, scrollPresenterLoadedEvent);
00262                 });
00263
00264                 WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00265
00266                 ZoomTo(scrollPresenter, 2.0f, 0.0f, 0.0f, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore);
00267
00268                 double horizontalOffset = 0.0;
00269                 double verticalOffset = 0.0;
00270
00271                 RunOnUIThread.Execute(() =>
00272                 {
00273                     if (orientation == Orientation.Vertical)
00274                     {
00275                         verticalOffset = scrollPresenter.ExtentHeight * 2.0 - scrollPresenter.Height;
00276                         scrollPresenter.VerticalAnchorRatio = 1.0;
00277                     }
00278                     else
00279                     {
00280                         horizontalOffset = scrollPresenter.ExtentWidth * 2.0 - scrollPresenter.Width;
00281                         scrollPresenter.HorizontalAnchorRatio = 1.0;
00282                     }
00283                 });
00284
00285                 ScrollTo(scrollPresenter, horizontalOffset, verticalOffset, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore, false /*hookViewChangingAndChanged*/);
00286
00287                 RunOnUIThread.Execute(() =>
00288                 {
00289                     scrollPresenter.ViewChanged += delegate (ScrollPresenter sender, object args)
00290                     {
00291                         Log.Comment("ViewChanged - HorizontalOffset={0}, VerticalOffset={1}, ZoomFactor={2}",
00292                             sender.HorizontalOffset, sender.VerticalOffset, sender.ZoomFactor);
00293                         Log.Comment("ViewChanged - CurrentAnchor is " + (sender.CurrentAnchor == null ? "null" : "non-null"));
00294                         scrollPresenterViewChangedEvent.Set();
00295                     };
00296
00297                     scrollPresenter.AnchorRequested += delegate (ScrollPresenter sender, ScrollingAnchorRequestedEventArgs args)
00298                     {
00299                         Log.Comment("AnchorRequested - AnchorCandidates.Count={0}", args.AnchorCandidates.Count);
00300                     };
00301
00302                     if (orientation == Orientation.Vertical)
00303                     {
00304                         Log.Comment("Decreasing viewport height");
00305                         scrollPresenter.Height -= 100;
00306                     }
00307                     else
00308                     {
00309                         Log.Comment("Decreasing viewport width");
00310                         scrollPresenter.Width -= 100;
00311                     }
00312                 });
00313
00314                 WaitForEvent("Waiting for ScrollPresenter.ViewChanged event", scrollPresenterViewChangedEvent);
00315                 IdleSynchronizer.Wait();
00316
00317                 RunOnUIThread.Execute(() =>
00318                 {
00319                     if (orientation == Orientation.Vertical)
00320                     {
00321                         verticalOffset = scrollPresenter.ExtentHeight * 2.0 - scrollPresenter.Height;
00322                     }
00323                     else
00324                     {
00325                         horizontalOffset = scrollPresenter.ExtentWidth * 2.0 - scrollPresenter.Width;
00326                     }
00327
00328                     Log.Comment("ScrollPresenter offset change expected");
00329                     Verify.AreEqual(scrollPresenter.HorizontalOffset, horizontalOffset);
00330                     Verify.AreEqual(scrollPresenter.VerticalOffset, verticalOffset);
00331
00332                     Log.Comment("ScrollPresenter CurrentAnchor is " + (scrollPresenter.CurrentAnchor == null ? "null" : "non-null"));
00333                     Verify.IsNull(scrollPresenter.CurrentAnchor);
00334                 });
00335             }
00336         }
00337
00338         [TestMethod]
00339         [TestProperty("Description", "Verifies HorizontalOffset growns when inserting an item at the beginning (HorizontalAnchorRatio=0).")]
00340         public void AnchoringAtAlmostLeftEdge()
00341         {
00342             AnchoringAtAlmostNearEdge(Orientation.Horizontal);
00343         }
00344
00345         [TestMethod]
00346         [TestProperty("Description", "Verifies VerticalOffset grows when inserting an item at the beginning (VerticalAnchorRatio=0).")]
00347         public void AnchoringAtAlmostTopEdge()
00348         {
00349             AnchoringAtAlmostNearEdge(Orientation.Vertical);
00350         }
00351
00352         private void AnchoringAtAlmostNearEdge(Orientation orientation)
00353         {
00354             using (ScrollPresenterTestHooksHelper scrollPresenterTestHooksHelper = new ScrollPresenterTestHooksHelper(
00355                 enableAnchorNotifications: true,
00356                 enableInteractionSourcesNotifications: true,
00357                 enableExpressionAnimationStatusNotifications: false))
00358             {
00359                 ScrollPresenter scrollPresenter = null;
00360                 AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00361                 AutoResetEvent scrollPresenterViewChangedEvent = new AutoResetEvent(false);
00362
00363                 RunOnUIThread.Execute(() =>
00364                 {
00365                     scrollPresenter = new ScrollPresenter();
00366
00367                     SetupDefaultAnchoringUI(orientation, scrollPresenter, scrollPresenterLoadedEvent);
00368                 });
00369
00370                 WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00371
00372                 double horizontalOffset = orientation == Orientation.Vertical ? 0.0 : 1.0;
00373                 double verticalOffset = orientation == Orientation.Vertical ? 1.0 : 0.0;
00374
00375                 ScrollTo(scrollPresenter, horizontalOffset, verticalOffset, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore);
00376
00377                 RunOnUIThread.Execute(() =>
00378                 {
00379                     scrollPresenter.ViewChanged += delegate (ScrollPresenter sender, object args)
00380                     {
00381                         Log.Comment("ViewChanged - HorizontalOffset={0}, VerticalOffset={1}, ZoomFactor={2}",
00382                             sender.HorizontalOffset, sender.VerticalOffset, sender.ZoomFactor);
00383                         Log.Comment("ViewChanged - CurrentAnchor is " + (sender.CurrentAnchor == null ? "null" : "non-null"));
00384                         scrollPresenterViewChangedEvent.Set();
00385                     };
00386
00387                     Log.Comment("Inserting child at near edge");
00388                     InsertStackPanelChild((scrollPresenter.Content as Border).Child as StackPanel, 1 /*operationCount*/, 0 /*newIndex*/, 1 /*newCount*/);
00389                 });
00390
00391                 WaitForEvent("Waiting for ScrollPresenter.ViewChanged event", scrollPresenterViewChangedEvent);
00392                 IdleSynchronizer.Wait();
00393
00394                 RunOnUIThread.Execute(() =>
00395                 {
00396                     Log.Comment("ScrollPresenter offset change expected");
00397                     if (orientation == Orientation.Vertical)
00398                     {
00399                         Verify.AreEqual(127.0, scrollPresenter.VerticalOffset);
00400                     }
00401                     else
00402                     {
00403                         Verify.AreEqual(127.0, scrollPresenter.HorizontalOffset);
00404                     }
00405
00406                     Log.Comment("ScrollPresenter CurrentAnchor is " + (scrollPresenter.CurrentAnchor == null ? "null" : "non-null"));
00407                     Verify.IsNotNull(scrollPresenter.CurrentAnchor);
00408                 });
00409             }
00410         }
00411
00412         [TestMethod]
00413         [TestProperty("Description", "Verifies HorizontalOffset does not change when inserting an item at the end (HorizontalAnchorRatio=1).")]
00414         public void AnchoringAtAlmostRightEdge()
00415         {
00416             AnchoringAtAlmostFarEdge(Orientation.Horizontal);
00417         }
00418
00419         [TestMethod]
00420         [TestProperty("Description", "Verifies VerticalOffset does not change when inserting an item at the end (VerticalAnchorRatio=1).")]
00421         public void AnchoringAtAlmostBottomEdge()
00422         {
00423             AnchoringAtAlmostFarEdge(Orientation.Vertical);
00424         }
00425
00426         private void AnchoringAtAlmostFarEdge(Orientation orientation)
00427         {
00428             using (ScrollPresenterTestHooksHelper scrollPresenterTestHooksHelper = new ScrollPresenterTestHooksHelper(
00429                 enableAnchorNotifications: true,
00430                 enableInteractionSourcesNotifications: true,
00431                 enableExpressionAnimationStatusNotifications: false))
00432             {
00433                 ScrollPresenter scrollPresenter = null;
00434                 AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00435
00436                 RunOnUIThread.Execute(() =>
00437                 {
00438                     scrollPresenter = new ScrollPresenter();
00439
00440                     SetupDefaultAnchoringUI(orientation, scrollPresenter, scrollPresenterLoadedEvent);
00441                 });
00442
00443                 WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00444
00445                 ZoomTo(scrollPresenter, 2.0f, 0.0f, 0.0f, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore);
00446
00447                 double horizontalOffset = 0.0;
00448                 double verticalOffset = 0.0;
00449
00450                 RunOnUIThread.Execute(() =>
00451                 {
00452                     if (orientation == Orientation.Vertical)
00453                     {
00454                         verticalOffset = scrollPresenter.ExtentHeight * 2.0 - scrollPresenter.Height - 1.0;
00455                         scrollPresenter.VerticalAnchorRatio = 1.0;
00456                     }
00457                     else
00458                     {
00459                         horizontalOffset = scrollPresenter.ExtentWidth * 2.0 - scrollPresenter.Width - 1.0;
00460                         scrollPresenter.HorizontalAnchorRatio = 1.0;
00461                     }
00462                 });
00463
00464                 ScrollTo(scrollPresenter, horizontalOffset, verticalOffset, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore, false /*hookViewChangingAndChanged*/);
00465
00466                 RunOnUIThread.Execute(() =>
00467                 {
00468                     Log.Comment("Inserting child at far edge");
00469                     InsertStackPanelChild((scrollPresenter.Content as Border).Child as StackPanel, 1 /*operationCount*/, c_defaultAnchoringUIStackPanelChildrenCount /*newIndex*/, 1 /*newCount*/);
00470                 });
00471
00472                 IdleSynchronizer.Wait();
00473
00474                 RunOnUIThread.Execute(() =>
00475                 {
00476                     Log.Comment("No ScrollPresenter offset change expected");
00477                     if (orientation == Orientation.Vertical)
00478                     {
00479                         Verify.AreEqual(scrollPresenter.VerticalOffset, verticalOffset);
00480                     }
00481                     else
00482                     {
00483                         Verify.AreEqual(scrollPresenter.HorizontalOffset, horizontalOffset);
00484                     }
00485
00486                     Log.Comment("ScrollPresenter CurrentAnchor is " + (scrollPresenter.CurrentAnchor == null ? "null" : "non-null"));
00487                     Verify.IsNotNull(scrollPresenter.CurrentAnchor);
00488                 });
00489             }
00490         }
00491
00492         [TestMethod]
00493         [TestProperty("Description", "Verifies HorizontalOffset increases when shrinking the viewport width (HorizontalAnchorRatio=0.5).")]
00494         public void AnchoringElementWithShrinkingViewport()
00495         {
00496             AnchoringElementWithResizedViewport(Orientation.Horizontal, -100.0);
00497         }
00498
00499         [TestMethod]
00500         [TestProperty("Description", "Verifies VerticalOffset decreases when growning the viewport height (VerticalAnchorRatio=0.5).")]
00501         public void AnchoringElementWithGrowningViewport()
00502         {
00503             AnchoringElementWithResizedViewport(Orientation.Vertical, 100.0);
00504         }
00505
00506         private void AnchoringElementWithResizedViewport(Orientation orientation, double viewportSizeChange)
00507         {
00508             using (ScrollPresenterTestHooksHelper scrollPresenterTestHooksHelper = new ScrollPresenterTestHooksHelper(
00509                 enableAnchorNotifications: true,
00510                 enableInteractionSourcesNotifications: true,
00511                 enableExpressionAnimationStatusNotifications: false))
00512             {
00513                 ScrollPresenter scrollPresenter = null;
00514                 AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00515                 AutoResetEvent scrollPresenterViewChangedEvent = new AutoResetEvent(false);
00516
00517                 RunOnUIThread.Execute(() =>
00518                 {
00519                     scrollPresenter = new ScrollPresenter();
00520
00521                     SetupDefaultAnchoringUI(orientation, scrollPresenter, scrollPresenterLoadedEvent);
00522                 });
00523
00524                 WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00525
00526                 ZoomTo(scrollPresenter, 2.0f, 0.0f, 0.0f, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore);
00527
00528                 double horizontalOffset = 0.0;
00529                 double verticalOffset = 0.0;
00530
00531                 RunOnUIThread.Execute(() =>
00532                 {
00533                     if (orientation == Orientation.Vertical)
00534                     {
00535                         verticalOffset = (scrollPresenter.ExtentHeight * 2.0 - scrollPresenter.Height) / 2.0;
00536                         scrollPresenter.VerticalAnchorRatio = 0.5;
00537                     }
00538                     else
00539                     {
00540                         horizontalOffset = (scrollPresenter.ExtentWidth * 2.0 - scrollPresenter.Width) / 2.0;
00541                         scrollPresenter.HorizontalAnchorRatio = 0.5;
00542                     }
00543                 });
00544
00545                 ScrollTo(scrollPresenter, horizontalOffset, verticalOffset, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore, false /*hookViewChangingAndChanged*/);
00546
00547                 RunOnUIThread.Execute(() =>
00548                 {
00549                     Log.Comment("ScrollPresenter view prior to viewport size change: HorizontalOffset={0}, VerticalOffset={1}, ZoomFactor={2}",
00550                             scrollPresenter.HorizontalOffset, scrollPresenter.VerticalOffset, scrollPresenter.ZoomFactor);
00551
00552                     scrollPresenter.ViewChanged += delegate (ScrollPresenter sender, object args)
00553                     {
00554                         Log.Comment("ViewChanged - HorizontalOffset={0}, VerticalOffset={1}, ZoomFactor={2}",
00555                             sender.HorizontalOffset, sender.VerticalOffset, sender.ZoomFactor);
00556                         Log.Comment("ViewChanged - CurrentAnchor is " + (sender.CurrentAnchor == null ? "null" : "non-null"));
00557                         scrollPresenterViewChangedEvent.Set();
00558                     };
00559
00560                     if (orientation == Orientation.Vertical)
00561                     {
00562                         Log.Comment("Changing viewport height");
00563                         scrollPresenter.Height += viewportSizeChange;
00564                     }
00565                     else
00566                     {
00567                         Log.Comment("Changing viewport width");
00568                         scrollPresenter.Width += viewportSizeChange;
00569                     }
00570                 });
00571
00572                 WaitForEvent("Waiting for ScrollPresenter.ViewChanged event", scrollPresenterViewChangedEvent);
00573                 IdleSynchronizer.Wait();
00574
00575                 RunOnUIThread.Execute(() =>
00576                 {
00577                     Log.Comment("ScrollPresenter view after viewport size change: HorizontalOffset={0}, VerticalOffset={1}, ZoomFactor={2}",
00578                             scrollPresenter.HorizontalOffset, scrollPresenter.VerticalOffset, scrollPresenter.ZoomFactor);
00579                     Log.Comment("Expecting offset change equal to half the viewport size change");
00580                     if (orientation == Orientation.Vertical)
00581                     {
00582                         Verify.AreEqual(scrollPresenter.VerticalOffset, verticalOffset - viewportSizeChange / 2.0);
00583                     }
00584                     else
00585                     {
00586                         Verify.AreEqual(scrollPresenter.HorizontalOffset, horizontalOffset - viewportSizeChange / 2.0);
00587                     }
00588
00589                     Log.Comment("ScrollPresenter CurrentAnchor is " + (scrollPresenter.CurrentAnchor == null ? "null" : "non-null"));
00590                     Verify.IsNotNull(scrollPresenter.CurrentAnchor);
00591                 });
00592             }
00593         }
00594
00595         private void SetupDefaultAnchoringUI(
00596             Orientation orientation,
00597             ScrollPresenter scrollPresenter,
00598             AutoResetEvent scrollPresenterLoadedEvent)
00599         {
00600             Log.Comment("Setting up default anchoring UI with ScrollPresenter");
00601
00602             StackPanel stackPanel = new StackPanel();
00603             stackPanel.Name = "stackPanel";
00604             stackPanel.Orientation = orientation;
00605             stackPanel.Margin = new Thickness(30);
00606
00607             Border border = new Border();
00608             border.Name = "border";
00609             border.BorderThickness = new Thickness(3);
00610             border.BorderBrush = new SolidColorBrush(Microsoft.UI.Colors.Chartreuse);
00611             border.Margin = new Thickness(15);
00612             border.Background = new SolidColorBrush(Microsoft.UI.Colors.Beige);
00613             border.Child = stackPanel;
00614
00615             Verify.IsNotNull(scrollPresenter);
00616             scrollPresenter.Name = "scrollPresenter";
00617             if (orientation == Orientation.Vertical)
00618             {
00619                 scrollPresenter.ContentOrientation = ScrollingContentOrientation.Vertical;
00620                 scrollPresenter.Width = c_defaultAnchoringUIScrollPresenterConstrainedSize;
00621                 scrollPresenter.Height = c_defaultAnchoringUIScrollPresenterNonConstrainedSize;
00622             }
00623             else
00624             {
00625                 scrollPresenter.ContentOrientation = ScrollingContentOrientation.Horizontal;
00626                 scrollPresenter.Width = c_defaultAnchoringUIScrollPresenterNonConstrainedSize;
00627                 scrollPresenter.Height = c_defaultAnchoringUIScrollPresenterConstrainedSize;
00628             }
00629             scrollPresenter.Background = new SolidColorBrush(Microsoft.UI.Colors.AliceBlue);
00630             scrollPresenter.Content = border;
00631
00632             InsertStackPanelChild(stackPanel, 0 /*operationCount*/, 0 /*newIndex*/, c_defaultAnchoringUIStackPanelChildrenCount /*newCount*/);
00633
00634             if (scrollPresenterLoadedEvent != null)
00635             {
00636                 scrollPresenter.Loaded += (object sender, RoutedEventArgs e) =>
00637                 {
00638                     Log.Comment("ScrollPresenter.Loaded event handler");
00639                     scrollPresenterLoadedEvent.Set();
00640                 };
00641             }
00642
00643             scrollPresenter.AnchorRequested += (ScrollPresenter sender, ScrollingAnchorRequestedEventArgs args) =>
00644             {
00645                 Log.Comment("ScrollPresenter.AnchorRequested event handler");
00646
00647                 Verify.IsNull(args.AnchorElement);
00648                 Verify.AreEqual(0, args.AnchorCandidates.Count);
00649
00650                 StackPanel sp = (sender.Content as Border).Child as StackPanel;
00651                 foreach (Border b in sp.Children)
00652                 {
00653                     args.AnchorCandidates.Add(b);
00654                 }
00655             };
00656
00657             Log.Comment("Setting window content");
00658             Content = scrollPresenter;
00659         }
00660
00661         private void InsertStackPanelChild(StackPanel stackPanel, int operationCount, int newIndex, int newCount, string namePrefix = "")
00662         {
00663             if (newIndex < 0 || newIndex > stackPanel.Children.Count || newCount <= 0)
00664             {
00665                 throw new ArgumentException();
00666             }
00667
00668             SolidColorBrush chartreuseBrush = new SolidColorBrush(Microsoft.UI.Colors.Chartreuse);
00669             SolidColorBrush blanchedAlmondBrush = new SolidColorBrush(Microsoft.UI.Colors.BlanchedAlmond);
00670
00671             for (int i = 0; i < newCount; i++)
00672             {
00673                 TextBlock textBlock = new TextBlock();
00674                 textBlock.Text = "TB#" + stackPanel.Children.Count + "_" + operationCount;
00675                 textBlock.Name = namePrefix + "textBlock" + stackPanel.Children.Count + "_" + operationCount;
00676                 textBlock.HorizontalAlignment = HorizontalAlignment.Center;
00677                 textBlock.VerticalAlignment = VerticalAlignment.Center;
00678
00679                 Border border = new Border();
00680                 border.Name = namePrefix + "border" + stackPanel.Children.Count + "_" + operationCount;
00681                 border.BorderThickness = border.Margin = new Thickness(3);
00682                 border.BorderBrush = chartreuseBrush;
00683                 border.Background = blanchedAlmondBrush;
00684                 border.Width = stackPanel.Orientation == Orientation.Vertical ? 170 : 120;
00685                 border.Height = stackPanel.Orientation == Orientation.Vertical ? 120 : 170;
00686                 border.Child = textBlock;
00687
00688                 stackPanel.Children.Insert(newIndex + i, border);
00689             }
00690         }
00691
00692         [TestMethod]
00693         [TestProperty("Description", "Verifies vertical offset does not exceed its max value because of anchoring, when reducing the extent height.")]
00694         public void AnchoringWithReducedExtent()
00695         {
00696             AnchoringWithOffsetCoercion(false /*reduceAnchorOffset*/);
00697         }
00698
00699         [TestMethod]
00700         [TestProperty("Description", "Verifies vertical offset does not exceed its max value because of anchoring, when reducing the extent height and anchor offset.")]
00701         public void AnchoringWithReducedExtentAndAnchorOffset()
00702         {
00703             AnchoringWithOffsetCoercion(true /*reduceAnchorOffset*/);
00704         }
00705
00706         private void AnchoringWithOffsetCoercion(bool reduceAnchorOffset)
00707         {
00708             using (ScrollPresenterTestHooksHelper scrollPresenterTestHooksHelper = new ScrollPresenterTestHooksHelper(
00709                 enableAnchorNotifications: true,
00710                 enableInteractionSourcesNotifications: true,
00711                 enableExpressionAnimationStatusNotifications: false))
00712             {
00713                 ScrollPresenter scrollPresenter = null;
00714                 Border anchorElement = null;
00715                 AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00716                 AutoResetEvent scrollPresenterViewChangedEvent = new AutoResetEvent(false);
00717                 AutoResetEvent scrollPresenterAnchorRequestedEvent = new AutoResetEvent(false);
00718
00719                 // This test validates that the ScrollPresenter accounts for maximum vertical offset (based on viewport and content extent)
00720                 // when calculating the vertical offset shift for anchoring. The vertical offset cannot exceed content extent - viewport.
00721
00722                 RunOnUIThread.Execute(() =>
00723                 {
00724                     Log.Comment("Visual tree setup");
00725                     anchorElement = new Border
00726                     {
00727                         Width = 100,
00728                         Height = 100,
00729                         Background = new SolidColorBrush(Microsoft.UI.Colors.Red),
00730                         Margin = new Thickness(0, 600, 0, 0),
00731                         VerticalAlignment = VerticalAlignment.Top
00732                     };
00733
00734                     Grid grid = new Grid();
00735                     grid.Children.Add(anchorElement);
00736                     grid.Width = 200;
00737                     grid.Height = 1000;
00738                     grid.Background = new SolidColorBrush(Microsoft.UI.Colors.Gray);
00739
00740                     scrollPresenter = new ScrollPresenter
00741                     {
00742                         Content = grid,
00743                         Width = 200,
00744                         Height = 200
00745                     };
00746
00747                     scrollPresenter.Loaded += (object sender, RoutedEventArgs e) =>
00748                     {
00749                         Log.Comment("ScrollPresenter.Loaded event handler");
00750                         scrollPresenterLoadedEvent.Set();
00751                     };
00752
00753                     scrollPresenter.ViewChanged += delegate (ScrollPresenter sender, object args)
00754                     {
00755                         Log.Comment("ViewChanged - HorizontalOffset={0}, VerticalOffset={1}, ZoomFactor={2}",
00756                             sender.HorizontalOffset, sender.VerticalOffset, sender.ZoomFactor);
00757                         Log.Comment("ViewChanged - CurrentAnchor is " + (sender.CurrentAnchor == null ? "null" : "non-null"));
00758                         if ((reduceAnchorOffset && sender.VerticalOffset == 400) ||
00759                             (!reduceAnchorOffset && sender.VerticalOffset == 500))
00760                         {
00761                             scrollPresenterViewChangedEvent.Set();
00762                         }
00763                     };
00764
00765                     scrollPresenter.AnchorRequested += delegate (ScrollPresenter sender, ScrollingAnchorRequestedEventArgs args)
00766                     {
00767                         Log.Comment("AnchorRequested - Forcing the red Border to be the ScrollPresenter anchor.");
00768                         args.AnchorElement = anchorElement;
00769                         scrollPresenterAnchorRequestedEvent.Set();
00770                     };
00771
00772                     Log.Comment("Setting window content");
00773                     Content = scrollPresenter;
00774                 });
00775
00776                 WaitForEvent("Waiting for ScrollPresenter.Loaded event", scrollPresenterLoadedEvent);
00777                 IdleSynchronizer.Wait();
00778
00779                 ScrollTo(scrollPresenter, 0.0, 600.0, ScrollingAnimationMode.Disabled, ScrollingSnapPointsMode.Ignore);
00780
00781                 RunOnUIThread.Execute(() =>
00782                 {
00783                     Verify.AreEqual(600, scrollPresenter.VerticalOffset);
00784
00785                     Log.Comment("ScrollPresenter.Content height is reduced by 300px. ScrollPresenter.VerticalOffset is expected to be reduced by 100px (600 -> 500).");
00786                     (scrollPresenter.Content as Grid).Height = 700;
00787                     if (reduceAnchorOffset)
00788                     {
00789                         Log.Comment("Tracked element is shifted up by 200px within the ScrollPresenter.Content (600 -> 400). Anchoring is expected to reduce the VerticalOffset by half of that (500 -> 400).");
00790                         anchorElement.Margin = new Thickness(0, 400, 0, 0);
00791                     }
00792                     scrollPresenterViewChangedEvent.Reset();
00793                 });
00794
00795                 WaitForEvent("Waiting for ScrollPresenter.ViewChanged event", scrollPresenterViewChangedEvent);
00796                 WaitForEvent("Waiting for ScrollPresenter.AnchorRequested event", scrollPresenterAnchorRequestedEvent);
00797                 IdleSynchronizer.Wait();
00798
00799                 RunOnUIThread.Execute(() =>
00800                 {
00801                     Verify.AreEqual(reduceAnchorOffset ? 400 : 500, scrollPresenter.VerticalOffset);
00802
00803                     Log.Comment("ScrollPresenter CurrentAnchor is " + (scrollPresenter.CurrentAnchor == null ? "null" : "non-null"));
00804                     Verify.IsNotNull(scrollPresenter.CurrentAnchor);
00805                 });
00806             }
00807         }
00808
00809         [TestMethod]
00810         [TestProperty("Description", "Verifies VerticalOffset adjusts when inserting and removing items at the beginning (VerticalAnchorRatio=0.5).")]
00811         public void AnchoringAtRepeaterMiddle()
00812         {
00813             using (ScrollPresenterTestHooksHelper scrollPresenterTestHooksHelper = new ScrollPresenterTestHooksHelper(
00814                 enableAnchorNotifications: true,
00815                 enableInteractionSourcesNotifications: true,
00816                 enableExpressionAnimationStatusNotifications: false))
00817             {
00818                 using (PrivateLoggingHelper privateLoggingHelper = new PrivateLoggingHelper("ScrollPresenter"))
00819                 {
00820                     ScrollPresenter scrollPresenter = null;
00821                     AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false);
00822                     AutoResetEvent scrollPresenterViewChangedEvent = new AutoResetEvent(false);
00823
00824                     RunOnUIThread.Execute(() =>
00825                     {
00826                         scrollPresenter = new ScrollPresenter();
00827
00828                         SetupRepeaterAnchoringUI(scrollPresenter, scrollPresenterLoadedEvent);
00829
00830                         scrollPresenter.HorizontalAnchorRatio = double.NaN;
00831                         scrollPresenter.VerticalAnchorRatio = 0.5;
00832                     });
00833
00834                     WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent);
00835
00836                     ZoomTo(scrollPresenter, 2.0f, 0.0f, 0.0f, ScrollingAnimationMode.Enabled, ScrollingSnapPointsMode.Ignore);
00837                     ScrollTo(scrollPresenter, 0.0, 250.0, ScrollingAnimationMode.Enabled, ScrollingSnapPointsMode.Ignore, false /*hookViewChangingAndChanged*/);
00838
00839                     ItemsRepeater repeater = null;
00840                     TestDataSource dataSource = null;
00841
00842                     RunOnUIThread.Execute(() =>
00843                     {
00844                         repeater = (scrollPresenter.Content as Border).Child as ItemsRepeater;
00845                         dataSource = repeater.ItemsSource as TestDataSource;
00846
00847                         scrollPresenter.ViewChanged += delegate (ScrollPresenter sender, object args) {
00848                             scrollPresenterViewChangedEvent.Set();
00849                         };
00850
00851                         Log.Comment("Inserting items at the beginning");
00852                         dataSource.Insert(0 /*index*/, 2 /*count*/);
00853                     });
00854
00855                     WaitForEvent("Waiting for ScrollPresenter.ViewChanged event", scrollPresenterViewChangedEvent);
00856
00857                     RunOnUIThread.Execute(() =>
00858                     {
00859                         Log.Comment("ScrollPresenter offset change expected");
00860                         Verify.AreEqual(520.0, scrollPresenter.VerticalOffset);
00861                     });
00862
00863                     RunOnUIThread.Execute(() =>
00864                     {
00865                         scrollPresenterViewChangedEvent.Reset();
00866
00867                         Log.Comment("Removing items from the beginning");
00868                         dataSource.Remove(0 /*index*/, 2 /*count*/);
00869                     });
00870
00871                     WaitForEvent("Waiting for ScrollPresenter.ViewChanged event", scrollPresenterViewChangedEvent);
00872
00873                     RunOnUIThread.Execute(() =>
00874                     {
00875                         Log.Comment("ScrollPresenter offset change expected");
00876                         Verify.AreEqual(250.0, scrollPresenter.VerticalOffset);
00877
00878                         Log.Comment("ScrollPresenter CurrentAnchor is " + (scrollPresenter.CurrentAnchor == null ? "null" : "non-null"));
00879                         Verify.IsNotNull(scrollPresenter.CurrentAnchor);
00880                     });
00881                 }
00882             }
00883         }
00884
00885         private void SetupRepeaterAnchoringUI(
00886             ScrollPresenter scrollPresenter,
00887             AutoResetEvent scrollPresenterLoadedEvent)
00888         {
00889             Log.Comment("Setting up ItemsRepeater anchoring UI with ScrollPresenter and ItemsRepeater");
00890
00891             TestDataSource dataSource = new TestDataSource(
00892                 Enumerable.Range(0, c_defaultAnchoringUIRepeaterChildrenCount).Select(i => string.Format("Item #{0}", i)).ToList());
00893
00894             RecyclingElementFactory elementFactory = new RecyclingElementFactory();
00895             elementFactory.RecyclePool = new RecyclePool();
00896             elementFactory.Templates["Item"] = XamlReader.Load(
00897                     @"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00898                         <Border BorderThickness='3' BorderBrush='Chartreuse' Width='100' Height='100' Margin='3' Background='BlanchedAlmond'>
00899                           <TextBlock Text='{Binding}' HorizontalAlignment='Center' VerticalAlignment='Center'/>
00900                         </Border>
00901                       </DataTemplate>") as DataTemplate;
00902
00903             ItemsRepeater repeater = new ItemsRepeater()
00904             {
00905                 Name = "repeater",
00906                 ItemsSource = dataSource,
00907                 ItemTemplate = elementFactory,
00908                 Layout = new UniformGridLayout()
00909                 {
00910                     MinItemWidth = 125,
00911                     MinItemHeight = 125,
00912                     MinRowSpacing = 10,
00913                     MinColumnSpacing = 10
00914                 },
00915                 Margin = new Thickness(30)
00916             };
00917
00918             Border border = new Border()
00919             {
00920                 Name = "border",
00921                 BorderThickness = new Thickness(3),
00922                 BorderBrush = new SolidColorBrush(Microsoft.UI.Colors.Chartreuse),
00923                 Margin = new Thickness(15),
00924                 Background = new SolidColorBrush(Microsoft.UI.Colors.Beige),
00925                 Child = repeater
00926             };
00927
00928             Verify.IsNotNull(scrollPresenter);
00929             scrollPresenter.Name = "scrollPresenter";
00930             scrollPresenter.ContentOrientation = ScrollingContentOrientation.Vertical;
00931             scrollPresenter.Width = 400;
00932             scrollPresenter.Height = 600;
00933             scrollPresenter.Background = new SolidColorBrush(Microsoft.UI.Colors.AliceBlue);
00934             scrollPresenter.Content = border;
00935
00936             if (scrollPresenterLoadedEvent != null)
00937             {
00938                 scrollPresenter.Loaded += (object sender, RoutedEventArgs e) =>
00939                 {
00940                     Log.Comment("ScrollPresenter.Loaded event handler");
00941                     scrollPresenterLoadedEvent.Set();
00942                 };
00943             }
00944
00945             scrollPresenter.AnchorRequested += (ScrollPresenter sender, ScrollingAnchorRequestedEventArgs args) =>
00946             {
00947                 Log.Comment("ScrollPresenter.AnchorRequested event handler");
00948
00949                 Verify.IsNull(args.AnchorElement);
00950                 Verify.IsGreaterThan(args.AnchorCandidates.Count, 0);
00951             };
00952
00953             Log.Comment("Setting window content");
00954             Content = scrollPresenter;
00955         }
00956
00957         private class TestDataSource : CustomItemsSourceViewWithUniqueIdMapping
00958         {
00959             public TestDataSource(List<string> source)
00960             {
00961                 Inner = source;
00962             }
00963
00964             public List<string> Inner
00965             {
00966                 get;
00967                 set;
00968             }
00969
00970             protected override int GetSizeCore()
00971             {
00972                 return Inner.Count;
00973             }
00974
00975             protected override object GetAtCore(int index)
00976             {
00977                 return Inner[index];
00978             }
00979
00980             protected override string KeyFromIndexCore(int index)
00981             {
00982                 return Inner[index].ToString();
00983             }
00984
00985             public void Insert(int index, int count)
00986             {
00987                 for (int i = 0; i < count; i++)
00988                 {
00989                     Inner.Insert(index + i, string.Format("ItemI #{0}", Inner.Count));
00990                 }
00991
00992                 OnItemsSourceChanged(CollectionChangeEventArgsConverters.CreateNotifyArgs(
00993                     NotifyCollectionChangedAction.Add,
00994                     oldStartingIndex: -1,
00995                     oldItemsCount: 0,
00996                     newStartingIndex: index,
00997                     newItemsCount: count));
00998             }
00999
01000             public void Remove(int index, int count)
01001             {
01002                 for (int i = 0; i < count; i++)
01003                 {
01004                     Inner.RemoveAt(index);
01005                 }
01006
01007                 OnItemsSourceChanged(CollectionChangeEventArgsConverters.CreateNotifyArgs(
01008                     NotifyCollectionChangedAction.Remove,
01009                     oldStartingIndex: index,
01010                     oldItemsCount: count,
01011                     newStartingIndex: -1,
01012                     newItemsCount: 0));
01013             }
01014         }
01015     }
01016 }
Generated on Sun Dec 1 2024 20:52:12 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ElementFactoryRecycleArgsDownlevel Member List

This is the complete list of members for ElementFactoryRecycleArgsDownlevel, including all inherited members.
abi_enter() | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
CheckThread() | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< ElementFactoryRecycleArgsDownlevel > &&self) noexcept | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline, static]
Element() | ElementFactoryRecycleArgsDownlevel |
Element(winrt::UIElement const &value) | ElementFactoryRecycleArgsDownlevel |
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
final_release(std::unique_ptr< ElementFactoryRecycleArgsDownlevel > &&self) | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline, static]
GetBase() | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
GetInner() | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
GetRuntimeClassName() const | ElementFactoryRecycleArgsDownlevel | [inline]
IsOnThread() | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
operator class_type() const noexcept | ElementFactoryRecycleArgsDownlevel | [inline]
Parent() | ElementFactoryRecycleArgsDownlevel |
Parent(winrt::UIElement const &value) | ElementFactoryRecycleArgsDownlevel |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ElementFactoryRecycleArgsDownlevel, reference_tracker_implements_t< winrt::Microsoft::UI::Xaml::IElementFactoryRecycleArgs >::type > | [inline]
Generated on Sun Dec 1 2024 20:52:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MapControl/MapIcon.cpp Source File

  • MapControl

MapIcon.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MapIcon.h"
00007 #include "RuntimeProfiler.h"
00008 #include "ResourceAccessor.h"
00009 #include "MapControl.h"
00010 #include "MapElementsLayer.h"
00011
00012 MapIcon::MapIcon()
00013 {
00014 }
00015
00016 void  MapIcon::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00017 {
00018     winrt::IDependencyProperty property = args.Property();
00019
00020     if (property == s_LocationProperty)
00021     {
00022         auto map = SharedHelpers::GetAncestorOfType<winrt::MapControl>(winrt::VisualTreeHelper::GetParent(*this));
00023         auto layer = SharedHelpers::GetAncestorOfType<winrt::MapElementsLayer>(winrt::VisualTreeHelper::GetParent(*this));
00024         if (map && layer)
00025         {
00026             winrt::get_self<MapControl>(map)->UpdateMapIcon(Location(), Id,  winrt::get_self<MapElementsLayer>(layer)->Id);
00027         }
00028     }
00029 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/TestUI/ScrollPresenterAccessibilityPage.xaml.cs Source File

  • ScrollPresenter
  • TestUI

ScrollPresenterAccessibilityPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml.Automation.Peers;
00006 using Microsoft.UI.Xaml.Automation.Provider;
00007
00008 namespace MUXControlsTestApp
00009 {
00010     public sealed partial class ScrollPresenterAccessibilityPage : TestPage
00011     {
00012         private IScrollProvider scrollPresenterAutomationPeer;
00013
00014         public ScrollPresenterAccessibilityPage()
00015         {
00016             this.InitializeComponent();
00017         }
00018
00019         private void BtnSetScrollPercent_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
00020         {
00021             EnsureAutomationPeer();
00022
00023             if (scrollPresenterAutomationPeer != null)
00024             {
00025                 scrollPresenterAutomationPeer.SetScrollPercent(
00026                     Math.Min(100.0, scrollPresenterAutomationPeer.HorizontalScrollPercent + 10.0),
00027                     Math.Min(100.0, scrollPresenterAutomationPeer.VerticalScrollPercent + 15.0));
00028             }
00029         }
00030
00031         private void EnsureAutomationPeer()
00032         {
00033             if (scrollPresenterAutomationPeer == null)
00034             {
00035                 scrollPresenterAutomationPeer = FrameworkElementAutomationPeer.CreatePeerForElement(scrollPresenter) as IScrollProvider;
00036             }
00037         }
00038     }
00039 }
Generated on Sun Dec 1 2024 20:52:16 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CompositionScrollControllerOffsetChangeCompletedEventArgs Member List

This is the complete list of members for CompositionScrollControllerOffsetChangeCompletedEventArgs, including all inherited members.
CompositionScrollControllerOffsetChangeCompletedEventArgs(int offsetChangeCorrelationId) | CompositionScrollControllerOffsetChangeCompletedEventArgs | [inline, private]
OffsetChangeCorrelationId | CompositionScrollControllerOffsetChangeCompletedEventArgs |
Generated on Sun Dec 1 2024 20:54:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TitleBar/TitleBarAutomationPeer.cpp Source File

  • TitleBar

TitleBarAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿#include "pch.h"
00002 #include "common.h"
00003 #include "ResourceAccessor.h"
00004 #include "TitleBarAutomationPeer.h"
00005 #include <UIAutomationCore.h>
00006 #include <UIAutomationCoreApi.h>
00007 #include "TitleBarAutomationPeer.properties.cpp"
00008
00009 TitleBarAutomationPeer::TitleBarAutomationPeer(winrt::TitleBar const& owner) : ReferenceTracker(owner)
00010 {
00011 }
00012
00013 winrt::AutomationControlType TitleBarAutomationPeer::GetAutomationControlTypeCore()
00014 {
00015     return winrt::AutomationControlType::TitleBar;
00016 }
00017
00018 winrt::hstring TitleBarAutomationPeer::GetClassNameCore()
00019 {
00020     return winrt::hstring_name_of<winrt::TitleBar>();
00021 }
00022
00023 winrt::hstring TitleBarAutomationPeer::GetNameCore()
00024 {
00025     winrt::hstring name = __super::GetNameCore();
00026
00027     if (name.empty())
00028     {
00029         if (auto titleBar = Owner().try_as<winrt::TitleBar>())
00030         {
00031             name = titleBar.Title();
00032         }
00033     }
00034
00035     return name;
00036 }
Generated on Sun Dec 1 2024 20:52:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IPosterizeEffect Member List

This is the complete list of members for IPosterizeEffect, including all inherited members.
BlueValueCount([out, retval] INT32 *value) | IPosterizeEffect
BlueValueCount([in] INT32 value) | IPosterizeEffect
GreenValueCount([out, retval] INT32 *value) | IPosterizeEffect
GreenValueCount([in] INT32 value) | IPosterizeEffect
RedValueCount([out, retval] INT32 *value) | IPosterizeEffect
RedValueCount([in] INT32 value) | IPosterizeEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | IPosterizeEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | IPosterizeEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: dll/XamlMetadataProviderGenerated.h Source File

  • dll

XamlMetadataProviderGenerated.h

Go to the documentation of this file.
00001
00002
00003 //////////////////////////////////////////////////////////////
00004 /// WARNING: Generated File: Please do not modify manually ///
00005 //////////////////////////////////////////////////////////////
00006
00007 #include "pch.h"
00008 #include "common.h"
00009 #include "XamlControlsResources.h"
00010
00011 namespace {
00012
00013 template <typename Factory>
00014 winrt::IInspectable ActivateInstanceWithFactory(_In_ PCWSTR typeName)
00015 {
00016     auto factory = GetFactory<Factory>(typeName);
00017     winrt::IInspectable inner;
00018     return factory.as<Factory>().CreateInstance(nullptr, inner);
00019 }
00020
00021 template <typename Factory>
00022 Factory GetFactory(_In_ PCWSTR typeName)
00023 {
00024     winrt::IActivationFactory _activationFactory{ nullptr };
00025     winrt::hstring activatableClassId{ typeName };
00026
00027     if (FAILED(WINRT_GetActivationFactory(winrt::get_abi(activatableClassId), winrt::put_abi(_activationFactory))))
00028     {
00029         return nullptr;
00030     }
00031     else
00032     {
00033         return _activationFactory.as<Factory>();
00034     }
00035 }
00036
00037 winrt::IInspectable ActivateInstance(_In_ PCWSTR typeName)
00038 {
00039     winrt::IActivationFactory _activationFactory{ nullptr };
00040     winrt::hstring activatableClassId{ typeName };
00041     winrt::check_hresult(WINRT_GetActivationFactory(winrt::get_abi(activatableClassId), winrt::put_abi(_activationFactory)));
00042
00043     return _activationFactory.ActivateInstance<winrt::IInspectable>();
00044 }
00045
00046 struct Entry
00047 {
00048     hstring typeName;
00049     std::function<winrt::IXamlType()> createXamlTypeCallback;
00050     winrt::IXamlType xamlType;
00051 };
00052
00053 Entry c_typeEntries[] =
00054 {
00055     {
00056         /* Arg1 TypeName */
00057         L"Microsoft.UI.Xaml.Controls.AnimatedIcon",
00058         /* Arg2 CreateXamlTypeCallback */
00059         []()
00060         {
00061             auto xamlType = winrt::make_self<XamlType>(
00062                 /* Arg 1 - TypeName */
00063                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedIcon",
00064                 /* Arg 2 - BaseTypeName */
00065                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IconElement",
00066                 /* Arg 3 - Activator func */
00067                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IAnimatedIconFactory>(L"Microsoft.UI.Xaml.Controls.AnimatedIcon"); },
00068                 /* Arg 4 - Populate properties func */
00069                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00070                 {
00071                     winrt::IAnimatedIconStatics statics = GetFactory<winrt::IAnimatedIconStatics>(L"Microsoft.UI.Xaml.Controls.AnimatedIcon");
00072                     {
00073                         xamlType.AddDPMember(L"FallbackIconSource", L"Microsoft.UI.Xaml.Controls.IconSource", statics.FallbackIconSourceProperty(), false /* isContent */);
00074                         xamlType.AddDPMember(L"MirroredWhenRightToLeft", L"Boolean", statics.MirroredWhenRightToLeftProperty(), false /* isContent */);
00075                         xamlType.AddDPMember(L"Source", L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2", statics.SourceProperty(), true /* isContent */);
00076                         xamlType.AddDPMember(L"State", L"String", statics.StateProperty(), false /* isContent */);
00077                     }
00078
00079                 });
00080
00081             return static_cast<winrt::IXamlType>(*xamlType);
00082         }
00083     },
00084     {
00085         /* Arg1 TypeName */
00086         L"Microsoft.UI.Xaml.Controls.AnimatedIconSource",
00087         /* Arg2 CreateXamlTypeCallback */
00088         []()
00089         {
00090             auto xamlType = winrt::make_self<XamlType>(
00091                 /* Arg 1 - TypeName */
00092                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedIconSource",
00093                 /* Arg 2 - BaseTypeName */
00094                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IconSource",
00095                 /* Arg 3 - Activator func */
00096                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IAnimatedIconSourceFactory>(L"Microsoft.UI.Xaml.Controls.AnimatedIconSource"); },
00097                 /* Arg 4 - Populate properties func */
00098                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00099                 {
00100                     winrt::IAnimatedIconSourceStatics statics = GetFactory<winrt::IAnimatedIconSourceStatics>(L"Microsoft.UI.Xaml.Controls.AnimatedIconSource");
00101                     {
00102                         xamlType.AddDPMember(L"FallbackIconSource", L"Microsoft.UI.Xaml.Controls.IconSource", statics.FallbackIconSourceProperty(), false /* isContent */);
00103                         xamlType.AddDPMember(L"MirroredWhenRightToLeft", L"Boolean", statics.MirroredWhenRightToLeftProperty(), false /* isContent */);
00104                         xamlType.AddDPMember(L"Source", L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2", statics.SourceProperty(), false /* isContent */);
00105                     }
00106
00107                 });
00108
00109             return static_cast<winrt::IXamlType>(*xamlType);
00110         }
00111     },
00112     {
00113         /* Arg1 TypeName */
00114         L"Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer",
00115         /* Arg2 CreateXamlTypeCallback */
00116         []()
00117         {
00118             auto xamlType = winrt::make_self<XamlType>(
00119                 /* Arg 1 - TypeName */
00120                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer",
00121                 /* Arg 2 - BaseTypeName */
00122                 (PCWSTR)L"Microsoft.UI.Xaml.FrameworkElement",
00123                 /* Arg 3 - Activator func */
00124                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IAnimatedVisualPlayerFactory>(L"Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer"); },
00125                 /* Arg 4 - Populate properties func */
00126                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00127                 {
00128                     winrt::IAnimatedVisualPlayerStatics statics = GetFactory<winrt::IAnimatedVisualPlayerStatics>(L"Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer");
00129                     {
00130                         xamlType.AddDPMember(L"AutoPlay", L"Boolean", statics.AutoPlayProperty(), false /* isContent */);
00131                         xamlType.AddDPMember(L"Diagnostics", L"Object", statics.DiagnosticsProperty(), false /* isContent */);
00132                         xamlType.AddDPMember(L"Duration", L"TimeSpan", statics.DurationProperty(), false /* isContent */);
00133                         xamlType.AddDPMember(L"FallbackContent", L"Microsoft.UI.Xaml.DataTemplate", statics.FallbackContentProperty(), false /* isContent */);
00134                         xamlType.AddDPMember(L"IsAnimatedVisualLoaded", L"Boolean", statics.IsAnimatedVisualLoadedProperty(), false /* isContent */);
00135                         xamlType.AddDPMember(L"IsPlaying", L"Boolean", statics.IsPlayingProperty(), false /* isContent */);
00136                         xamlType.AddDPMember(L"PlaybackRate", L"Double", statics.PlaybackRateProperty(), false /* isContent */);
00137                         xamlType.AddDPMember(L"Source", L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource", statics.SourceProperty(), true /* isContent */);
00138                         xamlType.AddDPMember(L"Stretch", L"Microsoft.UI.Xaml.Media.Stretch", statics.StretchProperty(), false /* isContent */);
00139                     }
00140
00141                     winrt::IAnimatedVisualPlayerStatics2 statics2 = GetFactory<winrt::IAnimatedVisualPlayerStatics2>(L"Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer");
00142                     {
00143                         xamlType.AddDPMember(L"AnimationOptimization", L"Microsoft.UI.Xaml.Controls.PlayerAnimationOptimization", statics2.AnimationOptimizationProperty(), false /* isContent */);
00144                     }
00145
00146                     xamlType.AddMember(
00147                         L"ProgressObject", /* propertyName */
00148                         L"Microsoft.UI.Composition.CompositionObject", /* propertyType */
00149                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedVisualPlayer>().ProgressObject(); },
00150                         nullptr, /* setter */
00151                         false, /* isContent */
00152                         false, /* isDependencyProperty */
00153                         false /* isAttachable */);
00154                 });
00155
00156             return static_cast<winrt::IXamlType>(*xamlType);
00157         }
00158     },
00159     {
00160         /* Arg1 TypeName */
00161         L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedAcceptVisualSource",
00162         /* Arg2 CreateXamlTypeCallback */
00163         []()
00164         {
00165             auto xamlType = winrt::make_self<XamlType>(
00166                 /* Arg 1 - TypeName */
00167                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedAcceptVisualSource",
00168                 /* Arg 2 - BaseTypeName */
00169                 (PCWSTR)L"Object",
00170                 /* Arg 3 - Activator func */
00171                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedAcceptVisualSource"); },
00172                 /* Arg 4 - Populate properties func */
00173                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00174                 {
00175                     xamlType.AddMember(
00176                         L"Markers", /* propertyName */
00177                         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", /* propertyType */
00178                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedAcceptVisualSource>().Markers(); },
00179                         nullptr, /* setter */
00180                         false, /* isContent */
00181                         false, /* isDependencyProperty */
00182                         false /* isAttachable */);
00183                 });
00184
00185             return static_cast<winrt::IXamlType>(*xamlType);
00186         }
00187     },
00188     {
00189         /* Arg1 TypeName */
00190         L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedBackVisualSource",
00191         /* Arg2 CreateXamlTypeCallback */
00192         []()
00193         {
00194             auto xamlType = winrt::make_self<XamlType>(
00195                 /* Arg 1 - TypeName */
00196                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedBackVisualSource",
00197                 /* Arg 2 - BaseTypeName */
00198                 (PCWSTR)L"Object",
00199                 /* Arg 3 - Activator func */
00200                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedBackVisualSource"); },
00201                 /* Arg 4 - Populate properties func */
00202                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00203                 {
00204                     xamlType.AddMember(
00205                         L"Markers", /* propertyName */
00206                         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", /* propertyType */
00207                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedBackVisualSource>().Markers(); },
00208                         nullptr, /* setter */
00209                         false, /* isContent */
00210                         false, /* isDependencyProperty */
00211                         false /* isAttachable */);
00212                 });
00213
00214             return static_cast<winrt::IXamlType>(*xamlType);
00215         }
00216     },
00217     {
00218         /* Arg1 TypeName */
00219         L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronDownSmallVisualSource",
00220         /* Arg2 CreateXamlTypeCallback */
00221         []()
00222         {
00223             auto xamlType = winrt::make_self<XamlType>(
00224                 /* Arg 1 - TypeName */
00225                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronDownSmallVisualSource",
00226                 /* Arg 2 - BaseTypeName */
00227                 (PCWSTR)L"Object",
00228                 /* Arg 3 - Activator func */
00229                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronDownSmallVisualSource"); },
00230                 /* Arg 4 - Populate properties func */
00231                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00232                 {
00233                     xamlType.AddMember(
00234                         L"Markers", /* propertyName */
00235                         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", /* propertyType */
00236                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedChevronDownSmallVisualSource>().Markers(); },
00237                         nullptr, /* setter */
00238                         false, /* isContent */
00239                         false, /* isDependencyProperty */
00240                         false /* isAttachable */);
00241                 });
00242
00243             return static_cast<winrt::IXamlType>(*xamlType);
00244         }
00245     },
00246     {
00247         /* Arg1 TypeName */
00248         L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronRightDownSmallVisualSource",
00249         /* Arg2 CreateXamlTypeCallback */
00250         []()
00251         {
00252             auto xamlType = winrt::make_self<XamlType>(
00253                 /* Arg 1 - TypeName */
00254                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronRightDownSmallVisualSource",
00255                 /* Arg 2 - BaseTypeName */
00256                 (PCWSTR)L"Object",
00257                 /* Arg 3 - Activator func */
00258                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronRightDownSmallVisualSource"); },
00259                 /* Arg 4 - Populate properties func */
00260                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00261                 {
00262                     xamlType.AddMember(
00263                         L"Markers", /* propertyName */
00264                         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", /* propertyType */
00265                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedChevronRightDownSmallVisualSource>().Markers(); },
00266                         nullptr, /* setter */
00267                         false, /* isContent */
00268                         false, /* isDependencyProperty */
00269                         false /* isAttachable */);
00270                 });
00271
00272             return static_cast<winrt::IXamlType>(*xamlType);
00273         }
00274     },
00275     {
00276         /* Arg1 TypeName */
00277         L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronUpDownSmallVisualSource",
00278         /* Arg2 CreateXamlTypeCallback */
00279         []()
00280         {
00281             auto xamlType = winrt::make_self<XamlType>(
00282                 /* Arg 1 - TypeName */
00283                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronUpDownSmallVisualSource",
00284                 /* Arg 2 - BaseTypeName */
00285                 (PCWSTR)L"Object",
00286                 /* Arg 3 - Activator func */
00287                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedChevronUpDownSmallVisualSource"); },
00288                 /* Arg 4 - Populate properties func */
00289                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00290                 {
00291                     xamlType.AddMember(
00292                         L"Markers", /* propertyName */
00293                         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", /* propertyType */
00294                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedChevronUpDownSmallVisualSource>().Markers(); },
00295                         nullptr, /* setter */
00296                         false, /* isContent */
00297                         false, /* isDependencyProperty */
00298                         false /* isAttachable */);
00299                 });
00300
00301             return static_cast<winrt::IXamlType>(*xamlType);
00302         }
00303     },
00304     {
00305         /* Arg1 TypeName */
00306         L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedFindVisualSource",
00307         /* Arg2 CreateXamlTypeCallback */
00308         []()
00309         {
00310             auto xamlType = winrt::make_self<XamlType>(
00311                 /* Arg 1 - TypeName */
00312                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedFindVisualSource",
00313                 /* Arg 2 - BaseTypeName */
00314                 (PCWSTR)L"Object",
00315                 /* Arg 3 - Activator func */
00316                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedFindVisualSource"); },
00317                 /* Arg 4 - Populate properties func */
00318                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00319                 {
00320                     xamlType.AddMember(
00321                         L"Markers", /* propertyName */
00322                         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", /* propertyType */
00323                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedFindVisualSource>().Markers(); },
00324                         nullptr, /* setter */
00325                         false, /* isContent */
00326                         false, /* isDependencyProperty */
00327                         false /* isAttachable */);
00328                 });
00329
00330             return static_cast<winrt::IXamlType>(*xamlType);
00331         }
00332     },
00333     {
00334         /* Arg1 TypeName */
00335         L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedGlobalNavigationButtonVisualSource",
00336         /* Arg2 CreateXamlTypeCallback */
00337         []()
00338         {
00339             auto xamlType = winrt::make_self<XamlType>(
00340                 /* Arg 1 - TypeName */
00341                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedGlobalNavigationButtonVisualSource",
00342                 /* Arg 2 - BaseTypeName */
00343                 (PCWSTR)L"Object",
00344                 /* Arg 3 - Activator func */
00345                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedGlobalNavigationButtonVisualSource"); },
00346                 /* Arg 4 - Populate properties func */
00347                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00348                 {
00349                     xamlType.AddMember(
00350                         L"Markers", /* propertyName */
00351                         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", /* propertyType */
00352                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedGlobalNavigationButtonVisualSource>().Markers(); },
00353                         nullptr, /* setter */
00354                         false, /* isContent */
00355                         false, /* isDependencyProperty */
00356                         false /* isAttachable */);
00357                 });
00358
00359             return static_cast<winrt::IXamlType>(*xamlType);
00360         }
00361     },
00362     {
00363         /* Arg1 TypeName */
00364         L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedSettingsVisualSource",
00365         /* Arg2 CreateXamlTypeCallback */
00366         []()
00367         {
00368             auto xamlType = winrt::make_self<XamlType>(
00369                 /* Arg 1 - TypeName */
00370                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedSettingsVisualSource",
00371                 /* Arg 2 - BaseTypeName */
00372                 (PCWSTR)L"Object",
00373                 /* Arg 3 - Activator func */
00374                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.AnimatedVisuals.AnimatedSettingsVisualSource"); },
00375                 /* Arg 4 - Populate properties func */
00376                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00377                 {
00378                     xamlType.AddMember(
00379                         L"Markers", /* propertyName */
00380                         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", /* propertyType */
00381                         [](winrt::IInspectable instance) { return instance.as<winrt::AnimatedSettingsVisualSource>().Markers(); },
00382                         nullptr, /* setter */
00383                         false, /* isContent */
00384                         false, /* isDependencyProperty */
00385                         false /* isAttachable */);
00386                 });
00387
00388             return static_cast<winrt::IXamlType>(*xamlType);
00389         }
00390     },
00391     {
00392         /* Arg1 TypeName */
00393         L"Microsoft.UI.Xaml.Controls.AnnotatedScrollBar",
00394         /* Arg2 CreateXamlTypeCallback */
00395         []()
00396         {
00397             auto xamlType = winrt::make_self<XamlType>(
00398                 /* Arg 1 - TypeName */
00399                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnnotatedScrollBar",
00400                 /* Arg 2 - BaseTypeName */
00401                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
00402                 /* Arg 3 - Activator func */
00403                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IAnnotatedScrollBarFactory>(L"Microsoft.UI.Xaml.Controls.AnnotatedScrollBar"); },
00404                 /* Arg 4 - Populate properties func */
00405                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00406                 {
00407                     winrt::IAnnotatedScrollBarStatics statics = GetFactory<winrt::IAnnotatedScrollBarStatics>(L"Microsoft.UI.Xaml.Controls.AnnotatedScrollBar");
00408                     {
00409                         xamlType.AddDPMember(L"DetailLabelTemplate", L"Microsoft.UI.Xaml.IElementFactory", statics.DetailLabelTemplateProperty(), false /* isContent */);
00410                         xamlType.AddDPMember(L"LabelTemplate", L"Microsoft.UI.Xaml.IElementFactory", statics.LabelTemplateProperty(), false /* isContent */);
00411                         xamlType.AddDPMember(L"Labels", L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.AnnotatedScrollBarLabel>", statics.LabelsProperty(), false /* isContent */);
00412                         xamlType.AddDPMember(L"SmallChange", L"Double", statics.SmallChangeProperty(), false /* isContent */);
00413                     }
00414
00415                     xamlType.AddMember(
00416                         L"ScrollController", /* propertyName */
00417                         L"Microsoft.UI.Xaml.Controls.Primitives.IScrollController", /* propertyType */
00418                         [](winrt::IInspectable instance) { return instance.as<winrt::AnnotatedScrollBar>().ScrollController(); },
00419                         nullptr, /* setter */
00420                         false, /* isContent */
00421                         false, /* isDependencyProperty */
00422                         false /* isAttachable */);
00423                 });
00424
00425             return static_cast<winrt::IXamlType>(*xamlType);
00426         }
00427     },
00428     {
00429         /* Arg1 TypeName */
00430         L"Microsoft.UI.Xaml.Controls.AnnotatedScrollBarLabel",
00431         /* Arg2 CreateXamlTypeCallback */
00432         []()
00433         {
00434             auto xamlType = winrt::make_self<XamlType>(
00435                 /* Arg 1 - TypeName */
00436                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnnotatedScrollBarLabel",
00437                 /* Arg 2 - BaseTypeName */
00438                 (PCWSTR)L"Object",
00439                 /* Arg 3 - Activator func */
00440                 nullptr,
00441                 /* Arg 4 - Populate properties func */
00442                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00443                 {
00444                     xamlType.AddMember(
00445                         L"Content", /* propertyName */
00446                         L"Object", /* propertyType */
00447                         [](winrt::IInspectable instance) { return instance.as<winrt::AnnotatedScrollBarLabel>().Content(); },
00448                         nullptr, /* setter */
00449                         false, /* isContent */
00450                         false, /* isDependencyProperty */
00451                         false /* isAttachable */);
00452                     xamlType.AddMember(
00453                         L"ScrollOffset", /* propertyName */
00454                         L"Double", /* propertyType */
00455                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::AnnotatedScrollBarLabel>().ScrollOffset()); },
00456                         nullptr, /* setter */
00457                         false, /* isContent */
00458                         false, /* isDependencyProperty */
00459                         false /* isAttachable */);
00460                 });
00461
00462             return static_cast<winrt::IXamlType>(*xamlType);
00463         }
00464     },
00465     {
00466         /* Arg1 TypeName */
00467         L"Microsoft.UI.Xaml.Controls.AnnotatedScrollBarScrollingEventKind",
00468         /* Arg2 CreateXamlTypeCallback */
00469         []()
00470         {
00471             auto xamlType = winrt::make<EnumXamlType>(
00472                 /* Arg 1 - TypeName */
00473                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.AnnotatedScrollBarScrollingEventKind",
00474                 /* Arg 2 - CreateFromString func */
00475                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
00476                 {
00477                     if (fromString == L"Click") return box_value(winrt::AnnotatedScrollBarScrollingEventKind::Click);
00478                     if (fromString == L"Drag") return box_value(winrt::AnnotatedScrollBarScrollingEventKind::Drag);
00479                     if (fromString == L"IncrementButton") return box_value(winrt::AnnotatedScrollBarScrollingEventKind::IncrementButton);
00480                     if (fromString == L"DecrementButton") return box_value(winrt::AnnotatedScrollBarScrollingEventKind::DecrementButton);
00481                     throw winrt::hresult_invalid_argument();
00482                 });
00483
00484             return xamlType;
00485         }
00486     },
00487     {
00488         /* Arg1 TypeName */
00489         L"Microsoft.UI.Xaml.Controls.BreadcrumbBar",
00490         /* Arg2 CreateXamlTypeCallback */
00491         []()
00492         {
00493             auto xamlType = winrt::make_self<XamlType>(
00494                 /* Arg 1 - TypeName */
00495                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.BreadcrumbBar",
00496                 /* Arg 2 - BaseTypeName */
00497                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
00498                 /* Arg 3 - Activator func */
00499                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IBreadcrumbBarFactory>(L"Microsoft.UI.Xaml.Controls.BreadcrumbBar"); },
00500                 /* Arg 4 - Populate properties func */
00501                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00502                 {
00503                     winrt::IBreadcrumbBarStatics statics = GetFactory<winrt::IBreadcrumbBarStatics>(L"Microsoft.UI.Xaml.Controls.BreadcrumbBar");
00504                     {
00505                         xamlType.AddDPMember(L"ItemTemplate", L"Object", statics.ItemTemplateProperty(), false /* isContent */);
00506                         xamlType.AddDPMember(L"ItemsSource", L"Object", statics.ItemsSourceProperty(), false /* isContent */);
00507                     }
00508
00509                 });
00510
00511             return static_cast<winrt::IXamlType>(*xamlType);
00512         }
00513     },
00514     {
00515         /* Arg1 TypeName */
00516         L"Microsoft.UI.Xaml.Controls.BreadcrumbBarItem",
00517         /* Arg2 CreateXamlTypeCallback */
00518         []()
00519         {
00520             auto xamlType = winrt::make_self<XamlType>(
00521                 /* Arg 1 - TypeName */
00522                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.BreadcrumbBarItem",
00523                 /* Arg 2 - BaseTypeName */
00524                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
00525                 /* Arg 3 - Activator func */
00526                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IBreadcrumbBarItemFactory>(L"Microsoft.UI.Xaml.Controls.BreadcrumbBarItem"); },
00527                 /* Arg 4 - Populate properties func */
00528                 nullptr
00529             );
00530
00531             return static_cast<winrt::IXamlType>(*xamlType);
00532         }
00533     },
00534     {
00535         /* Arg1 TypeName */
00536         L"Microsoft.UI.Xaml.Controls.ColorPicker",
00537         /* Arg2 CreateXamlTypeCallback */
00538         []()
00539         {
00540             auto xamlType = winrt::make_self<XamlType>(
00541                 /* Arg 1 - TypeName */
00542                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ColorPicker",
00543                 /* Arg 2 - BaseTypeName */
00544                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
00545                 /* Arg 3 - Activator func */
00546                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IColorPickerFactory>(L"Microsoft.UI.Xaml.Controls.ColorPicker"); },
00547                 /* Arg 4 - Populate properties func */
00548                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00549                 {
00550                     winrt::IColorPickerStatics statics = GetFactory<winrt::IColorPickerStatics>(L"Microsoft.UI.Xaml.Controls.ColorPicker");
00551                     {
00552                         xamlType.AddDPMember(L"Color", L"Windows.UI.Color", statics.ColorProperty(), false /* isContent */);
00553                         xamlType.AddDPMember(L"ColorSpectrumComponents", L"Microsoft.UI.Xaml.Controls.ColorSpectrumComponents", statics.ColorSpectrumComponentsProperty(), false /* isContent */);
00554                         xamlType.AddDPMember(L"ColorSpectrumShape", L"Microsoft.UI.Xaml.Controls.ColorSpectrumShape", statics.ColorSpectrumShapeProperty(), false /* isContent */);
00555                         xamlType.AddDPMember(L"IsAlphaEnabled", L"Boolean", statics.IsAlphaEnabledProperty(), false /* isContent */);
00556                         xamlType.AddDPMember(L"IsAlphaSliderVisible", L"Boolean", statics.IsAlphaSliderVisibleProperty(), false /* isContent */);
00557                         xamlType.AddDPMember(L"IsAlphaTextInputVisible", L"Boolean", statics.IsAlphaTextInputVisibleProperty(), false /* isContent */);
00558                         xamlType.AddDPMember(L"IsColorChannelTextInputVisible", L"Boolean", statics.IsColorChannelTextInputVisibleProperty(), false /* isContent */);
00559                         xamlType.AddDPMember(L"IsColorPreviewVisible", L"Boolean", statics.IsColorPreviewVisibleProperty(), false /* isContent */);
00560                         xamlType.AddDPMember(L"IsColorSliderVisible", L"Boolean", statics.IsColorSliderVisibleProperty(), false /* isContent */);
00561                         xamlType.AddDPMember(L"IsColorSpectrumVisible", L"Boolean", statics.IsColorSpectrumVisibleProperty(), false /* isContent */);
00562                         xamlType.AddDPMember(L"IsHexInputVisible", L"Boolean", statics.IsHexInputVisibleProperty(), false /* isContent */);
00563                         xamlType.AddDPMember(L"IsMoreButtonVisible", L"Boolean", statics.IsMoreButtonVisibleProperty(), false /* isContent */);
00564                         xamlType.AddDPMember(L"MaxHue", L"Int32", statics.MaxHueProperty(), false /* isContent */);
00565                         xamlType.AddDPMember(L"MaxSaturation", L"Int32", statics.MaxSaturationProperty(), false /* isContent */);
00566                         xamlType.AddDPMember(L"MaxValue", L"Int32", statics.MaxValueProperty(), false /* isContent */);
00567                         xamlType.AddDPMember(L"MinHue", L"Int32", statics.MinHueProperty(), false /* isContent */);
00568                         xamlType.AddDPMember(L"MinSaturation", L"Int32", statics.MinSaturationProperty(), false /* isContent */);
00569                         xamlType.AddDPMember(L"MinValue", L"Int32", statics.MinValueProperty(), false /* isContent */);
00570                         xamlType.AddDPMember(L"PreviousColor", L"Windows.Foundation.IReference`1<Windows.UI.Color>", statics.PreviousColorProperty(), false /* isContent */);
00571                     }
00572
00573                     winrt::IColorPickerStatics2 statics2 = GetFactory<winrt::IColorPickerStatics2>(L"Microsoft.UI.Xaml.Controls.ColorPicker");
00574                     {
00575                         xamlType.AddDPMember(L"Orientation", L"Microsoft.UI.Xaml.Controls.Orientation", statics2.OrientationProperty(), false /* isContent */);
00576                     }
00577
00578                 });
00579
00580             return static_cast<winrt::IXamlType>(*xamlType);
00581         }
00582     },
00583     {
00584         /* Arg1 TypeName */
00585         L"Microsoft.UI.Xaml.Controls.ColorPickerHsvChannel",
00586         /* Arg2 CreateXamlTypeCallback */
00587         []()
00588         {
00589             auto xamlType = winrt::make<EnumXamlType>(
00590                 /* Arg 1 - TypeName */
00591                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ColorPickerHsvChannel",
00592                 /* Arg 2 - CreateFromString func */
00593                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
00594                 {
00595                     if (fromString == L"Hue") return box_value(winrt::ColorPickerHsvChannel::Hue);
00596                     if (fromString == L"Saturation") return box_value(winrt::ColorPickerHsvChannel::Saturation);
00597                     if (fromString == L"Value") return box_value(winrt::ColorPickerHsvChannel::Value);
00598                     if (fromString == L"Alpha") return box_value(winrt::ColorPickerHsvChannel::Alpha);
00599                     throw winrt::hresult_invalid_argument();
00600                 });
00601
00602             return xamlType;
00603         }
00604     },
00605     {
00606         /* Arg1 TypeName */
00607         L"Microsoft.UI.Xaml.Controls.ColorSpectrumComponents",
00608         /* Arg2 CreateXamlTypeCallback */
00609         []()
00610         {
00611             auto xamlType = winrt::make<EnumXamlType>(
00612                 /* Arg 1 - TypeName */
00613                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ColorSpectrumComponents",
00614                 /* Arg 2 - CreateFromString func */
00615                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
00616                 {
00617                     if (fromString == L"HueValue") return box_value(winrt::ColorSpectrumComponents::HueValue);
00618                     if (fromString == L"ValueHue") return box_value(winrt::ColorSpectrumComponents::ValueHue);
00619                     if (fromString == L"HueSaturation") return box_value(winrt::ColorSpectrumComponents::HueSaturation);
00620                     if (fromString == L"SaturationHue") return box_value(winrt::ColorSpectrumComponents::SaturationHue);
00621                     if (fromString == L"SaturationValue") return box_value(winrt::ColorSpectrumComponents::SaturationValue);
00622                     if (fromString == L"ValueSaturation") return box_value(winrt::ColorSpectrumComponents::ValueSaturation);
00623                     throw winrt::hresult_invalid_argument();
00624                 });
00625
00626             return xamlType;
00627         }
00628     },
00629     {
00630         /* Arg1 TypeName */
00631         L"Microsoft.UI.Xaml.Controls.ColorSpectrumShape",
00632         /* Arg2 CreateXamlTypeCallback */
00633         []()
00634         {
00635             auto xamlType = winrt::make<EnumXamlType>(
00636                 /* Arg 1 - TypeName */
00637                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ColorSpectrumShape",
00638                 /* Arg 2 - CreateFromString func */
00639                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
00640                 {
00641                     if (fromString == L"Box") return box_value(winrt::ColorSpectrumShape::Box);
00642                     if (fromString == L"Ring") return box_value(winrt::ColorSpectrumShape::Ring);
00643                     throw winrt::hresult_invalid_argument();
00644                 });
00645
00646             return xamlType;
00647         }
00648     },
00649     {
00650         /* Arg1 TypeName */
00651         L"Microsoft.UI.Xaml.Controls.CommandBarFlyout",
00652         /* Arg2 CreateXamlTypeCallback */
00653         []()
00654         {
00655             auto xamlType = winrt::make_self<XamlType>(
00656                 /* Arg 1 - TypeName */
00657                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.CommandBarFlyout",
00658                 /* Arg 2 - BaseTypeName */
00659                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase",
00660                 /* Arg 3 - Activator func */
00661                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ICommandBarFlyoutFactory>(L"Microsoft.UI.Xaml.Controls.CommandBarFlyout"); },
00662                 /* Arg 4 - Populate properties func */
00663                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00664                 {
00665                     xamlType.AddMember(
00666                         L"PrimaryCommands", /* propertyName */
00667                         L"Windows.Foundation.Collections.IObservableVector`1<Microsoft.UI.Xaml.Controls.ICommandBarElement>", /* propertyType */
00668                         [](winrt::IInspectable instance) { return instance.as<winrt::CommandBarFlyout>().PrimaryCommands(); },
00669                         nullptr, /* setter */
00670                         true, /* isContent */
00671                         false, /* isDependencyProperty */
00672                         false /* isAttachable */);
00673                     xamlType.AddMember(
00674                         L"SecondaryCommands", /* propertyName */
00675                         L"Windows.Foundation.Collections.IObservableVector`1<Microsoft.UI.Xaml.Controls.ICommandBarElement>", /* propertyType */
00676                         [](winrt::IInspectable instance) { return instance.as<winrt::CommandBarFlyout>().SecondaryCommands(); },
00677                         nullptr, /* setter */
00678                         false, /* isContent */
00679                         false, /* isDependencyProperty */
00680                         false /* isAttachable */);
00681                     xamlType.AddMember(
00682                         L"AlwaysExpanded", /* propertyName */
00683                         L"Boolean", /* propertyType */
00684                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyout>().AlwaysExpanded()); },
00685                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::CommandBarFlyout>().AlwaysExpanded(unbox_value<bool>(value)); },
00686                         false, /* isContent */
00687                         false, /* isDependencyProperty */
00688                         false /* isAttachable */);
00689                 });
00690
00691             return static_cast<winrt::IXamlType>(*xamlType);
00692         }
00693     },
00694     {
00695         /* Arg1 TypeName */
00696         L"Microsoft.UI.Xaml.Controls.DropDownButton",
00697         /* Arg2 CreateXamlTypeCallback */
00698         []()
00699         {
00700             auto xamlType = winrt::make_self<XamlType>(
00701                 /* Arg 1 - TypeName */
00702                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.DropDownButton",
00703                 /* Arg 2 - BaseTypeName */
00704                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Button",
00705                 /* Arg 3 - Activator func */
00706                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IDropDownButtonFactory>(L"Microsoft.UI.Xaml.Controls.DropDownButton"); },
00707                 /* Arg 4 - Populate properties func */
00708                 nullptr
00709             );
00710
00711             return static_cast<winrt::IXamlType>(*xamlType);
00712         }
00713     },
00714     {
00715         /* Arg1 TypeName */
00716         L"Microsoft.UI.Xaml.Controls.ElementFactory",
00717         /* Arg2 CreateXamlTypeCallback */
00718         []()
00719         {
00720             auto xamlType = winrt::make_self<XamlType>(
00721                 /* Arg 1 - TypeName */
00722                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ElementFactory",
00723                 /* Arg 2 - BaseTypeName */
00724                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
00725                 /* Arg 3 - Activator func */
00726                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IElementFactoryFactory>(L"Microsoft.UI.Xaml.Controls.ElementFactory"); },
00727                 /* Arg 4 - Populate properties func */
00728                 nullptr
00729             );
00730
00731             return static_cast<winrt::IXamlType>(*xamlType);
00732         }
00733     },
00734     {
00735         /* Arg1 TypeName */
00736         L"Microsoft.UI.Xaml.Controls.ElementRealizationOptions",
00737         /* Arg2 CreateXamlTypeCallback */
00738         []()
00739         {
00740             auto xamlType = winrt::make<EnumXamlType>(
00741                 /* Arg 1 - TypeName */
00742                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ElementRealizationOptions",
00743                 /* Arg 2 - CreateFromString func */
00744                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
00745                 {
00746                     if (fromString == L"None") return box_value(winrt::ElementRealizationOptions::None);
00747                     if (fromString == L"ForceCreate") return box_value(winrt::ElementRealizationOptions::ForceCreate);
00748                     if (fromString == L"SuppressAutoRecycle") return box_value(winrt::ElementRealizationOptions::SuppressAutoRecycle);
00749                     throw winrt::hresult_invalid_argument();
00750                 });
00751
00752             return xamlType;
00753         }
00754     },
00755     {
00756         /* Arg1 TypeName */
00757         L"Microsoft.UI.Xaml.Controls.ExpandDirection",
00758         /* Arg2 CreateXamlTypeCallback */
00759         []()
00760         {
00761             auto xamlType = winrt::make<EnumXamlType>(
00762                 /* Arg 1 - TypeName */
00763                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ExpandDirection",
00764                 /* Arg 2 - CreateFromString func */
00765                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
00766                 {
00767                     if (fromString == L"Down") return box_value(winrt::ExpandDirection::Down);
00768                     if (fromString == L"Up") return box_value(winrt::ExpandDirection::Up);
00769                     throw winrt::hresult_invalid_argument();
00770                 });
00771
00772             return xamlType;
00773         }
00774     },
00775     {
00776         /* Arg1 TypeName */
00777         L"Microsoft.UI.Xaml.Controls.Expander",
00778         /* Arg2 CreateXamlTypeCallback */
00779         []()
00780         {
00781             auto xamlType = winrt::make_self<XamlType>(
00782                 /* Arg 1 - TypeName */
00783                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Expander",
00784                 /* Arg 2 - BaseTypeName */
00785                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
00786                 /* Arg 3 - Activator func */
00787                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IExpanderFactory>(L"Microsoft.UI.Xaml.Controls.Expander"); },
00788                 /* Arg 4 - Populate properties func */
00789                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00790                 {
00791                     winrt::IExpanderStatics statics = GetFactory<winrt::IExpanderStatics>(L"Microsoft.UI.Xaml.Controls.Expander");
00792                     {
00793                         xamlType.AddDPMember(L"ExpandDirection", L"Microsoft.UI.Xaml.Controls.ExpandDirection", statics.ExpandDirectionProperty(), false /* isContent */);
00794                         xamlType.AddDPMember(L"Header", L"Object", statics.HeaderProperty(), false /* isContent */);
00795                         xamlType.AddDPMember(L"HeaderTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.HeaderTemplateProperty(), false /* isContent */);
00796                         xamlType.AddDPMember(L"HeaderTemplateSelector", L"Microsoft.UI.Xaml.Controls.DataTemplateSelector", statics.HeaderTemplateSelectorProperty(), false /* isContent */);
00797                         xamlType.AddDPMember(L"IsExpanded", L"Boolean", statics.IsExpandedProperty(), false /* isContent */);
00798                     }
00799
00800                     xamlType.AddMember(
00801                         L"TemplateSettings", /* propertyName */
00802                         L"Microsoft.UI.Xaml.Controls.ExpanderTemplateSettings", /* propertyType */
00803                         [](winrt::IInspectable instance) { return instance.as<winrt::Expander>().TemplateSettings(); },
00804                         nullptr, /* setter */
00805                         false, /* isContent */
00806                         false, /* isDependencyProperty */
00807                         false /* isAttachable */);
00808                 });
00809
00810             return static_cast<winrt::IXamlType>(*xamlType);
00811         }
00812     },
00813     {
00814         /* Arg1 TypeName */
00815         L"Microsoft.UI.Xaml.Controls.ExpanderTemplateSettings",
00816         /* Arg2 CreateXamlTypeCallback */
00817         []()
00818         {
00819             auto xamlType = winrt::make_self<XamlType>(
00820                 /* Arg 1 - TypeName */
00821                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ExpanderTemplateSettings",
00822                 /* Arg 2 - BaseTypeName */
00823                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
00824                 /* Arg 3 - Activator func */
00825                 nullptr,
00826                 /* Arg 4 - Populate properties func */
00827                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00828                 {
00829                     xamlType.AddMember(
00830                         L"ContentHeight", /* propertyName */
00831                         L"Double", /* propertyType */
00832                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ExpanderTemplateSettings>().ContentHeight()); },
00833                         nullptr, /* setter */
00834                         false, /* isContent */
00835                         false, /* isDependencyProperty */
00836                         false /* isAttachable */);
00837                     xamlType.AddMember(
00838                         L"NegativeContentHeight", /* propertyName */
00839                         L"Double", /* propertyType */
00840                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ExpanderTemplateSettings>().NegativeContentHeight()); },
00841                         nullptr, /* setter */
00842                         false, /* isContent */
00843                         false, /* isDependencyProperty */
00844                         false /* isAttachable */);
00845                 });
00846
00847             return static_cast<winrt::IXamlType>(*xamlType);
00848         }
00849     },
00850     {
00851         /* Arg1 TypeName */
00852         L"Microsoft.UI.Xaml.Controls.Layout",
00853         /* Arg2 CreateXamlTypeCallback */
00854         []()
00855         {
00856             auto xamlType = winrt::make_self<XamlType>(
00857                 /* Arg 1 - TypeName */
00858                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Layout",
00859                 /* Arg 2 - BaseTypeName */
00860                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
00861                 /* Arg 3 - Activator func */
00862                 nullptr,
00863                 /* Arg 4 - Populate properties func */
00864                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00865                 {
00866                     xamlType.AddMember(
00867                         L"IndexBasedLayoutOrientation", /* propertyName */
00868                         L"Microsoft.UI.Xaml.Controls.IndexBasedLayoutOrientation", /* propertyType */
00869                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::Layout>().IndexBasedLayoutOrientation()); },
00870                         nullptr, /* setter */
00871                         false, /* isContent */
00872                         false, /* isDependencyProperty */
00873                         false /* isAttachable */);
00874                 });
00875
00876             return static_cast<winrt::IXamlType>(*xamlType);
00877         }
00878     },
00879     {
00880         /* Arg1 TypeName */
00881         L"Microsoft.UI.Xaml.Controls.VirtualizingLayout",
00882         /* Arg2 CreateXamlTypeCallback */
00883         []()
00884         {
00885             auto xamlType = winrt::make_self<XamlType>(
00886                 /* Arg 1 - TypeName */
00887                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.VirtualizingLayout",
00888                 /* Arg 2 - BaseTypeName */
00889                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Layout",
00890                 /* Arg 3 - Activator func */
00891                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IVirtualizingLayoutFactory>(L"Microsoft.UI.Xaml.Controls.VirtualizingLayout"); },
00892                 /* Arg 4 - Populate properties func */
00893                 nullptr
00894             );
00895
00896             return static_cast<winrt::IXamlType>(*xamlType);
00897         }
00898     },
00899     {
00900         /* Arg1 TypeName */
00901         L"Microsoft.UI.Xaml.Controls.FlowLayout",
00902         /* Arg2 CreateXamlTypeCallback */
00903         []()
00904         {
00905             auto xamlType = winrt::make_self<XamlType>(
00906                 /* Arg 1 - TypeName */
00907                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.FlowLayout",
00908                 /* Arg 2 - BaseTypeName */
00909                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.VirtualizingLayout",
00910                 /* Arg 3 - Activator func */
00911                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IFlowLayoutFactory>(L"Microsoft.UI.Xaml.Controls.FlowLayout"); },
00912                 /* Arg 4 - Populate properties func */
00913                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
00914                 {
00915                     winrt::IFlowLayoutStatics statics = GetFactory<winrt::IFlowLayoutStatics>(L"Microsoft.UI.Xaml.Controls.FlowLayout");
00916                     {
00917                         xamlType.AddDPMember(L"LineAlignment", L"Microsoft.UI.Xaml.Controls.FlowLayoutLineAlignment", statics.LineAlignmentProperty(), false /* isContent */);
00918                         xamlType.AddDPMember(L"MinColumnSpacing", L"Double", statics.MinColumnSpacingProperty(), false /* isContent */);
00919                         xamlType.AddDPMember(L"MinRowSpacing", L"Double", statics.MinRowSpacingProperty(), false /* isContent */);
00920                         xamlType.AddDPMember(L"Orientation", L"Microsoft.UI.Xaml.Controls.Orientation", statics.OrientationProperty(), false /* isContent */);
00921                     }
00922
00923                 });
00924
00925             return static_cast<winrt::IXamlType>(*xamlType);
00926         }
00927     },
00928     {
00929         /* Arg1 TypeName */
00930         L"Microsoft.UI.Xaml.Controls.FlowLayoutAnchorInfo",
00931         /* Arg2 CreateXamlTypeCallback */
00932         []()
00933         {
00934             auto xamlType = winrt::make_self<XamlType>(
00935                 /* Arg 1 - TypeName */
00936                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.FlowLayoutAnchorInfo",
00937                 /* Arg 2 - BaseTypeName */
00938                 (PCWSTR)L"ValueType",
00939                 /* Arg 3 - Activator func */
00940                 nullptr,
00941                 /* Arg 4 - Populate properties func */
00942                 nullptr
00943             );
00944
00945             return static_cast<winrt::IXamlType>(*xamlType);
00946         }
00947     },
00948     {
00949         /* Arg1 TypeName */
00950         L"Microsoft.UI.Xaml.Controls.FlowLayoutLineAlignment",
00951         /* Arg2 CreateXamlTypeCallback */
00952         []()
00953         {
00954             auto xamlType = winrt::make<EnumXamlType>(
00955                 /* Arg 1 - TypeName */
00956                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.FlowLayoutLineAlignment",
00957                 /* Arg 2 - CreateFromString func */
00958                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
00959                 {
00960                     if (fromString == L"Start") return box_value(winrt::FlowLayoutLineAlignment::Start);
00961                     if (fromString == L"Center") return box_value(winrt::FlowLayoutLineAlignment::Center);
00962                     if (fromString == L"End") return box_value(winrt::FlowLayoutLineAlignment::End);
00963                     if (fromString == L"SpaceAround") return box_value(winrt::FlowLayoutLineAlignment::SpaceAround);
00964                     if (fromString == L"SpaceBetween") return box_value(winrt::FlowLayoutLineAlignment::SpaceBetween);
00965                     if (fromString == L"SpaceEvenly") return box_value(winrt::FlowLayoutLineAlignment::SpaceEvenly);
00966                     throw winrt::hresult_invalid_argument();
00967                 });
00968
00969             return xamlType;
00970         }
00971     },
00972     {
00973         /* Arg1 TypeName */
00974         L"Microsoft.UI.Xaml.Controls.FlowLayoutState",
00975         /* Arg2 CreateXamlTypeCallback */
00976         []()
00977         {
00978             auto xamlType = winrt::make_self<XamlType>(
00979                 /* Arg 1 - TypeName */
00980                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.FlowLayoutState",
00981                 /* Arg 2 - BaseTypeName */
00982                 (PCWSTR)L"Object",
00983                 /* Arg 3 - Activator func */
00984                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IFlowLayoutStateFactory>(L"Microsoft.UI.Xaml.Controls.FlowLayoutState"); },
00985                 /* Arg 4 - Populate properties func */
00986                 nullptr
00987             );
00988
00989             return static_cast<winrt::IXamlType>(*xamlType);
00990         }
00991     },
00992     {
00993         /* Arg1 TypeName */
00994         L"Microsoft.UI.Xaml.Controls.IAnimatedVisual",
00995         /* Arg2 CreateXamlTypeCallback */
00996         []()
00997         {
00998             auto xamlType = winrt::make_self<XamlType>(
00999                 /* Arg 1 - TypeName */
01000                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IAnimatedVisual",
01001                 /* Arg 2 - BaseTypeName */
01002                 (PCWSTR)L"",
01003                 /* Arg 3 - Activator func */
01004                 nullptr,
01005                 /* Arg 4 - Populate properties func */
01006                 nullptr
01007             );
01008
01009             return static_cast<winrt::IXamlType>(*xamlType);
01010         }
01011     },
01012     {
01013         /* Arg1 TypeName */
01014         L"Microsoft.UI.Xaml.Controls.IAnimatedVisual2",
01015         /* Arg2 CreateXamlTypeCallback */
01016         []()
01017         {
01018             auto xamlType = winrt::make_self<XamlType>(
01019                 /* Arg 1 - TypeName */
01020                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IAnimatedVisual2",
01021                 /* Arg 2 - BaseTypeName */
01022                 (PCWSTR)L"",
01023                 /* Arg 3 - Activator func */
01024                 nullptr,
01025                 /* Arg 4 - Populate properties func */
01026                 nullptr
01027             );
01028
01029             return static_cast<winrt::IXamlType>(*xamlType);
01030         }
01031     },
01032     {
01033         /* Arg1 TypeName */
01034         L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource",
01035         /* Arg2 CreateXamlTypeCallback */
01036         []()
01037         {
01038             auto xamlType = winrt::make_self<XamlType>(
01039                 /* Arg 1 - TypeName */
01040                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource",
01041                 /* Arg 2 - BaseTypeName */
01042                 (PCWSTR)L"",
01043                 /* Arg 3 - Activator func */
01044                 nullptr,
01045                 /* Arg 4 - Populate properties func */
01046                 nullptr
01047             );
01048
01049             return static_cast<winrt::IXamlType>(*xamlType);
01050         }
01051     },
01052     {
01053         /* Arg1 TypeName */
01054         L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2",
01055         /* Arg2 CreateXamlTypeCallback */
01056         []()
01057         {
01058             auto xamlType = winrt::make_self<XamlType>(
01059                 /* Arg 1 - TypeName */
01060                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2",
01061                 /* Arg 2 - BaseTypeName */
01062                 (PCWSTR)L"",
01063                 /* Arg 3 - Activator func */
01064                 nullptr,
01065                 /* Arg 4 - Populate properties func */
01066                 nullptr
01067             );
01068
01069             return static_cast<winrt::IXamlType>(*xamlType);
01070         }
01071     },
01072     {
01073         /* Arg1 TypeName */
01074         L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource3",
01075         /* Arg2 CreateXamlTypeCallback */
01076         []()
01077         {
01078             auto xamlType = winrt::make_self<XamlType>(
01079                 /* Arg 1 - TypeName */
01080                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource3",
01081                 /* Arg 2 - BaseTypeName */
01082                 (PCWSTR)L"",
01083                 /* Arg 3 - Activator func */
01084                 nullptr,
01085                 /* Arg 4 - Populate properties func */
01086                 nullptr
01087             );
01088
01089             return static_cast<winrt::IXamlType>(*xamlType);
01090         }
01091     },
01092     {
01093         /* Arg1 TypeName */
01094         L"Microsoft.UI.Xaml.Controls.IApplicationViewSpanningRects",
01095         /* Arg2 CreateXamlTypeCallback */
01096         []()
01097         {
01098             auto xamlType = winrt::make_self<XamlType>(
01099                 /* Arg 1 - TypeName */
01100                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IApplicationViewSpanningRects",
01101                 /* Arg 2 - BaseTypeName */
01102                 (PCWSTR)L"",
01103                 /* Arg 3 - Activator func */
01104                 nullptr,
01105                 /* Arg 4 - Populate properties func */
01106                 nullptr
01107             );
01108
01109             return static_cast<winrt::IXamlType>(*xamlType);
01110         }
01111     },
01112     {
01113         /* Arg1 TypeName */
01114         L"Microsoft.UI.Xaml.Controls.IDynamicAnimatedVisualSource",
01115         /* Arg2 CreateXamlTypeCallback */
01116         []()
01117         {
01118             auto xamlType = winrt::make_self<XamlType>(
01119                 /* Arg 1 - TypeName */
01120                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IDynamicAnimatedVisualSource",
01121                 /* Arg 2 - BaseTypeName */
01122                 (PCWSTR)L"",
01123                 /* Arg 3 - Activator func */
01124                 nullptr,
01125                 /* Arg 4 - Populate properties func */
01126                 nullptr
01127             );
01128
01129             return static_cast<winrt::IXamlType>(*xamlType);
01130         }
01131     },
01132     {
01133         /* Arg1 TypeName */
01134         L"Microsoft.UI.Xaml.Controls.IKeyIndexMapping",
01135         /* Arg2 CreateXamlTypeCallback */
01136         []()
01137         {
01138             auto xamlType = winrt::make_self<XamlType>(
01139                 /* Arg 1 - TypeName */
01140                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IKeyIndexMapping",
01141                 /* Arg 2 - BaseTypeName */
01142                 (PCWSTR)L"",
01143                 /* Arg 3 - Activator func */
01144                 nullptr,
01145                 /* Arg 4 - Populate properties func */
01146                 nullptr
01147             );
01148
01149             return static_cast<winrt::IXamlType>(*xamlType);
01150         }
01151     },
01152     {
01153         /* Arg1 TypeName */
01154         L"Microsoft.UI.Xaml.Controls.ISelfPlayingAnimatedVisual",
01155         /* Arg2 CreateXamlTypeCallback */
01156         []()
01157         {
01158             auto xamlType = winrt::make_self<XamlType>(
01159                 /* Arg 1 - TypeName */
01160                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ISelfPlayingAnimatedVisual",
01161                 /* Arg 2 - BaseTypeName */
01162                 (PCWSTR)L"",
01163                 /* Arg 3 - Activator func */
01164                 nullptr,
01165                 /* Arg 4 - Populate properties func */
01166                 nullptr
01167             );
01168
01169             return static_cast<winrt::IXamlType>(*xamlType);
01170         }
01171     },
01172     {
01173         /* Arg1 TypeName */
01174         L"Microsoft.UI.Xaml.Controls.ImageIcon",
01175         /* Arg2 CreateXamlTypeCallback */
01176         []()
01177         {
01178             auto xamlType = winrt::make_self<XamlType>(
01179                 /* Arg 1 - TypeName */
01180                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ImageIcon",
01181                 /* Arg 2 - BaseTypeName */
01182                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IconElement",
01183                 /* Arg 3 - Activator func */
01184                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IImageIconFactory>(L"Microsoft.UI.Xaml.Controls.ImageIcon"); },
01185                 /* Arg 4 - Populate properties func */
01186                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01187                 {
01188                     winrt::IImageIconStatics statics = GetFactory<winrt::IImageIconStatics>(L"Microsoft.UI.Xaml.Controls.ImageIcon");
01189                     {
01190                         xamlType.AddDPMember(L"Source", L"Microsoft.UI.Xaml.Media.ImageSource", statics.SourceProperty(), false /* isContent */);
01191                     }
01192
01193                 });
01194
01195             return static_cast<winrt::IXamlType>(*xamlType);
01196         }
01197     },
01198     {
01199         /* Arg1 TypeName */
01200         L"Microsoft.UI.Xaml.Controls.ImageIconSource",
01201         /* Arg2 CreateXamlTypeCallback */
01202         []()
01203         {
01204             auto xamlType = winrt::make_self<XamlType>(
01205                 /* Arg 1 - TypeName */
01206                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ImageIconSource",
01207                 /* Arg 2 - BaseTypeName */
01208                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IconSource",
01209                 /* Arg 3 - Activator func */
01210                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IImageIconSourceFactory>(L"Microsoft.UI.Xaml.Controls.ImageIconSource"); },
01211                 /* Arg 4 - Populate properties func */
01212                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01213                 {
01214                     winrt::IImageIconSourceStatics statics = GetFactory<winrt::IImageIconSourceStatics>(L"Microsoft.UI.Xaml.Controls.ImageIconSource");
01215                     {
01216                         xamlType.AddDPMember(L"ImageSource", L"Microsoft.UI.Xaml.Media.ImageSource", statics.ImageSourceProperty(), false /* isContent */);
01217                     }
01218
01219                 });
01220
01221             return static_cast<winrt::IXamlType>(*xamlType);
01222         }
01223     },
01224     {
01225         /* Arg1 TypeName */
01226         L"Microsoft.UI.Xaml.Controls.IndexBasedLayoutOrientation",
01227         /* Arg2 CreateXamlTypeCallback */
01228         []()
01229         {
01230             auto xamlType = winrt::make<EnumXamlType>(
01231                 /* Arg 1 - TypeName */
01232                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IndexBasedLayoutOrientation",
01233                 /* Arg 2 - CreateFromString func */
01234                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01235                 {
01236                     if (fromString == L"None") return box_value(winrt::IndexBasedLayoutOrientation::None);
01237                     if (fromString == L"TopToBottom") return box_value(winrt::IndexBasedLayoutOrientation::TopToBottom);
01238                     if (fromString == L"LeftToRight") return box_value(winrt::IndexBasedLayoutOrientation::LeftToRight);
01239                     throw winrt::hresult_invalid_argument();
01240                 });
01241
01242             return xamlType;
01243         }
01244     },
01245     {
01246         /* Arg1 TypeName */
01247         L"Microsoft.UI.Xaml.Controls.IndexPath",
01248         /* Arg2 CreateXamlTypeCallback */
01249         []()
01250         {
01251             auto xamlType = winrt::make_self<XamlType>(
01252                 /* Arg 1 - TypeName */
01253                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.IndexPath",
01254                 /* Arg 2 - BaseTypeName */
01255                 (PCWSTR)L"Object",
01256                 /* Arg 3 - Activator func */
01257                 nullptr,
01258                 /* Arg 4 - Populate properties func */
01259                 nullptr
01260             );
01261
01262             return static_cast<winrt::IXamlType>(*xamlType);
01263         }
01264     },
01265     {
01266         /* Arg1 TypeName */
01267         L"Microsoft.UI.Xaml.Controls.InfoBadge",
01268         /* Arg2 CreateXamlTypeCallback */
01269         []()
01270         {
01271             auto xamlType = winrt::make_self<XamlType>(
01272                 /* Arg 1 - TypeName */
01273                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.InfoBadge",
01274                 /* Arg 2 - BaseTypeName */
01275                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
01276                 /* Arg 3 - Activator func */
01277                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IInfoBadgeFactory>(L"Microsoft.UI.Xaml.Controls.InfoBadge"); },
01278                 /* Arg 4 - Populate properties func */
01279                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01280                 {
01281                     winrt::IInfoBadgeStatics statics = GetFactory<winrt::IInfoBadgeStatics>(L"Microsoft.UI.Xaml.Controls.InfoBadge");
01282                     {
01283                         xamlType.AddDPMember(L"IconSource", L"Microsoft.UI.Xaml.Controls.IconSource", statics.IconSourceProperty(), false /* isContent */);
01284                         xamlType.AddDPMember(L"TemplateSettings", L"Microsoft.UI.Xaml.Controls.InfoBadgeTemplateSettings", statics.TemplateSettingsProperty(), false /* isContent */);
01285                         xamlType.AddDPMember(L"Value", L"Int32", statics.ValueProperty(), false /* isContent */);
01286                     }
01287
01288                 });
01289
01290             return static_cast<winrt::IXamlType>(*xamlType);
01291         }
01292     },
01293     {
01294         /* Arg1 TypeName */
01295         L"Microsoft.UI.Xaml.Controls.InfoBadgeTemplateSettings",
01296         /* Arg2 CreateXamlTypeCallback */
01297         []()
01298         {
01299             auto xamlType = winrt::make_self<XamlType>(
01300                 /* Arg 1 - TypeName */
01301                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.InfoBadgeTemplateSettings",
01302                 /* Arg 2 - BaseTypeName */
01303                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
01304                 /* Arg 3 - Activator func */
01305                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IInfoBadgeTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.InfoBadgeTemplateSettings"); },
01306                 /* Arg 4 - Populate properties func */
01307                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01308                 {
01309                     winrt::IInfoBadgeTemplateSettingsStatics statics = GetFactory<winrt::IInfoBadgeTemplateSettingsStatics>(L"Microsoft.UI.Xaml.Controls.InfoBadgeTemplateSettings");
01310                     {
01311                         xamlType.AddDPMember(L"IconElement", L"Microsoft.UI.Xaml.Controls.IconElement", statics.IconElementProperty(), false /* isContent */);
01312                         xamlType.AddDPMember(L"InfoBadgeCornerRadius", L"Microsoft.UI.Xaml.CornerRadius", statics.InfoBadgeCornerRadiusProperty(), false /* isContent */);
01313                     }
01314
01315                 });
01316
01317             return static_cast<winrt::IXamlType>(*xamlType);
01318         }
01319     },
01320     {
01321         /* Arg1 TypeName */
01322         L"Microsoft.UI.Xaml.Controls.InfoBar",
01323         /* Arg2 CreateXamlTypeCallback */
01324         []()
01325         {
01326             auto xamlType = winrt::make_self<XamlType>(
01327                 /* Arg 1 - TypeName */
01328                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.InfoBar",
01329                 /* Arg 2 - BaseTypeName */
01330                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
01331                 /* Arg 3 - Activator func */
01332                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IInfoBarFactory>(L"Microsoft.UI.Xaml.Controls.InfoBar"); },
01333                 /* Arg 4 - Populate properties func */
01334                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01335                 {
01336                     winrt::IInfoBarStatics statics = GetFactory<winrt::IInfoBarStatics>(L"Microsoft.UI.Xaml.Controls.InfoBar");
01337                     {
01338                         xamlType.AddDPMember(L"ActionButton", L"Microsoft.UI.Xaml.Controls.Primitives.ButtonBase", statics.ActionButtonProperty(), false /* isContent */);
01339                         xamlType.AddDPMember(L"CloseButtonCommandParameter", L"Object", statics.CloseButtonCommandParameterProperty(), false /* isContent */);
01340                         xamlType.AddDPMember(L"CloseButtonCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.CloseButtonCommandProperty(), false /* isContent */);
01341                         xamlType.AddDPMember(L"CloseButtonStyle", L"Microsoft.UI.Xaml.Style", statics.CloseButtonStyleProperty(), false /* isContent */);
01342                         xamlType.AddDPMember(L"Content", L"Object", statics.ContentProperty(), true /* isContent */);
01343                         xamlType.AddDPMember(L"ContentTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.ContentTemplateProperty(), false /* isContent */);
01344                         xamlType.AddDPMember(L"IconSource", L"Microsoft.UI.Xaml.Controls.IconSource", statics.IconSourceProperty(), false /* isContent */);
01345                         xamlType.AddDPMember(L"IsClosable", L"Boolean", statics.IsClosableProperty(), false /* isContent */);
01346                         xamlType.AddDPMember(L"IsIconVisible", L"Boolean", statics.IsIconVisibleProperty(), false /* isContent */);
01347                         xamlType.AddDPMember(L"IsOpen", L"Boolean", statics.IsOpenProperty(), false /* isContent */);
01348                         xamlType.AddDPMember(L"Message", L"String", statics.MessageProperty(), false /* isContent */);
01349                         xamlType.AddDPMember(L"Severity", L"Microsoft.UI.Xaml.Controls.InfoBarSeverity", statics.SeverityProperty(), false /* isContent */);
01350                         xamlType.AddDPMember(L"TemplateSettings", L"Microsoft.UI.Xaml.Controls.InfoBarTemplateSettings", statics.TemplateSettingsProperty(), false /* isContent */);
01351                         xamlType.AddDPMember(L"Title", L"String", statics.TitleProperty(), false /* isContent */);
01352                     }
01353
01354                 });
01355
01356             return static_cast<winrt::IXamlType>(*xamlType);
01357         }
01358     },
01359     {
01360         /* Arg1 TypeName */
01361         L"Microsoft.UI.Xaml.Controls.InfoBarCloseReason",
01362         /* Arg2 CreateXamlTypeCallback */
01363         []()
01364         {
01365             auto xamlType = winrt::make<EnumXamlType>(
01366                 /* Arg 1 - TypeName */
01367                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.InfoBarCloseReason",
01368                 /* Arg 2 - CreateFromString func */
01369                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01370                 {
01371                     if (fromString == L"CloseButton") return box_value(winrt::InfoBarCloseReason::CloseButton);
01372                     if (fromString == L"Programmatic") return box_value(winrt::InfoBarCloseReason::Programmatic);
01373                     throw winrt::hresult_invalid_argument();
01374                 });
01375
01376             return xamlType;
01377         }
01378     },
01379     {
01380         /* Arg1 TypeName */
01381         L"Microsoft.UI.Xaml.Controls.InfoBarSeverity",
01382         /* Arg2 CreateXamlTypeCallback */
01383         []()
01384         {
01385             auto xamlType = winrt::make<EnumXamlType>(
01386                 /* Arg 1 - TypeName */
01387                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.InfoBarSeverity",
01388                 /* Arg 2 - CreateFromString func */
01389                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01390                 {
01391                     if (fromString == L"Informational") return box_value(winrt::InfoBarSeverity::Informational);
01392                     if (fromString == L"Success") return box_value(winrt::InfoBarSeverity::Success);
01393                     if (fromString == L"Warning") return box_value(winrt::InfoBarSeverity::Warning);
01394                     if (fromString == L"Error") return box_value(winrt::InfoBarSeverity::Error);
01395                     throw winrt::hresult_invalid_argument();
01396                 });
01397
01398             return xamlType;
01399         }
01400     },
01401     {
01402         /* Arg1 TypeName */
01403         L"Microsoft.UI.Xaml.Controls.InfoBarTemplateSettings",
01404         /* Arg2 CreateXamlTypeCallback */
01405         []()
01406         {
01407             auto xamlType = winrt::make_self<XamlType>(
01408                 /* Arg 1 - TypeName */
01409                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.InfoBarTemplateSettings",
01410                 /* Arg 2 - BaseTypeName */
01411                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
01412                 /* Arg 3 - Activator func */
01413                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IInfoBarTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.InfoBarTemplateSettings"); },
01414                 /* Arg 4 - Populate properties func */
01415                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01416                 {
01417                     winrt::IInfoBarTemplateSettingsStatics statics = GetFactory<winrt::IInfoBarTemplateSettingsStatics>(L"Microsoft.UI.Xaml.Controls.InfoBarTemplateSettings");
01418                     {
01419                         xamlType.AddDPMember(L"IconElement", L"Microsoft.UI.Xaml.Controls.IconElement", statics.IconElementProperty(), false /* isContent */);
01420                     }
01421
01422                 });
01423
01424             return static_cast<winrt::IXamlType>(*xamlType);
01425         }
01426     },
01427     {
01428         /* Arg1 TypeName */
01429         L"Microsoft.UI.Xaml.Controls.InkCanvas",
01430         /* Arg2 CreateXamlTypeCallback */
01431         []()
01432         {
01433             auto xamlType = winrt::make_self<XamlType>(
01434                 /* Arg 1 - TypeName */
01435                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.InkCanvas",
01436                 /* Arg 2 - BaseTypeName */
01437                 (PCWSTR)L"Microsoft.UI.Xaml.FrameworkElement",
01438                 /* Arg 3 - Activator func */
01439                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IInkCanvasFactory>(L"Microsoft.UI.Xaml.Controls.InkCanvas"); },
01440                 /* Arg 4 - Populate properties func */
01441                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01442                 {
01443                     winrt::IInkCanvasStatics statics = GetFactory<winrt::IInkCanvasStatics>(L"Microsoft.UI.Xaml.Controls.InkCanvas");
01444                     {
01445                         xamlType.AddDPMember(L"IsEnabled", L"Boolean", statics.IsEnabledProperty(), false /* isContent */);
01446                     }
01447
01448                 });
01449
01450             return static_cast<winrt::IXamlType>(*xamlType);
01451         }
01452     },
01453     {
01454         /* Arg1 TypeName */
01455         L"Microsoft.UI.Xaml.Controls.ItemCollectionTransition",
01456         /* Arg2 CreateXamlTypeCallback */
01457         []()
01458         {
01459             auto xamlType = winrt::make_self<XamlType>(
01460                 /* Arg 1 - TypeName */
01461                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemCollectionTransition",
01462                 /* Arg 2 - BaseTypeName */
01463                 (PCWSTR)L"Object",
01464                 /* Arg 3 - Activator func */
01465                 nullptr,
01466                 /* Arg 4 - Populate properties func */
01467                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01468                 {
01469                     xamlType.AddMember(
01470                         L"HasStarted", /* propertyName */
01471                         L"Boolean", /* propertyType */
01472                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ItemCollectionTransition>().HasStarted()); },
01473                         nullptr, /* setter */
01474                         false, /* isContent */
01475                         false, /* isDependencyProperty */
01476                         false /* isAttachable */);
01477                     xamlType.AddMember(
01478                         L"NewBounds", /* propertyName */
01479                         L"Windows.Foundation.Rect", /* propertyType */
01480                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ItemCollectionTransition>().NewBounds()); },
01481                         nullptr, /* setter */
01482                         false, /* isContent */
01483                         false, /* isDependencyProperty */
01484                         false /* isAttachable */);
01485                     xamlType.AddMember(
01486                         L"OldBounds", /* propertyName */
01487                         L"Windows.Foundation.Rect", /* propertyType */
01488                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ItemCollectionTransition>().OldBounds()); },
01489                         nullptr, /* setter */
01490                         false, /* isContent */
01491                         false, /* isDependencyProperty */
01492                         false /* isAttachable */);
01493                     xamlType.AddMember(
01494                         L"Operation", /* propertyName */
01495                         L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionOperation", /* propertyType */
01496                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ItemCollectionTransition>().Operation()); },
01497                         nullptr, /* setter */
01498                         false, /* isContent */
01499                         false, /* isDependencyProperty */
01500                         false /* isAttachable */);
01501                     xamlType.AddMember(
01502                         L"Triggers", /* propertyName */
01503                         L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionTriggers", /* propertyType */
01504                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ItemCollectionTransition>().Triggers()); },
01505                         nullptr, /* setter */
01506                         false, /* isContent */
01507                         false, /* isDependencyProperty */
01508                         false /* isAttachable */);
01509                 });
01510
01511             return static_cast<winrt::IXamlType>(*xamlType);
01512         }
01513     },
01514     {
01515         /* Arg1 TypeName */
01516         L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionOperation",
01517         /* Arg2 CreateXamlTypeCallback */
01518         []()
01519         {
01520             auto xamlType = winrt::make<EnumXamlType>(
01521                 /* Arg 1 - TypeName */
01522                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionOperation",
01523                 /* Arg 2 - CreateFromString func */
01524                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01525                 {
01526                     if (fromString == L"Add") return box_value(winrt::ItemCollectionTransitionOperation::Add);
01527                     if (fromString == L"Remove") return box_value(winrt::ItemCollectionTransitionOperation::Remove);
01528                     if (fromString == L"Move") return box_value(winrt::ItemCollectionTransitionOperation::Move);
01529                     throw winrt::hresult_invalid_argument();
01530                 });
01531
01532             return xamlType;
01533         }
01534     },
01535     {
01536         /* Arg1 TypeName */
01537         L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProgress",
01538         /* Arg2 CreateXamlTypeCallback */
01539         []()
01540         {
01541             auto xamlType = winrt::make_self<XamlType>(
01542                 /* Arg 1 - TypeName */
01543                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProgress",
01544                 /* Arg 2 - BaseTypeName */
01545                 (PCWSTR)L"Object",
01546                 /* Arg 3 - Activator func */
01547                 nullptr,
01548                 /* Arg 4 - Populate properties func */
01549                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01550                 {
01551                     xamlType.AddMember(
01552                         L"Element", /* propertyName */
01553                         L"Microsoft.UI.Xaml.UIElement", /* propertyType */
01554                         [](winrt::IInspectable instance) { return instance.as<winrt::ItemCollectionTransitionProgress>().Element(); },
01555                         nullptr, /* setter */
01556                         false, /* isContent */
01557                         false, /* isDependencyProperty */
01558                         false /* isAttachable */);
01559                     xamlType.AddMember(
01560                         L"Transition", /* propertyName */
01561                         L"Microsoft.UI.Xaml.Controls.ItemCollectionTransition", /* propertyType */
01562                         [](winrt::IInspectable instance) { return instance.as<winrt::ItemCollectionTransitionProgress>().Transition(); },
01563                         nullptr, /* setter */
01564                         false, /* isContent */
01565                         false, /* isDependencyProperty */
01566                         false /* isAttachable */);
01567                 });
01568
01569             return static_cast<winrt::IXamlType>(*xamlType);
01570         }
01571     },
01572     {
01573         /* Arg1 TypeName */
01574         L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProvider",
01575         /* Arg2 CreateXamlTypeCallback */
01576         []()
01577         {
01578             auto xamlType = winrt::make_self<XamlType>(
01579                 /* Arg 1 - TypeName */
01580                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProvider",
01581                 /* Arg 2 - BaseTypeName */
01582                 (PCWSTR)L"Object",
01583                 /* Arg 3 - Activator func */
01584                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IItemCollectionTransitionProviderFactory>(L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProvider"); },
01585                 /* Arg 4 - Populate properties func */
01586                 nullptr
01587             );
01588
01589             return static_cast<winrt::IXamlType>(*xamlType);
01590         }
01591     },
01592     {
01593         /* Arg1 TypeName */
01594         L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionTriggers",
01595         /* Arg2 CreateXamlTypeCallback */
01596         []()
01597         {
01598             auto xamlType = winrt::make<EnumXamlType>(
01599                 /* Arg 1 - TypeName */
01600                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionTriggers",
01601                 /* Arg 2 - CreateFromString func */
01602                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01603                 {
01604                     if (fromString == L"CollectionChangeAdd") return box_value(winrt::ItemCollectionTransitionTriggers::CollectionChangeAdd);
01605                     if (fromString == L"CollectionChangeRemove") return box_value(winrt::ItemCollectionTransitionTriggers::CollectionChangeRemove);
01606                     if (fromString == L"CollectionChangeReset") return box_value(winrt::ItemCollectionTransitionTriggers::CollectionChangeReset);
01607                     if (fromString == L"LayoutTransition") return box_value(winrt::ItemCollectionTransitionTriggers::LayoutTransition);
01608                     throw winrt::hresult_invalid_argument();
01609                 });
01610
01611             return xamlType;
01612         }
01613     },
01614     {
01615         /* Arg1 TypeName */
01616         L"Microsoft.UI.Xaml.Controls.ItemContainer",
01617         /* Arg2 CreateXamlTypeCallback */
01618         []()
01619         {
01620             auto xamlType = winrt::make_self<XamlType>(
01621                 /* Arg 1 - TypeName */
01622                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemContainer",
01623                 /* Arg 2 - BaseTypeName */
01624                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
01625                 /* Arg 3 - Activator func */
01626                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IItemContainerFactory>(L"Microsoft.UI.Xaml.Controls.ItemContainer"); },
01627                 /* Arg 4 - Populate properties func */
01628                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01629                 {
01630                     winrt::IItemContainerStatics statics = GetFactory<winrt::IItemContainerStatics>(L"Microsoft.UI.Xaml.Controls.ItemContainer");
01631                     {
01632                         xamlType.AddDPMember(L"Child", L"Microsoft.UI.Xaml.UIElement", statics.ChildProperty(), true /* isContent */);
01633                         xamlType.AddDPMember(L"IsSelected", L"Boolean", statics.IsSelectedProperty(), false /* isContent */);
01634                     }
01635
01636                     winrt::IItemContainerStatics2 statics2 = GetFactory<winrt::IItemContainerStatics2>(L"Microsoft.UI.Xaml.Controls.ItemContainer");
01637                     {
01638                         xamlType.AddDPMember(L"CanUserInvoke", L"Microsoft.UI.Xaml.Controls.ItemContainerUserInvokeMode", statics2.CanUserInvokeProperty(), false /* isContent */);
01639                         xamlType.AddDPMember(L"CanUserSelect", L"Microsoft.UI.Xaml.Controls.ItemContainerUserSelectMode", statics2.CanUserSelectProperty(), false /* isContent */);
01640                         xamlType.AddDPMember(L"MultiSelectMode", L"Microsoft.UI.Xaml.Controls.ItemContainerMultiSelectMode", statics2.MultiSelectModeProperty(), false /* isContent */);
01641                     }
01642
01643                 });
01644
01645             return static_cast<winrt::IXamlType>(*xamlType);
01646         }
01647     },
01648     {
01649         /* Arg1 TypeName */
01650         L"Microsoft.UI.Xaml.Controls.ItemContainerInteractionTrigger",
01651         /* Arg2 CreateXamlTypeCallback */
01652         []()
01653         {
01654             auto xamlType = winrt::make<EnumXamlType>(
01655                 /* Arg 1 - TypeName */
01656                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemContainerInteractionTrigger",
01657                 /* Arg 2 - CreateFromString func */
01658                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01659                 {
01660                     if (fromString == L"PointerPressed") return box_value(winrt::ItemContainerInteractionTrigger::PointerPressed);
01661                     if (fromString == L"PointerReleased") return box_value(winrt::ItemContainerInteractionTrigger::PointerReleased);
01662                     if (fromString == L"Tap") return box_value(winrt::ItemContainerInteractionTrigger::Tap);
01663                     if (fromString == L"DoubleTap") return box_value(winrt::ItemContainerInteractionTrigger::DoubleTap);
01664                     if (fromString == L"EnterKey") return box_value(winrt::ItemContainerInteractionTrigger::EnterKey);
01665                     if (fromString == L"SpaceKey") return box_value(winrt::ItemContainerInteractionTrigger::SpaceKey);
01666                     if (fromString == L"AutomationInvoke") return box_value(winrt::ItemContainerInteractionTrigger::AutomationInvoke);
01667                     throw winrt::hresult_invalid_argument();
01668                 });
01669
01670             return xamlType;
01671         }
01672     },
01673     {
01674         /* Arg1 TypeName */
01675         L"Microsoft.UI.Xaml.Controls.ItemContainerMultiSelectMode",
01676         /* Arg2 CreateXamlTypeCallback */
01677         []()
01678         {
01679             auto xamlType = winrt::make<EnumXamlType>(
01680                 /* Arg 1 - TypeName */
01681                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemContainerMultiSelectMode",
01682                 /* Arg 2 - CreateFromString func */
01683                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01684                 {
01685                     if (fromString == L"Auto") return box_value(winrt::ItemContainerMultiSelectMode::Auto);
01686                     if (fromString == L"Single") return box_value(winrt::ItemContainerMultiSelectMode::Single);
01687                     if (fromString == L"Extended") return box_value(winrt::ItemContainerMultiSelectMode::Extended);
01688                     if (fromString == L"Multiple") return box_value(winrt::ItemContainerMultiSelectMode::Multiple);
01689                     throw winrt::hresult_invalid_argument();
01690                 });
01691
01692             return xamlType;
01693         }
01694     },
01695     {
01696         /* Arg1 TypeName */
01697         L"Microsoft.UI.Xaml.Controls.ItemContainerUserInvokeMode",
01698         /* Arg2 CreateXamlTypeCallback */
01699         []()
01700         {
01701             auto xamlType = winrt::make<EnumXamlType>(
01702                 /* Arg 1 - TypeName */
01703                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemContainerUserInvokeMode",
01704                 /* Arg 2 - CreateFromString func */
01705                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01706                 {
01707                     if (fromString == L"Auto") return box_value(winrt::ItemContainerUserInvokeMode::Auto);
01708                     if (fromString == L"UserCanInvoke") return box_value(winrt::ItemContainerUserInvokeMode::UserCanInvoke);
01709                     if (fromString == L"UserCannotInvoke") return box_value(winrt::ItemContainerUserInvokeMode::UserCannotInvoke);
01710                     throw winrt::hresult_invalid_argument();
01711                 });
01712
01713             return xamlType;
01714         }
01715     },
01716     {
01717         /* Arg1 TypeName */
01718         L"Microsoft.UI.Xaml.Controls.ItemContainerUserSelectMode",
01719         /* Arg2 CreateXamlTypeCallback */
01720         []()
01721         {
01722             auto xamlType = winrt::make<EnumXamlType>(
01723                 /* Arg 1 - TypeName */
01724                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemContainerUserSelectMode",
01725                 /* Arg 2 - CreateFromString func */
01726                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01727                 {
01728                     if (fromString == L"Auto") return box_value(winrt::ItemContainerUserSelectMode::Auto);
01729                     if (fromString == L"UserCanSelect") return box_value(winrt::ItemContainerUserSelectMode::UserCanSelect);
01730                     if (fromString == L"UserCannotSelect") return box_value(winrt::ItemContainerUserSelectMode::UserCannotSelect);
01731                     throw winrt::hresult_invalid_argument();
01732                 });
01733
01734             return xamlType;
01735         }
01736     },
01737     {
01738         /* Arg1 TypeName */
01739         L"Microsoft.UI.Xaml.Controls.ItemsRepeater",
01740         /* Arg2 CreateXamlTypeCallback */
01741         []()
01742         {
01743             auto xamlType = winrt::make_self<XamlType>(
01744                 /* Arg 1 - TypeName */
01745                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemsRepeater",
01746                 /* Arg 2 - BaseTypeName */
01747                 (PCWSTR)L"Microsoft.UI.Xaml.FrameworkElement",
01748                 /* Arg 3 - Activator func */
01749                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IItemsRepeaterFactory>(L"Microsoft.UI.Xaml.Controls.ItemsRepeater"); },
01750                 /* Arg 4 - Populate properties func */
01751                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01752                 {
01753                     winrt::IItemsRepeaterStatics statics = GetFactory<winrt::IItemsRepeaterStatics>(L"Microsoft.UI.Xaml.Controls.ItemsRepeater");
01754                     {
01755                         xamlType.AddDPMember(L"Background", L"Microsoft.UI.Xaml.Media.Brush", statics.BackgroundProperty(), false /* isContent */);
01756                         xamlType.AddDPMember(L"HorizontalCacheLength", L"Double", statics.HorizontalCacheLengthProperty(), false /* isContent */);
01757                         xamlType.AddDPMember(L"ItemTemplate", L"Object", statics.ItemTemplateProperty(), true /* isContent */);
01758                         xamlType.AddDPMember(L"ItemsSource", L"Object", statics.ItemsSourceProperty(), false /* isContent */);
01759                         xamlType.AddDPMember(L"Layout", L"Microsoft.UI.Xaml.Controls.Layout", statics.LayoutProperty(), false /* isContent */);
01760                         xamlType.AddDPMember(L"VerticalCacheLength", L"Double", statics.VerticalCacheLengthProperty(), false /* isContent */);
01761                     }
01762
01763                     winrt::IItemsRepeaterStatics2 statics2 = GetFactory<winrt::IItemsRepeaterStatics2>(L"Microsoft.UI.Xaml.Controls.ItemsRepeater");
01764                     {
01765                         xamlType.AddDPMember(L"ItemTransitionProvider", L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProvider", statics2.ItemTransitionProviderProperty(), false /* isContent */);
01766                     }
01767
01768                     xamlType.AddMember(
01769                         L"ItemsSourceView", /* propertyName */
01770                         L"Microsoft.UI.Xaml.Controls.ItemsSourceView", /* propertyType */
01771                         [](winrt::IInspectable instance) { return instance.as<winrt::ItemsRepeater>().ItemsSourceView(); },
01772                         nullptr, /* setter */
01773                         false, /* isContent */
01774                         false, /* isDependencyProperty */
01775                         false /* isAttachable */);
01776                 });
01777
01778             return static_cast<winrt::IXamlType>(*xamlType);
01779         }
01780     },
01781     {
01782         /* Arg1 TypeName */
01783         L"Microsoft.UI.Xaml.Controls.ItemsRepeaterScrollHost",
01784         /* Arg2 CreateXamlTypeCallback */
01785         []()
01786         {
01787             auto xamlType = winrt::make_self<XamlType>(
01788                 /* Arg 1 - TypeName */
01789                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemsRepeaterScrollHost",
01790                 /* Arg 2 - BaseTypeName */
01791                 (PCWSTR)L"Microsoft.UI.Xaml.FrameworkElement",
01792                 /* Arg 3 - Activator func */
01793                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.ItemsRepeaterScrollHost"); },
01794                 /* Arg 4 - Populate properties func */
01795                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01796                 {
01797                     xamlType.AddMember(
01798                         L"VerticalAnchorRatio", /* propertyName */
01799                         L"Double", /* propertyType */
01800                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ItemsRepeaterScrollHost>().VerticalAnchorRatio()); },
01801                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ItemsRepeaterScrollHost>().VerticalAnchorRatio(unbox_value<double>(value)); },
01802                         false, /* isContent */
01803                         false, /* isDependencyProperty */
01804                         false /* isAttachable */);
01805                     xamlType.AddMember(
01806                         L"ScrollViewer", /* propertyName */
01807                         L"Microsoft.UI.Xaml.Controls.ScrollViewer", /* propertyType */
01808                         [](winrt::IInspectable instance) { return instance.as<winrt::ItemsRepeaterScrollHost>().ScrollViewer(); },
01809                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ItemsRepeaterScrollHost>().ScrollViewer(value.as<winrt::Microsoft::UI::Xaml::Controls::ScrollViewer>()); },
01810                         true, /* isContent */
01811                         false, /* isDependencyProperty */
01812                         false /* isAttachable */);
01813                     xamlType.AddMember(
01814                         L"HorizontalAnchorRatio", /* propertyName */
01815                         L"Double", /* propertyType */
01816                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ItemsRepeaterScrollHost>().HorizontalAnchorRatio()); },
01817                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ItemsRepeaterScrollHost>().HorizontalAnchorRatio(unbox_value<double>(value)); },
01818                         false, /* isContent */
01819                         false, /* isDependencyProperty */
01820                         false /* isAttachable */);
01821                     xamlType.AddMember(
01822                         L"CurrentAnchor", /* propertyName */
01823                         L"Microsoft.UI.Xaml.UIElement", /* propertyType */
01824                         [](winrt::IInspectable instance) { return instance.as<winrt::ItemsRepeaterScrollHost>().CurrentAnchor(); },
01825                         nullptr, /* setter */
01826                         false, /* isContent */
01827                         false, /* isDependencyProperty */
01828                         false /* isAttachable */);
01829                 });
01830
01831             return static_cast<winrt::IXamlType>(*xamlType);
01832         }
01833     },
01834     {
01835         /* Arg1 TypeName */
01836         L"Microsoft.UI.Xaml.Controls.ItemsSourceView",
01837         /* Arg2 CreateXamlTypeCallback */
01838         []()
01839         {
01840             auto xamlType = winrt::make_self<XamlType>(
01841                 /* Arg 1 - TypeName */
01842                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemsSourceView",
01843                 /* Arg 2 - BaseTypeName */
01844                 (PCWSTR)L"Object",
01845                 /* Arg 3 - Activator func */
01846                 nullptr,
01847                 /* Arg 4 - Populate properties func */
01848                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01849                 {
01850                     xamlType.AddMember(
01851                         L"Count", /* propertyName */
01852                         L"Int32", /* propertyType */
01853                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ItemsSourceView>().Count()); },
01854                         nullptr, /* setter */
01855                         false, /* isContent */
01856                         false, /* isDependencyProperty */
01857                         false /* isAttachable */);
01858                     xamlType.AddMember(
01859                         L"HasKeyIndexMapping", /* propertyName */
01860                         L"Boolean", /* propertyType */
01861                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ItemsSourceView>().HasKeyIndexMapping()); },
01862                         nullptr, /* setter */
01863                         false, /* isContent */
01864                         false, /* isDependencyProperty */
01865                         false /* isAttachable */);
01866                 });
01867
01868             return static_cast<winrt::IXamlType>(*xamlType);
01869         }
01870     },
01871     {
01872         /* Arg1 TypeName */
01873         L"Microsoft.UI.Xaml.Controls.ItemsView",
01874         /* Arg2 CreateXamlTypeCallback */
01875         []()
01876         {
01877             auto xamlType = winrt::make_self<XamlType>(
01878                 /* Arg 1 - TypeName */
01879                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemsView",
01880                 /* Arg 2 - BaseTypeName */
01881                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
01882                 /* Arg 3 - Activator func */
01883                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IItemsViewFactory>(L"Microsoft.UI.Xaml.Controls.ItemsView"); },
01884                 /* Arg 4 - Populate properties func */
01885                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01886                 {
01887                     winrt::IItemsViewStatics statics = GetFactory<winrt::IItemsViewStatics>(L"Microsoft.UI.Xaml.Controls.ItemsView");
01888                     {
01889                         xamlType.AddDPMember(L"CurrentItemIndex", L"Int32", statics.CurrentItemIndexProperty(), false /* isContent */);
01890                         xamlType.AddDPMember(L"IsItemInvokedEnabled", L"Boolean", statics.IsItemInvokedEnabledProperty(), false /* isContent */);
01891                         xamlType.AddDPMember(L"ItemTemplate", L"Microsoft.UI.Xaml.IElementFactory", statics.ItemTemplateProperty(), false /* isContent */);
01892                         xamlType.AddDPMember(L"ItemTransitionProvider", L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProvider", statics.ItemTransitionProviderProperty(), false /* isContent */);
01893                         xamlType.AddDPMember(L"ItemsSource", L"Object", statics.ItemsSourceProperty(), false /* isContent */);
01894                         xamlType.AddDPMember(L"Layout", L"Microsoft.UI.Xaml.Controls.Layout", statics.LayoutProperty(), false /* isContent */);
01895                         xamlType.AddDPMember(L"ScrollView", L"Microsoft.UI.Xaml.Controls.ScrollView", statics.ScrollViewProperty(), false /* isContent */);
01896                         xamlType.AddDPMember(L"SelectedItem", L"Object", statics.SelectedItemProperty(), false /* isContent */);
01897                         xamlType.AddDPMember(L"SelectionMode", L"Microsoft.UI.Xaml.Controls.ItemsViewSelectionMode", statics.SelectionModeProperty(), false /* isContent */);
01898                         xamlType.AddDPMember(L"VerticalScrollController", L"Microsoft.UI.Xaml.Controls.Primitives.IScrollController", statics.VerticalScrollControllerProperty(), false /* isContent */);
01899                     }
01900
01901                     xamlType.AddMember(
01902                         L"SelectedItems", /* propertyName */
01903                         L"Windows.Foundation.Collections.IReadOnlyList`1<Object>", /* propertyType */
01904                         [](winrt::IInspectable instance) { return instance.as<winrt::ItemsView>().SelectedItems(); },
01905                         nullptr, /* setter */
01906                         false, /* isContent */
01907                         false, /* isDependencyProperty */
01908                         false /* isAttachable */);
01909                 });
01910
01911             return static_cast<winrt::IXamlType>(*xamlType);
01912         }
01913     },
01914     {
01915         /* Arg1 TypeName */
01916         L"Microsoft.UI.Xaml.Controls.ItemsViewSelectionMode",
01917         /* Arg2 CreateXamlTypeCallback */
01918         []()
01919         {
01920             auto xamlType = winrt::make<EnumXamlType>(
01921                 /* Arg 1 - TypeName */
01922                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemsViewSelectionMode",
01923                 /* Arg 2 - CreateFromString func */
01924                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
01925                 {
01926                     if (fromString == L"None") return box_value(winrt::ItemsViewSelectionMode::None);
01927                     if (fromString == L"Single") return box_value(winrt::ItemsViewSelectionMode::Single);
01928                     if (fromString == L"Multiple") return box_value(winrt::ItemsViewSelectionMode::Multiple);
01929                     if (fromString == L"Extended") return box_value(winrt::ItemsViewSelectionMode::Extended);
01930                     throw winrt::hresult_invalid_argument();
01931                 });
01932
01933             return xamlType;
01934         }
01935     },
01936     {
01937         /* Arg1 TypeName */
01938         L"Microsoft.UI.Xaml.Controls.LayoutContext",
01939         /* Arg2 CreateXamlTypeCallback */
01940         []()
01941         {
01942             auto xamlType = winrt::make_self<XamlType>(
01943                 /* Arg 1 - TypeName */
01944                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.LayoutContext",
01945                 /* Arg 2 - BaseTypeName */
01946                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
01947                 /* Arg 3 - Activator func */
01948                 nullptr,
01949                 /* Arg 4 - Populate properties func */
01950                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01951                 {
01952                     xamlType.AddMember(
01953                         L"LayoutState", /* propertyName */
01954                         L"Object", /* propertyType */
01955                         [](winrt::IInspectable instance) { return instance.as<winrt::LayoutContext>().LayoutState(); },
01956                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::LayoutContext>().LayoutState(value); },
01957                         false, /* isContent */
01958                         false, /* isDependencyProperty */
01959                         false /* isAttachable */);
01960                 });
01961
01962             return static_cast<winrt::IXamlType>(*xamlType);
01963         }
01964     },
01965     {
01966         /* Arg1 TypeName */
01967         L"Microsoft.UI.Xaml.Controls.LayoutPanel",
01968         /* Arg2 CreateXamlTypeCallback */
01969         []()
01970         {
01971             auto xamlType = winrt::make_self<XamlType>(
01972                 /* Arg 1 - TypeName */
01973                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.LayoutPanel",
01974                 /* Arg 2 - BaseTypeName */
01975                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Panel",
01976                 /* Arg 3 - Activator func */
01977                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ILayoutPanelFactory>(L"Microsoft.UI.Xaml.Controls.LayoutPanel"); },
01978                 /* Arg 4 - Populate properties func */
01979                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
01980                 {
01981                     winrt::ILayoutPanelStatics statics = GetFactory<winrt::ILayoutPanelStatics>(L"Microsoft.UI.Xaml.Controls.LayoutPanel");
01982                     {
01983                         xamlType.AddDPMember(L"BorderBrush", L"Microsoft.UI.Xaml.Media.Brush", statics.BorderBrushProperty(), false /* isContent */);
01984                         xamlType.AddDPMember(L"BorderThickness", L"Microsoft.UI.Xaml.Thickness", statics.BorderThicknessProperty(), false /* isContent */);
01985                         xamlType.AddDPMember(L"CornerRadius", L"Microsoft.UI.Xaml.CornerRadius", statics.CornerRadiusProperty(), false /* isContent */);
01986                         xamlType.AddDPMember(L"Layout", L"Microsoft.UI.Xaml.Controls.Layout", statics.LayoutProperty(), false /* isContent */);
01987                         xamlType.AddDPMember(L"Padding", L"Microsoft.UI.Xaml.Thickness", statics.PaddingProperty(), false /* isContent */);
01988                     }
01989
01990                 });
01991
01992             return static_cast<winrt::IXamlType>(*xamlType);
01993         }
01994     },
01995     {
01996         /* Arg1 TypeName */
01997         L"Microsoft.UI.Xaml.Controls.LinedFlowLayout",
01998         /* Arg2 CreateXamlTypeCallback */
01999         []()
02000         {
02001             auto xamlType = winrt::make_self<XamlType>(
02002                 /* Arg 1 - TypeName */
02003                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.LinedFlowLayout",
02004                 /* Arg 2 - BaseTypeName */
02005                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.VirtualizingLayout",
02006                 /* Arg 3 - Activator func */
02007                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ILinedFlowLayoutFactory>(L"Microsoft.UI.Xaml.Controls.LinedFlowLayout"); },
02008                 /* Arg 4 - Populate properties func */
02009                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02010                 {
02011                     winrt::ILinedFlowLayoutStatics statics = GetFactory<winrt::ILinedFlowLayoutStatics>(L"Microsoft.UI.Xaml.Controls.LinedFlowLayout");
02012                     {
02013                         xamlType.AddDPMember(L"ActualLineHeight", L"Double", statics.ActualLineHeightProperty(), false /* isContent */);
02014                         xamlType.AddDPMember(L"ItemsJustification", L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemsJustification", statics.ItemsJustificationProperty(), false /* isContent */);
02015                         xamlType.AddDPMember(L"ItemsStretch", L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemsStretch", statics.ItemsStretchProperty(), false /* isContent */);
02016                         xamlType.AddDPMember(L"LineHeight", L"Double", statics.LineHeightProperty(), false /* isContent */);
02017                         xamlType.AddDPMember(L"LineSpacing", L"Double", statics.LineSpacingProperty(), false /* isContent */);
02018                         xamlType.AddDPMember(L"MinItemSpacing", L"Double", statics.MinItemSpacingProperty(), false /* isContent */);
02019                     }
02020
02021                     xamlType.AddMember(
02022                         L"RequestedRangeLength", /* propertyName */
02023                         L"Int32", /* propertyType */
02024                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::LinedFlowLayout>().RequestedRangeLength()); },
02025                         nullptr, /* setter */
02026                         false, /* isContent */
02027                         false, /* isDependencyProperty */
02028                         false /* isAttachable */);
02029                     xamlType.AddMember(
02030                         L"RequestedRangeStartIndex", /* propertyName */
02031                         L"Int32", /* propertyType */
02032                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::LinedFlowLayout>().RequestedRangeStartIndex()); },
02033                         nullptr, /* setter */
02034                         false, /* isContent */
02035                         false, /* isDependencyProperty */
02036                         false /* isAttachable */);
02037                 });
02038
02039             return static_cast<winrt::IXamlType>(*xamlType);
02040         }
02041     },
02042     {
02043         /* Arg1 TypeName */
02044         L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemCollectionTransitionProvider",
02045         /* Arg2 CreateXamlTypeCallback */
02046         []()
02047         {
02048             auto xamlType = winrt::make_self<XamlType>(
02049                 /* Arg 1 - TypeName */
02050                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemCollectionTransitionProvider",
02051                 /* Arg 2 - BaseTypeName */
02052                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProvider",
02053                 /* Arg 3 - Activator func */
02054                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ILinedFlowLayoutItemCollectionTransitionProviderFactory>(L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemCollectionTransitionProvider"); },
02055                 /* Arg 4 - Populate properties func */
02056                 nullptr
02057             );
02058
02059             return static_cast<winrt::IXamlType>(*xamlType);
02060         }
02061     },
02062     {
02063         /* Arg1 TypeName */
02064         L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemsJustification",
02065         /* Arg2 CreateXamlTypeCallback */
02066         []()
02067         {
02068             auto xamlType = winrt::make<EnumXamlType>(
02069                 /* Arg 1 - TypeName */
02070                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemsJustification",
02071                 /* Arg 2 - CreateFromString func */
02072                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02073                 {
02074                     if (fromString == L"Start") return box_value(winrt::LinedFlowLayoutItemsJustification::Start);
02075                     if (fromString == L"Center") return box_value(winrt::LinedFlowLayoutItemsJustification::Center);
02076                     if (fromString == L"End") return box_value(winrt::LinedFlowLayoutItemsJustification::End);
02077                     if (fromString == L"SpaceAround") return box_value(winrt::LinedFlowLayoutItemsJustification::SpaceAround);
02078                     if (fromString == L"SpaceBetween") return box_value(winrt::LinedFlowLayoutItemsJustification::SpaceBetween);
02079                     if (fromString == L"SpaceEvenly") return box_value(winrt::LinedFlowLayoutItemsJustification::SpaceEvenly);
02080                     throw winrt::hresult_invalid_argument();
02081                 });
02082
02083             return xamlType;
02084         }
02085     },
02086     {
02087         /* Arg1 TypeName */
02088         L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemsStretch",
02089         /* Arg2 CreateXamlTypeCallback */
02090         []()
02091         {
02092             auto xamlType = winrt::make<EnumXamlType>(
02093                 /* Arg 1 - TypeName */
02094                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.LinedFlowLayoutItemsStretch",
02095                 /* Arg 2 - CreateFromString func */
02096                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02097                 {
02098                     if (fromString == L"None") return box_value(winrt::LinedFlowLayoutItemsStretch::None);
02099                     if (fromString == L"Fill") return box_value(winrt::LinedFlowLayoutItemsStretch::Fill);
02100                     throw winrt::hresult_invalid_argument();
02101                 });
02102
02103             return xamlType;
02104         }
02105     },
02106     {
02107         /* Arg1 TypeName */
02108         L"Microsoft.UI.Xaml.Controls.MapControl",
02109         /* Arg2 CreateXamlTypeCallback */
02110         []()
02111         {
02112             auto xamlType = winrt::make_self<XamlType>(
02113                 /* Arg 1 - TypeName */
02114                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MapControl",
02115                 /* Arg 2 - BaseTypeName */
02116                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
02117                 /* Arg 3 - Activator func */
02118                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IMapControlFactory>(L"Microsoft.UI.Xaml.Controls.MapControl"); },
02119                 /* Arg 4 - Populate properties func */
02120                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02121                 {
02122                     winrt::IMapControlStatics statics = GetFactory<winrt::IMapControlStatics>(L"Microsoft.UI.Xaml.Controls.MapControl");
02123                     {
02124                         xamlType.AddDPMember(L"Center", L"Windows.Devices.Geolocation.Geopoint", statics.CenterProperty(), false /* isContent */);
02125                         xamlType.AddDPMember(L"InteractiveControlsVisible", L"Boolean", statics.InteractiveControlsVisibleProperty(), false /* isContent */);
02126                         xamlType.AddDPMember(L"Layers", L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MapLayer>", statics.LayersProperty(), false /* isContent */);
02127                         xamlType.AddDPMember(L"MapServiceToken", L"String", statics.MapServiceTokenProperty(), false /* isContent */);
02128                         xamlType.AddDPMember(L"ZoomLevel", L"Double", statics.ZoomLevelProperty(), false /* isContent */);
02129                     }
02130
02131                 });
02132
02133             return static_cast<winrt::IXamlType>(*xamlType);
02134         }
02135     },
02136     {
02137         /* Arg1 TypeName */
02138         L"Microsoft.UI.Xaml.Controls.MapElement",
02139         /* Arg2 CreateXamlTypeCallback */
02140         []()
02141         {
02142             auto xamlType = winrt::make_self<XamlType>(
02143                 /* Arg 1 - TypeName */
02144                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MapElement",
02145                 /* Arg 2 - BaseTypeName */
02146                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
02147                 /* Arg 3 - Activator func */
02148                 nullptr,
02149                 /* Arg 4 - Populate properties func */
02150                 nullptr
02151             );
02152
02153             return static_cast<winrt::IXamlType>(*xamlType);
02154         }
02155     },
02156     {
02157         /* Arg1 TypeName */
02158         L"Microsoft.UI.Xaml.Controls.MapLayer",
02159         /* Arg2 CreateXamlTypeCallback */
02160         []()
02161         {
02162             auto xamlType = winrt::make_self<XamlType>(
02163                 /* Arg 1 - TypeName */
02164                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MapLayer",
02165                 /* Arg 2 - BaseTypeName */
02166                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
02167                 /* Arg 3 - Activator func */
02168                 nullptr,
02169                 /* Arg 4 - Populate properties func */
02170                 nullptr
02171             );
02172
02173             return static_cast<winrt::IXamlType>(*xamlType);
02174         }
02175     },
02176     {
02177         /* Arg1 TypeName */
02178         L"Microsoft.UI.Xaml.Controls.MapElementsLayer",
02179         /* Arg2 CreateXamlTypeCallback */
02180         []()
02181         {
02182             auto xamlType = winrt::make_self<XamlType>(
02183                 /* Arg 1 - TypeName */
02184                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MapElementsLayer",
02185                 /* Arg 2 - BaseTypeName */
02186                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MapLayer",
02187                 /* Arg 3 - Activator func */
02188                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IMapElementsLayerFactory>(L"Microsoft.UI.Xaml.Controls.MapElementsLayer"); },
02189                 /* Arg 4 - Populate properties func */
02190                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02191                 {
02192                     winrt::IMapElementsLayerStatics statics = GetFactory<winrt::IMapElementsLayerStatics>(L"Microsoft.UI.Xaml.Controls.MapElementsLayer");
02193                     {
02194                         xamlType.AddDPMember(L"MapElements", L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MapElement>", statics.MapElementsProperty(), false /* isContent */);
02195                     }
02196
02197                 });
02198
02199             return static_cast<winrt::IXamlType>(*xamlType);
02200         }
02201     },
02202     {
02203         /* Arg1 TypeName */
02204         L"Microsoft.UI.Xaml.Controls.MapIcon",
02205         /* Arg2 CreateXamlTypeCallback */
02206         []()
02207         {
02208             auto xamlType = winrt::make_self<XamlType>(
02209                 /* Arg 1 - TypeName */
02210                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MapIcon",
02211                 /* Arg 2 - BaseTypeName */
02212                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MapElement",
02213                 /* Arg 3 - Activator func */
02214                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IMapIconFactory>(L"Microsoft.UI.Xaml.Controls.MapIcon"); },
02215                 /* Arg 4 - Populate properties func */
02216                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02217                 {
02218                     winrt::IMapIconStatics statics = GetFactory<winrt::IMapIconStatics>(L"Microsoft.UI.Xaml.Controls.MapIcon");
02219                     {
02220                         xamlType.AddDPMember(L"Location", L"Windows.Devices.Geolocation.Geopoint", statics.LocationProperty(), false /* isContent */);
02221                     }
02222
02223                 });
02224
02225             return static_cast<winrt::IXamlType>(*xamlType);
02226         }
02227     },
02228     {
02229         /* Arg1 TypeName */
02230         L"Microsoft.UI.Xaml.Controls.MenuBar",
02231         /* Arg2 CreateXamlTypeCallback */
02232         []()
02233         {
02234             auto xamlType = winrt::make_self<XamlType>(
02235                 /* Arg 1 - TypeName */
02236                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MenuBar",
02237                 /* Arg 2 - BaseTypeName */
02238                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
02239                 /* Arg 3 - Activator func */
02240                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IMenuBarFactory>(L"Microsoft.UI.Xaml.Controls.MenuBar"); },
02241                 /* Arg 4 - Populate properties func */
02242                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02243                 {
02244                     winrt::IMenuBarStatics statics = GetFactory<winrt::IMenuBarStatics>(L"Microsoft.UI.Xaml.Controls.MenuBar");
02245                     {
02246                         xamlType.AddDPMember(L"Items", L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MenuBarItem>", statics.ItemsProperty(), true /* isContent */);
02247                     }
02248
02249                 });
02250
02251             return static_cast<winrt::IXamlType>(*xamlType);
02252         }
02253     },
02254     {
02255         /* Arg1 TypeName */
02256         L"Microsoft.UI.Xaml.Controls.MenuBarItem",
02257         /* Arg2 CreateXamlTypeCallback */
02258         []()
02259         {
02260             auto xamlType = winrt::make_self<XamlType>(
02261                 /* Arg 1 - TypeName */
02262                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MenuBarItem",
02263                 /* Arg 2 - BaseTypeName */
02264                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
02265                 /* Arg 3 - Activator func */
02266                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IMenuBarItemFactory>(L"Microsoft.UI.Xaml.Controls.MenuBarItem"); },
02267                 /* Arg 4 - Populate properties func */
02268                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02269                 {
02270                     winrt::IMenuBarItemStatics statics = GetFactory<winrt::IMenuBarItemStatics>(L"Microsoft.UI.Xaml.Controls.MenuBarItem");
02271                     {
02272                         xamlType.AddDPMember(L"Items", L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MenuFlyoutItemBase>", statics.ItemsProperty(), true /* isContent */);
02273                         xamlType.AddDPMember(L"Title", L"String", statics.TitleProperty(), false /* isContent */);
02274                     }
02275
02276                 });
02277
02278             return static_cast<winrt::IXamlType>(*xamlType);
02279         }
02280     },
02281     {
02282         /* Arg1 TypeName */
02283         L"Microsoft.UI.Xaml.Controls.MenuBarItemFlyout",
02284         /* Arg2 CreateXamlTypeCallback */
02285         []()
02286         {
02287             auto xamlType = winrt::make_self<XamlType>(
02288                 /* Arg 1 - TypeName */
02289                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MenuBarItemFlyout",
02290                 /* Arg 2 - BaseTypeName */
02291                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MenuFlyout",
02292                 /* Arg 3 - Activator func */
02293                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IMenuBarItemFlyoutFactory>(L"Microsoft.UI.Xaml.Controls.MenuBarItemFlyout"); },
02294                 /* Arg 4 - Populate properties func */
02295                 nullptr
02296             );
02297
02298             return static_cast<winrt::IXamlType>(*xamlType);
02299         }
02300     },
02301     {
02302         /* Arg1 TypeName */
02303         L"Microsoft.UI.Xaml.Controls.NavigationView",
02304         /* Arg2 CreateXamlTypeCallback */
02305         []()
02306         {
02307             auto xamlType = winrt::make_self<XamlType>(
02308                 /* Arg 1 - TypeName */
02309                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationView",
02310                 /* Arg 2 - BaseTypeName */
02311                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
02312                 /* Arg 3 - Activator func */
02313                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INavigationViewFactory>(L"Microsoft.UI.Xaml.Controls.NavigationView"); },
02314                 /* Arg 4 - Populate properties func */
02315                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02316                 {
02317                     winrt::INavigationViewStatics statics = GetFactory<winrt::INavigationViewStatics>(L"Microsoft.UI.Xaml.Controls.NavigationView");
02318                     {
02319                         xamlType.AddDPMember(L"AlwaysShowHeader", L"Boolean", statics.AlwaysShowHeaderProperty(), false /* isContent */);
02320                         xamlType.AddDPMember(L"AutoSuggestBox", L"Microsoft.UI.Xaml.Controls.AutoSuggestBox", statics.AutoSuggestBoxProperty(), false /* isContent */);
02321                         xamlType.AddDPMember(L"CompactModeThresholdWidth", L"Double", statics.CompactModeThresholdWidthProperty(), false /* isContent */);
02322                         xamlType.AddDPMember(L"CompactPaneLength", L"Double", statics.CompactPaneLengthProperty(), false /* isContent */);
02323                         xamlType.AddDPMember(L"DisplayMode", L"Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode", statics.DisplayModeProperty(), false /* isContent */);
02324                         xamlType.AddDPMember(L"ExpandedModeThresholdWidth", L"Double", statics.ExpandedModeThresholdWidthProperty(), false /* isContent */);
02325                         xamlType.AddDPMember(L"FooterMenuItems", L"Windows.Foundation.Collections.IVector`1<Object>", statics.FooterMenuItemsProperty(), false /* isContent */);
02326                         xamlType.AddDPMember(L"FooterMenuItemsSource", L"Object", statics.FooterMenuItemsSourceProperty(), false /* isContent */);
02327                         xamlType.AddDPMember(L"Header", L"Object", statics.HeaderProperty(), false /* isContent */);
02328                         xamlType.AddDPMember(L"HeaderTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.HeaderTemplateProperty(), false /* isContent */);
02329                         xamlType.AddDPMember(L"IsPaneOpen", L"Boolean", statics.IsPaneOpenProperty(), false /* isContent */);
02330                         xamlType.AddDPMember(L"IsPaneToggleButtonVisible", L"Boolean", statics.IsPaneToggleButtonVisibleProperty(), false /* isContent */);
02331                         xamlType.AddDPMember(L"IsSettingsVisible", L"Boolean", statics.IsSettingsVisibleProperty(), false /* isContent */);
02332                         xamlType.AddDPMember(L"IsTitleBarAutoPaddingEnabled", L"Boolean", statics.IsTitleBarAutoPaddingEnabledProperty(), false /* isContent */);
02333                         xamlType.AddDPMember(L"MenuItemContainerStyle", L"Microsoft.UI.Xaml.Style", statics.MenuItemContainerStyleProperty(), false /* isContent */);
02334                         xamlType.AddDPMember(L"MenuItemContainerStyleSelector", L"Microsoft.UI.Xaml.Controls.StyleSelector", statics.MenuItemContainerStyleSelectorProperty(), false /* isContent */);
02335                         xamlType.AddDPMember(L"MenuItemTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.MenuItemTemplateProperty(), false /* isContent */);
02336                         xamlType.AddDPMember(L"MenuItemTemplateSelector", L"Microsoft.UI.Xaml.Controls.DataTemplateSelector", statics.MenuItemTemplateSelectorProperty(), false /* isContent */);
02337                         xamlType.AddDPMember(L"MenuItems", L"Windows.Foundation.Collections.IVector`1<Object>", statics.MenuItemsProperty(), false /* isContent */);
02338                         xamlType.AddDPMember(L"MenuItemsSource", L"Object", statics.MenuItemsSourceProperty(), false /* isContent */);
02339                         xamlType.AddDPMember(L"OpenPaneLength", L"Double", statics.OpenPaneLengthProperty(), false /* isContent */);
02340                         xamlType.AddDPMember(L"PaneFooter", L"Microsoft.UI.Xaml.UIElement", statics.PaneFooterProperty(), false /* isContent */);
02341                         xamlType.AddDPMember(L"PaneToggleButtonStyle", L"Microsoft.UI.Xaml.Style", statics.PaneToggleButtonStyleProperty(), false /* isContent */);
02342                         xamlType.AddDPMember(L"SelectedItem", L"Object", statics.SelectedItemProperty(), false /* isContent */);
02343                         xamlType.AddDPMember(L"SettingsItem", L"Object", statics.SettingsItemProperty(), false /* isContent */);
02344                     }
02345
02346                     winrt::INavigationViewStatics2 statics2 = GetFactory<winrt::INavigationViewStatics2>(L"Microsoft.UI.Xaml.Controls.NavigationView");
02347                     {
02348                         xamlType.AddDPMember(L"ContentOverlay", L"Microsoft.UI.Xaml.UIElement", statics2.ContentOverlayProperty(), false /* isContent */);
02349                         xamlType.AddDPMember(L"IsBackButtonVisible", L"Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible", statics2.IsBackButtonVisibleProperty(), false /* isContent */);
02350                         xamlType.AddDPMember(L"IsBackEnabled", L"Boolean", statics2.IsBackEnabledProperty(), false /* isContent */);
02351                         xamlType.AddDPMember(L"IsPaneVisible", L"Boolean", statics2.IsPaneVisibleProperty(), false /* isContent */);
02352                         xamlType.AddDPMember(L"OverflowLabelMode", L"Microsoft.UI.Xaml.Controls.NavigationViewOverflowLabelMode", statics2.OverflowLabelModeProperty(), false /* isContent */);
02353                         xamlType.AddDPMember(L"PaneCustomContent", L"Microsoft.UI.Xaml.UIElement", statics2.PaneCustomContentProperty(), false /* isContent */);
02354                         xamlType.AddDPMember(L"PaneDisplayMode", L"Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode", statics2.PaneDisplayModeProperty(), false /* isContent */);
02355                         xamlType.AddDPMember(L"PaneHeader", L"Microsoft.UI.Xaml.UIElement", statics2.PaneHeaderProperty(), false /* isContent */);
02356                         xamlType.AddDPMember(L"PaneTitle", L"String", statics2.PaneTitleProperty(), false /* isContent */);
02357                         xamlType.AddDPMember(L"SelectionFollowsFocus", L"Microsoft.UI.Xaml.Controls.NavigationViewSelectionFollowsFocus", statics2.SelectionFollowsFocusProperty(), false /* isContent */);
02358                         xamlType.AddDPMember(L"ShoulderNavigationEnabled", L"Microsoft.UI.Xaml.Controls.NavigationViewShoulderNavigationEnabled", statics2.ShoulderNavigationEnabledProperty(), false /* isContent */);
02359                         xamlType.AddDPMember(L"TemplateSettings", L"Microsoft.UI.Xaml.Controls.NavigationViewTemplateSettings", statics2.TemplateSettingsProperty(), false /* isContent */);
02360                     }
02361
02362                 });
02363
02364             return static_cast<winrt::IXamlType>(*xamlType);
02365         }
02366     },
02367     {
02368         /* Arg1 TypeName */
02369         L"Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible",
02370         /* Arg2 CreateXamlTypeCallback */
02371         []()
02372         {
02373             auto xamlType = winrt::make<EnumXamlType>(
02374                 /* Arg 1 - TypeName */
02375                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible",
02376                 /* Arg 2 - CreateFromString func */
02377                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02378                 {
02379                     if (fromString == L"Collapsed") return box_value(winrt::NavigationViewBackButtonVisible::Collapsed);
02380                     if (fromString == L"Visible") return box_value(winrt::NavigationViewBackButtonVisible::Visible);
02381                     if (fromString == L"Auto") return box_value(winrt::NavigationViewBackButtonVisible::Auto);
02382                     throw winrt::hresult_invalid_argument();
02383                 });
02384
02385             return xamlType;
02386         }
02387     },
02388     {
02389         /* Arg1 TypeName */
02390         L"Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode",
02391         /* Arg2 CreateXamlTypeCallback */
02392         []()
02393         {
02394             auto xamlType = winrt::make<EnumXamlType>(
02395                 /* Arg 1 - TypeName */
02396                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode",
02397                 /* Arg 2 - CreateFromString func */
02398                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02399                 {
02400                     if (fromString == L"Minimal") return box_value(winrt::NavigationViewDisplayMode::Minimal);
02401                     if (fromString == L"Compact") return box_value(winrt::NavigationViewDisplayMode::Compact);
02402                     if (fromString == L"Expanded") return box_value(winrt::NavigationViewDisplayMode::Expanded);
02403                     throw winrt::hresult_invalid_argument();
02404                 });
02405
02406             return xamlType;
02407         }
02408     },
02409     {
02410         /* Arg1 TypeName */
02411         L"Microsoft.UI.Xaml.Controls.NavigationViewItemBase",
02412         /* Arg2 CreateXamlTypeCallback */
02413         []()
02414         {
02415             auto xamlType = winrt::make_self<XamlType>(
02416                 /* Arg 1 - TypeName */
02417                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewItemBase",
02418                 /* Arg 2 - BaseTypeName */
02419                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
02420                 /* Arg 3 - Activator func */
02421                 nullptr,
02422                 /* Arg 4 - Populate properties func */
02423                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02424                 {
02425                     winrt::INavigationViewItemBaseStatics statics = GetFactory<winrt::INavigationViewItemBaseStatics>(L"Microsoft.UI.Xaml.Controls.NavigationViewItemBase");
02426                     {
02427                         xamlType.AddDPMember(L"IsSelected", L"Boolean", statics.IsSelectedProperty(), false /* isContent */);
02428                     }
02429
02430                 });
02431
02432             return static_cast<winrt::IXamlType>(*xamlType);
02433         }
02434     },
02435     {
02436         /* Arg1 TypeName */
02437         L"Microsoft.UI.Xaml.Controls.NavigationViewItem",
02438         /* Arg2 CreateXamlTypeCallback */
02439         []()
02440         {
02441             auto xamlType = winrt::make_self<XamlType>(
02442                 /* Arg 1 - TypeName */
02443                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewItem",
02444                 /* Arg 2 - BaseTypeName */
02445                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewItemBase",
02446                 /* Arg 3 - Activator func */
02447                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INavigationViewItemFactory>(L"Microsoft.UI.Xaml.Controls.NavigationViewItem"); },
02448                 /* Arg 4 - Populate properties func */
02449                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02450                 {
02451                     winrt::INavigationViewItemStatics statics = GetFactory<winrt::INavigationViewItemStatics>(L"Microsoft.UI.Xaml.Controls.NavigationViewItem");
02452                     {
02453                         xamlType.AddDPMember(L"CompactPaneLength", L"Double", statics.CompactPaneLengthProperty(), false /* isContent */);
02454                         xamlType.AddDPMember(L"Icon", L"Microsoft.UI.Xaml.Controls.IconElement", statics.IconProperty(), false /* isContent */);
02455                     }
02456
02457                     winrt::INavigationViewItemStatics2 statics2 = GetFactory<winrt::INavigationViewItemStatics2>(L"Microsoft.UI.Xaml.Controls.NavigationViewItem");
02458                     {
02459                         xamlType.AddDPMember(L"HasUnrealizedChildren", L"Boolean", statics2.HasUnrealizedChildrenProperty(), false /* isContent */);
02460                         xamlType.AddDPMember(L"IsChildSelected", L"Boolean", statics2.IsChildSelectedProperty(), false /* isContent */);
02461                         xamlType.AddDPMember(L"IsExpanded", L"Boolean", statics2.IsExpandedProperty(), false /* isContent */);
02462                         xamlType.AddDPMember(L"MenuItems", L"Windows.Foundation.Collections.IVector`1<Object>", statics2.MenuItemsProperty(), false /* isContent */);
02463                         xamlType.AddDPMember(L"MenuItemsSource", L"Object", statics2.MenuItemsSourceProperty(), false /* isContent */);
02464                         xamlType.AddDPMember(L"SelectsOnInvoked", L"Boolean", statics2.SelectsOnInvokedProperty(), false /* isContent */);
02465                     }
02466
02467                     winrt::INavigationViewItemStatics3 statics3 = GetFactory<winrt::INavigationViewItemStatics3>(L"Microsoft.UI.Xaml.Controls.NavigationViewItem");
02468                     {
02469                         xamlType.AddDPMember(L"InfoBadge", L"Microsoft.UI.Xaml.Controls.InfoBadge", statics3.InfoBadgeProperty(), false /* isContent */);
02470                     }
02471
02472                 });
02473
02474             return static_cast<winrt::IXamlType>(*xamlType);
02475         }
02476     },
02477     {
02478         /* Arg1 TypeName */
02479         L"Microsoft.UI.Xaml.Controls.NavigationViewItemHeader",
02480         /* Arg2 CreateXamlTypeCallback */
02481         []()
02482         {
02483             auto xamlType = winrt::make_self<XamlType>(
02484                 /* Arg 1 - TypeName */
02485                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewItemHeader",
02486                 /* Arg 2 - BaseTypeName */
02487                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewItemBase",
02488                 /* Arg 3 - Activator func */
02489                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INavigationViewItemHeaderFactory>(L"Microsoft.UI.Xaml.Controls.NavigationViewItemHeader"); },
02490                 /* Arg 4 - Populate properties func */
02491                 nullptr
02492             );
02493
02494             return static_cast<winrt::IXamlType>(*xamlType);
02495         }
02496     },
02497     {
02498         /* Arg1 TypeName */
02499         L"Microsoft.UI.Xaml.Controls.NavigationViewItemSeparator",
02500         /* Arg2 CreateXamlTypeCallback */
02501         []()
02502         {
02503             auto xamlType = winrt::make_self<XamlType>(
02504                 /* Arg 1 - TypeName */
02505                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewItemSeparator",
02506                 /* Arg 2 - BaseTypeName */
02507                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewItemBase",
02508                 /* Arg 3 - Activator func */
02509                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INavigationViewItemSeparatorFactory>(L"Microsoft.UI.Xaml.Controls.NavigationViewItemSeparator"); },
02510                 /* Arg 4 - Populate properties func */
02511                 nullptr
02512             );
02513
02514             return static_cast<winrt::IXamlType>(*xamlType);
02515         }
02516     },
02517     {
02518         /* Arg1 TypeName */
02519         L"Microsoft.UI.Xaml.Controls.NavigationViewOverflowLabelMode",
02520         /* Arg2 CreateXamlTypeCallback */
02521         []()
02522         {
02523             auto xamlType = winrt::make<EnumXamlType>(
02524                 /* Arg 1 - TypeName */
02525                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewOverflowLabelMode",
02526                 /* Arg 2 - CreateFromString func */
02527                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02528                 {
02529                     if (fromString == L"MoreLabel") return box_value(winrt::NavigationViewOverflowLabelMode::MoreLabel);
02530                     if (fromString == L"NoLabel") return box_value(winrt::NavigationViewOverflowLabelMode::NoLabel);
02531                     throw winrt::hresult_invalid_argument();
02532                 });
02533
02534             return xamlType;
02535         }
02536     },
02537     {
02538         /* Arg1 TypeName */
02539         L"Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode",
02540         /* Arg2 CreateXamlTypeCallback */
02541         []()
02542         {
02543             auto xamlType = winrt::make<EnumXamlType>(
02544                 /* Arg 1 - TypeName */
02545                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode",
02546                 /* Arg 2 - CreateFromString func */
02547                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02548                 {
02549                     if (fromString == L"Auto") return box_value(winrt::NavigationViewPaneDisplayMode::Auto);
02550                     if (fromString == L"Left") return box_value(winrt::NavigationViewPaneDisplayMode::Left);
02551                     if (fromString == L"Top") return box_value(winrt::NavigationViewPaneDisplayMode::Top);
02552                     if (fromString == L"LeftCompact") return box_value(winrt::NavigationViewPaneDisplayMode::LeftCompact);
02553                     if (fromString == L"LeftMinimal") return box_value(winrt::NavigationViewPaneDisplayMode::LeftMinimal);
02554                     throw winrt::hresult_invalid_argument();
02555                 });
02556
02557             return xamlType;
02558         }
02559     },
02560     {
02561         /* Arg1 TypeName */
02562         L"Microsoft.UI.Xaml.Controls.NavigationViewSelectionFollowsFocus",
02563         /* Arg2 CreateXamlTypeCallback */
02564         []()
02565         {
02566             auto xamlType = winrt::make<EnumXamlType>(
02567                 /* Arg 1 - TypeName */
02568                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewSelectionFollowsFocus",
02569                 /* Arg 2 - CreateFromString func */
02570                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02571                 {
02572                     if (fromString == L"Disabled") return box_value(winrt::NavigationViewSelectionFollowsFocus::Disabled);
02573                     if (fromString == L"Enabled") return box_value(winrt::NavigationViewSelectionFollowsFocus::Enabled);
02574                     throw winrt::hresult_invalid_argument();
02575                 });
02576
02577             return xamlType;
02578         }
02579     },
02580     {
02581         /* Arg1 TypeName */
02582         L"Microsoft.UI.Xaml.Controls.NavigationViewShoulderNavigationEnabled",
02583         /* Arg2 CreateXamlTypeCallback */
02584         []()
02585         {
02586             auto xamlType = winrt::make<EnumXamlType>(
02587                 /* Arg 1 - TypeName */
02588                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewShoulderNavigationEnabled",
02589                 /* Arg 2 - CreateFromString func */
02590                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02591                 {
02592                     if (fromString == L"WhenSelectionFollowsFocus") return box_value(winrt::NavigationViewShoulderNavigationEnabled::WhenSelectionFollowsFocus);
02593                     if (fromString == L"Always") return box_value(winrt::NavigationViewShoulderNavigationEnabled::Always);
02594                     if (fromString == L"Never") return box_value(winrt::NavigationViewShoulderNavigationEnabled::Never);
02595                     throw winrt::hresult_invalid_argument();
02596                 });
02597
02598             return xamlType;
02599         }
02600     },
02601     {
02602         /* Arg1 TypeName */
02603         L"Microsoft.UI.Xaml.Controls.NavigationViewTemplateSettings",
02604         /* Arg2 CreateXamlTypeCallback */
02605         []()
02606         {
02607             auto xamlType = winrt::make_self<XamlType>(
02608                 /* Arg 1 - TypeName */
02609                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NavigationViewTemplateSettings",
02610                 /* Arg 2 - BaseTypeName */
02611                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
02612                 /* Arg 3 - Activator func */
02613                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INavigationViewTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.NavigationViewTemplateSettings"); },
02614                 /* Arg 4 - Populate properties func */
02615                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02616                 {
02617                     winrt::INavigationViewTemplateSettingsStatics statics = GetFactory<winrt::INavigationViewTemplateSettingsStatics>(L"Microsoft.UI.Xaml.Controls.NavigationViewTemplateSettings");
02618                     {
02619                         xamlType.AddDPMember(L"BackButtonVisibility", L"Microsoft.UI.Xaml.Visibility", statics.BackButtonVisibilityProperty(), false /* isContent */);
02620                         xamlType.AddDPMember(L"LeftPaneVisibility", L"Microsoft.UI.Xaml.Visibility", statics.LeftPaneVisibilityProperty(), false /* isContent */);
02621                         xamlType.AddDPMember(L"OverflowButtonVisibility", L"Microsoft.UI.Xaml.Visibility", statics.OverflowButtonVisibilityProperty(), false /* isContent */);
02622                         xamlType.AddDPMember(L"PaneToggleButtonVisibility", L"Microsoft.UI.Xaml.Visibility", statics.PaneToggleButtonVisibilityProperty(), false /* isContent */);
02623                         xamlType.AddDPMember(L"PaneToggleButtonWidth", L"Double", statics.PaneToggleButtonWidthProperty(), false /* isContent */);
02624                         xamlType.AddDPMember(L"SingleSelectionFollowsFocus", L"Boolean", statics.SingleSelectionFollowsFocusProperty(), false /* isContent */);
02625                         xamlType.AddDPMember(L"SmallerPaneToggleButtonWidth", L"Double", statics.SmallerPaneToggleButtonWidthProperty(), false /* isContent */);
02626                         xamlType.AddDPMember(L"TopPadding", L"Double", statics.TopPaddingProperty(), false /* isContent */);
02627                         xamlType.AddDPMember(L"TopPaneVisibility", L"Microsoft.UI.Xaml.Visibility", statics.TopPaneVisibilityProperty(), false /* isContent */);
02628                     }
02629
02630                     winrt::INavigationViewTemplateSettingsStatics2 statics2 = GetFactory<winrt::INavigationViewTemplateSettingsStatics2>(L"Microsoft.UI.Xaml.Controls.NavigationViewTemplateSettings");
02631                     {
02632                         xamlType.AddDPMember(L"OpenPaneLength", L"Double", statics2.OpenPaneLengthProperty(), false /* isContent */);
02633                     }
02634
02635                 });
02636
02637             return static_cast<winrt::IXamlType>(*xamlType);
02638         }
02639     },
02640     {
02641         /* Arg1 TypeName */
02642         L"Microsoft.UI.Xaml.Controls.NonVirtualizingLayout",
02643         /* Arg2 CreateXamlTypeCallback */
02644         []()
02645         {
02646             auto xamlType = winrt::make_self<XamlType>(
02647                 /* Arg 1 - TypeName */
02648                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NonVirtualizingLayout",
02649                 /* Arg 2 - BaseTypeName */
02650                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Layout",
02651                 /* Arg 3 - Activator func */
02652                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INonVirtualizingLayoutFactory>(L"Microsoft.UI.Xaml.Controls.NonVirtualizingLayout"); },
02653                 /* Arg 4 - Populate properties func */
02654                 nullptr
02655             );
02656
02657             return static_cast<winrt::IXamlType>(*xamlType);
02658         }
02659     },
02660     {
02661         /* Arg1 TypeName */
02662         L"Microsoft.UI.Xaml.Controls.NonVirtualizingLayoutContext",
02663         /* Arg2 CreateXamlTypeCallback */
02664         []()
02665         {
02666             auto xamlType = winrt::make_self<XamlType>(
02667                 /* Arg 1 - TypeName */
02668                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NonVirtualizingLayoutContext",
02669                 /* Arg 2 - BaseTypeName */
02670                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.LayoutContext",
02671                 /* Arg 3 - Activator func */
02672                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INonVirtualizingLayoutContextFactory>(L"Microsoft.UI.Xaml.Controls.NonVirtualizingLayoutContext"); },
02673                 /* Arg 4 - Populate properties func */
02674                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02675                 {
02676                     xamlType.AddMember(
02677                         L"Children", /* propertyName */
02678                         L"Windows.Foundation.Collections.IReadOnlyList`1<Microsoft.UI.Xaml.UIElement>", /* propertyType */
02679                         [](winrt::IInspectable instance) { return instance.as<winrt::NonVirtualizingLayoutContext>().Children(); },
02680                         nullptr, /* setter */
02681                         false, /* isContent */
02682                         false, /* isDependencyProperty */
02683                         false /* isAttachable */);
02684                 });
02685
02686             return static_cast<winrt::IXamlType>(*xamlType);
02687         }
02688     },
02689     {
02690         /* Arg1 TypeName */
02691         L"Microsoft.UI.Xaml.Controls.NumberBox",
02692         /* Arg2 CreateXamlTypeCallback */
02693         []()
02694         {
02695             auto xamlType = winrt::make_self<XamlType>(
02696                 /* Arg 1 - TypeName */
02697                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NumberBox",
02698                 /* Arg 2 - BaseTypeName */
02699                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
02700                 /* Arg 3 - Activator func */
02701                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INumberBoxFactory>(L"Microsoft.UI.Xaml.Controls.NumberBox"); },
02702                 /* Arg 4 - Populate properties func */
02703                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02704                 {
02705                     winrt::INumberBoxStatics statics = GetFactory<winrt::INumberBoxStatics>(L"Microsoft.UI.Xaml.Controls.NumberBox");
02706                     {
02707                         xamlType.AddDPMember(L"AcceptsExpression", L"Boolean", statics.AcceptsExpressionProperty(), false /* isContent */);
02708                         xamlType.AddDPMember(L"Description", L"Object", statics.DescriptionProperty(), false /* isContent */);
02709                         xamlType.AddDPMember(L"Header", L"Object", statics.HeaderProperty(), false /* isContent */);
02710                         xamlType.AddDPMember(L"HeaderTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.HeaderTemplateProperty(), false /* isContent */);
02711                         xamlType.AddDPMember(L"IsWrapEnabled", L"Boolean", statics.IsWrapEnabledProperty(), false /* isContent */);
02712                         xamlType.AddDPMember(L"LargeChange", L"Double", statics.LargeChangeProperty(), false /* isContent */);
02713                         xamlType.AddDPMember(L"Maximum", L"Double", statics.MaximumProperty(), false /* isContent */);
02714                         xamlType.AddDPMember(L"Minimum", L"Double", statics.MinimumProperty(), false /* isContent */);
02715                         xamlType.AddDPMember(L"NumberFormatter", L"Windows.Globalization.NumberFormatting.INumberFormatter2", statics.NumberFormatterProperty(), false /* isContent */);
02716                         xamlType.AddDPMember(L"PlaceholderText", L"String", statics.PlaceholderTextProperty(), false /* isContent */);
02717                         xamlType.AddDPMember(L"PreventKeyboardDisplayOnProgrammaticFocus", L"Boolean", statics.PreventKeyboardDisplayOnProgrammaticFocusProperty(), false /* isContent */);
02718                         xamlType.AddDPMember(L"SelectionFlyout", L"Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase", statics.SelectionFlyoutProperty(), false /* isContent */);
02719                         xamlType.AddDPMember(L"SelectionHighlightColor", L"Microsoft.UI.Xaml.Media.SolidColorBrush", statics.SelectionHighlightColorProperty(), false /* isContent */);
02720                         xamlType.AddDPMember(L"SmallChange", L"Double", statics.SmallChangeProperty(), false /* isContent */);
02721                         xamlType.AddDPMember(L"SpinButtonPlacementMode", L"Microsoft.UI.Xaml.Controls.NumberBoxSpinButtonPlacementMode", statics.SpinButtonPlacementModeProperty(), false /* isContent */);
02722                         xamlType.AddDPMember(L"Text", L"String", statics.TextProperty(), false /* isContent */);
02723                         xamlType.AddDPMember(L"TextReadingOrder", L"Microsoft.UI.Xaml.TextReadingOrder", statics.TextReadingOrderProperty(), false /* isContent */);
02724                         xamlType.AddDPMember(L"ValidationMode", L"Microsoft.UI.Xaml.Controls.NumberBoxValidationMode", statics.ValidationModeProperty(), false /* isContent */);
02725                         xamlType.AddDPMember(L"Value", L"Double", statics.ValueProperty(), false /* isContent */);
02726                     }
02727
02728                     winrt::INumberBoxStatics2 statics2 = GetFactory<winrt::INumberBoxStatics2>(L"Microsoft.UI.Xaml.Controls.NumberBox");
02729                     {
02730                         xamlType.AddDPMember(L"InputScope", L"Microsoft.UI.Xaml.Input.InputScope", statics2.InputScopeProperty(), false /* isContent */);
02731                         xamlType.AddDPMember(L"TextAlignment", L"Microsoft.UI.Xaml.TextAlignment", statics2.TextAlignmentProperty(), false /* isContent */);
02732                     }
02733
02734                 });
02735
02736             return static_cast<winrt::IXamlType>(*xamlType);
02737         }
02738     },
02739     {
02740         /* Arg1 TypeName */
02741         L"Microsoft.UI.Xaml.Controls.NumberBoxSpinButtonPlacementMode",
02742         /* Arg2 CreateXamlTypeCallback */
02743         []()
02744         {
02745             auto xamlType = winrt::make<EnumXamlType>(
02746                 /* Arg 1 - TypeName */
02747                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NumberBoxSpinButtonPlacementMode",
02748                 /* Arg 2 - CreateFromString func */
02749                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02750                 {
02751                     if (fromString == L"Hidden") return box_value(winrt::NumberBoxSpinButtonPlacementMode::Hidden);
02752                     if (fromString == L"Compact") return box_value(winrt::NumberBoxSpinButtonPlacementMode::Compact);
02753                     if (fromString == L"Inline") return box_value(winrt::NumberBoxSpinButtonPlacementMode::Inline);
02754                     throw winrt::hresult_invalid_argument();
02755                 });
02756
02757             return xamlType;
02758         }
02759     },
02760     {
02761         /* Arg1 TypeName */
02762         L"Microsoft.UI.Xaml.Controls.NumberBoxValidationMode",
02763         /* Arg2 CreateXamlTypeCallback */
02764         []()
02765         {
02766             auto xamlType = winrt::make<EnumXamlType>(
02767                 /* Arg 1 - TypeName */
02768                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NumberBoxValidationMode",
02769                 /* Arg 2 - CreateFromString func */
02770                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02771                 {
02772                     if (fromString == L"InvalidInputOverwritten") return box_value(winrt::NumberBoxValidationMode::InvalidInputOverwritten);
02773                     if (fromString == L"Disabled") return box_value(winrt::NumberBoxValidationMode::Disabled);
02774                     throw winrt::hresult_invalid_argument();
02775                 });
02776
02777             return xamlType;
02778         }
02779     },
02780     {
02781         /* Arg1 TypeName */
02782         L"Microsoft.UI.Xaml.Controls.PagerControl",
02783         /* Arg2 CreateXamlTypeCallback */
02784         []()
02785         {
02786             auto xamlType = winrt::make_self<XamlType>(
02787                 /* Arg 1 - TypeName */
02788                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PagerControl",
02789                 /* Arg 2 - BaseTypeName */
02790                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
02791                 /* Arg 3 - Activator func */
02792                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IPagerControlFactory>(L"Microsoft.UI.Xaml.Controls.PagerControl"); },
02793                 /* Arg 4 - Populate properties func */
02794                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02795                 {
02796                     winrt::IPagerControlStatics statics = GetFactory<winrt::IPagerControlStatics>(L"Microsoft.UI.Xaml.Controls.PagerControl");
02797                     {
02798                         xamlType.AddDPMember(L"ButtonPanelAlwaysShowFirstLastPageIndex", L"Boolean", statics.ButtonPanelAlwaysShowFirstLastPageIndexProperty(), false /* isContent */);
02799                         xamlType.AddDPMember(L"DisplayMode", L"Microsoft.UI.Xaml.Controls.PagerControlDisplayMode", statics.DisplayModeProperty(), false /* isContent */);
02800                         xamlType.AddDPMember(L"FirstButtonCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.FirstButtonCommandProperty(), false /* isContent */);
02801                         xamlType.AddDPMember(L"FirstButtonStyle", L"Microsoft.UI.Xaml.Style", statics.FirstButtonStyleProperty(), false /* isContent */);
02802                         xamlType.AddDPMember(L"FirstButtonVisibility", L"Microsoft.UI.Xaml.Controls.PagerControlButtonVisibility", statics.FirstButtonVisibilityProperty(), false /* isContent */);
02803                         xamlType.AddDPMember(L"LastButtonCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.LastButtonCommandProperty(), false /* isContent */);
02804                         xamlType.AddDPMember(L"LastButtonStyle", L"Microsoft.UI.Xaml.Style", statics.LastButtonStyleProperty(), false /* isContent */);
02805                         xamlType.AddDPMember(L"LastButtonVisibility", L"Microsoft.UI.Xaml.Controls.PagerControlButtonVisibility", statics.LastButtonVisibilityProperty(), false /* isContent */);
02806                         xamlType.AddDPMember(L"NextButtonCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.NextButtonCommandProperty(), false /* isContent */);
02807                         xamlType.AddDPMember(L"NextButtonStyle", L"Microsoft.UI.Xaml.Style", statics.NextButtonStyleProperty(), false /* isContent */);
02808                         xamlType.AddDPMember(L"NextButtonVisibility", L"Microsoft.UI.Xaml.Controls.PagerControlButtonVisibility", statics.NextButtonVisibilityProperty(), false /* isContent */);
02809                         xamlType.AddDPMember(L"NumberOfPages", L"Int32", statics.NumberOfPagesProperty(), false /* isContent */);
02810                         xamlType.AddDPMember(L"PagerInputCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.PagerInputCommandProperty(), false /* isContent */);
02811                         xamlType.AddDPMember(L"PrefixText", L"String", statics.PrefixTextProperty(), false /* isContent */);
02812                         xamlType.AddDPMember(L"PreviousButtonCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.PreviousButtonCommandProperty(), false /* isContent */);
02813                         xamlType.AddDPMember(L"PreviousButtonStyle", L"Microsoft.UI.Xaml.Style", statics.PreviousButtonStyleProperty(), false /* isContent */);
02814                         xamlType.AddDPMember(L"PreviousButtonVisibility", L"Microsoft.UI.Xaml.Controls.PagerControlButtonVisibility", statics.PreviousButtonVisibilityProperty(), false /* isContent */);
02815                         xamlType.AddDPMember(L"SelectedPageIndex", L"Int32", statics.SelectedPageIndexProperty(), false /* isContent */);
02816                         xamlType.AddDPMember(L"SuffixText", L"String", statics.SuffixTextProperty(), false /* isContent */);
02817                     }
02818
02819                     xamlType.AddMember(
02820                         L"TemplateSettings", /* propertyName */
02821                         L"Microsoft.UI.Xaml.Controls.PagerControlTemplateSettings", /* propertyType */
02822                         [](winrt::IInspectable instance) { return instance.as<winrt::PagerControl>().TemplateSettings(); },
02823                         nullptr, /* setter */
02824                         false, /* isContent */
02825                         false, /* isDependencyProperty */
02826                         false /* isAttachable */);
02827                 });
02828
02829             return static_cast<winrt::IXamlType>(*xamlType);
02830         }
02831     },
02832     {
02833         /* Arg1 TypeName */
02834         L"Microsoft.UI.Xaml.Controls.PagerControlButtonVisibility",
02835         /* Arg2 CreateXamlTypeCallback */
02836         []()
02837         {
02838             auto xamlType = winrt::make<EnumXamlType>(
02839                 /* Arg 1 - TypeName */
02840                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PagerControlButtonVisibility",
02841                 /* Arg 2 - CreateFromString func */
02842                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02843                 {
02844                     if (fromString == L"Visible") return box_value(winrt::PagerControlButtonVisibility::Visible);
02845                     if (fromString == L"HiddenOnEdge") return box_value(winrt::PagerControlButtonVisibility::HiddenOnEdge);
02846                     if (fromString == L"Hidden") return box_value(winrt::PagerControlButtonVisibility::Hidden);
02847                     throw winrt::hresult_invalid_argument();
02848                 });
02849
02850             return xamlType;
02851         }
02852     },
02853     {
02854         /* Arg1 TypeName */
02855         L"Microsoft.UI.Xaml.Controls.PagerControlDisplayMode",
02856         /* Arg2 CreateXamlTypeCallback */
02857         []()
02858         {
02859             auto xamlType = winrt::make<EnumXamlType>(
02860                 /* Arg 1 - TypeName */
02861                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PagerControlDisplayMode",
02862                 /* Arg 2 - CreateFromString func */
02863                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02864                 {
02865                     if (fromString == L"Auto") return box_value(winrt::PagerControlDisplayMode::Auto);
02866                     if (fromString == L"ComboBox") return box_value(winrt::PagerControlDisplayMode::ComboBox);
02867                     if (fromString == L"NumberBox") return box_value(winrt::PagerControlDisplayMode::NumberBox);
02868                     if (fromString == L"ButtonPanel") return box_value(winrt::PagerControlDisplayMode::ButtonPanel);
02869                     throw winrt::hresult_invalid_argument();
02870                 });
02871
02872             return xamlType;
02873         }
02874     },
02875     {
02876         /* Arg1 TypeName */
02877         L"Microsoft.UI.Xaml.Controls.PagerControlTemplateSettings",
02878         /* Arg2 CreateXamlTypeCallback */
02879         []()
02880         {
02881             auto xamlType = winrt::make_self<XamlType>(
02882                 /* Arg 1 - TypeName */
02883                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PagerControlTemplateSettings",
02884                 /* Arg 2 - BaseTypeName */
02885                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
02886                 /* Arg 3 - Activator func */
02887                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IPagerControlTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.PagerControlTemplateSettings"); },
02888                 /* Arg 4 - Populate properties func */
02889                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02890                 {
02891                     xamlType.AddMember(
02892                         L"NumberPanelItems", /* propertyName */
02893                         L"Windows.Foundation.Collections.IVector`1<Object>", /* propertyType */
02894                         [](winrt::IInspectable instance) { return instance.as<winrt::PagerControlTemplateSettings>().NumberPanelItems(); },
02895                         nullptr, /* setter */
02896                         false, /* isContent */
02897                         false, /* isDependencyProperty */
02898                         false /* isAttachable */);
02899                     xamlType.AddMember(
02900                         L"Pages", /* propertyName */
02901                         L"Windows.Foundation.Collections.IVector`1<Object>", /* propertyType */
02902                         [](winrt::IInspectable instance) { return instance.as<winrt::PagerControlTemplateSettings>().Pages(); },
02903                         nullptr, /* setter */
02904                         false, /* isContent */
02905                         false, /* isDependencyProperty */
02906                         false /* isAttachable */);
02907                 });
02908
02909             return static_cast<winrt::IXamlType>(*xamlType);
02910         }
02911     },
02912     {
02913         /* Arg1 TypeName */
02914         L"Microsoft.UI.Xaml.Controls.ParallaxSourceOffsetKind",
02915         /* Arg2 CreateXamlTypeCallback */
02916         []()
02917         {
02918             auto xamlType = winrt::make<EnumXamlType>(
02919                 /* Arg 1 - TypeName */
02920                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ParallaxSourceOffsetKind",
02921                 /* Arg 2 - CreateFromString func */
02922                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
02923                 {
02924                     if (fromString == L"Absolute") return box_value(winrt::ParallaxSourceOffsetKind::Absolute);
02925                     if (fromString == L"Relative") return box_value(winrt::ParallaxSourceOffsetKind::Relative);
02926                     throw winrt::hresult_invalid_argument();
02927                 });
02928
02929             return xamlType;
02930         }
02931     },
02932     {
02933         /* Arg1 TypeName */
02934         L"Microsoft.UI.Xaml.Controls.ParallaxView",
02935         /* Arg2 CreateXamlTypeCallback */
02936         []()
02937         {
02938             auto xamlType = winrt::make_self<XamlType>(
02939                 /* Arg 1 - TypeName */
02940                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ParallaxView",
02941                 /* Arg 2 - BaseTypeName */
02942                 (PCWSTR)L"Microsoft.UI.Xaml.FrameworkElement",
02943                 /* Arg 3 - Activator func */
02944                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IParallaxViewFactory>(L"Microsoft.UI.Xaml.Controls.ParallaxView"); },
02945                 /* Arg 4 - Populate properties func */
02946                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02947                 {
02948                     winrt::IParallaxViewStatics statics = GetFactory<winrt::IParallaxViewStatics>(L"Microsoft.UI.Xaml.Controls.ParallaxView");
02949                     {
02950                         xamlType.AddDPMember(L"Child", L"Microsoft.UI.Xaml.UIElement", statics.ChildProperty(), true /* isContent */);
02951                         xamlType.AddDPMember(L"HorizontalShift", L"Double", statics.HorizontalShiftProperty(), false /* isContent */);
02952                         xamlType.AddDPMember(L"HorizontalSourceEndOffset", L"Double", statics.HorizontalSourceEndOffsetProperty(), false /* isContent */);
02953                         xamlType.AddDPMember(L"HorizontalSourceOffsetKind", L"Microsoft.UI.Xaml.Controls.ParallaxSourceOffsetKind", statics.HorizontalSourceOffsetKindProperty(), false /* isContent */);
02954                         xamlType.AddDPMember(L"HorizontalSourceStartOffset", L"Double", statics.HorizontalSourceStartOffsetProperty(), false /* isContent */);
02955                         xamlType.AddDPMember(L"IsHorizontalShiftClamped", L"Boolean", statics.IsHorizontalShiftClampedProperty(), false /* isContent */);
02956                         xamlType.AddDPMember(L"IsVerticalShiftClamped", L"Boolean", statics.IsVerticalShiftClampedProperty(), false /* isContent */);
02957                         xamlType.AddDPMember(L"MaxHorizontalShiftRatio", L"Double", statics.MaxHorizontalShiftRatioProperty(), false /* isContent */);
02958                         xamlType.AddDPMember(L"MaxVerticalShiftRatio", L"Double", statics.MaxVerticalShiftRatioProperty(), false /* isContent */);
02959                         xamlType.AddDPMember(L"Source", L"Microsoft.UI.Xaml.UIElement", statics.SourceProperty(), false /* isContent */);
02960                         xamlType.AddDPMember(L"VerticalShift", L"Double", statics.VerticalShiftProperty(), false /* isContent */);
02961                         xamlType.AddDPMember(L"VerticalSourceEndOffset", L"Double", statics.VerticalSourceEndOffsetProperty(), false /* isContent */);
02962                         xamlType.AddDPMember(L"VerticalSourceOffsetKind", L"Microsoft.UI.Xaml.Controls.ParallaxSourceOffsetKind", statics.VerticalSourceOffsetKindProperty(), false /* isContent */);
02963                         xamlType.AddDPMember(L"VerticalSourceStartOffset", L"Double", statics.VerticalSourceStartOffsetProperty(), false /* isContent */);
02964                     }
02965
02966                 });
02967
02968             return static_cast<winrt::IXamlType>(*xamlType);
02969         }
02970     },
02971     {
02972         /* Arg1 TypeName */
02973         L"Microsoft.UI.Xaml.Controls.PersonPicture",
02974         /* Arg2 CreateXamlTypeCallback */
02975         []()
02976         {
02977             auto xamlType = winrt::make_self<XamlType>(
02978                 /* Arg 1 - TypeName */
02979                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PersonPicture",
02980                 /* Arg 2 - BaseTypeName */
02981                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
02982                 /* Arg 3 - Activator func */
02983                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IPersonPictureFactory>(L"Microsoft.UI.Xaml.Controls.PersonPicture"); },
02984                 /* Arg 4 - Populate properties func */
02985                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
02986                 {
02987                     winrt::IPersonPictureStatics statics = GetFactory<winrt::IPersonPictureStatics>(L"Microsoft.UI.Xaml.Controls.PersonPicture");
02988                     {
02989                         xamlType.AddDPMember(L"BadgeGlyph", L"String", statics.BadgeGlyphProperty(), false /* isContent */);
02990                         xamlType.AddDPMember(L"BadgeImageSource", L"Microsoft.UI.Xaml.Media.ImageSource", statics.BadgeImageSourceProperty(), false /* isContent */);
02991                         xamlType.AddDPMember(L"BadgeNumber", L"Int32", statics.BadgeNumberProperty(), false /* isContent */);
02992                         xamlType.AddDPMember(L"BadgeText", L"String", statics.BadgeTextProperty(), false /* isContent */);
02993                         xamlType.AddDPMember(L"Contact", L"Windows.ApplicationModel.Contacts.Contact", statics.ContactProperty(), false /* isContent */);
02994                         xamlType.AddDPMember(L"DisplayName", L"String", statics.DisplayNameProperty(), false /* isContent */);
02995                         xamlType.AddDPMember(L"Initials", L"String", statics.InitialsProperty(), false /* isContent */);
02996                         xamlType.AddDPMember(L"IsGroup", L"Boolean", statics.IsGroupProperty(), false /* isContent */);
02997                         xamlType.AddDPMember(L"PreferSmallImage", L"Boolean", statics.PreferSmallImageProperty(), false /* isContent */);
02998                         xamlType.AddDPMember(L"ProfilePicture", L"Microsoft.UI.Xaml.Media.ImageSource", statics.ProfilePictureProperty(), false /* isContent */);
02999                     }
03000
03001                     xamlType.AddMember(
03002                         L"TemplateSettings", /* propertyName */
03003                         L"Microsoft.UI.Xaml.Controls.PersonPictureTemplateSettings", /* propertyType */
03004                         [](winrt::IInspectable instance) { return instance.as<winrt::PersonPicture>().TemplateSettings(); },
03005                         nullptr, /* setter */
03006                         false, /* isContent */
03007                         false, /* isDependencyProperty */
03008                         false /* isAttachable */);
03009                 });
03010
03011             return static_cast<winrt::IXamlType>(*xamlType);
03012         }
03013     },
03014     {
03015         /* Arg1 TypeName */
03016         L"Microsoft.UI.Xaml.Controls.PersonPictureTemplateSettings",
03017         /* Arg2 CreateXamlTypeCallback */
03018         []()
03019         {
03020             auto xamlType = winrt::make_self<XamlType>(
03021                 /* Arg 1 - TypeName */
03022                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PersonPictureTemplateSettings",
03023                 /* Arg 2 - BaseTypeName */
03024                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
03025                 /* Arg 3 - Activator func */
03026                 nullptr,
03027                 /* Arg 4 - Populate properties func */
03028                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03029                 {
03030                     xamlType.AddMember(
03031                         L"ActualImageBrush", /* propertyName */
03032                         L"Microsoft.UI.Xaml.Media.ImageBrush", /* propertyType */
03033                         [](winrt::IInspectable instance) { return instance.as<winrt::PersonPictureTemplateSettings>().ActualImageBrush(); },
03034                         nullptr, /* setter */
03035                         false, /* isContent */
03036                         false, /* isDependencyProperty */
03037                         false /* isAttachable */);
03038                     xamlType.AddMember(
03039                         L"ActualInitials", /* propertyName */
03040                         L"String", /* propertyType */
03041                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::PersonPictureTemplateSettings>().ActualInitials()); },
03042                         nullptr, /* setter */
03043                         false, /* isContent */
03044                         false, /* isDependencyProperty */
03045                         false /* isAttachable */);
03046                 });
03047
03048             return static_cast<winrt::IXamlType>(*xamlType);
03049         }
03050     },
03051     {
03052         /* Arg1 TypeName */
03053         L"Microsoft.UI.Xaml.Controls.PipsPager",
03054         /* Arg2 CreateXamlTypeCallback */
03055         []()
03056         {
03057             auto xamlType = winrt::make_self<XamlType>(
03058                 /* Arg 1 - TypeName */
03059                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PipsPager",
03060                 /* Arg 2 - BaseTypeName */
03061                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
03062                 /* Arg 3 - Activator func */
03063                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IPipsPagerFactory>(L"Microsoft.UI.Xaml.Controls.PipsPager"); },
03064                 /* Arg 4 - Populate properties func */
03065                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03066                 {
03067                     winrt::IPipsPagerStatics statics = GetFactory<winrt::IPipsPagerStatics>(L"Microsoft.UI.Xaml.Controls.PipsPager");
03068                     {
03069                         xamlType.AddDPMember(L"MaxVisiblePips", L"Int32", statics.MaxVisiblePipsProperty(), false /* isContent */);
03070                         xamlType.AddDPMember(L"NextButtonStyle", L"Microsoft.UI.Xaml.Style", statics.NextButtonStyleProperty(), false /* isContent */);
03071                         xamlType.AddDPMember(L"NextButtonVisibility", L"Microsoft.UI.Xaml.Controls.PipsPagerButtonVisibility", statics.NextButtonVisibilityProperty(), false /* isContent */);
03072                         xamlType.AddDPMember(L"NormalPipStyle", L"Microsoft.UI.Xaml.Style", statics.NormalPipStyleProperty(), false /* isContent */);
03073                         xamlType.AddDPMember(L"NumberOfPages", L"Int32", statics.NumberOfPagesProperty(), false /* isContent */);
03074                         xamlType.AddDPMember(L"Orientation", L"Microsoft.UI.Xaml.Controls.Orientation", statics.OrientationProperty(), false /* isContent */);
03075                         xamlType.AddDPMember(L"PreviousButtonStyle", L"Microsoft.UI.Xaml.Style", statics.PreviousButtonStyleProperty(), false /* isContent */);
03076                         xamlType.AddDPMember(L"PreviousButtonVisibility", L"Microsoft.UI.Xaml.Controls.PipsPagerButtonVisibility", statics.PreviousButtonVisibilityProperty(), false /* isContent */);
03077                         xamlType.AddDPMember(L"SelectedPageIndex", L"Int32", statics.SelectedPageIndexProperty(), false /* isContent */);
03078                         xamlType.AddDPMember(L"SelectedPipStyle", L"Microsoft.UI.Xaml.Style", statics.SelectedPipStyleProperty(), false /* isContent */);
03079                     }
03080
03081                     winrt::IPipsPagerStatics2 statics2 = GetFactory<winrt::IPipsPagerStatics2>(L"Microsoft.UI.Xaml.Controls.PipsPager");
03082                     {
03083                         xamlType.AddDPMember(L"WrapMode", L"Microsoft.UI.Xaml.Controls.PipsPagerWrapMode", statics2.WrapModeProperty(), false /* isContent */);
03084                     }
03085
03086                     xamlType.AddMember(
03087                         L"TemplateSettings", /* propertyName */
03088                         L"Microsoft.UI.Xaml.Controls.PipsPagerTemplateSettings", /* propertyType */
03089                         [](winrt::IInspectable instance) { return instance.as<winrt::PipsPager>().TemplateSettings(); },
03090                         nullptr, /* setter */
03091                         false, /* isContent */
03092                         false, /* isDependencyProperty */
03093                         false /* isAttachable */);
03094                 });
03095
03096             return static_cast<winrt::IXamlType>(*xamlType);
03097         }
03098     },
03099     {
03100         /* Arg1 TypeName */
03101         L"Microsoft.UI.Xaml.Controls.PipsPagerButtonVisibility",
03102         /* Arg2 CreateXamlTypeCallback */
03103         []()
03104         {
03105             auto xamlType = winrt::make<EnumXamlType>(
03106                 /* Arg 1 - TypeName */
03107                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PipsPagerButtonVisibility",
03108                 /* Arg 2 - CreateFromString func */
03109                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
03110                 {
03111                     if (fromString == L"Visible") return box_value(winrt::PipsPagerButtonVisibility::Visible);
03112                     if (fromString == L"VisibleOnPointerOver") return box_value(winrt::PipsPagerButtonVisibility::VisibleOnPointerOver);
03113                     if (fromString == L"Collapsed") return box_value(winrt::PipsPagerButtonVisibility::Collapsed);
03114                     throw winrt::hresult_invalid_argument();
03115                 });
03116
03117             return xamlType;
03118         }
03119     },
03120     {
03121         /* Arg1 TypeName */
03122         L"Microsoft.UI.Xaml.Controls.PipsPagerTemplateSettings",
03123         /* Arg2 CreateXamlTypeCallback */
03124         []()
03125         {
03126             auto xamlType = winrt::make_self<XamlType>(
03127                 /* Arg 1 - TypeName */
03128                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PipsPagerTemplateSettings",
03129                 /* Arg 2 - BaseTypeName */
03130                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
03131                 /* Arg 3 - Activator func */
03132                 nullptr,
03133                 /* Arg 4 - Populate properties func */
03134                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03135                 {
03136                     xamlType.AddMember(
03137                         L"PipsPagerItems", /* propertyName */
03138                         L"Windows.Foundation.Collections.IVector`1<Int32>", /* propertyType */
03139                         [](winrt::IInspectable instance) { return instance.as<winrt::PipsPagerTemplateSettings>().PipsPagerItems(); },
03140                         nullptr, /* setter */
03141                         false, /* isContent */
03142                         false, /* isDependencyProperty */
03143                         false /* isAttachable */);
03144                 });
03145
03146             return static_cast<winrt::IXamlType>(*xamlType);
03147         }
03148     },
03149     {
03150         /* Arg1 TypeName */
03151         L"Microsoft.UI.Xaml.Controls.PipsPagerWrapMode",
03152         /* Arg2 CreateXamlTypeCallback */
03153         []()
03154         {
03155             auto xamlType = winrt::make<EnumXamlType>(
03156                 /* Arg 1 - TypeName */
03157                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PipsPagerWrapMode",
03158                 /* Arg 2 - CreateFromString func */
03159                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
03160                 {
03161                     if (fromString == L"None") return box_value(winrt::PipsPagerWrapMode::None);
03162                     if (fromString == L"Wrap") return box_value(winrt::PipsPagerWrapMode::Wrap);
03163                     throw winrt::hresult_invalid_argument();
03164                 });
03165
03166             return xamlType;
03167         }
03168     },
03169     {
03170         /* Arg1 TypeName */
03171         L"Microsoft.UI.Xaml.Controls.PlayerAnimationOptimization",
03172         /* Arg2 CreateXamlTypeCallback */
03173         []()
03174         {
03175             auto xamlType = winrt::make<EnumXamlType>(
03176                 /* Arg 1 - TypeName */
03177                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.PlayerAnimationOptimization",
03178                 /* Arg 2 - CreateFromString func */
03179                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
03180                 {
03181                     if (fromString == L"Latency") return box_value(winrt::PlayerAnimationOptimization::Latency);
03182                     if (fromString == L"Resources") return box_value(winrt::PlayerAnimationOptimization::Resources);
03183                     throw winrt::hresult_invalid_argument();
03184                 });
03185
03186             return xamlType;
03187         }
03188     },
03189     {
03190         /* Arg1 TypeName */
03191         L"Microsoft.UI.Xaml.Controls.Primitives.AutoSuggestBoxHelper",
03192         /* Arg2 CreateXamlTypeCallback */
03193         []()
03194         {
03195             auto xamlType = winrt::make_self<XamlType>(
03196                 /* Arg 1 - TypeName */
03197                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.AutoSuggestBoxHelper",
03198                 /* Arg 2 - BaseTypeName */
03199                 (PCWSTR)L"Object",
03200                 /* Arg 3 - Activator func */
03201                 nullptr,
03202                 /* Arg 4 - Populate properties func */
03203                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03204                 {
03205                     winrt::IAutoSuggestBoxHelperStatics statics = GetFactory<winrt::IAutoSuggestBoxHelperStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.AutoSuggestBoxHelper");
03206                     {
03207                         xamlType.AddDPMember(L"KeepInteriorCornersSquare", L"Boolean", statics.KeepInteriorCornersSquareProperty(), false /* isContent */);
03208                     }
03209
03210                 });
03211
03212             return static_cast<winrt::IXamlType>(*xamlType);
03213         }
03214     },
03215     {
03216         /* Arg1 TypeName */
03217         L"Microsoft.UI.Xaml.Controls.Primitives.ColorPickerSlider",
03218         /* Arg2 CreateXamlTypeCallback */
03219         []()
03220         {
03221             auto xamlType = winrt::make_self<XamlType>(
03222                 /* Arg 1 - TypeName */
03223                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ColorPickerSlider",
03224                 /* Arg 2 - BaseTypeName */
03225                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Slider",
03226                 /* Arg 3 - Activator func */
03227                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IColorPickerSliderFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.ColorPickerSlider"); },
03228                 /* Arg 4 - Populate properties func */
03229                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03230                 {
03231                     winrt::IColorPickerSliderStatics statics = GetFactory<winrt::IColorPickerSliderStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.ColorPickerSlider");
03232                     {
03233                         xamlType.AddDPMember(L"ColorChannel", L"Microsoft.UI.Xaml.Controls.ColorPickerHsvChannel", statics.ColorChannelProperty(), false /* isContent */);
03234                     }
03235
03236                 });
03237
03238             return static_cast<winrt::IXamlType>(*xamlType);
03239         }
03240     },
03241     {
03242         /* Arg1 TypeName */
03243         L"Microsoft.UI.Xaml.Controls.Primitives.ColorSpectrum",
03244         /* Arg2 CreateXamlTypeCallback */
03245         []()
03246         {
03247             auto xamlType = winrt::make_self<XamlType>(
03248                 /* Arg 1 - TypeName */
03249                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ColorSpectrum",
03250                 /* Arg 2 - BaseTypeName */
03251                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
03252                 /* Arg 3 - Activator func */
03253                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IColorSpectrumFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.ColorSpectrum"); },
03254                 /* Arg 4 - Populate properties func */
03255                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03256                 {
03257                     winrt::IColorSpectrumStatics statics = GetFactory<winrt::IColorSpectrumStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.ColorSpectrum");
03258                     {
03259                         xamlType.AddDPMember(L"Color", L"Windows.UI.Color", statics.ColorProperty(), false /* isContent */);
03260                         xamlType.AddDPMember(L"Components", L"Microsoft.UI.Xaml.Controls.ColorSpectrumComponents", statics.ComponentsProperty(), false /* isContent */);
03261                         xamlType.AddDPMember(L"HsvColor", L"Windows.Foundation.Numerics.Vector4", statics.HsvColorProperty(), false /* isContent */);
03262                         xamlType.AddDPMember(L"MaxHue", L"Int32", statics.MaxHueProperty(), false /* isContent */);
03263                         xamlType.AddDPMember(L"MaxSaturation", L"Int32", statics.MaxSaturationProperty(), false /* isContent */);
03264                         xamlType.AddDPMember(L"MaxValue", L"Int32", statics.MaxValueProperty(), false /* isContent */);
03265                         xamlType.AddDPMember(L"MinHue", L"Int32", statics.MinHueProperty(), false /* isContent */);
03266                         xamlType.AddDPMember(L"MinSaturation", L"Int32", statics.MinSaturationProperty(), false /* isContent */);
03267                         xamlType.AddDPMember(L"MinValue", L"Int32", statics.MinValueProperty(), false /* isContent */);
03268                         xamlType.AddDPMember(L"Shape", L"Microsoft.UI.Xaml.Controls.ColorSpectrumShape", statics.ShapeProperty(), false /* isContent */);
03269                     }
03270
03271                 });
03272
03273             return static_cast<winrt::IXamlType>(*xamlType);
03274         }
03275     },
03276     {
03277         /* Arg1 TypeName */
03278         L"Microsoft.UI.Xaml.Controls.Primitives.ColumnMajorUniformToLargestGridLayout",
03279         /* Arg2 CreateXamlTypeCallback */
03280         []()
03281         {
03282             auto xamlType = winrt::make_self<XamlType>(
03283                 /* Arg 1 - TypeName */
03284                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ColumnMajorUniformToLargestGridLayout",
03285                 /* Arg 2 - BaseTypeName */
03286                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.NonVirtualizingLayout",
03287                 /* Arg 3 - Activator func */
03288                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IColumnMajorUniformToLargestGridLayoutFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.ColumnMajorUniformToLargestGridLayout"); },
03289                 /* Arg 4 - Populate properties func */
03290                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03291                 {
03292                     winrt::IColumnMajorUniformToLargestGridLayoutStatics statics = GetFactory<winrt::IColumnMajorUniformToLargestGridLayoutStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.ColumnMajorUniformToLargestGridLayout");
03293                     {
03294                         xamlType.AddDPMember(L"ColumnSpacing", L"Double", statics.ColumnSpacingProperty(), false /* isContent */);
03295                         xamlType.AddDPMember(L"MaxColumns", L"Int32", statics.MaxColumnsProperty(), false /* isContent */);
03296                         xamlType.AddDPMember(L"RowSpacing", L"Double", statics.RowSpacingProperty(), false /* isContent */);
03297                     }
03298
03299                 });
03300
03301             return static_cast<winrt::IXamlType>(*xamlType);
03302         }
03303     },
03304     {
03305         /* Arg1 TypeName */
03306         L"Microsoft.UI.Xaml.Controls.Primitives.ComboBoxHelper",
03307         /* Arg2 CreateXamlTypeCallback */
03308         []()
03309         {
03310             auto xamlType = winrt::make_self<XamlType>(
03311                 /* Arg 1 - TypeName */
03312                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ComboBoxHelper",
03313                 /* Arg 2 - BaseTypeName */
03314                 (PCWSTR)L"Object",
03315                 /* Arg 3 - Activator func */
03316                 nullptr,
03317                 /* Arg 4 - Populate properties func */
03318                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03319                 {
03320                     winrt::IComboBoxHelperStatics statics = GetFactory<winrt::IComboBoxHelperStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.ComboBoxHelper");
03321                     {
03322                         xamlType.AddDPMember(L"KeepInteriorCornersSquare", L"Boolean", statics.KeepInteriorCornersSquareProperty(), false /* isContent */);
03323                     }
03324
03325                 });
03326
03327             return static_cast<winrt::IXamlType>(*xamlType);
03328         }
03329     },
03330     {
03331         /* Arg1 TypeName */
03332         L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBar",
03333         /* Arg2 CreateXamlTypeCallback */
03334         []()
03335         {
03336             auto xamlType = winrt::make_self<XamlType>(
03337                 /* Arg 1 - TypeName */
03338                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBar",
03339                 /* Arg 2 - BaseTypeName */
03340                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.CommandBar",
03341                 /* Arg 3 - Activator func */
03342                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ICommandBarFlyoutCommandBarFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBar"); },
03343                 /* Arg 4 - Populate properties func */
03344                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03345                 {
03346                     winrt::ICommandBarFlyoutCommandBarStatics statics = GetFactory<winrt::ICommandBarFlyoutCommandBarStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBar");
03347                     {
03348                         xamlType.AddDPMember(L"SystemBackdrop", L"Microsoft.UI.Xaml.Media.SystemBackdrop", statics.SystemBackdropProperty(), false /* isContent */);
03349                     }
03350
03351                     xamlType.AddMember(
03352                         L"FlyoutTemplateSettings", /* propertyName */
03353                         L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBarTemplateSettings", /* propertyType */
03354                         [](winrt::IInspectable instance) { return instance.as<winrt::CommandBarFlyoutCommandBar>().FlyoutTemplateSettings(); },
03355                         nullptr, /* setter */
03356                         false, /* isContent */
03357                         false, /* isDependencyProperty */
03358                         false /* isAttachable */);
03359                 });
03360
03361             return static_cast<winrt::IXamlType>(*xamlType);
03362         }
03363     },
03364     {
03365         /* Arg1 TypeName */
03366         L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBarAutomationProperties",
03367         /* Arg2 CreateXamlTypeCallback */
03368         []()
03369         {
03370             auto xamlType = winrt::make_self<XamlType>(
03371                 /* Arg 1 - TypeName */
03372                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBarAutomationProperties",
03373                 /* Arg 2 - BaseTypeName */
03374                 (PCWSTR)L"Object",
03375                 /* Arg 3 - Activator func */
03376                 nullptr,
03377                 /* Arg 4 - Populate properties func */
03378                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03379                 {
03380                     winrt::ICommandBarFlyoutCommandBarAutomationPropertiesStatics statics = GetFactory<winrt::ICommandBarFlyoutCommandBarAutomationPropertiesStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBarAutomationProperties");
03381                     {
03382                         xamlType.AddDPMember(L"ControlType", L"Microsoft.UI.Xaml.Automation.Peers.AutomationControlType", statics.ControlTypeProperty(), false /* isContent */);
03383                     }
03384
03385                 });
03386
03387             return static_cast<winrt::IXamlType>(*xamlType);
03388         }
03389     },
03390     {
03391         /* Arg1 TypeName */
03392         L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBarTemplateSettings",
03393         /* Arg2 CreateXamlTypeCallback */
03394         []()
03395         {
03396             auto xamlType = winrt::make_self<XamlType>(
03397                 /* Arg 1 - TypeName */
03398                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.CommandBarFlyoutCommandBarTemplateSettings",
03399                 /* Arg 2 - BaseTypeName */
03400                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
03401                 /* Arg 3 - Activator func */
03402                 nullptr,
03403                 /* Arg 4 - Populate properties func */
03404                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03405                 {
03406                     xamlType.AddMember(
03407                         L"CloseAnimationEndPosition", /* propertyName */
03408                         L"Double", /* propertyType */
03409                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().CloseAnimationEndPosition()); },
03410                         nullptr, /* setter */
03411                         false, /* isContent */
03412                         false, /* isDependencyProperty */
03413                         false /* isAttachable */);
03414                     xamlType.AddMember(
03415                         L"ContentClipRect", /* propertyName */
03416                         L"Windows.Foundation.Rect", /* propertyType */
03417                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ContentClipRect()); },
03418                         nullptr, /* setter */
03419                         false, /* isContent */
03420                         false, /* isDependencyProperty */
03421                         false /* isAttachable */);
03422                     xamlType.AddMember(
03423                         L"CurrentWidth", /* propertyName */
03424                         L"Double", /* propertyType */
03425                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().CurrentWidth()); },
03426                         nullptr, /* setter */
03427                         false, /* isContent */
03428                         false, /* isDependencyProperty */
03429                         false /* isAttachable */);
03430                     xamlType.AddMember(
03431                         L"ExpandDownAnimationEndPosition", /* propertyName */
03432                         L"Double", /* propertyType */
03433                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandDownAnimationEndPosition()); },
03434                         nullptr, /* setter */
03435                         false, /* isContent */
03436                         false, /* isDependencyProperty */
03437                         false /* isAttachable */);
03438                     xamlType.AddMember(
03439                         L"ExpandDownAnimationHoldPosition", /* propertyName */
03440                         L"Double", /* propertyType */
03441                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandDownAnimationHoldPosition()); },
03442                         nullptr, /* setter */
03443                         false, /* isContent */
03444                         false, /* isDependencyProperty */
03445                         false /* isAttachable */);
03446                     xamlType.AddMember(
03447                         L"ExpandDownAnimationStartPosition", /* propertyName */
03448                         L"Double", /* propertyType */
03449                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandDownAnimationStartPosition()); },
03450                         nullptr, /* setter */
03451                         false, /* isContent */
03452                         false, /* isDependencyProperty */
03453                         false /* isAttachable */);
03454                     xamlType.AddMember(
03455                         L"ExpandDownOverflowVerticalPosition", /* propertyName */
03456                         L"Double", /* propertyType */
03457                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandDownOverflowVerticalPosition()); },
03458                         nullptr, /* setter */
03459                         false, /* isContent */
03460                         false, /* isDependencyProperty */
03461                         false /* isAttachable */);
03462                     xamlType.AddMember(
03463                         L"ExpandUpAnimationEndPosition", /* propertyName */
03464                         L"Double", /* propertyType */
03465                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandUpAnimationEndPosition()); },
03466                         nullptr, /* setter */
03467                         false, /* isContent */
03468                         false, /* isDependencyProperty */
03469                         false /* isAttachable */);
03470                     xamlType.AddMember(
03471                         L"ExpandUpAnimationHoldPosition", /* propertyName */
03472                         L"Double", /* propertyType */
03473                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandUpAnimationHoldPosition()); },
03474                         nullptr, /* setter */
03475                         false, /* isContent */
03476                         false, /* isDependencyProperty */
03477                         false /* isAttachable */);
03478                     xamlType.AddMember(
03479                         L"ExpandUpAnimationStartPosition", /* propertyName */
03480                         L"Double", /* propertyType */
03481                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandUpAnimationStartPosition()); },
03482                         nullptr, /* setter */
03483                         false, /* isContent */
03484                         false, /* isDependencyProperty */
03485                         false /* isAttachable */);
03486                     xamlType.AddMember(
03487                         L"ExpandUpOverflowVerticalPosition", /* propertyName */
03488                         L"Double", /* propertyType */
03489                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandUpOverflowVerticalPosition()); },
03490                         nullptr, /* setter */
03491                         false, /* isContent */
03492                         false, /* isDependencyProperty */
03493                         false /* isAttachable */);
03494                     xamlType.AddMember(
03495                         L"ExpandedWidth", /* propertyName */
03496                         L"Double", /* propertyType */
03497                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().ExpandedWidth()); },
03498                         nullptr, /* setter */
03499                         false, /* isContent */
03500                         false, /* isDependencyProperty */
03501                         false /* isAttachable */);
03502                     xamlType.AddMember(
03503                         L"OpenAnimationEndPosition", /* propertyName */
03504                         L"Double", /* propertyType */
03505                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().OpenAnimationEndPosition()); },
03506                         nullptr, /* setter */
03507                         false, /* isContent */
03508                         false, /* isDependencyProperty */
03509                         false /* isAttachable */);
03510                     xamlType.AddMember(
03511                         L"OpenAnimationStartPosition", /* propertyName */
03512                         L"Double", /* propertyType */
03513                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().OpenAnimationStartPosition()); },
03514                         nullptr, /* setter */
03515                         false, /* isContent */
03516                         false, /* isDependencyProperty */
03517                         false /* isAttachable */);
03518                     xamlType.AddMember(
03519                         L"OverflowContentClipRect", /* propertyName */
03520                         L"Windows.Foundation.Rect", /* propertyType */
03521                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().OverflowContentClipRect()); },
03522                         nullptr, /* setter */
03523                         false, /* isContent */
03524                         false, /* isDependencyProperty */
03525                         false /* isAttachable */);
03526                     xamlType.AddMember(
03527                         L"WidthExpansionAnimationEndPosition", /* propertyName */
03528                         L"Double", /* propertyType */
03529                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().WidthExpansionAnimationEndPosition()); },
03530                         nullptr, /* setter */
03531                         false, /* isContent */
03532                         false, /* isDependencyProperty */
03533                         false /* isAttachable */);
03534                     xamlType.AddMember(
03535                         L"WidthExpansionAnimationStartPosition", /* propertyName */
03536                         L"Double", /* propertyType */
03537                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().WidthExpansionAnimationStartPosition()); },
03538                         nullptr, /* setter */
03539                         false, /* isContent */
03540                         false, /* isDependencyProperty */
03541                         false /* isAttachable */);
03542                     xamlType.AddMember(
03543                         L"WidthExpansionDelta", /* propertyName */
03544                         L"Double", /* propertyType */
03545                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().WidthExpansionDelta()); },
03546                         nullptr, /* setter */
03547                         false, /* isContent */
03548                         false, /* isDependencyProperty */
03549                         false /* isAttachable */);
03550                     xamlType.AddMember(
03551                         L"WidthExpansionMoreButtonAnimationEndPosition", /* propertyName */
03552                         L"Double", /* propertyType */
03553                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().WidthExpansionMoreButtonAnimationEndPosition()); },
03554                         nullptr, /* setter */
03555                         false, /* isContent */
03556                         false, /* isDependencyProperty */
03557                         false /* isAttachable */);
03558                     xamlType.AddMember(
03559                         L"WidthExpansionMoreButtonAnimationStartPosition", /* propertyName */
03560                         L"Double", /* propertyType */
03561                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::CommandBarFlyoutCommandBarTemplateSettings>().WidthExpansionMoreButtonAnimationStartPosition()); },
03562                         nullptr, /* setter */
03563                         false, /* isContent */
03564                         false, /* isDependencyProperty */
03565                         false /* isAttachable */);
03566                 });
03567
03568             return static_cast<winrt::IXamlType>(*xamlType);
03569         }
03570     },
03571     {
03572         /* Arg1 TypeName */
03573         L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusFilterConverter",
03574         /* Arg2 CreateXamlTypeCallback */
03575         []()
03576         {
03577             auto xamlType = winrt::make_self<XamlType>(
03578                 /* Arg 1 - TypeName */
03579                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusFilterConverter",
03580                 /* Arg 2 - BaseTypeName */
03581                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
03582                 /* Arg 3 - Activator func */
03583                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusFilterConverter"); },
03584                 /* Arg 4 - Populate properties func */
03585                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03586                 {
03587                     winrt::ICornerRadiusFilterConverterStatics statics = GetFactory<winrt::ICornerRadiusFilterConverterStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusFilterConverter");
03588                     {
03589                         xamlType.AddDPMember(L"Filter", L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusFilterKind", statics.FilterProperty(), false /* isContent */);
03590                         xamlType.AddDPMember(L"Scale", L"Double", statics.ScaleProperty(), false /* isContent */);
03591                     }
03592
03593                 });
03594
03595             return static_cast<winrt::IXamlType>(*xamlType);
03596         }
03597     },
03598     {
03599         /* Arg1 TypeName */
03600         L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusFilterKind",
03601         /* Arg2 CreateXamlTypeCallback */
03602         []()
03603         {
03604             auto xamlType = winrt::make<EnumXamlType>(
03605                 /* Arg 1 - TypeName */
03606                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusFilterKind",
03607                 /* Arg 2 - CreateFromString func */
03608                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
03609                 {
03610                     if (fromString == L"None") return box_value(winrt::CornerRadiusFilterKind::None);
03611                     if (fromString == L"Top") return box_value(winrt::CornerRadiusFilterKind::Top);
03612                     if (fromString == L"Right") return box_value(winrt::CornerRadiusFilterKind::Right);
03613                     if (fromString == L"Bottom") return box_value(winrt::CornerRadiusFilterKind::Bottom);
03614                     if (fromString == L"Left") return box_value(winrt::CornerRadiusFilterKind::Left);
03615                     if (fromString == L"TopLeftValue") return box_value(winrt::CornerRadiusFilterKind::TopLeftValue);
03616                     if (fromString == L"BottomRightValue") return box_value(winrt::CornerRadiusFilterKind::BottomRightValue);
03617                     throw winrt::hresult_invalid_argument();
03618                 });
03619
03620             return xamlType;
03621         }
03622     },
03623     {
03624         /* Arg1 TypeName */
03625         L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusToThicknessConverter",
03626         /* Arg2 CreateXamlTypeCallback */
03627         []()
03628         {
03629             auto xamlType = winrt::make_self<XamlType>(
03630                 /* Arg 1 - TypeName */
03631                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusToThicknessConverter",
03632                 /* Arg 2 - BaseTypeName */
03633                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
03634                 /* Arg 3 - Activator func */
03635                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusToThicknessConverter"); },
03636                 /* Arg 4 - Populate properties func */
03637                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03638                 {
03639                     winrt::ICornerRadiusToThicknessConverterStatics statics = GetFactory<winrt::ICornerRadiusToThicknessConverterStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusToThicknessConverter");
03640                     {
03641                         xamlType.AddDPMember(L"ConversionKind", L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusToThicknessConverterKind", statics.ConversionKindProperty(), false /* isContent */);
03642                         xamlType.AddDPMember(L"Multiplier", L"Double", statics.MultiplierProperty(), false /* isContent */);
03643                     }
03644
03645                 });
03646
03647             return static_cast<winrt::IXamlType>(*xamlType);
03648         }
03649     },
03650     {
03651         /* Arg1 TypeName */
03652         L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusToThicknessConverterKind",
03653         /* Arg2 CreateXamlTypeCallback */
03654         []()
03655         {
03656             auto xamlType = winrt::make<EnumXamlType>(
03657                 /* Arg 1 - TypeName */
03658                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusToThicknessConverterKind",
03659                 /* Arg 2 - CreateFromString func */
03660                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
03661                 {
03662                     if (fromString == L"FilterTopAndBottomFromLeft") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterTopAndBottomFromLeft);
03663                     if (fromString == L"FilterTopAndBottomFromRight") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterTopAndBottomFromRight);
03664                     if (fromString == L"FilterLeftAndRightFromTop") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterLeftAndRightFromTop);
03665                     if (fromString == L"FilterLeftAndRightFromBottom") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterLeftAndRightFromBottom);
03666                     if (fromString == L"FilterTopFromTopLeft") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterTopFromTopLeft);
03667                     if (fromString == L"FilterTopFromTopRight") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterTopFromTopRight);
03668                     if (fromString == L"FilterRightFromTopRight") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterRightFromTopRight);
03669                     if (fromString == L"FilterRightFromBottomRight") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterRightFromBottomRight);
03670                     if (fromString == L"FilterBottomFromBottomRight") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterBottomFromBottomRight);
03671                     if (fromString == L"FilterBottomFromBottomLeft") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterBottomFromBottomLeft);
03672                     if (fromString == L"FilterLeftFromBottomLeft") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterLeftFromBottomLeft);
03673                     if (fromString == L"FilterLeftFromTopLeft") return box_value(winrt::CornerRadiusToThicknessConverterKind::FilterLeftFromTopLeft);
03674                     throw winrt::hresult_invalid_argument();
03675                 });
03676
03677             return xamlType;
03678         }
03679     },
03680     {
03681         /* Arg1 TypeName */
03682         L"Microsoft.UI.Xaml.Controls.Primitives.IScrollController",
03683         /* Arg2 CreateXamlTypeCallback */
03684         []()
03685         {
03686             auto xamlType = winrt::make_self<XamlType>(
03687                 /* Arg 1 - TypeName */
03688                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.IScrollController",
03689                 /* Arg 2 - BaseTypeName */
03690                 (PCWSTR)L"",
03691                 /* Arg 3 - Activator func */
03692                 nullptr,
03693                 /* Arg 4 - Populate properties func */
03694                 nullptr
03695             );
03696
03697             return static_cast<winrt::IXamlType>(*xamlType);
03698         }
03699     },
03700     {
03701         /* Arg1 TypeName */
03702         L"Microsoft.UI.Xaml.Controls.Primitives.IScrollControllerPanningInfo",
03703         /* Arg2 CreateXamlTypeCallback */
03704         []()
03705         {
03706             auto xamlType = winrt::make_self<XamlType>(
03707                 /* Arg 1 - TypeName */
03708                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.IScrollControllerPanningInfo",
03709                 /* Arg 2 - BaseTypeName */
03710                 (PCWSTR)L"",
03711                 /* Arg 3 - Activator func */
03712                 nullptr,
03713                 /* Arg 4 - Populate properties func */
03714                 nullptr
03715             );
03716
03717             return static_cast<winrt::IXamlType>(*xamlType);
03718         }
03719     },
03720     {
03721         /* Arg1 TypeName */
03722         L"Microsoft.UI.Xaml.Controls.Primitives.InfoBarPanel",
03723         /* Arg2 CreateXamlTypeCallback */
03724         []()
03725         {
03726             auto xamlType = winrt::make_self<XamlType>(
03727                 /* Arg 1 - TypeName */
03728                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.InfoBarPanel",
03729                 /* Arg 2 - BaseTypeName */
03730                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Panel",
03731                 /* Arg 3 - Activator func */
03732                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IInfoBarPanelFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.InfoBarPanel"); },
03733                 /* Arg 4 - Populate properties func */
03734                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03735                 {
03736                     winrt::IInfoBarPanelStatics statics = GetFactory<winrt::IInfoBarPanelStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.InfoBarPanel");
03737                     {
03738                         xamlType.AddDPMember(L"HorizontalOrientationMargin", L"Microsoft.UI.Xaml.Thickness", statics.HorizontalOrientationMarginProperty(), false /* isContent */);
03739                         xamlType.AddDPMember(L"HorizontalOrientationPadding", L"Microsoft.UI.Xaml.Thickness", statics.HorizontalOrientationPaddingProperty(), false /* isContent */);
03740                         xamlType.AddDPMember(L"VerticalOrientationMargin", L"Microsoft.UI.Xaml.Thickness", statics.VerticalOrientationMarginProperty(), false /* isContent */);
03741                         xamlType.AddDPMember(L"VerticalOrientationPadding", L"Microsoft.UI.Xaml.Thickness", statics.VerticalOrientationPaddingProperty(), false /* isContent */);
03742                     }
03743
03744                 });
03745
03746             return static_cast<winrt::IXamlType>(*xamlType);
03747         }
03748     },
03749     {
03750         /* Arg1 TypeName */
03751         L"Microsoft.UI.Xaml.Controls.Primitives.MonochromaticOverlayPresenter",
03752         /* Arg2 CreateXamlTypeCallback */
03753         []()
03754         {
03755             auto xamlType = winrt::make_self<XamlType>(
03756                 /* Arg 1 - TypeName */
03757                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.MonochromaticOverlayPresenter",
03758                 /* Arg 2 - BaseTypeName */
03759                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Grid",
03760                 /* Arg 3 - Activator func */
03761                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IMonochromaticOverlayPresenterFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.MonochromaticOverlayPresenter"); },
03762                 /* Arg 4 - Populate properties func */
03763                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03764                 {
03765                     winrt::IMonochromaticOverlayPresenterStatics statics = GetFactory<winrt::IMonochromaticOverlayPresenterStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.MonochromaticOverlayPresenter");
03766                     {
03767                         xamlType.AddDPMember(L"ReplacementColor", L"Windows.UI.Color", statics.ReplacementColorProperty(), false /* isContent */);
03768                         xamlType.AddDPMember(L"SourceElement", L"Microsoft.UI.Xaml.UIElement", statics.SourceElementProperty(), false /* isContent */);
03769                     }
03770
03771                 });
03772
03773             return static_cast<winrt::IXamlType>(*xamlType);
03774         }
03775     },
03776     {
03777         /* Arg1 TypeName */
03778         L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenter",
03779         /* Arg2 CreateXamlTypeCallback */
03780         []()
03781         {
03782             auto xamlType = winrt::make_self<XamlType>(
03783                 /* Arg 1 - TypeName */
03784                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenter",
03785                 /* Arg 2 - BaseTypeName */
03786                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
03787                 /* Arg 3 - Activator func */
03788                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INavigationViewItemPresenterFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenter"); },
03789                 /* Arg 4 - Populate properties func */
03790                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03791                 {
03792                     winrt::INavigationViewItemPresenterStatics statics = GetFactory<winrt::INavigationViewItemPresenterStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenter");
03793                     {
03794                         xamlType.AddDPMember(L"Icon", L"Microsoft.UI.Xaml.Controls.IconElement", statics.IconProperty(), false /* isContent */);
03795                         xamlType.AddDPMember(L"TemplateSettings", L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenterTemplateSettings", statics.TemplateSettingsProperty(), false /* isContent */);
03796                     }
03797
03798                     winrt::INavigationViewItemPresenterStatics2 statics2 = GetFactory<winrt::INavigationViewItemPresenterStatics2>(L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenter");
03799                     {
03800                         xamlType.AddDPMember(L"InfoBadge", L"Microsoft.UI.Xaml.Controls.InfoBadge", statics2.InfoBadgeProperty(), false /* isContent */);
03801                     }
03802
03803                 });
03804
03805             return static_cast<winrt::IXamlType>(*xamlType);
03806         }
03807     },
03808     {
03809         /* Arg1 TypeName */
03810         L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenterTemplateSettings",
03811         /* Arg2 CreateXamlTypeCallback */
03812         []()
03813         {
03814             auto xamlType = winrt::make_self<XamlType>(
03815                 /* Arg 1 - TypeName */
03816                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenterTemplateSettings",
03817                 /* Arg 2 - BaseTypeName */
03818                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
03819                 /* Arg 3 - Activator func */
03820                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::INavigationViewItemPresenterTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenterTemplateSettings"); },
03821                 /* Arg 4 - Populate properties func */
03822                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03823                 {
03824                     winrt::INavigationViewItemPresenterTemplateSettingsStatics statics = GetFactory<winrt::INavigationViewItemPresenterTemplateSettingsStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.NavigationViewItemPresenterTemplateSettings");
03825                     {
03826                         xamlType.AddDPMember(L"IconWidth", L"Double", statics.IconWidthProperty(), false /* isContent */);
03827                         xamlType.AddDPMember(L"SmallerIconWidth", L"Double", statics.SmallerIconWidthProperty(), false /* isContent */);
03828                     }
03829
03830                 });
03831
03832             return static_cast<winrt::IXamlType>(*xamlType);
03833         }
03834     },
03835     {
03836         /* Arg1 TypeName */
03837         L"Microsoft.UI.Xaml.Controls.Primitives.SnapPointBase",
03838         /* Arg2 CreateXamlTypeCallback */
03839         []()
03840         {
03841             auto xamlType = winrt::make_self<XamlType>(
03842                 /* Arg 1 - TypeName */
03843                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.SnapPointBase",
03844                 /* Arg 2 - BaseTypeName */
03845                 (PCWSTR)L"Object",
03846                 /* Arg 3 - Activator func */
03847                 nullptr,
03848                 /* Arg 4 - Populate properties func */
03849                 nullptr
03850             );
03851
03852             return static_cast<winrt::IXamlType>(*xamlType);
03853         }
03854     },
03855     {
03856         /* Arg1 TypeName */
03857         L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointBase",
03858         /* Arg2 CreateXamlTypeCallback */
03859         []()
03860         {
03861             auto xamlType = winrt::make_self<XamlType>(
03862                 /* Arg 1 - TypeName */
03863                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointBase",
03864                 /* Arg 2 - BaseTypeName */
03865                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.SnapPointBase",
03866                 /* Arg 3 - Activator func */
03867                 nullptr,
03868                 /* Arg 4 - Populate properties func */
03869                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03870                 {
03871                     xamlType.AddMember(
03872                         L"Alignment", /* propertyName */
03873                         L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointsAlignment", /* propertyType */
03874                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ScrollSnapPointBase>().Alignment()); },
03875                         nullptr, /* setter */
03876                         false, /* isContent */
03877                         false, /* isDependencyProperty */
03878                         false /* isAttachable */);
03879                 });
03880
03881             return static_cast<winrt::IXamlType>(*xamlType);
03882         }
03883     },
03884     {
03885         /* Arg1 TypeName */
03886         L"Microsoft.UI.Xaml.Controls.Primitives.RepeatedScrollSnapPoint",
03887         /* Arg2 CreateXamlTypeCallback */
03888         []()
03889         {
03890             auto xamlType = winrt::make_self<XamlType>(
03891                 /* Arg 1 - TypeName */
03892                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.RepeatedScrollSnapPoint",
03893                 /* Arg 2 - BaseTypeName */
03894                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointBase",
03895                 /* Arg 3 - Activator func */
03896                 nullptr,
03897                 /* Arg 4 - Populate properties func */
03898                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03899                 {
03900                     xamlType.AddMember(
03901                         L"End", /* propertyName */
03902                         L"Double", /* propertyType */
03903                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::RepeatedScrollSnapPoint>().End()); },
03904                         nullptr, /* setter */
03905                         false, /* isContent */
03906                         false, /* isDependencyProperty */
03907                         false /* isAttachable */);
03908                     xamlType.AddMember(
03909                         L"Interval", /* propertyName */
03910                         L"Double", /* propertyType */
03911                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::RepeatedScrollSnapPoint>().Interval()); },
03912                         nullptr, /* setter */
03913                         false, /* isContent */
03914                         false, /* isDependencyProperty */
03915                         false /* isAttachable */);
03916                     xamlType.AddMember(
03917                         L"Offset", /* propertyName */
03918                         L"Double", /* propertyType */
03919                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::RepeatedScrollSnapPoint>().Offset()); },
03920                         nullptr, /* setter */
03921                         false, /* isContent */
03922                         false, /* isDependencyProperty */
03923                         false /* isAttachable */);
03924                     xamlType.AddMember(
03925                         L"Start", /* propertyName */
03926                         L"Double", /* propertyType */
03927                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::RepeatedScrollSnapPoint>().Start()); },
03928                         nullptr, /* setter */
03929                         false, /* isContent */
03930                         false, /* isDependencyProperty */
03931                         false /* isAttachable */);
03932                 });
03933
03934             return static_cast<winrt::IXamlType>(*xamlType);
03935         }
03936     },
03937     {
03938         /* Arg1 TypeName */
03939         L"Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPointBase",
03940         /* Arg2 CreateXamlTypeCallback */
03941         []()
03942         {
03943             auto xamlType = winrt::make_self<XamlType>(
03944                 /* Arg 1 - TypeName */
03945                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPointBase",
03946                 /* Arg 2 - BaseTypeName */
03947                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.SnapPointBase",
03948                 /* Arg 3 - Activator func */
03949                 nullptr,
03950                 /* Arg 4 - Populate properties func */
03951                 nullptr
03952             );
03953
03954             return static_cast<winrt::IXamlType>(*xamlType);
03955         }
03956     },
03957     {
03958         /* Arg1 TypeName */
03959         L"Microsoft.UI.Xaml.Controls.Primitives.RepeatedZoomSnapPoint",
03960         /* Arg2 CreateXamlTypeCallback */
03961         []()
03962         {
03963             auto xamlType = winrt::make_self<XamlType>(
03964                 /* Arg 1 - TypeName */
03965                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.RepeatedZoomSnapPoint",
03966                 /* Arg 2 - BaseTypeName */
03967                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPointBase",
03968                 /* Arg 3 - Activator func */
03969                 nullptr,
03970                 /* Arg 4 - Populate properties func */
03971                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
03972                 {
03973                     xamlType.AddMember(
03974                         L"End", /* propertyName */
03975                         L"Double", /* propertyType */
03976                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::RepeatedZoomSnapPoint>().End()); },
03977                         nullptr, /* setter */
03978                         false, /* isContent */
03979                         false, /* isDependencyProperty */
03980                         false /* isAttachable */);
03981                     xamlType.AddMember(
03982                         L"Interval", /* propertyName */
03983                         L"Double", /* propertyType */
03984                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::RepeatedZoomSnapPoint>().Interval()); },
03985                         nullptr, /* setter */
03986                         false, /* isContent */
03987                         false, /* isDependencyProperty */
03988                         false /* isAttachable */);
03989                     xamlType.AddMember(
03990                         L"Offset", /* propertyName */
03991                         L"Double", /* propertyType */
03992                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::RepeatedZoomSnapPoint>().Offset()); },
03993                         nullptr, /* setter */
03994                         false, /* isContent */
03995                         false, /* isDependencyProperty */
03996                         false /* isAttachable */);
03997                     xamlType.AddMember(
03998                         L"Start", /* propertyName */
03999                         L"Double", /* propertyType */
04000                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::RepeatedZoomSnapPoint>().Start()); },
04001                         nullptr, /* setter */
04002                         false, /* isContent */
04003                         false, /* isDependencyProperty */
04004                         false /* isAttachable */);
04005                 });
04006
04007             return static_cast<winrt::IXamlType>(*xamlType);
04008         }
04009     },
04010     {
04011         /* Arg1 TypeName */
04012         L"Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter",
04013         /* Arg2 CreateXamlTypeCallback */
04014         []()
04015         {
04016             auto xamlType = winrt::make_self<XamlType>(
04017                 /* Arg 1 - TypeName */
04018                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter",
04019                 /* Arg 2 - BaseTypeName */
04020                 (PCWSTR)L"Microsoft.UI.Xaml.FrameworkElement",
04021                 /* Arg 3 - Activator func */
04022                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IScrollPresenterFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter"); },
04023                 /* Arg 4 - Populate properties func */
04024                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04025                 {
04026                     winrt::IScrollPresenterStatics statics = GetFactory<winrt::IScrollPresenterStatics>(L"Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter");
04027                     {
04028                         xamlType.AddDPMember(L"Background", L"Microsoft.UI.Xaml.Media.Brush", statics.BackgroundProperty(), false /* isContent */);
04029                         xamlType.AddDPMember(L"ComputedHorizontalScrollMode", L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode", statics.ComputedHorizontalScrollModeProperty(), false /* isContent */);
04030                         xamlType.AddDPMember(L"ComputedVerticalScrollMode", L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode", statics.ComputedVerticalScrollModeProperty(), false /* isContent */);
04031                         xamlType.AddDPMember(L"ContentOrientation", L"Microsoft.UI.Xaml.Controls.ScrollingContentOrientation", statics.ContentOrientationProperty(), false /* isContent */);
04032                         xamlType.AddDPMember(L"Content", L"Microsoft.UI.Xaml.UIElement", statics.ContentProperty(), true /* isContent */);
04033                         xamlType.AddDPMember(L"HorizontalAnchorRatio", L"Double", statics.HorizontalAnchorRatioProperty(), false /* isContent */);
04034                         xamlType.AddDPMember(L"HorizontalScrollChainMode", L"Microsoft.UI.Xaml.Controls.ScrollingChainMode", statics.HorizontalScrollChainModeProperty(), false /* isContent */);
04035                         xamlType.AddDPMember(L"HorizontalScrollMode", L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode", statics.HorizontalScrollModeProperty(), false /* isContent */);
04036                         xamlType.AddDPMember(L"HorizontalScrollRailMode", L"Microsoft.UI.Xaml.Controls.ScrollingRailMode", statics.HorizontalScrollRailModeProperty(), false /* isContent */);
04037                         xamlType.AddDPMember(L"IgnoredInputKinds", L"Microsoft.UI.Xaml.Controls.ScrollingInputKinds", statics.IgnoredInputKindsProperty(), false /* isContent */);
04038                         xamlType.AddDPMember(L"MaxZoomFactor", L"Double", statics.MaxZoomFactorProperty(), false /* isContent */);
04039                         xamlType.AddDPMember(L"MinZoomFactor", L"Double", statics.MinZoomFactorProperty(), false /* isContent */);
04040                         xamlType.AddDPMember(L"VerticalAnchorRatio", L"Double", statics.VerticalAnchorRatioProperty(), false /* isContent */);
04041                         xamlType.AddDPMember(L"VerticalScrollChainMode", L"Microsoft.UI.Xaml.Controls.ScrollingChainMode", statics.VerticalScrollChainModeProperty(), false /* isContent */);
04042                         xamlType.AddDPMember(L"VerticalScrollMode", L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode", statics.VerticalScrollModeProperty(), false /* isContent */);
04043                         xamlType.AddDPMember(L"VerticalScrollRailMode", L"Microsoft.UI.Xaml.Controls.ScrollingRailMode", statics.VerticalScrollRailModeProperty(), false /* isContent */);
04044                         xamlType.AddDPMember(L"ZoomChainMode", L"Microsoft.UI.Xaml.Controls.ScrollingChainMode", statics.ZoomChainModeProperty(), false /* isContent */);
04045                         xamlType.AddDPMember(L"ZoomMode", L"Microsoft.UI.Xaml.Controls.ScrollingZoomMode", statics.ZoomModeProperty(), false /* isContent */);
04046                     }
04047
04048                     xamlType.AddMember(
04049                         L"CurrentAnchor", /* propertyName */
04050                         L"Microsoft.UI.Xaml.UIElement", /* propertyType */
04051                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollPresenter>().CurrentAnchor(); },
04052                         nullptr, /* setter */
04053                         false, /* isContent */
04054                         false, /* isDependencyProperty */
04055                         false /* isAttachable */);
04056                     xamlType.AddMember(
04057                         L"HorizontalScrollController", /* propertyName */
04058                         L"Microsoft.UI.Xaml.Controls.Primitives.IScrollController", /* propertyType */
04059                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollPresenter>().HorizontalScrollController(); },
04060                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ScrollPresenter>().HorizontalScrollController(value.as<winrt::Microsoft::UI::Xaml::Controls::Primitives::IScrollController>()); },
04061                         false, /* isContent */
04062                         false, /* isDependencyProperty */
04063                         false /* isAttachable */);
04064                     xamlType.AddMember(
04065                         L"VerticalScrollController", /* propertyName */
04066                         L"Microsoft.UI.Xaml.Controls.Primitives.IScrollController", /* propertyType */
04067                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollPresenter>().VerticalScrollController(); },
04068                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ScrollPresenter>().VerticalScrollController(value.as<winrt::Microsoft::UI::Xaml::Controls::Primitives::IScrollController>()); },
04069                         false, /* isContent */
04070                         false, /* isDependencyProperty */
04071                         false /* isAttachable */);
04072                     xamlType.AddMember(
04073                         L"ExpressionAnimationSources", /* propertyName */
04074                         L"Microsoft.UI.Composition.CompositionPropertySet", /* propertyType */
04075                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollPresenter>().ExpressionAnimationSources(); },
04076                         nullptr, /* setter */
04077                         false, /* isContent */
04078                         false, /* isDependencyProperty */
04079                         false /* isAttachable */);
04080                     xamlType.AddMember(
04081                         L"ExtentHeight", /* propertyName */
04082                         L"Double", /* propertyType */
04083                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().ExtentHeight()); },
04084                         nullptr, /* setter */
04085                         false, /* isContent */
04086                         false, /* isDependencyProperty */
04087                         false /* isAttachable */);
04088                     xamlType.AddMember(
04089                         L"ExtentWidth", /* propertyName */
04090                         L"Double", /* propertyType */
04091                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().ExtentWidth()); },
04092                         nullptr, /* setter */
04093                         false, /* isContent */
04094                         false, /* isDependencyProperty */
04095                         false /* isAttachable */);
04096                     xamlType.AddMember(
04097                         L"HorizontalOffset", /* propertyName */
04098                         L"Double", /* propertyType */
04099                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().HorizontalOffset()); },
04100                         nullptr, /* setter */
04101                         false, /* isContent */
04102                         false, /* isDependencyProperty */
04103                         false /* isAttachable */);
04104                     xamlType.AddMember(
04105                         L"HorizontalSnapPoints", /* propertyName */
04106                         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointBase>", /* propertyType */
04107                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollPresenter>().HorizontalSnapPoints(); },
04108                         nullptr, /* setter */
04109                         false, /* isContent */
04110                         false, /* isDependencyProperty */
04111                         false /* isAttachable */);
04112                     xamlType.AddMember(
04113                         L"ScrollableHeight", /* propertyName */
04114                         L"Double", /* propertyType */
04115                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().ScrollableHeight()); },
04116                         nullptr, /* setter */
04117                         false, /* isContent */
04118                         false, /* isDependencyProperty */
04119                         false /* isAttachable */);
04120                     xamlType.AddMember(
04121                         L"ScrollableWidth", /* propertyName */
04122                         L"Double", /* propertyType */
04123                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().ScrollableWidth()); },
04124                         nullptr, /* setter */
04125                         false, /* isContent */
04126                         false, /* isDependencyProperty */
04127                         false /* isAttachable */);
04128                     xamlType.AddMember(
04129                         L"State", /* propertyName */
04130                         L"Microsoft.UI.Xaml.Controls.ScrollingInteractionState", /* propertyType */
04131                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ScrollPresenter>().State()); },
04132                         nullptr, /* setter */
04133                         false, /* isContent */
04134                         false, /* isDependencyProperty */
04135                         false /* isAttachable */);
04136                     xamlType.AddMember(
04137                         L"VerticalOffset", /* propertyName */
04138                         L"Double", /* propertyType */
04139                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().VerticalOffset()); },
04140                         nullptr, /* setter */
04141                         false, /* isContent */
04142                         false, /* isDependencyProperty */
04143                         false /* isAttachable */);
04144                     xamlType.AddMember(
04145                         L"VerticalSnapPoints", /* propertyName */
04146                         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointBase>", /* propertyType */
04147                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollPresenter>().VerticalSnapPoints(); },
04148                         nullptr, /* setter */
04149                         false, /* isContent */
04150                         false, /* isDependencyProperty */
04151                         false /* isAttachable */);
04152                     xamlType.AddMember(
04153                         L"ViewportHeight", /* propertyName */
04154                         L"Double", /* propertyType */
04155                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().ViewportHeight()); },
04156                         nullptr, /* setter */
04157                         false, /* isContent */
04158                         false, /* isDependencyProperty */
04159                         false /* isAttachable */);
04160                     xamlType.AddMember(
04161                         L"ViewportWidth", /* propertyName */
04162                         L"Double", /* propertyType */
04163                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().ViewportWidth()); },
04164                         nullptr, /* setter */
04165                         false, /* isContent */
04166                         false, /* isDependencyProperty */
04167                         false /* isAttachable */);
04168                     xamlType.AddMember(
04169                         L"ZoomFactor", /* propertyName */
04170                         L"Single", /* propertyType */
04171                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollPresenter>().ZoomFactor()); },
04172                         nullptr, /* setter */
04173                         false, /* isContent */
04174                         false, /* isDependencyProperty */
04175                         false /* isAttachable */);
04176                     xamlType.AddMember(
04177                         L"ZoomSnapPoints", /* propertyName */
04178                         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPointBase>", /* propertyType */
04179                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollPresenter>().ZoomSnapPoints(); },
04180                         nullptr, /* setter */
04181                         false, /* isContent */
04182                         false, /* isDependencyProperty */
04183                         false /* isAttachable */);
04184                 });
04185
04186             return static_cast<winrt::IXamlType>(*xamlType);
04187         }
04188     },
04189     {
04190         /* Arg1 TypeName */
04191         L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPoint",
04192         /* Arg2 CreateXamlTypeCallback */
04193         []()
04194         {
04195             auto xamlType = winrt::make_self<XamlType>(
04196                 /* Arg 1 - TypeName */
04197                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPoint",
04198                 /* Arg 2 - BaseTypeName */
04199                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointBase",
04200                 /* Arg 3 - Activator func */
04201                 nullptr,
04202                 /* Arg 4 - Populate properties func */
04203                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04204                 {
04205                     xamlType.AddMember(
04206                         L"Value", /* propertyName */
04207                         L"Double", /* propertyType */
04208                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollSnapPoint>().Value()); },
04209                         nullptr, /* setter */
04210                         false, /* isContent */
04211                         false, /* isDependencyProperty */
04212                         false /* isAttachable */);
04213                 });
04214
04215             return static_cast<winrt::IXamlType>(*xamlType);
04216         }
04217     },
04218     {
04219         /* Arg1 TypeName */
04220         L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointsAlignment",
04221         /* Arg2 CreateXamlTypeCallback */
04222         []()
04223         {
04224             auto xamlType = winrt::make<EnumXamlType>(
04225                 /* Arg 1 - TypeName */
04226                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointsAlignment",
04227                 /* Arg 2 - CreateFromString func */
04228                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
04229                 {
04230                     if (fromString == L"Near") return box_value(winrt::ScrollSnapPointsAlignment::Near);
04231                     if (fromString == L"Center") return box_value(winrt::ScrollSnapPointsAlignment::Center);
04232                     if (fromString == L"Far") return box_value(winrt::ScrollSnapPointsAlignment::Far);
04233                     throw winrt::hresult_invalid_argument();
04234                 });
04235
04236             return xamlType;
04237         }
04238     },
04239     {
04240         /* Arg1 TypeName */
04241         L"Microsoft.UI.Xaml.Controls.Primitives.TabViewListView",
04242         /* Arg2 CreateXamlTypeCallback */
04243         []()
04244         {
04245             auto xamlType = winrt::make_self<XamlType>(
04246                 /* Arg 1 - TypeName */
04247                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.TabViewListView",
04248                 /* Arg 2 - BaseTypeName */
04249                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ListView",
04250                 /* Arg 3 - Activator func */
04251                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITabViewListViewFactory>(L"Microsoft.UI.Xaml.Controls.Primitives.TabViewListView"); },
04252                 /* Arg 4 - Populate properties func */
04253                 nullptr
04254             );
04255
04256             return static_cast<winrt::IXamlType>(*xamlType);
04257         }
04258     },
04259     {
04260         /* Arg1 TypeName */
04261         L"Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPoint",
04262         /* Arg2 CreateXamlTypeCallback */
04263         []()
04264         {
04265             auto xamlType = winrt::make_self<XamlType>(
04266                 /* Arg 1 - TypeName */
04267                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPoint",
04268                 /* Arg 2 - BaseTypeName */
04269                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPointBase",
04270                 /* Arg 3 - Activator func */
04271                 nullptr,
04272                 /* Arg 4 - Populate properties func */
04273                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04274                 {
04275                     xamlType.AddMember(
04276                         L"Value", /* propertyName */
04277                         L"Double", /* propertyType */
04278                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ZoomSnapPoint>().Value()); },
04279                         nullptr, /* setter */
04280                         false, /* isContent */
04281                         false, /* isDependencyProperty */
04282                         false /* isAttachable */);
04283                 });
04284
04285             return static_cast<winrt::IXamlType>(*xamlType);
04286         }
04287     },
04288     {
04289         /* Arg1 TypeName */
04290         L"Microsoft.UI.Xaml.Controls.ProgressBar",
04291         /* Arg2 CreateXamlTypeCallback */
04292         []()
04293         {
04294             auto xamlType = winrt::make_self<XamlType>(
04295                 /* Arg 1 - TypeName */
04296                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ProgressBar",
04297                 /* Arg 2 - BaseTypeName */
04298                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.RangeBase",
04299                 /* Arg 3 - Activator func */
04300                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IProgressBarFactory>(L"Microsoft.UI.Xaml.Controls.ProgressBar"); },
04301                 /* Arg 4 - Populate properties func */
04302                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04303                 {
04304                     winrt::IProgressBarStatics statics = GetFactory<winrt::IProgressBarStatics>(L"Microsoft.UI.Xaml.Controls.ProgressBar");
04305                     {
04306                         xamlType.AddDPMember(L"IsIndeterminate", L"Boolean", statics.IsIndeterminateProperty(), false /* isContent */);
04307                         xamlType.AddDPMember(L"ShowError", L"Boolean", statics.ShowErrorProperty(), false /* isContent */);
04308                         xamlType.AddDPMember(L"ShowPaused", L"Boolean", statics.ShowPausedProperty(), false /* isContent */);
04309                     }
04310
04311                     xamlType.AddMember(
04312                         L"TemplateSettings", /* propertyName */
04313                         L"Microsoft.UI.Xaml.Controls.ProgressBarTemplateSettings", /* propertyType */
04314                         [](winrt::IInspectable instance) { return instance.as<winrt::ProgressBar>().TemplateSettings(); },
04315                         nullptr, /* setter */
04316                         false, /* isContent */
04317                         false, /* isDependencyProperty */
04318                         false /* isAttachable */);
04319                 });
04320
04321             return static_cast<winrt::IXamlType>(*xamlType);
04322         }
04323     },
04324     {
04325         /* Arg1 TypeName */
04326         L"Microsoft.UI.Xaml.Controls.ProgressBarTemplateSettings",
04327         /* Arg2 CreateXamlTypeCallback */
04328         []()
04329         {
04330             auto xamlType = winrt::make_self<XamlType>(
04331                 /* Arg 1 - TypeName */
04332                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ProgressBarTemplateSettings",
04333                 /* Arg 2 - BaseTypeName */
04334                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
04335                 /* Arg 3 - Activator func */
04336                 nullptr,
04337                 /* Arg 4 - Populate properties func */
04338                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04339                 {
04340                     xamlType.AddMember(
04341                         L"ClipRect", /* propertyName */
04342                         L"Microsoft.UI.Xaml.Media.RectangleGeometry", /* propertyType */
04343                         [](winrt::IInspectable instance) { return instance.as<winrt::ProgressBarTemplateSettings>().ClipRect(); },
04344                         nullptr, /* setter */
04345                         false, /* isContent */
04346                         false, /* isDependencyProperty */
04347                         false /* isAttachable */);
04348                     xamlType.AddMember(
04349                         L"Container2AnimationEndPosition", /* propertyName */
04350                         L"Double", /* propertyType */
04351                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().Container2AnimationEndPosition()); },
04352                         nullptr, /* setter */
04353                         false, /* isContent */
04354                         false, /* isDependencyProperty */
04355                         false /* isAttachable */);
04356                     xamlType.AddMember(
04357                         L"Container2AnimationStartPosition", /* propertyName */
04358                         L"Double", /* propertyType */
04359                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().Container2AnimationStartPosition()); },
04360                         nullptr, /* setter */
04361                         false, /* isContent */
04362                         false, /* isDependencyProperty */
04363                         false /* isAttachable */);
04364                     xamlType.AddMember(
04365                         L"ContainerAnimationEndPosition", /* propertyName */
04366                         L"Double", /* propertyType */
04367                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().ContainerAnimationEndPosition()); },
04368                         nullptr, /* setter */
04369                         false, /* isContent */
04370                         false, /* isDependencyProperty */
04371                         false /* isAttachable */);
04372                     xamlType.AddMember(
04373                         L"ContainerAnimationMidPosition", /* propertyName */
04374                         L"Double", /* propertyType */
04375                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().ContainerAnimationMidPosition()); },
04376                         nullptr, /* setter */
04377                         false, /* isContent */
04378                         false, /* isDependencyProperty */
04379                         false /* isAttachable */);
04380                     xamlType.AddMember(
04381                         L"ContainerAnimationStartPosition", /* propertyName */
04382                         L"Double", /* propertyType */
04383                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().ContainerAnimationStartPosition()); },
04384                         nullptr, /* setter */
04385                         false, /* isContent */
04386                         false, /* isDependencyProperty */
04387                         false /* isAttachable */);
04388                     xamlType.AddMember(
04389                         L"EllipseAnimationEndPosition", /* propertyName */
04390                         L"Double", /* propertyType */
04391                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().EllipseAnimationEndPosition()); },
04392                         nullptr, /* setter */
04393                         false, /* isContent */
04394                         false, /* isDependencyProperty */
04395                         false /* isAttachable */);
04396                     xamlType.AddMember(
04397                         L"EllipseAnimationWellPosition", /* propertyName */
04398                         L"Double", /* propertyType */
04399                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().EllipseAnimationWellPosition()); },
04400                         nullptr, /* setter */
04401                         false, /* isContent */
04402                         false, /* isDependencyProperty */
04403                         false /* isAttachable */);
04404                     xamlType.AddMember(
04405                         L"EllipseDiameter", /* propertyName */
04406                         L"Double", /* propertyType */
04407                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().EllipseDiameter()); },
04408                         nullptr, /* setter */
04409                         false, /* isContent */
04410                         false, /* isDependencyProperty */
04411                         false /* isAttachable */);
04412                     xamlType.AddMember(
04413                         L"EllipseOffset", /* propertyName */
04414                         L"Double", /* propertyType */
04415                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().EllipseOffset()); },
04416                         nullptr, /* setter */
04417                         false, /* isContent */
04418                         false, /* isDependencyProperty */
04419                         false /* isAttachable */);
04420                     xamlType.AddMember(
04421                         L"IndicatorLengthDelta", /* propertyName */
04422                         L"Double", /* propertyType */
04423                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressBarTemplateSettings>().IndicatorLengthDelta()); },
04424                         nullptr, /* setter */
04425                         false, /* isContent */
04426                         false, /* isDependencyProperty */
04427                         false /* isAttachable */);
04428                 });
04429
04430             return static_cast<winrt::IXamlType>(*xamlType);
04431         }
04432     },
04433     {
04434         /* Arg1 TypeName */
04435         L"Microsoft.UI.Xaml.Controls.ProgressRing",
04436         /* Arg2 CreateXamlTypeCallback */
04437         []()
04438         {
04439             auto xamlType = winrt::make_self<XamlType>(
04440                 /* Arg 1 - TypeName */
04441                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ProgressRing",
04442                 /* Arg 2 - BaseTypeName */
04443                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
04444                 /* Arg 3 - Activator func */
04445                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IProgressRingFactory>(L"Microsoft.UI.Xaml.Controls.ProgressRing"); },
04446                 /* Arg 4 - Populate properties func */
04447                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04448                 {
04449                     winrt::IProgressRingStatics statics = GetFactory<winrt::IProgressRingStatics>(L"Microsoft.UI.Xaml.Controls.ProgressRing");
04450                     {
04451                         xamlType.AddDPMember(L"IsActive", L"Boolean", statics.IsActiveProperty(), false /* isContent */);
04452                         xamlType.AddDPMember(L"IsIndeterminate", L"Boolean", statics.IsIndeterminateProperty(), false /* isContent */);
04453                         xamlType.AddDPMember(L"Maximum", L"Double", statics.MaximumProperty(), false /* isContent */);
04454                         xamlType.AddDPMember(L"Minimum", L"Double", statics.MinimumProperty(), false /* isContent */);
04455                         xamlType.AddDPMember(L"Value", L"Double", statics.ValueProperty(), false /* isContent */);
04456                     }
04457
04458                     winrt::IProgressRingStatics2 statics2 = GetFactory<winrt::IProgressRingStatics2>(L"Microsoft.UI.Xaml.Controls.ProgressRing");
04459                     {
04460                         xamlType.AddDPMember(L"DeterminateSource", L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource", statics2.DeterminateSourceProperty(), false /* isContent */);
04461                         xamlType.AddDPMember(L"IndeterminateSource", L"Microsoft.UI.Xaml.Controls.IAnimatedVisualSource", statics2.IndeterminateSourceProperty(), false /* isContent */);
04462                     }
04463
04464                     xamlType.AddMember(
04465                         L"TemplateSettings", /* propertyName */
04466                         L"Microsoft.UI.Xaml.Controls.ProgressRingTemplateSettings", /* propertyType */
04467                         [](winrt::IInspectable instance) { return instance.as<winrt::ProgressRing>().TemplateSettings(); },
04468                         nullptr, /* setter */
04469                         false, /* isContent */
04470                         false, /* isDependencyProperty */
04471                         false /* isAttachable */);
04472                 });
04473
04474             return static_cast<winrt::IXamlType>(*xamlType);
04475         }
04476     },
04477     {
04478         /* Arg1 TypeName */
04479         L"Microsoft.UI.Xaml.Controls.ProgressRingTemplateSettings",
04480         /* Arg2 CreateXamlTypeCallback */
04481         []()
04482         {
04483             auto xamlType = winrt::make_self<XamlType>(
04484                 /* Arg 1 - TypeName */
04485                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ProgressRingTemplateSettings",
04486                 /* Arg 2 - BaseTypeName */
04487                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
04488                 /* Arg 3 - Activator func */
04489                 nullptr,
04490                 /* Arg 4 - Populate properties func */
04491                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04492                 {
04493                     xamlType.AddMember(
04494                         L"EllipseDiameter", /* propertyName */
04495                         L"Double", /* propertyType */
04496                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressRingTemplateSettings>().EllipseDiameter()); },
04497                         nullptr, /* setter */
04498                         false, /* isContent */
04499                         false, /* isDependencyProperty */
04500                         false /* isAttachable */);
04501                     xamlType.AddMember(
04502                         L"EllipseOffset", /* propertyName */
04503                         L"Microsoft.UI.Xaml.Thickness", /* propertyType */
04504                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressRingTemplateSettings>().EllipseOffset()); },
04505                         nullptr, /* setter */
04506                         false, /* isContent */
04507                         false, /* isDependencyProperty */
04508                         false /* isAttachable */);
04509                     xamlType.AddMember(
04510                         L"MaxSideLength", /* propertyName */
04511                         L"Double", /* propertyType */
04512                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ProgressRingTemplateSettings>().MaxSideLength()); },
04513                         nullptr, /* setter */
04514                         false, /* isContent */
04515                         false, /* isDependencyProperty */
04516                         false /* isAttachable */);
04517                 });
04518
04519             return static_cast<winrt::IXamlType>(*xamlType);
04520         }
04521     },
04522     {
04523         /* Arg1 TypeName */
04524         L"Microsoft.UI.Xaml.Controls.RadioButtons",
04525         /* Arg2 CreateXamlTypeCallback */
04526         []()
04527         {
04528             auto xamlType = winrt::make_self<XamlType>(
04529                 /* Arg 1 - TypeName */
04530                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RadioButtons",
04531                 /* Arg 2 - BaseTypeName */
04532                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
04533                 /* Arg 3 - Activator func */
04534                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRadioButtonsFactory>(L"Microsoft.UI.Xaml.Controls.RadioButtons"); },
04535                 /* Arg 4 - Populate properties func */
04536                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04537                 {
04538                     winrt::IRadioButtonsStatics statics = GetFactory<winrt::IRadioButtonsStatics>(L"Microsoft.UI.Xaml.Controls.RadioButtons");
04539                     {
04540                         xamlType.AddDPMember(L"Header", L"Object", statics.HeaderProperty(), false /* isContent */);
04541                         xamlType.AddDPMember(L"HeaderTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.HeaderTemplateProperty(), false /* isContent */);
04542                         xamlType.AddDPMember(L"ItemTemplate", L"Object", statics.ItemTemplateProperty(), false /* isContent */);
04543                         xamlType.AddDPMember(L"Items", L"Windows.Foundation.Collections.IVector`1<Object>", statics.ItemsProperty(), true /* isContent */);
04544                         xamlType.AddDPMember(L"ItemsSource", L"Object", statics.ItemsSourceProperty(), false /* isContent */);
04545                         xamlType.AddDPMember(L"MaxColumns", L"Int32", statics.MaxColumnsProperty(), false /* isContent */);
04546                         xamlType.AddDPMember(L"SelectedIndex", L"Int32", statics.SelectedIndexProperty(), false /* isContent */);
04547                         xamlType.AddDPMember(L"SelectedItem", L"Object", statics.SelectedItemProperty(), false /* isContent */);
04548                     }
04549
04550                 });
04551
04552             return static_cast<winrt::IXamlType>(*xamlType);
04553         }
04554     },
04555     {
04556         /* Arg1 TypeName */
04557         L"Microsoft.UI.Xaml.Controls.RadioMenuFlyoutItem",
04558         /* Arg2 CreateXamlTypeCallback */
04559         []()
04560         {
04561             auto xamlType = winrt::make_self<XamlType>(
04562                 /* Arg 1 - TypeName */
04563                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RadioMenuFlyoutItem",
04564                 /* Arg 2 - BaseTypeName */
04565                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.MenuFlyoutItem",
04566                 /* Arg 3 - Activator func */
04567                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRadioMenuFlyoutItemFactory>(L"Microsoft.UI.Xaml.Controls.RadioMenuFlyoutItem"); },
04568                 /* Arg 4 - Populate properties func */
04569                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04570                 {
04571                     winrt::IRadioMenuFlyoutItemStatics statics = GetFactory<winrt::IRadioMenuFlyoutItemStatics>(L"Microsoft.UI.Xaml.Controls.RadioMenuFlyoutItem");
04572                     {
04573                         xamlType.AddDPMember(L"GroupName", L"String", statics.GroupNameProperty(), false /* isContent */);
04574                         xamlType.AddDPMember(L"IsChecked", L"Boolean", statics.IsCheckedProperty(), false /* isContent */);
04575                     }
04576
04577                     winrt::IRadioMenuFlyoutItemStatics2 statics2 = GetFactory<winrt::IRadioMenuFlyoutItemStatics2>(L"Microsoft.UI.Xaml.Controls.RadioMenuFlyoutItem");
04578                     {
04579                         xamlType.AddDPMember(L"AreCheckStatesEnabled", L"Boolean", statics2.AreCheckStatesEnabledProperty(), false /* isContent */);
04580                     }
04581
04582                 });
04583
04584             return static_cast<winrt::IXamlType>(*xamlType);
04585         }
04586     },
04587     {
04588         /* Arg1 TypeName */
04589         L"Microsoft.UI.Xaml.Controls.RatingControl",
04590         /* Arg2 CreateXamlTypeCallback */
04591         []()
04592         {
04593             auto xamlType = winrt::make_self<XamlType>(
04594                 /* Arg 1 - TypeName */
04595                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RatingControl",
04596                 /* Arg 2 - BaseTypeName */
04597                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
04598                 /* Arg 3 - Activator func */
04599                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRatingControlFactory>(L"Microsoft.UI.Xaml.Controls.RatingControl"); },
04600                 /* Arg 4 - Populate properties func */
04601                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04602                 {
04603                     winrt::IRatingControlStatics statics = GetFactory<winrt::IRatingControlStatics>(L"Microsoft.UI.Xaml.Controls.RatingControl");
04604                     {
04605                         xamlType.AddDPMember(L"Caption", L"String", statics.CaptionProperty(), false /* isContent */);
04606                         xamlType.AddDPMember(L"InitialSetValue", L"Int32", statics.InitialSetValueProperty(), false /* isContent */);
04607                         xamlType.AddDPMember(L"IsClearEnabled", L"Boolean", statics.IsClearEnabledProperty(), false /* isContent */);
04608                         xamlType.AddDPMember(L"IsReadOnly", L"Boolean", statics.IsReadOnlyProperty(), false /* isContent */);
04609                         xamlType.AddDPMember(L"ItemInfo", L"Microsoft.UI.Xaml.Controls.RatingItemInfo", statics.ItemInfoProperty(), false /* isContent */);
04610                         xamlType.AddDPMember(L"MaxRating", L"Int32", statics.MaxRatingProperty(), false /* isContent */);
04611                         xamlType.AddDPMember(L"PlaceholderValue", L"Double", statics.PlaceholderValueProperty(), false /* isContent */);
04612                         xamlType.AddDPMember(L"Value", L"Double", statics.ValueProperty(), false /* isContent */);
04613                     }
04614
04615                 });
04616
04617             return static_cast<winrt::IXamlType>(*xamlType);
04618         }
04619     },
04620     {
04621         /* Arg1 TypeName */
04622         L"Microsoft.UI.Xaml.Controls.RatingItemInfo",
04623         /* Arg2 CreateXamlTypeCallback */
04624         []()
04625         {
04626             auto xamlType = winrt::make_self<XamlType>(
04627                 /* Arg 1 - TypeName */
04628                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RatingItemInfo",
04629                 /* Arg 2 - BaseTypeName */
04630                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
04631                 /* Arg 3 - Activator func */
04632                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRatingItemInfoFactory>(L"Microsoft.UI.Xaml.Controls.RatingItemInfo"); },
04633                 /* Arg 4 - Populate properties func */
04634                 nullptr
04635             );
04636
04637             return static_cast<winrt::IXamlType>(*xamlType);
04638         }
04639     },
04640     {
04641         /* Arg1 TypeName */
04642         L"Microsoft.UI.Xaml.Controls.RatingItemFontInfo",
04643         /* Arg2 CreateXamlTypeCallback */
04644         []()
04645         {
04646             auto xamlType = winrt::make_self<XamlType>(
04647                 /* Arg 1 - TypeName */
04648                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RatingItemFontInfo",
04649                 /* Arg 2 - BaseTypeName */
04650                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RatingItemInfo",
04651                 /* Arg 3 - Activator func */
04652                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRatingItemFontInfoFactory>(L"Microsoft.UI.Xaml.Controls.RatingItemFontInfo"); },
04653                 /* Arg 4 - Populate properties func */
04654                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04655                 {
04656                     winrt::IRatingItemFontInfoStatics statics = GetFactory<winrt::IRatingItemFontInfoStatics>(L"Microsoft.UI.Xaml.Controls.RatingItemFontInfo");
04657                     {
04658                         xamlType.AddDPMember(L"DisabledGlyph", L"String", statics.DisabledGlyphProperty(), false /* isContent */);
04659                         xamlType.AddDPMember(L"Glyph", L"String", statics.GlyphProperty(), false /* isContent */);
04660                         xamlType.AddDPMember(L"PlaceholderGlyph", L"String", statics.PlaceholderGlyphProperty(), false /* isContent */);
04661                         xamlType.AddDPMember(L"PointerOverGlyph", L"String", statics.PointerOverGlyphProperty(), false /* isContent */);
04662                         xamlType.AddDPMember(L"PointerOverPlaceholderGlyph", L"String", statics.PointerOverPlaceholderGlyphProperty(), false /* isContent */);
04663                         xamlType.AddDPMember(L"UnsetGlyph", L"String", statics.UnsetGlyphProperty(), false /* isContent */);
04664                     }
04665
04666                 });
04667
04668             return static_cast<winrt::IXamlType>(*xamlType);
04669         }
04670     },
04671     {
04672         /* Arg1 TypeName */
04673         L"Microsoft.UI.Xaml.Controls.RatingItemImageInfo",
04674         /* Arg2 CreateXamlTypeCallback */
04675         []()
04676         {
04677             auto xamlType = winrt::make_self<XamlType>(
04678                 /* Arg 1 - TypeName */
04679                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RatingItemImageInfo",
04680                 /* Arg 2 - BaseTypeName */
04681                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RatingItemInfo",
04682                 /* Arg 3 - Activator func */
04683                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRatingItemImageInfoFactory>(L"Microsoft.UI.Xaml.Controls.RatingItemImageInfo"); },
04684                 /* Arg 4 - Populate properties func */
04685                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04686                 {
04687                     winrt::IRatingItemImageInfoStatics statics = GetFactory<winrt::IRatingItemImageInfoStatics>(L"Microsoft.UI.Xaml.Controls.RatingItemImageInfo");
04688                     {
04689                         xamlType.AddDPMember(L"DisabledImage", L"Microsoft.UI.Xaml.Media.ImageSource", statics.DisabledImageProperty(), false /* isContent */);
04690                         xamlType.AddDPMember(L"Image", L"Microsoft.UI.Xaml.Media.ImageSource", statics.ImageProperty(), false /* isContent */);
04691                         xamlType.AddDPMember(L"PlaceholderImage", L"Microsoft.UI.Xaml.Media.ImageSource", statics.PlaceholderImageProperty(), false /* isContent */);
04692                         xamlType.AddDPMember(L"PointerOverImage", L"Microsoft.UI.Xaml.Media.ImageSource", statics.PointerOverImageProperty(), false /* isContent */);
04693                         xamlType.AddDPMember(L"PointerOverPlaceholderImage", L"Microsoft.UI.Xaml.Media.ImageSource", statics.PointerOverPlaceholderImageProperty(), false /* isContent */);
04694                         xamlType.AddDPMember(L"UnsetImage", L"Microsoft.UI.Xaml.Media.ImageSource", statics.UnsetImageProperty(), false /* isContent */);
04695                     }
04696
04697                 });
04698
04699             return static_cast<winrt::IXamlType>(*xamlType);
04700         }
04701     },
04702     {
04703         /* Arg1 TypeName */
04704         L"Microsoft.UI.Xaml.Controls.RecyclePool",
04705         /* Arg2 CreateXamlTypeCallback */
04706         []()
04707         {
04708             auto xamlType = winrt::make_self<XamlType>(
04709                 /* Arg 1 - TypeName */
04710                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RecyclePool",
04711                 /* Arg 2 - BaseTypeName */
04712                 (PCWSTR)L"Object",
04713                 /* Arg 3 - Activator func */
04714                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRecyclePoolFactory>(L"Microsoft.UI.Xaml.Controls.RecyclePool"); },
04715                 /* Arg 4 - Populate properties func */
04716                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04717                 {
04718                     winrt::IRecyclePoolStatics statics = GetFactory<winrt::IRecyclePoolStatics>(L"Microsoft.UI.Xaml.Controls.RecyclePool");
04719                     {
04720                         xamlType.AddDPMember(L"PoolInstance", L"Microsoft.UI.Xaml.Controls.RecyclePool", statics.PoolInstanceProperty(), false /* isContent */);
04721                     }
04722
04723                 });
04724
04725             return static_cast<winrt::IXamlType>(*xamlType);
04726         }
04727     },
04728     {
04729         /* Arg1 TypeName */
04730         L"Microsoft.UI.Xaml.Controls.RecyclingElementFactory",
04731         /* Arg2 CreateXamlTypeCallback */
04732         []()
04733         {
04734             auto xamlType = winrt::make_self<XamlType>(
04735                 /* Arg 1 - TypeName */
04736                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RecyclingElementFactory",
04737                 /* Arg 2 - BaseTypeName */
04738                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ElementFactory",
04739                 /* Arg 3 - Activator func */
04740                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRecyclingElementFactoryFactory>(L"Microsoft.UI.Xaml.Controls.RecyclingElementFactory"); },
04741                 /* Arg 4 - Populate properties func */
04742                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04743                 {
04744                     xamlType.AddMember(
04745                         L"Templates", /* propertyName */
04746                         L"Windows.Foundation.Collections.IMap`2<String,Microsoft.UI.Xaml.DataTemplate>", /* propertyType */
04747                         [](winrt::IInspectable instance) { return instance.as<winrt::RecyclingElementFactory>().Templates(); },
04748                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::RecyclingElementFactory>().Templates(value.as<winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::UI::Xaml::DataTemplate>>()); },
04749                         true, /* isContent */
04750                         false, /* isDependencyProperty */
04751                         false /* isAttachable */);
04752                     xamlType.AddMember(
04753                         L"RecyclePool", /* propertyName */
04754                         L"Microsoft.UI.Xaml.Controls.RecyclePool", /* propertyType */
04755                         [](winrt::IInspectable instance) { return instance.as<winrt::RecyclingElementFactory>().RecyclePool(); },
04756                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::RecyclingElementFactory>().RecyclePool(value.as<winrt::Microsoft::UI::Xaml::Controls::RecyclePool>()); },
04757                         false, /* isContent */
04758                         false, /* isDependencyProperty */
04759                         false /* isAttachable */);
04760                 });
04761
04762             return static_cast<winrt::IXamlType>(*xamlType);
04763         }
04764     },
04765     {
04766         /* Arg1 TypeName */
04767         L"Microsoft.UI.Xaml.Controls.RefreshContainer",
04768         /* Arg2 CreateXamlTypeCallback */
04769         []()
04770         {
04771             auto xamlType = winrt::make_self<XamlType>(
04772                 /* Arg 1 - TypeName */
04773                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RefreshContainer",
04774                 /* Arg 2 - BaseTypeName */
04775                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
04776                 /* Arg 3 - Activator func */
04777                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRefreshContainerFactory>(L"Microsoft.UI.Xaml.Controls.RefreshContainer"); },
04778                 /* Arg 4 - Populate properties func */
04779                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04780                 {
04781                     winrt::IRefreshContainerStatics statics = GetFactory<winrt::IRefreshContainerStatics>(L"Microsoft.UI.Xaml.Controls.RefreshContainer");
04782                     {
04783                         xamlType.AddDPMember(L"PullDirection", L"Microsoft.UI.Xaml.Controls.RefreshPullDirection", statics.PullDirectionProperty(), false /* isContent */);
04784                         xamlType.AddDPMember(L"Visualizer", L"Microsoft.UI.Xaml.Controls.RefreshVisualizer", statics.VisualizerProperty(), false /* isContent */);
04785                     }
04786
04787                 });
04788
04789             return static_cast<winrt::IXamlType>(*xamlType);
04790         }
04791     },
04792     {
04793         /* Arg1 TypeName */
04794         L"Microsoft.UI.Xaml.Controls.RefreshPullDirection",
04795         /* Arg2 CreateXamlTypeCallback */
04796         []()
04797         {
04798             auto xamlType = winrt::make<EnumXamlType>(
04799                 /* Arg 1 - TypeName */
04800                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RefreshPullDirection",
04801                 /* Arg 2 - CreateFromString func */
04802                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
04803                 {
04804                     if (fromString == L"LeftToRight") return box_value(winrt::RefreshPullDirection::LeftToRight);
04805                     if (fromString == L"TopToBottom") return box_value(winrt::RefreshPullDirection::TopToBottom);
04806                     if (fromString == L"RightToLeft") return box_value(winrt::RefreshPullDirection::RightToLeft);
04807                     if (fromString == L"BottomToTop") return box_value(winrt::RefreshPullDirection::BottomToTop);
04808                     throw winrt::hresult_invalid_argument();
04809                 });
04810
04811             return xamlType;
04812         }
04813     },
04814     {
04815         /* Arg1 TypeName */
04816         L"Microsoft.UI.Xaml.Controls.RefreshVisualizer",
04817         /* Arg2 CreateXamlTypeCallback */
04818         []()
04819         {
04820             auto xamlType = winrt::make_self<XamlType>(
04821                 /* Arg 1 - TypeName */
04822                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RefreshVisualizer",
04823                 /* Arg 2 - BaseTypeName */
04824                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
04825                 /* Arg 3 - Activator func */
04826                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRefreshVisualizerFactory>(L"Microsoft.UI.Xaml.Controls.RefreshVisualizer"); },
04827                 /* Arg 4 - Populate properties func */
04828                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04829                 {
04830                     winrt::IRefreshVisualizerStatics statics = GetFactory<winrt::IRefreshVisualizerStatics>(L"Microsoft.UI.Xaml.Controls.RefreshVisualizer");
04831                     {
04832                         xamlType.AddDPMember(L"Content", L"Microsoft.UI.Xaml.UIElement", statics.ContentProperty(), false /* isContent */);
04833                         xamlType.AddDPMember(L"InfoProvider", L"Object", statics.InfoProviderProperty(), false /* isContent */);
04834                         xamlType.AddDPMember(L"Orientation", L"Microsoft.UI.Xaml.Controls.RefreshVisualizerOrientation", statics.OrientationProperty(), false /* isContent */);
04835                         xamlType.AddDPMember(L"State", L"Microsoft.UI.Xaml.Controls.RefreshVisualizerState", statics.StateProperty(), false /* isContent */);
04836                     }
04837
04838                 });
04839
04840             return static_cast<winrt::IXamlType>(*xamlType);
04841         }
04842     },
04843     {
04844         /* Arg1 TypeName */
04845         L"Microsoft.UI.Xaml.Controls.RefreshVisualizerOrientation",
04846         /* Arg2 CreateXamlTypeCallback */
04847         []()
04848         {
04849             auto xamlType = winrt::make<EnumXamlType>(
04850                 /* Arg 1 - TypeName */
04851                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RefreshVisualizerOrientation",
04852                 /* Arg 2 - CreateFromString func */
04853                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
04854                 {
04855                     if (fromString == L"Auto") return box_value(winrt::RefreshVisualizerOrientation::Auto);
04856                     if (fromString == L"Normal") return box_value(winrt::RefreshVisualizerOrientation::Normal);
04857                     if (fromString == L"Rotate90DegreesCounterclockwise") return box_value(winrt::RefreshVisualizerOrientation::Rotate90DegreesCounterclockwise);
04858                     if (fromString == L"Rotate270DegreesCounterclockwise") return box_value(winrt::RefreshVisualizerOrientation::Rotate270DegreesCounterclockwise);
04859                     throw winrt::hresult_invalid_argument();
04860                 });
04861
04862             return xamlType;
04863         }
04864     },
04865     {
04866         /* Arg1 TypeName */
04867         L"Microsoft.UI.Xaml.Controls.RefreshVisualizerState",
04868         /* Arg2 CreateXamlTypeCallback */
04869         []()
04870         {
04871             auto xamlType = winrt::make<EnumXamlType>(
04872                 /* Arg 1 - TypeName */
04873                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RefreshVisualizerState",
04874                 /* Arg 2 - CreateFromString func */
04875                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
04876                 {
04877                     if (fromString == L"Idle") return box_value(winrt::RefreshVisualizerState::Idle);
04878                     if (fromString == L"Peeking") return box_value(winrt::RefreshVisualizerState::Peeking);
04879                     if (fromString == L"Interacting") return box_value(winrt::RefreshVisualizerState::Interacting);
04880                     if (fromString == L"Pending") return box_value(winrt::RefreshVisualizerState::Pending);
04881                     if (fromString == L"Refreshing") return box_value(winrt::RefreshVisualizerState::Refreshing);
04882                     throw winrt::hresult_invalid_argument();
04883                 });
04884
04885             return xamlType;
04886         }
04887     },
04888     {
04889         /* Arg1 TypeName */
04890         L"Microsoft.UI.Xaml.Controls.RevealListViewItemPresenter",
04891         /* Arg2 CreateXamlTypeCallback */
04892         []()
04893         {
04894             auto xamlType = winrt::make_self<XamlType>(
04895                 /* Arg 1 - TypeName */
04896                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.RevealListViewItemPresenter",
04897                 /* Arg 2 - BaseTypeName */
04898                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ListViewItemPresenter",
04899                 /* Arg 3 - Activator func */
04900                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRevealListViewItemPresenterFactory>(L"Microsoft.UI.Xaml.Controls.RevealListViewItemPresenter"); },
04901                 /* Arg 4 - Populate properties func */
04902                 nullptr
04903             );
04904
04905             return static_cast<winrt::IXamlType>(*xamlType);
04906         }
04907     },
04908     {
04909         /* Arg1 TypeName */
04910         L"Microsoft.UI.Xaml.Controls.ScrollView",
04911         /* Arg2 CreateXamlTypeCallback */
04912         []()
04913         {
04914             auto xamlType = winrt::make_self<XamlType>(
04915                 /* Arg 1 - TypeName */
04916                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollView",
04917                 /* Arg 2 - BaseTypeName */
04918                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
04919                 /* Arg 3 - Activator func */
04920                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IScrollViewFactory>(L"Microsoft.UI.Xaml.Controls.ScrollView"); },
04921                 /* Arg 4 - Populate properties func */
04922                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
04923                 {
04924                     winrt::IScrollViewStatics statics = GetFactory<winrt::IScrollViewStatics>(L"Microsoft.UI.Xaml.Controls.ScrollView");
04925                     {
04926                         xamlType.AddDPMember(L"ComputedHorizontalScrollBarVisibility", L"Microsoft.UI.Xaml.Visibility", statics.ComputedHorizontalScrollBarVisibilityProperty(), false /* isContent */);
04927                         xamlType.AddDPMember(L"ComputedHorizontalScrollMode", L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode", statics.ComputedHorizontalScrollModeProperty(), false /* isContent */);
04928                         xamlType.AddDPMember(L"ComputedVerticalScrollBarVisibility", L"Microsoft.UI.Xaml.Visibility", statics.ComputedVerticalScrollBarVisibilityProperty(), false /* isContent */);
04929                         xamlType.AddDPMember(L"ComputedVerticalScrollMode", L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode", statics.ComputedVerticalScrollModeProperty(), false /* isContent */);
04930                         xamlType.AddDPMember(L"ContentOrientation", L"Microsoft.UI.Xaml.Controls.ScrollingContentOrientation", statics.ContentOrientationProperty(), false /* isContent */);
04931                         xamlType.AddDPMember(L"Content", L"Microsoft.UI.Xaml.UIElement", statics.ContentProperty(), true /* isContent */);
04932                         xamlType.AddDPMember(L"HorizontalAnchorRatio", L"Double", statics.HorizontalAnchorRatioProperty(), false /* isContent */);
04933                         xamlType.AddDPMember(L"HorizontalScrollBarVisibility", L"Microsoft.UI.Xaml.Controls.ScrollingScrollBarVisibility", statics.HorizontalScrollBarVisibilityProperty(), false /* isContent */);
04934                         xamlType.AddDPMember(L"HorizontalScrollChainMode", L"Microsoft.UI.Xaml.Controls.ScrollingChainMode", statics.HorizontalScrollChainModeProperty(), false /* isContent */);
04935                         xamlType.AddDPMember(L"HorizontalScrollMode", L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode", statics.HorizontalScrollModeProperty(), false /* isContent */);
04936                         xamlType.AddDPMember(L"HorizontalScrollRailMode", L"Microsoft.UI.Xaml.Controls.ScrollingRailMode", statics.HorizontalScrollRailModeProperty(), false /* isContent */);
04937                         xamlType.AddDPMember(L"IgnoredInputKinds", L"Microsoft.UI.Xaml.Controls.ScrollingInputKinds", statics.IgnoredInputKindsProperty(), false /* isContent */);
04938                         xamlType.AddDPMember(L"MaxZoomFactor", L"Double", statics.MaxZoomFactorProperty(), false /* isContent */);
04939                         xamlType.AddDPMember(L"MinZoomFactor", L"Double", statics.MinZoomFactorProperty(), false /* isContent */);
04940                         xamlType.AddDPMember(L"ScrollPresenter", L"Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter", statics.ScrollPresenterProperty(), false /* isContent */);
04941                         xamlType.AddDPMember(L"VerticalAnchorRatio", L"Double", statics.VerticalAnchorRatioProperty(), false /* isContent */);
04942                         xamlType.AddDPMember(L"VerticalScrollBarVisibility", L"Microsoft.UI.Xaml.Controls.ScrollingScrollBarVisibility", statics.VerticalScrollBarVisibilityProperty(), false /* isContent */);
04943                         xamlType.AddDPMember(L"VerticalScrollChainMode", L"Microsoft.UI.Xaml.Controls.ScrollingChainMode", statics.VerticalScrollChainModeProperty(), false /* isContent */);
04944                         xamlType.AddDPMember(L"VerticalScrollMode", L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode", statics.VerticalScrollModeProperty(), false /* isContent */);
04945                         xamlType.AddDPMember(L"VerticalScrollRailMode", L"Microsoft.UI.Xaml.Controls.ScrollingRailMode", statics.VerticalScrollRailModeProperty(), false /* isContent */);
04946                         xamlType.AddDPMember(L"ZoomChainMode", L"Microsoft.UI.Xaml.Controls.ScrollingChainMode", statics.ZoomChainModeProperty(), false /* isContent */);
04947                         xamlType.AddDPMember(L"ZoomMode", L"Microsoft.UI.Xaml.Controls.ScrollingZoomMode", statics.ZoomModeProperty(), false /* isContent */);
04948                     }
04949
04950                     xamlType.AddMember(
04951                         L"CurrentAnchor", /* propertyName */
04952                         L"Microsoft.UI.Xaml.UIElement", /* propertyType */
04953                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollView>().CurrentAnchor(); },
04954                         nullptr, /* setter */
04955                         false, /* isContent */
04956                         false, /* isDependencyProperty */
04957                         false /* isAttachable */);
04958                     xamlType.AddMember(
04959                         L"ExpressionAnimationSources", /* propertyName */
04960                         L"Microsoft.UI.Composition.CompositionPropertySet", /* propertyType */
04961                         [](winrt::IInspectable instance) { return instance.as<winrt::ScrollView>().ExpressionAnimationSources(); },
04962                         nullptr, /* setter */
04963                         false, /* isContent */
04964                         false, /* isDependencyProperty */
04965                         false /* isAttachable */);
04966                     xamlType.AddMember(
04967                         L"ExtentHeight", /* propertyName */
04968                         L"Double", /* propertyType */
04969                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().ExtentHeight()); },
04970                         nullptr, /* setter */
04971                         false, /* isContent */
04972                         false, /* isDependencyProperty */
04973                         false /* isAttachable */);
04974                     xamlType.AddMember(
04975                         L"ExtentWidth", /* propertyName */
04976                         L"Double", /* propertyType */
04977                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().ExtentWidth()); },
04978                         nullptr, /* setter */
04979                         false, /* isContent */
04980                         false, /* isDependencyProperty */
04981                         false /* isAttachable */);
04982                     xamlType.AddMember(
04983                         L"HorizontalOffset", /* propertyName */
04984                         L"Double", /* propertyType */
04985                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().HorizontalOffset()); },
04986                         nullptr, /* setter */
04987                         false, /* isContent */
04988                         false, /* isDependencyProperty */
04989                         false /* isAttachable */);
04990                     xamlType.AddMember(
04991                         L"ScrollableHeight", /* propertyName */
04992                         L"Double", /* propertyType */
04993                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().ScrollableHeight()); },
04994                         nullptr, /* setter */
04995                         false, /* isContent */
04996                         false, /* isDependencyProperty */
04997                         false /* isAttachable */);
04998                     xamlType.AddMember(
04999                         L"ScrollableWidth", /* propertyName */
05000                         L"Double", /* propertyType */
05001                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().ScrollableWidth()); },
05002                         nullptr, /* setter */
05003                         false, /* isContent */
05004                         false, /* isDependencyProperty */
05005                         false /* isAttachable */);
05006                     xamlType.AddMember(
05007                         L"State", /* propertyName */
05008                         L"Microsoft.UI.Xaml.Controls.ScrollingInteractionState", /* propertyType */
05009                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ScrollView>().State()); },
05010                         nullptr, /* setter */
05011                         false, /* isContent */
05012                         false, /* isDependencyProperty */
05013                         false /* isAttachable */);
05014                     xamlType.AddMember(
05015                         L"VerticalOffset", /* propertyName */
05016                         L"Double", /* propertyType */
05017                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().VerticalOffset()); },
05018                         nullptr, /* setter */
05019                         false, /* isContent */
05020                         false, /* isDependencyProperty */
05021                         false /* isAttachable */);
05022                     xamlType.AddMember(
05023                         L"ViewportHeight", /* propertyName */
05024                         L"Double", /* propertyType */
05025                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().ViewportHeight()); },
05026                         nullptr, /* setter */
05027                         false, /* isContent */
05028                         false, /* isDependencyProperty */
05029                         false /* isAttachable */);
05030                     xamlType.AddMember(
05031                         L"ViewportWidth", /* propertyName */
05032                         L"Double", /* propertyType */
05033                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().ViewportWidth()); },
05034                         nullptr, /* setter */
05035                         false, /* isContent */
05036                         false, /* isDependencyProperty */
05037                         false /* isAttachable */);
05038                     xamlType.AddMember(
05039                         L"ZoomFactor", /* propertyName */
05040                         L"Single", /* propertyType */
05041                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::ScrollView>().ZoomFactor()); },
05042                         nullptr, /* setter */
05043                         false, /* isContent */
05044                         false, /* isDependencyProperty */
05045                         false /* isAttachable */);
05046                 });
05047
05048             return static_cast<winrt::IXamlType>(*xamlType);
05049         }
05050     },
05051     {
05052         /* Arg1 TypeName */
05053         L"Microsoft.UI.Xaml.Controls.ScrollingAnimationMode",
05054         /* Arg2 CreateXamlTypeCallback */
05055         []()
05056         {
05057             auto xamlType = winrt::make<EnumXamlType>(
05058                 /* Arg 1 - TypeName */
05059                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingAnimationMode",
05060                 /* Arg 2 - CreateFromString func */
05061                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05062                 {
05063                     if (fromString == L"Disabled") return box_value(winrt::ScrollingAnimationMode::Disabled);
05064                     if (fromString == L"Enabled") return box_value(winrt::ScrollingAnimationMode::Enabled);
05065                     if (fromString == L"Auto") return box_value(winrt::ScrollingAnimationMode::Auto);
05066                     throw winrt::hresult_invalid_argument();
05067                 });
05068
05069             return xamlType;
05070         }
05071     },
05072     {
05073         /* Arg1 TypeName */
05074         L"Microsoft.UI.Xaml.Controls.ScrollingChainMode",
05075         /* Arg2 CreateXamlTypeCallback */
05076         []()
05077         {
05078             auto xamlType = winrt::make<EnumXamlType>(
05079                 /* Arg 1 - TypeName */
05080                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingChainMode",
05081                 /* Arg 2 - CreateFromString func */
05082                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05083                 {
05084                     if (fromString == L"Auto") return box_value(winrt::ScrollingChainMode::Auto);
05085                     if (fromString == L"Always") return box_value(winrt::ScrollingChainMode::Always);
05086                     if (fromString == L"Never") return box_value(winrt::ScrollingChainMode::Never);
05087                     throw winrt::hresult_invalid_argument();
05088                 });
05089
05090             return xamlType;
05091         }
05092     },
05093     {
05094         /* Arg1 TypeName */
05095         L"Microsoft.UI.Xaml.Controls.ScrollingContentOrientation",
05096         /* Arg2 CreateXamlTypeCallback */
05097         []()
05098         {
05099             auto xamlType = winrt::make<EnumXamlType>(
05100                 /* Arg 1 - TypeName */
05101                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingContentOrientation",
05102                 /* Arg 2 - CreateFromString func */
05103                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05104                 {
05105                     if (fromString == L"Vertical") return box_value(winrt::ScrollingContentOrientation::Vertical);
05106                     if (fromString == L"Horizontal") return box_value(winrt::ScrollingContentOrientation::Horizontal);
05107                     if (fromString == L"None") return box_value(winrt::ScrollingContentOrientation::None);
05108                     if (fromString == L"Both") return box_value(winrt::ScrollingContentOrientation::Both);
05109                     throw winrt::hresult_invalid_argument();
05110                 });
05111
05112             return xamlType;
05113         }
05114     },
05115     {
05116         /* Arg1 TypeName */
05117         L"Microsoft.UI.Xaml.Controls.ScrollingInputKinds",
05118         /* Arg2 CreateXamlTypeCallback */
05119         []()
05120         {
05121             auto xamlType = winrt::make<EnumXamlType>(
05122                 /* Arg 1 - TypeName */
05123                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingInputKinds",
05124                 /* Arg 2 - CreateFromString func */
05125                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05126                 {
05127                     if (fromString == L"None") return box_value(winrt::ScrollingInputKinds::None);
05128                     if (fromString == L"Touch") return box_value(winrt::ScrollingInputKinds::Touch);
05129                     if (fromString == L"Pen") return box_value(winrt::ScrollingInputKinds::Pen);
05130                     if (fromString == L"MouseWheel") return box_value(winrt::ScrollingInputKinds::MouseWheel);
05131                     if (fromString == L"Keyboard") return box_value(winrt::ScrollingInputKinds::Keyboard);
05132                     if (fromString == L"Gamepad") return box_value(winrt::ScrollingInputKinds::Gamepad);
05133                     if (fromString == L"All") return box_value(winrt::ScrollingInputKinds::All);
05134                     throw winrt::hresult_invalid_argument();
05135                 });
05136
05137             return xamlType;
05138         }
05139     },
05140     {
05141         /* Arg1 TypeName */
05142         L"Microsoft.UI.Xaml.Controls.ScrollingInteractionState",
05143         /* Arg2 CreateXamlTypeCallback */
05144         []()
05145         {
05146             auto xamlType = winrt::make<EnumXamlType>(
05147                 /* Arg 1 - TypeName */
05148                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingInteractionState",
05149                 /* Arg 2 - CreateFromString func */
05150                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05151                 {
05152                     if (fromString == L"Idle") return box_value(winrt::ScrollingInteractionState::Idle);
05153                     if (fromString == L"Interaction") return box_value(winrt::ScrollingInteractionState::Interaction);
05154                     if (fromString == L"Inertia") return box_value(winrt::ScrollingInteractionState::Inertia);
05155                     if (fromString == L"Animation") return box_value(winrt::ScrollingInteractionState::Animation);
05156                     throw winrt::hresult_invalid_argument();
05157                 });
05158
05159             return xamlType;
05160         }
05161     },
05162     {
05163         /* Arg1 TypeName */
05164         L"Microsoft.UI.Xaml.Controls.ScrollingRailMode",
05165         /* Arg2 CreateXamlTypeCallback */
05166         []()
05167         {
05168             auto xamlType = winrt::make<EnumXamlType>(
05169                 /* Arg 1 - TypeName */
05170                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingRailMode",
05171                 /* Arg 2 - CreateFromString func */
05172                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05173                 {
05174                     if (fromString == L"Enabled") return box_value(winrt::ScrollingRailMode::Enabled);
05175                     if (fromString == L"Disabled") return box_value(winrt::ScrollingRailMode::Disabled);
05176                     throw winrt::hresult_invalid_argument();
05177                 });
05178
05179             return xamlType;
05180         }
05181     },
05182     {
05183         /* Arg1 TypeName */
05184         L"Microsoft.UI.Xaml.Controls.ScrollingScrollBarVisibility",
05185         /* Arg2 CreateXamlTypeCallback */
05186         []()
05187         {
05188             auto xamlType = winrt::make<EnumXamlType>(
05189                 /* Arg 1 - TypeName */
05190                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingScrollBarVisibility",
05191                 /* Arg 2 - CreateFromString func */
05192                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05193                 {
05194                     if (fromString == L"Auto") return box_value(winrt::ScrollingScrollBarVisibility::Auto);
05195                     if (fromString == L"Visible") return box_value(winrt::ScrollingScrollBarVisibility::Visible);
05196                     if (fromString == L"Hidden") return box_value(winrt::ScrollingScrollBarVisibility::Hidden);
05197                     throw winrt::hresult_invalid_argument();
05198                 });
05199
05200             return xamlType;
05201         }
05202     },
05203     {
05204         /* Arg1 TypeName */
05205         L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode",
05206         /* Arg2 CreateXamlTypeCallback */
05207         []()
05208         {
05209             auto xamlType = winrt::make<EnumXamlType>(
05210                 /* Arg 1 - TypeName */
05211                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingScrollMode",
05212                 /* Arg 2 - CreateFromString func */
05213                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05214                 {
05215                     if (fromString == L"Enabled") return box_value(winrt::ScrollingScrollMode::Enabled);
05216                     if (fromString == L"Disabled") return box_value(winrt::ScrollingScrollMode::Disabled);
05217                     if (fromString == L"Auto") return box_value(winrt::ScrollingScrollMode::Auto);
05218                     throw winrt::hresult_invalid_argument();
05219                 });
05220
05221             return xamlType;
05222         }
05223     },
05224     {
05225         /* Arg1 TypeName */
05226         L"Microsoft.UI.Xaml.Controls.ScrollingScrollOptions",
05227         /* Arg2 CreateXamlTypeCallback */
05228         []()
05229         {
05230             auto xamlType = winrt::make_self<XamlType>(
05231                 /* Arg 1 - TypeName */
05232                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingScrollOptions",
05233                 /* Arg 2 - BaseTypeName */
05234                 (PCWSTR)L"Object",
05235                 /* Arg 3 - Activator func */
05236                 nullptr,
05237                 /* Arg 4 - Populate properties func */
05238                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05239                 {
05240                     xamlType.AddMember(
05241                         L"SnapPointsMode", /* propertyName */
05242                         L"Microsoft.UI.Xaml.Controls.ScrollingSnapPointsMode", /* propertyType */
05243                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ScrollingScrollOptions>().SnapPointsMode()); },
05244                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ScrollingScrollOptions>().SnapPointsMode(unbox_value<winrt::ScrollingSnapPointsMode>(value)); },
05245                         false, /* isContent */
05246                         false, /* isDependencyProperty */
05247                         false /* isAttachable */);
05248                     xamlType.AddMember(
05249                         L"AnimationMode", /* propertyName */
05250                         L"Microsoft.UI.Xaml.Controls.ScrollingAnimationMode", /* propertyType */
05251                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ScrollingScrollOptions>().AnimationMode()); },
05252                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ScrollingScrollOptions>().AnimationMode(unbox_value<winrt::ScrollingAnimationMode>(value)); },
05253                         false, /* isContent */
05254                         false, /* isDependencyProperty */
05255                         false /* isAttachable */);
05256                 });
05257
05258             return static_cast<winrt::IXamlType>(*xamlType);
05259         }
05260     },
05261     {
05262         /* Arg1 TypeName */
05263         L"Microsoft.UI.Xaml.Controls.ScrollingSnapPointsMode",
05264         /* Arg2 CreateXamlTypeCallback */
05265         []()
05266         {
05267             auto xamlType = winrt::make<EnumXamlType>(
05268                 /* Arg 1 - TypeName */
05269                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingSnapPointsMode",
05270                 /* Arg 2 - CreateFromString func */
05271                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05272                 {
05273                     if (fromString == L"Default") return box_value(winrt::ScrollingSnapPointsMode::Default);
05274                     if (fromString == L"Ignore") return box_value(winrt::ScrollingSnapPointsMode::Ignore);
05275                     throw winrt::hresult_invalid_argument();
05276                 });
05277
05278             return xamlType;
05279         }
05280     },
05281     {
05282         /* Arg1 TypeName */
05283         L"Microsoft.UI.Xaml.Controls.ScrollingZoomMode",
05284         /* Arg2 CreateXamlTypeCallback */
05285         []()
05286         {
05287             auto xamlType = winrt::make<EnumXamlType>(
05288                 /* Arg 1 - TypeName */
05289                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingZoomMode",
05290                 /* Arg 2 - CreateFromString func */
05291                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05292                 {
05293                     if (fromString == L"Enabled") return box_value(winrt::ScrollingZoomMode::Enabled);
05294                     if (fromString == L"Disabled") return box_value(winrt::ScrollingZoomMode::Disabled);
05295                     throw winrt::hresult_invalid_argument();
05296                 });
05297
05298             return xamlType;
05299         }
05300     },
05301     {
05302         /* Arg1 TypeName */
05303         L"Microsoft.UI.Xaml.Controls.ScrollingZoomOptions",
05304         /* Arg2 CreateXamlTypeCallback */
05305         []()
05306         {
05307             auto xamlType = winrt::make_self<XamlType>(
05308                 /* Arg 1 - TypeName */
05309                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollingZoomOptions",
05310                 /* Arg 2 - BaseTypeName */
05311                 (PCWSTR)L"Object",
05312                 /* Arg 3 - Activator func */
05313                 nullptr,
05314                 /* Arg 4 - Populate properties func */
05315                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05316                 {
05317                     xamlType.AddMember(
05318                         L"SnapPointsMode", /* propertyName */
05319                         L"Microsoft.UI.Xaml.Controls.ScrollingSnapPointsMode", /* propertyType */
05320                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ScrollingZoomOptions>().SnapPointsMode()); },
05321                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ScrollingZoomOptions>().SnapPointsMode(unbox_value<winrt::ScrollingSnapPointsMode>(value)); },
05322                         false, /* isContent */
05323                         false, /* isDependencyProperty */
05324                         false /* isAttachable */);
05325                     xamlType.AddMember(
05326                         L"AnimationMode", /* propertyName */
05327                         L"Microsoft.UI.Xaml.Controls.ScrollingAnimationMode", /* propertyType */
05328                         [](winrt::IInspectable instance) { return box_value<int>((int)instance.as<winrt::ScrollingZoomOptions>().AnimationMode()); },
05329                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::ScrollingZoomOptions>().AnimationMode(unbox_value<winrt::ScrollingAnimationMode>(value)); },
05330                         false, /* isContent */
05331                         false, /* isDependencyProperty */
05332                         false /* isAttachable */);
05333                 });
05334
05335             return static_cast<winrt::IXamlType>(*xamlType);
05336         }
05337     },
05338     {
05339         /* Arg1 TypeName */
05340         L"Microsoft.UI.Xaml.Controls.SelectionModel",
05341         /* Arg2 CreateXamlTypeCallback */
05342         []()
05343         {
05344             auto xamlType = winrt::make_self<XamlType>(
05345                 /* Arg 1 - TypeName */
05346                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SelectionModel",
05347                 /* Arg 2 - BaseTypeName */
05348                 (PCWSTR)L"Object",
05349                 /* Arg 3 - Activator func */
05350                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ISelectionModelFactory>(L"Microsoft.UI.Xaml.Controls.SelectionModel"); },
05351                 /* Arg 4 - Populate properties func */
05352                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05353                 {
05354                     xamlType.AddMember(
05355                         L"Source", /* propertyName */
05356                         L"Object", /* propertyType */
05357                         [](winrt::IInspectable instance) { return instance.as<winrt::SelectionModel>().Source(); },
05358                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::SelectionModel>().Source(value); },
05359                         false, /* isContent */
05360                         false, /* isDependencyProperty */
05361                         false /* isAttachable */);
05362                     xamlType.AddMember(
05363                         L"SingleSelect", /* propertyName */
05364                         L"Boolean", /* propertyType */
05365                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::SelectionModel>().SingleSelect()); },
05366                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::SelectionModel>().SingleSelect(unbox_value<bool>(value)); },
05367                         false, /* isContent */
05368                         false, /* isDependencyProperty */
05369                         false /* isAttachable */);
05370                     xamlType.AddMember(
05371                         L"SelectedIndex", /* propertyName */
05372                         L"Microsoft.UI.Xaml.Controls.IndexPath", /* propertyType */
05373                         [](winrt::IInspectable instance) { return instance.as<winrt::SelectionModel>().SelectedIndex(); },
05374                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::SelectionModel>().SelectedIndex(value.as<winrt::Microsoft::UI::Xaml::Controls::IndexPath>()); },
05375                         false, /* isContent */
05376                         false, /* isDependencyProperty */
05377                         false /* isAttachable */);
05378                     xamlType.AddMember(
05379                         L"AnchorIndex", /* propertyName */
05380                         L"Microsoft.UI.Xaml.Controls.IndexPath", /* propertyType */
05381                         [](winrt::IInspectable instance) { return instance.as<winrt::SelectionModel>().AnchorIndex(); },
05382                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::SelectionModel>().AnchorIndex(value.as<winrt::Microsoft::UI::Xaml::Controls::IndexPath>()); },
05383                         false, /* isContent */
05384                         false, /* isDependencyProperty */
05385                         false /* isAttachable */);
05386                     xamlType.AddMember(
05387                         L"SelectedIndices", /* propertyName */
05388                         L"Windows.Foundation.Collections.IReadOnlyList`1<Microsoft.UI.Xaml.Controls.IndexPath>", /* propertyType */
05389                         [](winrt::IInspectable instance) { return instance.as<winrt::SelectionModel>().SelectedIndices(); },
05390                         nullptr, /* setter */
05391                         false, /* isContent */
05392                         false, /* isDependencyProperty */
05393                         false /* isAttachable */);
05394                     xamlType.AddMember(
05395                         L"SelectedItem", /* propertyName */
05396                         L"Object", /* propertyType */
05397                         [](winrt::IInspectable instance) { return instance.as<winrt::SelectionModel>().SelectedItem(); },
05398                         nullptr, /* setter */
05399                         false, /* isContent */
05400                         false, /* isDependencyProperty */
05401                         false /* isAttachable */);
05402                     xamlType.AddMember(
05403                         L"SelectedItems", /* propertyName */
05404                         L"Windows.Foundation.Collections.IReadOnlyList`1<Object>", /* propertyType */
05405                         [](winrt::IInspectable instance) { return instance.as<winrt::SelectionModel>().SelectedItems(); },
05406                         nullptr, /* setter */
05407                         false, /* isContent */
05408                         false, /* isDependencyProperty */
05409                         false /* isAttachable */);
05410                 });
05411
05412             return static_cast<winrt::IXamlType>(*xamlType);
05413         }
05414     },
05415     {
05416         /* Arg1 TypeName */
05417         L"Microsoft.UI.Xaml.Controls.SelectorBar",
05418         /* Arg2 CreateXamlTypeCallback */
05419         []()
05420         {
05421             auto xamlType = winrt::make_self<XamlType>(
05422                 /* Arg 1 - TypeName */
05423                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SelectorBar",
05424                 /* Arg 2 - BaseTypeName */
05425                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
05426                 /* Arg 3 - Activator func */
05427                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ISelectorBarFactory>(L"Microsoft.UI.Xaml.Controls.SelectorBar"); },
05428                 /* Arg 4 - Populate properties func */
05429                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05430                 {
05431                     winrt::ISelectorBarStatics statics = GetFactory<winrt::ISelectorBarStatics>(L"Microsoft.UI.Xaml.Controls.SelectorBar");
05432                     {
05433                         xamlType.AddDPMember(L"Items", L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.SelectorBarItem>", statics.ItemsProperty(), true /* isContent */);
05434                         xamlType.AddDPMember(L"SelectedItem", L"Microsoft.UI.Xaml.Controls.SelectorBarItem", statics.SelectedItemProperty(), false /* isContent */);
05435                     }
05436
05437                 });
05438
05439             return static_cast<winrt::IXamlType>(*xamlType);
05440         }
05441     },
05442     {
05443         /* Arg1 TypeName */
05444         L"Microsoft.UI.Xaml.Controls.SelectorBarItem",
05445         /* Arg2 CreateXamlTypeCallback */
05446         []()
05447         {
05448             auto xamlType = winrt::make_self<XamlType>(
05449                 /* Arg 1 - TypeName */
05450                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SelectorBarItem",
05451                 /* Arg 2 - BaseTypeName */
05452                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ItemContainer",
05453                 /* Arg 3 - Activator func */
05454                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ISelectorBarItemFactory>(L"Microsoft.UI.Xaml.Controls.SelectorBarItem"); },
05455                 /* Arg 4 - Populate properties func */
05456                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05457                 {
05458                     winrt::ISelectorBarItemStatics statics = GetFactory<winrt::ISelectorBarItemStatics>(L"Microsoft.UI.Xaml.Controls.SelectorBarItem");
05459                     {
05460                         xamlType.AddDPMember(L"Icon", L"Microsoft.UI.Xaml.Controls.IconElement", statics.IconProperty(), false /* isContent */);
05461                         xamlType.AddDPMember(L"Text", L"String", statics.TextProperty(), false /* isContent */);
05462                     }
05463
05464                 });
05465
05466             return static_cast<winrt::IXamlType>(*xamlType);
05467         }
05468     },
05469     {
05470         /* Arg1 TypeName */
05471         L"Microsoft.UI.Xaml.Controls.SplitButton",
05472         /* Arg2 CreateXamlTypeCallback */
05473         []()
05474         {
05475             auto xamlType = winrt::make_self<XamlType>(
05476                 /* Arg 1 - TypeName */
05477                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SplitButton",
05478                 /* Arg 2 - BaseTypeName */
05479                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
05480                 /* Arg 3 - Activator func */
05481                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ISplitButtonFactory>(L"Microsoft.UI.Xaml.Controls.SplitButton"); },
05482                 /* Arg 4 - Populate properties func */
05483                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05484                 {
05485                     winrt::ISplitButtonStatics statics = GetFactory<winrt::ISplitButtonStatics>(L"Microsoft.UI.Xaml.Controls.SplitButton");
05486                     {
05487                         xamlType.AddDPMember(L"CommandParameter", L"Object", statics.CommandParameterProperty(), false /* isContent */);
05488                         xamlType.AddDPMember(L"Command", L"Microsoft.UI.Xaml.Input.ICommand", statics.CommandProperty(), false /* isContent */);
05489                         xamlType.AddDPMember(L"Flyout", L"Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase", statics.FlyoutProperty(), false /* isContent */);
05490                     }
05491
05492                 });
05493
05494             return static_cast<winrt::IXamlType>(*xamlType);
05495         }
05496     },
05497     {
05498         /* Arg1 TypeName */
05499         L"Microsoft.UI.Xaml.Controls.StackLayout",
05500         /* Arg2 CreateXamlTypeCallback */
05501         []()
05502         {
05503             auto xamlType = winrt::make_self<XamlType>(
05504                 /* Arg 1 - TypeName */
05505                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.StackLayout",
05506                 /* Arg 2 - BaseTypeName */
05507                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.VirtualizingLayout",
05508                 /* Arg 3 - Activator func */
05509                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IStackLayoutFactory>(L"Microsoft.UI.Xaml.Controls.StackLayout"); },
05510                 /* Arg 4 - Populate properties func */
05511                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05512                 {
05513                     winrt::IStackLayoutStatics statics = GetFactory<winrt::IStackLayoutStatics>(L"Microsoft.UI.Xaml.Controls.StackLayout");
05514                     {
05515                         xamlType.AddDPMember(L"Orientation", L"Microsoft.UI.Xaml.Controls.Orientation", statics.OrientationProperty(), false /* isContent */);
05516                         xamlType.AddDPMember(L"Spacing", L"Double", statics.SpacingProperty(), false /* isContent */);
05517                     }
05518
05519                     winrt::IStackLayoutStatics2 statics2 = GetFactory<winrt::IStackLayoutStatics2>(L"Microsoft.UI.Xaml.Controls.StackLayout");
05520                     {
05521                         xamlType.AddDPMember(L"IsVirtualizationEnabled", L"Boolean", statics2.IsVirtualizationEnabledProperty(), false /* isContent */);
05522                     }
05523
05524                 });
05525
05526             return static_cast<winrt::IXamlType>(*xamlType);
05527         }
05528     },
05529     {
05530         /* Arg1 TypeName */
05531         L"Microsoft.UI.Xaml.Controls.StackLayoutState",
05532         /* Arg2 CreateXamlTypeCallback */
05533         []()
05534         {
05535             auto xamlType = winrt::make_self<XamlType>(
05536                 /* Arg 1 - TypeName */
05537                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.StackLayoutState",
05538                 /* Arg 2 - BaseTypeName */
05539                 (PCWSTR)L"Object",
05540                 /* Arg 3 - Activator func */
05541                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IStackLayoutStateFactory>(L"Microsoft.UI.Xaml.Controls.StackLayoutState"); },
05542                 /* Arg 4 - Populate properties func */
05543                 nullptr
05544             );
05545
05546             return static_cast<winrt::IXamlType>(*xamlType);
05547         }
05548     },
05549     {
05550         /* Arg1 TypeName */
05551         L"Microsoft.UI.Xaml.Controls.SwipeBehaviorOnInvoked",
05552         /* Arg2 CreateXamlTypeCallback */
05553         []()
05554         {
05555             auto xamlType = winrt::make<EnumXamlType>(
05556                 /* Arg 1 - TypeName */
05557                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SwipeBehaviorOnInvoked",
05558                 /* Arg 2 - CreateFromString func */
05559                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05560                 {
05561                     if (fromString == L"Auto") return box_value(winrt::SwipeBehaviorOnInvoked::Auto);
05562                     if (fromString == L"Close") return box_value(winrt::SwipeBehaviorOnInvoked::Close);
05563                     if (fromString == L"RemainOpen") return box_value(winrt::SwipeBehaviorOnInvoked::RemainOpen);
05564                     throw winrt::hresult_invalid_argument();
05565                 });
05566
05567             return xamlType;
05568         }
05569     },
05570     {
05571         /* Arg1 TypeName */
05572         L"Microsoft.UI.Xaml.Controls.SwipeControl",
05573         /* Arg2 CreateXamlTypeCallback */
05574         []()
05575         {
05576             auto xamlType = winrt::make_self<XamlType>(
05577                 /* Arg 1 - TypeName */
05578                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SwipeControl",
05579                 /* Arg 2 - BaseTypeName */
05580                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
05581                 /* Arg 3 - Activator func */
05582                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ISwipeControlFactory>(L"Microsoft.UI.Xaml.Controls.SwipeControl"); },
05583                 /* Arg 4 - Populate properties func */
05584                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05585                 {
05586                     winrt::ISwipeControlStatics statics = GetFactory<winrt::ISwipeControlStatics>(L"Microsoft.UI.Xaml.Controls.SwipeControl");
05587                     {
05588                         xamlType.AddDPMember(L"BottomItems", L"Microsoft.UI.Xaml.Controls.SwipeItems", statics.BottomItemsProperty(), false /* isContent */);
05589                         xamlType.AddDPMember(L"LeftItems", L"Microsoft.UI.Xaml.Controls.SwipeItems", statics.LeftItemsProperty(), false /* isContent */);
05590                         xamlType.AddDPMember(L"RightItems", L"Microsoft.UI.Xaml.Controls.SwipeItems", statics.RightItemsProperty(), false /* isContent */);
05591                         xamlType.AddDPMember(L"TopItems", L"Microsoft.UI.Xaml.Controls.SwipeItems", statics.TopItemsProperty(), false /* isContent */);
05592                     }
05593
05594                 });
05595
05596             return static_cast<winrt::IXamlType>(*xamlType);
05597         }
05598     },
05599     {
05600         /* Arg1 TypeName */
05601         L"Microsoft.UI.Xaml.Controls.SwipeItem",
05602         /* Arg2 CreateXamlTypeCallback */
05603         []()
05604         {
05605             auto xamlType = winrt::make_self<XamlType>(
05606                 /* Arg 1 - TypeName */
05607                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SwipeItem",
05608                 /* Arg 2 - BaseTypeName */
05609                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
05610                 /* Arg 3 - Activator func */
05611                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ISwipeItemFactory>(L"Microsoft.UI.Xaml.Controls.SwipeItem"); },
05612                 /* Arg 4 - Populate properties func */
05613                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05614                 {
05615                     winrt::ISwipeItemStatics statics = GetFactory<winrt::ISwipeItemStatics>(L"Microsoft.UI.Xaml.Controls.SwipeItem");
05616                     {
05617                         xamlType.AddDPMember(L"Background", L"Microsoft.UI.Xaml.Media.Brush", statics.BackgroundProperty(), false /* isContent */);
05618                         xamlType.AddDPMember(L"BehaviorOnInvoked", L"Microsoft.UI.Xaml.Controls.SwipeBehaviorOnInvoked", statics.BehaviorOnInvokedProperty(), false /* isContent */);
05619                         xamlType.AddDPMember(L"CommandParameter", L"Object", statics.CommandParameterProperty(), false /* isContent */);
05620                         xamlType.AddDPMember(L"Command", L"Microsoft.UI.Xaml.Input.ICommand", statics.CommandProperty(), false /* isContent */);
05621                         xamlType.AddDPMember(L"Foreground", L"Microsoft.UI.Xaml.Media.Brush", statics.ForegroundProperty(), false /* isContent */);
05622                         xamlType.AddDPMember(L"IconSource", L"Microsoft.UI.Xaml.Controls.IconSource", statics.IconSourceProperty(), false /* isContent */);
05623                         xamlType.AddDPMember(L"Text", L"String", statics.TextProperty(), false /* isContent */);
05624                     }
05625
05626                 });
05627
05628             return static_cast<winrt::IXamlType>(*xamlType);
05629         }
05630     },
05631     {
05632         /* Arg1 TypeName */
05633         L"Microsoft.UI.Xaml.Controls.SwipeItems",
05634         /* Arg2 CreateXamlTypeCallback */
05635         []()
05636         {
05637             auto xamlType = winrt::make_self<XamlType>(
05638                 /* Arg 1 - TypeName */
05639                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SwipeItems",
05640                 /* Arg 2 - BaseTypeName */
05641                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
05642                 /* Arg 3 - Activator func */
05643                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ISwipeItemsFactory>(L"Microsoft.UI.Xaml.Controls.SwipeItems"); },
05644                 /* Arg 4 - Populate properties func */
05645                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05646                 {
05647                     winrt::ISwipeItemsStatics statics = GetFactory<winrt::ISwipeItemsStatics>(L"Microsoft.UI.Xaml.Controls.SwipeItems");
05648                     {
05649                         xamlType.AddDPMember(L"Mode", L"Microsoft.UI.Xaml.Controls.SwipeMode", statics.ModeProperty(), false /* isContent */);
05650                     }
05651
05652                 });
05653
05654             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
05655             {
05656                 collection.as<winrt::Microsoft::UI::Xaml::Controls::SwipeItems>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::SwipeItem>(value));
05657             });
05658
05659             return static_cast<winrt::IXamlType>(*xamlType);
05660         }
05661     },
05662     {
05663         /* Arg1 TypeName */
05664         L"Microsoft.UI.Xaml.Controls.SwipeMode",
05665         /* Arg2 CreateXamlTypeCallback */
05666         []()
05667         {
05668             auto xamlType = winrt::make<EnumXamlType>(
05669                 /* Arg 1 - TypeName */
05670                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SwipeMode",
05671                 /* Arg 2 - CreateFromString func */
05672                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05673                 {
05674                     if (fromString == L"Reveal") return box_value(winrt::SwipeMode::Reveal);
05675                     if (fromString == L"Execute") return box_value(winrt::SwipeMode::Execute);
05676                     throw winrt::hresult_invalid_argument();
05677                 });
05678
05679             return xamlType;
05680         }
05681     },
05682     {
05683         /* Arg1 TypeName */
05684         L"Microsoft.UI.Xaml.Controls.TabView",
05685         /* Arg2 CreateXamlTypeCallback */
05686         []()
05687         {
05688             auto xamlType = winrt::make_self<XamlType>(
05689                 /* Arg 1 - TypeName */
05690                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TabView",
05691                 /* Arg 2 - BaseTypeName */
05692                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
05693                 /* Arg 3 - Activator func */
05694                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITabViewFactory>(L"Microsoft.UI.Xaml.Controls.TabView"); },
05695                 /* Arg 4 - Populate properties func */
05696                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05697                 {
05698                     winrt::ITabViewStatics statics = GetFactory<winrt::ITabViewStatics>(L"Microsoft.UI.Xaml.Controls.TabView");
05699                     {
05700                         xamlType.AddDPMember(L"AddTabButtonCommandParameter", L"Object", statics.AddTabButtonCommandParameterProperty(), false /* isContent */);
05701                         xamlType.AddDPMember(L"AddTabButtonCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.AddTabButtonCommandProperty(), false /* isContent */);
05702                         xamlType.AddDPMember(L"AllowDropTabs", L"Boolean", statics.AllowDropTabsProperty(), false /* isContent */);
05703                         xamlType.AddDPMember(L"CanDragTabs", L"Boolean", statics.CanDragTabsProperty(), false /* isContent */);
05704                         xamlType.AddDPMember(L"CanReorderTabs", L"Boolean", statics.CanReorderTabsProperty(), false /* isContent */);
05705                         xamlType.AddDPMember(L"CloseButtonOverlayMode", L"Microsoft.UI.Xaml.Controls.TabViewCloseButtonOverlayMode", statics.CloseButtonOverlayModeProperty(), false /* isContent */);
05706                         xamlType.AddDPMember(L"IsAddTabButtonVisible", L"Boolean", statics.IsAddTabButtonVisibleProperty(), false /* isContent */);
05707                         xamlType.AddDPMember(L"SelectedIndex", L"Int32", statics.SelectedIndexProperty(), false /* isContent */);
05708                         xamlType.AddDPMember(L"SelectedItem", L"Object", statics.SelectedItemProperty(), false /* isContent */);
05709                         xamlType.AddDPMember(L"TabItemTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.TabItemTemplateProperty(), false /* isContent */);
05710                         xamlType.AddDPMember(L"TabItemTemplateSelector", L"Microsoft.UI.Xaml.Controls.DataTemplateSelector", statics.TabItemTemplateSelectorProperty(), false /* isContent */);
05711                         xamlType.AddDPMember(L"TabItems", L"Windows.Foundation.Collections.IVector`1<Object>", statics.TabItemsProperty(), true /* isContent */);
05712                         xamlType.AddDPMember(L"TabItemsSource", L"Object", statics.TabItemsSourceProperty(), false /* isContent */);
05713                         xamlType.AddDPMember(L"TabStripFooter", L"Object", statics.TabStripFooterProperty(), false /* isContent */);
05714                         xamlType.AddDPMember(L"TabStripFooterTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.TabStripFooterTemplateProperty(), false /* isContent */);
05715                         xamlType.AddDPMember(L"TabStripHeader", L"Object", statics.TabStripHeaderProperty(), false /* isContent */);
05716                         xamlType.AddDPMember(L"TabStripHeaderTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.TabStripHeaderTemplateProperty(), false /* isContent */);
05717                         xamlType.AddDPMember(L"TabWidthMode", L"Microsoft.UI.Xaml.Controls.TabViewWidthMode", statics.TabWidthModeProperty(), false /* isContent */);
05718                     }
05719
05720                     winrt::ITabViewStatics2 statics2 = GetFactory<winrt::ITabViewStatics2>(L"Microsoft.UI.Xaml.Controls.TabView");
05721                     {
05722                         xamlType.AddDPMember(L"CanTearOutTabs", L"Boolean", statics2.CanTearOutTabsProperty(), false /* isContent */);
05723                     }
05724
05725                 });
05726
05727             return static_cast<winrt::IXamlType>(*xamlType);
05728         }
05729     },
05730     {
05731         /* Arg1 TypeName */
05732         L"Microsoft.UI.Xaml.Controls.TabViewCloseButtonOverlayMode",
05733         /* Arg2 CreateXamlTypeCallback */
05734         []()
05735         {
05736             auto xamlType = winrt::make<EnumXamlType>(
05737                 /* Arg 1 - TypeName */
05738                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TabViewCloseButtonOverlayMode",
05739                 /* Arg 2 - CreateFromString func */
05740                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05741                 {
05742                     if (fromString == L"Auto") return box_value(winrt::TabViewCloseButtonOverlayMode::Auto);
05743                     if (fromString == L"OnPointerOver") return box_value(winrt::TabViewCloseButtonOverlayMode::OnPointerOver);
05744                     if (fromString == L"Always") return box_value(winrt::TabViewCloseButtonOverlayMode::Always);
05745                     throw winrt::hresult_invalid_argument();
05746                 });
05747
05748             return xamlType;
05749         }
05750     },
05751     {
05752         /* Arg1 TypeName */
05753         L"Microsoft.UI.Xaml.Controls.TabViewItem",
05754         /* Arg2 CreateXamlTypeCallback */
05755         []()
05756         {
05757             auto xamlType = winrt::make_self<XamlType>(
05758                 /* Arg 1 - TypeName */
05759                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TabViewItem",
05760                 /* Arg 2 - BaseTypeName */
05761                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ListViewItem",
05762                 /* Arg 3 - Activator func */
05763                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITabViewItemFactory>(L"Microsoft.UI.Xaml.Controls.TabViewItem"); },
05764                 /* Arg 4 - Populate properties func */
05765                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05766                 {
05767                     winrt::ITabViewItemStatics statics = GetFactory<winrt::ITabViewItemStatics>(L"Microsoft.UI.Xaml.Controls.TabViewItem");
05768                     {
05769                         xamlType.AddDPMember(L"Header", L"Object", statics.HeaderProperty(), false /* isContent */);
05770                         xamlType.AddDPMember(L"HeaderTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics.HeaderTemplateProperty(), false /* isContent */);
05771                         xamlType.AddDPMember(L"IconSource", L"Microsoft.UI.Xaml.Controls.IconSource", statics.IconSourceProperty(), false /* isContent */);
05772                         xamlType.AddDPMember(L"IsClosable", L"Boolean", statics.IsClosableProperty(), false /* isContent */);
05773                         xamlType.AddDPMember(L"TabViewTemplateSettings", L"Microsoft.UI.Xaml.Controls.TabViewItemTemplateSettings", statics.TabViewTemplateSettingsProperty(), false /* isContent */);
05774                     }
05775
05776                 });
05777
05778             return static_cast<winrt::IXamlType>(*xamlType);
05779         }
05780     },
05781     {
05782         /* Arg1 TypeName */
05783         L"Microsoft.UI.Xaml.Controls.TabViewItemTemplateSettings",
05784         /* Arg2 CreateXamlTypeCallback */
05785         []()
05786         {
05787             auto xamlType = winrt::make_self<XamlType>(
05788                 /* Arg 1 - TypeName */
05789                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TabViewItemTemplateSettings",
05790                 /* Arg 2 - BaseTypeName */
05791                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
05792                 /* Arg 3 - Activator func */
05793                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITabViewItemTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.TabViewItemTemplateSettings"); },
05794                 /* Arg 4 - Populate properties func */
05795                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05796                 {
05797                     winrt::ITabViewItemTemplateSettingsStatics statics = GetFactory<winrt::ITabViewItemTemplateSettingsStatics>(L"Microsoft.UI.Xaml.Controls.TabViewItemTemplateSettings");
05798                     {
05799                         xamlType.AddDPMember(L"IconElement", L"Microsoft.UI.Xaml.Controls.IconElement", statics.IconElementProperty(), false /* isContent */);
05800                     }
05801
05802                     winrt::ITabViewItemTemplateSettingsStatics2 statics2 = GetFactory<winrt::ITabViewItemTemplateSettingsStatics2>(L"Microsoft.UI.Xaml.Controls.TabViewItemTemplateSettings");
05803                     {
05804                         xamlType.AddDPMember(L"TabGeometry", L"Microsoft.UI.Xaml.Media.Geometry", statics2.TabGeometryProperty(), false /* isContent */);
05805                     }
05806
05807                 });
05808
05809             return static_cast<winrt::IXamlType>(*xamlType);
05810         }
05811     },
05812     {
05813         /* Arg1 TypeName */
05814         L"Microsoft.UI.Xaml.Controls.TabViewWidthMode",
05815         /* Arg2 CreateXamlTypeCallback */
05816         []()
05817         {
05818             auto xamlType = winrt::make<EnumXamlType>(
05819                 /* Arg 1 - TypeName */
05820                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TabViewWidthMode",
05821                 /* Arg 2 - CreateFromString func */
05822                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05823                 {
05824                     if (fromString == L"Equal") return box_value(winrt::TabViewWidthMode::Equal);
05825                     if (fromString == L"SizeToContent") return box_value(winrt::TabViewWidthMode::SizeToContent);
05826                     if (fromString == L"Compact") return box_value(winrt::TabViewWidthMode::Compact);
05827                     throw winrt::hresult_invalid_argument();
05828                 });
05829
05830             return xamlType;
05831         }
05832     },
05833     {
05834         /* Arg1 TypeName */
05835         L"Microsoft.UI.Xaml.Controls.TeachingTip",
05836         /* Arg2 CreateXamlTypeCallback */
05837         []()
05838         {
05839             auto xamlType = winrt::make_self<XamlType>(
05840                 /* Arg 1 - TypeName */
05841                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TeachingTip",
05842                 /* Arg 2 - BaseTypeName */
05843                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl",
05844                 /* Arg 3 - Activator func */
05845                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITeachingTipFactory>(L"Microsoft.UI.Xaml.Controls.TeachingTip"); },
05846                 /* Arg 4 - Populate properties func */
05847                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05848                 {
05849                     winrt::ITeachingTipStatics statics = GetFactory<winrt::ITeachingTipStatics>(L"Microsoft.UI.Xaml.Controls.TeachingTip");
05850                     {
05851                         xamlType.AddDPMember(L"ActionButtonCommandParameter", L"Object", statics.ActionButtonCommandParameterProperty(), false /* isContent */);
05852                         xamlType.AddDPMember(L"ActionButtonCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.ActionButtonCommandProperty(), false /* isContent */);
05853                         xamlType.AddDPMember(L"ActionButtonContent", L"Object", statics.ActionButtonContentProperty(), false /* isContent */);
05854                         xamlType.AddDPMember(L"ActionButtonStyle", L"Microsoft.UI.Xaml.Style", statics.ActionButtonStyleProperty(), false /* isContent */);
05855                         xamlType.AddDPMember(L"CloseButtonCommandParameter", L"Object", statics.CloseButtonCommandParameterProperty(), false /* isContent */);
05856                         xamlType.AddDPMember(L"CloseButtonCommand", L"Microsoft.UI.Xaml.Input.ICommand", statics.CloseButtonCommandProperty(), false /* isContent */);
05857                         xamlType.AddDPMember(L"CloseButtonContent", L"Object", statics.CloseButtonContentProperty(), false /* isContent */);
05858                         xamlType.AddDPMember(L"CloseButtonStyle", L"Microsoft.UI.Xaml.Style", statics.CloseButtonStyleProperty(), false /* isContent */);
05859                         xamlType.AddDPMember(L"HeroContentPlacement", L"Microsoft.UI.Xaml.Controls.TeachingTipHeroContentPlacementMode", statics.HeroContentPlacementProperty(), false /* isContent */);
05860                         xamlType.AddDPMember(L"HeroContent", L"Microsoft.UI.Xaml.UIElement", statics.HeroContentProperty(), false /* isContent */);
05861                         xamlType.AddDPMember(L"IconSource", L"Microsoft.UI.Xaml.Controls.IconSource", statics.IconSourceProperty(), false /* isContent */);
05862                         xamlType.AddDPMember(L"IsLightDismissEnabled", L"Boolean", statics.IsLightDismissEnabledProperty(), false /* isContent */);
05863                         xamlType.AddDPMember(L"IsOpen", L"Boolean", statics.IsOpenProperty(), false /* isContent */);
05864                         xamlType.AddDPMember(L"PlacementMargin", L"Microsoft.UI.Xaml.Thickness", statics.PlacementMarginProperty(), false /* isContent */);
05865                         xamlType.AddDPMember(L"PreferredPlacement", L"Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode", statics.PreferredPlacementProperty(), false /* isContent */);
05866                         xamlType.AddDPMember(L"ShouldConstrainToRootBounds", L"Boolean", statics.ShouldConstrainToRootBoundsProperty(), false /* isContent */);
05867                         xamlType.AddDPMember(L"Subtitle", L"String", statics.SubtitleProperty(), false /* isContent */);
05868                         xamlType.AddDPMember(L"TailVisibility", L"Microsoft.UI.Xaml.Controls.TeachingTipTailVisibility", statics.TailVisibilityProperty(), false /* isContent */);
05869                         xamlType.AddDPMember(L"Target", L"Microsoft.UI.Xaml.FrameworkElement", statics.TargetProperty(), false /* isContent */);
05870                         xamlType.AddDPMember(L"TemplateSettings", L"Microsoft.UI.Xaml.Controls.TeachingTipTemplateSettings", statics.TemplateSettingsProperty(), false /* isContent */);
05871                         xamlType.AddDPMember(L"Title", L"String", statics.TitleProperty(), false /* isContent */);
05872                     }
05873
05874                 });
05875
05876             return static_cast<winrt::IXamlType>(*xamlType);
05877         }
05878     },
05879     {
05880         /* Arg1 TypeName */
05881         L"Microsoft.UI.Xaml.Controls.TeachingTipCloseReason",
05882         /* Arg2 CreateXamlTypeCallback */
05883         []()
05884         {
05885             auto xamlType = winrt::make<EnumXamlType>(
05886                 /* Arg 1 - TypeName */
05887                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TeachingTipCloseReason",
05888                 /* Arg 2 - CreateFromString func */
05889                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05890                 {
05891                     if (fromString == L"CloseButton") return box_value(winrt::TeachingTipCloseReason::CloseButton);
05892                     if (fromString == L"LightDismiss") return box_value(winrt::TeachingTipCloseReason::LightDismiss);
05893                     if (fromString == L"Programmatic") return box_value(winrt::TeachingTipCloseReason::Programmatic);
05894                     throw winrt::hresult_invalid_argument();
05895                 });
05896
05897             return xamlType;
05898         }
05899     },
05900     {
05901         /* Arg1 TypeName */
05902         L"Microsoft.UI.Xaml.Controls.TeachingTipHeroContentPlacementMode",
05903         /* Arg2 CreateXamlTypeCallback */
05904         []()
05905         {
05906             auto xamlType = winrt::make<EnumXamlType>(
05907                 /* Arg 1 - TypeName */
05908                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TeachingTipHeroContentPlacementMode",
05909                 /* Arg 2 - CreateFromString func */
05910                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05911                 {
05912                     if (fromString == L"Auto") return box_value(winrt::TeachingTipHeroContentPlacementMode::Auto);
05913                     if (fromString == L"Top") return box_value(winrt::TeachingTipHeroContentPlacementMode::Top);
05914                     if (fromString == L"Bottom") return box_value(winrt::TeachingTipHeroContentPlacementMode::Bottom);
05915                     throw winrt::hresult_invalid_argument();
05916                 });
05917
05918             return xamlType;
05919         }
05920     },
05921     {
05922         /* Arg1 TypeName */
05923         L"Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode",
05924         /* Arg2 CreateXamlTypeCallback */
05925         []()
05926         {
05927             auto xamlType = winrt::make<EnumXamlType>(
05928                 /* Arg 1 - TypeName */
05929                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode",
05930                 /* Arg 2 - CreateFromString func */
05931                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05932                 {
05933                     if (fromString == L"Auto") return box_value(winrt::TeachingTipPlacementMode::Auto);
05934                     if (fromString == L"Top") return box_value(winrt::TeachingTipPlacementMode::Top);
05935                     if (fromString == L"Bottom") return box_value(winrt::TeachingTipPlacementMode::Bottom);
05936                     if (fromString == L"Left") return box_value(winrt::TeachingTipPlacementMode::Left);
05937                     if (fromString == L"Right") return box_value(winrt::TeachingTipPlacementMode::Right);
05938                     if (fromString == L"TopRight") return box_value(winrt::TeachingTipPlacementMode::TopRight);
05939                     if (fromString == L"TopLeft") return box_value(winrt::TeachingTipPlacementMode::TopLeft);
05940                     if (fromString == L"BottomRight") return box_value(winrt::TeachingTipPlacementMode::BottomRight);
05941                     if (fromString == L"BottomLeft") return box_value(winrt::TeachingTipPlacementMode::BottomLeft);
05942                     if (fromString == L"LeftTop") return box_value(winrt::TeachingTipPlacementMode::LeftTop);
05943                     if (fromString == L"LeftBottom") return box_value(winrt::TeachingTipPlacementMode::LeftBottom);
05944                     if (fromString == L"RightTop") return box_value(winrt::TeachingTipPlacementMode::RightTop);
05945                     if (fromString == L"RightBottom") return box_value(winrt::TeachingTipPlacementMode::RightBottom);
05946                     if (fromString == L"Center") return box_value(winrt::TeachingTipPlacementMode::Center);
05947                     throw winrt::hresult_invalid_argument();
05948                 });
05949
05950             return xamlType;
05951         }
05952     },
05953     {
05954         /* Arg1 TypeName */
05955         L"Microsoft.UI.Xaml.Controls.TeachingTipTailVisibility",
05956         /* Arg2 CreateXamlTypeCallback */
05957         []()
05958         {
05959             auto xamlType = winrt::make<EnumXamlType>(
05960                 /* Arg 1 - TypeName */
05961                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TeachingTipTailVisibility",
05962                 /* Arg 2 - CreateFromString func */
05963                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
05964                 {
05965                     if (fromString == L"Auto") return box_value(winrt::TeachingTipTailVisibility::Auto);
05966                     if (fromString == L"Visible") return box_value(winrt::TeachingTipTailVisibility::Visible);
05967                     if (fromString == L"Collapsed") return box_value(winrt::TeachingTipTailVisibility::Collapsed);
05968                     throw winrt::hresult_invalid_argument();
05969                 });
05970
05971             return xamlType;
05972         }
05973     },
05974     {
05975         /* Arg1 TypeName */
05976         L"Microsoft.UI.Xaml.Controls.TeachingTipTemplateSettings",
05977         /* Arg2 CreateXamlTypeCallback */
05978         []()
05979         {
05980             auto xamlType = winrt::make_self<XamlType>(
05981                 /* Arg 1 - TypeName */
05982                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TeachingTipTemplateSettings",
05983                 /* Arg 2 - BaseTypeName */
05984                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
05985                 /* Arg 3 - Activator func */
05986                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITeachingTipTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.TeachingTipTemplateSettings"); },
05987                 /* Arg 4 - Populate properties func */
05988                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
05989                 {
05990                     winrt::ITeachingTipTemplateSettingsStatics statics = GetFactory<winrt::ITeachingTipTemplateSettingsStatics>(L"Microsoft.UI.Xaml.Controls.TeachingTipTemplateSettings");
05991                     {
05992                         xamlType.AddDPMember(L"IconElement", L"Microsoft.UI.Xaml.Controls.IconElement", statics.IconElementProperty(), false /* isContent */);
05993                         xamlType.AddDPMember(L"TopLeftHighlightMargin", L"Microsoft.UI.Xaml.Thickness", statics.TopLeftHighlightMarginProperty(), false /* isContent */);
05994                         xamlType.AddDPMember(L"TopRightHighlightMargin", L"Microsoft.UI.Xaml.Thickness", statics.TopRightHighlightMarginProperty(), false /* isContent */);
05995                     }
05996
05997                 });
05998
05999             return static_cast<winrt::IXamlType>(*xamlType);
06000         }
06001     },
06002     {
06003         /* Arg1 TypeName */
06004         L"Microsoft.UI.Xaml.Controls.TextCommandBarFlyout",
06005         /* Arg2 CreateXamlTypeCallback */
06006         []()
06007         {
06008             auto xamlType = winrt::make_self<XamlType>(
06009                 /* Arg 1 - TypeName */
06010                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TextCommandBarFlyout",
06011                 /* Arg 2 - BaseTypeName */
06012                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.CommandBarFlyout",
06013                 /* Arg 3 - Activator func */
06014                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITextCommandBarFlyoutFactory>(L"Microsoft.UI.Xaml.Controls.TextCommandBarFlyout"); },
06015                 /* Arg 4 - Populate properties func */
06016                 nullptr
06017             );
06018
06019             return static_cast<winrt::IXamlType>(*xamlType);
06020         }
06021     },
06022     {
06023         /* Arg1 TypeName */
06024         L"Microsoft.UI.Xaml.Controls.TitleBar",
06025         /* Arg2 CreateXamlTypeCallback */
06026         []()
06027         {
06028             auto xamlType = winrt::make_self<XamlType>(
06029                 /* Arg 1 - TypeName */
06030                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TitleBar",
06031                 /* Arg 2 - BaseTypeName */
06032                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
06033                 /* Arg 3 - Activator func */
06034                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITitleBarFactory>(L"Microsoft.UI.Xaml.Controls.TitleBar"); },
06035                 /* Arg 4 - Populate properties func */
06036                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06037                 {
06038                     winrt::ITitleBarStatics statics = GetFactory<winrt::ITitleBarStatics>(L"Microsoft.UI.Xaml.Controls.TitleBar");
06039                     {
06040                         xamlType.AddDPMember(L"Content", L"Object", statics.ContentProperty(), true /* isContent */);
06041                         xamlType.AddDPMember(L"Footer", L"Object", statics.FooterProperty(), false /* isContent */);
06042                         xamlType.AddDPMember(L"Header", L"Object", statics.HeaderProperty(), false /* isContent */);
06043                         xamlType.AddDPMember(L"IconSource", L"Microsoft.UI.Xaml.Controls.IconSource", statics.IconSourceProperty(), false /* isContent */);
06044                         xamlType.AddDPMember(L"IsBackButtonVisible", L"Boolean", statics.IsBackButtonVisibleProperty(), false /* isContent */);
06045                         xamlType.AddDPMember(L"IsBackEnabled", L"Boolean", statics.IsBackEnabledProperty(), false /* isContent */);
06046                         xamlType.AddDPMember(L"IsPaneToggleButtonVisible", L"Boolean", statics.IsPaneToggleButtonVisibleProperty(), false /* isContent */);
06047                         xamlType.AddDPMember(L"Subtitle", L"String", statics.SubtitleProperty(), false /* isContent */);
06048                         xamlType.AddDPMember(L"TemplateSettings", L"Microsoft.UI.Xaml.Controls.TitleBarTemplateSettings", statics.TemplateSettingsProperty(), false /* isContent */);
06049                         xamlType.AddDPMember(L"Title", L"String", statics.TitleProperty(), false /* isContent */);
06050                     }
06051
06052                 });
06053
06054             return static_cast<winrt::IXamlType>(*xamlType);
06055         }
06056     },
06057     {
06058         /* Arg1 TypeName */
06059         L"Microsoft.UI.Xaml.Controls.TitleBarTemplateSettings",
06060         /* Arg2 CreateXamlTypeCallback */
06061         []()
06062         {
06063             auto xamlType = winrt::make_self<XamlType>(
06064                 /* Arg 1 - TypeName */
06065                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TitleBarTemplateSettings",
06066                 /* Arg 2 - BaseTypeName */
06067                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
06068                 /* Arg 3 - Activator func */
06069                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITitleBarTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.TitleBarTemplateSettings"); },
06070                 /* Arg 4 - Populate properties func */
06071                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06072                 {
06073                     winrt::ITitleBarTemplateSettingsStatics statics = GetFactory<winrt::ITitleBarTemplateSettingsStatics>(L"Microsoft.UI.Xaml.Controls.TitleBarTemplateSettings");
06074                     {
06075                         xamlType.AddDPMember(L"IconElement", L"Microsoft.UI.Xaml.Controls.IconElement", statics.IconElementProperty(), false /* isContent */);
06076                     }
06077
06078                 });
06079
06080             return static_cast<winrt::IXamlType>(*xamlType);
06081         }
06082     },
06083     {
06084         /* Arg1 TypeName */
06085         L"Microsoft.UI.Xaml.Controls.ToggleSplitButton",
06086         /* Arg2 CreateXamlTypeCallback */
06087         []()
06088         {
06089             auto xamlType = winrt::make_self<XamlType>(
06090                 /* Arg 1 - TypeName */
06091                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ToggleSplitButton",
06092                 /* Arg 2 - BaseTypeName */
06093                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.SplitButton",
06094                 /* Arg 3 - Activator func */
06095                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IToggleSplitButtonFactory>(L"Microsoft.UI.Xaml.Controls.ToggleSplitButton"); },
06096                 /* Arg 4 - Populate properties func */
06097                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06098                 {
06099                     winrt::IToggleSplitButtonStatics statics = GetFactory<winrt::IToggleSplitButtonStatics>(L"Microsoft.UI.Xaml.Controls.ToggleSplitButton");
06100                     {
06101                         xamlType.AddDPMember(L"IsChecked", L"Boolean", statics.IsCheckedProperty(), false /* isContent */);
06102                     }
06103
06104                 });
06105
06106             return static_cast<winrt::IXamlType>(*xamlType);
06107         }
06108     },
06109     {
06110         /* Arg1 TypeName */
06111         L"Microsoft.UI.Xaml.Controls.TreeView",
06112         /* Arg2 CreateXamlTypeCallback */
06113         []()
06114         {
06115             auto xamlType = winrt::make_self<XamlType>(
06116                 /* Arg 1 - TypeName */
06117                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TreeView",
06118                 /* Arg 2 - BaseTypeName */
06119                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
06120                 /* Arg 3 - Activator func */
06121                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITreeViewFactory>(L"Microsoft.UI.Xaml.Controls.TreeView"); },
06122                 /* Arg 4 - Populate properties func */
06123                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06124                 {
06125                     winrt::ITreeViewStatics statics = GetFactory<winrt::ITreeViewStatics>(L"Microsoft.UI.Xaml.Controls.TreeView");
06126                     {
06127                         xamlType.AddDPMember(L"SelectedItem", L"Object", statics.SelectedItemProperty(), false /* isContent */);
06128                         xamlType.AddDPMember(L"SelectionMode", L"Microsoft.UI.Xaml.Controls.TreeViewSelectionMode", statics.SelectionModeProperty(), false /* isContent */);
06129                     }
06130
06131                     winrt::ITreeViewStatics2 statics2 = GetFactory<winrt::ITreeViewStatics2>(L"Microsoft.UI.Xaml.Controls.TreeView");
06132                     {
06133                         xamlType.AddDPMember(L"CanDragItems", L"Boolean", statics2.CanDragItemsProperty(), false /* isContent */);
06134                         xamlType.AddDPMember(L"CanReorderItems", L"Boolean", statics2.CanReorderItemsProperty(), false /* isContent */);
06135                         xamlType.AddDPMember(L"ItemContainerStyle", L"Microsoft.UI.Xaml.Style", statics2.ItemContainerStyleProperty(), false /* isContent */);
06136                         xamlType.AddDPMember(L"ItemContainerStyleSelector", L"Microsoft.UI.Xaml.Controls.StyleSelector", statics2.ItemContainerStyleSelectorProperty(), false /* isContent */);
06137                         xamlType.AddDPMember(L"ItemContainerTransitions", L"Microsoft.UI.Xaml.Media.Animation.TransitionCollection", statics2.ItemContainerTransitionsProperty(), false /* isContent */);
06138                         xamlType.AddDPMember(L"ItemTemplate", L"Microsoft.UI.Xaml.DataTemplate", statics2.ItemTemplateProperty(), false /* isContent */);
06139                         xamlType.AddDPMember(L"ItemTemplateSelector", L"Microsoft.UI.Xaml.Controls.DataTemplateSelector", statics2.ItemTemplateSelectorProperty(), false /* isContent */);
06140                         xamlType.AddDPMember(L"ItemsSource", L"Object", statics2.ItemsSourceProperty(), false /* isContent */);
06141                     }
06142
06143                     xamlType.AddMember(
06144                         L"RootNodes", /* propertyName */
06145                         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.TreeViewNode>", /* propertyType */
06146                         [](winrt::IInspectable instance) { return instance.as<winrt::TreeView>().RootNodes(); },
06147                         nullptr, /* setter */
06148                         false, /* isContent */
06149                         false, /* isDependencyProperty */
06150                         false /* isAttachable */);
06151                     xamlType.AddMember(
06152                         L"SelectedNodes", /* propertyName */
06153                         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.TreeViewNode>", /* propertyType */
06154                         [](winrt::IInspectable instance) { return instance.as<winrt::TreeView>().SelectedNodes(); },
06155                         nullptr, /* setter */
06156                         false, /* isContent */
06157                         false, /* isDependencyProperty */
06158                         false /* isAttachable */);
06159                     xamlType.AddMember(
06160                         L"SelectedNode", /* propertyName */
06161                         L"Microsoft.UI.Xaml.Controls.TreeViewNode", /* propertyType */
06162                         [](winrt::IInspectable instance) { return instance.as<winrt::TreeView>().SelectedNode(); },
06163                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::TreeView>().SelectedNode(value.as<winrt::Microsoft::UI::Xaml::Controls::TreeViewNode>()); },
06164                         false, /* isContent */
06165                         false, /* isDependencyProperty */
06166                         false /* isAttachable */);
06167                     xamlType.AddMember(
06168                         L"SelectedItems", /* propertyName */
06169                         L"Windows.Foundation.Collections.IVector`1<Object>", /* propertyType */
06170                         [](winrt::IInspectable instance) { return instance.as<winrt::TreeView>().SelectedItems(); },
06171                         nullptr, /* setter */
06172                         false, /* isContent */
06173                         false, /* isDependencyProperty */
06174                         false /* isAttachable */);
06175                 });
06176
06177             return static_cast<winrt::IXamlType>(*xamlType);
06178         }
06179     },
06180     {
06181         /* Arg1 TypeName */
06182         L"Microsoft.UI.Xaml.Controls.TreeViewItem",
06183         /* Arg2 CreateXamlTypeCallback */
06184         []()
06185         {
06186             auto xamlType = winrt::make_self<XamlType>(
06187                 /* Arg 1 - TypeName */
06188                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TreeViewItem",
06189                 /* Arg 2 - BaseTypeName */
06190                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ListViewItem",
06191                 /* Arg 3 - Activator func */
06192                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITreeViewItemFactory>(L"Microsoft.UI.Xaml.Controls.TreeViewItem"); },
06193                 /* Arg 4 - Populate properties func */
06194                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06195                 {
06196                     winrt::ITreeViewItemStatics statics = GetFactory<winrt::ITreeViewItemStatics>(L"Microsoft.UI.Xaml.Controls.TreeViewItem");
06197                     {
06198                         xamlType.AddDPMember(L"CollapsedGlyph", L"String", statics.CollapsedGlyphProperty(), false /* isContent */);
06199                         xamlType.AddDPMember(L"ExpandedGlyph", L"String", statics.ExpandedGlyphProperty(), false /* isContent */);
06200                         xamlType.AddDPMember(L"GlyphBrush", L"Microsoft.UI.Xaml.Media.Brush", statics.GlyphBrushProperty(), false /* isContent */);
06201                         xamlType.AddDPMember(L"GlyphOpacity", L"Double", statics.GlyphOpacityProperty(), false /* isContent */);
06202                         xamlType.AddDPMember(L"GlyphSize", L"Double", statics.GlyphSizeProperty(), false /* isContent */);
06203                         xamlType.AddDPMember(L"IsExpanded", L"Boolean", statics.IsExpandedProperty(), false /* isContent */);
06204                         xamlType.AddDPMember(L"TreeViewItemTemplateSettings", L"Microsoft.UI.Xaml.Controls.TreeViewItemTemplateSettings", statics.TreeViewItemTemplateSettingsProperty(), false /* isContent */);
06205                     }
06206
06207                     winrt::ITreeViewItemStatics2 statics2 = GetFactory<winrt::ITreeViewItemStatics2>(L"Microsoft.UI.Xaml.Controls.TreeViewItem");
06208                     {
06209                         xamlType.AddDPMember(L"HasUnrealizedChildren", L"Boolean", statics2.HasUnrealizedChildrenProperty(), false /* isContent */);
06210                         xamlType.AddDPMember(L"ItemsSource", L"Object", statics2.ItemsSourceProperty(), false /* isContent */);
06211                     }
06212
06213                 });
06214
06215             return static_cast<winrt::IXamlType>(*xamlType);
06216         }
06217     },
06218     {
06219         /* Arg1 TypeName */
06220         L"Microsoft.UI.Xaml.Controls.TreeViewItemTemplateSettings",
06221         /* Arg2 CreateXamlTypeCallback */
06222         []()
06223         {
06224             auto xamlType = winrt::make_self<XamlType>(
06225                 /* Arg 1 - TypeName */
06226                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TreeViewItemTemplateSettings",
06227                 /* Arg 2 - BaseTypeName */
06228                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
06229                 /* Arg 3 - Activator func */
06230                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITreeViewItemTemplateSettingsFactory>(L"Microsoft.UI.Xaml.Controls.TreeViewItemTemplateSettings"); },
06231                 /* Arg 4 - Populate properties func */
06232                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06233                 {
06234                     winrt::ITreeViewItemTemplateSettingsStatics statics = GetFactory<winrt::ITreeViewItemTemplateSettingsStatics>(L"Microsoft.UI.Xaml.Controls.TreeViewItemTemplateSettings");
06235                     {
06236                         xamlType.AddDPMember(L"CollapsedGlyphVisibility", L"Microsoft.UI.Xaml.Visibility", statics.CollapsedGlyphVisibilityProperty(), false /* isContent */);
06237                         xamlType.AddDPMember(L"DragItemsCount", L"Int32", statics.DragItemsCountProperty(), false /* isContent */);
06238                         xamlType.AddDPMember(L"ExpandedGlyphVisibility", L"Microsoft.UI.Xaml.Visibility", statics.ExpandedGlyphVisibilityProperty(), false /* isContent */);
06239                         xamlType.AddDPMember(L"Indentation", L"Microsoft.UI.Xaml.Thickness", statics.IndentationProperty(), false /* isContent */);
06240                     }
06241
06242                 });
06243
06244             return static_cast<winrt::IXamlType>(*xamlType);
06245         }
06246     },
06247     {
06248         /* Arg1 TypeName */
06249         L"Microsoft.UI.Xaml.Controls.TreeViewList",
06250         /* Arg2 CreateXamlTypeCallback */
06251         []()
06252         {
06253             auto xamlType = winrt::make_self<XamlType>(
06254                 /* Arg 1 - TypeName */
06255                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TreeViewList",
06256                 /* Arg 2 - BaseTypeName */
06257                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.ListView",
06258                 /* Arg 3 - Activator func */
06259                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITreeViewListFactory>(L"Microsoft.UI.Xaml.Controls.TreeViewList"); },
06260                 /* Arg 4 - Populate properties func */
06261                 nullptr
06262             );
06263
06264             return static_cast<winrt::IXamlType>(*xamlType);
06265         }
06266     },
06267     {
06268         /* Arg1 TypeName */
06269         L"Microsoft.UI.Xaml.Controls.TreeViewNode",
06270         /* Arg2 CreateXamlTypeCallback */
06271         []()
06272         {
06273             auto xamlType = winrt::make_self<XamlType>(
06274                 /* Arg 1 - TypeName */
06275                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TreeViewNode",
06276                 /* Arg 2 - BaseTypeName */
06277                 (PCWSTR)L"Microsoft.UI.Xaml.DependencyObject",
06278                 /* Arg 3 - Activator func */
06279                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITreeViewNodeFactory>(L"Microsoft.UI.Xaml.Controls.TreeViewNode"); },
06280                 /* Arg 4 - Populate properties func */
06281                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06282                 {
06283                     winrt::ITreeViewNodeStatics statics = GetFactory<winrt::ITreeViewNodeStatics>(L"Microsoft.UI.Xaml.Controls.TreeViewNode");
06284                     {
06285                         xamlType.AddDPMember(L"Content", L"Object", statics.ContentProperty(), false /* isContent */);
06286                         xamlType.AddDPMember(L"Depth", L"Int32", statics.DepthProperty(), false /* isContent */);
06287                         xamlType.AddDPMember(L"HasChildren", L"Boolean", statics.HasChildrenProperty(), false /* isContent */);
06288                         xamlType.AddDPMember(L"IsExpanded", L"Boolean", statics.IsExpandedProperty(), false /* isContent */);
06289                     }
06290
06291                     xamlType.AddMember(
06292                         L"HasUnrealizedChildren", /* propertyName */
06293                         L"Boolean", /* propertyType */
06294                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::TreeViewNode>().HasUnrealizedChildren()); },
06295                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::TreeViewNode>().HasUnrealizedChildren(unbox_value<bool>(value)); },
06296                         false, /* isContent */
06297                         false, /* isDependencyProperty */
06298                         false /* isAttachable */);
06299                     xamlType.AddMember(
06300                         L"Children", /* propertyName */
06301                         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.TreeViewNode>", /* propertyType */
06302                         [](winrt::IInspectable instance) { return instance.as<winrt::TreeViewNode>().Children(); },
06303                         nullptr, /* setter */
06304                         false, /* isContent */
06305                         false, /* isDependencyProperty */
06306                         false /* isAttachable */);
06307                     xamlType.AddMember(
06308                         L"Parent", /* propertyName */
06309                         L"Microsoft.UI.Xaml.Controls.TreeViewNode", /* propertyType */
06310                         [](winrt::IInspectable instance) { return instance.as<winrt::TreeViewNode>().Parent(); },
06311                         nullptr, /* setter */
06312                         false, /* isContent */
06313                         false, /* isDependencyProperty */
06314                         false /* isAttachable */);
06315                 });
06316
06317             xamlType->SetIsBindable(true);
06318
06319             return static_cast<winrt::IXamlType>(*xamlType);
06320         }
06321     },
06322     {
06323         /* Arg1 TypeName */
06324         L"Microsoft.UI.Xaml.Controls.TreeViewSelectionMode",
06325         /* Arg2 CreateXamlTypeCallback */
06326         []()
06327         {
06328             auto xamlType = winrt::make<EnumXamlType>(
06329                 /* Arg 1 - TypeName */
06330                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TreeViewSelectionMode",
06331                 /* Arg 2 - CreateFromString func */
06332                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
06333                 {
06334                     if (fromString == L"None") return box_value(winrt::TreeViewSelectionMode::None);
06335                     if (fromString == L"Single") return box_value(winrt::TreeViewSelectionMode::Single);
06336                     if (fromString == L"Multiple") return box_value(winrt::TreeViewSelectionMode::Multiple);
06337                     throw winrt::hresult_invalid_argument();
06338                 });
06339
06340             return xamlType;
06341         }
06342     },
06343     {
06344         /* Arg1 TypeName */
06345         L"Microsoft.UI.Xaml.Controls.TwoPaneView",
06346         /* Arg2 CreateXamlTypeCallback */
06347         []()
06348         {
06349             auto xamlType = winrt::make_self<XamlType>(
06350                 /* Arg 1 - TypeName */
06351                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TwoPaneView",
06352                 /* Arg 2 - BaseTypeName */
06353                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.Control",
06354                 /* Arg 3 - Activator func */
06355                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::ITwoPaneViewFactory>(L"Microsoft.UI.Xaml.Controls.TwoPaneView"); },
06356                 /* Arg 4 - Populate properties func */
06357                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06358                 {
06359                     winrt::ITwoPaneViewStatics statics = GetFactory<winrt::ITwoPaneViewStatics>(L"Microsoft.UI.Xaml.Controls.TwoPaneView");
06360                     {
06361                         xamlType.AddDPMember(L"MinTallModeHeight", L"Double", statics.MinTallModeHeightProperty(), false /* isContent */);
06362                         xamlType.AddDPMember(L"MinWideModeWidth", L"Double", statics.MinWideModeWidthProperty(), false /* isContent */);
06363                         xamlType.AddDPMember(L"Mode", L"Microsoft.UI.Xaml.Controls.TwoPaneViewMode", statics.ModeProperty(), false /* isContent */);
06364                         xamlType.AddDPMember(L"Pane1Length", L"Microsoft.UI.Xaml.GridLength", statics.Pane1LengthProperty(), false /* isContent */);
06365                         xamlType.AddDPMember(L"Pane1", L"Microsoft.UI.Xaml.UIElement", statics.Pane1Property(), false /* isContent */);
06366                         xamlType.AddDPMember(L"Pane2Length", L"Microsoft.UI.Xaml.GridLength", statics.Pane2LengthProperty(), false /* isContent */);
06367                         xamlType.AddDPMember(L"Pane2", L"Microsoft.UI.Xaml.UIElement", statics.Pane2Property(), false /* isContent */);
06368                         xamlType.AddDPMember(L"PanePriority", L"Microsoft.UI.Xaml.Controls.TwoPaneViewPriority", statics.PanePriorityProperty(), false /* isContent */);
06369                         xamlType.AddDPMember(L"TallModeConfiguration", L"Microsoft.UI.Xaml.Controls.TwoPaneViewTallModeConfiguration", statics.TallModeConfigurationProperty(), false /* isContent */);
06370                         xamlType.AddDPMember(L"WideModeConfiguration", L"Microsoft.UI.Xaml.Controls.TwoPaneViewWideModeConfiguration", statics.WideModeConfigurationProperty(), false /* isContent */);
06371                     }
06372
06373                 });
06374
06375             return static_cast<winrt::IXamlType>(*xamlType);
06376         }
06377     },
06378     {
06379         /* Arg1 TypeName */
06380         L"Microsoft.UI.Xaml.Controls.TwoPaneViewMode",
06381         /* Arg2 CreateXamlTypeCallback */
06382         []()
06383         {
06384             auto xamlType = winrt::make<EnumXamlType>(
06385                 /* Arg 1 - TypeName */
06386                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TwoPaneViewMode",
06387                 /* Arg 2 - CreateFromString func */
06388                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
06389                 {
06390                     if (fromString == L"SinglePane") return box_value(winrt::TwoPaneViewMode::SinglePane);
06391                     if (fromString == L"Wide") return box_value(winrt::TwoPaneViewMode::Wide);
06392                     if (fromString == L"Tall") return box_value(winrt::TwoPaneViewMode::Tall);
06393                     throw winrt::hresult_invalid_argument();
06394                 });
06395
06396             return xamlType;
06397         }
06398     },
06399     {
06400         /* Arg1 TypeName */
06401         L"Microsoft.UI.Xaml.Controls.TwoPaneViewPriority",
06402         /* Arg2 CreateXamlTypeCallback */
06403         []()
06404         {
06405             auto xamlType = winrt::make<EnumXamlType>(
06406                 /* Arg 1 - TypeName */
06407                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TwoPaneViewPriority",
06408                 /* Arg 2 - CreateFromString func */
06409                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
06410                 {
06411                     if (fromString == L"Pane1") return box_value(winrt::TwoPaneViewPriority::Pane1);
06412                     if (fromString == L"Pane2") return box_value(winrt::TwoPaneViewPriority::Pane2);
06413                     throw winrt::hresult_invalid_argument();
06414                 });
06415
06416             return xamlType;
06417         }
06418     },
06419     {
06420         /* Arg1 TypeName */
06421         L"Microsoft.UI.Xaml.Controls.TwoPaneViewTallModeConfiguration",
06422         /* Arg2 CreateXamlTypeCallback */
06423         []()
06424         {
06425             auto xamlType = winrt::make<EnumXamlType>(
06426                 /* Arg 1 - TypeName */
06427                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TwoPaneViewTallModeConfiguration",
06428                 /* Arg 2 - CreateFromString func */
06429                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
06430                 {
06431                     if (fromString == L"SinglePane") return box_value(winrt::TwoPaneViewTallModeConfiguration::SinglePane);
06432                     if (fromString == L"TopBottom") return box_value(winrt::TwoPaneViewTallModeConfiguration::TopBottom);
06433                     if (fromString == L"BottomTop") return box_value(winrt::TwoPaneViewTallModeConfiguration::BottomTop);
06434                     throw winrt::hresult_invalid_argument();
06435                 });
06436
06437             return xamlType;
06438         }
06439     },
06440     {
06441         /* Arg1 TypeName */
06442         L"Microsoft.UI.Xaml.Controls.TwoPaneViewWideModeConfiguration",
06443         /* Arg2 CreateXamlTypeCallback */
06444         []()
06445         {
06446             auto xamlType = winrt::make<EnumXamlType>(
06447                 /* Arg 1 - TypeName */
06448                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.TwoPaneViewWideModeConfiguration",
06449                 /* Arg 2 - CreateFromString func */
06450                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
06451                 {
06452                     if (fromString == L"SinglePane") return box_value(winrt::TwoPaneViewWideModeConfiguration::SinglePane);
06453                     if (fromString == L"LeftRight") return box_value(winrt::TwoPaneViewWideModeConfiguration::LeftRight);
06454                     if (fromString == L"RightLeft") return box_value(winrt::TwoPaneViewWideModeConfiguration::RightLeft);
06455                     throw winrt::hresult_invalid_argument();
06456                 });
06457
06458             return xamlType;
06459         }
06460     },
06461     {
06462         /* Arg1 TypeName */
06463         L"Microsoft.UI.Xaml.Controls.UniformGridLayout",
06464         /* Arg2 CreateXamlTypeCallback */
06465         []()
06466         {
06467             auto xamlType = winrt::make_self<XamlType>(
06468                 /* Arg 1 - TypeName */
06469                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.UniformGridLayout",
06470                 /* Arg 2 - BaseTypeName */
06471                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.VirtualizingLayout",
06472                 /* Arg 3 - Activator func */
06473                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IUniformGridLayoutFactory>(L"Microsoft.UI.Xaml.Controls.UniformGridLayout"); },
06474                 /* Arg 4 - Populate properties func */
06475                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06476                 {
06477                     winrt::IUniformGridLayoutStatics statics = GetFactory<winrt::IUniformGridLayoutStatics>(L"Microsoft.UI.Xaml.Controls.UniformGridLayout");
06478                     {
06479                         xamlType.AddDPMember(L"ItemsJustification", L"Microsoft.UI.Xaml.Controls.UniformGridLayoutItemsJustification", statics.ItemsJustificationProperty(), false /* isContent */);
06480                         xamlType.AddDPMember(L"ItemsStretch", L"Microsoft.UI.Xaml.Controls.UniformGridLayoutItemsStretch", statics.ItemsStretchProperty(), false /* isContent */);
06481                         xamlType.AddDPMember(L"MaximumRowsOrColumns", L"Int32", statics.MaximumRowsOrColumnsProperty(), false /* isContent */);
06482                         xamlType.AddDPMember(L"MinColumnSpacing", L"Double", statics.MinColumnSpacingProperty(), false /* isContent */);
06483                         xamlType.AddDPMember(L"MinItemHeight", L"Double", statics.MinItemHeightProperty(), false /* isContent */);
06484                         xamlType.AddDPMember(L"MinItemWidth", L"Double", statics.MinItemWidthProperty(), false /* isContent */);
06485                         xamlType.AddDPMember(L"MinRowSpacing", L"Double", statics.MinRowSpacingProperty(), false /* isContent */);
06486                         xamlType.AddDPMember(L"Orientation", L"Microsoft.UI.Xaml.Controls.Orientation", statics.OrientationProperty(), false /* isContent */);
06487                     }
06488
06489                 });
06490
06491             return static_cast<winrt::IXamlType>(*xamlType);
06492         }
06493     },
06494     {
06495         /* Arg1 TypeName */
06496         L"Microsoft.UI.Xaml.Controls.UniformGridLayoutItemsJustification",
06497         /* Arg2 CreateXamlTypeCallback */
06498         []()
06499         {
06500             auto xamlType = winrt::make<EnumXamlType>(
06501                 /* Arg 1 - TypeName */
06502                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.UniformGridLayoutItemsJustification",
06503                 /* Arg 2 - CreateFromString func */
06504                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
06505                 {
06506                     if (fromString == L"Start") return box_value(winrt::UniformGridLayoutItemsJustification::Start);
06507                     if (fromString == L"Center") return box_value(winrt::UniformGridLayoutItemsJustification::Center);
06508                     if (fromString == L"End") return box_value(winrt::UniformGridLayoutItemsJustification::End);
06509                     if (fromString == L"SpaceAround") return box_value(winrt::UniformGridLayoutItemsJustification::SpaceAround);
06510                     if (fromString == L"SpaceBetween") return box_value(winrt::UniformGridLayoutItemsJustification::SpaceBetween);
06511                     if (fromString == L"SpaceEvenly") return box_value(winrt::UniformGridLayoutItemsJustification::SpaceEvenly);
06512                     throw winrt::hresult_invalid_argument();
06513                 });
06514
06515             return xamlType;
06516         }
06517     },
06518     {
06519         /* Arg1 TypeName */
06520         L"Microsoft.UI.Xaml.Controls.UniformGridLayoutItemsStretch",
06521         /* Arg2 CreateXamlTypeCallback */
06522         []()
06523         {
06524             auto xamlType = winrt::make<EnumXamlType>(
06525                 /* Arg 1 - TypeName */
06526                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.UniformGridLayoutItemsStretch",
06527                 /* Arg 2 - CreateFromString func */
06528                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
06529                 {
06530                     if (fromString == L"None") return box_value(winrt::UniformGridLayoutItemsStretch::None);
06531                     if (fromString == L"Fill") return box_value(winrt::UniformGridLayoutItemsStretch::Fill);
06532                     if (fromString == L"Uniform") return box_value(winrt::UniformGridLayoutItemsStretch::Uniform);
06533                     throw winrt::hresult_invalid_argument();
06534                 });
06535
06536             return xamlType;
06537         }
06538     },
06539     {
06540         /* Arg1 TypeName */
06541         L"Microsoft.UI.Xaml.Controls.UniformGridLayoutState",
06542         /* Arg2 CreateXamlTypeCallback */
06543         []()
06544         {
06545             auto xamlType = winrt::make_self<XamlType>(
06546                 /* Arg 1 - TypeName */
06547                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.UniformGridLayoutState",
06548                 /* Arg 2 - BaseTypeName */
06549                 (PCWSTR)L"Object",
06550                 /* Arg 3 - Activator func */
06551                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IUniformGridLayoutStateFactory>(L"Microsoft.UI.Xaml.Controls.UniformGridLayoutState"); },
06552                 /* Arg 4 - Populate properties func */
06553                 nullptr
06554             );
06555
06556             return static_cast<winrt::IXamlType>(*xamlType);
06557         }
06558     },
06559     {
06560         /* Arg1 TypeName */
06561         L"Microsoft.UI.Xaml.Controls.VirtualizingLayoutContext",
06562         /* Arg2 CreateXamlTypeCallback */
06563         []()
06564         {
06565             auto xamlType = winrt::make_self<XamlType>(
06566                 /* Arg 1 - TypeName */
06567                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.VirtualizingLayoutContext",
06568                 /* Arg 2 - BaseTypeName */
06569                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.LayoutContext",
06570                 /* Arg 3 - Activator func */
06571                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IVirtualizingLayoutContextFactory>(L"Microsoft.UI.Xaml.Controls.VirtualizingLayoutContext"); },
06572                 /* Arg 4 - Populate properties func */
06573                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06574                 {
06575                     xamlType.AddMember(
06576                         L"LayoutOrigin", /* propertyName */
06577                         L"Windows.Foundation.Point", /* propertyType */
06578                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::VirtualizingLayoutContext>().LayoutOrigin()); },
06579                         [](winrt::IInspectable instance, winrt::IInspectable value) { instance.as<winrt::VirtualizingLayoutContext>().LayoutOrigin(unbox_value<winrt::Point>(value)); },
06580                         false, /* isContent */
06581                         false, /* isDependencyProperty */
06582                         false /* isAttachable */);
06583                     xamlType.AddMember(
06584                         L"ItemCount", /* propertyName */
06585                         L"Int32", /* propertyType */
06586                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::VirtualizingLayoutContext>().ItemCount()); },
06587                         nullptr, /* setter */
06588                         false, /* isContent */
06589                         false, /* isDependencyProperty */
06590                         false /* isAttachable */);
06591                     xamlType.AddMember(
06592                         L"RealizationRect", /* propertyName */
06593                         L"Windows.Foundation.Rect", /* propertyType */
06594                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::VirtualizingLayoutContext>().RealizationRect()); },
06595                         nullptr, /* setter */
06596                         false, /* isContent */
06597                         false, /* isDependencyProperty */
06598                         false /* isAttachable */);
06599                     xamlType.AddMember(
06600                         L"RecommendedAnchorIndex", /* propertyName */
06601                         L"Int32", /* propertyType */
06602                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::VirtualizingLayoutContext>().RecommendedAnchorIndex()); },
06603                         nullptr, /* setter */
06604                         false, /* isContent */
06605                         false, /* isDependencyProperty */
06606                         false /* isAttachable */);
06607                     xamlType.AddMember(
06608                         L"VisibleRect", /* propertyName */
06609                         L"Windows.Foundation.Rect", /* propertyType */
06610                         [](winrt::IInspectable instance) { return box_value(instance.as<winrt::VirtualizingLayoutContext>().VisibleRect()); },
06611                         nullptr, /* setter */
06612                         false, /* isContent */
06613                         false, /* isDependencyProperty */
06614                         false /* isAttachable */);
06615                 });
06616
06617             return static_cast<winrt::IXamlType>(*xamlType);
06618         }
06619     },
06620     {
06621         /* Arg1 TypeName */
06622         L"Microsoft.UI.Xaml.Controls.WebView2",
06623         /* Arg2 CreateXamlTypeCallback */
06624         []()
06625         {
06626             auto xamlType = winrt::make_self<XamlType>(
06627                 /* Arg 1 - TypeName */
06628                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.WebView2",
06629                 /* Arg 2 - BaseTypeName */
06630                 (PCWSTR)L"Microsoft.UI.Xaml.FrameworkElement",
06631                 /* Arg 3 - Activator func */
06632                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IWebView2Factory>(L"Microsoft.UI.Xaml.Controls.WebView2"); },
06633                 /* Arg 4 - Populate properties func */
06634                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06635                 {
06636                     winrt::IWebView2Statics statics = GetFactory<winrt::IWebView2Statics>(L"Microsoft.UI.Xaml.Controls.WebView2");
06637                     {
06638                         xamlType.AddDPMember(L"CanGoBack", L"Boolean", statics.CanGoBackProperty(), false /* isContent */);
06639                         xamlType.AddDPMember(L"CanGoForward", L"Boolean", statics.CanGoForwardProperty(), false /* isContent */);
06640                         xamlType.AddDPMember(L"DefaultBackgroundColor", L"Windows.UI.Color", statics.DefaultBackgroundColorProperty(), false /* isContent */);
06641                         xamlType.AddDPMember(L"Source", L"Uri", statics.SourceProperty(), false /* isContent */);
06642                     }
06643
06644                     xamlType.AddMember(
06645                         L"CoreWebView2", /* propertyName */
06646                         L"Microsoft.Web.WebView2.Core.CoreWebView2", /* propertyType */
06647                         [](winrt::IInspectable instance) { return instance.as<winrt::WebView2>().CoreWebView2(); },
06648                         nullptr, /* setter */
06649                         false, /* isContent */
06650                         false, /* isDependencyProperty */
06651                         false /* isAttachable */);
06652                 });
06653
06654             return static_cast<winrt::IXamlType>(*xamlType);
06655         }
06656     },
06657     {
06658         /* Arg1 TypeName */
06659         L"Microsoft.UI.Xaml.Controls.XamlControlsResources",
06660         /* Arg2 CreateXamlTypeCallback */
06661         []()
06662         {
06663             auto xamlType = winrt::make_self<XamlType>(
06664                 /* Arg 1 - TypeName */
06665                 (PCWSTR)L"Microsoft.UI.Xaml.Controls.XamlControlsResources",
06666                 /* Arg 2 - BaseTypeName */
06667                 (PCWSTR)L"Microsoft.UI.Xaml.ResourceDictionary",
06668                 /* Arg 3 - Activator func */
06669                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.Controls.XamlControlsResources"); },
06670                 /* Arg 4 - Populate properties func */
06671                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06672                 {
06673                     winrt::IXamlControlsResourcesStatics statics = GetFactory<winrt::IXamlControlsResourcesStatics>(L"Microsoft.UI.Xaml.Controls.XamlControlsResources");
06674                     {
06675                         xamlType.AddDPMember(L"UseCompactResources", L"Boolean", statics.UseCompactResourcesProperty(), false /* isContent */);
06676                     }
06677
06678                 });
06679
06680             return static_cast<winrt::IXamlType>(*xamlType);
06681         }
06682     },
06683     {
06684         /* Arg1 TypeName */
06685         L"Microsoft.UI.Xaml.CustomAttributes.MUXHasCustomActivationFactoryAttribute",
06686         /* Arg2 CreateXamlTypeCallback */
06687         []()
06688         {
06689             auto xamlType = winrt::make_self<XamlType>(
06690                 /* Arg 1 - TypeName */
06691                 (PCWSTR)L"Microsoft.UI.Xaml.CustomAttributes.MUXHasCustomActivationFactoryAttribute",
06692                 /* Arg 2 - BaseTypeName */
06693                 (PCWSTR)L"Attribute",
06694                 /* Arg 3 - Activator func */
06695                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.CustomAttributes.MUXHasCustomActivationFactoryAttribute"); },
06696                 /* Arg 4 - Populate properties func */
06697                 nullptr
06698             );
06699
06700             return static_cast<winrt::IXamlType>(*xamlType);
06701         }
06702     },
06703     {
06704         /* Arg1 TypeName */
06705         L"Microsoft.UI.Xaml.CustomAttributes.MUXOverrideEnsurePropertiesAttribute",
06706         /* Arg2 CreateXamlTypeCallback */
06707         []()
06708         {
06709             auto xamlType = winrt::make_self<XamlType>(
06710                 /* Arg 1 - TypeName */
06711                 (PCWSTR)L"Microsoft.UI.Xaml.CustomAttributes.MUXOverrideEnsurePropertiesAttribute",
06712                 /* Arg 2 - BaseTypeName */
06713                 (PCWSTR)L"Attribute",
06714                 /* Arg 3 - Activator func */
06715                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.CustomAttributes.MUXOverrideEnsurePropertiesAttribute"); },
06716                 /* Arg 4 - Populate properties func */
06717                 nullptr
06718             );
06719
06720             return static_cast<winrt::IXamlType>(*xamlType);
06721         }
06722     },
06723     {
06724         /* Arg1 TypeName */
06725         L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute",
06726         /* Arg2 CreateXamlTypeCallback */
06727         []()
06728         {
06729             auto xamlType = winrt::make_self<XamlType>(
06730                 /* Arg 1 - TypeName */
06731                 (PCWSTR)L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute",
06732                 /* Arg 2 - BaseTypeName */
06733                 (PCWSTR)L"Attribute",
06734                 /* Arg 3 - Activator func */
06735                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute"); },
06736                 /* Arg 4 - Populate properties func */
06737                 nullptr
06738             );
06739
06740             return static_cast<winrt::IXamlType>(*xamlType);
06741         }
06742     },
06743     {
06744         /* Arg1 TypeName */
06745         L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodNameAttribute",
06746         /* Arg2 CreateXamlTypeCallback */
06747         []()
06748         {
06749             auto xamlType = winrt::make_self<XamlType>(
06750                 /* Arg 1 - TypeName */
06751                 (PCWSTR)L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodNameAttribute",
06752                 /* Arg 2 - BaseTypeName */
06753                 (PCWSTR)L"Attribute",
06754                 /* Arg 3 - Activator func */
06755                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodNameAttribute"); },
06756                 /* Arg 4 - Populate properties func */
06757                 nullptr
06758             );
06759
06760             return static_cast<winrt::IXamlType>(*xamlType);
06761         }
06762     },
06763     {
06764         /* Arg1 TypeName */
06765         L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValueAttribute",
06766         /* Arg2 CreateXamlTypeCallback */
06767         []()
06768         {
06769             auto xamlType = winrt::make_self<XamlType>(
06770                 /* Arg 1 - TypeName */
06771                 (PCWSTR)L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValueAttribute",
06772                 /* Arg 2 - BaseTypeName */
06773                 (PCWSTR)L"Attribute",
06774                 /* Arg 3 - Activator func */
06775                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValueAttribute"); },
06776                 /* Arg 4 - Populate properties func */
06777                 nullptr
06778             );
06779
06780             return static_cast<winrt::IXamlType>(*xamlType);
06781         }
06782     },
06783     {
06784         /* Arg1 TypeName */
06785         L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyNeedsDependencyPropertyFieldAttribute",
06786         /* Arg2 CreateXamlTypeCallback */
06787         []()
06788         {
06789             auto xamlType = winrt::make_self<XamlType>(
06790                 /* Arg 1 - TypeName */
06791                 (PCWSTR)L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyNeedsDependencyPropertyFieldAttribute",
06792                 /* Arg 2 - BaseTypeName */
06793                 (PCWSTR)L"Attribute",
06794                 /* Arg 3 - Activator func */
06795                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyNeedsDependencyPropertyFieldAttribute"); },
06796                 /* Arg 4 - Populate properties func */
06797                 nullptr
06798             );
06799
06800             return static_cast<winrt::IXamlType>(*xamlType);
06801         }
06802     },
06803     {
06804         /* Arg1 TypeName */
06805         L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyTypeAttribute",
06806         /* Arg2 CreateXamlTypeCallback */
06807         []()
06808         {
06809             auto xamlType = winrt::make_self<XamlType>(
06810                 /* Arg 1 - TypeName */
06811                 (PCWSTR)L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyTypeAttribute",
06812                 /* Arg 2 - BaseTypeName */
06813                 (PCWSTR)L"Attribute",
06814                 /* Arg 3 - Activator func */
06815                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyTypeAttribute"); },
06816                 /* Arg 4 - Populate properties func */
06817                 nullptr
06818             );
06819
06820             return static_cast<winrt::IXamlType>(*xamlType);
06821         }
06822     },
06823     {
06824         /* Arg1 TypeName */
06825         L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyValidationCallbackAttribute",
06826         /* Arg2 CreateXamlTypeCallback */
06827         []()
06828         {
06829             auto xamlType = winrt::make_self<XamlType>(
06830                 /* Arg 1 - TypeName */
06831                 (PCWSTR)L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyValidationCallbackAttribute",
06832                 /* Arg 2 - BaseTypeName */
06833                 (PCWSTR)L"Attribute",
06834                 /* Arg 3 - Activator func */
06835                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.CustomAttributes.MUXPropertyValidationCallbackAttribute"); },
06836                 /* Arg 4 - Populate properties func */
06837                 nullptr
06838             );
06839
06840             return static_cast<winrt::IXamlType>(*xamlType);
06841         }
06842     },
06843     {
06844         /* Arg1 TypeName */
06845         L"Microsoft.UI.Xaml.Media.AcrylicBrush",
06846         /* Arg2 CreateXamlTypeCallback */
06847         []()
06848         {
06849             auto xamlType = winrt::make_self<XamlType>(
06850                 /* Arg 1 - TypeName */
06851                 (PCWSTR)L"Microsoft.UI.Xaml.Media.AcrylicBrush",
06852                 /* Arg 2 - BaseTypeName */
06853                 (PCWSTR)L"Microsoft.UI.Xaml.Media.XamlCompositionBrushBase",
06854                 /* Arg 3 - Activator func */
06855                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IAcrylicBrushFactory>(L"Microsoft.UI.Xaml.Media.AcrylicBrush"); },
06856                 /* Arg 4 - Populate properties func */
06857                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06858                 {
06859                     winrt::IAcrylicBrushStatics statics = GetFactory<winrt::IAcrylicBrushStatics>(L"Microsoft.UI.Xaml.Media.AcrylicBrush");
06860                     {
06861                         xamlType.AddDPMember(L"AlwaysUseFallback", L"Boolean", statics.AlwaysUseFallbackProperty(), false /* isContent */);
06862                         xamlType.AddDPMember(L"TintColor", L"Windows.UI.Color", statics.TintColorProperty(), false /* isContent */);
06863                         xamlType.AddDPMember(L"TintOpacity", L"Double", statics.TintOpacityProperty(), false /* isContent */);
06864                         xamlType.AddDPMember(L"TintTransitionDuration", L"TimeSpan", statics.TintTransitionDurationProperty(), false /* isContent */);
06865                     }
06866
06867                     winrt::IAcrylicBrushStatics2 statics2 = GetFactory<winrt::IAcrylicBrushStatics2>(L"Microsoft.UI.Xaml.Media.AcrylicBrush");
06868                     {
06869                         xamlType.AddDPMember(L"TintLuminosityOpacity", L"Windows.Foundation.IReference`1<Double>", statics2.TintLuminosityOpacityProperty(), false /* isContent */);
06870                     }
06871
06872                 });
06873
06874             return static_cast<winrt::IXamlType>(*xamlType);
06875         }
06876     },
06877     {
06878         /* Arg1 TypeName */
06879         L"Microsoft.UI.Xaml.Media.DesktopAcrylicBackdrop",
06880         /* Arg2 CreateXamlTypeCallback */
06881         []()
06882         {
06883             auto xamlType = winrt::make_self<XamlType>(
06884                 /* Arg 1 - TypeName */
06885                 (PCWSTR)L"Microsoft.UI.Xaml.Media.DesktopAcrylicBackdrop",
06886                 /* Arg 2 - BaseTypeName */
06887                 (PCWSTR)L"Microsoft.UI.Xaml.Media.SystemBackdrop",
06888                 /* Arg 3 - Activator func */
06889                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IDesktopAcrylicBackdropFactory>(L"Microsoft.UI.Xaml.Media.DesktopAcrylicBackdrop"); },
06890                 /* Arg 4 - Populate properties func */
06891                 nullptr
06892             );
06893
06894             return static_cast<winrt::IXamlType>(*xamlType);
06895         }
06896     },
06897     {
06898         /* Arg1 TypeName */
06899         L"Microsoft.UI.Xaml.Media.MicaBackdrop",
06900         /* Arg2 CreateXamlTypeCallback */
06901         []()
06902         {
06903             auto xamlType = winrt::make_self<XamlType>(
06904                 /* Arg 1 - TypeName */
06905                 (PCWSTR)L"Microsoft.UI.Xaml.Media.MicaBackdrop",
06906                 /* Arg 2 - BaseTypeName */
06907                 (PCWSTR)L"Microsoft.UI.Xaml.Media.SystemBackdrop",
06908                 /* Arg 3 - Activator func */
06909                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IMicaBackdropFactory>(L"Microsoft.UI.Xaml.Media.MicaBackdrop"); },
06910                 /* Arg 4 - Populate properties func */
06911                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06912                 {
06913                     winrt::IMicaBackdropStatics statics = GetFactory<winrt::IMicaBackdropStatics>(L"Microsoft.UI.Xaml.Media.MicaBackdrop");
06914                     {
06915                         xamlType.AddDPMember(L"Kind", L"Microsoft.UI.Composition.SystemBackdrops.MicaKind", statics.KindProperty(), false /* isContent */);
06916                     }
06917
06918                 });
06919
06920             return static_cast<winrt::IXamlType>(*xamlType);
06921         }
06922     },
06923     {
06924         /* Arg1 TypeName */
06925         L"Microsoft.UI.Xaml.Media.RadialGradientBrush",
06926         /* Arg2 CreateXamlTypeCallback */
06927         []()
06928         {
06929             auto xamlType = winrt::make_self<XamlType>(
06930                 /* Arg 1 - TypeName */
06931                 (PCWSTR)L"Microsoft.UI.Xaml.Media.RadialGradientBrush",
06932                 /* Arg 2 - BaseTypeName */
06933                 (PCWSTR)L"Microsoft.UI.Xaml.Media.XamlCompositionBrushBase",
06934                 /* Arg 3 - Activator func */
06935                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRadialGradientBrushFactory>(L"Microsoft.UI.Xaml.Media.RadialGradientBrush"); },
06936                 /* Arg 4 - Populate properties func */
06937                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06938                 {
06939                     winrt::IRadialGradientBrushStatics statics = GetFactory<winrt::IRadialGradientBrushStatics>(L"Microsoft.UI.Xaml.Media.RadialGradientBrush");
06940                     {
06941                         xamlType.AddDPMember(L"Center", L"Windows.Foundation.Point", statics.CenterProperty(), false /* isContent */);
06942                         xamlType.AddDPMember(L"GradientOrigin", L"Windows.Foundation.Point", statics.GradientOriginProperty(), false /* isContent */);
06943                         xamlType.AddDPMember(L"InterpolationSpace", L"Microsoft.UI.Composition.CompositionColorSpace", statics.InterpolationSpaceProperty(), false /* isContent */);
06944                         xamlType.AddDPMember(L"MappingMode", L"Microsoft.UI.Xaml.Media.BrushMappingMode", statics.MappingModeProperty(), false /* isContent */);
06945                         xamlType.AddDPMember(L"RadiusX", L"Double", statics.RadiusXProperty(), false /* isContent */);
06946                         xamlType.AddDPMember(L"RadiusY", L"Double", statics.RadiusYProperty(), false /* isContent */);
06947                         xamlType.AddDPMember(L"SpreadMethod", L"Microsoft.UI.Xaml.Media.GradientSpreadMethod", statics.SpreadMethodProperty(), false /* isContent */);
06948                     }
06949
06950                     xamlType.AddMember(
06951                         L"GradientStops", /* propertyName */
06952                         L"Windows.Foundation.Collections.IObservableVector`1<Microsoft.UI.Xaml.Media.GradientStop>", /* propertyType */
06953                         [](winrt::IInspectable instance) { return instance.as<winrt::RadialGradientBrush>().GradientStops(); },
06954                         nullptr, /* setter */
06955                         true, /* isContent */
06956                         false, /* isDependencyProperty */
06957                         false /* isAttachable */);
06958                 });
06959
06960             return static_cast<winrt::IXamlType>(*xamlType);
06961         }
06962     },
06963     {
06964         /* Arg1 TypeName */
06965         L"Microsoft.UI.Xaml.Media.RevealBrush",
06966         /* Arg2 CreateXamlTypeCallback */
06967         []()
06968         {
06969             auto xamlType = winrt::make_self<XamlType>(
06970                 /* Arg 1 - TypeName */
06971                 (PCWSTR)L"Microsoft.UI.Xaml.Media.RevealBrush",
06972                 /* Arg 2 - BaseTypeName */
06973                 (PCWSTR)L"Microsoft.UI.Xaml.Media.XamlCompositionBrushBase",
06974                 /* Arg 3 - Activator func */
06975                 nullptr,
06976                 /* Arg 4 - Populate properties func */
06977                 (std::function<void(XamlTypeBase&)>)[](XamlTypeBase& xamlType)
06978                 {
06979                     winrt::IRevealBrushStatics statics = GetFactory<winrt::IRevealBrushStatics>(L"Microsoft.UI.Xaml.Media.RevealBrush");
06980                     {
06981                         xamlType.AddDPMember(L"AlwaysUseFallback", L"Boolean", statics.AlwaysUseFallbackProperty(), false /* isContent */);
06982                         xamlType.AddDPMember(L"Color", L"Windows.UI.Color", statics.ColorProperty(), false /* isContent */);
06983                         xamlType.AddDPMember(L"State", L"Microsoft.UI.Xaml.Media.RevealBrushState", statics.StateProperty(), false /* isContent */);
06984                         xamlType.AddDPMember(L"TargetTheme", L"Microsoft.UI.Xaml.ApplicationTheme", statics.TargetThemeProperty(), false /* isContent */);
06985                     }
06986
06987                 });
06988
06989             return static_cast<winrt::IXamlType>(*xamlType);
06990         }
06991     },
06992     {
06993         /* Arg1 TypeName */
06994         L"Microsoft.UI.Xaml.Media.RevealBackgroundBrush",
06995         /* Arg2 CreateXamlTypeCallback */
06996         []()
06997         {
06998             auto xamlType = winrt::make_self<XamlType>(
06999                 /* Arg 1 - TypeName */
07000                 (PCWSTR)L"Microsoft.UI.Xaml.Media.RevealBackgroundBrush",
07001                 /* Arg 2 - BaseTypeName */
07002                 (PCWSTR)L"Microsoft.UI.Xaml.Media.RevealBrush",
07003                 /* Arg 3 - Activator func */
07004                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRevealBackgroundBrushFactory>(L"Microsoft.UI.Xaml.Media.RevealBackgroundBrush"); },
07005                 /* Arg 4 - Populate properties func */
07006                 nullptr
07007             );
07008
07009             return static_cast<winrt::IXamlType>(*xamlType);
07010         }
07011     },
07012     {
07013         /* Arg1 TypeName */
07014         L"Microsoft.UI.Xaml.Media.RevealBorderBrush",
07015         /* Arg2 CreateXamlTypeCallback */
07016         []()
07017         {
07018             auto xamlType = winrt::make_self<XamlType>(
07019                 /* Arg 1 - TypeName */
07020                 (PCWSTR)L"Microsoft.UI.Xaml.Media.RevealBorderBrush",
07021                 /* Arg 2 - BaseTypeName */
07022                 (PCWSTR)L"Microsoft.UI.Xaml.Media.RevealBrush",
07023                 /* Arg 3 - Activator func */
07024                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstanceWithFactory<winrt::IRevealBorderBrushFactory>(L"Microsoft.UI.Xaml.Media.RevealBorderBrush"); },
07025                 /* Arg 4 - Populate properties func */
07026                 nullptr
07027             );
07028
07029             return static_cast<winrt::IXamlType>(*xamlType);
07030         }
07031     },
07032     {
07033         /* Arg1 TypeName */
07034         L"Microsoft.UI.Xaml.Media.RevealBrushState",
07035         /* Arg2 CreateXamlTypeCallback */
07036         []()
07037         {
07038             auto xamlType = winrt::make<EnumXamlType>(
07039                 /* Arg 1 - TypeName */
07040                 (PCWSTR)L"Microsoft.UI.Xaml.Media.RevealBrushState",
07041                 /* Arg 2 - CreateFromString func */
07042                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
07043                 {
07044                     if (fromString == L"Normal") return box_value(winrt::RevealBrushState::Normal);
07045                     if (fromString == L"PointerOver") return box_value(winrt::RevealBrushState::PointerOver);
07046                     if (fromString == L"Pressed") return box_value(winrt::RevealBrushState::Pressed);
07047                     throw winrt::hresult_invalid_argument();
07048                 });
07049
07050             return xamlType;
07051         }
07052     },
07053     {
07054         /* Arg1 TypeName */
07055         L"Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider",
07056         /* Arg2 CreateXamlTypeCallback */
07057         []()
07058         {
07059             auto xamlType = winrt::make_self<XamlType>(
07060                 /* Arg 1 - TypeName */
07061                 (PCWSTR)L"Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider",
07062                 /* Arg 2 - BaseTypeName */
07063                 (PCWSTR)L"Object",
07064                 /* Arg 3 - Activator func */
07065                 (std::function<winrt::IInspectable()>)[](){ return ActivateInstance(L"Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider"); },
07066                 /* Arg 4 - Populate properties func */
07067                 nullptr
07068             );
07069
07070             return static_cast<winrt::IXamlType>(*xamlType);
07071         }
07072     },
07073     // Register types encountered
07074     {
07075         /* Arg1 TypeName */
07076         L"Attribute",
07077         /* Arg2 CreateXamlTypeCallback */
07078         []()
07079         {
07080             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Attribute", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07081             return static_cast<winrt::IXamlType>(*xamlType);
07082         }
07083     },
07084     {
07085         /* Arg1 TypeName */
07086         L"Boolean",
07087         /* Arg2 CreateXamlTypeCallback */
07088         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Boolean"); }
07089     },
07090     {
07091         /* Arg1 TypeName */
07092         L"Double",
07093         /* Arg2 CreateXamlTypeCallback */
07094         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Double"); }
07095     },
07096     {
07097         /* Arg1 TypeName */
07098         L"Int32",
07099         /* Arg2 CreateXamlTypeCallback */
07100         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Int32"); }
07101     },
07102     {
07103         /* Arg1 TypeName */
07104         L"Microsoft.UI.Composition.CompositionColorSpace",
07105         /* Arg2 CreateXamlTypeCallback */
07106         []()
07107         {
07108             auto xamlType = winrt::make<EnumXamlType>(
07109                 /* Arg 1 - TypeName */
07110                 (PCWSTR)L"Microsoft.UI.Composition.CompositionColorSpace",
07111                 /* Arg 2 - CreateFromString func */
07112                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
07113                 {
07114                     if (fromString == L"Auto") return box_value(winrt::CompositionColorSpace::Auto);
07115                     if (fromString == L"Hsl") return box_value(winrt::CompositionColorSpace::Hsl);
07116                     if (fromString == L"Rgb") return box_value(winrt::CompositionColorSpace::Rgb);
07117                     if (fromString == L"HslLinear") return box_value(winrt::CompositionColorSpace::HslLinear);
07118                     if (fromString == L"RgbLinear") return box_value(winrt::CompositionColorSpace::RgbLinear);
07119                     throw winrt::hresult_invalid_argument();
07120                 });
07121
07122             return xamlType;
07123         }
07124     },
07125     {
07126         /* Arg1 TypeName */
07127         L"Microsoft.UI.Composition.CompositionObject",
07128         /* Arg2 CreateXamlTypeCallback */
07129         []()
07130         {
07131             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Microsoft.UI.Composition.CompositionObject", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07132             return static_cast<winrt::IXamlType>(*xamlType);
07133         }
07134     },
07135     {
07136         /* Arg1 TypeName */
07137         L"Microsoft.UI.Composition.CompositionPropertySet",
07138         /* Arg2 CreateXamlTypeCallback */
07139         []()
07140         {
07141             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Microsoft.UI.Composition.CompositionPropertySet", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07142             return static_cast<winrt::IXamlType>(*xamlType);
07143         }
07144     },
07145     {
07146         /* Arg1 TypeName */
07147         L"Microsoft.UI.Composition.SystemBackdrops.MicaKind",
07148         /* Arg2 CreateXamlTypeCallback */
07149         []()
07150         {
07151             auto xamlType = winrt::make<EnumXamlType>(
07152                 /* Arg 1 - TypeName */
07153                 (PCWSTR)L"Microsoft.UI.Composition.SystemBackdrops.MicaKind",
07154                 /* Arg 2 - CreateFromString func */
07155                 (std::function<winrt::IInspectable(hstring)>)[](hstring fromString)
07156                 {
07157                     if (fromString == L"Base") return box_value(winrt::MicaKind::Base);
07158                     if (fromString == L"BaseAlt") return box_value(winrt::MicaKind::BaseAlt);
07159                     throw winrt::hresult_invalid_argument();
07160                 });
07161
07162             return xamlType;
07163         }
07164     },
07165     {
07166         /* Arg1 TypeName */
07167         L"Microsoft.UI.Xaml.ApplicationTheme",
07168         /* Arg2 CreateXamlTypeCallback */
07169         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.ApplicationTheme"); }
07170     },
07171     {
07172         /* Arg1 TypeName */
07173         L"Microsoft.UI.Xaml.Automation.Peers.AutomationControlType",
07174         /* Arg2 CreateXamlTypeCallback */
07175         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Automation.Peers.AutomationControlType"); }
07176     },
07177     {
07178         /* Arg1 TypeName */
07179         L"Microsoft.UI.Xaml.Controls.AutoSuggestBox",
07180         /* Arg2 CreateXamlTypeCallback */
07181         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.AutoSuggestBox"); }
07182     },
07183     {
07184         /* Arg1 TypeName */
07185         L"Microsoft.UI.Xaml.Controls.Button",
07186         /* Arg2 CreateXamlTypeCallback */
07187         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Button"); }
07188     },
07189     {
07190         /* Arg1 TypeName */
07191         L"Microsoft.UI.Xaml.Controls.CommandBar",
07192         /* Arg2 CreateXamlTypeCallback */
07193         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.CommandBar"); }
07194     },
07195     {
07196         /* Arg1 TypeName */
07197         L"Microsoft.UI.Xaml.Controls.ContentControl",
07198         /* Arg2 CreateXamlTypeCallback */
07199         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.ContentControl"); }
07200     },
07201     {
07202         /* Arg1 TypeName */
07203         L"Microsoft.UI.Xaml.Controls.Control",
07204         /* Arg2 CreateXamlTypeCallback */
07205         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Control"); }
07206     },
07207     {
07208         /* Arg1 TypeName */
07209         L"Microsoft.UI.Xaml.Controls.DataTemplateSelector",
07210         /* Arg2 CreateXamlTypeCallback */
07211         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.DataTemplateSelector"); }
07212     },
07213     {
07214         /* Arg1 TypeName */
07215         L"Microsoft.UI.Xaml.Controls.Grid",
07216         /* Arg2 CreateXamlTypeCallback */
07217         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Grid"); }
07218     },
07219     {
07220         /* Arg1 TypeName */
07221         L"Microsoft.UI.Xaml.Controls.IconElement",
07222         /* Arg2 CreateXamlTypeCallback */
07223         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.IconElement"); }
07224     },
07225     {
07226         /* Arg1 TypeName */
07227         L"Microsoft.UI.Xaml.Controls.IconSource",
07228         /* Arg2 CreateXamlTypeCallback */
07229         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.IconSource"); }
07230     },
07231     {
07232         /* Arg1 TypeName */
07233         L"Microsoft.UI.Xaml.Controls.ListView",
07234         /* Arg2 CreateXamlTypeCallback */
07235         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.ListView"); }
07236     },
07237     {
07238         /* Arg1 TypeName */
07239         L"Microsoft.UI.Xaml.Controls.ListViewItem",
07240         /* Arg2 CreateXamlTypeCallback */
07241         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.ListViewItem"); }
07242     },
07243     {
07244         /* Arg1 TypeName */
07245         L"Microsoft.UI.Xaml.Controls.MenuFlyout",
07246         /* Arg2 CreateXamlTypeCallback */
07247         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.MenuFlyout"); }
07248     },
07249     {
07250         /* Arg1 TypeName */
07251         L"Microsoft.UI.Xaml.Controls.MenuFlyoutItem",
07252         /* Arg2 CreateXamlTypeCallback */
07253         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.MenuFlyoutItem"); }
07254     },
07255     {
07256         /* Arg1 TypeName */
07257         L"Microsoft.UI.Xaml.Controls.Orientation",
07258         /* Arg2 CreateXamlTypeCallback */
07259         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Orientation"); }
07260     },
07261     {
07262         /* Arg1 TypeName */
07263         L"Microsoft.UI.Xaml.Controls.Panel",
07264         /* Arg2 CreateXamlTypeCallback */
07265         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Panel"); }
07266     },
07267     {
07268         /* Arg1 TypeName */
07269         L"Microsoft.UI.Xaml.Controls.Primitives.ButtonBase",
07270         /* Arg2 CreateXamlTypeCallback */
07271         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ButtonBase"); }
07272     },
07273     {
07274         /* Arg1 TypeName */
07275         L"Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase",
07276         /* Arg2 CreateXamlTypeCallback */
07277         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase"); }
07278     },
07279     {
07280         /* Arg1 TypeName */
07281         L"Microsoft.UI.Xaml.Controls.Primitives.ListViewItemPresenter",
07282         /* Arg2 CreateXamlTypeCallback */
07283         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.ListViewItemPresenter"); }
07284     },
07285     {
07286         /* Arg1 TypeName */
07287         L"Microsoft.UI.Xaml.Controls.Primitives.RangeBase",
07288         /* Arg2 CreateXamlTypeCallback */
07289         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Primitives.RangeBase"); }
07290     },
07291     {
07292         /* Arg1 TypeName */
07293         L"Microsoft.UI.Xaml.Controls.ScrollViewer",
07294         /* Arg2 CreateXamlTypeCallback */
07295         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.ScrollViewer"); }
07296     },
07297     {
07298         /* Arg1 TypeName */
07299         L"Microsoft.UI.Xaml.Controls.Slider",
07300         /* Arg2 CreateXamlTypeCallback */
07301         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.Slider"); }
07302     },
07303     {
07304         /* Arg1 TypeName */
07305         L"Microsoft.UI.Xaml.Controls.StyleSelector",
07306         /* Arg2 CreateXamlTypeCallback */
07307         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Controls.StyleSelector"); }
07308     },
07309     {
07310         /* Arg1 TypeName */
07311         L"Microsoft.UI.Xaml.CornerRadius",
07312         /* Arg2 CreateXamlTypeCallback */
07313         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.CornerRadius"); }
07314     },
07315     {
07316         /* Arg1 TypeName */
07317         L"Microsoft.UI.Xaml.DataTemplate",
07318         /* Arg2 CreateXamlTypeCallback */
07319         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.DataTemplate"); }
07320     },
07321     {
07322         /* Arg1 TypeName */
07323         L"Microsoft.UI.Xaml.DependencyObject",
07324         /* Arg2 CreateXamlTypeCallback */
07325         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.DependencyObject"); }
07326     },
07327     {
07328         /* Arg1 TypeName */
07329         L"Microsoft.UI.Xaml.FrameworkElement",
07330         /* Arg2 CreateXamlTypeCallback */
07331         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.FrameworkElement"); }
07332     },
07333     {
07334         /* Arg1 TypeName */
07335         L"Microsoft.UI.Xaml.GridLength",
07336         /* Arg2 CreateXamlTypeCallback */
07337         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.GridLength"); }
07338     },
07339     {
07340         /* Arg1 TypeName */
07341         L"Microsoft.UI.Xaml.IElementFactory",
07342         /* Arg2 CreateXamlTypeCallback */
07343         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.IElementFactory"); }
07344     },
07345     {
07346         /* Arg1 TypeName */
07347         L"Microsoft.UI.Xaml.Input.ICommand",
07348         /* Arg2 CreateXamlTypeCallback */
07349         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Input.ICommand"); }
07350     },
07351     {
07352         /* Arg1 TypeName */
07353         L"Microsoft.UI.Xaml.Input.InputScope",
07354         /* Arg2 CreateXamlTypeCallback */
07355         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Input.InputScope"); }
07356     },
07357     {
07358         /* Arg1 TypeName */
07359         L"Microsoft.UI.Xaml.Media.Animation.TransitionCollection",
07360         /* Arg2 CreateXamlTypeCallback */
07361         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.Animation.TransitionCollection"); }
07362     },
07363     {
07364         /* Arg1 TypeName */
07365         L"Microsoft.UI.Xaml.Media.Brush",
07366         /* Arg2 CreateXamlTypeCallback */
07367         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.Brush"); }
07368     },
07369     {
07370         /* Arg1 TypeName */
07371         L"Microsoft.UI.Xaml.Media.BrushMappingMode",
07372         /* Arg2 CreateXamlTypeCallback */
07373         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.BrushMappingMode"); }
07374     },
07375     {
07376         /* Arg1 TypeName */
07377         L"Microsoft.UI.Xaml.Media.Geometry",
07378         /* Arg2 CreateXamlTypeCallback */
07379         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.Geometry"); }
07380     },
07381     {
07382         /* Arg1 TypeName */
07383         L"Microsoft.UI.Xaml.Media.GradientSpreadMethod",
07384         /* Arg2 CreateXamlTypeCallback */
07385         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.GradientSpreadMethod"); }
07386     },
07387     {
07388         /* Arg1 TypeName */
07389         L"Microsoft.UI.Xaml.Media.ImageBrush",
07390         /* Arg2 CreateXamlTypeCallback */
07391         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.ImageBrush"); }
07392     },
07393     {
07394         /* Arg1 TypeName */
07395         L"Microsoft.UI.Xaml.Media.ImageSource",
07396         /* Arg2 CreateXamlTypeCallback */
07397         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.ImageSource"); }
07398     },
07399     {
07400         /* Arg1 TypeName */
07401         L"Microsoft.UI.Xaml.Media.RectangleGeometry",
07402         /* Arg2 CreateXamlTypeCallback */
07403         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.RectangleGeometry"); }
07404     },
07405     {
07406         /* Arg1 TypeName */
07407         L"Microsoft.UI.Xaml.Media.SolidColorBrush",
07408         /* Arg2 CreateXamlTypeCallback */
07409         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.SolidColorBrush"); }
07410     },
07411     {
07412         /* Arg1 TypeName */
07413         L"Microsoft.UI.Xaml.Media.Stretch",
07414         /* Arg2 CreateXamlTypeCallback */
07415         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.Stretch"); }
07416     },
07417     {
07418         /* Arg1 TypeName */
07419         L"Microsoft.UI.Xaml.Media.SystemBackdrop",
07420         /* Arg2 CreateXamlTypeCallback */
07421         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.SystemBackdrop"); }
07422     },
07423     {
07424         /* Arg1 TypeName */
07425         L"Microsoft.UI.Xaml.Media.XamlCompositionBrushBase",
07426         /* Arg2 CreateXamlTypeCallback */
07427         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Media.XamlCompositionBrushBase"); }
07428     },
07429     {
07430         /* Arg1 TypeName */
07431         L"Microsoft.UI.Xaml.ResourceDictionary",
07432         /* Arg2 CreateXamlTypeCallback */
07433         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.ResourceDictionary"); }
07434     },
07435     {
07436         /* Arg1 TypeName */
07437         L"Microsoft.UI.Xaml.Style",
07438         /* Arg2 CreateXamlTypeCallback */
07439         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Style"); }
07440     },
07441     {
07442         /* Arg1 TypeName */
07443         L"Microsoft.UI.Xaml.TextAlignment",
07444         /* Arg2 CreateXamlTypeCallback */
07445         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.TextAlignment"); }
07446     },
07447     {
07448         /* Arg1 TypeName */
07449         L"Microsoft.UI.Xaml.TextReadingOrder",
07450         /* Arg2 CreateXamlTypeCallback */
07451         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.TextReadingOrder"); }
07452     },
07453     {
07454         /* Arg1 TypeName */
07455         L"Microsoft.UI.Xaml.Thickness",
07456         /* Arg2 CreateXamlTypeCallback */
07457         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Thickness"); }
07458     },
07459     {
07460         /* Arg1 TypeName */
07461         L"Microsoft.UI.Xaml.UIElement",
07462         /* Arg2 CreateXamlTypeCallback */
07463         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.UIElement"); }
07464     },
07465     {
07466         /* Arg1 TypeName */
07467         L"Microsoft.UI.Xaml.Visibility",
07468         /* Arg2 CreateXamlTypeCallback */
07469         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Microsoft.UI.Xaml.Visibility"); }
07470     },
07471     {
07472         /* Arg1 TypeName */
07473         L"Microsoft.Web.WebView2.Core.CoreWebView2",
07474         /* Arg2 CreateXamlTypeCallback */
07475         []()
07476         {
07477             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Microsoft.Web.WebView2.Core.CoreWebView2", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07478             return static_cast<winrt::IXamlType>(*xamlType);
07479         }
07480     },
07481     {
07482         /* Arg1 TypeName */
07483         L"Object",
07484         /* Arg2 CreateXamlTypeCallback */
07485         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Object"); }
07486     },
07487     {
07488         /* Arg1 TypeName */
07489         L"Single",
07490         /* Arg2 CreateXamlTypeCallback */
07491         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"Single"); }
07492     },
07493     {
07494         /* Arg1 TypeName */
07495         L"String",
07496         /* Arg2 CreateXamlTypeCallback */
07497         []() { return winrt::make<PrimitiveXamlType>((PCWSTR)L"String"); }
07498     },
07499     {
07500         /* Arg1 TypeName */
07501         L"TimeSpan",
07502         /* Arg2 CreateXamlTypeCallback */
07503         []()
07504         {
07505             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"TimeSpan", (PCWSTR)L"ValueType" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07506             return static_cast<winrt::IXamlType>(*xamlType);
07507         }
07508     },
07509     {
07510         /* Arg1 TypeName */
07511         L"Uri",
07512         /* Arg2 CreateXamlTypeCallback */
07513         []()
07514         {
07515             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Uri", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07516             return static_cast<winrt::IXamlType>(*xamlType);
07517         }
07518     },
07519     {
07520         /* Arg1 TypeName */
07521         L"ValueType",
07522         /* Arg2 CreateXamlTypeCallback */
07523         []()
07524         {
07525             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"ValueType", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07526             return static_cast<winrt::IXamlType>(*xamlType);
07527         }
07528     },
07529     {
07530         /* Arg1 TypeName */
07531         L"Windows.ApplicationModel.Contacts.Contact",
07532         /* Arg2 CreateXamlTypeCallback */
07533         []()
07534         {
07535             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.ApplicationModel.Contacts.Contact", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07536             return static_cast<winrt::IXamlType>(*xamlType);
07537         }
07538     },
07539     {
07540         /* Arg1 TypeName */
07541         L"Windows.Devices.Geolocation.Geopoint",
07542         /* Arg2 CreateXamlTypeCallback */
07543         []()
07544         {
07545             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Devices.Geolocation.Geopoint", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07546             return static_cast<winrt::IXamlType>(*xamlType);
07547         }
07548     },
07549     {
07550         /* Arg1 TypeName */
07551         L"Windows.Foundation.Collections.IMap`2<String,Microsoft.UI.Xaml.DataTemplate>",
07552         /* Arg2 CreateXamlTypeCallback */
07553         []()
07554         {
07555             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IMap`2<String,Microsoft.UI.Xaml.DataTemplate>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07556             xamlType->SetAddToMapFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& map, winrt::IInspectable const& key, winrt::IInspectable const& value)
07557             {
07558                 map.as<winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::UI::Xaml::DataTemplate>>().Insert(unbox_value<winrt::hstring>(key), unbox_value<winrt::Microsoft::UI::Xaml::DataTemplate>(value));
07559             });
07560
07561             return static_cast<winrt::IXamlType>(*xamlType);
07562         }
07563     },
07564     {
07565         /* Arg1 TypeName */
07566         L"Windows.Foundation.Collections.IObservableVector`1<Microsoft.UI.Xaml.Controls.ICommandBarElement>",
07567         /* Arg2 CreateXamlTypeCallback */
07568         []()
07569         {
07570             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IObservableVector`1<Microsoft.UI.Xaml.Controls.ICommandBarElement>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07571             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07572             {
07573                 collection.as<winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::UI::Xaml::Controls::ICommandBarElement>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::ICommandBarElement>(value));
07574             });
07575
07576             return static_cast<winrt::IXamlType>(*xamlType);
07577         }
07578     },
07579     {
07580         /* Arg1 TypeName */
07581         L"Windows.Foundation.Collections.IObservableVector`1<Microsoft.UI.Xaml.Media.GradientStop>",
07582         /* Arg2 CreateXamlTypeCallback */
07583         []()
07584         {
07585             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IObservableVector`1<Microsoft.UI.Xaml.Media.GradientStop>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07586             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07587             {
07588                 collection.as<winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::UI::Xaml::Media::GradientStop>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Media::GradientStop>(value));
07589             });
07590
07591             return static_cast<winrt::IXamlType>(*xamlType);
07592         }
07593     },
07594     {
07595         /* Arg1 TypeName */
07596         L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>",
07597         /* Arg2 CreateXamlTypeCallback */
07598         []()
07599         {
07600             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IReadOnlyDictionary`2<String,Double>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07601             return static_cast<winrt::IXamlType>(*xamlType);
07602         }
07603     },
07604     {
07605         /* Arg1 TypeName */
07606         L"Windows.Foundation.Collections.IReadOnlyList`1<Microsoft.UI.Xaml.Controls.IndexPath>",
07607         /* Arg2 CreateXamlTypeCallback */
07608         []()
07609         {
07610             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IReadOnlyList`1<Microsoft.UI.Xaml.Controls.IndexPath>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07611             return static_cast<winrt::IXamlType>(*xamlType);
07612         }
07613     },
07614     {
07615         /* Arg1 TypeName */
07616         L"Windows.Foundation.Collections.IReadOnlyList`1<Microsoft.UI.Xaml.UIElement>",
07617         /* Arg2 CreateXamlTypeCallback */
07618         []()
07619         {
07620             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IReadOnlyList`1<Microsoft.UI.Xaml.UIElement>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07621             return static_cast<winrt::IXamlType>(*xamlType);
07622         }
07623     },
07624     {
07625         /* Arg1 TypeName */
07626         L"Windows.Foundation.Collections.IReadOnlyList`1<Object>",
07627         /* Arg2 CreateXamlTypeCallback */
07628         []()
07629         {
07630             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IReadOnlyList`1<Object>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07631             return static_cast<winrt::IXamlType>(*xamlType);
07632         }
07633     },
07634     {
07635         /* Arg1 TypeName */
07636         L"Windows.Foundation.Collections.IVector`1<Int32>",
07637         /* Arg2 CreateXamlTypeCallback */
07638         []()
07639         {
07640             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Int32>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07641             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07642             {
07643                 collection.as<winrt::Windows::Foundation::Collections::IVector<int>>().Append(unbox_value<int>(value));
07644             });
07645
07646             return static_cast<winrt::IXamlType>(*xamlType);
07647         }
07648     },
07649     {
07650         /* Arg1 TypeName */
07651         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.AnnotatedScrollBarLabel>",
07652         /* Arg2 CreateXamlTypeCallback */
07653         []()
07654         {
07655             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.AnnotatedScrollBarLabel>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07656             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07657             {
07658                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::AnnotatedScrollBarLabel>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::AnnotatedScrollBarLabel>(value));
07659             });
07660
07661             return static_cast<winrt::IXamlType>(*xamlType);
07662         }
07663     },
07664     {
07665         /* Arg1 TypeName */
07666         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MapElement>",
07667         /* Arg2 CreateXamlTypeCallback */
07668         []()
07669         {
07670             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MapElement>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07671             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07672             {
07673                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::MapElement>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::MapElement>(value));
07674             });
07675
07676             return static_cast<winrt::IXamlType>(*xamlType);
07677         }
07678     },
07679     {
07680         /* Arg1 TypeName */
07681         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MapLayer>",
07682         /* Arg2 CreateXamlTypeCallback */
07683         []()
07684         {
07685             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MapLayer>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07686             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07687             {
07688                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::MapLayer>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::MapLayer>(value));
07689             });
07690
07691             return static_cast<winrt::IXamlType>(*xamlType);
07692         }
07693     },
07694     {
07695         /* Arg1 TypeName */
07696         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MenuBarItem>",
07697         /* Arg2 CreateXamlTypeCallback */
07698         []()
07699         {
07700             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MenuBarItem>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07701             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07702             {
07703                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::MenuBarItem>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::MenuBarItem>(value));
07704             });
07705
07706             return static_cast<winrt::IXamlType>(*xamlType);
07707         }
07708     },
07709     {
07710         /* Arg1 TypeName */
07711         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MenuFlyoutItemBase>",
07712         /* Arg2 CreateXamlTypeCallback */
07713         []()
07714         {
07715             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.MenuFlyoutItemBase>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07716             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07717             {
07718                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::MenuFlyoutItemBase>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::MenuFlyoutItemBase>(value));
07719             });
07720
07721             return static_cast<winrt::IXamlType>(*xamlType);
07722         }
07723     },
07724     {
07725         /* Arg1 TypeName */
07726         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointBase>",
07727         /* Arg2 CreateXamlTypeCallback */
07728         []()
07729         {
07730             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.Primitives.ScrollSnapPointBase>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07731             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07732             {
07733                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::Primitives::ScrollSnapPointBase>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::Primitives::ScrollSnapPointBase>(value));
07734             });
07735
07736             return static_cast<winrt::IXamlType>(*xamlType);
07737         }
07738     },
07739     {
07740         /* Arg1 TypeName */
07741         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPointBase>",
07742         /* Arg2 CreateXamlTypeCallback */
07743         []()
07744         {
07745             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.Primitives.ZoomSnapPointBase>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07746             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07747             {
07748                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::Primitives::ZoomSnapPointBase>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::Primitives::ZoomSnapPointBase>(value));
07749             });
07750
07751             return static_cast<winrt::IXamlType>(*xamlType);
07752         }
07753     },
07754     {
07755         /* Arg1 TypeName */
07756         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.SelectorBarItem>",
07757         /* Arg2 CreateXamlTypeCallback */
07758         []()
07759         {
07760             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.SelectorBarItem>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07761             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07762             {
07763                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::SelectorBarItem>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::SelectorBarItem>(value));
07764             });
07765
07766             return static_cast<winrt::IXamlType>(*xamlType);
07767         }
07768     },
07769     {
07770         /* Arg1 TypeName */
07771         L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.TreeViewNode>",
07772         /* Arg2 CreateXamlTypeCallback */
07773         []()
07774         {
07775             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.TreeViewNode>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07776             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07777             {
07778                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::TreeViewNode>>().Append(unbox_value<winrt::Microsoft::UI::Xaml::Controls::TreeViewNode>(value));
07779             });
07780
07781             return static_cast<winrt::IXamlType>(*xamlType);
07782         }
07783     },
07784     {
07785         /* Arg1 TypeName */
07786         L"Windows.Foundation.Collections.IVector`1<Object>",
07787         /* Arg2 CreateXamlTypeCallback */
07788         []()
07789         {
07790             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Collections.IVector`1<Object>", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07791             xamlType->SetCollectionAddFunc((std::function<void(winrt::IInspectable const&, winrt::IInspectable const&)>)[](winrt::IInspectable const& collection, winrt::IInspectable const& value)
07792             {
07793                 collection.as<winrt::Windows::Foundation::Collections::IVector<winrt::IInspectable>>().Append(unbox_value<winrt::IInspectable>(value));
07794             });
07795
07796             return static_cast<winrt::IXamlType>(*xamlType);
07797         }
07798     },
07799     {
07800         /* Arg1 TypeName */
07801         L"Windows.Foundation.IReference`1<Double>",
07802         /* Arg2 CreateXamlTypeCallback */
07803         []() { return winrt::make<NullableXamlType>((PCWSTR)L"Windows.Foundation.IReference`1<Double>", (PCWSTR)L"Double"); }
07804     },
07805     {
07806         /* Arg1 TypeName */
07807         L"Windows.Foundation.IReference`1<Windows.UI.Color>",
07808         /* Arg2 CreateXamlTypeCallback */
07809         []() { return winrt::make<NullableXamlType>((PCWSTR)L"Windows.Foundation.IReference`1<Windows.UI.Color>", (PCWSTR)L"Windows.UI.Color"); }
07810     },
07811     {
07812         /* Arg1 TypeName */
07813         L"Windows.Foundation.Numerics.Vector4",
07814         /* Arg2 CreateXamlTypeCallback */
07815         []()
07816         {
07817             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Numerics.Vector4", (PCWSTR)L"ValueType" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07818             return static_cast<winrt::IXamlType>(*xamlType);
07819         }
07820     },
07821     {
07822         /* Arg1 TypeName */
07823         L"Windows.Foundation.Point",
07824         /* Arg2 CreateXamlTypeCallback */
07825         []()
07826         {
07827             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Point", (PCWSTR)L"ValueType" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07828             return static_cast<winrt::IXamlType>(*xamlType);
07829         }
07830     },
07831     {
07832         /* Arg1 TypeName */
07833         L"Windows.Foundation.Rect",
07834         /* Arg2 CreateXamlTypeCallback */
07835         []()
07836         {
07837             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Foundation.Rect", (PCWSTR)L"ValueType" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07838             return static_cast<winrt::IXamlType>(*xamlType);
07839         }
07840     },
07841     {
07842         /* Arg1 TypeName */
07843         L"Windows.Globalization.NumberFormatting.INumberFormatter2",
07844         /* Arg2 CreateXamlTypeCallback */
07845         []()
07846         {
07847             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.Globalization.NumberFormatting.INumberFormatter2", (PCWSTR)L"Object" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07848             return static_cast<winrt::IXamlType>(*xamlType);
07849         }
07850     },
07851     {
07852         /* Arg1 TypeName */
07853         L"Windows.UI.Color",
07854         /* Arg2 CreateXamlTypeCallback */
07855         []()
07856         {
07857             auto xamlType = winrt::make_self<XamlType>((PCWSTR)L"Windows.UI.Color", (PCWSTR)L"ValueType" /* BaseTypeName */ , nullptr /* Activator Func */, nullptr /* PopulatePropertiesFunc */ );
07858             return static_cast<winrt::IXamlType>(*xamlType);
07859         }
07860     },
07861 };
07862
07863 hstring c_knownNamespacePrefixes[] =
07864 {
07865     L"Microsoft.UI.Composition.",
07866     L"Microsoft.UI.Xaml.",
07867     L"Microsoft.Web.WebView2.",
07868     L"Windows.ApplicationModel.Contacts.",
07869     L"Windows.Devices.Geolocation.",
07870     L"Windows.Foundation.",
07871     L"Windows.Foundation.Collections.",
07872     L"Windows.Foundation.Numerics.",
07873     L"Windows.Globalization.NumberFormatting.",
07874     L"Windows.UI.",
07875 };
07876 }
07877
07878 #include "AcrylicBrush.properties.h"
07879 #include "AnimatedIcon.properties.h"
07880 #include "AnimatedIconSource.properties.h"
07881 #include "AnimatedVisualPlayer.properties.h"
07882 #include "AnnotatedScrollBar.properties.h"
07883 #include "AutoSuggestBoxHelper.properties.h"
07884 #include "BreadcrumbBar.properties.h"
07885 #include "ColorPicker.properties.h"
07886 #include "ColorPickerSlider.properties.h"
07887 #include "ColorSpectrum.properties.h"
07888 #include "ColumnMajorUniformToLargestGridLayout.properties.h"
07889 #include "ComboBoxHelper.properties.h"
07890 #include "CommandBarFlyoutCommandBar.properties.h"
07891 #include "CommandBarFlyoutCommandBarAutomationProperties.properties.h"
07892 #include "CommandBarFlyoutCommandBarTemplateSettings.properties.h"
07893 #include "CornerRadiusFilterConverter.properties.h"
07894 #include "CornerRadiusToThicknessConverter.properties.h"
07895 #include "Expander.properties.h"
07896 #include "FlowLayout.properties.h"
07897 #include "ImageIcon.properties.h"
07898 #include "ImageIconSource.properties.h"
07899 #include "InfoBadge.properties.h"
07900 #include "InfoBadgeTemplateSettings.properties.h"
07901 #include "InfoBar.properties.h"
07902 #include "InfoBarPanel.properties.h"
07903 #include "InfoBarTemplateSettings.properties.h"
07904 #include "InkCanvas.properties.h"
07905 #include "ItemContainer.properties.h"
07906 #include "ItemsRepeater.properties.h"
07907 #include "ItemsView.properties.h"
07908 #include "LayoutPanel.properties.h"
07909 #include "LinedFlowLayout.properties.h"
07910 #include "MapControl.properties.h"
07911 #include "MapElementsLayer.properties.h"
07912 #include "MapIcon.properties.h"
07913 #include "MenuBar.properties.h"
07914 #include "MenuBarItem.properties.h"
07915 #include "MicaBackdrop.properties.h"
07916 #include "MonochromaticOverlayPresenter.properties.h"
07917 #include "NavigationView.properties.h"
07918 #include "NavigationViewItem.properties.h"
07919 #include "NavigationViewItemBase.properties.h"
07920 #include "NavigationViewItemPresenter.properties.h"
07921 #include "NavigationViewItemPresenterTemplateSettings.properties.h"
07922 #include "NavigationViewTemplateSettings.properties.h"
07923 #include "NumberBox.properties.h"
07924 #include "PagerControl.properties.h"
07925 #include "ParallaxView.properties.h"
07926 #include "PersonPicture.properties.h"
07927 #include "PipsPager.properties.h"
07928 #include "ProgressBar.properties.h"
07929 #include "ProgressBarTemplateSettings.properties.h"
07930 #include "ProgressRing.properties.h"
07931 #include "RadialGradientBrush.properties.h"
07932 #include "RadioButtons.properties.h"
07933 #include "RadioMenuFlyoutItem.properties.h"
07934 #include "RatingControl.properties.h"
07935 #include "RatingItemFontInfo.properties.h"
07936 #include "RatingItemImageInfo.properties.h"
07937 #include "RecyclePool.properties.h"
07938 #include "RefreshContainer.properties.h"
07939 #include "RefreshVisualizer.properties.h"
07940 #include "RevealBrush.properties.h"
07941 #include "ScrollPresenter.properties.h"
07942 #include "ScrollView.properties.h"
07943 #include "SelectorBar.properties.h"
07944 #include "SelectorBarItem.properties.h"
07945 #include "SplitButton.properties.h"
07946 #include "StackLayout.properties.h"
07947 #include "SwipeControl.properties.h"
07948 #include "SwipeItem.properties.h"
07949 #include "SwipeItems.properties.h"
07950 #include "TabView.properties.h"
07951 #include "TabViewItem.properties.h"
07952 #include "TabViewItemTemplateSettings.properties.h"
07953 #include "TeachingTip.properties.h"
07954 #include "TeachingTipTemplateSettings.properties.h"
07955 #include "TitleBar.properties.h"
07956 #include "TitleBarTemplateSettings.properties.h"
07957 #include "ToggleSplitButton.properties.h"
07958 #include "TreeView.properties.h"
07959 #include "TreeViewItem.properties.h"
07960 #include "TreeViewItemTemplateSettings.properties.h"
07961 #include "TreeViewNode.properties.h"
07962 #include "TwoPaneView.properties.h"
07963 #include "UniformGridLayout.properties.h"
07964 #include "WebView2.properties.h"
07965 #include "XamlControlsResources.properties.h"
07966 #include "AutoSuggestBoxHelper.h"
07967 #include "ComboBoxHelper.h"
07968 #include "RecyclePool.h"
07969 #include "RevealBrush.h"
07970
07971 namespace {
07972
07973 void ClearTypeProperties()
07974 {
07975     AcrylicBrushProperties::ClearProperties();
07976     AnimatedIconProperties::ClearProperties();
07977     AnimatedIconSourceProperties::ClearProperties();
07978     AnimatedVisualPlayerProperties::ClearProperties();
07979     AnnotatedScrollBarProperties::ClearProperties();
07980     AutoSuggestBoxHelperProperties::ClearProperties();
07981     BreadcrumbBarProperties::ClearProperties();
07982     ColorPickerProperties::ClearProperties();
07983     ColorPickerSliderProperties::ClearProperties();
07984     ColorSpectrumProperties::ClearProperties();
07985     ColumnMajorUniformToLargestGridLayoutProperties::ClearProperties();
07986     ComboBoxHelperProperties::ClearProperties();
07987     CommandBarFlyoutCommandBarProperties::ClearProperties();
07988     CommandBarFlyoutCommandBarAutomationPropertiesProperties::ClearProperties();
07989     CommandBarFlyoutCommandBarTemplateSettingsProperties::ClearProperties();
07990     CornerRadiusFilterConverterProperties::ClearProperties();
07991     CornerRadiusToThicknessConverterProperties::ClearProperties();
07992     ExpanderProperties::ClearProperties();
07993     FlowLayoutProperties::ClearProperties();
07994     ImageIconProperties::ClearProperties();
07995     ImageIconSourceProperties::ClearProperties();
07996     InfoBadgeProperties::ClearProperties();
07997     InfoBadgeTemplateSettingsProperties::ClearProperties();
07998     InfoBarProperties::ClearProperties();
07999     InfoBarPanelProperties::ClearProperties();
08000     InfoBarTemplateSettingsProperties::ClearProperties();
08001     InkCanvasProperties::ClearProperties();
08002     ItemContainerProperties::ClearProperties();
08003     ItemsRepeaterProperties::ClearProperties();
08004     ItemsViewProperties::ClearProperties();
08005     LayoutPanelProperties::ClearProperties();
08006     LinedFlowLayoutProperties::ClearProperties();
08007     MapControlProperties::ClearProperties();
08008     MapElementsLayerProperties::ClearProperties();
08009     MapIconProperties::ClearProperties();
08010     MenuBarProperties::ClearProperties();
08011     MenuBarItemProperties::ClearProperties();
08012     MicaBackdropProperties::ClearProperties();
08013     MonochromaticOverlayPresenterProperties::ClearProperties();
08014     NavigationViewProperties::ClearProperties();
08015     NavigationViewItemProperties::ClearProperties();
08016     NavigationViewItemBaseProperties::ClearProperties();
08017     NavigationViewItemPresenterProperties::ClearProperties();
08018     NavigationViewItemPresenterTemplateSettingsProperties::ClearProperties();
08019     NavigationViewTemplateSettingsProperties::ClearProperties();
08020     NumberBoxProperties::ClearProperties();
08021     PagerControlProperties::ClearProperties();
08022     ParallaxViewProperties::ClearProperties();
08023     PersonPictureProperties::ClearProperties();
08024     PipsPagerProperties::ClearProperties();
08025     ProgressBarProperties::ClearProperties();
08026     ProgressBarTemplateSettingsProperties::ClearProperties();
08027     ProgressRingProperties::ClearProperties();
08028     RadialGradientBrushProperties::ClearProperties();
08029     RadioButtonsProperties::ClearProperties();
08030     RadioMenuFlyoutItemProperties::ClearProperties();
08031     RatingControlProperties::ClearProperties();
08032     RatingItemFontInfoProperties::ClearProperties();
08033     RatingItemImageInfoProperties::ClearProperties();
08034     RecyclePoolProperties::ClearProperties();
08035     RefreshContainerProperties::ClearProperties();
08036     RefreshVisualizerProperties::ClearProperties();
08037     RevealBrushProperties::ClearProperties();
08038     ScrollPresenterProperties::ClearProperties();
08039     ScrollViewProperties::ClearProperties();
08040     SelectorBarProperties::ClearProperties();
08041     SelectorBarItemProperties::ClearProperties();
08042     SplitButtonProperties::ClearProperties();
08043     StackLayoutProperties::ClearProperties();
08044     SwipeControlProperties::ClearProperties();
08045     SwipeItemProperties::ClearProperties();
08046     SwipeItemsProperties::ClearProperties();
08047     TabViewProperties::ClearProperties();
08048     TabViewItemProperties::ClearProperties();
08049     TabViewItemTemplateSettingsProperties::ClearProperties();
08050     TeachingTipProperties::ClearProperties();
08051     TeachingTipTemplateSettingsProperties::ClearProperties();
08052     TitleBarProperties::ClearProperties();
08053     TitleBarTemplateSettingsProperties::ClearProperties();
08054     ToggleSplitButtonProperties::ClearProperties();
08055     TreeViewProperties::ClearProperties();
08056     TreeViewItemProperties::ClearProperties();
08057     TreeViewItemTemplateSettingsProperties::ClearProperties();
08058     TreeViewNodeProperties::ClearProperties();
08059     TwoPaneViewProperties::ClearProperties();
08060     UniformGridLayoutProperties::ClearProperties();
08061     WebView2Properties::ClearProperties();
08062     XamlControlsResourcesProperties::ClearProperties();
08063     AutoSuggestBoxHelper::ClearProperties();
08064     ComboBoxHelper::ClearProperties();
08065     RecyclePool::ClearProperties();
08066     RevealBrush::ClearProperties();
08067 }
08068
08069 }
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PersonPicture/PersonPictureAutomationPeer.cpp Source File

  • PersonPicture

PersonPictureAutomationPeer.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "PersonPicture.h"
00007 #include "PersonPictureAutomationPeer.h"
00008
00009 #include "PersonPictureAutomationPeer.properties.cpp"
00010
00011 PersonPictureAutomationPeer::PersonPictureAutomationPeer(winrt::PersonPicture const& owner) :
00012     ReferenceTracker(owner)
00013 {
00014 }
00015
00016 //IAutomationPeerOverrides
00017
00018 winrt::AutomationControlType PersonPictureAutomationPeer::GetAutomationControlTypeCore()
00019 {
00020     return winrt::AutomationControlType::Text;
00021 }
00022
00023 winrt::hstring PersonPictureAutomationPeer::GetClassNameCore()
00024 {
00025     return winrt::hstring_name_of<winrt::PersonPicture>();
00026 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/FlowLayoutAlgorithm.cpp Source File

  • Repeater

FlowLayoutAlgorithm.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include <ItemsRepeater.common.h>
00007 #include "FlowLayoutAlgorithm.h"
00008 #include "VirtualizingLayoutContext.h"
00009 #include "MuxcTraceLogging.h"
00010
00011 void FlowLayoutAlgorithm::InitializeForContext(
00012     const winrt::VirtualizingLayoutContext& context,
00013     IFlowLayoutAlgorithmDelegates* callbacks)
00014 {
00015     m_algorithmCallbacks = callbacks;
00016     m_context.set(context);
00017     m_elementManager.SetContext(context);
00018 }
00019
00020 void FlowLayoutAlgorithm::UninitializeForContext(const winrt::VirtualizingLayoutContext& context)
00021 {
00022     if (IsVirtualizingContext())
00023     {
00024         // This layout is about to be detached. Let go of all elements
00025         // being held and remove the layout state from the context.
00026         m_elementManager.ClearRealizedRange();
00027     }
00028     context.LayoutStateCore(nullptr);
00029 }
00030
00031 winrt::Size FlowLayoutAlgorithm::Measure(
00032     const winrt::Size& availableSize,
00033     const winrt::VirtualizingLayoutContext& context,
00034     bool isWrapping,
00035     double minItemSpacing,
00036     double lineSpacing,
00037     unsigned int maxItemsPerLine,
00038     const ScrollOrientation& orientation,
00039     const bool isVirtualizationEnabled,
00040     const wstring_view& layoutId)
00041 {
00042     SetScrollOrientation(orientation);
00043
00044     // If minor size is infinity, there is only one line and no need to align that line.
00045     m_scrollOrientationSameAsFlow = Minor(availableSize) == std::numeric_limits<float>::infinity();
00046     const auto realizationRect = RealizationRect();
00047
00048     ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT_FLT_FLT_FLT, METH_NAME, this,
00049         winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(),
00050         L"MeasureLayout Realization:", realizationRect.X, realizationRect.Y, realizationRect.Width, realizationRect.Height);
00051
00052     TraceLoggingProviderWrite(
00053         XamlTelemetryLogging, "FlowLayoutAlgorithm_Measure",
00054         TraceLoggingWideString(layoutId.data(), "LayoutId"),
00055         TraceLoggingFloat32(realizationRect.X, "X"),
00056         TraceLoggingFloat32(realizationRect.Y, "Y"),
00057         TraceLoggingFloat32(realizationRect.Width, "Width"),
00058         TraceLoggingFloat32(realizationRect.Height, "Height"),
00059         TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
00060
00061     const auto suggestedAnchorIndex = m_context.get().RecommendedAnchorIndex();
00062     if (m_elementManager.IsIndexValidInData(suggestedAnchorIndex))
00063     {
00064         const auto anchorRealized = m_elementManager.IsDataIndexRealized(suggestedAnchorIndex);
00065         if (!anchorRealized)
00066         {
00067             MakeAnchor(m_context.get(), suggestedAnchorIndex, availableSize);
00068         }
00069     }
00070
00071     if (isVirtualizationEnabled)
00072     {
00073         m_elementManager.OnBeginMeasure(orientation);
00074     }
00075
00076     const int anchorIndex = GetAnchorIndex(availableSize, isWrapping, minItemSpacing, isVirtualizationEnabled, layoutId);
00077     Generate(GenerateDirection::Forward, anchorIndex, availableSize, isWrapping, minItemSpacing, lineSpacing, maxItemsPerLine, isVirtualizationEnabled, layoutId);
00078     Generate(GenerateDirection::Backward, anchorIndex, availableSize, isWrapping, minItemSpacing, lineSpacing, maxItemsPerLine, isVirtualizationEnabled, layoutId);
00079     if (isWrapping && IsReflowRequired())
00080     {
00081         ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR, METH_NAME, this,
00082             winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(), L"Reflow Pass.");
00083
00084         const auto firstElementBounds = m_elementManager.GetLayoutBoundsForRealizedIndex(0);
00085         MinorStart(firstElementBounds) = 0;
00086         m_elementManager.SetLayoutBoundsForRealizedIndex(0, firstElementBounds);
00087         Generate(GenerateDirection::Forward, 0 /*anchorIndex*/, availableSize, isWrapping, minItemSpacing, lineSpacing, maxItemsPerLine, isVirtualizationEnabled, layoutId);
00088     }
00089
00090     RaiseLineArranged();
00091     m_collectionChangePending = false;
00092     m_lastExtent = EstimateExtent(availableSize, layoutId);
00093     SetLayoutOrigin();
00094
00095     return winrt::Size{ m_lastExtent.Width, m_lastExtent.Height };
00096 }
00097
00098 winrt::Size FlowLayoutAlgorithm::Arrange(
00099     const winrt::Size& finalSize,
00100     const winrt::VirtualizingLayoutContext& context,
00101     bool isWrapping,
00102     FlowLayoutAlgorithm::LineAlignment lineAlignment,
00103     const wstring_view& layoutId)
00104 {
00105     ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR, METH_NAME, this,
00106         winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(), L"ArrangeLayout");
00107
00108     ArrangeVirtualizingLayout(finalSize, lineAlignment, isWrapping, layoutId);
00109
00110     return winrt::Size
00111     {
00112         std::max(finalSize.Width, m_lastExtent.Width),
00113         std::max(finalSize.Height, m_lastExtent.Height)
00114     };
00115 }
00116
00117 void FlowLayoutAlgorithm::MakeAnchor(
00118     const winrt::VirtualizingLayoutContext& context,
00119     int index,
00120     const winrt::Size& availableSize)
00121 {
00122     m_elementManager.ClearRealizedRange();
00123     // FlowLayout requires that the anchor is the first element in the row.
00124     const auto internalAnchor = m_algorithmCallbacks->Algorithm_GetAnchorForTargetElement(index, availableSize, context);
00125     MUX_ASSERT(internalAnchor.Index <= index);
00126
00127     // No need to set the position of the anchor.
00128     // (0,0) is fine for now since the extent can
00129     // grow in any direction.
00130     for (int dataIndex = internalAnchor.Index; dataIndex < index + 1; ++dataIndex)
00131     {
00132         auto element = context.GetOrCreateElementAt(dataIndex, winrt::ElementRealizationOptions::ForceCreate | winrt::ElementRealizationOptions::SuppressAutoRecycle);
00133         element.Measure(m_algorithmCallbacks->Algorithm_GetMeasureSize(dataIndex, availableSize, context));
00134         m_elementManager.Add(element, dataIndex);
00135     }
00136 }
00137
00138 void FlowLayoutAlgorithm::OnItemsSourceChanged(
00139     const winrt::IInspectable& source,
00140     winrt::NotifyCollectionChangedEventArgs const& args,
00141     const winrt::IVirtualizingLayoutContext& /*context*/)
00142 {
00143     m_elementManager.DataSourceChanged(source, args);
00144     m_collectionChangePending = true;
00145 }
00146
00147 winrt::Size FlowLayoutAlgorithm::MeasureElement(
00148     const winrt::UIElement& element,
00149     int index,
00150     const winrt::Size& availableSize,
00151     const winrt::VirtualizingLayoutContext& context)
00152 {
00153     const auto measureSize = m_algorithmCallbacks->Algorithm_GetMeasureSize(index, availableSize, context);
00154     element.Measure(measureSize);
00155     const auto provisionalArrangeSize = m_algorithmCallbacks->Algorithm_GetProvisionalArrangeSize(index, measureSize, element.DesiredSize(), context);
00156     m_algorithmCallbacks->Algorithm_OnElementMeasured(element, index, availableSize, measureSize, element.DesiredSize(), provisionalArrangeSize, context);
00157
00158     return provisionalArrangeSize;
00159 }
00160
00161 #pragma region Measure related private methods
00162
00163 int FlowLayoutAlgorithm::GetAnchorIndex(
00164     const winrt::Size& availableSize,
00165     bool isWrapping,
00166     double minItemSpacing,
00167     const bool isVirtualizationEnabled,
00168     const wstring_view& layoutId)
00169 {
00170     int anchorIndex = -1;
00171     winrt::Point anchorPosition{};
00172     auto context = m_context.get();
00173
00174     if (!IsVirtualizingContext() || !isVirtualizationEnabled)
00175     {
00176         // Non virtualizing host, start generating from the element 0
00177         anchorIndex = context.ItemCountCore() > 0 ? 0 : -1;
00178     }
00179     else
00180     {
00181         const bool isRealizationWindowConnected = m_elementManager.IsWindowConnected(RealizationRect(), GetScrollOrientation(), m_scrollOrientationSameAsFlow);
00182         // Item spacing and size in non-virtualizing direction change can cause elements to reflow
00183         // and get a new column position. In that case we need the anchor to be positioned in the
00184         // correct column.
00185         const bool needAnchorColumnReevaluation = isWrapping && (
00186             Minor(m_lastAvailableSize) != Minor(availableSize) ||
00187             m_lastItemSpacing != minItemSpacing ||
00188             m_collectionChangePending);
00189
00190         const auto suggestedAnchorIndex = m_context.get().RecommendedAnchorIndex();
00191
00192         const bool isAnchorSuggestionValid = suggestedAnchorIndex >= 0 &&
00193             m_elementManager.IsDataIndexRealized(suggestedAnchorIndex);
00194
00195         if (isAnchorSuggestionValid)
00196         {
00197             ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_INT, METH_NAME, this,
00198                 winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(),
00199                 L"Using suggested anchor:", suggestedAnchorIndex);
00200
00201             anchorIndex = m_algorithmCallbacks->Algorithm_GetAnchorForTargetElement(
00202                 suggestedAnchorIndex,
00203                 availableSize,
00204                 context).Index;
00205
00206             if (m_elementManager.IsDataIndexRealized(anchorIndex))
00207             {
00208                 const auto anchorBounds = m_elementManager.GetLayoutBoundsForDataIndex(anchorIndex);
00209                 if (needAnchorColumnReevaluation)
00210                 {
00211                     // We were provided a valid anchor, but its position might be incorrect because for example it is in
00212                     // the wrong column. We do know that the anchor is the first element in the row, so we can force the minor position
00213                     // to start at 0.
00214                     anchorPosition = MinorMajorPoint(0, MajorStart(anchorBounds));
00215                 }
00216                 else
00217                 {
00218                     anchorPosition = winrt::Point(anchorBounds.X, anchorBounds.Y);
00219                 }
00220             }
00221             else
00222             {
00223                 // It is possible to end up in a situation during a collection change where GetAnchorForTargetElement returns an index
00224                 // which is not in the realized range. Eg. insert one item at index 0 for a grid layout.
00225                 // SuggestedAnchor will be 1 (used to be 0) and GetAnchorForTargetElement will return 0 (left most item in row). However 0 is not in the
00226                 // realized range yet. In this case we realize the gap between the target anchor and the suggested anchor.
00227                 const int firstRealizedDataIndex = m_elementManager.GetDataIndexFromRealizedRangeIndex(0);
00228                 MUX_ASSERT(anchorIndex < firstRealizedDataIndex);
00229                 for (int i = firstRealizedDataIndex - 1; i >= anchorIndex; --i)
00230                 {
00231                     m_elementManager.EnsureElementRealized(false /*forward*/, i, layoutId);
00232                 }
00233
00234                 const auto anchorBounds = m_elementManager.GetLayoutBoundsForDataIndex(suggestedAnchorIndex);
00235                 anchorPosition = MinorMajorPoint(0, MajorStart(anchorBounds));
00236             }
00237         }
00238         else if (needAnchorColumnReevaluation || !isRealizationWindowConnected)
00239         {
00240             if (needAnchorColumnReevaluation)
00241             {
00242                 ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR, METH_NAME, this,
00243                     winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(), L"NeedAnchorColumnReevaluation.");
00244             }
00245
00246             if (!isRealizationWindowConnected)
00247             {
00248                 ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR, METH_NAME, this,
00249                     winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(), L"Disconnected Window.");
00250             }
00251
00252             // The anchor is based on the realization window because a connected ItemsRepeater might intersect the realization window
00253             // but not the visible window. In that situation, we still need to produce a valid anchor.
00254             const auto anchorInfo = m_algorithmCallbacks->Algorithm_GetAnchorForRealizationRect(availableSize, context);
00255             anchorIndex = anchorInfo.Index;
00256             anchorPosition = MinorMajorPoint(0, static_cast<float>(anchorInfo.Offset));
00257         }
00258         else
00259         {
00260             ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR, METH_NAME, this,
00261                 winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(),
00262                 L"Connected Window - picking first realized element as anchor.");
00263
00264             // No suggestion - just pick first in realized range
00265             anchorIndex = m_elementManager.GetDataIndexFromRealizedRangeIndex(0);
00266             anchorPosition = MinorMajorPoint(0, MajorStart(m_elementManager.GetLayoutBoundsForRealizedIndex(0)));
00267         }
00268     }
00269
00270     ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_INT, METH_NAME, this,
00271         winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(),
00272         L"Picked anchor:", anchorIndex);
00273
00274     MUX_ASSERT(anchorIndex == -1 || m_elementManager.IsIndexValidInData(anchorIndex));
00275     m_firstRealizedDataIndexInsideRealizationWindow = m_lastRealizedDataIndexInsideRealizationWindow = anchorIndex;
00276     if (m_elementManager.IsIndexValidInData(anchorIndex))
00277     {
00278         if (!m_elementManager.IsDataIndexRealized(anchorIndex))
00279         {
00280             // Disconnected, throw everything and create new anchor
00281             ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR, METH_NAME, this,
00282                 winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(),
00283                 L"Disconnected Window - throwing away all realized elements.");
00284
00285             m_elementManager.ClearRealizedRange();
00286
00287             auto anchor = m_context.get().GetOrCreateElementAt(anchorIndex, winrt::ElementRealizationOptions::ForceCreate | winrt::ElementRealizationOptions::SuppressAutoRecycle);
00288             m_elementManager.Add(anchor, anchorIndex);
00289         }
00290
00291         const auto anchorElement = m_elementManager.GetRealizedElement(anchorIndex);
00292         const auto desiredSize = MeasureElement(anchorElement, anchorIndex, availableSize, m_context.get());
00293         const auto layoutBounds = winrt::Rect{ anchorPosition.X, anchorPosition.Y, desiredSize.Width, desiredSize.Height };
00294         m_elementManager.SetLayoutBoundsForDataIndex(anchorIndex, layoutBounds);
00295
00296         ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_INT_FLT_FLT_FLT_FLT, METH_NAME, this,
00297             winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(),
00298             L"Anchor index & Layout bounds:", anchorIndex, layoutBounds.X, layoutBounds.Y, layoutBounds.Width, layoutBounds.Height);
00299     }
00300     else
00301     {
00302         // Throw everything away
00303         ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR, METH_NAME, this,
00304             winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), layoutId.data(),
00305             L"Anchor index is not valid - throwing away all realized elements.");
00306         m_elementManager.ClearRealizedRange();
00307     }
00308
00309     // TODO: Perhaps we can track changes in the property setter
00310     m_lastAvailableSize = availableSize;
00311     m_lastItemSpacing = minItemSpacing;
00312
00313     return anchorIndex;
00314 }
00315
00316
00317 void FlowLayoutAlgorithm::Generate(
00318     GenerateDirection direction,
00319     int anchorIndex,
00320     const winrt::Size& availableSize,
00321     bool isWrapping,
00322     double minItemSpacing,
00323     double lineSpacing,
00324     unsigned int maxItemsPerLine,
00325     const bool isVirtualizationEnabled,
00326     const wstring_view& layoutId)
00327 {
00328     if (anchorIndex != -1)
00329     {
00330         const int step = (direction == GenerateDirection::Forward) ? 1 : -1;
00331
00332         ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_INT, METH_NAME, this,
00333             winrt::get_self<VirtualizingLayoutContext>(m_context.get())->Indent(), layoutId.data(),
00334             direction == GenerateDirection::Forward ? L"Generating forward from anchor:" : L"Generating backward from anchor:",
00335             anchorIndex);
00336
00337         TraceLoggingProviderWrite(
00338             XamlTelemetryLogging, "FlowLayoutAlgorithm_Generate",
00339             TraceLoggingWideString(layoutId.data(), "LayoutId"),
00340             TraceLoggingWideString(direction == GenerateDirection::Forward ? L"Forward" : L"Backward", "Direction"),
00341             TraceLoggingInt32(anchorIndex, "Anchor"),
00342             TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
00343
00344         int previousIndex = anchorIndex;
00345         int currentIndex = anchorIndex + step;
00346         const auto anchorBounds = m_elementManager.GetLayoutBoundsForDataIndex(anchorIndex);
00347         float lineOffset = MajorStart(anchorBounds);
00348         float lineMajorSize = MajorSize(anchorBounds);
00349         unsigned int countInLine = 1;
00350         bool lineNeedsReposition = false;
00351
00352         while (m_elementManager.IsIndexValidInData(currentIndex) &&
00353               (!isVirtualizationEnabled || ShouldContinueFillingUpSpace(previousIndex, direction)))
00354         {
00355             // Ensure layout element.
00356             m_elementManager.EnsureElementRealized(direction == GenerateDirection::Forward, currentIndex, layoutId);
00357             const auto currentElement = m_elementManager.GetRealizedElement(currentIndex);
00358             const auto desiredSize = MeasureElement(currentElement, currentIndex, availableSize, m_context.get());
00359
00360             // Lay it out.
00361             const auto previousElement = m_elementManager.GetRealizedElement(previousIndex);
00362             const winrt::Rect currentBounds = winrt::Rect{ 0, 0, desiredSize.Width, desiredSize.Height };
00363             const auto previousElementBounds = m_elementManager.GetLayoutBoundsForDataIndex(previousIndex);
00364
00365             TraceLoggingProviderWrite(
00366                 XamlTelemetryLogging, "FlowLayoutAlgorithm_Generate_CurrentBounds",
00367                 TraceLoggingWideString(layoutId.data(), "LayoutId"),
00368                 TraceLoggingInt32(currentIndex, "CurrentIndex"),
00369                 TraceLoggingFloat32(currentBounds.X, "X"),
00370                 TraceLoggingFloat32(currentBounds.Y, "Y"),
00371                 TraceLoggingFloat32(currentBounds.Width, "Width"),
00372                 TraceLoggingFloat32(currentBounds.Height, "Height"),
00373                 TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
00374
00375             if (direction == GenerateDirection::Forward)
00376             {
00377                 const double remainingSpace = static_cast<double>(Minor(availableSize)) -
00378                                               (static_cast<double>(MinorStart(previousElementBounds)) +
00379                                                static_cast<double>(MinorSize(previousElementBounds)) +
00380                                                minItemSpacing +
00381                                                static_cast<double>(Minor(desiredSize)));
00382                 if (countInLine >= maxItemsPerLine || m_algorithmCallbacks->Algorithm_ShouldBreakLine(currentIndex, remainingSpace))
00383                 {
00384                     // No more space in this row. wrap to next row.
00385                     MinorStart(currentBounds) = 0;
00386                     MajorStart(currentBounds) = MajorStart(previousElementBounds) + lineMajorSize + static_cast<float>(lineSpacing);
00387
00388                     if (lineNeedsReposition)
00389                     {
00390                         // reposition the previous line (countInLine items)
00391                         for (unsigned int i = 0; i < countInLine; i++)
00392                         {
00393                             const auto dataIndex = currentIndex - 1 - i;
00394                             const auto bounds = m_elementManager.GetLayoutBoundsForDataIndex(dataIndex);
00395                             MajorSize(bounds) = lineMajorSize;
00396                             m_elementManager.SetLayoutBoundsForDataIndex(dataIndex, bounds);
00397                         }
00398                     }
00399
00400                     // Setup for next line.
00401                     lineMajorSize = MajorSize(currentBounds);
00402                     lineOffset = MajorStart(currentBounds);
00403                     lineNeedsReposition = false;
00404                     countInLine = 1;
00405                 }
00406                 else
00407                 {
00408                     // More space is available in this row.
00409                     MinorStart(currentBounds) = MinorStart(previousElementBounds) + MinorSize(previousElementBounds) + static_cast<float>(minItemSpacing);
00410                     MajorStart(currentBounds) = lineOffset;
00411                     lineMajorSize = std::max(lineMajorSize, MajorSize(currentBounds));
00412                     lineNeedsReposition = MajorSize(previousElementBounds) != MajorSize(currentBounds);
00413                     countInLine++;
00414                 }
00415             }
00416             else
00417             {
00418                 // Backward
00419                 const double remainingSpace = MinorStart(previousElementBounds) - (Minor(desiredSize) + minItemSpacing);
00420                 if (countInLine >= maxItemsPerLine || m_algorithmCallbacks->Algorithm_ShouldBreakLine(currentIndex, remainingSpace))
00421                 {
00422                     if (isWrapping)
00423                     {
00424                         // Does not fit, wrap to the previous row
00425                         const auto availableSizeMinor = Minor(availableSize);
00426                         // If the last available size is finite, start from end and subtract our desired size.
00427                         // Otherwise, look at the last extent and use that for positioning.
00428                         MinorStart(currentBounds) = std::isfinite(availableSizeMinor) ? availableSizeMinor - Minor(desiredSize) : MinorSize(LastExtent()) - Minor(desiredSize);
00429                     }
00430                     // else keep MinorStart(currentBounds) at 0. Same as for GenerateDirection::Forward.
00431
00432                     MajorStart(currentBounds) = lineOffset - Major(desiredSize) - static_cast<float>(lineSpacing);
00433
00434                     if (lineNeedsReposition)
00435                     {
00436                         auto previousLineOffset = MajorStart(m_elementManager.GetLayoutBoundsForDataIndex(currentIndex + countInLine + 1));
00437                         // reposition the previous line (countInLine items)
00438                         for (unsigned int i = 0; i < countInLine; i++)
00439                         {
00440                             const auto dataIndex = currentIndex + 1 + (int)i;
00441                             if (dataIndex != anchorIndex)
00442                             {
00443                                 const auto bounds = m_elementManager.GetLayoutBoundsForDataIndex(dataIndex);
00444                                 MajorStart(bounds) = previousLineOffset - lineMajorSize - static_cast<float>(lineSpacing);
00445                                 MajorSize(bounds) = lineMajorSize;
00446                                 m_elementManager.SetLayoutBoundsForDataIndex(dataIndex, bounds);
00447
00448                                 ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_INT_FLT_FLT_FLT_FLT, METH_NAME, this,
00449                                     winrt::get_self<VirtualizingLayoutContext>(m_context.get())->Indent(), layoutId.data(),
00450                                     L"Element dataIndex & corrected layout bounds:", dataIndex, bounds.X, bounds.Y, bounds.Width, bounds.Height);
00451                             }
00452                         }
00453                     }
00454
00455                     // Setup for next line.
00456                     lineMajorSize = MajorSize(currentBounds);
00457                     lineOffset = MajorStart(currentBounds);
00458                     lineNeedsReposition = false;
00459                     countInLine = 1;
00460                 }
00461                 else
00462                 {
00463                     // Fits in this row. put it in the previous position
00464                     MinorStart(currentBounds) = MinorStart(previousElementBounds) - Minor(desiredSize) - static_cast<float>(minItemSpacing);
00465                     MajorStart(currentBounds) = lineOffset;
00466                     lineMajorSize = std::max(lineMajorSize, MajorSize(currentBounds));
00467                     lineNeedsReposition = MajorSize(previousElementBounds) != MajorSize(currentBounds);
00468                     countInLine++;
00469                 }
00470             }
00471
00472             m_elementManager.SetLayoutBoundsForDataIndex(currentIndex, currentBounds);
00473
00474             ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_INT_FLT_FLT_FLT_FLT, METH_NAME, this,
00475                 winrt::get_self<VirtualizingLayoutContext>(m_context.get())->Indent(), layoutId.data(),
00476                 L"Element dataIndex & Layout bounds:", currentIndex, currentBounds.X, currentBounds.Y, currentBounds.Width, currentBounds.Height);
00477
00478             previousIndex = currentIndex;
00479             currentIndex += step;
00480         }
00481
00482         const int dataCount = m_context.get().ItemCount();
00483
00484         // If we did not reach the top or bottom of the extent, we realized one
00485         // extra item before we knew we were outside the realization window. Do not
00486         // account for that element in the indices inside the realization window.
00487         if (direction == GenerateDirection::Forward)
00488         {
00489             m_lastRealizedDataIndexInsideRealizationWindow = previousIndex == dataCount - 1 ? dataCount - 1 : previousIndex - 1;
00490             m_lastRealizedDataIndexInsideRealizationWindow = std::max(0, m_lastRealizedDataIndexInsideRealizationWindow);
00491         }
00492         else
00493         {
00494             m_firstRealizedDataIndexInsideRealizationWindow = previousIndex == 0 ? 0 : previousIndex + 1;
00495             m_firstRealizedDataIndexInsideRealizationWindow = std::min(dataCount - 1, m_firstRealizedDataIndexInsideRealizationWindow);
00496         }
00497
00498         m_elementManager.DiscardElementsOutsideWindow(direction == GenerateDirection::Forward, currentIndex);
00499     }
00500 }
00501
00502 bool FlowLayoutAlgorithm::IsReflowRequired() const
00503 {
00504     // If first element is realized and is not at the very beginning we need to reflow.
00505     return
00506         m_elementManager.GetRealizedElementCount() > 0 &&
00507         m_elementManager.GetDataIndexFromRealizedRangeIndex(0) == 0 &&
00508         (GetScrollOrientation() == ScrollOrientation::Vertical ?
00509         m_elementManager.GetLayoutBoundsForRealizedIndex(0).X != 0 :
00510         m_elementManager.GetLayoutBoundsForRealizedIndex(0).Y != 0);
00511 }
00512
00513 bool FlowLayoutAlgorithm::ShouldContinueFillingUpSpace(
00514     int index,
00515     GenerateDirection direction)
00516 {
00517     bool shouldContinue = false;
00518     if (!IsVirtualizingContext())
00519     {
00520         shouldContinue = true;
00521     }
00522     else
00523     {
00524         const auto realizationRect = m_context.get().RealizationRect();
00525         const auto elementBounds = m_elementManager.GetLayoutBoundsForDataIndex(index);
00526
00527         const auto elementMajorStart = MajorStart(elementBounds);
00528         const auto elementMajorEnd = MajorEnd(elementBounds);
00529         const auto rectMajorStart = MajorStart(realizationRect);
00530         const auto rectMajorEnd = MajorEnd(realizationRect);
00531
00532         const auto elementMinorStart = MinorStart(elementBounds);
00533         const auto elementMinorEnd = MinorEnd(elementBounds);
00534         const auto rectMinorStart = MinorStart(realizationRect);
00535         const auto rectMinorEnd = MinorEnd(realizationRect);
00536
00537         // Ensure that both minor and major directions are taken into consideration so that if the scrolling direction
00538         // is the same as the flow direction we still stop at the end of the viewport rectangle.
00539         shouldContinue = direction == GenerateDirection::Forward
00540             ? elementMajorStart < rectMajorEnd && elementMinorStart < rectMinorEnd
00541             : elementMajorEnd > rectMajorStart && elementMinorEnd > rectMinorStart;
00542     }
00543
00544     return shouldContinue;
00545 }
00546
00547 winrt::Rect FlowLayoutAlgorithm::EstimateExtent(const winrt::Size& availableSize, const wstring_view& layoutId)
00548 {
00549     winrt::UIElement firstRealizedElement = nullptr;
00550     winrt::Rect firstBounds{};
00551     winrt::UIElement lastRealizedElement = nullptr;
00552     winrt::Rect lastBounds{};
00553     int firstDataIndex = -1;
00554     int lastDataIndex = -1;
00555
00556     if (m_elementManager.GetRealizedElementCount() > 0)
00557     {
00558         firstRealizedElement = m_elementManager.GetAt(0);
00559         firstBounds = m_elementManager.GetLayoutBoundsForRealizedIndex(0);
00560         firstDataIndex = m_elementManager.GetDataIndexFromRealizedRangeIndex(0);
00561
00562         const int last = m_elementManager.GetRealizedElementCount() - 1;
00563         lastRealizedElement = m_elementManager.GetAt(last);
00564         lastDataIndex = m_elementManager.GetDataIndexFromRealizedRangeIndex(last);
00565         lastBounds = m_elementManager.GetLayoutBoundsForRealizedIndex(last);
00566     }
00567
00568     const winrt::Rect extent = m_algorithmCallbacks->Algorithm_GetExtent(
00569         availableSize,
00570         m_context.get(),
00571         firstRealizedElement,
00572         firstDataIndex,
00573         firstBounds,
00574         lastRealizedElement,
00575         lastDataIndex,
00576         lastBounds);
00577
00578     ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT_FLT_FLT_FLT, METH_NAME, this,
00579         winrt::get_self<VirtualizingLayoutContext>(m_context.get())->Indent(), layoutId.data(),
00580         L"Extent:", extent.X, extent.Y, extent.Width, extent.Height);
00581
00582     return extent;
00583 }
00584
00585 void FlowLayoutAlgorithm::RaiseLineArranged()
00586 {
00587     const auto realizationRect = RealizationRect();
00588     if (realizationRect.Width != 0.0f || realizationRect.Height != 0.0f)
00589     {
00590         const int realizedElementCount = m_elementManager.GetRealizedElementCount();
00591         if (realizedElementCount > 0)
00592         {
00593             MUX_ASSERT(m_firstRealizedDataIndexInsideRealizationWindow != -1 && m_lastRealizedDataIndexInsideRealizationWindow != -1);
00594             int countInLine = 0;
00595             auto previousElementBounds = m_elementManager.GetLayoutBoundsForDataIndex(m_firstRealizedDataIndexInsideRealizationWindow);
00596             auto currentLineOffset = MajorStart(previousElementBounds);
00597             auto currentLineSize = MajorSize(previousElementBounds);
00598             for (int currentDataIndex = m_firstRealizedDataIndexInsideRealizationWindow; currentDataIndex <= m_lastRealizedDataIndexInsideRealizationWindow; currentDataIndex++)
00599             {
00600                 const auto currentBounds = m_elementManager.GetLayoutBoundsForDataIndex(currentDataIndex);
00601                 if (MajorStart(currentBounds) != currentLineOffset)
00602                 {
00603                     // Starting a new line
00604                     m_algorithmCallbacks->Algorithm_OnLineArranged(currentDataIndex - countInLine, countInLine, currentLineSize, m_context.get());
00605                     countInLine = 0;
00606                     currentLineOffset = MajorStart(currentBounds);
00607                     currentLineSize = 0;
00608                 }
00609
00610                 currentLineSize = std::max(static_cast<float>(currentLineSize), MajorSize(currentBounds));
00611                 countInLine++;
00612                 previousElementBounds = currentBounds;
00613             }
00614
00615             // Raise for the last line.
00616             m_algorithmCallbacks->Algorithm_OnLineArranged(m_lastRealizedDataIndexInsideRealizationWindow - countInLine + 1, countInLine, currentLineSize, m_context.get());
00617         }
00618     }
00619 }
00620
00621 #pragma endregion
00622
00623 #pragma region Arrange related private methods
00624
00625 void FlowLayoutAlgorithm::ArrangeVirtualizingLayout(
00626     const winrt::Size& finalSize,
00627     FlowLayoutAlgorithm::LineAlignment lineAlignment,
00628     bool isWrapping,
00629     const wstring_view& layoutId)
00630 {
00631     // Walk through the realized elements one line at a time and
00632     // align them. Then call element.Arrange with the arranged bounds.
00633     const int realizedElementCount = m_elementManager.GetRealizedElementCount();
00634     if (realizedElementCount > 0)
00635     {
00636         int countInLine = 1;
00637         auto previousElementBounds = m_elementManager.GetLayoutBoundsForRealizedIndex(0);
00638         auto currentLineOffset = MajorStart(previousElementBounds);
00639         auto spaceAtLineStart = MinorStart(previousElementBounds);
00640         float spaceAtLineEnd = 0;
00641         float currentLineSize = MajorSize(previousElementBounds);
00642
00643         for (int i = 1; i < realizedElementCount; i++)
00644         {
00645             const auto currentBounds = m_elementManager.GetLayoutBoundsForRealizedIndex(i);
00646
00647             if (MajorStart(currentBounds) != currentLineOffset)
00648             {
00649                 spaceAtLineEnd = Minor(finalSize) - MinorStart(previousElementBounds) - MinorSize(previousElementBounds);
00650                 PerformLineAlignment(i - countInLine, countInLine, spaceAtLineStart, spaceAtLineEnd, currentLineSize, lineAlignment, isWrapping, finalSize, layoutId);
00651                 spaceAtLineStart = MinorStart(currentBounds);
00652                 countInLine = 0;
00653                 currentLineOffset = MajorStart(currentBounds);
00654                 currentLineSize = 0;
00655             }
00656
00657             countInLine++; // for current element
00658             currentLineSize = std::max(currentLineSize, MajorSize(currentBounds));
00659             previousElementBounds = currentBounds;
00660         }
00661
00662         // Last line - potentially have a property to customize
00663         // aligning the last line or not.
00664         if (countInLine > 0)
00665         {
00666             const float spaceAtEnd = Minor(finalSize) - MinorStart(previousElementBounds) - MinorSize(previousElementBounds);
00667
00668             PerformLineAlignment(realizedElementCount - countInLine, countInLine, spaceAtLineStart, spaceAtEnd, currentLineSize, lineAlignment, isWrapping, finalSize, layoutId);
00669         }
00670     }
00671 }
00672
00673 // Align elements within a line. Note that this does not modify LayoutBounds. So if we get
00674 // repeated measures, the LayoutBounds remain the same in each layout.
00675 void FlowLayoutAlgorithm::PerformLineAlignment(
00676     int lineStartIndex,
00677     int countInLine,
00678     float spaceAtLineStart,
00679     float spaceAtLineEnd,
00680     float lineSize,
00681     FlowLayoutAlgorithm::LineAlignment lineAlignment,
00682     bool isWrapping,
00683     const winrt::Size& finalSize,
00684     const wstring_view& layoutId)
00685 {
00686     for (int rangeIndex = lineStartIndex; rangeIndex < lineStartIndex + countInLine; ++rangeIndex)
00687     {
00688         auto bounds = m_elementManager.GetLayoutBoundsForRealizedIndex(rangeIndex);
00689         MajorSize(bounds) = lineSize;
00690
00691         if (!m_scrollOrientationSameAsFlow)
00692         {
00693             // Note: Space at start could potentially be negative
00694             if (spaceAtLineStart != 0 || spaceAtLineEnd != 0)
00695             {
00696                 float totalSpace = spaceAtLineStart + spaceAtLineEnd;
00697                 switch (lineAlignment)
00698                 {
00699                 case FlowLayoutAlgorithm::LineAlignment::Start:
00700                 {
00701                     MinorStart(bounds) -= spaceAtLineStart;
00702                     break;
00703                 }
00704
00705                 case FlowLayoutAlgorithm::LineAlignment::End:
00706                 {
00707                     MinorStart(bounds) += spaceAtLineEnd;
00708                     break;
00709                 }
00710
00711                 case FlowLayoutAlgorithm::LineAlignment::Center:
00712                 {
00713                     MinorStart(bounds) -= spaceAtLineStart;
00714                     MinorStart(bounds) += totalSpace / 2;
00715                     break;
00716                 }
00717
00718                 case FlowLayoutAlgorithm::LineAlignment::SpaceAround:
00719                 {
00720                     float interItemSpace = countInLine >= 1 ? totalSpace / (countInLine * 2) : 0;
00721                     MinorStart(bounds) -= spaceAtLineStart;
00722                     MinorStart(bounds) += interItemSpace * ((rangeIndex - lineStartIndex + 1) * 2 - 1);
00723                     break;
00724                 }
00725
00726                 case FlowLayoutAlgorithm::LineAlignment::SpaceBetween:
00727                 {
00728                     float interItemSpace = countInLine > 1 ? totalSpace / (countInLine - 1) : 0;
00729                     MinorStart(bounds) -= spaceAtLineStart;
00730                     MinorStart(bounds) += interItemSpace * (rangeIndex - lineStartIndex);
00731                     break;
00732                 }
00733
00734                 case FlowLayoutAlgorithm::LineAlignment::SpaceEvenly:
00735                 {
00736                     float interItemSpace = countInLine >= 1 ? totalSpace / (countInLine + 1) : 0;
00737                     MinorStart(bounds) -= spaceAtLineStart;
00738                     MinorStart(bounds) += interItemSpace * (rangeIndex - lineStartIndex + 1);
00739                     break;
00740                 }
00741                 }
00742             }
00743         }
00744
00745         bounds.X -= m_lastExtent.X;
00746         bounds.Y -= m_lastExtent.Y;
00747
00748         if (!isWrapping)
00749         {
00750             MinorSize(bounds) = std::max(MinorSize(bounds), Minor(finalSize));
00751         }
00752
00753         auto element = m_elementManager.GetAt(rangeIndex);
00754
00755         ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_INT_FLT_FLT_FLT_FLT, METH_NAME, this,
00756             winrt::get_self<VirtualizingLayoutContext>(m_context.get())->Indent(), layoutId.data(),
00757             L"Element dataIndex & arrange bounds:",
00758             m_elementManager.GetDataIndexFromRealizedRangeIndex(rangeIndex),
00759             bounds.X, bounds.Y, bounds.Width, bounds.Height);
00760
00761         element.Arrange(bounds);
00762     }
00763 }
00764
00765 #pragma endregion
00766
00767 #pragma region Layout Context Helpers
00768
00769 winrt::Rect FlowLayoutAlgorithm::RealizationRect()
00770 {
00771     return IsVirtualizingContext() ?
00772         m_context.get().RealizationRect() :
00773         winrt::Rect{ 0, 0, std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity() };
00774 }
00775
00776 void FlowLayoutAlgorithm::SetLayoutOrigin()
00777 {
00778     if (IsVirtualizingContext())
00779     {
00780         m_context.get().LayoutOrigin(winrt::Point{ m_lastExtent.X, m_lastExtent.Y });
00781     }
00782     else
00783     {
00784         // Should have 0 origin for non-virtualizing layout since we always start from
00785         // the first item
00786         MUX_ASSERT(m_lastExtent.X == 0 && m_lastExtent.Y == 0);
00787     }
00788 }
00789
00790 winrt::UIElement FlowLayoutAlgorithm::GetElementIfRealized(
00791     int dataIndex)
00792 {
00793     if (m_elementManager.IsDataIndexRealized(dataIndex))
00794     {
00795         return m_elementManager.GetRealizedElement(dataIndex);
00796     }
00797
00798     return  nullptr;
00799 }
00800
00801 bool FlowLayoutAlgorithm::IsVirtualizingContext()
00802 {
00803     if (m_context)
00804     {
00805         const auto rect = m_context.get().RealizationRect();
00806         const bool hasInfiniteSize = (rect.Height == std::numeric_limits<float>::infinity() || rect.Width == std::numeric_limits<float>::infinity());
00807         return !hasInfiniteSize;
00808     }
00809     return false;
00810 }
00811
00812 #pragma endregion
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewItemTemplateSettingsProperties Member List

This is the complete list of members for TreeViewItemTemplateSettingsProperties, including all inherited members.
ClearProperties() | TreeViewItemTemplateSettingsProperties | [static]
CollapsedGlyphVisibility(winrt::Visibility const &value) | TreeViewItemTemplateSettingsProperties |
CollapsedGlyphVisibility() | TreeViewItemTemplateSettingsProperties |
CollapsedGlyphVisibilityProperty() | TreeViewItemTemplateSettingsProperties | [inline, static]
DragItemsCount(int value) | TreeViewItemTemplateSettingsProperties |
DragItemsCount() | TreeViewItemTemplateSettingsProperties |
DragItemsCountProperty() | TreeViewItemTemplateSettingsProperties | [inline, static]
EnsureProperties() | TreeViewItemTemplateSettingsProperties | [static]
ExpandedGlyphVisibility(winrt::Visibility const &value) | TreeViewItemTemplateSettingsProperties |
ExpandedGlyphVisibility() | TreeViewItemTemplateSettingsProperties |
ExpandedGlyphVisibilityProperty() | TreeViewItemTemplateSettingsProperties | [inline, static]
Indentation(winrt::Thickness const &value) | TreeViewItemTemplateSettingsProperties |
Indentation() | TreeViewItemTemplateSettingsProperties |
IndentationProperty() | TreeViewItemTemplateSettingsProperties | [inline, static]
s_CollapsedGlyphVisibilityProperty | TreeViewItemTemplateSettingsProperties | [static]
s_DragItemsCountProperty | TreeViewItemTemplateSettingsProperties | [static]
s_ExpandedGlyphVisibilityProperty | TreeViewItemTemplateSettingsProperties | [static]
s_IndentationProperty | TreeViewItemTemplateSettingsProperties | [static]
TreeViewItemTemplateSettingsProperties() | TreeViewItemTemplateSettingsProperties |
Generated on Sun Dec 1 2024 20:53:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemCollectionTransitionCompletedEventArgs.cpp Source File

  • Repeater

ItemCollectionTransitionCompletedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ItemCollectionTransitionCompletedEventArgs.h"
00007 #include "ItemCollectionTransition.h"
00008
00009 ItemCollectionTransitionCompletedEventArgs::ItemCollectionTransitionCompletedEventArgs(winrt::ItemCollectionTransition const& transition)
00010 {
00011     m_transition.set(transition);
00012 }
00013
00014 winrt::UIElement ItemCollectionTransitionCompletedEventArgs::Element()
00015 {
00016     return m_transition ? winrt::get_self<ItemCollectionTransition>(m_transition.safe_get())->Element() : nullptr;
00017 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ReadOnlyNotifyPropertyChangedCollection-g< T > Member List

This is the complete list of members for ReadOnlyNotifyPropertyChangedCollection-g< T >, including all inherited members.
_data | ReadOnlyNotifyPropertyChangedCollection-g< T > | [private]
CollectionChanged | ReadOnlyNotifyPropertyChangedCollection-g< T > |
Count | ReadOnlyNotifyPropertyChangedCollection-g< T > |
Data | ReadOnlyNotifyPropertyChangedCollection-g< T > |
GetEnumerator() | ReadOnlyNotifyPropertyChangedCollection-g< T > | [inline]
GetEnumerator() | ReadOnlyNotifyPropertyChangedCollection-g< T > | [inline, private]
IndexFromKey(string key) | ReadOnlyNotifyPropertyChangedCollection-g< T > | [inline]
KeyFromIndex(int index) | ReadOnlyNotifyPropertyChangedCollection-g< T > | [inline]
OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) | ReadOnlyNotifyPropertyChangedCollection-g< T > | [inline, protected, virtual]
ReadOnlyNotifyPropertyChangedCollection() | ReadOnlyNotifyPropertyChangedCollection-g< T > | [inline]
ReadOnlyNotifyPropertyChangedCollection(IEnumerable< T > data) | ReadOnlyNotifyPropertyChangedCollection-g< T > | [inline]
this | ReadOnlyNotifyPropertyChangedCollection-g< T > |
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/UniformGridLayoutDemo.cs Source File

  • Repeater
  • TestUI
  • Samples

UniformGridLayoutDemo.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.Generic;
00005 using System.Linq;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Controls;
00008
00009 namespace MUXControlsTestApp.Samples
00010 {
00011     public sealed partial class UniformGridLayoutDemo : TestPage
00012     {
00013         public IEnumerable<int> collection;
00014
00015         public UniformGridLayoutDemo()
00016         {
00017             collection = Enumerable.Range(0, 40);
00018             this.InitializeComponent();
00019             imageAspectRatioTestRepeater.ItemsSource = Enumerable.Range(0, 30);
00020
00021             Loaded += UniformGridLayoutDemo_Loaded;
00022         }
00023
00024         ~UniformGridLayoutDemo()
00025         {
00026         }
00027
00028         private void UniformGridLayoutDemo_Loaded(object sender, RoutedEventArgs e)
00029         {
00030             GetUniformGridLayoutMaximumRowsOrColumnsButtonClick(null, null);
00031         }
00032
00033         public void GetRepeaterActualHeightButtonClick(object sender, RoutedEventArgs e)
00034         {
00035             RepeaterActualHeightLabel.Text = UniformGridRepeater.ActualHeight.ToString();
00036         }
00037
00038         private void GetUniformGridLayoutMaximumRowsOrColumnsButtonClick(object sender, RoutedEventArgs e)
00039         {
00040             UniformGridLayoutMaximumRowsOrColumns.Text = (UniformGridRepeater.Layout as UniformGridLayout).MaximumRowsOrColumns.ToString();
00041         }
00042
00043         private void SetUniformGridLayoutMaximumRowsOrColumnsButtonClick(object sender, RoutedEventArgs e)
00044         {
00045             LayoutHelper.SetMaxRowsOrColumns(UniformGridRepeater.Layout, int.Parse(UniformGridLayoutMaximumRowsOrColumns.Text));
00046         }
00047
00048         private void GetUniformGridLayoutMinColumnSpacingButtonClick(object sender, RoutedEventArgs e)
00049         {
00050             UniformGridLayoutMinColumnSpacing.Text = (UniformGridRepeater.Layout as UniformGridLayout).MinColumnSpacing.ToString();
00051         }
00052
00053         private void SetUniformGridLayoutMinColumnSpacingButtonClick(object sender, RoutedEventArgs e)
00054         {
00055             LayoutHelper.SetMinColumnSpacing(UniformGridRepeater.Layout, double.Parse(UniformGridLayoutMinColumnSpacing.Text));
00056         }
00057
00058         private void GetUniformGridLayoutMinRowSpacingButtonClick(object sender, RoutedEventArgs e)
00059         {
00060             UniformGridLayoutMinRowSpacing.Text = (UniformGridRepeater.Layout as UniformGridLayout).MinRowSpacing.ToString();
00061         }
00062
00063         private void SetUniformGridLayoutMinRowSpacingButtonClick(object sender, RoutedEventArgs e)
00064         {
00065             LayoutHelper.SetMinRowSpacing(UniformGridRepeater.Layout, double.Parse(UniformGridLayoutMinRowSpacing.Text));
00066         }
00067
00068         private void GetUniformGridLayoutMinItemWidthButtonClick(object sender, RoutedEventArgs e)
00069         {
00070             UniformGridLayoutMinItemWidth.Text = (UniformGridRepeater.Layout as UniformGridLayout).MinItemWidth.ToString();
00071         }
00072
00073         private void SetUniformGridLayoutMinItemWidthButtonClick(object sender, RoutedEventArgs e)
00074         {
00075             (UniformGridRepeater.Layout as UniformGridLayout).MinItemWidth = double.Parse(UniformGridLayoutMinItemWidth.Text);
00076         }
00077
00078         private void GetUniformGridLayoutMinItemHeightButtonClick(object sender, RoutedEventArgs e)
00079         {
00080             UniformGridLayoutMinItemHeight.Text = (UniformGridRepeater.Layout as UniformGridLayout).MinItemHeight.ToString();
00081         }
00082
00083         private void SetUniformGridLayoutMinItemHeightButtonClick(object sender, RoutedEventArgs e)
00084         {
00085             (UniformGridRepeater.Layout as UniformGridLayout).MinItemHeight = double.Parse(UniformGridLayoutMinItemHeight.Text);
00086         }
00087
00088         private void GetScrollViewerMaxWidthButtonClick(object sender, RoutedEventArgs e)
00089         {
00090             ScrollViewerMaxWidth.Text = ScrollViewer.MaxWidth.ToString();
00091         }
00092
00093         private void SetScrollViewerMaxWidthButtonClick(object sender, RoutedEventArgs e)
00094         {
00095             ScrollViewer.MaxWidth = double.Parse(ScrollViewerMaxWidth.Text);
00096         }
00097
00098         private void GetScrollViewerMaxHeightButtonClick(object sender, RoutedEventArgs e)
00099         {
00100             ScrollViewerMaxHeight.Text = ScrollViewer.MaxHeight.ToString();
00101         }
00102
00103         private void SetScrollViewerMaxHeightButtonClick(object sender, RoutedEventArgs e)
00104         {
00105             ScrollViewer.MaxHeight = double.Parse(ScrollViewerMaxHeight.Text);
00106         }
00107
00108         private void GetScrollViewerHorizontalOffsetButtonClick(object sender, RoutedEventArgs e)
00109         {
00110             ScrollViewerHorizontalOffset.Text = ScrollViewer.HorizontalOffset.ToString();
00111         }
00112
00113         private void SetScrollViewerHorizontalOffsetButtonClick(object sender, RoutedEventArgs e)
00114         {
00115             ScrollViewer.ChangeView(double.Parse(ScrollViewerHorizontalOffset.Text), null, null, true);
00116         }
00117
00118         private void GetScrollViewerVerticalOffsetButtonClick(object sender, RoutedEventArgs e)
00119         {
00120             ScrollViewerVerticalOffset.Text = ScrollViewer.VerticalOffset.ToString();
00121         }
00122
00123         private void SetScrollViewerVerticalOffsetButtonClick(object sender, RoutedEventArgs e)
00124         {
00125             ScrollViewer.ChangeView(null, double.Parse(ScrollViewerVerticalOffset.Text), null, true);
00126         }
00127
00128         private void CmbUniformGridLayoutItemsStretch_SelectionChanged(object sender, SelectionChangedEventArgs e)
00129         {
00130             if (UniformGridRepeater != null)
00131             {
00132                 var itemsStretch = (CmbUniformGridLayoutItemsStretch.SelectedItem as ComboBoxItem).Content.ToString();
00133
00134                 LayoutHelper.SetItemsStretch(UniformGridRepeater.Layout, itemsStretch);
00135             }
00136         }
00137
00138         private void CmbUniformGridLayoutItemsJustification_SelectionChanged(object sender, SelectionChangedEventArgs e)
00139         {
00140             if (UniformGridRepeater != null)
00141             {
00142                 var itemsJustification = (CmbUniformGridLayoutItemsJustification.SelectedItem as ComboBoxItem).Content.ToString();
00143
00144                 LayoutHelper.SetLineAlignment(UniformGridRepeater.Layout, itemsJustification);
00145             }
00146         }
00147
00148         private void CmbUniformGridLayoutOrientation_SelectionChanged(object sender, SelectionChangedEventArgs e)
00149         {
00150             if (UniformGridRepeater != null)
00151             {
00152                 (UniformGridRepeater.Layout as UniformGridLayout).Orientation = CmbUniformGridLayoutOrientation.SelectedIndex == 0 ? Orientation.Vertical : Orientation.Horizontal;
00153             }
00154         }
00155
00156         private void CmbScrollViewerHorizontalScrollBarVisibility_SelectionChanged(object sender, SelectionChangedEventArgs e)
00157         {
00158             if (ScrollViewer != null)
00159             {
00160                 ScrollViewer.HorizontalScrollBarVisibility = (ScrollBarVisibility)CmbScrollViewerHorizontalScrollBarVisibility.SelectedIndex;
00161             }
00162         }
00163     }
00164 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: IconSource/ImageIconSource.h Source File

  • IconSource

ImageIconSource.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ImageIconSource.g.h"
00007 #include "ImageIconSource.properties.h"
00008
00009 class ImageIconSource :
00010     public ReferenceTracker<ImageIconSource, DeriveFromBitmapIconSourceHelper_base, winrt::ImageIconSource>,
00011     public ImageIconSourceProperties
00012 {
00013 public:
00014     using ImageIconSourceProperties::EnsureProperties;
00015     using ImageIconSourceProperties::ClearProperties;
00016
00017     winrt::DependencyProperty GetIconElementPropertyCore(winrt::DependencyProperty sourceProperty);
00018     winrt::IconElement CreateIconElementCore();
00019 };
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBarEraserButtonInternal Member List

This is the complete list of members for InkToolBarEraserButtonInternal, including all inherited members.
abi_enter() | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
CheckThread() | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< InkToolBarEraserButtonInternal > &&self) noexcept | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
final_release(std::unique_ptr< InkToolBarEraserButtonInternal > &&self) | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline, static]
GetBase() | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
GetInner() | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
IsOnThread() | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< InkToolBarEraserButtonInternal, winrt::implementation::InkToolBarEraserButtonInternalTundefined > | [inline]
Generated on Sun Dec 1 2024 20:52:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/RevealBorderLight.h Source File

  • Lights

RevealBorderLight.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "MaterialHelper.h"
00006 #include "RevealTestApi.h"
00007
00008 #include "RevealBorderLight.g.h"
00009
00010 class PointerHoverWindowHelper;
00011 class SoftLightSwitch;
00012
00013 class RevealBorderLight :
00014     public ReferenceTracker<RevealBorderLight, winrt::implementation::RevealBorderLightT>
00015 {
00016     friend RevealTestApi;
00017     friend MaterialHelperBase;
00018     friend MaterialHelper;
00019 public:
00020     static winrt::hstring& GetLightThemeIdStatic();
00021     static winrt::hstring& GetDarkThemeIdStatic();
00022
00023     void SetIsWideLight(bool isWideLight) { m_isWideLight = isWideLight; }
00024     void SetIsLightTheme(bool isLightTheme) { m_isLightTheme = isLightTheme; }
00025
00026     // IXamlLightOverrides
00027     winrt::hstring GetId();
00028     void OnConnected(winrt::UIElement const& newElement);
00029     void OnDisconnected(winrt::UIElement const& oldElement);
00030
00031     void OnMaterialPolicyStatusChanged(const com_ptr<MaterialHelperBase>& sender, bool isDisabledByMaterialPolicy);
00032
00033 private:
00034     winrt::SpotLight GetLight() { return m_compositionSpotLight; } // For test APIs
00035     void HookupWindowPointerHandlers();
00036     void UnhookWindowPointerHandlers();
00037     void EnsureCompositionResources();
00038     void ReleaseCompositionResources();
00039     bool GetShouldLightBeOn();
00040     void SwitchLight(bool turnOn);
00041
00042     void EnsureLocalLight();
00043     void ReleaseLocalLight();
00044
00045     winrt::weak_ref<winrt::UIElement> m_targetElement{ nullptr };
00046     winrt::ExpressionAnimation m_offsetAnimation{ nullptr };
00047     winrt::CompositionPropertySet m_pointer{ nullptr };
00048     winrt::SpotLight m_compositionSpotLight{ nullptr };
00049     winrt::CompositionPropertySet m_colorsProxy{ nullptr };
00050     winrt::CompositionPropertySet m_offsetProps{ nullptr };
00051
00052     winrt::event_token m_PointerEnteredToken{};
00053     winrt::event_token m_PointerExitedToken{};
00054     winrt::event_token m_PointerMovedToken{};
00055     winrt::event_token m_PointerPressedToken{};
00056     winrt::event_token m_PointerReleasedToken{};
00057     winrt::event_token m_PointerCaptureLostToken{};
00058     bool m_gotPointerCaptureLostDueToDManip{};
00059
00060     bool m_isWideLight{};
00061     bool m_isLightTheme{};
00062
00063     bool m_isDisabledByMaterialPolicy{};
00064
00065     bool m_shouldLightBeOn{};
00066     bool m_setLightDisabledAfterTurnOffAnimation{ true };
00067
00068     winrt::event_token m_materialPolicyChangedToken{};
00069
00070     winrt::CoreWindow m_coreWindow{ nullptr };
00071 };
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/ImagePage.xaml.cs Source File

  • CommonStyles
  • TestUI

ImagePage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Media;
00006 using Microsoft.UI.Xaml.Media.Imaging;
00007 using System;
00008 using System.Collections.Generic;
00009
00010 namespace MUXControlsTestApp
00011 {
00012     [TopLevelTestPage(Name="Image", Icon="Image.png")]
00013     public sealed partial class ImagePage : TestPage
00014     {
00015         private object asyncEventReportingLock = new object();
00016         private List<string> lstAsyncEventMessage = new List<string>();
00017         private int imageIndex = 0;
00018
00019         public ImagePage()
00020         {
00021             this.InitializeComponent();
00022
00023             image.ImageFailed += Image_ImageFailed;
00024             image.ImageOpened += Image_ImageOpened;
00025
00026             Loaded += ImagePage_Loaded;
00027         }
00028
00029         private void ImagePage_Loaded(object sender, RoutedEventArgs e)
00030         {
00031             UpdateImage();
00032
00033             BtnGetImageMinWidth_Click(null, null);
00034             BtnGetImageMaxWidth_Click(null, null);
00035             BtnGetImageWidth_Click(null, null);
00036             BtnGetImageActualWidth_Click(null, null);
00037             BtnGetImageDesiredWidth_Click(null, null);
00038             BtnGetImageMinHeight_Click(null, null);
00039             BtnGetImageMaxHeight_Click(null, null);
00040             BtnGetImageHeight_Click(null, null);
00041             BtnGetImageActualHeight_Click(null, null);
00042             BtnGetImageDesiredHeight_Click(null, null);
00043             BtnGetImageRenderWidth_Click(null, null);
00044             BtnGetImageRenderHeight_Click(null, null);
00045             BtnGetImageHorizontalAlignment_Click(null, null);
00046             BtnGetImageVerticalAlignment_Click(null, null);
00047             BtnGetImageMargin_Click(null, null);
00048             BtnGetImageParentWidth_Click(null, null);
00049             BtnGetImageParentHeight_Click(null, null);
00050         }
00051
00052         private void Image_ImageOpened(object sender, RoutedEventArgs e)
00053         {
00054             AppendAsyncEventMessage("Image_ImageOpened");
00055         }
00056
00057         private void Image_ImageFailed(object sender, ExceptionRoutedEventArgs e)
00058         {
00059             AppendAsyncEventMessage($"Image_ImageFailed ErrorMessage={e.ErrorMessage}");
00060         }
00061
00062         private void ChkImageProperties_Checked(object sender, RoutedEventArgs e)
00063         {
00064             if (svImageProperties != null)
00065                 svImageProperties.Visibility = Visibility.Visible;
00066         }
00067
00068         private void ChkImageProperties_Unchecked(object sender, RoutedEventArgs e)
00069         {
00070             if (svImageProperties != null)
00071                 svImageProperties.Visibility = Visibility.Collapsed;
00072         }
00073
00074         private void ChkImageParentProperties_Checked(object sender, RoutedEventArgs e)
00075         {
00076             if (svImageParentProperties != null)
00077                 svImageParentProperties.Visibility = Visibility.Visible;
00078         }
00079
00080         private void ChkImageParentProperties_Unchecked(object sender, RoutedEventArgs e)
00081         {
00082             if (svImageParentProperties != null)
00083                 svImageParentProperties.Visibility = Visibility.Collapsed;
00084         }
00085
00086         private void ChkLogs_Checked(object sender, RoutedEventArgs e)
00087         {
00088             if (grdLogs != null)
00089                 grdLogs.Visibility = Visibility.Visible;
00090         }
00091
00092         private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
00093         {
00094             if (grdLogs != null)
00095                 grdLogs.Visibility = Visibility.Collapsed;
00096         }
00097
00098         private void BtnGetBitmapImageUriSource_Click(object sender, RoutedEventArgs e)
00099         {
00100             try
00101             {
00102                 if (txtBitmapImageUriSource != null)
00103                 {
00104                     txtBitmapImageUriSource.Text = imageIndex.ToString();
00105                 }
00106             }
00107             catch (Exception ex)
00108             {
00109                 txtExceptionReport.Text = ex.ToString();
00110                 AppendAsyncEventMessage(ex.ToString());
00111             }
00112         }
00113
00114         private void BtnSetBitmapImageUriSource_Click(object sender, RoutedEventArgs e)
00115         {
00116             UpdateImage();
00117         }
00118
00119         private void BtnGetBitmapImageDecodePixelWidth_Click(object sender, RoutedEventArgs e)
00120         {
00121             try
00122             {
00123                 if (txtBitmapImageDecodePixelWidth != null && image != null)
00124                 {
00125                     txtBitmapImageDecodePixelWidth.Text = (image.Source as BitmapImage).DecodePixelWidth.ToString();
00126                 }
00127             }
00128             catch (Exception ex)
00129             {
00130                 txtExceptionReport.Text = ex.ToString();
00131                 AppendAsyncEventMessage(ex.ToString());
00132             }
00133         }
00134
00135         private void BtnSetBitmapImageDecodePixelWidth_Click(object sender, RoutedEventArgs e)
00136         {
00137             UpdateImage();
00138         }
00139
00140         private void BtnGetBitmapImageDecodePixelHeight_Click(object sender, RoutedEventArgs e)
00141         {
00142             try
00143             {
00144                 if (txtBitmapImageDecodePixelHeight != null && image != null)
00145                 {
00146                     txtBitmapImageDecodePixelHeight.Text = (image.Source as BitmapImage).DecodePixelHeight.ToString();
00147                 }
00148             }
00149             catch (Exception ex)
00150             {
00151                 txtExceptionReport.Text = ex.ToString();
00152                 AppendAsyncEventMessage(ex.ToString());
00153             }
00154         }
00155
00156         private void BtnSetBitmapImageDecodePixelHeight_Click(object sender, RoutedEventArgs e)
00157         {
00158             UpdateImage();
00159         }
00160
00161         private void BtnGetImageStretch_Click(object sender, RoutedEventArgs e)
00162         {
00163             try
00164             {
00165                 if (cmbImageStretch != null && image != null)
00166                 {
00167                     cmbImageStretch.SelectedIndex = (int) image.Stretch;
00168                 }
00169             }
00170             catch (Exception ex)
00171             {
00172                 txtExceptionReport.Text = ex.ToString();
00173                 AppendAsyncEventMessage(ex.ToString());
00174             }
00175         }
00176
00177         private void BtnSetImageStretch_Click(object sender, RoutedEventArgs e)
00178         {
00179             try
00180             {
00181                 if (cmbImageStretch != null && image != null)
00182                 {
00183                     image.Stretch = (Stretch) cmbImageStretch.SelectedIndex;
00184                 }
00185             }
00186             catch (Exception ex)
00187             {
00188                 txtExceptionReport.Text = ex.ToString();
00189                 AppendAsyncEventMessage(ex.ToString());
00190             }
00191         }
00192
00193         private void BtnGetImageMinWidth_Click(object sender, RoutedEventArgs e)
00194         {
00195             try
00196             {
00197                 if (txtImageMinWidth != null && image != null)
00198                 {
00199                     txtImageMinWidth.Text = image.MinWidth.ToString();
00200                 }
00201             }
00202             catch (Exception ex)
00203             {
00204                 txtExceptionReport.Text = ex.ToString();
00205                 AppendAsyncEventMessage(ex.ToString());
00206             }
00207         }
00208
00209         private void BtnGetImageMaxWidth_Click(object sender, RoutedEventArgs e)
00210         {
00211             try
00212             {
00213                 if (txtImageMaxWidth != null && image != null)
00214                 {
00215                     txtImageMaxWidth.Text = image.MaxWidth.ToString();
00216                 }
00217             }
00218             catch (Exception ex)
00219             {
00220                 txtExceptionReport.Text = ex.ToString();
00221                 AppendAsyncEventMessage(ex.ToString());
00222             }
00223         }
00224
00225         private void BtnGetImageWidth_Click(object sender, RoutedEventArgs e)
00226         {
00227             try
00228             {
00229                 if (txtImageWidth != null && image != null)
00230                 {
00231                     txtImageWidth.Text = image.Width.ToString();
00232                 }
00233             }
00234             catch (Exception ex)
00235             {
00236                 txtExceptionReport.Text = ex.ToString();
00237                 AppendAsyncEventMessage(ex.ToString());
00238             }
00239         }
00240
00241         private void BtnGetImageActualWidth_Click(object sender, RoutedEventArgs e)
00242         {
00243             try
00244             {
00245                 if (txtImageActualWidth != null && image != null)
00246                 {
00247                     txtImageActualWidth.Text = image.ActualWidth.ToString();
00248                 }
00249             }
00250             catch (Exception ex)
00251             {
00252                 txtExceptionReport.Text = ex.ToString();
00253                 AppendAsyncEventMessage(ex.ToString());
00254             }
00255         }
00256
00257         private void BtnGetImageDesiredWidth_Click(object sender, RoutedEventArgs e)
00258         {
00259             try
00260             {
00261                 if (txtImageDesiredWidth != null && image != null)
00262                 {
00263                     txtImageDesiredWidth.Text = image.DesiredSize.Width.ToString();
00264                 }
00265             }
00266             catch (Exception ex)
00267             {
00268                 txtExceptionReport.Text = ex.ToString();
00269                 AppendAsyncEventMessage(ex.ToString());
00270             }
00271         }
00272
00273         private void BtnGetImageRenderWidth_Click(object sender, RoutedEventArgs e)
00274         {
00275             try
00276             {
00277                 if (txtImageRenderWidth != null && image != null)
00278                 {
00279                     txtImageRenderWidth.Text = image.RenderSize.Width.ToString();
00280                 }
00281             }
00282             catch (Exception ex)
00283             {
00284                 txtExceptionReport.Text = ex.ToString();
00285                 AppendAsyncEventMessage(ex.ToString());
00286             }
00287         }
00288
00289         private void BtnSetImageMinWidth_Click(object sender, RoutedEventArgs e)
00290         {
00291             try
00292             {
00293                 if (txtImageMinWidth != null && !string.IsNullOrWhiteSpace(txtImageMinWidth.Text) && image != null)
00294                 {
00295                     image.MinWidth = double.Parse(txtImageMinWidth.Text);
00296                 }
00297             }
00298             catch (Exception ex)
00299             {
00300                 txtExceptionReport.Text = ex.ToString();
00301                 AppendAsyncEventMessage(ex.ToString());
00302             }
00303         }
00304
00305         private void BtnSetImageMaxWidth_Click(object sender, RoutedEventArgs e)
00306         {
00307             try
00308             {
00309                 if (txtImageMaxWidth != null && !string.IsNullOrWhiteSpace(txtImageMaxWidth.Text) && image != null)
00310                 {
00311                     image.MaxWidth = double.Parse(txtImageMaxWidth.Text);
00312                 }
00313             }
00314             catch (Exception ex)
00315             {
00316                 txtExceptionReport.Text = ex.ToString();
00317                 AppendAsyncEventMessage(ex.ToString());
00318             }
00319         }
00320
00321         private void BtnSetImageWidth_Click(object sender, RoutedEventArgs e)
00322         {
00323             try
00324             {
00325                 if (txtImageWidth != null && !string.IsNullOrWhiteSpace(txtImageWidth.Text) && image != null)
00326                 {
00327                     image.Width = double.Parse(txtImageWidth.Text);
00328                 }
00329             }
00330             catch (Exception ex)
00331             {
00332                 txtExceptionReport.Text = ex.ToString();
00333                 AppendAsyncEventMessage(ex.ToString());
00334             }
00335         }
00336
00337         private void BtnGetImageMinHeight_Click(object sender, RoutedEventArgs e)
00338         {
00339             try
00340             {
00341                 if (txtImageMinHeight != null && image != null)
00342                 {
00343                     txtImageMinHeight.Text = image.MinHeight.ToString();
00344                 }
00345             }
00346             catch (Exception ex)
00347             {
00348                 txtExceptionReport.Text = ex.ToString();
00349                 AppendAsyncEventMessage(ex.ToString());
00350             }
00351         }
00352
00353         private void BtnGetImageMaxHeight_Click(object sender, RoutedEventArgs e)
00354         {
00355             try
00356             {
00357                 if (txtImageMaxHeight != null && image != null)
00358                 {
00359                     txtImageMaxHeight.Text = image.MaxHeight.ToString();
00360                 }
00361             }
00362             catch (Exception ex)
00363             {
00364                 txtExceptionReport.Text = ex.ToString();
00365                 AppendAsyncEventMessage(ex.ToString());
00366             }
00367         }
00368
00369         private void BtnGetImageHeight_Click(object sender, RoutedEventArgs e)
00370         {
00371             try
00372             {
00373                 if (txtImageHeight != null && image != null)
00374                 {
00375                     txtImageHeight.Text = image.Height.ToString();
00376                 }
00377             }
00378             catch (Exception ex)
00379             {
00380                 txtExceptionReport.Text = ex.ToString();
00381                 AppendAsyncEventMessage(ex.ToString());
00382             }
00383         }
00384
00385         private void BtnGetImageActualHeight_Click(object sender, RoutedEventArgs e)
00386         {
00387             try
00388             {
00389                 if (txtImageActualHeight != null && image != null)
00390                 {
00391                     txtImageActualHeight.Text = image.ActualHeight.ToString();
00392                 }
00393             }
00394             catch (Exception ex)
00395             {
00396                 txtExceptionReport.Text = ex.ToString();
00397                 AppendAsyncEventMessage(ex.ToString());
00398             }
00399         }
00400
00401         private void BtnGetImageDesiredHeight_Click(object sender, RoutedEventArgs e)
00402         {
00403             try
00404             {
00405                 if (txtImageDesiredHeight != null && image != null)
00406                 {
00407                     txtImageDesiredHeight.Text = image.DesiredSize.Height.ToString();
00408                 }
00409             }
00410             catch (Exception ex)
00411             {
00412                 txtExceptionReport.Text = ex.ToString();
00413                 AppendAsyncEventMessage(ex.ToString());
00414             }
00415         }
00416
00417         private void BtnGetImageRenderHeight_Click(object sender, RoutedEventArgs e)
00418         {
00419             try
00420             {
00421                 if (txtImageRenderHeight != null && image != null)
00422                 {
00423                     txtImageRenderHeight.Text = image.RenderSize.Height.ToString();
00424                 }
00425             }
00426             catch (Exception ex)
00427             {
00428                 txtExceptionReport.Text = ex.ToString();
00429                 AppendAsyncEventMessage(ex.ToString());
00430             }
00431         }
00432
00433         private void BtnSetImageMinHeight_Click(object sender, RoutedEventArgs e)
00434         {
00435             try
00436             {
00437                 if (txtImageMinHeight != null && !string.IsNullOrWhiteSpace(txtImageMinHeight.Text) && image != null)
00438                 {
00439                     image.MinHeight = double.Parse(txtImageMinHeight.Text);
00440                 }
00441             }
00442             catch (Exception ex)
00443             {
00444                 txtExceptionReport.Text = ex.ToString();
00445                 AppendAsyncEventMessage(ex.ToString());
00446             }
00447         }
00448
00449         private void BtnSetImageMaxHeight_Click(object sender, RoutedEventArgs e)
00450         {
00451             try
00452             {
00453                 if (txtImageMaxHeight != null && !string.IsNullOrWhiteSpace(txtImageMaxHeight.Text) && image != null)
00454                 {
00455                     image.MaxHeight = double.Parse(txtImageMaxHeight.Text);
00456                 }
00457             }
00458             catch (Exception ex)
00459             {
00460                 txtExceptionReport.Text = ex.ToString();
00461                 AppendAsyncEventMessage(ex.ToString());
00462             }
00463         }
00464
00465         private void BtnSetImageHeight_Click(object sender, RoutedEventArgs e)
00466         {
00467             try
00468             {
00469                 if (txtImageHeight != null && !string.IsNullOrWhiteSpace(txtImageHeight.Text) && image != null)
00470                 {
00471                     image.Height = double.Parse(txtImageHeight.Text);
00472                 }
00473             }
00474             catch (Exception ex)
00475             {
00476                 txtExceptionReport.Text = ex.ToString();
00477                 AppendAsyncEventMessage(ex.ToString());
00478             }
00479         }
00480
00481         private void BtnGetImageHorizontalAlignment_Click(object sender, RoutedEventArgs e)
00482         {
00483             try
00484             {
00485                 if (image != null && cmbImageHorizontalAlignment != null)
00486                 {
00487                     cmbImageHorizontalAlignment.SelectedIndex = (int) image.HorizontalAlignment;
00488                 }
00489             }
00490             catch (Exception ex)
00491             {
00492                 txtExceptionReport.Text = ex.ToString();
00493                 AppendAsyncEventMessage(ex.ToString());
00494             }
00495         }
00496
00497         private void BtnGetImageVerticalAlignment_Click(object sender, RoutedEventArgs e)
00498         {
00499             try
00500             {
00501                 if (image != null && cmbImageVerticalAlignment != null)
00502                 {
00503                     cmbImageVerticalAlignment.SelectedIndex = (int)image.VerticalAlignment;
00504                 }
00505             }
00506             catch (Exception ex)
00507             {
00508                 txtExceptionReport.Text = ex.ToString();
00509                 AppendAsyncEventMessage(ex.ToString());
00510             }
00511         }
00512
00513         private void BtnSetImageHorizontalAlignment_Click(object sender, RoutedEventArgs e)
00514         {
00515             try
00516             {
00517                 if (image != null && cmbImageHorizontalAlignment != null)
00518                 {
00519                     image.HorizontalAlignment = (HorizontalAlignment) cmbImageHorizontalAlignment.SelectedIndex;
00520                 }
00521             }
00522             catch (Exception ex)
00523             {
00524                 txtExceptionReport.Text = ex.ToString();
00525                 AppendAsyncEventMessage(ex.ToString());
00526             }
00527         }
00528
00529         private void BtnSetImageVerticalAlignment_Click(object sender, RoutedEventArgs e)
00530         {
00531             try
00532             {
00533                 if (image != null && cmbImageVerticalAlignment != null)
00534                 {
00535                     image.VerticalAlignment = (VerticalAlignment) cmbImageVerticalAlignment.SelectedIndex;
00536                 }
00537             }
00538             catch (Exception ex)
00539             {
00540                 txtExceptionReport.Text = ex.ToString();
00541                 AppendAsyncEventMessage(ex.ToString());
00542             }
00543         }
00544
00545         private void BtnGetImageMargin_Click(object sender, RoutedEventArgs e)
00546         {
00547             try
00548             {
00549                 if (image != null && txtImageMargin != null)
00550                 {
00551                     txtImageMargin.Text = image.Margin.ToString();
00552                 }
00553             }
00554             catch (Exception ex)
00555             {
00556                 txtExceptionReport.Text = ex.ToString();
00557                 AppendAsyncEventMessage(ex.ToString());
00558             }
00559         }
00560
00561         private void BtnSetImageMargin_Click(object sender, RoutedEventArgs e)
00562         {
00563             try
00564             {
00565                 if (image != null && txtImageMargin != null)
00566                 {
00567                     image.Margin = GetThicknessFromString(txtImageMargin.Text);
00568                 }
00569             }
00570             catch (Exception ex)
00571             {
00572                 txtExceptionReport.Text = ex.ToString();
00573                 AppendAsyncEventMessage(ex.ToString());
00574             }
00575         }
00576
00577         private void BtnGetImageParentWidth_Click(object sender, RoutedEventArgs e)
00578         {
00579             try
00580             {
00581                 if (imagePanel != null && txtImageParentWidth != null)
00582                 {
00583                     txtImageParentWidth.Text = imagePanel.Width.ToString();
00584                 }
00585             }
00586             catch (Exception ex)
00587             {
00588                 txtExceptionReport.Text = ex.ToString();
00589                 AppendAsyncEventMessage(ex.ToString());
00590             }
00591         }
00592
00593         private void BtnGetImageParentHeight_Click(object sender, RoutedEventArgs e)
00594         {
00595             try
00596             {
00597                 if (imagePanel != null && txtImageParentHeight != null)
00598                 {
00599                     txtImageParentHeight.Text = imagePanel.Height.ToString();
00600                 }
00601             }
00602             catch (Exception ex)
00603             {
00604                 txtExceptionReport.Text = ex.ToString();
00605                 AppendAsyncEventMessage(ex.ToString());
00606             }
00607         }
00608
00609         private void BtnSetImageParentWidth_Click(object sender, RoutedEventArgs e)
00610         {
00611             try
00612             {
00613                 if (imagePanel != null && txtImageParentWidth != null)
00614                 {
00615                     imagePanel.Width = double.Parse(txtImageParentWidth.Text);
00616                 }
00617             }
00618             catch (Exception ex)
00619             {
00620                 txtExceptionReport.Text = ex.ToString();
00621                 AppendAsyncEventMessage(ex.ToString());
00622             }
00623         }
00624
00625         private void BtnSetImageParentHeight_Click(object sender, RoutedEventArgs e)
00626         {
00627             try
00628             {
00629                 if (imagePanel != null && txtImageParentHeight != null)
00630                 {
00631                     imagePanel.Height = double.Parse(txtImageParentHeight.Text);
00632                 }
00633             }
00634             catch (Exception ex)
00635             {
00636                 txtExceptionReport.Text = ex.ToString();
00637                 AppendAsyncEventMessage(ex.ToString());
00638             }
00639         }
00640
00641         private void UpdateImage()
00642         {
00643             try
00644             {
00645                 if (txtBitmapImageUriSource != null &&
00646                     txtBitmapImageDecodePixelWidth != null &&
00647                     txtBitmapImageDecodePixelHeight != null)
00648                 {
00649                     int imageIndexTemp = int.Parse(txtBitmapImageUriSource.Text);
00650
00651                     if (imageIndexTemp >= 1 && imageIndexTemp <= 126)
00652                     {
00653                         imageIndex = imageIndexTemp;
00654
00655                         Uri uri = new Uri(string.Format("ms-appx:///Images/vette{0}.jpg", imageIndex));
00656
00657                         BitmapImage bitmapImage = new BitmapImage() {
00658                             DecodePixelWidth = int.Parse(txtBitmapImageDecodePixelWidth.Text),
00659                             DecodePixelHeight = int.Parse(txtBitmapImageDecodePixelHeight.Text),
00660                             UriSource = uri
00661                         };
00662
00663                         image.Source = bitmapImage;
00664                     }
00665                     else
00666                     {
00667                         AppendAsyncEventMessage("Image number out of bounds. Pick a number between 1 and 126.");
00668                     }
00669                 }
00670             }
00671             catch (Exception ex)
00672             {
00673                 txtExceptionReport.Text = ex.ToString();
00674                 AppendAsyncEventMessage(ex.ToString());
00675             }
00676         }
00677
00678         private void AppendAsyncEventMessage(string asyncEventMessage)
00679         {
00680             lock (asyncEventReportingLock)
00681             {
00682                 while (asyncEventMessage.Length > 0)
00683                 {
00684                     string msgHead = asyncEventMessage;
00685
00686                     if (asyncEventMessage.Length > 110)
00687                     {
00688                         int commaIndex = asyncEventMessage.IndexOf(',', 110);
00689                         if (commaIndex != -1)
00690                         {
00691                             msgHead = asyncEventMessage.Substring(0, commaIndex);
00692                             asyncEventMessage = asyncEventMessage.Substring(commaIndex + 1);
00693                         }
00694                         else
00695                         {
00696                             asyncEventMessage = string.Empty;
00697                         }
00698                     }
00699                     else
00700                     {
00701                         asyncEventMessage = string.Empty;
00702                     }
00703
00704                     lstAsyncEventMessage.Add(msgHead);
00705                 }
00706                 var ignored = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, AppendAsyncEventMessage);
00707
00708             }
00709         }
00710
00711         private void AppendAsyncEventMessage()
00712         {
00713             lock (asyncEventReportingLock)
00714             {
00715                 foreach (string asyncEventMessage in lstAsyncEventMessage)
00716                 {
00717                     lstLogs.Items.Add(asyncEventMessage);
00718                 }
00719                 lstAsyncEventMessage.Clear();
00720             }
00721         }
00722
00723         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00724         {
00725             txtExceptionReport.Text = string.Empty;
00726         }
00727
00728         private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
00729         {
00730             lstLogs.Items.Clear();
00731         }
00732
00733         private Thickness GetThicknessFromString(string thickness)
00734         {
00735             string[] lengths = thickness.Split(',');
00736             if (lengths.Length < 4)
00737                 return new Thickness(
00738                     Convert.ToDouble(lengths[0]));
00739             else
00740                 return new Thickness(
00741                     Convert.ToDouble(lengths[0]), Convert.ToDouble(lengths[1]), Convert.ToDouble(lengths[2]), Convert.ToDouble(lengths[3]));
00742         }
00743     }
00744 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

OrientationBasedMeasures Member List

This is the complete list of members for OrientationBasedMeasures, including all inherited members.
GetScrollOrientation() const | OrientationBasedMeasures | [inline]
Major(const winrt::Size &size) | OrientationBasedMeasures |
MajorEnd(const winrt::Rect &rect) const | OrientationBasedMeasures |
MajorSize(const winrt::Rect &rect) | OrientationBasedMeasures |
MajorStart(const winrt::Rect &rect) | OrientationBasedMeasures |
Minor(const winrt::Size &size) | OrientationBasedMeasures |
MinorEnd(const winrt::Rect &rect) const | OrientationBasedMeasures |
MinorMajorPoint(float minor, float major) | OrientationBasedMeasures |
MinorMajorRect(float minor, float major, float minorSize, float majorSize) | OrientationBasedMeasures |
MinorMajorSize(float minor, float major) | OrientationBasedMeasures |
MinorSize(const winrt::Rect &rect) | OrientationBasedMeasures |
MinorStart(const winrt::Rect &rect) | OrientationBasedMeasures |
SetScrollOrientation(ScrollOrientation value) | OrientationBasedMeasures | [inline]
Generated on Sun Dec 1 2024 20:52:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SelectedTreeNodeVector Member List

This is the complete list of members for SelectedTreeNodeVector, including all inherited members.
abi_enter() | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
Append(winrt::TreeViewNode const &node) | SelectedTreeNodeVector |
CheckThread() | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
Clear() | SelectedTreeNodeVector |
Contains(winrt::TreeViewNode const &node) | SelectedTreeNodeVector |
DeleteInstanceOnUIThread(std::unique_ptr< SelectedTreeNodeVector > &&self) noexcept | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
final_release(std::unique_ptr< SelectedTreeNodeVector > &&self) | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline, static]
GetBase() | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
GetCustomIndexOfFunction | SelectedTreeNodeVector | [inline]
GetInner() | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
Implement_Vector_Read(SelectedTreeNodeVectorOptions) private | SelectedTreeNodeVector | [inline, private]
IndexOf_OptimizedForRemove(winrt::TreeViewNode const &node, uint32_t &index) | SelectedTreeNodeVector |
InsertAt(unsigned int index, winrt::TreeViewNode const &node) | SelectedTreeNodeVector |
InsertAtCore_NoContainsCheck(unsigned int index, winrt::TreeViewNode const &node) | SelectedTreeNodeVector |
IsOnThread() | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< SelectedTreeNodeVector, reference_tracker_implements_t< SelectedTreeNodeVectorOptions::VectorType >::type, TreeViewNodeVectorOptions::IterableType, TreeViewNodeVectorOptions::ObservableVectorType > | [inline]
RemoveAt(unsigned int index) | SelectedTreeNodeVector |
RemoveAtCore(unsigned int index) | SelectedTreeNodeVector |
RemoveAtEnd() | SelectedTreeNodeVector |
ReplaceAll(winrt::array_view< winrt::TreeViewNode const > nodes) | SelectedTreeNodeVector |
SetAt(unsigned int index, winrt::TreeViewNode const &node) | SelectedTreeNodeVector |
SetViewModel(ViewModel &viewModel) | SelectedTreeNodeVector |
UpdateSelection(winrt::TreeViewNode const &node, TreeNodeSelectionState state) | SelectedTreeNodeVector | [private]
Generated on Sun Dec 1 2024 20:53:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/PipsPagerTemplateSettings.properties.h Source File

  • Generated

PipsPagerTemplateSettings.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class PipsPagerTemplateSettingsProperties
00008 {
00009 public:
00010     PipsPagerTemplateSettingsProperties();
00011
00012     void PipsPagerItems(winrt::IVector<int> const& value);
00013     winrt::IVector<int> PipsPagerItems();
00014
00015     static winrt::DependencyProperty PipsPagerItemsProperty() { return s_PipsPagerItemsProperty; }
00016
00017     static GlobalDependencyProperty s_PipsPagerItemsProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021 };
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/QPCTimer.h Source File

  • Repeater

QPCTimer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 // High performance time management using QueryPerformanceCounter
00007 class QPCTimer final
00008 {
00009 public:
00010     QPCTimer();
00011     void Reset();
00012     int DurationInMilliSeconds() const;
00013
00014 private:
00015     LARGE_INTEGER m_start;
00016     LARGE_INTEGER m_frequency;
00017 };
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NestedGridViewsPage Member List

This is the complete list of members for NestedGridViewsPage, including all inherited members.
BtnGetItemsStackPanelCacheLength_Click(object sender, RoutedEventArgs e) | NestedGridViewsPage | [inline, private]
BtnSetItemsStackPanelCacheLength_Click(object sender, RoutedEventArgs e) | NestedGridViewsPage | [inline, private]
BtnSwitchOuterListViewVisibility_Click(object sender, RoutedEventArgs e) | NestedGridViewsPage | [inline, private]
ChkOuterListViewSingleSelectionFollowsFocus_IsCheckedChanged(object sender, RoutedEventArgs e) | NestedGridViewsPage | [inline, private]
CmbOuterListViewSelectionMode_SelectionChanged(object sender, SelectionChangedEventArgs e) | NestedGridViewsPage | [inline, private]
CmbOuterListViewTabNavigation_SelectionChanged(object sender, SelectionChangedEventArgs e) | NestedGridViewsPage | [inline, private]
NestedGridViewsPage() | NestedGridViewsPage | [inline]
Generated on Sun Dec 1 2024 20:54:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/ItemsView.cpp Source File

  • ItemsView

ItemsView.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include <DoubleUtil.h>
00007 #include "TypeLogging.h"
00008 #include "ItemsView.h"
00009 #include "RuntimeProfiler.h"
00010 #include "ItemsViewTestHooks.h"
00011 #include "ItemsViewItemInvokedEventArgs.h"
00012 #include "ItemsViewSelectionChangedEventArgs.h"
00013 #include "ItemsViewAutomationPeer.h"
00014 #include "NullSelector.h"
00015 #include "SingleSelector.h"
00016 #include "MultipleSelector.h"
00017 #include "ExtendedSelector.h"
00018 #include "ItemContainer.h"
00019 #include "ItemContainerRevokers.h"
00020 #include "ScrollView.h"
00021 #include "SelectionNode.h"
00022 #include "SelectionModel.h"
00023 #include "SharedHelpers.h"
00024
00025 // Change to 'true' to turn on debugging outputs in Output window
00026 bool ItemsViewTrace::s_IsDebugOutputEnabled{ false };
00027 bool ItemsViewTrace::s_IsVerboseDebugOutputEnabled{ false };
00028
00029 // Number of CompositionTarget.Rendering event occurrences after bring-into-view completion before resetting m_bringIntoViewElement as the scroll anchoring element.
00030 const uint8_t c_renderingEventsPostBringIntoView = 4;
00031
00032 ItemsView::ItemsView()
00033 {
00034     ITEMSVIEW_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00035
00036     __RP_Marker_ClassById(RuntimeProfiler::ProfId_ItemsView);
00037
00038     static const auto s_ItemsViewItemContainerRevokersPropertyInit = []()
00039     {
00040         s_ItemsViewItemContainerRevokersProperty =
00041             InitializeDependencyProperty(
00042                 L"ItemsViewItemContainerRevokers",
00043                 winrt::name_of<winrt::IInspectable>(),
00044                 winrt::name_of<winrt::UIElement>(),
00045                 true /* isAttached */,
00046                 nullptr /* defaultValue */);
00047         return false;
00048     }();
00049
00050     EnsureProperties();
00051     SetDefaultStyleKey(this);
00052
00053     m_loadedRevoker = Loaded(winrt::auto_revoke, { this, &ItemsView::OnLoaded });
00054     m_unloadedRevoker = Unloaded(winrt::auto_revoke, { this, &ItemsView::OnUnloaded });
00055     m_selectionModelSelectionChangedRevoker = m_selectionModel.SelectionChanged(winrt::auto_revoke, { this, &ItemsView::OnSelectionModelSelectionChanged });
00056     m_currentElementSelectionModelSelectionChangedRevoker = m_currentElementSelectionModel.SelectionChanged(winrt::auto_revoke, { this, &ItemsView::OnCurrentElementSelectionModelSelectionChanged });
00057
00058     // m_currentElementSelectionModel tracks the single current element.
00059     m_currentElementSelectionModel.SingleSelect(true);
00060
00061     UpdateSelector();
00062 }
00063
00064 ItemsView::~ItemsView()
00065 {
00066     ITEMSVIEW_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
00067
00068     m_loadedRevoker.revoke();
00069     m_unloadedRevoker.revoke();
00070     m_selectionModelSelectionChangedRevoker.revoke();
00071     m_currentElementSelectionModelSelectionChangedRevoker.revoke();
00072
00073     UnhookCompositionTargetRendering();
00074     UnhookItemsRepeaterEvents(true /*isForDestructor*/);
00075     UnhookScrollViewEvents(true /*isForDestructor*/);
00076 }
00077
00078 #pragma region IItemsView
00079
00080 winrt::ScrollView ItemsView::ScrollView() const
00081 {
00082     return m_scrollView.get().as<winrt::ScrollView>();
00083 }
00084
00085 // Returns the index of the closest realized item to a point specified by the two viewport ratio numbers.
00086 // See GetItemInternal for details.
00087 bool ItemsView::TryGetItemIndex(
00088     double horizontalViewportRatio,
00089     double verticalViewportRatio,
00090     int& index)
00091 {
00092     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, horizontalViewportRatio, verticalViewportRatio);
00093
00094     const winrt::IndexBasedLayoutOrientation indexBasedLayoutOrientation = GetLayoutIndexBasedLayoutOrientation();
00095     const bool isHorizontalDistanceFavored = indexBasedLayoutOrientation == winrt::IndexBasedLayoutOrientation::TopToBottom;
00096     const bool isVerticalDistanceFavored = indexBasedLayoutOrientation == winrt::IndexBasedLayoutOrientation::LeftToRight;
00097
00098     index = GetItemInternal(
00099                 horizontalViewportRatio,
00100                 verticalViewportRatio,
00101                 isHorizontalDistanceFavored,
00102                 isVerticalDistanceFavored,
00103                 false /*useKeyboardNavigationReferenceHorizontalOffset*/,
00104                 false /*useKeyboardNavigationReferenceVerticalOffset*/,
00105                 false /*capItemEdgesToViewportRatioEdges*/,
00106                 false /*forFocusableItemsOnly*/);
00107     return index != -1;
00108 }
00109
00110 // Invokes UIElement::StartBringIntoView with the provided BringIntoViewOptions instance, if any,
00111 // for the element associated with the given data index.
00112 // If that element is currently virtualized, it is realized and synchronously layed out, before that StartBringIntoView call.
00113 // Note that because of lines 111-112 of ViewportManagerWithPlatformFeatures::GetLayoutVisibleWindow() and line 295 of
00114 // ViewportManagerWithPlatformFeatures::OnBringIntoViewRequested(...), animated bring-into-view operations are not supported.
00115 // ViewportManagerWithPlatformFeatures::GetLayoutVisibleWindow snaps the RealizationWindow to 0,0 while
00116 // ViewportManagerWithPlatformFeatures::OnBringIntoViewRequested turns off BringIntoViewRequestedEventArgs::AnimationDesired.
00117 void ItemsView::StartBringItemIntoView(
00118     int32_t index,
00119     const winrt::BringIntoViewOptions& options)
00120 {
00121     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00122
00123     bool success = StartBringItemIntoViewInternal(true /*throwOutOfBounds*/, true /* throwOnAnyFailure */, index, options);
00124     MUX_ASSERT(success);
00125 }
00126
00127 winrt::IVectorView<winrt::IInspectable> ItemsView::SelectedItems()
00128 {
00129     return m_selectionModel.SelectedItems();
00130 }
00131
00132 void ItemsView::Select(int itemIndex)
00133 {
00134     m_selectionModel.Select(itemIndex);
00135 }
00136
00137 void ItemsView::Deselect(int itemIndex)
00138 {
00139     m_selectionModel.Deselect(itemIndex);
00140 }
00141
00142 bool ItemsView::IsSelected(int itemIndex)
00143 {
00144     const winrt::IReference<bool> isItemIndexSelected = m_selectionModel.IsSelected(itemIndex);
00145     return isItemIndexSelected != nullptr && isItemIndexSelected.Value();
00146 }
00147
00148 void ItemsView::SelectAll()
00149 {
00150     // TODO: Update once ItemsView has grouping.
00151     // This function assumes a flat list data source.
00152     m_selectionModel.SelectAllFlat();
00153 }
00154
00155 void ItemsView::DeselectAll()
00156 {
00157     m_selectionModel.ClearSelection();
00158 }
00159
00160 void ItemsView::InvertSelection()
00161 {
00162     if (auto const& itemsRepeater = m_itemsRepeater.get())
00163     {
00164         if (auto const& itemsSourceView = itemsRepeater.ItemsSourceView())
00165         {
00166             const auto selectedIndices = m_selectionModel.SelectedIndices();
00167             int indexEnd = itemsSourceView.Count() - 1;
00168
00169             // We loop backwards through the selected indices so we can deselect as we go
00170             for (int i = selectedIndices.Size() - 1; i >= 0; i--)
00171             {
00172                 auto indexPath = selectedIndices.GetAt(i);
00173                 // TODO: Update once ItemsView has grouping.
00174                 int index = indexPath.GetAt(0);
00175
00176                 // Select all the unselected items
00177                 if (index < indexEnd)
00178                 {
00179                     auto startIndex = winrt::IndexPath::CreateFrom(index + 1);
00180                     auto endIndex = winrt::IndexPath::CreateFrom(indexEnd);
00181                     m_selectionModel.SelectRange(startIndex, endIndex);
00182                 }
00183
00184                 m_selectionModel.DeselectAt(indexPath);
00185                 indexEnd = index - 1;
00186             }
00187
00188             // Select the remaining unselected items at the beginning of the collection
00189             if (indexEnd >= 0)
00190             {
00191                 auto startIndex = winrt::IndexPath::CreateFrom(0);
00192                 auto endIndex = winrt::IndexPath::CreateFrom(indexEnd);
00193                 m_selectionModel.SelectRange(startIndex, endIndex);
00194             }
00195         }
00196     }
00197 }
00198
00199 #pragma endregion
00200
00201 #pragma region IControlOverrides
00202
00203 #ifdef DBG
00204 void ItemsView::OnGotFocus(
00205     winrt::RoutedEventArgs const& args)
00206 {
00207     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00208
00209     __super::OnGotFocus(args);
00210 }
00211 #endif
00212
00213 #pragma endregion
00214
00215 #pragma region IFrameworkElementOverrides
00216
00217 void ItemsView::OnApplyTemplate()
00218 {
00219     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00220
00221     RestoreOriginalVerticalScrollControllerAndVisibility();
00222
00223     __super::OnApplyTemplate();
00224
00225     winrt::IControlProtected thisAsControlProtected = *this;
00226
00227     winrt::ScrollView scrollView = GetTemplateChildT<winrt::ScrollView>(s_scrollViewPartName, thisAsControlProtected);
00228
00229     UpdateScrollView(scrollView);
00230
00231     winrt::ItemsRepeater itemsRepeater = GetTemplateChildT<winrt::ItemsRepeater>(s_itemsRepeaterPartName, thisAsControlProtected);
00232
00233     UpdateItemsRepeater(itemsRepeater);
00234
00235     m_setVerticalScrollControllerOnLoaded = true;
00236 }
00237
00238 #pragma endregion
00239
00240 #pragma region IUIElementOverrides
00241
00242 winrt::AutomationPeer ItemsView::OnCreateAutomationPeer()
00243 {
00244     return winrt::make<ItemsViewAutomationPeer>(*this);
00245 }
00246
00247 #pragma endregion
00248
00249 // Invoked when a dependency property of this ItemsView has changed.
00250 void ItemsView::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00251 {
00252     auto dependencyProperty = args.Property();
00253
00254     ITEMSVIEW_TRACE_VERBOSE_DBG(nullptr, L"%s(property: %s)\n", METH_NAME, DependencyPropertyToStringDbg(dependencyProperty).c_str());
00255
00256     if (dependencyProperty == s_IsItemInvokedEnabledProperty)
00257     {
00258         OnIsItemInvokedEnabledChanged();
00259     }
00260     else if (dependencyProperty == s_ItemTemplateProperty)
00261     {
00262         OnItemTemplateChanged();
00263     }
00264     else if (dependencyProperty == s_SelectionModeProperty)
00265     {
00266         OnSelectionModeChanged();
00267     }
00268     else if (dependencyProperty == s_ItemsSourceProperty)
00269     {
00270         OnItemsSourceChanged();
00271     }
00272     else if (dependencyProperty == s_VerticalScrollControllerProperty)
00273     {
00274         OnVerticalScrollControllerChanged();
00275     }
00276 #ifdef DBG
00277     else if (dependencyProperty == s_LayoutProperty)
00278     {
00279         OnLayoutChangedDbg();
00280     }
00281 #endif
00282 }
00283
00284 // Make sure the default ItemTemplate is used when the ItemsSource is non-null and the ItemTemplate is null.
00285 // Prevents ViewManager::GetElementFromElementFactory from setting the ItemsRepeater.ItemTemplate property
00286 // which would clear the template-binding between the ItemsView & ItemsRepeater ItemTemplate properties.
00287 // This is not needed though when the ItemsSource points to UIElements instead of data items. In that case,
00288 // ViewManager::GetElementFromElementFactory will not set a default ItemTemplate. It must remain null.
00289 void ItemsView::EnsureItemTemplate()
00290 {
00291     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00292
00293     if (ItemsSource() == nullptr || ItemTemplate() != nullptr)
00294     {
00295         return;
00296     }
00297
00298     if (auto const& itemsRepeater = m_itemsRepeater.get())
00299     {
00300         if (auto const& itemsSourceView = itemsRepeater.ItemsSourceView())
00301         {
00302             const auto itemCount = itemsSourceView.Count();
00303
00304             if (itemCount == 0)
00305             {
00306                 return;
00307             }
00308
00309             const auto data = itemsSourceView.GetAt(0);
00310
00311             if (auto const& dataAsUIElement = data.try_as<winrt::UIElement>())
00312             {
00313                 // No need to set a default ItemTemplate with an ItemContainer when the ItemsSource is a list of UIElements.
00314                 return;
00315             }
00316
00317             // The default ItemTemplate uses an ItemContainer for its root element since this is an ItemsView requirement for now.
00318             auto const defaultItemTemplate = winrt::XamlReader::Load(L"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'><ItemContainer><TextBlock Text='{Binding}'/></ItemContainer></DataTemplate>").as<winrt::DataTemplate>();
00319
00320             ItemTemplate(defaultItemTemplate);
00321         }
00322     }
00323 }
00324
00325 void ItemsView::UpdateItemsRepeater(
00326     const winrt::ItemsRepeater& itemsRepeater)
00327 {
00328     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00329
00330     m_keyboardNavigationReferenceResetPending = false;
00331
00332     UnhookItemsRepeaterEvents(false /*isForDestructor*/);
00333
00334     // Reset inner ItemsRepeater dependency properties
00335     if (auto oldItemsRepeater = m_itemsRepeater.get())
00336     {
00337         oldItemsRepeater.ClearValue(winrt::ItemsRepeater::ItemsSourceProperty());
00338         oldItemsRepeater.ClearValue(winrt::ItemsRepeater::ItemTemplateProperty());
00339         oldItemsRepeater.ClearValue(winrt::ItemsRepeater::LayoutProperty());
00340     }
00341
00342     m_itemsRepeater.set(itemsRepeater);
00343
00344     HookItemsRepeaterEvents();
00345     HookItemsSourceViewEvents();
00346 }
00347
00348 void ItemsView::UpdateScrollView(
00349     const winrt::ScrollView& scrollView)
00350 {
00351     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00352
00353     UnhookScrollViewEvents(false /*isForDestructor*/);
00354
00355     m_scrollView.set(scrollView);
00356
00357     SetValue(s_ScrollViewProperty, scrollView);
00358
00359     HookScrollViewEvents();
00360 }
00361
00362 void ItemsView::UpdateSelector()
00363 {
00364     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, SelectionMode());
00365
00366     m_selectionModel.SingleSelect(false);
00367
00368     switch (SelectionMode())
00369     {
00370         case winrt::ItemsViewSelectionMode::None:
00371         {
00372             m_selectionModel.ClearSelection();
00373             m_selector = std::make_shared<NullSelector>();
00374             break;
00375         }
00376
00377         case winrt::ItemsViewSelectionMode::Single:
00378         {
00379             m_selectionModel.SingleSelect(true);
00380
00381             m_selector = std::make_shared<SingleSelector>();
00382             m_selector->SetSelectionModel(m_selectionModel);
00383             break;
00384         }
00385
00386         case winrt::ItemsViewSelectionMode::Multiple:
00387         {
00388             m_selector = std::make_shared<MultipleSelector>();
00389             m_selector->SetSelectionModel(m_selectionModel);
00390             break;
00391         }
00392
00393         case winrt::ItemsViewSelectionMode::Extended:
00394         {
00395             m_selector = std::make_shared<ExtendedSelector>();
00396             m_selector->SetSelectionModel(m_selectionModel);
00397             break;
00398         }
00399     }
00400 }
00401
00402 bool ItemsView::CanRaiseItemInvoked(
00403     const winrt::ItemContainerInteractionTrigger& interactionTrigger,
00404     const winrt::ItemContainer& itemContainer)
00405 {
00406     MUX_ASSERT(itemContainer != nullptr);
00407
00408 #ifdef MUX_PRERELEASE
00409     const winrt::ItemContainerUserInvokeMode canUserInvoke = itemContainer.CanUserInvoke();
00410 #else
00411     const winrt::ItemContainerUserInvokeMode canUserInvoke = winrt::get_self<ItemContainer>(itemContainer)->CanUserInvokeInternal();
00412 #endif
00413
00414     if (static_cast<int>(canUserInvoke & (winrt::ItemContainerUserInvokeMode::UserCannotInvoke | winrt::ItemContainerUserInvokeMode::UserCanInvoke)) != static_cast<int>(winrt::ItemContainerUserInvokeMode::UserCanInvoke))
00415     {
00416         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"Returns false based on ItemContainer.CanUserInvoke.");
00417
00418         return false;
00419     }
00420
00421     const bool cannotRaiseItemInvoked =
00422         (!IsItemInvokedEnabled()  ||
00423         (SelectionMode() == winrt::ItemsViewSelectionMode::None && interactionTrigger == winrt::ItemContainerInteractionTrigger::DoubleTap) ||
00424         (SelectionMode() != winrt::ItemsViewSelectionMode::None && (interactionTrigger == winrt::ItemContainerInteractionTrigger::Tap || interactionTrigger == winrt::ItemContainerInteractionTrigger::SpaceKey)));
00425
00426     const bool canRaiseItemInvoked = !cannotRaiseItemInvoked;
00427
00428     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"Returns based on ItemsView.IsItemInvokedEnabled.", canRaiseItemInvoked);
00429
00430     return canRaiseItemInvoked;
00431 }
00432
00433 void ItemsView::RaiseItemInvoked(
00434     const winrt::UIElement& element)
00435 {
00436     if (m_itemInvokedEventSource)
00437     {
00438         bool itemInvokedFound = false;
00439
00440         auto const& itemInvoked = GetElementItem(element, &itemInvokedFound);
00441
00442         ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_PTR_INT, METH_NAME, this, itemInvoked, itemInvokedFound);
00443
00444         if (itemInvokedFound)
00445         {
00446             auto itemsViewItemInvokedEventArgs = winrt::make_self<ItemsViewItemInvokedEventArgs>(itemInvoked);
00447
00448             m_itemInvokedEventSource(*this, *itemsViewItemInvokedEventArgs);
00449         }
00450     }
00451 }
00452
00453 void ItemsView::RaiseSelectionChanged()
00454 {
00455     if (m_selectionChangedEventSource)
00456     {
00457         ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00458
00459         auto itemsViewSelectionChangedEventArgs = winrt::make_self<ItemsViewSelectionChangedEventArgs>();
00460
00461         m_selectionChangedEventSource(*this, *itemsViewSelectionChangedEventArgs);
00462     }
00463 }
00464
00465 void ItemsView::HookItemsSourceViewEvents()
00466 {
00467     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00468
00469     m_itemsSourceViewChangedRevoker.revoke();
00470
00471     if (auto const& itemsRepeater = m_itemsRepeater.get())
00472     {
00473         if (auto const& itemsSourceView = itemsRepeater.ItemsSourceView())
00474         {
00475             m_itemsSourceViewChangedRevoker = itemsSourceView.CollectionChanged(winrt::auto_revoke, { this, &ItemsView::OnSourceListChanged });
00476
00477             // Make sure the default ItemTemplate is used when the ItemsSource is non-null and the ItemTemplate is null.
00478             EnsureItemTemplate();
00479         }
00480     }
00481 }
00482
00483 void ItemsView::HookItemsRepeaterEvents()
00484 {
00485     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00486
00487     if (auto itemsRepeater = m_itemsRepeater.get())
00488     {
00489         m_itemsRepeaterElementPreparedRevoker = itemsRepeater.ElementPrepared(winrt::auto_revoke, { this, &ItemsView::OnItemsRepeaterElementPrepared });
00490         m_itemsRepeaterElementClearingRevoker = itemsRepeater.ElementClearing(winrt::auto_revoke, { this, &ItemsView::OnItemsRepeaterElementClearing });
00491         m_itemsRepeaterElementIndexChangedRevoker = itemsRepeater.ElementIndexChanged(winrt::auto_revoke, { this, &ItemsView::OnItemsRepeaterElementIndexChanged });
00492         m_itemsRepeaterLayoutUpdatedRevoker = itemsRepeater.LayoutUpdated(winrt::auto_revoke, { this, &ItemsView::OnItemsRepeaterLayoutUpdated });
00493         m_itemsRepeaterSizeChangedRevoker = itemsRepeater.SizeChanged(winrt::auto_revoke, { this, &ItemsView::OnItemsRepeaterSizeChanged });
00494         m_itemsRepeaterItemsSourcePropertyChangedRevoker = RegisterPropertyChanged(itemsRepeater, winrt::ItemsRepeater::ItemsSourceProperty(), { this, &ItemsView::OnItemsRepeaterItemsSourceChanged });
00495     }
00496 }
00497
00498 void ItemsView::UnhookItemsRepeaterEvents(
00499     bool isForDestructor)
00500 {
00501     if (isForDestructor)
00502     {
00503         ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00504     }
00505     else
00506     {
00507         ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00508     }
00509
00510     if (auto itemRepeater = isForDestructor ? m_itemsRepeater.safe_get() : m_itemsRepeater.get())
00511     {
00512         m_itemsRepeaterElementPreparedRevoker.revoke();
00513         m_itemsRepeaterElementClearingRevoker.revoke();
00514         m_itemsRepeaterElementIndexChangedRevoker.revoke();
00515         m_itemsRepeaterItemsSourcePropertyChangedRevoker.revoke();
00516         m_itemsRepeaterLayoutUpdatedRevoker.revoke();
00517         m_itemsRepeaterSizeChangedRevoker.revoke();
00518
00519         if (isForDestructor)
00520         {
00521             ClearAllItemsViewItemContainerRevokers();
00522         }
00523     }
00524 }
00525
00526 void ItemsView::HookScrollViewEvents()
00527 {
00528     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00529
00530     if (auto const& scrollView = m_scrollView.get())
00531     {
00532         m_scrollViewAnchorRequestedRevoker = scrollView.AnchorRequested(winrt::auto_revoke, { this, &ItemsView::OnScrollViewAnchorRequested });
00533         m_scrollViewBringingIntoViewRevoker = scrollView.BringingIntoView(winrt::auto_revoke, { this, &ItemsView::OnScrollViewBringingIntoView });
00534 #ifdef DBG
00535         m_scrollViewExtentChangedRevokerDbg = scrollView.ExtentChanged(winrt::auto_revoke, { this, &ItemsView::OnScrollViewExtentChangedDbg });
00536 #endif
00537         m_scrollViewScrollCompletedRevoker = scrollView.ScrollCompleted(winrt::auto_revoke, { this, &ItemsView::OnScrollViewScrollCompleted });
00538     }
00539 }
00540
00541 void ItemsView::UnhookScrollViewEvents(
00542     bool isForDestructor)
00543 {
00544     if (isForDestructor)
00545     {
00546         ITEMSVIEW_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
00547     }
00548     else
00549     {
00550         ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00551     }
00552
00553     if (auto scrollView = isForDestructor ? m_scrollView.safe_get() : m_scrollView.get())
00554     {
00555         m_scrollViewAnchorRequestedRevoker.revoke();
00556         m_scrollViewBringingIntoViewRevoker.revoke();
00557 #ifdef DBG
00558         m_scrollViewExtentChangedRevokerDbg.revoke();
00559 #endif
00560         m_scrollViewScrollCompletedRevoker.revoke();
00561     }
00562 }
00563
00564 void ItemsView::HookCompositionTargetRendering()
00565 {
00566     if (!m_renderingRevoker)
00567     {
00568         winrt::Microsoft::UI::Xaml::Media::CompositionTarget compositionTarget{ nullptr };
00569         m_renderingRevoker = compositionTarget.Rendering(winrt::auto_revoke, { this, &ItemsView::OnCompositionTargetRendering });
00570     }
00571 }
00572
00573 void ItemsView::UnhookCompositionTargetRendering()
00574 {
00575     m_renderingRevoker.revoke();
00576 }
00577
00578 void ItemsView::CacheOriginalVerticalScrollControllerAndVisibility()
00579 {
00580     if (auto scrollView = m_scrollView.get())
00581     {
00582         if (const auto scrollPresenter = scrollView.ScrollPresenter())
00583         {
00584             m_originalVerticalScrollController.set(scrollPresenter.VerticalScrollController());
00585         }
00586
00587         m_originalVerticalScrollBarVisibility = scrollView.VerticalScrollBarVisibility();
00588     }
00589
00590     ITEMSVIEW_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_originalVerticalScrollController, L"m_originalVerticalScrollController");
00591     ITEMSVIEW_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_originalVerticalScrollBarVisibility", m_originalVerticalScrollBarVisibility);
00592 }
00593
00594 // Restore the original ScrollView and ScrollController properties when
00595 // the ItemsView gets re-templated.
00596 void ItemsView::RestoreOriginalVerticalScrollControllerAndVisibility()
00597 {
00598     ITEMSVIEW_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_originalVerticalScrollController, L"m_originalVerticalScrollController");
00599     ITEMSVIEW_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_originalVerticalScrollBarVisibility", m_originalVerticalScrollBarVisibility);
00600
00601     if (auto scrollView = m_scrollView.get())
00602     {
00603         if (auto scrollPresenter = scrollView.ScrollPresenter())
00604         {
00605             scrollPresenter.VerticalScrollController(m_originalVerticalScrollController.get());
00606         }
00607
00608         scrollView.VerticalScrollBarVisibility(m_originalVerticalScrollBarVisibility);
00609     }
00610
00611     m_originalVerticalScrollController.set(nullptr);
00612     m_originalVerticalScrollBarVisibility = winrt::ScrollingScrollBarVisibility::Auto;
00613 }
00614
00615 void ItemsView::SetVerticalScrollControllerOnLoaded()
00616 {
00617     if (VerticalScrollController())
00618     {
00619         // Apply the VerticalScrollController property value that was set
00620         // before the Loaded event.
00621         ApplyVerticalScrollController();
00622     }
00623     else
00624     {
00625         // The VerticalScrollController property was left null prior to the
00626         // Loaded event. Use the value from the inner ScrollPresenter.
00627         // This may invoke ItemsView::OnVerticalScrollControllerChanged and
00628         // ItemsView::ApplyVerticalScrollController but will be a no-op.
00629         VerticalScrollController(m_originalVerticalScrollController.get());
00630     }
00631 }
00632
00633 // Propagates the ItemsView.VerticalScrollController property value to the
00634 // inner ScrollPresenter.VerticalScrollController property.
00635 // If the value is other than original value read in the Loaded event,
00636 // the inner ScrollView's VerticalScrollBarVisibility is set to Hidden.
00637 // Else, the original visibility is restored.
00638 void ItemsView::ApplyVerticalScrollController()
00639 {
00640     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, VerticalScrollController(), L"VerticalScrollController");
00641
00642     if (auto scrollView = m_scrollView.get())
00643     {
00644         const auto verticalScrollController = VerticalScrollController();
00645
00646         if (verticalScrollController == m_originalVerticalScrollController.get())
00647         {
00648             scrollView.VerticalScrollBarVisibility(m_originalVerticalScrollBarVisibility);
00649         }
00650         else
00651         {
00652             scrollView.VerticalScrollBarVisibility(winrt::ScrollingScrollBarVisibility::Hidden);
00653         }
00654
00655         auto scrollViewImpl = winrt::get_self<::ScrollView>(scrollView);
00656
00657         if (auto scrollPresenter = scrollViewImpl->ScrollPresenter())
00658         {
00659             scrollPresenter.VerticalScrollController(verticalScrollController);
00660         }
00661     }
00662 }
00663
00664 // Invoked at the beginning of a StartBringItemIntoView call to abort any potential bring-into-view operation, and a few ticks after a bring-into-view
00665 // operation completed, giving time for the new layout to settle and scroll anchoring to do its job of freezing its target element.
00666 void ItemsView::CompleteStartBringItemIntoView()
00667 {
00668     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_bringIntoViewElement.get(), L"m_bringIntoViewElement reset.");
00669     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_bringIntoViewCorrelationId reset", m_bringIntoViewCorrelationId);
00670     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_bringIntoViewElementRetentionCountdown reset", m_bringIntoViewElementRetentionCountdown);
00671
00672     m_bringIntoViewElement.set(nullptr);
00673     m_bringIntoViewElementRetentionCountdown = 0;
00674     m_bringIntoViewCorrelationId = -1;
00675
00676     if (m_scrollViewHorizontalAnchorRatio != -1)
00677     {
00678         MUX_ASSERT(m_scrollViewVerticalAnchorRatio != -1);
00679
00680         // Restore the pre-operation anchor settings.
00681         if (const auto scrollView = m_scrollView.get())
00682         {
00683             scrollView.HorizontalAnchorRatio(m_scrollViewHorizontalAnchorRatio);
00684             scrollView.VerticalAnchorRatio(m_scrollViewVerticalAnchorRatio);
00685         }
00686
00687         m_scrollViewHorizontalAnchorRatio = -1;
00688         m_scrollViewVerticalAnchorRatio = -1;
00689     }
00690
00691     if (m_navigationKeyProcessingCountdown == 0)
00692     {
00693         UnhookCompositionTargetRendering();
00694     }
00695 }
00696
00697 void ItemsView::OnItemsRepeaterElementPrepared(
00698     const winrt::ItemsRepeater& itemsRepeater,
00699     const winrt::ItemsRepeaterElementPreparedEventArgs& args)
00700 {
00701     if (const auto element = args.Element())
00702     {
00703         const auto index = args.Index();
00704
00705 #ifdef DBG_VERBOSE
00706         ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, index);
00707 #endif
00708
00709         MUX_ASSERT(index == GetElementIndex(element));
00710
00711         const auto itemContainer = element.try_as<winrt::ItemContainer>();
00712
00713         if (itemContainer != nullptr)
00714         {
00715 #ifdef MUX_PRERELEASE
00716             if (static_cast<int>(itemContainer.CanUserInvoke() & winrt::ItemContainerUserInvokeMode::Auto))
00717             {
00718                 winrt::ItemContainerUserInvokeMode canUserInvoke = winrt::ItemContainerUserInvokeMode::Auto;
00719
00720                 canUserInvoke |= IsItemInvokedEnabled() ? winrt::ItemContainerUserInvokeMode::UserCanInvoke : winrt::ItemContainerUserInvokeMode::UserCannotInvoke;
00721
00722                 itemContainer.CanUserInvoke(canUserInvoke);
00723             }
00724
00725             if (static_cast<int>(itemContainer.MultiSelectMode() & winrt::ItemContainerMultiSelectMode::Auto))
00726             {
00727                 winrt::ItemContainerMultiSelectMode multiSelectMode = winrt::ItemContainerMultiSelectMode::Auto;
00728
00729                 switch (SelectionMode())
00730                 {
00731                     case winrt::ItemsViewSelectionMode::None:
00732                     case winrt::ItemsViewSelectionMode::Single:
00733                         multiSelectMode |= winrt::ItemContainerMultiSelectMode::Single;
00734                         break;
00735                     case winrt::ItemsViewSelectionMode::Extended:
00736                         multiSelectMode |= winrt::ItemContainerMultiSelectMode::Extended;
00737                         break;
00738                     case winrt::ItemsViewSelectionMode::Multiple:
00739                         multiSelectMode |= winrt::ItemContainerMultiSelectMode::Multiple;
00740                         break;
00741                 }
00742
00743                 itemContainer.MultiSelectMode(multiSelectMode);
00744             }
00745
00746             if (static_cast<int>(itemContainer.CanUserSelect() & winrt::ItemContainerUserSelectMode::Auto))
00747             {
00748                 winrt::ItemContainerUserSelectMode canUserSelect = winrt::ItemContainerUserSelectMode::Auto;
00749
00750                 canUserSelect |= SelectionMode() == winrt::ItemsViewSelectionMode::None ? winrt::ItemContainerUserSelectMode::UserCannotSelect : winrt::ItemContainerUserSelectMode::UserCanSelect;
00751
00752                 itemContainer.CanUserSelect(canUserSelect);
00753             }
00754 #else
00755             if (const auto& itemContainerImpl = winrt::get_self<ItemContainer>(itemContainer))
00756             {
00757                 if (static_cast<int>(itemContainerImpl->CanUserInvokeInternal() & winrt::ItemContainerUserInvokeMode::Auto))
00758                 {
00759                     winrt::ItemContainerUserInvokeMode canUserInvoke = winrt::ItemContainerUserInvokeMode::Auto;
00760
00761                     canUserInvoke |= IsItemInvokedEnabled() ? winrt::ItemContainerUserInvokeMode::UserCanInvoke : winrt::ItemContainerUserInvokeMode::UserCannotInvoke;
00762
00763                     itemContainerImpl->CanUserInvokeInternal(canUserInvoke);
00764                 }
00765
00766                 if (static_cast<int>(itemContainerImpl->MultiSelectModeInternal() & winrt::ItemContainerMultiSelectMode::Auto))
00767                 {
00768                     winrt::ItemContainerMultiSelectMode multiSelectMode = winrt::ItemContainerMultiSelectMode::Auto;
00769
00770                     switch (SelectionMode())
00771                     {
00772                         case winrt::ItemsViewSelectionMode::None:
00773                         case winrt::ItemsViewSelectionMode::Single:
00774                             multiSelectMode |= winrt::ItemContainerMultiSelectMode::Single;
00775                             break;
00776                         case winrt::ItemsViewSelectionMode::Extended:
00777                             multiSelectMode |= winrt::ItemContainerMultiSelectMode::Extended;
00778                             break;
00779                         case winrt::ItemsViewSelectionMode::Multiple:
00780                             multiSelectMode |= winrt::ItemContainerMultiSelectMode::Multiple;
00781                             break;
00782                     }
00783
00784                     itemContainerImpl->MultiSelectModeInternal(multiSelectMode);
00785                 }
00786
00787                 if (static_cast<int>(itemContainerImpl->CanUserSelectInternal() & winrt::ItemContainerUserSelectMode::Auto))
00788                 {
00789                     winrt::ItemContainerUserSelectMode canUserSelect = winrt::ItemContainerUserSelectMode::Auto;
00790
00791                     canUserSelect |= SelectionMode() == winrt::ItemsViewSelectionMode::None ? winrt::ItemContainerUserSelectMode::UserCannotSelect : winrt::ItemContainerUserSelectMode::UserCanSelect;
00792
00793                     itemContainerImpl->CanUserSelectInternal(canUserSelect);
00794                 }
00795             }
00796 #endif
00797
00798             winrt::IReference<bool> isSelectionModelSelectedAsNullable = m_selectionModel.IsSelected(index);
00799             bool isSelectionModelSelected = isSelectionModelSelectedAsNullable != nullptr && isSelectionModelSelectedAsNullable.Value();
00800
00801             if (itemContainer.IsSelected())
00802             {
00803                 // The ItemsSource may be a list of ItemContainers, some of them having IsSelected==True. Account for this situation
00804                 // by updating the selection model accordingly. Only selected containers are pushed into the selection model to avoid
00805                 // clearing any potential selections already present in that model, which are pushed into the ItemContainers next.
00806                 if (!isSelectionModelSelected && SelectionMode() != winrt::ItemsViewSelectionMode::None)
00807                 {
00808                     // When SelectionMode is None, ItemContainer.IsSelected will be reset below.
00809                     // For all other selection modes, simply select the item.
00810                     // No need to go through the SingleSelector, MultipleSelector or ExtendedSelector policy.
00811                     m_selectionModel.Select(index);
00812
00813                     // Access the new selection status for the same ItemContainer so it can be updated accordingly below.
00814                     isSelectionModelSelectedAsNullable = m_selectionModel.IsSelected(index);
00815                     isSelectionModelSelected = isSelectionModelSelectedAsNullable != nullptr && isSelectionModelSelectedAsNullable.Value();
00816                 }
00817             }
00818
00819             itemContainer.IsSelected(isSelectionModelSelected);
00820
00821             SetItemsViewItemContainerRevokers(itemContainer);
00822         }
00823         else
00824         {
00825             throw winrt::hresult_error(E_INVALIDARG, s_invalidItemTemplateRoot);
00826         }
00827
00828         if (const auto itemsSourceView = itemsRepeater.ItemsSourceView())
00829         {
00830             element.SetValue(winrt::AutomationProperties::PositionInSetProperty(), box_value(index + 1));
00831             element.SetValue(winrt::AutomationProperties::SizeOfSetProperty(), box_value(itemsSourceView.Count()));
00832         }
00833     }
00834 }
00835
00836 void ItemsView::OnItemsRepeaterElementClearing(
00837     const winrt::ItemsRepeater& itemsRepeater,
00838     const winrt::ItemsRepeaterElementClearingEventArgs& args)
00839 {
00840     if (const auto element = args.Element())
00841     {
00842 #ifdef DBG_VERBOSE
00843         ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, GetElementIndex(element));
00844 #endif
00845
00846         const auto itemContainer = element.try_as<winrt::ItemContainer>();
00847
00848         if (itemContainer != nullptr)
00849         {
00850             // Clear all the revokers first before touching ItemContainer properties to avoid side effects.
00851             // For example, if you clear IsSelected before clearing revokers, we will listen to that change and
00852             // update SelectionModel which is incorrect.
00853             ClearItemsViewItemContainerRevokers(itemContainer);
00854
00855 #ifdef MUX_PRERELEASE
00856             if (static_cast<int>(itemContainer.CanUserInvoke() & winrt::ItemContainerUserInvokeMode::Auto))
00857             {
00858                 itemContainer.CanUserInvoke(winrt::ItemContainerUserInvokeMode::Auto);
00859             }
00860
00861             if (static_cast<int>(itemContainer.MultiSelectMode() & winrt::ItemContainerMultiSelectMode::Auto))
00862             {
00863                 itemContainer.MultiSelectMode(winrt::ItemContainerMultiSelectMode::Auto);
00864             }
00865
00866             if (static_cast<int>(itemContainer.CanUserSelect() & winrt::ItemContainerUserSelectMode::Auto))
00867             {
00868                 itemContainer.CanUserSelect(winrt::ItemContainerUserSelectMode::Auto);
00869             }
00870 #else
00871             if (const auto& itemContainerImpl = winrt::get_self<ItemContainer>(itemContainer))
00872             {
00873                 if (static_cast<int>(itemContainerImpl->CanUserInvokeInternal() & winrt::ItemContainerUserInvokeMode::Auto))
00874                 {
00875                     itemContainerImpl->CanUserInvokeInternal(winrt::ItemContainerUserInvokeMode::Auto);
00876                 }
00877
00878                 if (static_cast<int>(itemContainerImpl->MultiSelectModeInternal() & winrt::ItemContainerMultiSelectMode::Auto))
00879                 {
00880                     itemContainerImpl->MultiSelectModeInternal(winrt::ItemContainerMultiSelectMode::Auto);
00881                 }
00882
00883                 if (static_cast<int>(itemContainerImpl->CanUserSelectInternal() & winrt::ItemContainerUserSelectMode::Auto))
00884                 {
00885                     itemContainerImpl->CanUserSelectInternal(winrt::ItemContainerUserSelectMode::Auto);
00886                 }
00887             }
00888 #endif
00889
00890             itemContainer.IsSelected(false);
00891         }
00892
00893         element.ClearValue(winrt::AutomationProperties::PositionInSetProperty());
00894         element.ClearValue(winrt::AutomationProperties::SizeOfSetProperty());
00895     }
00896 }
00897
00898 void ItemsView::OnItemsRepeaterElementIndexChanged(
00899     const winrt::ItemsRepeater& itemsRepeater,
00900     const winrt::ItemsRepeaterElementIndexChangedEventArgs& args)
00901 {
00902     if (const auto element = args.Element())
00903     {
00904         const auto newIndex = args.NewIndex();
00905
00906         ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, newIndex);
00907
00908         element.SetValue(winrt::AutomationProperties::PositionInSetProperty(), box_value(newIndex + 1));
00909     }
00910 }
00911
00912 void ItemsView::OnItemsRepeaterItemsSourceChanged(
00913     const winrt::DependencyObject& sender,
00914     const winrt::DependencyProperty& args)
00915 {
00916     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00917
00918     HookItemsSourceViewEvents();
00919
00920     auto const& itemsSource = ItemsSource();
00921
00922     // Updating the selection model's ItemsSource here rather than earlier in ItemsView::OnPropertyChanged/ItemsView::OnItemsSourceChanged so that
00923     // Layout::OnItemsChangedCore is executed before ItemsView::OnSelectionModelSelectionChanged. Otherwise OnSelectionModelSelectionChanged
00924     // would operate on out-of-date ItemsRepeater children.
00925     m_selectionModel.Source(itemsSource);
00926
00927     m_currentElementSelectionModel.Source(itemsSource);
00928 }
00929
00930 void ItemsView::OnItemsRepeaterLayoutUpdated(
00931     const winrt::IInspectable& sender,
00932     const winrt::IInspectable& args)
00933 {
00934 #ifdef DBG_VERBOSE
00935     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00936 #endif
00937
00938     if (m_keyboardNavigationReferenceResetPending)
00939     {
00940         m_keyboardNavigationReferenceResetPending = false;
00941         UpdateKeyboardNavigationReference();
00942     }
00943 }
00944
00945 void ItemsView::OnItemsRepeaterSizeChanged(
00946     const winrt::IInspectable& sender,
00947     const winrt::SizeChangedEventArgs& args)
00948 {
00949     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, TypeLogging::SizeToString(args.PreviousSize()).c_str(), TypeLogging::SizeToString(args.NewSize()).c_str());
00950
00951     UpdateKeyboardNavigationReference();
00952 }
00953
00954 void ItemsView::OnScrollViewAnchorRequested(
00955     const winrt::ScrollView& scrollView,
00956     const winrt::ScrollingAnchorRequestedEventArgs& args)
00957 {
00958     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"ScrollingAnchorRequestedEventArgs.AnchorCandidates.Size", args.AnchorCandidates().Size());
00959
00960     if (m_bringIntoViewElement != nullptr)
00961     {
00962         // During a StartBringItemIntoView operation, its target element is used as the scroll anchor so that any potential shuffling of the Layout does not disturb the final visual.
00963         // This anchor is used until the new layout has a chance to settle.
00964         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_bringIntoViewElement.get(), L"ScrollingAnchorRequestedEventArgs.AnchorElement set to m_bringIntoViewElement.");
00965         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"at index", GetElementIndex(m_bringIntoViewElement.get()));
00966
00967         args.AnchorElement(m_bringIntoViewElement.get());
00968     }
00969 #ifdef DBG
00970     else
00971     {
00972         ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"ScrollingAnchorRequestedEventArgs.AnchorElement unset. m_bringIntoViewElement null.");
00973     }
00974 #endif
00975 }
00976
00977 void ItemsView::OnScrollViewBringingIntoView(
00978     const winrt::ScrollView& scrollView,
00979     const winrt::ScrollingBringingIntoViewEventArgs& args)
00980 {
00981 #ifdef DBG
00982     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this,
00983         L"ScrollingBringingIntoViewEventArgs.CorrelationId", args.CorrelationId());
00984     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this,
00985         L"ScrollingBringingIntoViewEventArgs.TargetHorizontalOffset", args.TargetHorizontalOffset());
00986     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this,
00987         L"ScrollingBringingIntoViewEventArgs.TargetVerticalOffset", args.TargetVerticalOffset());
00988
00989     if (auto const& requestEventArgs = args.RequestEventArgs())
00990     {
00991         ITEMSVIEW_TRACE_INFO(*this, L"%s[0x%p](ScrollingBringingIntoViewEventArgs.RequestEventArgs: AnimationDesired:%d, H/V AlignmentRatio:%lf,%lf, H/V Offset:%f,%f, TargetRect:%s, TargetElement:0x%p)\n",
00992             METH_NAME, this,
00993             requestEventArgs.AnimationDesired(),
00994             requestEventArgs.HorizontalAlignmentRatio(), requestEventArgs.VerticalAlignmentRatio(),
00995             requestEventArgs.HorizontalOffset(), requestEventArgs.VerticalOffset(),
00996             TypeLogging::RectToString(requestEventArgs.TargetRect()).c_str(),
00997             requestEventArgs.TargetElement());
00998
00999         if (requestEventArgs.AnimationDesired())
01000         {
01001             ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR, METH_NAME, this,
01002                 L"ScrollingBringingIntoViewEventArgs.RequestEventArgs.AnimationDesired unexpectedly True");
01003         }
01004     }
01005
01006     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this,
01007         m_bringIntoViewElement.get(), L"m_bringIntoViewElement");
01008 #endif
01009
01010     if (m_bringIntoViewCorrelationId == -1 &&
01011         m_bringIntoViewElement != nullptr &&
01012         args.RequestEventArgs() != nullptr &&
01013         m_bringIntoViewElement.get() == args.RequestEventArgs().TargetElement())
01014     {
01015         // Record the CorrelationId for the bring-into-view operation so ItemsView::OnScrollViewScrollCompleted can trigger the countdown to a stable layout.
01016         m_bringIntoViewCorrelationId = args.CorrelationId();
01017
01018         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"for m_bringIntoViewElement index", GetElementIndex(m_bringIntoViewElement.get()));
01019         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_bringIntoViewCorrelationId set", m_bringIntoViewCorrelationId);
01020     }
01021
01022     if (m_navigationKeyBringIntoViewPendingCount > 0)
01023     {
01024         m_navigationKeyBringIntoViewPendingCount--;
01025         // Record the CorrelationId for the navigation-key-triggered bring-into-view operation so ItemsView::OnScrollViewScrollCompleted can trigger the countdown
01026         // to a stable layout for large offset changes or immediately process queued navigation keys.
01027         m_navigationKeyBringIntoViewCorrelationId = args.CorrelationId();
01028
01029         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_navigationKeyBringIntoViewPendingCount decremented", m_navigationKeyBringIntoViewPendingCount);
01030         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_navigationKeyBringIntoViewCorrelationId set", m_navigationKeyBringIntoViewCorrelationId);
01031     }
01032 }
01033
01034 #ifdef DBG
01035 void ItemsView::OnScrollViewExtentChangedDbg(
01036     const winrt::ScrollView& scrollView,
01037     const winrt::IInspectable& args)
01038 {
01039     if (auto const& scrollView = m_scrollView.get())
01040     {
01041         ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"ScrollView.ExtentWidth", scrollView.ExtentWidth());
01042         ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"ScrollView.ExtentHeight", scrollView.ExtentHeight());
01043     }
01044 }
01045 #endif
01046
01047 void ItemsView::OnScrollViewScrollCompleted(
01048     const winrt::ScrollView& scrollView,
01049     const winrt::ScrollingScrollCompletedEventArgs& args)
01050 {
01051     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"ScrollingScrollCompletedEventArgs.CorrelationId", args.CorrelationId());
01052
01053     if (args.CorrelationId() == m_bringIntoViewCorrelationId)
01054     {
01055         MUX_ASSERT(m_bringIntoViewElement != nullptr);
01056
01057         m_bringIntoViewCorrelationId = -1;
01058
01059         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"m_bringIntoViewCorrelationId reset & m_bringIntoViewElementRetentionCountdown initialized to 4.");
01060
01061         m_bringIntoViewElementRetentionCountdown = c_renderingEventsPostBringIntoView;
01062
01063         // ItemsView::OnCompositionTargetRendering will decrement m_bringIntoViewElementRetentionCountdown until it reaches 0,
01064         // at which point m_bringIntoViewElement is reset to null and the ScrollView anchor alignments are restored.
01065         HookCompositionTargetRendering();
01066     }
01067
01068     if (args.CorrelationId() == m_navigationKeyBringIntoViewCorrelationId)
01069     {
01070         if (m_lastNavigationKeyProcessed == winrt::VirtualKey::Left ||
01071             m_lastNavigationKeyProcessed == winrt::VirtualKey::Right ||
01072             m_lastNavigationKeyProcessed == winrt::VirtualKey::Up ||
01073             m_lastNavigationKeyProcessed == winrt::VirtualKey::Down)
01074         {
01075             ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"m_navigationKeyBringIntoViewCorrelationId reset.");
01076
01077             m_navigationKeyBringIntoViewCorrelationId = -1;
01078
01079             if (m_navigationKeyBringIntoViewPendingCount == 0)
01080             {
01081                 // After a small offset change, for better perf, immediately process the remaining queued navigation keys as no item re-layout is likely.
01082                 ProcessNavigationKeys();
01083             }
01084         }
01085         else
01086         {
01087             ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"m_navigationKeyProcessingCountdown initialized to 4.");
01088
01089             // After a large offset change for PageDown/PageUp/Home/End, wait a few ticks for the UI to settle before processing the remaining queued
01090             // navigation keys, so the content is properly layed out.
01091             m_navigationKeyProcessingCountdown = c_renderingEventsPostBringIntoView;
01092
01093             HookCompositionTargetRendering();
01094         }
01095     }
01096 }
01097
01098 void ItemsView::OnItemsViewItemContainerIsSelectedChanged(
01099     const winrt::DependencyObject& sender,
01100     const winrt::DependencyProperty& args)
01101 {
01102     auto const& element = sender.try_as<winrt::UIElement>();
01103
01104     MUX_ASSERT(element != nullptr);
01105
01106     if (element != nullptr)
01107     {
01108         const int itemIndex = GetElementIndex(element);
01109
01110         if (itemIndex != -1)
01111         {
01112             auto const& itemContainer = element.try_as<winrt::ItemContainer>();
01113
01114             MUX_ASSERT(itemContainer != nullptr);
01115
01116             if (itemContainer != nullptr)
01117             {
01118                 const winrt::IReference<bool> isSelectionModelSelectedAsNullable = m_selectionModel.IsSelected(itemIndex);
01119                 const bool isSelectionModelSelected = isSelectionModelSelectedAsNullable != nullptr && isSelectionModelSelectedAsNullable.Value();
01120
01121                 if (itemContainer.IsSelected())
01122                 {
01123                     if (!isSelectionModelSelected)
01124                     {
01125                         if (SelectionMode() == winrt::ItemsViewSelectionMode::None)
01126                         {
01127                             // Permission denied.
01128                             itemContainer.IsSelected(false);
01129                         }
01130                         else
01131                         {
01132                             // For all other selection modes, simply select the item.
01133                             // No need to go through the SingleSelector, MultipleSelector or ExtendedSelector policy.
01134                             m_selectionModel.Select(itemIndex);
01135                         }
01136                     }
01137                 }
01138                 else
01139                 {
01140                     if (isSelectionModelSelected)
01141                     {
01142                         // For all selection modes, simply deselect the item & preserve the anchor if any.
01143                         m_selector->DeselectWithAnchorPreservation(itemIndex);
01144                     }
01145                 }
01146             }
01147         }
01148     }
01149 }
01150
01151 #ifdef DBG
01152 void ItemsView::OnLayoutMeasureInvalidatedDbg(
01153     const winrt::Layout& sender,
01154     const winrt::IInspectable& args)
01155 {
01156     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01157 }
01158
01159 void ItemsView::OnLayoutArrangeInvalidatedDbg(
01160     const winrt::Layout& sender,
01161     const winrt::IInspectable& args)
01162 {
01163     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01164 }
01165 #endif
01166
01167 void ItemsView::OnCompositionTargetRendering(
01168     const winrt::IInspectable& sender,
01169     const winrt::IInspectable& args)
01170 {
01171     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_bringIntoViewElementRetentionCountdown", m_bringIntoViewElementRetentionCountdown);
01172     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"m_navigationKeyProcessingCountdown", m_navigationKeyProcessingCountdown);
01173
01174     MUX_ASSERT(m_bringIntoViewElementRetentionCountdown > 0 || m_navigationKeyProcessingCountdown > 0);
01175
01176     if (m_bringIntoViewElementRetentionCountdown > 0)
01177     {
01178         // Waiting for the new layout to settle before discarding the bring-into-view target element and no longer using it as a scroll anchor.
01179         m_bringIntoViewElementRetentionCountdown--;
01180
01181         if (m_bringIntoViewElementRetentionCountdown == 0)
01182         {
01183             CompleteStartBringItemIntoView();
01184         }
01185     }
01186
01187     if (m_navigationKeyProcessingCountdown > 0)
01188     {
01189         // Waiting for the new layout to settle before processing remaining queued navigation keys.
01190         m_navigationKeyProcessingCountdown--;
01191
01192         if (m_navigationKeyProcessingCountdown == 0)
01193         {
01194             if (m_bringIntoViewElementRetentionCountdown == 0)
01195             {
01196                 UnhookCompositionTargetRendering();
01197             }
01198
01199             ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"m_navigationKeyBringIntoViewCorrelationId reset.");
01200
01201             m_navigationKeyBringIntoViewCorrelationId = -1;
01202
01203             if (m_navigationKeyBringIntoViewPendingCount == 0)
01204             {
01205                 // With no pending ItemsView::OnScrollViewBringingIntoView calls, it is time to process the remaining queue navigation keys.
01206                 ProcessNavigationKeys();
01207             }
01208         }
01209     }
01210 }
01211
01212 void ItemsView::OnItemsSourceChanged()
01213 {
01214     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01215
01216     // When the inner ItemsRepeater has not been loaded yet, set the selection models' Source
01217     // right away as ItemsView::OnItemsRepeaterItemsSourceChanged will not be invoked.
01218     // There is no reason to delay the updates to ItemsView::OnItemsRepeaterItemsSourceChanged
01219     // in this case since ItemsRepeater and its children do not exist yet.
01220     auto const& itemsRepeater = m_itemsRepeater.get();
01221
01222     if (itemsRepeater == nullptr)
01223     {
01224         auto const& itemsSource = ItemsSource();
01225
01226         m_selectionModel.Source(itemsSource);
01227         m_currentElementSelectionModel.Source(itemsSource);
01228     }
01229 }
01230
01231 void ItemsView::OnVerticalScrollControllerChanged()
01232 {
01233     ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, VerticalScrollController(), L"VerticalScrollController");
01234
01235     ApplyVerticalScrollController();
01236 }
01237
01238 #ifdef DBG
01239 void ItemsView::OnLayoutChangedDbg()
01240 {
01241     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01242
01243     m_layoutMeasureInvalidatedDbg.revoke();
01244     m_layoutArrangeInvalidatedDbg.revoke();
01245
01246     if (auto const& layout = Layout())
01247     {
01248         m_layoutMeasureInvalidatedDbg = layout.MeasureInvalidated(winrt::auto_revoke, { this, &ItemsView::OnLayoutMeasureInvalidatedDbg });
01249         m_layoutArrangeInvalidatedDbg = layout.ArrangeInvalidated(winrt::auto_revoke, { this, &ItemsView::OnLayoutArrangeInvalidatedDbg });
01250     }
01251 }
01252 #endif
01253
01254 void ItemsView::OnIsItemInvokedEnabledChanged()
01255 {
01256     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01257
01258     // For all ItemContainer children, update the CanUserInvoke property according to the new ItemsView.IsItemInvokedEnabled property.
01259     if (auto const& itemsRepeater = m_itemsRepeater.get())
01260     {
01261         const auto count = winrt::VisualTreeHelper::GetChildrenCount(itemsRepeater);
01262         const winrt::ItemContainerUserInvokeMode canUserInvoke = IsItemInvokedEnabled() ?
01263             winrt::ItemContainerUserInvokeMode::Auto | winrt::ItemContainerUserInvokeMode::UserCanInvoke :
01264             winrt::ItemContainerUserInvokeMode::Auto | winrt::ItemContainerUserInvokeMode::UserCannotInvoke;
01265
01266         for (int32_t childIndex = 0; childIndex < count; childIndex++)
01267         {
01268             auto elementAsDO = winrt::VisualTreeHelper::GetChild(itemsRepeater, childIndex);
01269             auto itemContainer = elementAsDO.try_as<winrt::ItemContainer>();
01270
01271             if (itemContainer != nullptr)
01272             {
01273 #ifdef MUX_PRERELEASE
01274                 if (static_cast<int>(itemContainer.CanUserInvoke() & winrt::ItemContainerUserInvokeMode::Auto))
01275                 {
01276                     itemContainer.CanUserInvoke(canUserInvoke);
01277                 }
01278 #else
01279                 if (const auto& itemContainerImpl = winrt::get_self<ItemContainer>(itemContainer))
01280                 {
01281                     if (static_cast<int>(itemContainerImpl->CanUserInvokeInternal() & winrt::ItemContainerUserInvokeMode::Auto))
01282                     {
01283                         itemContainerImpl->CanUserInvokeInternal(canUserInvoke);
01284                     }
01285                 }
01286 #endif
01287             }
01288         }
01289     }
01290 }
01291
01292 void ItemsView::OnItemTemplateChanged()
01293 {
01294     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
01295
01296     // Make sure the default ItemTemplate is used when the ItemsSource is non-null and the ItemTemplate is null.
01297     EnsureItemTemplate();
01298 }
01299
01300 void ItemsView::OnSelectionModeChanged()
01301 {
01302     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01303
01304     UpdateSelector();
01305
01306     // For all ItemContainer children, update the MultiSelectMode and CanUserSelect properties according to the new ItemsView.SelectionMode property.
01307     if (auto const& itemsRepeater = m_itemsRepeater.get())
01308     {
01309         const auto count = winrt::VisualTreeHelper::GetChildrenCount(itemsRepeater);
01310         const auto selectionMode = SelectionMode();
01311         winrt::ItemContainerMultiSelectMode multiSelectMode = winrt::ItemContainerMultiSelectMode::Auto;
01312
01313         switch (selectionMode)
01314         {
01315             case winrt::ItemsViewSelectionMode::None:
01316             case winrt::ItemsViewSelectionMode::Single:
01317                 multiSelectMode |= winrt::ItemContainerMultiSelectMode::Single;
01318                 break;
01319             case winrt::ItemsViewSelectionMode::Extended:
01320                 multiSelectMode |= winrt::ItemContainerMultiSelectMode::Extended;
01321                 break;
01322             case winrt::ItemsViewSelectionMode::Multiple:
01323                 multiSelectMode |= winrt::ItemContainerMultiSelectMode::Multiple;
01324                 break;
01325         }
01326
01327         const winrt::ItemContainerUserSelectMode canUserSelect = selectionMode == winrt::ItemsViewSelectionMode::None ?
01328             winrt::ItemContainerUserSelectMode::Auto | winrt::ItemContainerUserSelectMode::UserCannotSelect :
01329             winrt::ItemContainerUserSelectMode::Auto | winrt::ItemContainerUserSelectMode::UserCanSelect;
01330
01331         for (int32_t childIndex = 0; childIndex < count; childIndex++)
01332         {
01333             auto elementAsDO = winrt::VisualTreeHelper::GetChild(itemsRepeater, childIndex);
01334             auto itemContainer = elementAsDO.try_as<winrt::ItemContainer>();
01335
01336             if (itemContainer != nullptr)
01337             {
01338 #ifdef MUX_PRERELEASE
01339                 if (static_cast<int>(itemContainer.MultiSelectMode() & winrt::ItemContainerMultiSelectMode::Auto))
01340                 {
01341                     itemContainer.MultiSelectMode(multiSelectMode);
01342                 }
01343
01344                 if (static_cast<int>(itemContainer.CanUserSelect() & winrt::ItemContainerUserSelectMode::Auto))
01345                 {
01346                     itemContainer.CanUserSelect(canUserSelect);
01347                 }
01348 #else
01349                 if (const auto& itemContainerImpl = winrt::get_self<ItemContainer>(itemContainer))
01350                 {
01351                     if (static_cast<int>(itemContainerImpl->MultiSelectModeInternal() & winrt::ItemContainerMultiSelectMode::Auto))
01352                     {
01353                         itemContainerImpl->MultiSelectModeInternal(multiSelectMode);
01354                     }
01355
01356                     if (static_cast<int>(itemContainerImpl->CanUserSelectInternal() & winrt::ItemContainerUserSelectMode::Auto))
01357                     {
01358                         itemContainerImpl->CanUserSelectInternal(canUserSelect);
01359                     }
01360                 }
01361 #endif
01362             }
01363         }
01364     }
01365 }
01366
01367 void ItemsView::OnSelectionModelSelectionChanged(
01368     const winrt::SelectionModel& selectionModel,
01369     const winrt::SelectionModelSelectionChangedEventArgs& args)
01370 {
01371     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01372
01373     // Unfortunately using an internal hook to see whether this notification orginated from a collection change or not.
01374     const bool selectionInvalidatedDueToCollectionChange =
01375         winrt::get_self<SelectionModel>(selectionModel)->SelectionInvalidatedDueToCollectionChange();
01376
01377     /*
01378     Another option, besides a public API on SelectionModel, would have been to apply the changes
01379     asynchronously like below. But that seems fragile compared to delaying the application until
01380     the synchronous call to ItemsView::OnSourceListChanged that is about to occur.
01381     DispatcherQueue().TryEnqueue(
01382         winrt::DispatcherQueuePriority::Low,
01383         winrt::DispatcherQueueHandler([weakThis{ get_weak() }]()
01384         {
01385             if (auto strongThis = weakThis.get())
01386             {
01387                 strongThis->ApplySelectionModelSelectionChange();
01388             }
01389         }));
01390     */
01391
01392     if (selectionInvalidatedDueToCollectionChange)
01393     {
01394         // Delay the SelectionModel's selection changes until the upcoming ItemsView::OnSourceListChanged
01395         // call because neither m_itemsRepeater's Children nor m_itemsRepeater's ItemsSourceView have been updated yet.
01396         // ApplySelectionModelSelectionChange which uses both is thus delayed, but is still going to be called synchronously.
01397         m_applySelectionChangeOnSourceListChanged = true;
01398     }
01399     else
01400     {
01401         ApplySelectionModelSelectionChange();
01402     }
01403 }
01404
01405 void ItemsView::ApplySelectionModelSelectionChange()
01406 {
01407     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01408
01409     // Update ItemsView properties
01410     SelectedItem(m_selectionModel.SelectedItem());
01411
01412     // For all ItemContainer children, update the IsSelected property according to the new ItemsView.SelectionModel property.
01413     if (auto const& itemsRepeater = m_itemsRepeater.get())
01414     {
01415         const auto count = winrt::VisualTreeHelper::GetChildrenCount(itemsRepeater);
01416
01417 #ifdef DBG
01418         if (const auto itemsSourceView = itemsRepeater.ItemsSourceView())
01419         {
01420             const auto itemsSourceViewCount = itemsSourceView.Count();
01421         }
01422 #endif
01423
01424         for (int32_t childIndex = 0; childIndex < count; childIndex++)
01425         {
01426             auto elementAsDO = winrt::VisualTreeHelper::GetChild(itemsRepeater, childIndex);
01427             auto itemContainer = elementAsDO.try_as<winrt::ItemContainer>();
01428
01429             if (itemContainer != nullptr)
01430             {
01431                 const int32_t itemIndex = itemsRepeater.GetElementIndex(itemContainer);
01432
01433                 if (itemIndex >= 0)
01434                 {
01435                     const winrt::IReference<bool> isItemContainerSelected = m_selectionModel.IsSelected(itemIndex);
01436                     const bool isSelected = isItemContainerSelected != nullptr && isItemContainerSelected.Value();
01437
01438                     if (isSelected)
01439                     {
01440 #ifdef MUX_PRERELEASE
01441                         const winrt::ItemContainerUserSelectMode canUserSelect = itemContainer.CanUserSelect();
01442 #else
01443                         const winrt::ItemContainerUserSelectMode canUserSelect = winrt::get_self<ItemContainer>(itemContainer)->CanUserSelectInternal();
01444 #endif
01445
01446                         if (!m_isProcessingInteraction || !static_cast<int>(canUserSelect & winrt::ItemContainerUserSelectMode::UserCannotSelect))
01447                         {
01448                             itemContainer.IsSelected(true);
01449                         }
01450                         else
01451                         {
01452                             // Processing a user interaction while ItemContainer.CanUserSelect is ItemContainerUserSelectMode.UserCannotSelect. Deselect that item
01453                             // in the selection model without touching the potential anchor.
01454                             m_selector->DeselectWithAnchorPreservation(itemIndex);
01455                         }
01456                     }
01457                     else
01458                     {
01459                         itemContainer.IsSelected(false);
01460                     }
01461                 }
01462             }
01463         }
01464     }
01465
01466     RaiseSelectionChanged();
01467 }
01468
01469 // Raised when the current element index changed.
01470 void ItemsView::OnCurrentElementSelectionModelSelectionChanged(
01471     const winrt::SelectionModel& selectionModel,
01472     const winrt::SelectionModelSelectionChangedEventArgs& args)
01473 {
01474     const int currentElementIndex = GetCurrentElementIndex();
01475
01476     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT, METH_NAME, this, currentElementIndex);
01477
01478     CurrentItemIndex(currentElementIndex);
01479 }
01480
01481 // Raised when the ItemsSource collection changed.
01482 void ItemsView::OnSourceListChanged(
01483     const winrt::IInspectable& dataSource,
01484     const winrt::NotifyCollectionChangedEventArgs& args)
01485 {
01486     if (m_applySelectionChangeOnSourceListChanged)
01487     {
01488         m_applySelectionChangeOnSourceListChanged = false;
01489
01490         // Finally apply the SelectionModel's changes notified in ItemsView::OnSelectionModelSelectionChanged
01491         // now that both m_itemsRepeater's Children & m_itemsRepeater's ItemsSourceView are up-to-date.
01492         ApplySelectionModelSelectionChange();
01493     }
01494
01495     // When the item count goes from 0 to strictly positive, the ItemTemplate property may
01496     // have to be set to a default template which includes an ItemContainer.
01497     EnsureItemTemplate();
01498
01499     m_keyboardNavigationReferenceResetPending = true;
01500
01501     if (const auto itemsRepeater = m_itemsRepeater.get())
01502     {
01503         if (const auto itemsSourceView = itemsRepeater.ItemsSourceView())
01504         {
01505             const auto count = itemsSourceView.Count();
01506             const int childrenCount = winrt::VisualTreeHelper::GetChildrenCount(itemsRepeater);
01507
01508             for (int childIndex = 0; childIndex < childrenCount; childIndex++)
01509             {
01510                 auto const& elementAsDO = winrt::VisualTreeHelper::GetChild(itemsRepeater, childIndex);
01511                 auto const& element = elementAsDO.try_as<winrt::UIElement>();
01512
01513                 // Checking if the element represents a valid item since there are cases where an element is parented to the ItemsRepeater
01514                 // but not in the realized range, like for example during a delete animation.
01515                 if (element != nullptr && itemsRepeater.GetElementIndex(element) != -1)
01516                 {
01517                     element.SetValue(winrt::AutomationProperties::SizeOfSetProperty(), box_value(count));
01518                 }
01519             }
01520         }
01521     }
01522 }
01523
01524 void ItemsView::OnLoaded(
01525     const winrt::IInspectable& /*sender*/,
01526     const winrt::RoutedEventArgs& /*args*/)
01527 {
01528     if (m_setVerticalScrollControllerOnLoaded)
01529     {
01530         // First occurrence of the Loaded event after template
01531         // application. Now that the inner ScrollView and ScrollPresenter
01532         // are loaded, cache their original vertical scroll
01533         // controller visibility and value for potential restoration.
01534         m_setVerticalScrollControllerOnLoaded = false;
01535
01536         CacheOriginalVerticalScrollControllerAndVisibility();
01537
01538         // Either push the VerticalScrollController value already set
01539         // to the inner control or set VerticalScrollController to the
01540         // inner control's value.
01541         SetVerticalScrollControllerOnLoaded();
01542     }
01543 }
01544
01545 void ItemsView::OnUnloaded(
01546     const winrt::IInspectable& /*sender*/,
01547     const winrt::RoutedEventArgs& /*args*/)
01548 {
01549     ITEMSVIEW_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01550
01551     if (!IsLoaded())
01552     {
01553         UnhookCompositionTargetRendering();
01554
01555         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"Keyboard navigation fields reset.");
01556
01557         m_navigationKeyBringIntoViewPendingCount = 0;
01558         m_navigationKeyBringIntoViewCorrelationId = -1;
01559         m_navigationKeyProcessingCountdown = 0;
01560         m_navigationKeysToProcess.clear();
01561
01562         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"Bring-into-view fields reset.");
01563
01564         m_bringIntoViewElement.set(nullptr);
01565         m_bringIntoViewCorrelationId = -1;
01566         m_bringIntoViewElementRetentionCountdown = 0;
01567     }
01568 }
01569
01570 // When isForTopLeftItem is True, returns the top/left focusable item in the viewport. Returns the bottom/right item instead.
01571 // Fully displayed items are favored over partially displayed ones.
01572 int ItemsView::GetCornerFocusableItem(
01573     bool isForTopLeftItem)
01574 {
01575     // When FlowDirection is FlowDirection::RightToLeft, the top/right item is returned instead of top/left (and bottom/left instead of bottom/right).
01576     // GetItemInternal's input is unchanged as it handles FlowDirection itself.
01577
01578     const winrt::IndexBasedLayoutOrientation indexBasedLayoutOrientation = GetLayoutIndexBasedLayoutOrientation();
01579     const int itemIndex = GetItemInternal(
01580         isForTopLeftItem ? 0.0 : 1.0 /*horizontalViewportRatio*/,
01581         isForTopLeftItem ? 0.0 : 1.0 /*verticalViewportRatio*/,
01582         indexBasedLayoutOrientation == winrt::IndexBasedLayoutOrientation::TopToBottom /*isHorizontalDistanceFavored*/,
01583         indexBasedLayoutOrientation == winrt::IndexBasedLayoutOrientation::LeftToRight /*isVerticalDistanceFavored*/,
01584         false /*useKeyboardNavigationReferenceHorizontalOffset*/,
01585         false /*useKeyboardNavigationReferenceVerticalOffset*/,
01586         true /*capItemEdgesToViewportRatioEdges*/,
01587         true /*forFocusableItemsOnly*/);
01588
01589     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, itemIndex);
01590
01591     return itemIndex;
01592 }
01593
01594 // Returns the ItemsRepeater child index for the provided UIElement.
01595 // All ItemContainer instances in the element parent chain are candidates
01596 // until a match is found. Returns -1 when no match was made.
01597 int ItemsView::GetElementIndex(
01598     const winrt::UIElement& element) const
01599 {
01600     MUX_ASSERT(element != nullptr);
01601
01602     if (auto const& itemsRepeater = m_itemsRepeater.get())
01603     {
01604         int index = -1;
01605         winrt::ItemContainer itemContainer = element.try_as<winrt::ItemContainer>();
01606
01607         if (itemContainer == nullptr)
01608         {
01609             itemContainer = SharedHelpers::GetAncestorOfType<winrt::ItemContainer>(element);
01610         }
01611
01612         if (itemContainer != nullptr)
01613         {
01614             do
01615             {
01616                 index = itemsRepeater.GetElementIndex(itemContainer);
01617
01618                 if (index == -1)
01619                 {
01620                     itemContainer = SharedHelpers::GetAncestorOfType<winrt::ItemContainer>(itemContainer);
01621                 }
01622             }
01623             while (index == -1 && itemContainer != nullptr);
01624         }
01625
01626         return index;
01627     }
01628
01629     return -1;
01630 }
01631
01632 winrt::IndexPath ItemsView::GetElementIndexPath(
01633     const winrt::UIElement& element,
01634     bool* isValid) const
01635 {
01636     MUX_ASSERT(element != nullptr);
01637
01638     const int index = GetElementIndex(element);
01639
01640     if (isValid)
01641     {
01642         *isValid = index >= 0;
01643     }
01644
01645     return winrt::IndexPath::CreateFrom(index);
01646 }
01647
01648 winrt::IInspectable ItemsView::GetElementItem(
01649     const winrt::UIElement& element,
01650     bool* valueReturned) const
01651 {
01652     if (valueReturned)
01653     {
01654         *valueReturned = false;
01655     }
01656
01657     if (auto const& itemsRepeater = m_itemsRepeater.get())
01658     {
01659         if (auto const& itemsSourceView = itemsRepeater.ItemsSourceView())
01660         {
01661             const int itemIndex = GetElementIndex(element);
01662
01663             if (itemIndex >= 0 && itemsSourceView.Count() > itemIndex)
01664             {
01665                 if (valueReturned)
01666                 {
01667                     *valueReturned = true;
01668                 }
01669                 return itemsSourceView.GetAt(itemIndex);
01670             }
01671         }
01672     }
01673
01674     return nullptr;
01675 }
01676
01677 // isHorizontalDistanceFavored==True:
01678 //  - Means distance on the horizontal axis supercedes the one on the vertical axis. i.e. the vertical distance is only considered when the horizontal distance is identical.
01679 // isVerticalDistanceFavored==True:
01680 //  - Means distance on the vertical axis supercedes the one on the horizontal axis. i.e. the horizontal distance is only considered when the vertical distance is identical.
01681 // useKeyboardNavigationReferenceHorizontalOffset:
01682 //  - Instead of using horizontalViewportRatio, m_keyboardNavigationReferenceIndex/m_keyboardNavigationReferenceRect define a target vertical line. The distance from the middle
01683 //    of the items to that line is considered.
01684 // useKeyboardNavigationReferenceVerticalOffset:
01685 //  - Instead of using verticalViewportRatio, m_keyboardNavigationReferenceIndex/m_keyboardNavigationReferenceRect define a target horizontal line. The distance from the middle
01686 //    of the items to that line is considered.
01687 // capItemEdgesToViewportRatioEdges==False:
01688 //  - Means
01689 //    - horizontalViewportRatio <= 0.5: find item with left edge closest to viewport ratio edge
01690 //    - horizontalViewportRatio > 0.5: find item with right edge closest to viewport ratio edge
01691 //    - verticalViewportRatio <= 0.5: find item with top edge closest to viewport ratio edge
01692 //    - verticalViewportRatio > 0.5: find item with bottom edge closest to viewport ratio edge
01693 // capItemEdgesToViewportRatioEdges==True:
01694 //  - Means that the two item edges used for distance measurements must be closer to the center of the viewport than viewport ratio edges.
01695 //  - Used for PageUp/PageDown operations which respectively look for items with their near/far edge on the viewport center side of the viewport ratio edges.
01696 //  - Additional restrictions compared to capItemEdgesToViewportRatioEdges==False above:
01697 //    - horizontalViewportRatio <= 0.5: item left edge larger than viewport ratio edge
01698 //    - horizontalViewportRatio > 0.5: item right edge smaller than viewport ratio edge
01699 //    - verticalViewportRatio <= 0.5: item top edge larger than viewport ratio edge
01700 //    - verticalViewportRatio > 0.5: item bottom edge smaller than viewport ratio edge
01701 // Returns -1 ItemsRepeater or ScrollView part are null, or the data source is empty, or when no item fulfills the restrictions imposed by capItemEdgesToViewportRatioEdges and/or forFocusableItemsOnly.
01702 int ItemsView::GetItemInternal(
01703     double horizontalViewportRatio,
01704     double verticalViewportRatio,
01705     bool isHorizontalDistanceFavored,
01706     bool isVerticalDistanceFavored,
01707     bool useKeyboardNavigationReferenceHorizontalOffset,
01708     bool useKeyboardNavigationReferenceVerticalOffset,
01709     bool capItemEdgesToViewportRatioEdges,
01710     bool forFocusableItemsOnly)
01711 {
01712     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_DBL_DBL, METH_NAME, this, horizontalViewportRatio, verticalViewportRatio);
01713     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, isHorizontalDistanceFavored, isVerticalDistanceFavored);
01714     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, capItemEdgesToViewportRatioEdges, forFocusableItemsOnly);
01715
01716     MUX_ASSERT(!isHorizontalDistanceFavored || !isVerticalDistanceFavored);
01717     MUX_ASSERT(!useKeyboardNavigationReferenceHorizontalOffset || horizontalViewportRatio == 0.0);
01718     MUX_ASSERT(!useKeyboardNavigationReferenceVerticalOffset || verticalViewportRatio == 0.0);
01719
01720     if (auto const& itemsRepeater = m_itemsRepeater.get())
01721     {
01722         if (auto const& scrollView = m_scrollView.get())
01723         {
01724             const float zoomFactor = scrollView.ZoomFactor();
01725             bool useHorizontalItemNearEdge{ false };
01726             bool useVerticalItemNearEdge{ false };
01727             double horizontalTarget{};
01728             double verticalTarget{};
01729
01730             if (!useKeyboardNavigationReferenceHorizontalOffset)
01731             {
01732                 const double horizontalScrollOffset = scrollView.HorizontalOffset();
01733                 const double viewportWidth = scrollView.ViewportWidth();
01734                 const double horizontalViewportOffset = horizontalViewportRatio * viewportWidth;
01735                 const double horizontalExtent = scrollView.ExtentWidth() * static_cast<double>(zoomFactor);
01736
01737                 horizontalTarget = horizontalScrollOffset + horizontalViewportOffset;
01738                 horizontalTarget = std::max(0.0, horizontalTarget);
01739                 horizontalTarget = std::min(horizontalExtent, horizontalTarget);
01740
01741                 useHorizontalItemNearEdge = horizontalViewportRatio <= 0.5;
01742             }
01743
01744             if (!useKeyboardNavigationReferenceVerticalOffset)
01745             {
01746                 const double verticalScrollOffset = scrollView.VerticalOffset();
01747                 const double viewportHeight = scrollView.ViewportHeight();
01748                 const double verticalViewportOffset = verticalViewportRatio * viewportHeight;
01749                 const double verticalExtent = scrollView.ExtentHeight() * static_cast<double>(zoomFactor);
01750
01751                 verticalTarget = verticalScrollOffset + verticalViewportOffset;
01752                 verticalTarget = std::max(0.0, verticalTarget);
01753                 verticalTarget = std::min(verticalExtent, verticalTarget);
01754
01755                 useVerticalItemNearEdge = verticalViewportRatio <= 0.5;
01756             }
01757
01758             float keyboardNavigationReferenceOffset{ -1.0f };
01759
01760             if (useKeyboardNavigationReferenceHorizontalOffset || useKeyboardNavigationReferenceVerticalOffset)
01761             {
01762                 const winrt::Point keyboardNavigationReferenceOffsetPoint = GetUpdatedKeyboardNavigationReferenceOffset();
01763                 keyboardNavigationReferenceOffset = useKeyboardNavigationReferenceHorizontalOffset ? keyboardNavigationReferenceOffsetPoint.X : keyboardNavigationReferenceOffsetPoint.Y;
01764
01765                 MUX_ASSERT(keyboardNavigationReferenceOffset != -1.0f);
01766             }
01767
01768             const double roundingScaleFactor = GetRoundingScaleFactor(scrollView);
01769             const int childrenCount = winrt::VisualTreeHelper::GetChildrenCount(itemsRepeater);
01770             winrt::UIElement closestElement = nullptr;
01771             double smallestFavoredDistance = std::numeric_limits<double>::max();
01772             double smallestUnfavoredDistance = std::numeric_limits<double>::max();
01773
01774             for (int childIndex = 0; childIndex < childrenCount; childIndex++)
01775             {
01776                 auto const& elementAsDO = winrt::VisualTreeHelper::GetChild(itemsRepeater, childIndex);
01777                 auto const& element = elementAsDO.try_as<winrt::UIElement>();
01778
01779                 if (element != nullptr)
01780                 {
01781                     if (forFocusableItemsOnly && !SharedHelpers::IsFocusableElement(element))
01782                     {
01783                         continue;
01784                     }
01785
01786                     const winrt::Rect elementRect = GetElementRect(element, itemsRepeater);
01787                     const winrt::Rect elementZoomedRect{ elementRect.X * zoomFactor, elementRect.Y * zoomFactor, elementRect.Width * zoomFactor, elementRect.Height * zoomFactor };
01788                     double signedHorizontalDistance{};
01789                     double signedVerticalDistance{};
01790
01791                     if (useKeyboardNavigationReferenceHorizontalOffset)
01792                     {
01793                         signedHorizontalDistance = static_cast<double>(elementZoomedRect.X) + elementZoomedRect.Width / 2.0 - static_cast<double>(keyboardNavigationReferenceOffset) * zoomFactor;
01794                     }
01795                     else
01796                     {
01797                         signedHorizontalDistance = useHorizontalItemNearEdge ? elementZoomedRect.X - horizontalTarget : horizontalTarget - elementZoomedRect.X - elementZoomedRect.Width;
01798
01799                         if (capItemEdgesToViewportRatioEdges && signedHorizontalDistance < -1.0 / roundingScaleFactor)
01800                         {
01801                             continue;
01802                         }
01803                     }
01804
01805                     if (useKeyboardNavigationReferenceVerticalOffset)
01806                     {
01807                         signedVerticalDistance = static_cast<double>(elementZoomedRect.Y) + elementZoomedRect.Height / 2.0 - static_cast<double>(keyboardNavigationReferenceOffset) * zoomFactor;
01808                     }
01809                     else
01810                     {
01811                         signedVerticalDistance = useVerticalItemNearEdge ? elementZoomedRect.Y - verticalTarget : verticalTarget - elementZoomedRect.Y - elementZoomedRect.Height;
01812
01813                         if (capItemEdgesToViewportRatioEdges && signedVerticalDistance < -1.0 / roundingScaleFactor)
01814                         {
01815                             continue;
01816                         }
01817                     }
01818
01819                     double horizontalDistance = std::abs(signedHorizontalDistance);
01820                     double verticalDistance = std::abs(signedVerticalDistance);
01821
01822                     if (!isHorizontalDistanceFavored && !isVerticalDistanceFavored)
01823                     {
01824                         horizontalDistance = std::pow(horizontalDistance, 2.0);
01825                         verticalDistance = std::pow(verticalDistance, 2.0);
01826
01827                         smallestUnfavoredDistance = 0.0;
01828
01829                         if (horizontalDistance + verticalDistance < smallestFavoredDistance)
01830                         {
01831                             smallestFavoredDistance = horizontalDistance + verticalDistance;
01832                             closestElement = element;
01833                         }
01834                     }
01835                     else if (isHorizontalDistanceFavored)
01836                     {
01837                         if (horizontalDistance < smallestFavoredDistance)
01838                         {
01839                             smallestFavoredDistance = horizontalDistance;
01840                             smallestUnfavoredDistance = verticalDistance;
01841                             closestElement = element;
01842                         }
01843                         else if (horizontalDistance == smallestFavoredDistance && verticalDistance < smallestUnfavoredDistance)
01844                         {
01845                             smallestUnfavoredDistance = verticalDistance;
01846                             closestElement = element;
01847                         }
01848                     }
01849                     else
01850                     {
01851                         MUX_ASSERT(isVerticalDistanceFavored);
01852
01853                         if (verticalDistance < smallestFavoredDistance)
01854                         {
01855                             smallestFavoredDistance = verticalDistance;
01856                             smallestUnfavoredDistance = horizontalDistance;
01857                             closestElement = element;
01858                         }
01859                         else if (verticalDistance == smallestFavoredDistance && horizontalDistance < smallestUnfavoredDistance)
01860                         {
01861                             smallestUnfavoredDistance = horizontalDistance;
01862                             closestElement = element;
01863                         }
01864                     }
01865
01866                     if (smallestFavoredDistance == 0.0 && smallestUnfavoredDistance == 0.0)
01867                     {
01868                         break;
01869                     }
01870                 }
01871             }
01872
01873             return closestElement == nullptr ? -1 : itemsRepeater.GetElementIndex(closestElement);
01874         }
01875     }
01876
01877     return -1;
01878 }
01879
01880 double ItemsView::GetRoundingScaleFactor(
01881     const winrt::UIElement& xamlRootReference) const
01882 {
01883     if (auto const& xamlRoot = xamlRootReference.XamlRoot())
01884     {
01885         return static_cast<float>(xamlRoot.RasterizationScale());
01886     }
01887     return 1.0; // Assuming a 1.0 scale factor when no XamlRoot is available at the moment.
01888 }
01889
01890 bool ItemsView::SetCurrentElementIndex(
01891     int index,
01892     winrt::FocusState focusState,
01893     bool forceKeyboardNavigationReferenceReset,
01894     bool startBringIntoView,
01895     bool expectBringIntoView)
01896 {
01897     const int currentElementIndex = GetCurrentElementIndex();
01898
01899     if (index != currentElementIndex)
01900     {
01901         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"current element index", currentElementIndex);
01902         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"index", index);
01903
01904         if (index == -1)
01905         {
01906             m_currentElementSelectionModel.ClearSelection();
01907         }
01908         else
01909         {
01910             m_currentElementSelectionModel.Select(index);
01911         }
01912
01913         if (index == -1 || m_keyboardNavigationReferenceRect.X == -1.0 || forceKeyboardNavigationReferenceReset)
01914         {
01915             UpdateKeyboardNavigationReference();
01916         }
01917     }
01918
01919     return SetFocusElementIndex(index, focusState, startBringIntoView, expectBringIntoView);
01920 }
01921
01922 // Returns True when a bring-into-view operation was initiated, and False otherwise.
01923 bool ItemsView::StartBringItemIntoViewInternal(
01924     bool throwOutOfBounds,
01925     bool throwOnAnyFailure,
01926     int32_t index,
01927     const winrt::BringIntoViewOptions& options)
01928 {
01929 #ifdef DBG
01930     ITEMSVIEW_TRACE_INFO(*this, TRACE_MSG_METH_STR_INT, METH_NAME, this, L"index", index);
01931
01932     if (options != nullptr)
01933     {
01934         ITEMSVIEW_TRACE_INFO(*this, L"%s[0x%p](AnimationDesired:%d, H/V AlignmentRatio:%lf,%lf, H/V Offset:%f,%f, TargetRect:%s)\n",
01935             METH_NAME, this,
01936             options.AnimationDesired(),
01937             options.HorizontalAlignmentRatio(), options.VerticalAlignmentRatio(),
01938             options.HorizontalOffset(), options.VerticalOffset(),
01939             options.TargetRect() == nullptr ? L"null" : TypeLogging::RectToString(options.TargetRect().Value()).c_str());
01940     }
01941 #endif
01942
01943     auto const& itemsRepeater = m_itemsRepeater.get();
01944
01945     if (itemsRepeater == nullptr)
01946     {
01947         // StartBringIntoView operation cannot be initiated without ItemsRepeater part.
01948         if (throwOnAnyFailure)
01949         {
01950             throw winrt::hresult_error(E_INVALID_OPERATION, s_missingItemsRepeaterPart);
01951         }
01952
01953         return false;
01954     }
01955
01956     bool isItemIndexValid = ValidateItemIndex(throwOutOfBounds || throwOnAnyFailure, index);
01957
01958     if (!isItemIndexValid)
01959     {
01960         MUX_ASSERT(!throwOutOfBounds && !throwOnAnyFailure);
01961
01962         return false;
01963     }
01964
01965     // Reset the fields changed by any potential bring-into-view operation still in progress.
01966     CompleteStartBringItemIntoView();
01967
01968     MUX_ASSERT(m_bringIntoViewElement == nullptr);
01969     MUX_ASSERT(m_bringIntoViewElementRetentionCountdown == 0);
01970     MUX_ASSERT(m_bringIntoViewCorrelationId == -1);
01971     MUX_ASSERT(m_scrollViewHorizontalAnchorRatio == -1);
01972     MUX_ASSERT(m_scrollViewVerticalAnchorRatio == -1);
01973
01974     // Access or create the target element so its position within the ItemsRepeater can be evaluated.
01975     winrt::UIElement element = itemsRepeater.GetOrCreateElement(index);
01976
01977     MUX_ASSERT(element != nullptr);
01978
01979     const auto scrollView = m_scrollView.get();
01980
01981     // During the initial position evaluation, scroll anchoring is turned off to avoid shifting offsets
01982     // which may result in an incorrect final scroll offset.
01983     if (scrollView)
01984     {
01985         // Current anchoring settings are recorded for post-operation restoration.
01986         m_scrollViewHorizontalAnchorRatio = scrollView.HorizontalAnchorRatio();
01987         m_scrollViewVerticalAnchorRatio = scrollView.VerticalAnchorRatio();
01988
01989         scrollView.HorizontalAnchorRatio(DoubleUtil::NaN);
01990         scrollView.VerticalAnchorRatio(DoubleUtil::NaN);
01991     }
01992
01993     ITEMSVIEW_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_METH, METH_NAME, this, L"UIElement::UpdateLayout");
01994
01995     // Ensure the item is given a valid position within the ItemsRepeater. It will determine the target scroll offset.
01996     element.UpdateLayout();
01997
01998     // Make sure that the target index is still valid after the UpdateLayout call.
01999     isItemIndexValid = ValidateItemIndex(false /*throwIfInvalid*/, index);
02000
02001     if (!isItemIndexValid)
02002     {
02003         // Restore scrollView.HorizontalAnchorRatio/VerticalAnchorRatio properties with m_scrollViewHorizontalAnchorRatio/m_scrollViewVerticalAnchorRatio cached values.
02004         CompleteStartBringItemIntoView();
02005
02006         // StartBringIntoView operation cannot be initiated without ItemsRepeater part or in-bounds item index.
02007         if (throwOnAnyFailure)
02008         {
02009             throw winrt::hresult_error(E_INVALID_OPERATION, s_indexOutOfBounds);
02010         }
02011         return false;
02012     }
02013
02014     if (scrollView)
02015     {
02016         // Turn on scroll anchoring during and after the scroll operation so target repositionings have no effect on the final visual.
02017         // The value 0.5 is used rather than 0.0 or 1.0 to avoid near and far edge anchoring which only take effect when the content
02018         // hits the viewport boundary. With any value between 0 and 1, anchoring is also effective in those extreme cases.
02019         constexpr double anchorRatio = 0.5;
02020
02021         scrollView.HorizontalAnchorRatio(anchorRatio);
02022         scrollView.VerticalAnchorRatio(anchorRatio);
02023     }
02024
02025     // Access the element's index to account for the rare event where it was recycled during the layout.
02026     if (index != GetElementIndex(element))
02027     {
02028         // Access the target element which was created during the layout pass. Its position is already set.
02029         element = itemsRepeater.GetOrCreateElement(index);
02030
02031         if (GetElementIndex(element) == -1)
02032         {
02033             // This situation arises when the ItemsView is not parented.
02034             // Restore the ScrollView's HorizontalAnchorRatio/VerticalAnchorRatio properties.
02035             CompleteStartBringItemIntoView();
02036
02037             if (throwOnAnyFailure)
02038             {
02039                 throw winrt::hresult_error(E_INVALID_OPERATION, s_itemsViewNotParented);
02040             }
02041
02042             return false;
02043         }
02044
02045         MUX_ASSERT(index == GetElementIndex(element));
02046
02047         // Make sure animation is turned off in this rare case.
02048         if (options != nullptr)
02049         {
02050             options.AnimationDesired(false);
02051         }
02052     }
02053
02054     m_bringIntoViewElement.set(element);
02055
02056     // Trigger the actual bring-into-view scroll - it'll cause ItemsView::OnScrollViewBringingIntoView and ItemsView::OnScrollViewScrollCompleted calls.
02057     if (options == nullptr)
02058     {
02059         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_bringIntoViewElement.get(), L"m_bringIntoViewElement set. Invoking UIElement.StartBringIntoView without options.");
02060
02061         element.StartBringIntoView();
02062     }
02063     else
02064     {
02065         ITEMSVIEW_TRACE_INFO_DBG(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, m_bringIntoViewElement.get(), L"m_bringIntoViewElement set. Invoking UIElement.StartBringIntoView with options.");
02066
02067         element.StartBringIntoView(options);
02068     }
02069
02070     return true;
02071 }
02072
02073 winrt::UIElement ItemsView::TryGetElement(int index) const
02074 {
02075     if (auto const& itemsRepeater = m_itemsRepeater.get())
02076     {
02077         return itemsRepeater.TryGetElement(index);
02078     }
02079
02080     return nullptr;
02081 }
02082
02083 void ItemsView::SetItemsViewItemContainerRevokers(
02084     const winrt::ItemContainer& itemContainer)
02085 {
02086     auto itemContainerRevokers = winrt::make_self<ItemContainerRevokers>();
02087
02088     itemContainerRevokers->m_keyDownRevoker = itemContainer.KeyDown(
02089         winrt::auto_revoke,
02090         { this, &ItemsView::OnItemsViewElementKeyDown });
02091
02092     itemContainerRevokers->m_gettingFocusRevoker = itemContainer.GettingFocus(
02093         winrt::auto_revoke,
02094         { this, &ItemsView::OnItemsViewElementGettingFocus });
02095
02096 #ifdef DBG
02097     itemContainerRevokers->m_losingFocusRevoker = itemContainer.LosingFocus(
02098         winrt::auto_revoke,
02099         { this, &ItemsView::OnItemsViewElementLosingFocusDbg });
02100 #endif
02101
02102     itemContainerRevokers->m_itemInvokedRevoker = itemContainer.ItemInvoked(
02103         winrt::auto_revoke,
02104         { this, &ItemsView::OnItemsViewItemContainerItemInvoked });
02105
02106     itemContainerRevokers->m_isSelectedPropertyChangedRevoker =
02107         RegisterPropertyChanged(itemContainer, winrt::ItemContainer::IsSelectedProperty(), { this, &ItemsView::OnItemsViewItemContainerIsSelectedChanged });
02108
02109 #ifdef DBG_VERBOSE
02110     itemContainerRevokers->m_sizeChangedRevokerDbg = itemContainer.SizeChanged(
02111         winrt::auto_revoke,
02112         { this, &ItemsView::OnItemsViewItemContainerSizeChangedDbg });
02113 #endif
02114
02115     itemContainer.SetValue(s_ItemsViewItemContainerRevokersProperty, itemContainerRevokers.as<winrt::IInspectable>());
02116
02117     m_itemContainersWithRevokers.insert(itemContainer);
02118 }
02119
02120 void ItemsView::ClearItemsViewItemContainerRevokers(
02121     const winrt::ItemContainer& itemContainer)
02122 {
02123     RevokeItemsViewItemContainerRevokers(itemContainer);
02124     itemContainer.SetValue(s_ItemsViewItemContainerRevokersProperty, nullptr);
02125     m_itemContainersWithRevokers.erase(itemContainer);
02126 }
02127
02128 void ItemsView::ClearAllItemsViewItemContainerRevokers() noexcept
02129 {
02130     for (const auto& itemContainer : m_itemContainersWithRevokers)
02131     {
02132         // ClearAllItemsViewItemContainerRevokers is only called in the destructor, where exceptions cannot be thrown.
02133         // If the associated ItemsView items have not yet been cleaned up, we must detach these revokers or risk a call into freed
02134         // memory being made.  However if they have been cleaned up these calls will throw. In this case we can ignore
02135         // those exceptions.
02136         try
02137         {
02138             RevokeItemsViewItemContainerRevokers(itemContainer);
02139             itemContainer.SetValue(s_ItemsViewItemContainerRevokersProperty, nullptr);
02140         }
02141         catch (...)
02142         {
02143         }
02144     }
02145     m_itemContainersWithRevokers.clear();
02146 }
02147
02148 void ItemsView::RevokeItemsViewItemContainerRevokers(
02149     const winrt::ItemContainer& itemContainer)
02150 {
02151     if (auto const revokers = itemContainer.GetValue(s_ItemsViewItemContainerRevokersProperty))
02152     {
02153         if (auto const itemContainerRevokers = revokers.try_as<ItemContainerRevokers>())
02154         {
02155             itemContainerRevokers->RevokeAll(itemContainer);
02156         }
02157     }
02158 }
02159
02160 bool ItemsView::ValidateItemIndex(
02161     bool throwIfInvalid,
02162     int index) const
02163 {
02164     if (auto const& itemsRepeater = m_itemsRepeater.get())
02165     {
02166         if (itemsRepeater.ItemsSourceView() == nullptr)
02167         {
02168             if (throwIfInvalid)
02169             {
02170                 throw winrt::hresult_error(E_INVALID_OPERATION, s_itemsSourceNull);
02171             }
02172             return false;
02173         }
02174
02175         if (index < 0 || index >= itemsRepeater.ItemsSourceView().Count())
02176         {
02177             if (throwIfInvalid)
02178             {
02179                 throw winrt::hresult_out_of_bounds(s_indexOutOfBounds);
02180             }
02181             return false;
02182         }
02183
02184         return true;
02185     }
02186
02187     return false;
02188 }
02189
02190 // Invoked by ItemsViewTestHooks
02191 winrt::Point ItemsView::GetKeyboardNavigationReferenceOffset() const
02192 {
02193     if (m_keyboardNavigationReferenceRect.X == -1.0f)
02194     {
02195         return winrt::Point{ -1.0f, -1.0f };
02196     }
02197
02198     return winrt::Point{
02199         m_keyboardNavigationReferenceRect.X + m_keyboardNavigationReferenceRect.Width / 2.0f,
02200         m_keyboardNavigationReferenceRect.Y + m_keyboardNavigationReferenceRect.Height / 2.0f };
02201 }
02202
02203 int ItemsView::GetCurrentElementIndex() const
02204 {
02205     winrt::IndexPath currentElementIndexPath = m_currentElementSelectionModel.SelectedIndex();
02206
02207     MUX_ASSERT(currentElementIndexPath == nullptr || currentElementIndexPath.GetSize() == 1);
02208
02209     const int currentElementIndex = currentElementIndexPath == nullptr ? -1 : currentElementIndexPath.GetAt(0);
02210
02211     return currentElementIndex;
02212 }
02213
02214 winrt::ScrollView ItemsView::GetScrollViewPart() const
02215 {
02216     return m_scrollView.get();
02217 }
02218
02219 winrt::ItemsRepeater ItemsView::GetItemsRepeaterPart() const
02220 {
02221     return m_itemsRepeater.get();
02222 }
02223
02224 winrt::SelectionModel ItemsView::GetSelectionModel() const
02225 {
02226     return m_selectionModel;
02227 }
02228
02229 #ifdef DBG
02230
02231 winrt::hstring ItemsView::DependencyPropertyToStringDbg(
02232     const winrt::IDependencyProperty& dependencyProperty)
02233 {
02234     if (dependencyProperty == s_ItemsSourceProperty)
02235     {
02236         return L"ItemsSource";
02237     }
02238     else if (dependencyProperty == s_ItemTemplateProperty)
02239     {
02240         return L"ItemTemplate";
02241     }
02242     else if (dependencyProperty == s_LayoutProperty)
02243     {
02244         return L"Layout";
02245     }
02246     else if (dependencyProperty == s_SelectionModeProperty)
02247     {
02248         return L"SelectionMode";
02249     }
02250     else if (dependencyProperty == s_ScrollViewProperty)
02251     {
02252         return L"ScrollView";
02253     }
02254     else
02255     {
02256         return L"UNKNOWN";
02257     }
02258 }
02259
02260 #endif
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AnimatedFindVisualSource.properties.cpp Source File

  • Generated

AnimatedFindVisualSource.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "AnimatedFindVisualSource.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(AnimatedFindVisualSource)
00012 }
00013
00014 #include "AnimatedFindVisualSource.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs.h Source File

  • ScrollPresenter

ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs.g.h"
00007
00008 class ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs :
00009     public winrt::implementation::ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgsT<ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs>
00010 {
00011 public:
00012     ScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs(bool isExpressionAnimationStarted, wstring_view const& propertyName);
00013
00014     // IScrollPresenterTestHooksExpressionAnimationStatusChangedEventArgs overrides
00015     bool IsExpressionAnimationStarted();
00016     winrt::hstring PropertyName();
00017
00018 private:
00019     bool m_isExpressionAnimationStarted{ false };
00020     winrt::hstring m_propertyName{};
00021 };
Generated on Sun Dec 1 2024 20:52:15 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

VisualStateUtil Member List

This is the complete list of members for VisualStateUtil, including all inherited members.
GetVisualStateGroup(const winrt::FrameworkElement &control, const std::wstring_view &groupName) | VisualStateUtil | [static]
GoToStateIfGroupExists(const winrt::Control &control, const std::wstring_view &groupName, const std::wstring_view &stateName, bool useTransitions) | VisualStateUtil | [static]
VisualStateGroupExists(const winrt::FrameworkElement &control, const std::wstring_view &groupName) | VisualStateUtil | [static]
Generated on Sun Dec 1 2024 20:53:22 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnnotatedScrollBarInteractionTests Member List

This is the complete list of members for AnnotatedScrollBarInteractionTests, including all inherited members.
ClassInitialize(TestContext testContext) | AnnotatedScrollBarInteractionTests | [inline, static]
CollidingLabelsAreRemoved() | AnnotatedScrollBarInteractionTests | [inline]
DetailLabelDoesNotShowWhenDataFieldIsEmpty() | AnnotatedScrollBarInteractionTests | [inline]
DetailLabelRequestedOffsetDoesNotExceedMaxPossibleValue() | AnnotatedScrollBarInteractionTests | [inline]
LabelsGrowToAccomodateLongText() | AnnotatedScrollBarInteractionTests | [inline]
ScrollUsingArrowButtons() | AnnotatedScrollBarInteractionTests | [inline]
ScrollUsingClick() | AnnotatedScrollBarInteractionTests | [inline]
ScrollUsingTouchAndDrag() | AnnotatedScrollBarInteractionTests | [inline]
TestCleanup() | AnnotatedScrollBarInteractionTests | [inline]
VerifyCanCancelScrolling() | AnnotatedScrollBarInteractionTests | [inline]
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PullToRefresh/PTRTracing/PTRTracing.h Source File

  • PullToRefresh
  • PTRTracing

PTRTracing.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "MuxcTraceLogging.h"
00006 #include "Utils.h"
00007 #include "MUXControlsTestHooks.h"
00008
00009 inline bool IsPTRTracingEnabled()
00010 {
00011     return g_IsLoggingProviderEnabled &&
00012         g_LoggingProviderLevel >= WINEVENT_LEVEL_INFO &&
00013         (g_LoggingProviderMatchAnyKeyword & KEYWORD_PTR || g_LoggingProviderMatchAnyKeyword == 0);
00014 }
00015
00016 inline bool IsPTRVerboseTracingEnabled()
00017 {
00018     return g_IsLoggingProviderEnabled &&
00019         g_LoggingProviderLevel >= WINEVENT_LEVEL_VERBOSE &&
00020         (g_LoggingProviderMatchAnyKeyword & KEYWORD_PTR || g_LoggingProviderMatchAnyKeyword == 0);
00021 }
00022
00023 inline bool IsPTRPerfTracingEnabled()
00024 {
00025     return g_IsPerfProviderEnabled &&
00026         g_PerfProviderLevel >= WINEVENT_LEVEL_INFO &&
00027         (g_PerfProviderMatchAnyKeyword & KEYWORD_PTR || g_PerfProviderMatchAnyKeyword == 0);
00028 }
00029
00030 #define PTR_TRACE_INFO_ENABLED(includeTraceLogging, sender, message, ...) \
00031 PTRTrace::TraceInfo(includeTraceLogging, sender, message, __VA_ARGS__); \
00032
00033 #define PTR_TRACE_INFO(sender, message, ...) \
00034 if (IsPTRTracingEnabled()) \
00035 { \
00036     PTR_TRACE_INFO_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00037 } \
00038 else if (PTRTrace::s_IsDebugOutputEnabled || PTRTrace::s_IsVerboseDebugOutputEnabled) \
00039 { \
00040     PTR_TRACE_INFO_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00041 } \
00042
00043 #define PTR_TRACE_VERBOSE_ENABLED(includeTraceLogging, sender, message, ...) \
00044 PTRTrace::TraceVerbose(includeTraceLogging, sender, message, __VA_ARGS__); \
00045
00046 #define PTR_TRACE_VERBOSE(sender, message, ...) \
00047 if (IsPTRVerboseTracingEnabled()) \
00048 { \
00049     PTR_TRACE_VERBOSE_ENABLED(true /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00050 } \
00051 else if (PTRTrace::s_IsVerboseDebugOutputEnabled) \
00052 { \
00053     PTR_TRACE_VERBOSE_ENABLED(false /*includeTraceLogging*/, sender, message, __VA_ARGS__); \
00054 } \
00055
00056 #define PTR_TRACE_PERF(info) \
00057 if (IsPTRPerfTracingEnabled()) \
00058 { \
00059     PTRTrace::TracePerfInfo(info); \
00060 } \
00061
00062 #ifdef DBG
00063 #define PTR_TRACE_INFO_DBG(sender, message, ...)    PTR_TRACE_INFO(sender, message, __VA_ARGS__)
00064 #define PTR_TRACE_VERBOSE_DBG(sender, message, ...) PTR_TRACE_VERBOSE(sender, message, __VA_ARGS__)
00065 #define PTR_TRACE_PERF_DBG(info)                    PTR_TRACE_PERF(info)
00066 #else
00067 #define PTR_TRACE_INFO_DBG(sender, message, ...)
00068 #define PTR_TRACE_VERBOSE_DBG(sender, message, ...)
00069 #define PTR_TRACE_PERF_DBG(info)
00070 #endif // DBG
00071
00072 class PTRTrace
00073 {
00074 public:
00075     static bool s_IsDebugOutputEnabled;
00076     static bool s_IsVerboseDebugOutputEnabled;
00077
00078     static void TraceInfo(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept
00079     {
00080         va_list args;
00081         va_start(args, message);
00082         WCHAR buffer[256]{};
00083         if (SUCCEEDED(StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args)))
00084         {
00085             if (includeTraceLogging)
00086             {
00087                 // TraceViewers
00088                 // http://toolbox/pef
00089                 // http://fastetw/index.aspx
00090                 TraceLoggingWrite(
00091                     g_hLoggingProvider,
00092                     "PTRInfo" /* eventName */,
00093                     TraceLoggingLevel(WINEVENT_LEVEL_INFO),
00094                     TraceLoggingKeyword(KEYWORD_PTR),
00095                     TraceLoggingWideString(buffer, "Message"));
00096             }
00097
00098             if (s_IsDebugOutputEnabled)
00099             {
00100                 OutputDebugStringW(buffer);
00101             }
00102
00103             com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks();
00104
00105             if (globalTestHooks &&
00106                 (globalTestHooks->GetLoggingLevelForType(L"PTR") >= WINEVENT_LEVEL_INFO || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_INFO))
00107             {
00108                 globalTestHooks->LogMessage(sender, buffer, false /*isVerboseLevel*/);
00109             }
00110         }
00111         va_end(args);
00112     }
00113
00114     static void TraceVerbose(bool includeTraceLogging, const winrt::IInspectable& sender, PCWSTR message, ...) noexcept
00115     {
00116         va_list args;
00117         va_start(args, message);
00118         WCHAR buffer[256]{};
00119         if SUCCEEDED((StringCchVPrintfW(buffer, ARRAYSIZE(buffer), message, args)))
00120         {
00121             if (includeTraceLogging)
00122             {
00123                 // TraceViewers
00124                 // http://toolbox/pef
00125                 // http://fastetw/index.aspx
00126                 TraceLoggingWrite(
00127                     g_hLoggingProvider,
00128                     "PTRVerbose" /* eventName */,
00129                     TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
00130                     TraceLoggingKeyword(KEYWORD_PTR),
00131                     TraceLoggingWideString(buffer, "Message"));
00132             }
00133
00134             if (s_IsDebugOutputEnabled || s_IsVerboseDebugOutputEnabled)
00135             {
00136                 OutputDebugStringW(buffer);
00137             }
00138
00139             com_ptr<MUXControlsTestHooks> globalTestHooks = MUXControlsTestHooks::GetGlobalTestHooks();
00140
00141             if (globalTestHooks &&
00142                 (globalTestHooks->GetLoggingLevelForType(L"PTR") >= WINEVENT_LEVEL_VERBOSE || globalTestHooks->GetLoggingLevelForInstance(sender) >= WINEVENT_LEVEL_VERBOSE))
00143             {
00144                 globalTestHooks->LogMessage(sender, buffer, true /*isVerboseLevel*/);
00145             }
00146         }
00147         va_end(args);
00148     }
00149
00150     static void TracePerfInfo(PCWSTR info) noexcept
00151     {
00152         // TraceViewers
00153         // http://toolbox/pef
00154         // http://fastetw/index.aspx
00155         TraceLoggingWrite(
00156             g_hPerfProvider,
00157             "PTRPerf" /* eventName */,
00158             TraceLoggingLevel(WINEVENT_LEVEL_INFO),
00159             TraceLoggingKeyword(KEYWORD_PTR),
00160             TraceLoggingWideString(info, "Info"));
00161     }
00162 };
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/FlowLayout.cpp Source File

  • Repeater

FlowLayout.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include <DoubleUtil.h>
00007 #include "ItemsRepeater.common.h"
00008 #include "FlowLayoutAlgorithm.h"
00009 #include "FlowLayoutState.h"
00010 #include "FlowLayout.h"
00011 #include "VirtualizingLayoutContext.h"
00012
00013 FlowLayout::FlowLayout()
00014 {
00015     LayoutId(L"FlowLayout");
00016
00017     UpdateIndexBasedLayoutOrientation(winrt::Orientation::Horizontal);
00018 }
00019
00020 #pragma region IVirtualizingLayoutOverrides
00021
00022 void FlowLayout::InitializeForContextCore(winrt::VirtualizingLayoutContext const& context)
00023 {
00024     auto state = context.LayoutState();
00025     winrt::com_ptr<FlowLayoutState> flowState = nullptr;
00026     if (state)
00027     {
00028         flowState = GetAsFlowState(state);
00029     }
00030
00031     if (!flowState)
00032     {
00033         if (state)
00034         {
00035             throw winrt::hresult_error(E_FAIL, L"LayoutState must derive from FlowLayoutState.");
00036         }
00037
00038         // Custom deriving layouts could potentially be stateful.
00039         // If that is the case, we will just create the base state required by FlowLayout ourselves.
00040         flowState = winrt::make_self<FlowLayoutState>();
00041     }
00042
00043     flowState->InitializeForContext(context, this);
00044 }
00045
00046 void FlowLayout::UninitializeForContextCore(winrt::VirtualizingLayoutContext const& context)
00047 {
00048     auto flowState = GetAsFlowState(context.LayoutState());
00049     flowState->UninitializeForContext(context);
00050 }
00051
00052 winrt::Size FlowLayout::MeasureOverride(
00053     winrt::VirtualizingLayoutContext const& context,
00054     winrt::Size const& availableSize)
00055 {
00056     auto desiredSize = GetFlowAlgorithm(context).Measure(
00057         availableSize,
00058         context,
00059         true, /* isWrapping*/
00060         MinItemSpacing(),
00061         LineSpacing(),
00062         std::numeric_limits<unsigned int>::max() /* maxItemsPerLine */,
00063         OrientationBasedMeasures::GetScrollOrientation(),
00064         true /* isVirtualizationEnabled */,
00065         LayoutId());
00066     return desiredSize;
00067 }
00068
00069 winrt::Size FlowLayout::ArrangeOverride(
00070     winrt::VirtualizingLayoutContext const& context,
00071     winrt::Size const& finalSize)
00072 {
00073     auto value = GetFlowAlgorithm(context).Arrange(
00074         finalSize,
00075         context,
00076         true, /* isWrapping */
00077         static_cast<FlowLayoutAlgorithm::LineAlignment>(m_lineAlignment),
00078         LayoutId());
00079     return value;
00080 }
00081
00082
00083 void FlowLayout::OnItemsChangedCore(
00084     winrt::VirtualizingLayoutContext const& context,
00085     winrt::IInspectable const& source,
00086     winrt::NotifyCollectionChangedEventArgs const& args)
00087 {
00088     GetFlowAlgorithm(context).OnItemsSourceChanged(source, args, context);
00089     // Always invalidate layout to keep the view accurate.
00090     InvalidateLayout();
00091 }
00092
00093 #pragma endregion
00094
00095 #pragma region IFlowLayoutOverrides
00096
00097 winrt::Size FlowLayout::GetMeasureSize(
00098     int /*index*/,
00099     winrt::Size const& availableSize)
00100 {
00101     return availableSize;
00102 }
00103
00104 winrt::Size FlowLayout::GetProvisionalArrangeSize(
00105     int /*index*/,
00106     winrt::Size const& /*measureSize*/,
00107     winrt::Size const& desiredSize)
00108 {
00109     return desiredSize;
00110 }
00111
00112 bool FlowLayout::ShouldBreakLine(
00113     int /*index*/,
00114     double remainingSpace)
00115 {
00116     return remainingSpace < 0;
00117 }
00118
00119 winrt::FlowLayoutAnchorInfo FlowLayout::GetAnchorForRealizationRect(
00120     winrt::Size const& availableSize,
00121     winrt::VirtualizingLayoutContext const& context)
00122 {
00123     int anchorIndex = -1;
00124     double offset = DoubleUtil::NaN;
00125
00126     // Constants
00127     const int itemsCount = context.ItemCount();
00128     if (itemsCount > 0)
00129     {
00130         const auto realizationRect = context.RealizationRect();
00131         const auto state = context.LayoutState();
00132         const auto flowState = GetAsFlowState(state);
00133         const auto lastExtent = flowState->FlowAlgorithm().LastExtent();
00134
00135         double averageItemsPerLine = 0;
00136         const double averageLineSize = GetAverageLineInfo(availableSize, context, flowState, averageItemsPerLine) + LineSpacing();
00137         MUX_ASSERT(averageItemsPerLine != 0);
00138
00139         const double extentMajorSize = MajorSize(lastExtent) == 0 ? (itemsCount / averageItemsPerLine) * averageLineSize : MajorSize(lastExtent);
00140         if (itemsCount > 0 &&
00141             MajorSize(realizationRect) > 0 &&
00142             DoesRealizationWindowOverlapExtent(realizationRect, MinorMajorRect(MinorStart(lastExtent), MajorStart(lastExtent), Minor(availableSize), static_cast<float>(extentMajorSize))))
00143         {
00144             const double realizationWindowStartWithinExtent = static_cast<double>(MajorStart(realizationRect)) - static_cast<double>(MajorStart(lastExtent));
00145             const int lineIndex = std::max(0, (int)(realizationWindowStartWithinExtent / averageLineSize));
00146             anchorIndex = (int)(lineIndex * averageItemsPerLine);
00147
00148             // Clamp it to be within valid range
00149             anchorIndex = std::max(0, std::min(itemsCount - 1, anchorIndex));
00150             offset = lineIndex * averageLineSize + MajorStart(lastExtent);
00151         }
00152     }
00153
00154     return { anchorIndex, offset };
00155 }
00156
00157 winrt::FlowLayoutAnchorInfo FlowLayout::GetAnchorForTargetElement(
00158     int targetIndex,
00159     winrt::Size const& availableSize,
00160     winrt::VirtualizingLayoutContext const& context)
00161 {
00162     double offset = DoubleUtil::NaN;
00163     int index = -1;
00164     const int itemsCount = context.ItemCount();
00165
00166     if (targetIndex >= 0 && targetIndex < itemsCount)
00167     {
00168         index = targetIndex;
00169         const auto state = context.LayoutState();
00170         auto flowState = GetAsFlowState(state);
00171         double averageItemsPerLine = 0;
00172         const double averageLineSize = GetAverageLineInfo(availableSize, context, flowState, averageItemsPerLine) + LineSpacing();
00173         const int lineIndex = (int)(targetIndex / averageItemsPerLine);
00174         offset = lineIndex * averageLineSize + MajorStart(flowState->FlowAlgorithm().LastExtent());
00175     }
00176
00177     return { index, offset };
00178 }
00179
00180 winrt::Rect FlowLayout::GetExtent(
00181     winrt::Size const& availableSize,
00182     winrt::VirtualizingLayoutContext const& context,
00183     winrt::UIElement const& firstRealized,
00184     int firstRealizedItemIndex,
00185     winrt::Rect const& firstRealizedLayoutBounds,
00186     winrt::UIElement const& lastRealized,
00187     int lastRealizedItemIndex,
00188     winrt::Rect const& lastRealizedLayoutBounds)
00189 {
00190     UNREFERENCED_PARAMETER(lastRealized);
00191
00192     auto extent = winrt::Rect{};
00193
00194     const int itemsCount = context.ItemCount();
00195
00196     if (itemsCount > 0)
00197     {
00198         const float availableSizeMinor = Minor(availableSize);
00199         const auto state = context.LayoutState();
00200         const auto flowState = GetAsFlowState(state);
00201         double averageItemsPerLine = 0;
00202         const double averageLineSize = GetAverageLineInfo(availableSize, context, flowState, averageItemsPerLine) + LineSpacing();
00203
00204         MUX_ASSERT(averageItemsPerLine != 0);
00205         if (firstRealized)
00206         {
00207             MUX_ASSERT(lastRealized);
00208             const int linesBeforeFirst = static_cast<int>(firstRealizedItemIndex / averageItemsPerLine);
00209             const double extentMajorStart = MajorStart(firstRealizedLayoutBounds) - linesBeforeFirst * averageLineSize;
00210             MajorStart(extent) = static_cast<float>(extentMajorStart);
00211             const int remainingItems = itemsCount - lastRealizedItemIndex - 1;
00212             const int remainingLinesAfterLast = static_cast<int>((remainingItems / averageItemsPerLine));
00213             const double extentMajorSize = static_cast<double>(MajorEnd(lastRealizedLayoutBounds)) - static_cast<double>(MajorStart(extent)) + remainingLinesAfterLast * averageLineSize;
00214             MajorSize(extent) = static_cast<float>(extentMajorSize);
00215
00216             // If the available size is infinite, we will have realized all the items in one line.
00217             // In that case, the extent in the non virtualizing direction should be based on the
00218             // right/bottom of the last realized element.
00219             MinorSize(extent) =
00220                 std::isfinite(availableSizeMinor) ?
00221                 availableSizeMinor :
00222                 std::max(0.0f, MinorEnd(lastRealizedLayoutBounds));
00223         }
00224         else
00225         {
00226             const auto lineSpacing = LineSpacing();
00227             const auto minItemSpacing = MinItemSpacing();
00228             // We dont have anything realized. make an educated guess.
00229             const int numLines = (int)std::ceil(itemsCount / averageItemsPerLine);
00230             extent =
00231                 std::isfinite(availableSizeMinor) ?
00232                 MinorMajorRect(0, 0, availableSizeMinor, std::max(0.0f, static_cast<float>(numLines * averageLineSize - lineSpacing))) :
00233                 MinorMajorRect(
00234                     0,
00235                     0,
00236                     std::max(0.0f, static_cast<float>((Minor(flowState->SpecialElementDesiredSize()) + minItemSpacing) * itemsCount - minItemSpacing)),
00237                     std::max(0.0f, static_cast<float>(averageLineSize - lineSpacing)));
00238             ITEMSREPEATER_TRACE_VERBOSE_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR, METH_NAME, this,
00239                 winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), LayoutId().data(),
00240                 L"Estimating extent with no realized elements.");
00241         }
00242
00243 #ifdef DBG
00244         const int indentDbg = winrt::get_self<VirtualizingLayoutContext>(context)->Indent();
00245
00246         ITEMSREPEATER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT_FLT, METH_NAME, this,
00247             indentDbg, LayoutId().data(),
00248             L"Extent:", extent.Width, extent.Height);
00249         ITEMSREPEATER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT, METH_NAME, this,
00250             indentDbg, LayoutId().data(),
00251             L"Based on average line size:", averageLineSize);
00252         ITEMSREPEATER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT_FLT, METH_NAME, this,
00253             indentDbg, LayoutId().data(),
00254             L"Based on average items per line:", averageItemsPerLine);
00255 #endif // DBG
00256     }
00257     else
00258     {
00259         MUX_ASSERT(firstRealizedItemIndex == -1);
00260         MUX_ASSERT(lastRealizedItemIndex == -1);
00261
00262         ITEMSREPEATER_TRACE_INFO_DBG(nullptr, TRACE_MSG_METH_IND_STR_STR_FLT_FLT, METH_NAME, this,
00263             winrt::get_self<VirtualizingLayoutContext>(context)->Indent(), LayoutId().data(),
00264             L"ItemCount is 0. Extent:", extent.Width, extent.Height);
00265     }
00266
00267     return extent;
00268 }
00269
00270 void FlowLayout::OnElementMeasured(
00271     winrt::UIElement const& /*element*/,
00272     int /*index*/,
00273     winrt::Size const& /*availableSize*/,
00274     winrt::Size const& /*measureSize*/,
00275     winrt::Size const& /*desiredSize*/,
00276     winrt::Size const& /*provisionalArrangeSize*/,
00277     winrt::VirtualizingLayoutContext const& /*context*/)
00278 {
00279 }
00280
00281 void FlowLayout::OnLineArranged(
00282     int startIndex,
00283     int countInLine,
00284     double lineSize,
00285     winrt::VirtualizingLayoutContext const& context)
00286 {
00287 #ifdef DBG
00288     const int indentDbg = winrt::get_self<VirtualizingLayoutContext>(context)->Indent();
00289
00290     ITEMSREPEATER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_IND_STR_STR_INT, METH_NAME, this, indentDbg, LayoutId().data(), L"startIndex", startIndex);
00291     ITEMSREPEATER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_IND_STR_STR_INT, METH_NAME, this, indentDbg, LayoutId().data(), L"Count", countInLine);
00292     ITEMSREPEATER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_IND_STR_STR_INT, METH_NAME, this, indentDbg, LayoutId().data(), L"LineHeight", lineSize);
00293 #endif
00294
00295     const auto flowState = GetAsFlowState(context.LayoutState());
00296     flowState->OnLineArranged(startIndex, countInLine, lineSize, context);
00297 }
00298
00299 #pragma endregion
00300
00301 #pragma region IFlowLayoutAlgorithmDelegates
00302
00303 winrt::Size FlowLayout::Algorithm_GetMeasureSize(int index, const winrt::Size & availableSize, const winrt::VirtualizingLayoutContext& /*context*/)
00304 {
00305     return overridable().GetMeasureSize(index, availableSize);
00306 }
00307
00308 winrt::Size FlowLayout::Algorithm_GetProvisionalArrangeSize(int index, const winrt::Size & measureSize, winrt::Size const& desiredSize, const winrt::VirtualizingLayoutContext& /*context*/)
00309 {
00310     return overridable().GetProvisionalArrangeSize(index, measureSize, desiredSize);
00311 }
00312
00313 bool FlowLayout::Algorithm_ShouldBreakLine(int index, double remainingSpace)
00314 {
00315     return overridable().ShouldBreakLine(index, remainingSpace);
00316 }
00317
00318 winrt::FlowLayoutAnchorInfo FlowLayout::Algorithm_GetAnchorForRealizationRect(
00319     const winrt::Size & availableSize,
00320     const winrt::VirtualizingLayoutContext & context)
00321 {
00322     return overridable().GetAnchorForRealizationRect(availableSize, context);
00323 }
00324
00325 winrt::FlowLayoutAnchorInfo FlowLayout::Algorithm_GetAnchorForTargetElement(
00326     int targetIndex,
00327     const winrt::Size & availableSize,
00328     const winrt::VirtualizingLayoutContext & context)
00329 {
00330     return overridable().GetAnchorForTargetElement(targetIndex, availableSize, context);
00331 }
00332
00333 winrt::Rect FlowLayout::Algorithm_GetExtent(
00334     const winrt::Size & availableSize,
00335     const winrt::VirtualizingLayoutContext & context,
00336     const winrt::UIElement & firstRealized,
00337     int firstRealizedItemIndex,
00338     const winrt::Rect & firstRealizedLayoutBounds,
00339     const winrt::UIElement & lastRealized,
00340     int lastRealizedItemIndex,
00341     const winrt::Rect & lastRealizedLayoutBounds)
00342 {
00343     return overridable().GetExtent(
00344         availableSize,
00345         context,
00346         firstRealized,
00347         firstRealizedItemIndex,
00348         firstRealizedLayoutBounds,
00349         lastRealized,
00350         lastRealizedItemIndex,
00351         lastRealizedLayoutBounds);
00352 }
00353
00354 void FlowLayout::Algorithm_OnElementMeasured(
00355     const winrt::UIElement & element,
00356     const int index,
00357     const winrt::Size & availableSize,
00358     const winrt::Size & measureSize,
00359     const winrt::Size & desiredSize,
00360     const winrt::Size & provisionalArrangeSize,
00361     const winrt::VirtualizingLayoutContext & context)
00362 {
00363     overridable().OnElementMeasured(
00364         element,
00365         index,
00366         availableSize,
00367         measureSize,
00368         desiredSize,
00369         provisionalArrangeSize,
00370         context);
00371 }
00372
00373 void FlowLayout::Algorithm_OnLineArranged(
00374     int startIndex,
00375     int countInLine,
00376     double lineSize,
00377     const winrt::VirtualizingLayoutContext & context)
00378 {
00379     return overridable().OnLineArranged(
00380         startIndex,
00381         countInLine,
00382         lineSize,
00383         context);
00384 }
00385
00386 #pragma endregion
00387
00388 void FlowLayout::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
00389 {
00390     auto property = args.Property();
00391     if (property == s_OrientationProperty)
00392     {
00393         auto orientation = unbox_value<winrt::Orientation>(args.NewValue());
00394
00395         //Note: For FlowLayout Vertical Orientation means we have a Horizontal ScrollOrientation. Horizontal Orientation means we have a Vertical ScrollOrientation.
00396         //i.e. the properties are the inverse of each other.
00397         const auto scrollOrientation = (orientation == winrt::Orientation::Horizontal) ? ScrollOrientation::Vertical : ScrollOrientation::Horizontal;
00398         OrientationBasedMeasures::SetScrollOrientation(scrollOrientation);
00399
00400         UpdateIndexBasedLayoutOrientation(orientation);
00401     }
00402     else if (property == s_MinColumnSpacingProperty)
00403     {
00404         m_minColumnSpacing = unbox_value<double>(args.NewValue());
00405     }
00406     else if (property == s_MinRowSpacingProperty)
00407     {
00408         m_minRowSpacing = unbox_value<double>(args.NewValue());
00409     }
00410     else if (property == s_LineAlignmentProperty)
00411     {
00412         m_lineAlignment = unbox_value<winrt::FlowLayoutLineAlignment>(args.NewValue());
00413     }
00414
00415     InvalidateLayout();
00416 }
00417
00418 #pragma region private helpers
00419
00420 double FlowLayout::GetAverageLineInfo(
00421     const winrt::Size& availableSize,
00422     const winrt::VirtualizingLayoutContext& context,
00423     const winrt::com_ptr<FlowLayoutState>& flowState,
00424     double& avgCountInLine)
00425 {
00426     // default to 1 item per line with 0 size
00427     double avgLineSize = 0;
00428     avgCountInLine = 1;
00429
00430     MUX_ASSERT(context.ItemCountCore() > 0);
00431     if (flowState->TotalLinesMeasured() == 0)
00432     {
00433         const auto tmpElement = context.GetOrCreateElementAt(0, winrt::ElementRealizationOptions::ForceCreate | winrt::ElementRealizationOptions::SuppressAutoRecycle);
00434         const auto desiredSize = flowState->FlowAlgorithm().MeasureElement(tmpElement, 0, availableSize, context);
00435         context.RecycleElement(tmpElement);
00436
00437         const int estimatedCountInLine = std::max(1, static_cast<int>(Minor(availableSize) / Minor(desiredSize)));
00438         flowState->OnLineArranged(0, estimatedCountInLine, Major(desiredSize), context);
00439         flowState->SpecialElementDesiredSize(desiredSize);
00440     }
00441
00442     avgCountInLine = std::max(1.0, flowState->TotalItemsPerLine() / flowState->TotalLinesMeasured());
00443     avgLineSize = round(flowState->TotalLineSize() / flowState->TotalLinesMeasured());
00444
00445     return avgLineSize;
00446 }
00447
00448 void FlowLayout::UpdateIndexBasedLayoutOrientation(const winrt::Orientation& orientation)
00449 {
00450     SetIndexBasedLayoutOrientation(orientation == winrt::Orientation::Horizontal ?
00451         winrt::IndexBasedLayoutOrientation::LeftToRight : winrt::IndexBasedLayoutOrientation::TopToBottom);
00452 }
00453
00454 #pragma endregion
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InfoBarPage Member List

This is the complete list of members for InfoBarPage, including all inherited members.
_actionButton | InfoBarPage | [private]
_timer | InfoBarPage | [private]
_timerAction | InfoBarPage | [private]
ActionButton_Click(object sender, RoutedEventArgs e) | InfoBarPage | [inline, private]
ActionButtonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | InfoBarPage | [inline, private]
AddInfoBarClick(object sender, object args) | InfoBarPage | [inline, private]
ClearButtonClick(object sender, object args) | InfoBarPage | [inline]
CloseStyleChanged(object sender, object args) | InfoBarPage | [inline]
CollapseActionButtonAsynchronouslyClick(object sender, object args) | InfoBarPage | [inline, private]
CollapseActionButtonProperty() | InfoBarPage | [inline, private]
CustomBackgroundChanged(object sender, object args) | InfoBarPage | [inline]
DisableActionButtonAsynchronouslyClick(object sender, object args) | InfoBarPage | [inline, private]
DisableActionButtonProperty() | InfoBarPage | [inline, private]
DiscardActionButton() | InfoBarPage | [inline, private]
HasCustomContentChanged(object sender, object args) | InfoBarPage | [inline]
IconComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | InfoBarPage | [inline, private]
InfoBarPage() | InfoBarPage | [inline]
OnCloseButtonClick(object sender, object args) | InfoBarPage | [inline]
OnClosed(object sender, InfoBarClosedEventArgs args) | InfoBarPage | [inline]
OnClosing(object sender, InfoBarClosingEventArgs args) | InfoBarPage | [inline]
RemoveInfoBarAsynchronouslyClick(object sender, object args) | InfoBarPage | [inline, private]
ResetActionButtonAsynchronouslyClick(object sender, object args) | InfoBarPage | [inline, private]
ResetActionButtonProperty() | InfoBarPage | [inline, private]
SetForegroundClick(object sender, object args) | InfoBarPage | [inline]
SeverityComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | InfoBarPage | [inline, private]
StartAsynchronousAction(int timerAction) | InfoBarPage | [inline, private]
Timer_Tick(object sender, object e) | InfoBarPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressBar/ProgressBarTemplateSettings.cpp Source File

  • ProgressBar

ProgressBarTemplateSettings.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ProgressBarTemplateSettings.h"
00007
00008 ProgressBarTemplateSettings::ProgressBarTemplateSettings()
00009 {
00010     EnsureProperties();
00011 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ItemContainerProperties Member List

This is the complete list of members for ItemContainerProperties, including all inherited members.
CanUserInvoke(winrt::ItemContainerUserInvokeMode const &value) | ItemContainerProperties |
CanUserInvoke() | ItemContainerProperties |
CanUserInvokeProperty() | ItemContainerProperties | [inline, static]
CanUserSelect(winrt::ItemContainerUserSelectMode const &value) | ItemContainerProperties |
CanUserSelect() | ItemContainerProperties |
CanUserSelectProperty() | ItemContainerProperties | [inline, static]
Child(winrt::UIElement const &value) | ItemContainerProperties |
Child() | ItemContainerProperties |
ChildProperty() | ItemContainerProperties | [inline, static]
ClearProperties() | ItemContainerProperties | [static]
EnsureProperties() | ItemContainerProperties | [static]
IsSelected(bool value) | ItemContainerProperties |
IsSelected() | ItemContainerProperties |
IsSelectedProperty() | ItemContainerProperties | [inline, static]
ItemContainerProperties() | ItemContainerProperties |
ItemInvoked(winrt::TypedEventHandler< winrt::ItemContainer, winrt::ItemContainerInvokedEventArgs > const &value) | ItemContainerProperties |
ItemInvoked(winrt::event_token const &token) | ItemContainerProperties |
m_itemInvokedEventSource | ItemContainerProperties |
MultiSelectMode(winrt::ItemContainerMultiSelectMode const &value) | ItemContainerProperties |
MultiSelectMode() | ItemContainerProperties |
MultiSelectModeProperty() | ItemContainerProperties | [inline, static]
OnCanUserInvokePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemContainerProperties | [static]
OnCanUserSelectPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemContainerProperties | [static]
OnChildPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemContainerProperties | [static]
OnIsSelectedPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemContainerProperties | [static]
OnMultiSelectModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ItemContainerProperties | [static]
s_CanUserInvokeProperty | ItemContainerProperties | [static]
s_CanUserSelectProperty | ItemContainerProperties | [static]
s_ChildProperty | ItemContainerProperties | [static]
s_IsSelectedProperty | ItemContainerProperties | [static]
s_MultiSelectModeProperty | ItemContainerProperties | [static]
Generated on Sun Dec 1 2024 20:52:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ScrollControllerPanRequestedEventArgs.cpp Source File

  • ScrollPresenter

ScrollControllerPanRequestedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TypeLogging.h"
00007 #include "ScrollPresenterTrace.h"
00008 #include "ScrollControllerPanRequestedEventArgs.h"
00009
00010 #include "ScrollControllerPanRequestedEventArgs.properties.cpp"
00011
00012 ScrollControllerPanRequestedEventArgs::ScrollControllerPanRequestedEventArgs(
00013     const winrt::PointerPoint& pointerPoint)
00014 {
00015     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_STR, METH_NAME, this, TypeLogging::PointerPointToString(pointerPoint).c_str());
00016
00017     m_pointerPoint = pointerPoint;
00018 }
00019
00020 winrt::PointerPoint ScrollControllerPanRequestedEventArgs::PointerPoint() const
00021 {
00022     return m_pointerPoint;
00023 }
00024
00025 bool ScrollControllerPanRequestedEventArgs::Handled() const
00026 {
00027     return m_handled;
00028 }
00029
00030 void ScrollControllerPanRequestedEventArgs::Handled(bool handled)
00031 {
00032     SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH_INT, METH_NAME, this, handled);
00033     m_handled = handled;
00034 }
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/InteractionTests/Reveal_InteractionTests/RevealBrushTests.cs Source File

  • Materials
  • Reveal
  • InteractionTests
  • Reveal_InteractionTests

RevealBrushTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00007 using Common;
00008 using System.Threading.Tasks;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation;
00016 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00017 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00018 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00019
00020 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00021 {
00022     [TestClass]
00023     public class RevealBrushTests
00024     {
00025         private const string AcrylicRectangleName = "Rectangle1";
00026         private const string TintOpacitySliderName = "TintOpacity";
00027         private const string SizeSliderName = "SizeSlider";
00028
00029         [ClassInitialize]
00030         [TestProperty("RunAs", "User")]
00031         [TestProperty("Classification", "Integration")]
00032         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00033         [TestProperty("MUXControlsTestEnabledForPhone", "True")]
00034         // TODO: Enable as part of: Bug 24355584: DCPP: Reveal isn't following the pointer - need to update the effect
00035         [TestProperty("Ignore", "True")]
00036         public static void ClassInitialize(TestContext testContext)
00037         {
00038             TestEnvironment.Initialize(testContext);
00039         }
00040
00041         [TestCleanup]
00042         public void TestCleanup()
00043         {
00044             if (TestEnvironment.TestContext.CurrentTestOutcome != UnitTestOutcome.Passed)
00045             {
00046                 Log.Comment("Test failed. Queueing an app restart, since we may now be in an unknown state.");
00047                 TestEnvironment.ShouldRestartApplication = true;
00048             }
00049         }
00050
00051         [TestMethod]
00052         [TestProperty("Ignore", "True")] // Disabled as per tracking issue #3125 and internal issue 17762113
00053         public void RevealBrushAudit()
00054         {
00055             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToColorReveal" }))
00056             {
00057                 var result = new Edit(FindElement.ByName("CheckBrushesResult"));
00058
00059                 FindElement.ByName<Button>("CheckBrushes").InvokeAndWait();
00060
00061                 string errors = result.Value;
00062                 if (errors != "")
00063                 {
00064                     Log.Error("Brush check result = {0}", errors);
00065                 }
00066             }
00067         }
00068
00069         [TestMethod]
00070         public void RevealAlwaysUseFallback()
00071         {
00072             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealFallback" }))
00073             {
00074                 ChooseFromComboBox("TestNameComboBox", "RevealAlwaysUseFallback");
00075
00076                 var result = new Edit(FindElement.ById("TestResult"));
00077
00078                 FindElement.ByName<Button>("RunTestButton").InvokeAndWait();
00079
00080                 if (result.Value.Equals("RevealAlwaysUseFallback: Skipped"))
00081                 {
00082                     Log.Error("Error: FallbackBrush in use - expecting effect brush");
00083                     return;
00084                 }
00085
00086                 string errors = result.Value;
00087                 if (errors != "")
00088                 {
00089                     Log.Error("RevealAlwaysUseFallback result = {0}", errors);
00090                 }
00091             }
00092         }
00093
00094         [TestMethod]
00095         [TestProperty("EnableForPGOTraining", "True")]
00096         public void RevealButtonStates()
00097         {
00098             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00099             {
00100                 Log.Comment("Testing light states for Button... ");
00101
00102                 var target = FindElement.ById("LargeButton");
00103                 ChooseFromComboBox("TargetComboBox", "LargeButton");
00104                 RevealStatesHelper(target);
00105             }
00106         }
00107
00108         [TestMethod]
00109         public void RevealListViewItemStates()
00110         {
00111             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00112             {
00113                 Log.Comment("Testing RevealHoverLight states for ListViewItem... ");
00114
00115                 var target = FindElement.ById("NormalListViewItem");
00116                 ChooseFromComboBox("TargetComboBox", "NormalListViewItem");
00117                 RevealStatesHelper(target);
00118             }
00119         }
00120
00121         [TestMethod]
00122         public void RevealSetStateNoCrashWhenParentIsNotControl()
00123         {
00124             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00125             {
00126                 var button = new Button(FindElement.ByName("SetStatePressed"));
00127                 button.Invoke();
00128                 Wait.ForIdle();
00129
00130                 var result = new Edit(FindElement.ById("TestResult"));
00131                 Verify.AreEqual("SetState_Click: Clicked", result.Value);
00132             }
00133         }
00134
00135         private void RevealStatesHelper(UIObject target)
00136         {
00137             var result = new Edit(FindElement.ById("TestResult"));
00138
00139             Log.Comment("Move Mouse to (0,0). Validate target is initially in Normal state.");
00140             using (var waiter = new ValueChangedEventWaiter(result))
00141             {
00142                 TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00143                 Wait.ForIdle();
00144                 ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidateNormalState");
00145                 waiter.Wait();
00146             }
00147             LogResult(result, "Normal");
00148
00149             Log.Comment("Move mouse over the target (which will attach RevealHoverLight). Validate PointerOver light state.");
00150             using (var waiter = new ValueChangedEventWaiter(result))
00151             {
00152                 target.MovePointer(30, 30);
00153                 Wait.ForIdle();
00154                 ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePointerOverState");
00155                 waiter.Wait();
00156             }
00157             LogResult(result, "PointerOver");
00158
00159             Log.Comment("Click the Target. Verify Pressed light state.");
00160             using (var waiter = new ValueChangedEventWaiter(result))
00161             {
00162                 target.MovePointer(30, 30);
00163                 Wait.ForIdle();
00164
00165                 if (target is ListViewItem)
00166                 {
00167                     ListView testListView = new ListView(FindElement.ById("TestListView"));
00168                     testListView.Click();
00169                 }
00170                 else
00171                 {
00172                     target.Click();
00173                 }
00174                 waiter.Wait();
00175             }
00176             LogResult(result, "Pressed");
00177
00178             Log.Comment("Move Mouse to (0, 0). Validate target button is again in Normal state.");
00179             using (var waiter = new ValueChangedEventWaiter(result))
00180             {
00181                 TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00182                 Wait.ForIdle();
00183                 ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidateNormalState");
00184                 waiter.Wait();
00185             }
00186             LogResult(result, "Normal");
00187         }
00188
00189         [TestMethod]
00190         [TestProperty("Ignore", "True")]    // Bug 24355584: DCPP: Reveal isn't following the pointer - need to update the effect
00191         public void RevealBorderLightTouchTests()
00192         {
00193             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00194             {
00195                 Log.Comment("Testing RevealBorderLight for ListViewItem... ");
00196
00197                 var target = FindElement.ById("AnotherListViewItem");
00198
00199                 var result = new Edit(FindElement.ById("TestResult"));
00200
00201                 // Regression coverage for Bug 11713432: [Neon][Reveal] Reveal borders remain after swiping in Groove and Movies & TV left-nav pane on mobile and desktop
00202                 Log.Comment("Tap ListViewItem, then pan away from it. After panning, validate RevealBorderLight is off.");
00203                 using (var waiter = new ValueChangedEventWaiter(result))
00204                 {
00205                     // Move mouse pointer away so it does not create BorderLight on the item
00206                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00207                     Wait.ForIdle();
00208
00209                     InputHelper.Pan(target, 300, Direction.North);
00210                     Wait.ForIdle();
00211
00212                     ChooseFromComboBox("ValidationActionsComboBox", "BorderLight_ValidateBorderLightPanAway");
00213                     Wait.ForIdle();
00214                     waiter.Wait();
00215                 }
00216                 LogResult(result, "BorderLight_PanAway");
00217
00218                 Log.Comment("Tap and hold ListViewItem. While holding, validate RevealBorderLight is on.");
00219                 using (var waiter = new ValueChangedEventWaiter(result))
00220                 {
00221                     // Move mouse pointer away so it does not create BorderLight on the item
00222                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00223                     Wait.ForIdle();
00224
00225                     // Validation will be triggered on ListViewItem's Holding event (this way we are still in the holding state while validating).
00226                     InputHelper.TapAndHold(target, 1000);
00227                     Wait.ForIdle();
00228
00229                     waiter.Wait();
00230                 }
00231                 LogResult(result, "BorderLight_TapAndHold");
00232
00233             }
00234         }
00235
00236         [TestProperty("Ignore", "True")] // 24174814
00237         [TestMethod]
00238         public void RevealHoverLightPositionTests()
00239         {
00240             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00241             {
00242                 var result = new Edit(FindElement.ById("TestResult"));
00243
00244                 Log.Comment("Tap and hold Button at an offset. Verfiy RevealHoverLight uses pointer expression to position itself at the pointer.");
00245                 var target = FindElement.ById("NarrowButton");
00246                 using (var waiter = new ValueChangedEventWaiter(result))
00247                 {
00248                     // Move mouse pointer away so it does not create HoverLight on the item
00249                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00250                     Wait.ForIdle();
00251
00252                     InputHelper.TapAndHold(target, 10, 35, 1000);
00253                     Wait.ForIdle();
00254
00255                     waiter.Wait();
00256                 }
00257                 LogResult(result, "HoverLightExpression_Button_Touch");
00258
00259                 Log.Comment("Activate Button with Keyboard. Validate RevealHoverLight uses keyboard expression to position itself at center of the control.");
00260                 using (var waiter = new ValueChangedEventWaiter(result))
00261                 {
00262                     // Move mouse pointer away so it does not create BorderLight on the item
00263                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00264                     Wait.ForIdle();
00265
00266                     // Tab to next button and activate it with keyboard
00267                     KeyboardHelper.PressKey(Key.Tab);
00268                     KeyboardHelper.PressKey(Key.Space);
00269                     Wait.ForIdle();
00270
00271                     waiter.Wait();
00272                 }
00273                 LogResult(result, "HoverLightExpression_Button_Keyboard");
00274
00275                 Log.Comment("Tap and hold ListViewItem at an offset. Verfiy RevealHoverLight uses pointer expression to position itself at the pointer.");
00276                 target = FindElement.ById("OneMoreListViewItem");
00277                 ChooseFromComboBox("TargetComboBox", "OneMoreListViewItem");
00278                 using (var waiter = new ValueChangedEventWaiter(result))
00279                 {
00280                     // Move mouse pointer away so it does not create HoverLight on the item
00281                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00282                     Wait.ForIdle();
00283
00284                     InputHelper.TapAndHold(target, 150, 35, 1000);
00285                     Wait.ForIdle();
00286
00287                     waiter.Wait();
00288                 }
00289                 LogResult(result, "HoverLightExpression_ListViewItem_Touch");
00290             }
00291         }
00292
00293         //Issue #6649 Some tests fail when run on OS 21H1
00294         [TestMethod]
00295         [TestProperty("Ignore", "True")]    // Bug 24355584: DCPP: Reveal isn't following the pointer - need to update the effect
00296         public void RevealButtonStates_Values()
00297         {
00298             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00299             {
00300                 var result = new Edit(FindElement.ById("TestResult"));
00301                 var target = FindElement.ById("LargeButton2");
00302
00303                 using (var waiter = new ValueChangedEventWaiter(result))
00304                 {
00305                     Log.Comment("Tap and hold button (which will attach reveal backgorund lights).");
00306                     InputHelper.TapAndHold(target, 3000);
00307                     Wait.ForIdle();
00308
00309                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00310                     Wait.ForIdle();
00311
00312                     ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePointerOverState_Values");
00313                     FindElement.ByName<Button>("StartLoggingValues").InvokeAndWait();
00314
00315                     Log.Comment("Move mouse over the target. Wait for light to reach Default state values.");
00316                     target.MovePointer(30, 30);
00317                     Wait.ForIdle();
00318
00319                     waiter.Wait();
00320                 }
00321                 LogResult(result, "PointerOver_Values");
00322
00323                 using (var waiter = new ValueChangedEventWaiter(result))
00324                 {
00325                     ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePressedState_Values");
00326                     FindElement.ByName<Button>("StartLoggingValues").InvokeAndWait();
00327
00328                     Log.Comment("Click button. Wait for light to reach Pressed state values.");
00329                     target.Click();
00330                     Wait.ForIdle();
00331
00332                     waiter.Wait();
00333                 }
00334                 LogResult(result, "Pressed_Values");
00335             }
00336         }
00337
00338         //Issue #6649 Some tests fail when run on OS 21H1
00339         [TestMethod]
00340         [TestProperty("Ignore", "True")]    // Bug 24355584: DCPP: Reveal isn't following the pointer - need to update the effect
00341         public void RevealButtonStates_FastRelease_Values()
00342         {
00343             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00344             {
00345                 var result = new Edit(FindElement.ById("TestResult"));
00346                 var target = FindElement.ById("LargeButton2");
00347
00348                 using (var waiter = new ValueChangedEventWaiter(result))
00349                 {
00350                     Log.Comment("Tap and hold button (which will attach reveal backgorund lights).");
00351                     InputHelper.TapAndHold(target, 3000);
00352                     Wait.ForIdle();
00353
00354                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00355                     Wait.ForIdle();
00356
00357                     ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidateFastRelease_Values");
00358                     FindElement.ByName<Button>("StartLoggingValues").InvokeAndWait();
00359
00360                     Log.Comment("Click button. Wait for light to first reach Pressed, then FastRelease values.");
00361                     InputHelper.LeftClick(target);
00362                     Wait.ForIdle();
00363
00364                     waiter.Wait();
00365                 }
00366                 LogResult(result, "FastRelease_Values");
00367             }
00368         }
00369
00370         //Issue #6649 Some tests fail when run on OS 21H1
00371         [TestMethod]
00372         [TestProperty("Ignore", "True")]    // Bug 24355584: DCPP: Reveal isn't following the pointer - need to update the effect
00373         public void RevealButtonStates_SlowRelease_Values()
00374         {
00375             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00376             {
00377                 var result = new Edit(FindElement.ById("TestResult"));
00378                 var target = FindElement.ById("LargeButton2");
00379
00380                 using (var waiter = new ValueChangedEventWaiter(result))
00381                 {
00382                     Log.Comment("Tap and hold button (which will attach RevealHoverLight).");
00383                     InputHelper.TapAndHold(target, 3000);
00384                     Wait.ForIdle();
00385
00386                     ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidateSlowRelease_Values");
00387                     FindElement.ByName<Button>("StartLoggingValues").InvokeAndWait();
00388
00389                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00390                     Wait.ForIdle();
00391
00392                     Log.Comment("Tap and hold button. Wait for light to first reach Pressed, then SlowRelease values.");
00393                     InputHelper.TapAndHold(target, 5000);
00394                     Wait.ForIdle();
00395
00396                     waiter.Wait();
00397                 }
00398                 LogResult(result, "SlowRelease_Values");
00399             }
00400         }
00401
00402         //Issue #6649 Some tests fail when run on OS 21H1
00403         [TestMethod]
00404         [TestProperty("Ignore", "True")]    // Bug 24355584: DCPP: Reveal isn't following the pointer - need to update the effect
00405         public void RevealHoverLightPosition_Values()
00406         {
00407             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" }))
00408             {
00409                 var result = new Edit(FindElement.ById("TestResult"));
00410                 var target = FindElement.ById("LargeButton2");
00411
00412                 using (var waiter = new ValueChangedEventWaiter(result))
00413                 {
00414                     // Note for this test case we specifically attach the hover light via hover, not press.
00415                     // This provides regression coverage for Bug 14079741: Reveal hover light doesn't follow pointer until first interaction/click
00416                     Log.Comment("Move pointer over LargeButton2 (which will attach RevealHoverLight).");
00417                     target.MovePointer(50, 50);
00418                     Wait.ForIdle();
00419
00420                     ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePosition_Offset1_Values");
00421                     FindElement.ByName<Button>("StartLoggingValues").InvokeAndWait();
00422
00423                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00424                     Wait.ForIdle();
00425
00426                     Log.Comment("Move pointer to Offset1 [10, 90] on LargeButton2. Wait for light to position to reach expected values.");
00427                     target.MovePointer(10, 90);
00428                     Wait.ForIdle();
00429
00430                     waiter.Wait();
00431                 }
00432                 LogResult(result, "Offset1_Values");
00433
00434                 using (var waiter = new ValueChangedEventWaiter(result))
00435                 {
00436                     ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePosition_Offset2_Values");
00437                     FindElement.ByName<Button>("StartLoggingValues").InvokeAndWait();
00438
00439                     // Move mouse pointer away so it does not create BorderLight on the item
00440                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00441                     Wait.ForIdle();
00442
00443                     Log.Comment("Move pointer to Offset2 [50, 50]. Wait for light to position to reach expected values.");
00444                     target.MovePointer(50, 50);
00445                     Wait.ForIdle();
00446
00447                     waiter.Wait();
00448                 }
00449                 LogResult(result, "Offset2_Values");
00450
00451                 target = FindElement.ById("NarrowButton2");
00452                 using (var waiter = new ValueChangedEventWaiter(result))
00453                 {
00454                     Log.Comment("Tap and hold NarrowButton2 (which will attach RevealHoverLight).");
00455                     InputHelper.TapAndHold(target, 3000);
00456                     Wait.ForIdle();
00457
00458                     ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePosition_Offset3_Values");
00459                     FindElement.ByName<Button>("StartLoggingValues").InvokeAndWait();
00460
00461                     TestEnvironment.Application.CoreWindow.MovePointer(0, 0);
00462                     Wait.ForIdle();
00463
00464                     Log.Comment("Tap on NarrowButton2 at [10, 40]. Wait for light position to reach expected values.");
00465                     InputHelper.Tap(target, 10, 40);
00466                     Wait.ForIdle();
00467
00468                     waiter.Wait();
00469                 }
00470                 LogResult(result, "Offset3_Values");
00471             }
00472         }
00473
00474         [TestMethod]
00475         public void RevealCreateThenEnableEffects()
00476         {
00477             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealRegressionTests" }))
00478             {
00479                 ToggleButton simulateDisabledByPolicyToggleButton = new ToggleButton(FindElement.ById("SimluateDisabledByPolicyToggleButton"));
00480                 var addRevealButton = FindElement.ById("AddRevealButton");
00481                 var removeRevealButton = FindElement.ById("RemoveRevealButton");
00482                 var addBackRevealButton = FindElement.ById("AddBackRevealButton");
00483
00484                 var result = new Edit(FindElement.ById("TestResult"));
00485
00486                 using (var waiter = new ValueChangedEventWaiter(result))
00487                 {
00488                     Log.Comment("Disable Composition Effects.");
00489                     simulateDisabledByPolicyToggleButton.Toggle();      // Default is false, so this will disable effect
00490
00491                     Log.Comment("Click Add Reveal Button, to add button while effects disabled");
00492                     addRevealButton.Click();
00493                     Wait.ForIdle();
00494
00495                     var revealButton = FindElement.ById("Test1_RevealButton");
00496
00497                     Log.Comment("Tap and hold button (which would attach reveal backgorund lights).");
00498                     InputHelper.TapAndHold(revealButton, 1000);
00499                     Wait.ForIdle();
00500
00501                     Log.Comment("Click Remove Reveal Button.");
00502                     removeRevealButton.Click();
00503                     Wait.ForIdle();
00504
00505                     Log.Comment("Enable Composition Effects.");
00506                     simulateDisabledByPolicyToggleButton.Toggle();
00507                     Wait.ForIdle();
00508
00509                     Log.Comment("Add Back Reveal Button, which should now have reveal. Make sure there is no crash. ");
00510                     addBackRevealButton.Click();
00511                     Wait.ForIdle();
00512
00513                     Log.Comment("Tap and hold button. Make sure there is no crash and 2 hover lights are present.");
00514                     revealButton.Click();
00515                     Wait.ForIdle();
00516
00517                     waiter.Wait();
00518                 }
00519                 LogResult(result, "RevealCreateThenEnableEffects");
00520             }
00521         }
00522
00523         [TestMethod]
00524         public void CoreWindowEventsTests()
00525         {
00526             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToCoreWindowEventsTests" }))
00527             {
00528                 var addReveal = FindElement.ById("AddReveal");
00529                 var result = new Edit(FindElement.ById("TestResult"));
00530
00531                 using (var waiter = new ValueChangedEventWaiter(result))
00532                 {
00533                     Log.Comment("Click Add Reveal Button to enterin RevealBorderLights");
00534                     addReveal.Click();
00535                     Wait.ForIdle();
00536
00537                     Log.Comment("Move Mouse to (-1,-1) to cause PointerExited event, the app's handler will remove Reveal. Ensure there is no crash.");
00538                     TestEnvironment.Application.CoreWindow.MovePointer(-1, -1);
00539                     Wait.ForIdle();
00540
00541                     Log.Comment("Add back Reveal, make sure things are still good");
00542                     addReveal.Click();
00543                     Wait.ForIdle();
00544
00545                     waiter.Wait();
00546                 }
00547                 LogResult(result, "CoreWindowEventsTests");
00548             }
00549         }
00550
00551         [TestMethod]
00552         [TestProperty("Ignore", "True")] // Disabling as Reveal Brush is being deprecated
00553         public void RevealBrushFromMarkup()
00554         {
00555             using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealMarkup" }))
00556             {
00557                 var result = new Edit(FindElement.ById("TestResult"));
00558                 using (var waiter = new ValueChangedEventWaiter(result))
00559                 {
00560                     Button runTestButton = new Button(FindElement.ById("RunTestButton"));
00561                     runTestButton.Invoke();
00562                     waiter.Wait();
00563                 }
00564
00565                 LogResult(result, "RevealBrushFromMarkup");
00566             }
00567         }
00568
00569         private void LogResult(Edit result, string stateName)
00570         {
00571             string expectedResult = stateName + ": Passed";
00572             bool testPassed = (0 == String.Compare(expectedResult, 0, result.Value, 0, expectedResult.Length));
00573
00574             if (testPassed)
00575             {
00576                 Log.Comment(result.Value);
00577             }
00578             else
00579             {
00580                 Log.Error(result.Value);
00581             }
00582         }
00583
00584         private void ChooseFromComboBox(string textBoxName, string text)
00585         {
00586             Log.Comment("Retrieve text box with name '{0}'.", textBoxName);
00587             ComboBox comboBox = new ComboBox(FindElement.ById(textBoxName));
00588             comboBox.SelectItemByName(text);
00589         }
00590     }
00591 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioButtons/TestUI/RadioButtonsPage.xaml.cs Source File

  • RadioButtons
  • TestUI

RadioButtonsPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections;
00006 using System.Collections.ObjectModel;
00007 using System.Linq;
00008 using System.Windows.Input;
00009 using Microsoft.UI.Xaml;
00010 using Microsoft.UI.Xaml.Automation;
00011 using Microsoft.UI.Xaml.Controls;
00012 using Microsoft.UI.Xaml.Controls.Primitives;
00013 using Microsoft.UI.Xaml.Input;
00014 using Microsoft.UI.Xaml.Media;
00015 using Microsoft.UI.Xaml.Markup;
00016 using Microsoft.UI.Private.Controls;
00017 using MUXControlsTestApp.Utilities;
00018 using Microsoft.UI;
00019
00020 namespace MUXControlsTestApp
00021 {
00022     public sealed partial class RadioButtonsPage : TestPage
00023     {
00024         ObservableCollection<string> m_stringItemCollection;
00025         ObservableCollection<RadioButton> m_radioButtonItemCollection;
00026         bool m_loaded = false;
00027
00028         public RadioButtonsPage()
00029         {
00030             this.InitializeComponent();
00031             m_stringItemCollection = new ObservableCollection<string>();
00032             m_radioButtonItemCollection = new ObservableCollection<RadioButton>();
00033             this.Loaded += RadioButtonsPage_Loaded;
00034             this.SecondTestRadioButton.SelectedItem = this.TheRadioButton;
00035         }
00036
00037         private void RadioButtonsPage_Loaded(object sender, RoutedEventArgs e)
00038         {
00039             m_loaded = true;
00040             RadioButtonsTestHooks.SetTestHooksEnabled(TestRadioButtons, true);
00041             RadioButtonsTestHooks.LayoutChanged += RadioButtonsTestHooks_LayoutChanged;
00042
00043             SetMaxColumnsButton_Click(null, null);
00044             SetNumberOfItemsButton_Click(null, null);
00045             UpdateRadioButtonsSource();
00046             UpdateDisplayRadioButton();
00047         }
00048
00049         private void RadioButtonsTestHooks_LayoutChanged(RadioButtons sender, object args)
00050         {
00051             LayoutNumberOfRowsTextBlock.Text = RadioButtonsTestHooks.GetRows(sender).ToString();
00052             LayoutNumberOfColumnsTextBlock.Text = RadioButtonsTestHooks.GetColumns(sender).ToString();
00053             LayoutNumberOfLargerColumnsTextBlock.Text = RadioButtonsTestHooks.GetLargerColumns(sender).ToString();
00054         }
00055
00056         private void TestRadioButtons_SelectionChanged(object sender, SelectionChangedEventArgs e)
00057         {
00058             var index = TestRadioButtons.SelectedIndex;
00059             SelectedIndexTextBlock.Text = index.ToString();
00060             if (TestRadioButtons.SelectedItem != null)
00061             {
00062                 SelectedItemTextBlock.Text = TestRadioButtons.SelectedItem.ToString();
00063             }
00064             else
00065             {
00066                 SelectedItemTextBlock.Text = "null";
00067             }
00068
00069             if (index > 0)
00070             {
00071                 var radioButton = TestRadioButtons.ContainerFromIndex(index);
00072                 if (radioButton != null)
00073                 {
00074                     SelectedPositionInSetTextBlock.Text = radioButton.GetValue(AutomationProperties.PositionInSetProperty).ToString();
00075                     SelectedSizeOfSetTextBlock.Text = radioButton.GetValue(AutomationProperties.SizeOfSetProperty).ToString();
00076                 }
00077             }
00078             else
00079             {
00080                 SelectedPositionInSetTextBlock.Text = "-1";
00081                 SelectedSizeOfSetTextBlock.Text = "-1";
00082             }
00083         }
00084
00085         private void RootGotFocus(object sender, RoutedEventArgs e)
00086         {
00087             FocusedItemTextBlock.Text = e.OriginalSource.ToString();
00088         }
00089
00090         private void TestRadioButtons_GotFocus(object sender, RoutedEventArgs e)
00091         {
00092             var stackPanel = VisualTreeHelper.GetChild(TestRadioButtons, 0);
00093             var repeater = (ItemsRepeater)VisualTreeHelper.GetChild(stackPanel, 1);
00094             FocusedIndexTextBlock.Text = repeater.GetElementIndex((UIElement)e.OriginalSource).ToString();
00095             RadioButtonsHasFocusCheckBox.IsChecked = true;
00096         }
00097
00098         private void TestRadioButtons_LostFocus(object sender, RoutedEventArgs e)
00099         {
00100             FocusedIndexTextBlock.Text = "-1";
00101             RadioButtonsHasFocusCheckBox.IsChecked = false;
00102         }
00103
00104         private void SetMaxColumnsButton_Click(object sender, RoutedEventArgs e)
00105         {
00106             if (UInt32.TryParse(MaxColumnsTextBlock.Text, out uint value))
00107             {
00108                 TestRadioButtons.MaxColumns = (int)value;
00109                 MaxColumnsTextBlock.BorderBrush = new SolidColorBrush(Colors.Black);
00110             }
00111             else
00112             {
00113                 MaxColumnsTextBlock.BorderBrush = new SolidColorBrush(Colors.Red);
00114             }
00115         }
00116
00117         private void SetNumberOfItemsButton_Click(object sender, RoutedEventArgs e)
00118         {
00119             if (UInt32.TryParse(NumberOfItemsTextBlock.Text, out uint value))
00120             {
00121                 m_stringItemCollection.Clear();
00122                 m_radioButtonItemCollection.Clear();
00123                 for (int i = 0; i<value; i++)
00124                 {
00125                     m_stringItemCollection.Add(i.ToString());
00126                     var radioButton = new RadioButton();
00127                     radioButton.Content = i.ToString() + "Radio Button";
00128                     radioButton.SetValue(AutomationProperties.NameProperty, "Radio Button " + i);
00129                     radioButton.Name = "Radio Button " + i;
00130                     m_radioButtonItemCollection.Add(radioButton);
00131                 }
00132
00133                 if(SourceComboBox.SelectedItem == ItemsComboBoxItem)
00134                 {
00135                     UpdateRadioButtonsSource();
00136                 }
00137                 NumberOfItemsTextBlock.BorderBrush = new SolidColorBrush(Colors.Black);
00138             }
00139             else
00140             {
00141                 NumberOfItemsTextBlock.BorderBrush = new SolidColorBrush(Colors.Red);
00142             }
00143         }
00144
00145         private void SourceComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
00146         {
00147             UpdateRadioButtonsSource();
00148         }
00149
00150         private void ItemTypeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
00151         {
00152             UpdateRadioButtonsSource();
00153         }
00154
00155         private void SelectByIndexButton_Click(object sender, RoutedEventArgs e)
00156         {
00157             var index = getIndexToSelect();
00158             if (index != -2)
00159             {
00160                 TestRadioButtons.SelectedIndex = index;
00161             }
00162         }
00163
00164         private void SelectByItemButton_Click(object sender, RoutedEventArgs e)
00165         {
00166             var index = getIndexToSelect();
00167             if (index >= 0)
00168             {
00169                 if (ItemTypeComboBox.SelectedItem == StringsComboBoxItem)
00170                 {
00171                     if (SourceComboBox.SelectedItem == ItemsSourceComboBoxItem)
00172                     {
00173                         TestRadioButtons.SelectedItem = m_stringItemCollection[index];
00174                     }
00175                     else if (SourceComboBox.SelectedItem == ItemsComboBoxItem)
00176                     {
00177                         TestRadioButtons.SelectedItem = TestRadioButtons.Items[index];
00178                     }
00179                 }
00180                 else if (ItemTypeComboBox.SelectedItem == RadioButtonElementsComboBoxItem)
00181                 {
00182                     TestRadioButtons.SelectedItem = m_radioButtonItemCollection[index];
00183                 }
00184             }
00185             else
00186             {
00187                 TestRadioButtons.SelectedItem = null;
00188             }
00189
00190         }
00191
00192         private int getIndexToSelect()
00193         {
00194             if (Int32.TryParse(IndexToSelectTextBlock.Text, out int value))
00195             {
00196                 if (value >= m_radioButtonItemCollection.Count)
00197                 {
00198                     IndexToSelectTextBlock.Foreground = new SolidColorBrush(Colors.DarkRed);
00199                     return -2;
00200                 }
00201                 if (value < -1)
00202                 {
00203                     IndexToSelectTextBlock.Foreground = new SolidColorBrush(Colors.DarkRed);
00204                     return -2;
00205                 }
00206                 IndexToSelectTextBlock.Foreground = new SolidColorBrush(Colors.Black);
00207                 return value;
00208             }
00209             IndexToSelectTextBlock.Foreground = new SolidColorBrush(Colors.DarkRed);
00210             return -2;
00211         }
00212
00213         private void UpdateDisplayRadioButtonButton_Click(object sender, RoutedEventArgs e)
00214         {
00215             UpdateDisplayRadioButton();
00216         }
00217         private void InsertDisplayRadioButtonButton_Click(object sender, RoutedEventArgs e)
00218         {
00219             if(UpdateDisplayRadioButton())
00220             {
00221                 var radioButton = new RadioButton();
00222                 radioButton.Content = DisplayRadioButton.Content;
00223                 radioButton.IsEnabled = !(bool)CustomDisabledCheckBox.IsChecked;
00224                 radioButton.IsChecked = (bool)CustomCheckedCheckBox.IsChecked;
00225                 m_radioButtonItemCollection.Insert(Int32.Parse(CustomIndexTextBox.Text), radioButton);
00226
00227                 if (SourceComboBox.SelectedItem == ItemsComboBoxItem)
00228                 {
00229                     UpdateRadioButtonsSource();
00230                 }
00231             }
00232             TestRadioButtons_SelectionChanged(null, null);
00233         }
00234
00235         private void FocusSelectedItemButton_Clicked(object sender, RoutedEventArgs e)
00236         {
00237             var stackPanel = VisualTreeHelper.GetChild(TestRadioButtons, 0);
00238             var repeater = (ItemsRepeater)VisualTreeHelper.GetChild(stackPanel, 1);
00239             ((Control)repeater.TryGetElement(TestRadioButtons.SelectedIndex)).Focus(FocusState.Keyboard);
00240         }
00241
00242         private void SetBorderWidthButton_Click(object sender, RoutedEventArgs e)
00243         {
00244             if(this.BorderWidthTextBox.Text == "inf")
00245             {
00246                 this.TestRadioButtonsBorder.Width = float.NaN;
00247                 this.BorderWidthTextBox.BorderBrush = new SolidColorBrush(Colors.Black);
00248             }
00249             else
00250             {
00251                 if(float.TryParse(this.BorderWidthTextBox.Text, out float value))
00252                 {
00253                     this.TestRadioButtonsBorder.Width = value;
00254                     this.BorderWidthTextBox.BorderBrush = new SolidColorBrush(Colors.Black);
00255                 }
00256                 else
00257                 {
00258                     this.BorderWidthTextBox.BorderBrush = new SolidColorBrush(Colors.DarkRed);
00259                 }
00260             }
00261         }
00262
00263         private void Select5ThenChangeSourceButton_Clicked(object sender, RoutedEventArgs e)
00264         {
00265             TestRadioButtons.SelectedIndex = 5;
00266             ItemTypeComboBox.SelectedIndex = (ItemTypeComboBox.SelectedIndex + 1) % 2;
00267         }
00268
00269         private void ClearRadioButtonsEventsButton_Click(object sender, RoutedEventArgs e)
00270         {
00271         }
00272
00273         private void UpdateRadioButtonsSource()
00274         {
00275             if (m_loaded)
00276             {
00277                 var source = SourceComboBox.SelectedItem;
00278                 if (source == ItemsComboBoxItem)
00279                 {
00280                     TestRadioButtons.Items.Clear();
00281                     TestRadioButtons.ItemsSource = null;
00282                     foreach (var item in GetItemsCollection())
00283                     {
00284                         TestRadioButtons.Items.Add(item);
00285                     }
00286                 }
00287                 else if (source == ItemsSourceComboBoxItem)
00288                 {
00289                     TestRadioButtons.ItemsSource = GetItemsCollection();
00290                     TestRadioButtons.Items.Clear();
00291                 }
00292             }
00293         }
00294
00295         private IEnumerable GetItemsCollection()
00296         {
00297             if (ItemTypeComboBox.SelectedItem == StringsComboBoxItem)
00298             {
00299                 InsertDisplayRadioButtonButton.IsEnabled = false;
00300                 return m_stringItemCollection;
00301             }
00302             else
00303             {
00304                 InsertDisplayRadioButtonButton.IsEnabled = true;
00305                 return m_radioButtonItemCollection;
00306             }
00307         }
00308
00309         private bool UpdateDisplayRadioButton()
00310         {
00311             if (UInt32.TryParse(CustomIndexTextBox.Text, out uint value))
00312             {
00313                 if (value > m_radioButtonItemCollection.Count)
00314                 {
00315                     DisplayRadioButtonErrorMessage.Text = "Index out of Range";
00316                     DisplayRadioButtonErrorMessage.Foreground = new SolidColorBrush(Colors.DarkRed);
00317                     return false;
00318                 }
00319             }
00320             else
00321             {
00322                 DisplayRadioButtonErrorMessage.Text = "Malformed Index";
00323                 DisplayRadioButtonErrorMessage.Foreground = new SolidColorBrush(Colors.DarkRed);
00324                 return false;
00325             }
00326
00327             DisplayRadioButton.Content = CustomContentTextBox.Text;
00328
00329             DisplayRadioButtonErrorMessage.Text = "Okay";
00330             DisplayRadioButtonErrorMessage.Foreground = new SolidColorBrush(Colors.Green);
00331             return true;
00332         }
00333     }
00334 }
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/TestUI/ScrollViewBlankPage.xaml.cs Source File

  • ScrollView
  • TestUI

ScrollViewBlankPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.Generic;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Navigation;
00007
00008 using ScrollPresenter = Microsoft.UI.Xaml.Controls.Primitives.ScrollPresenter;
00009 using ScrollView = Microsoft.UI.Xaml.Controls.ScrollView;
00010 using ScrollingScrollOptions = Microsoft.UI.Xaml.Controls.ScrollingScrollOptions;
00011 using ScrollingAnimationMode = Microsoft.UI.Xaml.Controls.ScrollingAnimationMode;
00012 using ScrollingSnapPointsMode = Microsoft.UI.Xaml.Controls.ScrollingSnapPointsMode;
00013 using ScrollingScrollStartingEventArgs = Microsoft.UI.Xaml.Controls.ScrollingScrollStartingEventArgs;
00014 using ScrollingZoomStartingEventArgs = Microsoft.UI.Xaml.Controls.ScrollingZoomStartingEventArgs;
00015 using ScrollingScrollAnimationStartingEventArgs = Microsoft.UI.Xaml.Controls.ScrollingScrollAnimationStartingEventArgs;
00016 using ScrollingZoomAnimationStartingEventArgs = Microsoft.UI.Xaml.Controls.ScrollingZoomAnimationStartingEventArgs;
00017 using ScrollingScrollCompletedEventArgs = Microsoft.UI.Xaml.Controls.ScrollingScrollCompletedEventArgs;
00018 using ScrollingZoomCompletedEventArgs = Microsoft.UI.Xaml.Controls.ScrollingZoomCompletedEventArgs;
00019 using MUXControlsTestHooks = Microsoft.UI.Private.Controls.MUXControlsTestHooks;
00020 using MUXControlsTestHooksLoggingMessageEventArgs = Microsoft.UI.Private.Controls.MUXControlsTestHooksLoggingMessageEventArgs;
00021 using ScrollViewTestHooks = Microsoft.UI.Private.Controls.ScrollViewTestHooks;
00022
00023 namespace MUXControlsTestApp
00024 {
00025     public sealed partial class ScrollViewBlankPage : TestPage
00026     {
00027         private object asyncEventReportingLock = new object();
00028         private List<string> lstAsyncEventMessage = new List<string>();
00029
00030         public ScrollViewBlankPage()
00031         {
00032             this.InitializeComponent();
00033
00034             if (chkLogScrollViewMessages.IsChecked == true || chkLogScrollPresenterMessages.IsChecked == true)
00035             {
00036                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00037
00038                 if (chkLogScrollPresenterMessages.IsChecked == true)
00039                 {
00040                     MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00041                 }
00042                 if (chkLogScrollViewMessages.IsChecked == true)
00043                 {
00044                     MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00045                 }
00046             }
00047         }
00048
00049         ~ScrollViewBlankPage()
00050         {
00051         }
00052
00053         protected override void OnNavigatedFrom(NavigationEventArgs e)
00054         {
00055             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00056             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00057
00058             MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00059
00060             base.OnNavigatedFrom(e);
00061         }
00062
00063         private void ChkCustomUI_Checked(object sender, RoutedEventArgs e)
00064         {
00065             if (grdCustomUI != null)
00066                 grdCustomUI.Visibility = Visibility.Visible;
00067         }
00068
00069         private void ChkCustomUI_Unchecked(object sender, RoutedEventArgs e)
00070         {
00071             if (grdCustomUI != null)
00072                 grdCustomUI.Visibility = Visibility.Collapsed;
00073         }
00074
00075         private void ChkLogs_Checked(object sender, RoutedEventArgs e)
00076         {
00077             if (grdLogs != null)
00078                 grdLogs.Visibility = Visibility.Visible;
00079         }
00080
00081         private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
00082         {
00083             if (grdLogs != null)
00084                 grdLogs.Visibility = Visibility.Collapsed;
00085         }
00086
00087         private void ScrollView_Loaded(object sender, RoutedEventArgs e)
00088         {
00089             AppendAsyncEventMessage($"ScrollView.Loaded");
00090             if (chkLogScrollPresenterEvents.IsChecked == true)
00091             {
00092                 LogScrollPresenterInfo();
00093             }
00094             LogScrollViewInfo();
00095         }
00096
00097         private void ScrollView_SizeChanged(object sender, SizeChangedEventArgs e)
00098         {
00099             AppendAsyncEventMessage($"ScrollView.SizeChanged Size={scrollView.ActualWidth}, {scrollView.ActualHeight}");
00100             if (chkLogScrollPresenterEvents.IsChecked == true)
00101             {
00102                 LogScrollPresenterInfo();
00103             }
00104             LogScrollViewInfo();
00105         }
00106
00107         private void ScrollView_GettingFocus(UIElement sender, Microsoft.UI.Xaml.Input.GettingFocusEventArgs args)
00108         {
00109             FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
00110             string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
00111             FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
00112             string newFEName = (newFE == null) ? "null" : newFE.Name;
00113
00114             AppendAsyncEventMessage($"ScrollView.GettingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
00115         }
00116
00117         private void ScrollView_LostFocus(object sender, RoutedEventArgs e)
00118         {
00119             AppendAsyncEventMessage("ScrollView.LostFocus");
00120         }
00121
00122         private void ScrollView_LosingFocus(UIElement sender, Microsoft.UI.Xaml.Input.LosingFocusEventArgs args)
00123         {
00124             FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
00125             string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
00126             FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
00127             string newFEName = (newFE == null) ? "null" : newFE.Name;
00128
00129             AppendAsyncEventMessage($"ScrollView.LosingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
00130         }
00131
00132         private void ScrollView_GotFocus(object sender, RoutedEventArgs e)
00133         {
00134             AppendAsyncEventMessage("ScrollView.GotFocus");
00135         }
00136
00137         private void ScrollPresenter_Loaded(object sender, RoutedEventArgs e)
00138         {
00139             AppendAsyncEventMessage($"ScrollPresenter.Loaded");
00140             LogScrollPresenterInfo();
00141             if (chkLogScrollViewEvents.IsChecked == true)
00142             {
00143                 LogScrollViewInfo();
00144             }
00145         }
00146
00147         private void ScrollPresenter_SizeChanged(object sender, SizeChangedEventArgs e)
00148         {
00149             AppendAsyncEventMessage($"ScrollPresenter.SizeChanged Size={scrollView.ActualWidth}, {scrollView.ActualHeight}");
00150             LogScrollPresenterInfo();
00151             if (chkLogScrollViewEvents.IsChecked == true)
00152             {
00153                 LogScrollViewInfo();
00154             }
00155         }
00156
00157         private void ScrollPresenter_ExtentChanged(ScrollPresenter sender, object args)
00158         {
00159             AppendAsyncEventMessage("ScrollPresenter.ExtentChanged ExtentWidth={sender.ExtentWidth}, ExtentHeight={sender.ExtentHeight}");
00160         }
00161
00162         private void ScrollPresenter_StateChanged(ScrollPresenter sender, object args)
00163         {
00164             AppendAsyncEventMessage($"ScrollPresenter.StateChanged {sender.State.ToString()}");
00165         }
00166
00167         private void ScrollPresenter_ViewChanged(ScrollPresenter sender, object args)
00168         {
00169             AppendAsyncEventMessage($"ScrollPresenter.ViewChanged HorizontalOffset={sender.HorizontalOffset}, VerticalOffset={sender.VerticalOffset}, ZoomFactor={sender.ZoomFactor}");
00170         }
00171
00172         private void ScrollPresenter_ScrollStarting(ScrollPresenter sender, ScrollingScrollStartingEventArgs args)
00173         {
00174             AppendAsyncEventMessage($"ScrollPresenter.ScrollStarting OffsetsChangeCorrelationId={args.CorrelationId}, HorizontalOffset={args.HorizontalOffset}, VerticalOffset={args.VerticalOffset}, ZoomFactor={args.ZoomFactor}");
00175         }
00176
00177         private void ScrollPresenter_ZoomStarting(ScrollPresenter sender, ScrollingZoomStartingEventArgs args)
00178         {
00179             AppendAsyncEventMessage($"ScrollPresenter.ZoomStarting ZoomFactorChangeCorrelationId={args.CorrelationId}, HorizontalOffset={args.HorizontalOffset}, VerticalOffset={args.VerticalOffset}, ZoomFactor={args.ZoomFactor}");
00180         }
00181
00182         private void ScrollPresenter_ScrollAnimationStarting(ScrollPresenter sender, ScrollingScrollAnimationStartingEventArgs args)
00183         {
00184             AppendAsyncEventMessage($"ScrollPresenter.ScrollAnimationStarting OffsetsChangeCorrelationId={args.CorrelationId}, SP=({args.StartPosition.X}, {args.StartPosition.Y}), EP=({args.EndPosition.X}, {args.EndPosition.Y})");
00185         }
00186
00187         private void ScrollPresenter_ZoomAnimationStarting(ScrollPresenter sender, ScrollingZoomAnimationStartingEventArgs args)
00188         {
00189             AppendAsyncEventMessage($"ScrollPresenter.ZoomAnimationStarting ZoomFactorChangeCorrelationId={args.CorrelationId}, CenterPoint={args.CenterPoint}, SZF={args.StartZoomFactor}, EZF={args.EndZoomFactor}");
00190         }
00191
00192         private void ScrollPresenter_ScrollCompleted(ScrollPresenter sender, ScrollingScrollCompletedEventArgs args)
00193         {
00194             AppendAsyncEventMessage($"ScrollPresenter.ScrollCompleted OffsetsChangeCorrelationId={args.CorrelationId}");
00195         }
00196
00197         private void ScrollPresenter_ZoomCompleted(ScrollPresenter sender, ScrollingZoomCompletedEventArgs args)
00198         {
00199             AppendAsyncEventMessage($"ScrollPresenter.ZoomCompleted ZoomFactorChangeCorrelationId={args.CorrelationId}");
00200         }
00201
00202         private void ScrollView_ExtentChanged(ScrollView sender, object args)
00203         {
00204             AppendAsyncEventMessage($"ScrollView.ExtentChanged ExtentWidth={sender.ExtentWidth}, ExtentHeight={sender.ExtentHeight}");
00205         }
00206
00207         private void ScrollView_StateChanged(ScrollView sender, object args)
00208         {
00209             AppendAsyncEventMessage($"ScrollView.StateChanged {sender.State.ToString()}");
00210         }
00211
00212         private void ScrollView_ViewChanged(ScrollView sender, object args)
00213         {
00214             AppendAsyncEventMessage($"ScrollView.ViewChanged HorizontalOffset={sender.HorizontalOffset}, VerticalOffset={sender.VerticalOffset}, ZoomFactor={sender.ZoomFactor}");
00215         }
00216
00217         private void ScrollView_ScrollStarting(ScrollView sender, ScrollingScrollStartingEventArgs args)
00218         {
00219             AppendAsyncEventMessage($"ScrollView.ScrollStarting OffsetsChangeCorrelationId={args.CorrelationId}, HorizontalOffset={args.HorizontalOffset}, VerticalOffset={args.VerticalOffset}, ZoomFactor={args.ZoomFactor}");
00220         }
00221
00222         private void ScrollView_ZoomStarting(ScrollView sender, ScrollingZoomStartingEventArgs args)
00223         {
00224             AppendAsyncEventMessage($"ScrollView.ZoomStarting ZoomFactorChangeCorrelationId={args.CorrelationId}, HorizontalOffset={args.HorizontalOffset}, VerticalOffset={args.VerticalOffset}, ZoomFactor={args.ZoomFactor}");
00225         }
00226
00227         private void ScrollView_ScrollAnimationStarting(ScrollView sender, ScrollingScrollAnimationStartingEventArgs args)
00228         {
00229             AppendAsyncEventMessage($"ScrollView.ScrollAnimationStarting OffsetsChangeCorrelationId={args.CorrelationId}");
00230         }
00231
00232         private void ScrollView_ZoomAnimationStarting(ScrollView sender, ScrollingZoomAnimationStartingEventArgs args)
00233         {
00234             AppendAsyncEventMessage($"ScrollView.ZoomAnimationStarting ZoomFactorChangeCorrelationId={args.CorrelationId}, CenterPoint={args.CenterPoint}");
00235         }
00236
00237         private void ScrollView_ScrollCompleted(ScrollView sender, ScrollingScrollCompletedEventArgs args)
00238         {
00239             AppendAsyncEventMessage($"ScrollView.ScrollCompleted OffsetsChangeCorrelationId={args.CorrelationId}");
00240         }
00241
00242         private void ScrollView_ZoomCompleted(ScrollView sender, ScrollingZoomCompletedEventArgs args)
00243         {
00244             AppendAsyncEventMessage($"ScrollView.ZoomCompleted ZoomFactorChangeCorrelationId={args.CorrelationId}");
00245         }
00246
00247         private void LogScrollPresenterInfo()
00248         {
00249             ScrollPresenter scrollPresenter = scrollView.ScrollPresenter;
00250
00251             AppendAsyncEventMessage($"ScrollPresenter Info: HorizontalOffset={scrollPresenter.HorizontalOffset}, VerticalOffset={scrollPresenter.VerticalOffset}, ZoomFactor={scrollPresenter.ZoomFactor}");
00252             AppendAsyncEventMessage($"ScrollPresenter Info: ViewportWidth={scrollPresenter.ViewportWidth}, ExtentHeight={scrollPresenter.ViewportHeight}");
00253             AppendAsyncEventMessage($"ScrollPresenter Info: ExtentWidth={scrollPresenter.ExtentWidth}, ExtentHeight={scrollPresenter.ExtentHeight}");
00254             AppendAsyncEventMessage($"ScrollPresenter Info: ScrollableWidth={scrollPresenter.ScrollableWidth}, ScrollableHeight={scrollPresenter.ScrollableHeight}");
00255         }
00256
00257         private void LogScrollViewInfo()
00258         {
00259             AppendAsyncEventMessage($"ScrollView Info: HorizontalOffset={scrollView.HorizontalOffset}, VerticalOffset={scrollView.VerticalOffset}, ZoomFactor={scrollView.ZoomFactor}");
00260             AppendAsyncEventMessage($"ScrollView Info: ViewportWidth={scrollView.ViewportWidth}, ExtentHeight={scrollView.ViewportHeight}");
00261             AppendAsyncEventMessage($"ScrollView Info: ExtentWidth={scrollView.ExtentWidth}, ExtentHeight={scrollView.ExtentHeight}");
00262             AppendAsyncEventMessage($"ScrollView Info: ScrollableWidth={scrollView.ScrollableWidth}, ScrollableHeight={scrollView.ScrollableHeight}");
00263         }
00264
00265         private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
00266         {
00267             lstLogs.Items.Clear();
00268         }
00269
00270         private void ChkLogScrollPresenterEvents_Checked(object sender, RoutedEventArgs e)
00271         {
00272             if (scrollView != null)
00273             {
00274                 ScrollPresenter scrollPresenter = scrollView.ScrollPresenter;
00275
00276                 if (scrollPresenter != null)
00277                 {
00278                     scrollPresenter.Loaded += ScrollPresenter_Loaded;
00279                     scrollPresenter.SizeChanged += ScrollPresenter_SizeChanged;
00280                     scrollPresenter.ExtentChanged += ScrollPresenter_ExtentChanged;
00281                     scrollPresenter.StateChanged += ScrollPresenter_StateChanged;
00282                     scrollPresenter.ViewChanged += ScrollPresenter_ViewChanged;
00283                     scrollPresenter.ScrollStarting += ScrollPresenter_ScrollStarting;
00284                     scrollPresenter.ZoomStarting += ScrollPresenter_ZoomStarting;
00285                     scrollPresenter.ScrollAnimationStarting += ScrollPresenter_ScrollAnimationStarting;
00286                     scrollPresenter.ZoomAnimationStarting += ScrollPresenter_ZoomAnimationStarting;
00287                     scrollPresenter.ScrollCompleted += ScrollPresenter_ScrollCompleted;
00288                     scrollPresenter.ZoomCompleted += ScrollPresenter_ZoomCompleted;
00289                 }
00290             }
00291         }
00292
00293         private void ChkLogScrollPresenterEvents_Unchecked(object sender, RoutedEventArgs e)
00294         {
00295             if (scrollView != null)
00296             {
00297                 ScrollPresenter scrollPresenter = scrollView.ScrollPresenter;
00298
00299                 if (scrollPresenter != null)
00300                 {
00301                     scrollPresenter.Loaded -= ScrollPresenter_Loaded;
00302                     scrollPresenter.SizeChanged -= ScrollPresenter_SizeChanged;
00303                     scrollPresenter.ExtentChanged -= ScrollPresenter_ExtentChanged;
00304                     scrollPresenter.StateChanged -= ScrollPresenter_StateChanged;
00305                     scrollPresenter.ViewChanged -= ScrollPresenter_ViewChanged;
00306                     scrollPresenter.ScrollStarting -= ScrollPresenter_ScrollStarting;
00307                     scrollPresenter.ZoomStarting -= ScrollPresenter_ZoomStarting;
00308                     scrollPresenter.ScrollAnimationStarting -= ScrollPresenter_ScrollAnimationStarting;
00309                     scrollPresenter.ZoomAnimationStarting -= ScrollPresenter_ZoomAnimationStarting;
00310                     scrollPresenter.ScrollCompleted -= ScrollPresenter_ScrollCompleted;
00311                     scrollPresenter.ZoomCompleted -= ScrollPresenter_ZoomCompleted;
00312                 }
00313             }
00314         }
00315
00316         private void ChkLogScrollViewEvents_Checked(object sender, RoutedEventArgs e)
00317         {
00318             if (scrollView != null)
00319             {
00320                 scrollView.GettingFocus += ScrollView_GettingFocus;
00321                 scrollView.GotFocus += ScrollView_GotFocus;
00322                 scrollView.LosingFocus += ScrollView_LosingFocus;
00323                 scrollView.LostFocus += ScrollView_LostFocus;
00324                 scrollView.Loaded += ScrollView_Loaded;
00325                 scrollView.SizeChanged += ScrollView_SizeChanged;
00326                 scrollView.ExtentChanged += ScrollView_ExtentChanged;
00327                 scrollView.StateChanged += ScrollView_StateChanged;
00328                 scrollView.ViewChanged += ScrollView_ViewChanged;
00329                 scrollView.ScrollStarting += ScrollView_ScrollStarting;
00330                 scrollView.ZoomStarting += ScrollView_ZoomStarting;
00331                 scrollView.ScrollAnimationStarting += ScrollView_ScrollAnimationStarting;
00332                 scrollView.ZoomAnimationStarting += ScrollView_ZoomAnimationStarting;
00333                 scrollView.ScrollCompleted += ScrollView_ScrollCompleted;
00334                 scrollView.ZoomCompleted += ScrollView_ZoomCompleted;
00335             }
00336         }
00337
00338         private void ChkLogScrollViewEvents_Unchecked(object sender, RoutedEventArgs e)
00339         {
00340             if (scrollView != null)
00341             {
00342                 scrollView.GettingFocus -= ScrollView_GettingFocus;
00343                 scrollView.GotFocus -= ScrollView_GotFocus;
00344                 scrollView.LosingFocus -= ScrollView_LosingFocus;
00345                 scrollView.LostFocus -= ScrollView_LostFocus;
00346                 scrollView.Loaded -= ScrollView_Loaded;
00347                 scrollView.SizeChanged -= ScrollView_SizeChanged;
00348                 scrollView.ExtentChanged -= ScrollView_ExtentChanged;
00349                 scrollView.StateChanged -= ScrollView_StateChanged;
00350                 scrollView.ViewChanged -= ScrollView_ViewChanged;
00351                 scrollView.ScrollStarting -= ScrollView_ScrollStarting;
00352                 scrollView.ZoomStarting -= ScrollView_ZoomStarting;
00353                 scrollView.ScrollAnimationStarting -= ScrollView_ScrollAnimationStarting;
00354                 scrollView.ZoomAnimationStarting -= ScrollView_ZoomAnimationStarting;
00355                 scrollView.ScrollCompleted -= ScrollView_ScrollCompleted;
00356                 scrollView.ZoomCompleted -= ScrollView_ZoomCompleted;
00357             }
00358         }
00359
00360         private void ChkLogScrollPresenterMessages_Checked(object sender, RoutedEventArgs e)
00361         {
00362             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00363             if (chkLogScrollViewMessages.IsChecked == false)
00364                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00365         }
00366
00367         private void ChkLogScrollPresenterMessages_Unchecked(object sender, RoutedEventArgs e)
00368         {
00369             MUXControlsTestHooks.SetLoggingLevelForType("ScrollPresenter", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00370             if (chkLogScrollViewMessages.IsChecked == false)
00371                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00372         }
00373
00374         private void ChkLogScrollViewMessages_Checked(object sender, RoutedEventArgs e)
00375         {
00376             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
00377             if (chkLogScrollPresenterMessages.IsChecked == false)
00378                 MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
00379         }
00380
00381         private void ChkLogScrollViewMessages_Unchecked(object sender, RoutedEventArgs e)
00382         {
00383             MUXControlsTestHooks.SetLoggingLevelForType("ScrollView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
00384             if (chkLogScrollPresenterMessages.IsChecked == false)
00385                 MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
00386         }
00387
00388         private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
00389         {
00390             // Cut off the terminating new line.
00391             string msg = args.Message.Substring(0, args.Message.Length - 1);
00392             string asyncEventMessage = string.Empty;
00393             string senderName = string.Empty;
00394
00395             try
00396             {
00397                 FrameworkElement fe = sender as FrameworkElement;
00398
00399                 if (fe != null)
00400                 {
00401                     senderName = "s:" + fe.Name + ", ";
00402                 }
00403             }
00404             catch
00405             {
00406             }
00407
00408             if (args.IsVerboseLevel)
00409             {
00410                 asyncEventMessage = "Verbose: " + senderName + "m:" + msg;
00411             }
00412             else
00413             {
00414                 asyncEventMessage = "Info: " + senderName + "m:" + msg;
00415             }
00416
00417             AppendAsyncEventMessage(asyncEventMessage);
00418         }
00419
00420         private void AppendAsyncEventMessage(string asyncEventMessage)
00421         {
00422             lock (asyncEventReportingLock)
00423             {
00424                 while (asyncEventMessage.Length > 0)
00425                 {
00426                     string msgHead = asyncEventMessage;
00427
00428                     if (asyncEventMessage.Length > 110)
00429                     {
00430                         int commaIndex = asyncEventMessage.IndexOf(',', 110);
00431                         if (commaIndex != -1)
00432                         {
00433                             msgHead = asyncEventMessage.Substring(0, commaIndex);
00434                             asyncEventMessage = asyncEventMessage.Substring(commaIndex + 1);
00435                         }
00436                         else
00437                         {
00438                             asyncEventMessage = string.Empty;
00439                         }
00440                     }
00441                     else
00442                     {
00443                         asyncEventMessage = string.Empty;
00444                     }
00445
00446                     lstAsyncEventMessage.Add(msgHead);
00447                 }
00448                 var ignored = this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, AppendAsyncEventMessage);
00449
00450             }
00451         }
00452
00453         private void AppendAsyncEventMessage()
00454         {
00455             lock (asyncEventReportingLock)
00456             {
00457                 foreach (string asyncEventMessage in lstAsyncEventMessage)
00458                 {
00459                     lstLogs.Items.Add(asyncEventMessage);
00460                 }
00461                 lstAsyncEventMessage.Clear();
00462             }
00463         }
00464
00465         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00466         {
00467             txtExceptionReport.Text = string.Empty;
00468         }
00469     }
00470 }
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Flex Member List

This is the complete list of members for Flex, including all inherited members.
AlignContent | Flex |
AlignContentProperty | Flex | [static]
AlignItems | Flex |
AlignItemsProperty | Flex | [static]
AlignSelfProperty | Flex | [static]
ArrangeOverride(NonVirtualizingLayoutContext context, Size finalSize) | Flex | [inline, protected]
NonVirtualizingLayout::ArrangeOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &finalSize) | NonVirtualizingLayout | [virtual]
Cross(Size size) | Flex | [inline, private]
FlexBasisProperty | Flex | [static]
FlexDirection | Flex |
FlexDirectionProperty | Flex | [static]
FlexGrowProperty | Flex | [static]
FlexShrinkProperty | Flex | [static]
FlexWrap | Flex |
FlexWrapProperty | Flex | [static]
GetAlignSelf(DependencyObject obj) | Flex | [inline, static]
GetContentAlignedCrossOffset(double extraCrossSpaceInExtent, int lineIndex, FlexState state) | Flex | [inline, private]
GetContentJustifiedMainOffset(int countInLine, double extraMainSpace, int itemIndex) | Flex | [inline, private]
GetFlexBasis(DependencyObject obj) | Flex | [inline, static]
GetFlexGrow(DependencyObject obj) | Flex | [inline, static]
GetFlexShrink(DependencyObject obj) | Flex | [inline, static]
GetItemsAlignedCrossOffset(LineInfo line, double itemCrossSize, AlignItems alignment) | Flex | [inline, private]
GrowLineIfNeeded(ref LineInfo currentLine, IReadOnlyList< UIElement > children, Size availableSize, bool isReverse) | Flex | [inline, private]
InitializeForContextCore(NonVirtualizingLayoutContext context) | Flex | [inline, protected]
NonVirtualizingLayout::InitializeForContextCore(winrt::LayoutContext const &context) | NonVirtualizingLayout | [virtual]
JustifyContent | Flex |
JustifyContentProperty | Flex | [static]
Main(Size size) | Flex | [inline, private]
MeasureOverride(NonVirtualizingLayoutContext context, Size availableSize) | Flex | [inline, protected]
NonVirtualizingLayout::MeasureOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &availableSize) | NonVirtualizingLayout | [virtual]
NonVirtualizingLayout() | NonVirtualizingLayout |
OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | Flex | [inline, private, static]
Rect(double main, double cross, double mainSize, double crossSize) | Flex | [inline, private]
SetAlignSelf(DependencyObject obj, AlignItems value) | Flex | [inline, static]
SetFlexBasis(DependencyObject obj, int value) | Flex | [inline, static]
SetFlexGrow(DependencyObject obj, int value) | Flex | [inline, static]
SetFlexShrink(DependencyObject obj, int value) | Flex | [inline, static]
ShrinkLineIfNeeded(ref LineInfo currentLine, IReadOnlyList< UIElement > children, Size availableSize, bool isReverse) | Flex | [inline, private]
Size(double main, double cross) | Flex | [inline, private]
State(NonVirtualizingLayoutContext context) | Flex | [inline, private]
UninitializeForContextCore(NonVirtualizingLayoutContext context) | Flex | [inline, protected]
NonVirtualizingLayout::UninitializeForContextCore(winrt::LayoutContext const &context) | NonVirtualizingLayout | [virtual]
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: MapControl/MapElement.cpp Source File

  • MapControl

MapElement.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MapElement.h"
00007 #include "RuntimeProfiler.h"
00008 #include "ResourceAccessor.h"
00009
00010
00011 MapElement::MapElement()
00012 {
00013 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RatingControl Member List

This is the complete list of members for RatingControl, including all inherited members.
abi_enter() | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
ActualRatingFontSize() | RatingControl | [private]
ApplyScaleExpressionAnimation(const winrt::UIElement &uiElement, int starIndex) | RatingControl | [private]
CalculateActualRatingWidth() | RatingControl | [private]
CalculateStarCenter(int starIndex) | RatingControl | [private]
CalculateTotalRatingControlWidth() | RatingControl | [private]
Caption(winrt::hstring const &value) | RatingControlProperties |
Caption() | RatingControlProperties |
CaptionProperty() | RatingControlProperties | [inline, static]
ChangeRatingBy(double increase, bool originatedFromMouse) | RatingControl | [private]
CheckThread() | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
ClearProperties() | RatingControlProperties | [static]
CoerceValueBetweenMinAndMax(double value) | RatingControl | [private]
CustomizeRatingItem(const winrt::UIElement &ui, RatingControlStates type) | RatingControl | [private]
CustomizeStackPanel(const winrt::StackPanel &stackPanel, RatingControlStates state) | RatingControl | [private]
DeleteInstanceOnUIThread(std::unique_ptr< RatingControl > &&self) noexcept | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline, static]
EnsureProperties() | RatingControlProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
EnsureResourcesLoaded() | RatingControl | [private]
EnterGamepadEngagementMode() | RatingControl | [private]
ExitGamepadEngagementMode() | RatingControl | [private]
final_release(std::unique_ptr< RatingControl > &&self) | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline, static]
GetAppropriateGlyph(RatingControlStates type) | RatingControl | [private]
GetAppropriateImageSource(RatingControlStates type) | RatingControl | [private]
GetBase() | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
GetInner() | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
GetNextGlyphIfNull(winrt::hstring glyph, RatingControlStates fallbackType=RatingControlStates::Set) | RatingControl | [private]
GetNextImageIfNull(winrt::ImageSource image, RatingControlStates fallbackType=RatingControlStates::Set) | RatingControl | [private]
GetUISettings() | RatingControl | [private, static]
InitialSetValue(int value) | RatingControlProperties |
InitialSetValue() | RatingControlProperties |
InitialSetValueProperty() | RatingControlProperties | [inline, static]
IsClearEnabled(bool value) | RatingControlProperties |
IsClearEnabled() | RatingControlProperties |
IsClearEnabledProperty() | RatingControlProperties | [inline, static]
IsItemInfoPresentAndFontInfo() | RatingControl | [inline, private]
IsItemInfoPresentAndImageInfo() | RatingControl | [inline, private]
IsOnThread() | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
IsReadOnly(bool value) | RatingControlProperties |
IsReadOnly() | RatingControlProperties |
IsReadOnlyProperty() | RatingControlProperties | [inline, static]
ItemInfo(winrt::RatingItemInfo const &value) | RatingControlProperties |
ItemInfo() | RatingControlProperties |
ItemInfoProperty() | RatingControlProperties | [inline, static]
ItemSpacing() | RatingControl | [private]
m_valueChangedEventSource | RatingControlProperties |
MaxRating(int value) | RatingControlProperties |
MaxRating() | RatingControlProperties |
MaxRatingProperty() | RatingControlProperties | [inline, static]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
OnApplyTemplate() | RatingControl |
OnCaptionChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnCaptionPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnCaptionSizeChanged(const winrt::IInspectable &sender, const winrt::SizeChangedEventArgs &args) | RatingControl | [private]
OnCreateAutomationPeer() | RatingControl |
OnFocusDisengaged(const winrt::Control &sender, const winrt::FocusDisengagedEventArgs &args) | RatingControl | [private]
OnFocusEngaged(const winrt::Control &sender, const winrt::FocusEngagedEventArgs &args) | RatingControl | [private]
OnFontFamilyChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | RatingControl | [private]
OnInitialSetValueChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnInitialSetValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnIsClearEnabledChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnIsClearEnabledPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnIsEnabledChanged(const winrt::IInspectable &sender, const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnIsReadOnlyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnIsReadOnlyPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnItemInfoChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnItemInfoPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnKeyDown(winrt::KeyRoutedEventArgs const &e) | RatingControl |
OnMaxRatingChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnMaxRatingPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnPlaceholderValueChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnPlaceholderValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
OnPointerCancelledBackgroundStackPanel(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | RatingControl | [private]
OnPointerCaptureLostBackgroundStackPanel(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | RatingControl | [private]
OnPointerEnteredBackgroundStackPanel(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | RatingControl | [private]
OnPointerExitedBackgroundStackPanel(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | RatingControl | [private]
OnPointerMovedOverBackgroundStackPanel(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | RatingControl | [private]
OnPointerPressedBackgroundStackPanel(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | RatingControl | [private]
OnPointerReleasedBackgroundStackPanel(const winrt::IInspectable &sender, const winrt::PointerRoutedEventArgs &args) | RatingControl | [private]
OnPreviewKeyDown(winrt::KeyRoutedEventArgs const &e) | RatingControl |
OnPreviewKeyUp(winrt::KeyRoutedEventArgs const &e) | RatingControl |
OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl |
OnTextScaleFactorChanged(const winrt::UISettings &setting, const winrt::IInspectable &args) | RatingControl | [private]
OnValueChanged(const winrt::DependencyPropertyChangedEventArgs &args) | RatingControl | [private]
OnValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | RatingControlProperties | [static]
PlaceholderValue(double value) | RatingControlProperties |
PlaceholderValue() | RatingControlProperties |
PlaceholderValueProperty() | RatingControlProperties | [inline, static]
PointerExitedImpl(const winrt::PointerRoutedEventArgs &args, bool resetScaleAnimation=true) | RatingControl | [private]
PopulateStackPanelWithItems(wstring_view templateName, const winrt::StackPanel &stackPanel, RatingControlStates state) | RatingControl | [private]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
RatingControl() | RatingControl |
RatingControlProperties() | RatingControlProperties |
RecycleEvents(bool useSafeGet=false) | RatingControl | [private]
ReferenceTracker(Args &&...args) | ReferenceTracker< RatingControl, winrt::implementation::RatingControlT > | [inline]
RenderingRatingFontSize() | RatingControl | [private]
ReRenderCaption() | RatingControl | [private]
ResetControlWidth() | RatingControl | [private]
s_CaptionProperty | RatingControlProperties | [static]
s_InitialSetValueProperty | RatingControlProperties | [static]
s_IsClearEnabledProperty | RatingControlProperties | [static]
s_IsReadOnlyProperty | RatingControlProperties | [static]
s_ItemInfoProperty | RatingControlProperties | [static]
s_MaxRatingProperty | RatingControlProperties | [static]
s_PlaceholderValueProperty | RatingControlProperties | [static]
s_ValueProperty | RatingControlProperties | [static]
SetRatingTo(double newRating, bool originatedFromMouse) | RatingControl | [private]
StampOutRatingItems() | RatingControl | [private]
UpdateCaptionMargins() | RatingControl | [private]
UpdateRatingItemsAppearance() | RatingControl | [private]
Value(double value) | RatingControlProperties |
Value() | RatingControlProperties |
ValueChanged(winrt::TypedEventHandler< winrt::RatingControl, winrt::IInspectable > const &value) | RatingControlProperties |
ValueChanged(winrt::event_token const &token) | RatingControlProperties |
ValueProperty() | RatingControlProperties | [inline, static]
~RatingControl() | RatingControl |
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: InfoBar/TestUI/InfobarAxeTestage.xaml.cs Source File

  • InfoBar
  • TestUI

InfobarAxeTestage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003 namespace MUXControlsTestApp
00004 {
00005     [AxeScanTestPage(Name = "Infobar-Axe")]
00006     public sealed partial class InfobarAxeTestage : TestPage
00007     {
00008         public InfobarAxeTestage()
00009         {
00010             this.InitializeComponent();
00011         }
00012     }
00013 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/ZoomFactorChange.h Source File

  • ScrollPresenter

ZoomFactorChange.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ViewChange.h"
00007
00008 class ZoomFactorChange : public ViewChange
00009 {
00010 public:
00011     ZoomFactorChange(
00012         float zoomFactor,
00013         winrt::IReference<winrt::float2> centerPoint,
00014         ScrollPresenterViewKind zoomFactorKind,
00015         winrt::IInspectable const& options);
00016     ~ZoomFactorChange();
00017
00018     float ZoomFactor() const
00019     {
00020         return m_zoomFactor;
00021     }
00022
00023     winrt::IReference<winrt::float2> CenterPoint() const
00024     {
00025         return m_centerPoint;
00026     }
00027
00028 private:
00029     float m_zoomFactor{};
00030     winrt::IReference<winrt::float2> m_centerPoint{};
00031 };
00032
Generated on Sun Dec 1 2024 20:52:17 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TabViewItemTemplateSettingsProperties Member List

This is the complete list of members for TabViewItemTemplateSettingsProperties, including all inherited members.
ClearProperties() | TabViewItemTemplateSettingsProperties | [static]
EnsureProperties() | TabViewItemTemplateSettingsProperties | [static]
IconElement(winrt::IconElement const &value) | TabViewItemTemplateSettingsProperties |
IconElement() | TabViewItemTemplateSettingsProperties |
IconElementProperty() | TabViewItemTemplateSettingsProperties | [inline, static]
s_IconElementProperty | TabViewItemTemplateSettingsProperties | [static]
s_TabGeometryProperty | TabViewItemTemplateSettingsProperties | [static]
TabGeometry(winrt::Geometry const &value) | TabViewItemTemplateSettingsProperties |
TabGeometry() | TabViewItemTemplateSettingsProperties |
TabGeometryProperty() | TabViewItemTemplateSettingsProperties | [inline, static]
TabViewItemTemplateSettingsProperties() | TabViewItemTemplateSettingsProperties |
Generated on Sun Dec 1 2024 20:53:14 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/StackLayoutState.properties.cpp Source File

  • Generated

StackLayoutState.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "StackLayoutState.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(StackLayoutState)
00012 }
00013
00014 #include "StackLayoutState.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ItemsView/ItemsViewTestHooksFactory.h Source File

  • ItemsView

ItemsViewTestHooksFactory.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ItemsViewTestHooks.h"
Generated on Sun Dec 1 2024 20:51:57 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterProperties Member List

This is the complete list of members for ScrollPresenterProperties, including all inherited members.
AnchorRequested(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::ScrollingAnchorRequestedEventArgs > const &value) | ScrollPresenterProperties |
AnchorRequested(winrt::event_token const &token) | ScrollPresenterProperties |
Background(winrt::Brush const &value) | ScrollPresenterProperties |
Background() | ScrollPresenterProperties |
BackgroundProperty() | ScrollPresenterProperties | [inline, static]
BringingIntoView(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::ScrollingBringingIntoViewEventArgs > const &value) | ScrollPresenterProperties |
BringingIntoView(winrt::event_token const &token) | ScrollPresenterProperties |
ClearProperties() | ScrollPresenterProperties | [static]
ComputedHorizontalScrollMode(winrt::ScrollingScrollMode const &value) | ScrollPresenterProperties |
ComputedHorizontalScrollMode() | ScrollPresenterProperties |
ComputedHorizontalScrollModeProperty() | ScrollPresenterProperties | [inline, static]
ComputedVerticalScrollMode(winrt::ScrollingScrollMode const &value) | ScrollPresenterProperties |
ComputedVerticalScrollMode() | ScrollPresenterProperties |
ComputedVerticalScrollModeProperty() | ScrollPresenterProperties | [inline, static]
Content(winrt::UIElement const &value) | ScrollPresenterProperties |
Content() | ScrollPresenterProperties |
ContentOrientation(winrt::ScrollingContentOrientation const &value) | ScrollPresenterProperties |
ContentOrientation() | ScrollPresenterProperties |
ContentOrientationProperty() | ScrollPresenterProperties | [inline, static]
ContentProperty() | ScrollPresenterProperties | [inline, static]
EnsureProperties() | ScrollPresenterProperties | [static]
ExtentChanged(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::IInspectable > const &value) | ScrollPresenterProperties |
ExtentChanged(winrt::event_token const &token) | ScrollPresenterProperties |
HorizontalAnchorRatio(double value) | ScrollPresenterProperties |
HorizontalAnchorRatio() | ScrollPresenterProperties |
HorizontalAnchorRatioProperty() | ScrollPresenterProperties | [inline, static]
HorizontalScrollChainMode(winrt::ScrollingChainMode const &value) | ScrollPresenterProperties |
HorizontalScrollChainMode() | ScrollPresenterProperties |
HorizontalScrollChainModeProperty() | ScrollPresenterProperties | [inline, static]
HorizontalScrollMode(winrt::ScrollingScrollMode const &value) | ScrollPresenterProperties |
HorizontalScrollMode() | ScrollPresenterProperties |
HorizontalScrollModeProperty() | ScrollPresenterProperties | [inline, static]
HorizontalScrollRailMode(winrt::ScrollingRailMode const &value) | ScrollPresenterProperties |
HorizontalScrollRailMode() | ScrollPresenterProperties |
HorizontalScrollRailModeProperty() | ScrollPresenterProperties | [inline, static]
IgnoredInputKinds(winrt::ScrollingInputKinds const &value) | ScrollPresenterProperties |
IgnoredInputKinds() | ScrollPresenterProperties |
IgnoredInputKindsProperty() | ScrollPresenterProperties | [inline, static]
m_anchorRequestedEventSource | ScrollPresenterProperties |
m_bringingIntoViewEventSource | ScrollPresenterProperties |
m_extentChangedEventSource | ScrollPresenterProperties |
m_scrollAnimationStartingEventSource | ScrollPresenterProperties |
m_scrollCompletedEventSource | ScrollPresenterProperties |
m_scrollStartingEventSource | ScrollPresenterProperties |
m_stateChangedEventSource | ScrollPresenterProperties |
m_viewChangedEventSource | ScrollPresenterProperties |
m_zoomAnimationStartingEventSource | ScrollPresenterProperties |
m_zoomCompletedEventSource | ScrollPresenterProperties |
m_zoomStartingEventSource | ScrollPresenterProperties |
MaxZoomFactor(double value) | ScrollPresenterProperties |
MaxZoomFactor() | ScrollPresenterProperties |
MaxZoomFactorProperty() | ScrollPresenterProperties | [inline, static]
MinZoomFactor(double value) | ScrollPresenterProperties |
MinZoomFactor() | ScrollPresenterProperties |
MinZoomFactorProperty() | ScrollPresenterProperties | [inline, static]
OnBackgroundPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnComputedHorizontalScrollModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnComputedVerticalScrollModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnContentOrientationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnContentPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnHorizontalAnchorRatioPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnHorizontalScrollChainModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnHorizontalScrollModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnHorizontalScrollRailModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnIgnoredInputKindsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnMaxZoomFactorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnMinZoomFactorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnVerticalAnchorRatioPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnVerticalScrollChainModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnVerticalScrollModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnVerticalScrollRailModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnZoomChainModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
OnZoomModePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ScrollPresenterProperties | [static]
s_BackgroundProperty | ScrollPresenterProperties | [static]
s_ComputedHorizontalScrollModeProperty | ScrollPresenterProperties | [static]
s_ComputedVerticalScrollModeProperty | ScrollPresenterProperties | [static]
s_ContentOrientationProperty | ScrollPresenterProperties | [static]
s_ContentProperty | ScrollPresenterProperties | [static]
s_HorizontalAnchorRatioProperty | ScrollPresenterProperties | [static]
s_HorizontalScrollChainModeProperty | ScrollPresenterProperties | [static]
s_HorizontalScrollModeProperty | ScrollPresenterProperties | [static]
s_HorizontalScrollRailModeProperty | ScrollPresenterProperties | [static]
s_IgnoredInputKindsProperty | ScrollPresenterProperties | [static]
s_MaxZoomFactorProperty | ScrollPresenterProperties | [static]
s_MinZoomFactorProperty | ScrollPresenterProperties | [static]
s_VerticalAnchorRatioProperty | ScrollPresenterProperties | [static]
s_VerticalScrollChainModeProperty | ScrollPresenterProperties | [static]
s_VerticalScrollModeProperty | ScrollPresenterProperties | [static]
s_VerticalScrollRailModeProperty | ScrollPresenterProperties | [static]
s_ZoomChainModeProperty | ScrollPresenterProperties | [static]
s_ZoomModeProperty | ScrollPresenterProperties | [static]
ScrollAnimationStarting(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::ScrollingScrollAnimationStartingEventArgs > const &value) | ScrollPresenterProperties |
ScrollAnimationStarting(winrt::event_token const &token) | ScrollPresenterProperties |
ScrollCompleted(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::ScrollingScrollCompletedEventArgs > const &value) | ScrollPresenterProperties |
ScrollCompleted(winrt::event_token const &token) | ScrollPresenterProperties |
ScrollPresenterProperties() | ScrollPresenterProperties |
ScrollStarting(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::ScrollingScrollStartingEventArgs > const &value) | ScrollPresenterProperties |
ScrollStarting(winrt::event_token const &token) | ScrollPresenterProperties |
StateChanged(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::IInspectable > const &value) | ScrollPresenterProperties |
StateChanged(winrt::event_token const &token) | ScrollPresenterProperties |
VerticalAnchorRatio(double value) | ScrollPresenterProperties |
VerticalAnchorRatio() | ScrollPresenterProperties |
VerticalAnchorRatioProperty() | ScrollPresenterProperties | [inline, static]
VerticalScrollChainMode(winrt::ScrollingChainMode const &value) | ScrollPresenterProperties |
VerticalScrollChainMode() | ScrollPresenterProperties |
VerticalScrollChainModeProperty() | ScrollPresenterProperties | [inline, static]
VerticalScrollMode(winrt::ScrollingScrollMode const &value) | ScrollPresenterProperties |
VerticalScrollMode() | ScrollPresenterProperties |
VerticalScrollModeProperty() | ScrollPresenterProperties | [inline, static]
VerticalScrollRailMode(winrt::ScrollingRailMode const &value) | ScrollPresenterProperties |
VerticalScrollRailMode() | ScrollPresenterProperties |
VerticalScrollRailModeProperty() | ScrollPresenterProperties | [inline, static]
ViewChanged(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::IInspectable > const &value) | ScrollPresenterProperties |
ViewChanged(winrt::event_token const &token) | ScrollPresenterProperties |
ZoomAnimationStarting(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::ScrollingZoomAnimationStartingEventArgs > const &value) | ScrollPresenterProperties |
ZoomAnimationStarting(winrt::event_token const &token) | ScrollPresenterProperties |
ZoomChainMode(winrt::ScrollingChainMode const &value) | ScrollPresenterProperties |
ZoomChainMode() | ScrollPresenterProperties |
ZoomChainModeProperty() | ScrollPresenterProperties | [inline, static]
ZoomCompleted(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::ScrollingZoomCompletedEventArgs > const &value) | ScrollPresenterProperties |
ZoomCompleted(winrt::event_token const &token) | ScrollPresenterProperties |
ZoomMode(winrt::ScrollingZoomMode const &value) | ScrollPresenterProperties |
ZoomMode() | ScrollPresenterProperties |
ZoomModeProperty() | ScrollPresenterProperties | [inline, static]
ZoomStarting(winrt::TypedEventHandler< winrt::ScrollPresenter, winrt::ScrollingZoomStartingEventArgs > const &value) | ScrollPresenterProperties |
ZoomStarting(winrt::event_token const &token) | ScrollPresenterProperties |
Generated on Sun Dec 1 2024 20:53:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/LayoutTests.cs Source File

  • Repeater
  • APITests

LayoutTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common.Mocks;
00006 using MUXControlsTestApp.Utilities;
00007 using System;
00008 using System.Collections.Generic;
00009 using System.Collections.ObjectModel;
00010 using System.Linq;
00011 using System.Threading;
00012 using Windows.Foundation;
00013 using Microsoft.UI.Xaml;
00014 using Microsoft.UI.Xaml.Controls;
00015 using Microsoft.UI.Xaml.Controls.Primitives;
00016 using Microsoft.UI.Xaml.Markup;
00017 using Microsoft.UI.Xaml.Media;
00018 using Common;
00019
00020 using WEX.TestExecution;
00021 using WEX.TestExecution.Markup;
00022 using WEX.Logging.Interop;
00023
00024 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests
00025 {
00026     [TestClass]
00027     public class LayoutTests : ApiTestBase
00028     {
00029         [TestMethod]
00030         public void ValidateMappingAndAutoRecycling()
00031         {
00032             ItemsRepeater repeater = null;
00033             ScrollViewer scrollViewer = null;
00034             RunOnUIThread.Execute(() =>
00035             {
00036                 var layout = new MockVirtualizingLayout()
00037                 {
00038                     MeasureLayoutFunc = (availableSize, context) =>
00039                     {
00040                         var element0 = context.GetOrCreateElementAt(index: 0);
00041                         // lookup - repeater will give back the same element and note that this element will not
00042                         // be pinned - i.e it will be auto recycled after a measure pass where GetElementAt(0) is not called.
00043                         var element0lookup = context.GetOrCreateElementAt(index: 0, options: ElementRealizationOptions.None);
00044
00045                         var element1 = context.GetOrCreateElementAt(index: 1, options: ElementRealizationOptions.ForceCreate | ElementRealizationOptions.SuppressAutoRecycle);
00046                         // forcing a new element for index 1 that will be pinned (not auto recycled). This will be
00047                         // a completely new element. Repeater does not do the mapping/lookup when forceCreate is true.
00048                         var element1Clone = context.GetOrCreateElementAt(index: 1, options: ElementRealizationOptions.ForceCreate | ElementRealizationOptions.SuppressAutoRecycle);
00049
00050                         Verify.AreSame(element0, element0lookup);
00051                         Verify.AreNotSame(element1, element1Clone);
00052
00053                         element0.Measure(availableSize);
00054                         element1.Measure(availableSize);
00055                         element1Clone.Measure(availableSize);
00056                         return new Size(100, 100);
00057                     },
00058                 };
00059
00060                 Content = CreateAndInitializeRepeater(
00061                     itemsSource: Enumerable.Range(0, 5),
00062                     layout: layout,
00063                     elementFactory: GetDataTemplate("<Button>Hello</Button>"),
00064                     repeater: ref repeater,
00065                     scrollViewer: ref scrollViewer);
00066
00067                 Content.UpdateLayout();
00068
00069                 Verify.IsNotNull(repeater.TryGetElement(0));
00070                 Verify.IsNotNull(repeater.TryGetElement(1));
00071
00072                 layout.MeasureLayoutFunc = null;
00073
00074                 repeater.InvalidateMeasure();
00075                 Content.UpdateLayout();
00076
00077                 Verify.IsNull(repeater.TryGetElement(0)); // not pinned, should be auto recycled.
00078                 Verify.IsNotNull(repeater.TryGetElement(1)); // pinned, should stay alive
00079             });
00080         }
00081
00082         [TestMethod]
00083         public void ValidateNonVirtualLayoutWithItemsRepeater()
00084         {
00085             RunOnUIThread.Execute(() =>
00086             {
00087                 var repeater = new ItemsRepeater();
00088                 repeater.Layout = new NonVirtualStackLayout();
00089                 repeater.ItemsSource = Enumerable.Range(0, 10);
00090                 repeater.ItemTemplate = (DataTemplate)XamlReader.Load(
00091                     @"<DataTemplate  xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00092                          <Button Content='{Binding}' Height='100' />
00093                     </DataTemplate>");
00094
00095                 Content = repeater;
00096                 Content.UpdateLayout();
00097
00098                 double expectedYOffset = 0;
00099                 for (int i = 0; i < repeater.ItemsSourceView.Count; i++)
00100                 {
00101                     var child = repeater.TryGetElement(i) as Button;
00102                     Verify.IsNotNull(child);
00103                     var layoutBounds = LayoutInformation.GetLayoutSlot(child);
00104                     Verify.AreEqual(expectedYOffset, layoutBounds.Y);
00105                     Verify.AreEqual(i, child.Content);
00106                     expectedYOffset += 100;
00107                 }
00108             });
00109         }
00110
00111         [TestMethod]
00112         public void VerifyItemsRepeaterNullLayoutIsTreatedAsStackLayout()
00113         {
00114             // ItemsRepeater.Layout defaults to 'null'.
00115             // The null Layout is internally treated as a StackLayout.
00116             // Verify that it behaves correctly and that if we switch Layout away from null and back again it
00117             // continues to work correctly.
00118             RunOnUIThread.Execute(() =>
00119             {
00120                 var repeater = new ItemsRepeater();
00121                 repeater.ItemsSource = Enumerable.Range(0, 10);
00122                 repeater.ItemTemplate = (DataTemplate)XamlReader.Load(
00123                     @"<DataTemplate  xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00124                          <Button Content='{Binding}' Height='10' Width='100' />
00125                     </DataTemplate>");
00126
00127                 Action validateStackLayout = () =>
00128                 {
00129                     double expectedYOffset = 0;
00130                     for (int i = 0; i < repeater.ItemsSourceView.Count; i++)
00131                     {
00132                         var child = repeater.TryGetElement(i) as Button;
00133                         Verify.IsNotNull(child);
00134                         var layoutBounds = LayoutInformation.GetLayoutSlot(child);
00135                         Verify.AreEqual(expectedYOffset, layoutBounds.Y);
00136                         Verify.AreEqual(i, child.Content);
00137                         expectedYOffset += 10;
00138                     }
00139                 };
00140
00141                 Action validateGridLayout = () =>
00142                 {
00143                     int totalColumns = 5;
00144                     int currentCol = 0;
00145                     int currentRow = 0;
00146                     for (int i = 0; i < repeater.ItemsSourceView.Count; i++)
00147                     {
00148                         double expectedYOffset = currentRow * 10;
00149                         double expectedXOffset = currentCol * 100;
00150                         var child = repeater.TryGetElement(i) as Button;
00151                         Verify.IsNotNull(child);
00152                         var layoutBounds = LayoutInformation.GetLayoutSlot(child);
00153                         Verify.AreEqual(expectedYOffset, layoutBounds.Y);
00154                         Verify.AreEqual(expectedXOffset, layoutBounds.X);
00155                         Verify.AreEqual(i, child.Content);
00156                         currentCol++;
00157                         if(currentCol == totalColumns)
00158                         {
00159                             currentCol = 0;
00160                             currentRow++;
00161                         }
00162                     }
00163                 };
00164
00165                 Grid grid = new Grid
00166                 {
00167                     Width = 500,
00168                     Height = 500,
00169                 };
00170                 grid.Children.Add(repeater);
00171                 Content = grid;
00172
00173                 Log.Comment("Validate repeater with default 'null' Layout");
00174                 Verify.IsNull(repeater.Layout);
00175                 Content.UpdateLayout();
00176                 validateStackLayout();
00177
00178                 Log.Comment("Switch Layout to UniformGridLayout ");
00179                 var uniformGridLayout = new UniformGridLayout
00180                 {
00181                     MaximumRowsOrColumns = 5,
00182                     MinItemHeight = 10,
00183                     MinItemWidth = 100,
00184                 };
00185                 repeater.Layout = uniformGridLayout;
00186                 Content.UpdateLayout();
00187                 validateGridLayout();
00188
00189                 Log.Comment("Switch Layout back to 'null' Layout");
00190                 repeater.Layout = null;
00191                 Content.UpdateLayout();
00192                 validateStackLayout();
00193             });
00194         }
00195
00196         [TestMethod]
00197         public void ValidateNonVirtualLayoutDoesNotGetMeasuredForViewportChanges()
00198         {
00199             RunOnUIThread.Execute(() =>
00200             {
00201                 int measureCount = 0;
00202                 int arrangeCount = 0;
00203                 var repeater = new ItemsRepeater();
00204
00205                 // with a non virtualizing layout, repeater will just
00206                 // run layout once.
00207                 repeater.Layout = new MockNonVirtualizingLayout()
00208                 {
00209                     MeasureLayoutFunc = (size, context) =>
00210                     {
00211                         measureCount++;
00212                         return new Size(100, 800);
00213                     },
00214                     ArrangeLayoutFunc = (size, context) =>
00215                     {
00216                         arrangeCount++;
00217                         return new Size(100, 800);
00218                     }
00219                 };
00220
00221                 repeater.ItemsSource = Enumerable.Range(0, 10);
00222                 repeater.ItemTemplate = (DataTemplate)XamlReader.Load(
00223                     @"<DataTemplate  xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00224                          <Button Content='{Binding}' Height='100' />
00225                     </DataTemplate>");
00226
00227                 Content = new ScrollViewer()
00228                 {
00229                     Content = repeater
00230                 };
00231                 Content.UpdateLayout();
00232
00233                 Verify.AreEqual(1, measureCount);
00234                 Verify.AreEqual(1, arrangeCount);
00235
00236                 measureCount = 0;
00237                 arrangeCount = 0;
00238
00239                 // Once we switch to a virtualizing layout we should
00240                 // get at least two passes to update the viewport.
00241                 repeater.Layout = new MockVirtualizingLayout() {
00242                     MeasureLayoutFunc = (size, context) =>
00243                     {
00244                         measureCount++;
00245                         return new Size(100, 800);
00246                     },
00247                     ArrangeLayoutFunc = (size, context) =>
00248                     {
00249                         arrangeCount++;
00250                         return new Size(100, 800);
00251                     }
00252                 };
00253
00254                 Content.UpdateLayout();
00255
00256                 Verify.IsGreaterThan(measureCount, 1);
00257                 Verify.IsGreaterThan(arrangeCount, 1);
00258             });
00259         }
00260
00261         [TestMethod]
00262         public void ValidateStackLayoutDoesNotRetainIncorrectMinorWidth()
00263         {
00264             RunOnUIThread.Execute(() =>
00265             {
00266                 var repeater = new ItemsRepeater()
00267                 {
00268                     ItemsSource = Enumerable.Range(0, 1)
00269                 };
00270
00271                 Content = new ScrollViewer()
00272                 {
00273                     Content = repeater,
00274                     Width = 400,
00275                 };
00276
00277                 Content.UpdateLayout();
00278
00279                 // Measure with large width.
00280                 repeater.Measure(new Size(600, 100));
00281                 Verify.AreEqual(600, repeater.DesiredSize.Width);
00282                 // Measure with smaller width again before arrange.
00283                 // StackLayout has to pick up the smaller width for its extent.
00284                 repeater.Measure(new Size(300, 100));
00285                 Verify.AreEqual(300, repeater.DesiredSize.Width);
00286
00287                 Content.UpdateLayout();
00288                 Verify.AreEqual(400, repeater.ActualWidth);
00289             });
00290         }
00291
00292         [TestMethod]
00293         public void ValidateStackLayoutDisabledVirtualizationWithItemsRepeater()
00294         {
00295             RunOnUIThread.Execute(() =>
00296             {
00297                 var repeater = new ItemsRepeater();
00298                 var stackLayout = new StackLayout();
00299                 stackLayout.IsVirtualizationEnabled = false;
00300                 repeater.Layout = stackLayout;
00301                 repeater.ItemsSource = Enumerable.Range(0, 10);
00302                 repeater.ItemTemplate = (DataTemplate)XamlReader.Load(
00303                     @"<DataTemplate  xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00304                          <Button Content='{Binding}' Height='100' />
00305                     </DataTemplate>");
00306
00307                 var scrollViewer = new ScrollViewer() {
00308                     Content = repeater
00309                 };
00310                 scrollViewer.Height = 100;
00311                 Content = scrollViewer;
00312                 Content.UpdateLayout();
00313
00314                 for (int i = 0; i < repeater.ItemsSourceView.Count; i++)
00315                 {
00316                     var child = repeater.TryGetElement(i) as Button;
00317                     Verify.IsNotNull(child);
00318                 }
00319             });
00320         }
00321
00322         [TestMethod]
00323         public void VerifyStackLayoutCycleShortcut()
00324         {
00325             RunOnUIThread.Execute(() =>
00326             {
00327                 int measureCount = 0;
00328                 int arrangeCount = 0;
00329                 var repeater = new ItemsRepeater();
00330                 var mockStackLayout = new MockStackLayout();
00331
00332                 mockStackLayout.MeasureLayoutFunc = (size, context) =>
00333                 {
00334                     // Simulating variable sized children that cause
00335                     // the ItemsRepeater's layout to not settle.
00336                     // This would normally cause a layout cycle but the use
00337                     // of ItemsRepeater::m_stackLayoutMeasureCounter avoids it.
00338                     mockStackLayout.InvalidateMeasure();
00339                     measureCount++;
00340                     return new Size(100, 200 + measureCount);
00341                 };
00342                 mockStackLayout.ArrangeLayoutFunc = (size, context) =>
00343                 {
00344                     arrangeCount++;
00345                     return new Size(100, 200 + arrangeCount);
00346                 };
00347
00348                 repeater.Layout = mockStackLayout;
00349                 repeater.ItemsSource = Enumerable.Range(0, 10);
00350                 repeater.ItemTemplate = GetDataTemplate("<Button Content='{Binding}' Height='200'/>");
00351
00352                 Content = repeater;
00353                 Content.UpdateLayout();
00354             });
00355         }
00356
00357         [TestMethod]
00358         public void VerifyUniformGridLayoutDoesntCrashWhenTryingToScrollToEnd()
00359         {
00360             ItemsRepeater repeater = null;
00361             ScrollViewer scrollViewer = null;
00362             RunOnUIThread.Execute(() =>
00363             {
00364                 repeater = new ItemsRepeater {
00365                     ItemsSource = Enumerable.Range(0, 1000).Select(i => new Border {
00366                         Background = new SolidColorBrush(Colors.Blue),
00367                         Child = new TextBlock { Text = "#" + i }
00368                     }).ToArray(),
00369                     Layout = new UniformGridLayout {
00370                         MinItemWidth = 100,
00371                         MinItemHeight = 40,
00372                         MinRowSpacing = 10,
00373                         MinColumnSpacing = 10
00374                     }
00375                 };
00376                 scrollViewer = new ScrollViewer { Content = repeater };
00377                 Content = scrollViewer;
00378             });
00379
00380             IdleSynchronizer.Wait();
00381
00382             RunOnUIThread.Execute(() =>
00383             {
00384                 scrollViewer.ChangeView(0, repeater.ActualHeight, null);
00385             });
00386
00387             IdleSynchronizer.Wait();
00388
00389             RunOnUIThread.Execute(() =>
00390             {
00391                 scrollViewer.ChangeView(0, 0, null);
00392             });
00393
00394             IdleSynchronizer.Wait();
00395
00396             // The test guards against an app crash, so this is enough to verify
00397             Verify.IsTrue(true);
00398         }
00399
00400         private ItemsRepeaterScrollHost CreateAndInitializeRepeater(
00401            object itemsSource,
00402            VirtualizingLayout layout,
00403            object elementFactory,
00404            ref ItemsRepeater repeater,
00405            ref ScrollViewer scrollViewer)
00406         {
00407             repeater = new ItemsRepeater()
00408             {
00409                 ItemsSource = itemsSource,
00410                 Layout = layout,
00411                 ItemTemplate = elementFactory,
00412                 HorizontalCacheLength = 0,
00413                 VerticalCacheLength = 0,
00414             };
00415
00416             scrollViewer = new ScrollViewer()
00417             {
00418                 Content = repeater
00419             };
00420
00421             return new ItemsRepeaterScrollHost()
00422             {
00423                 Width = 400,
00424                 Height = 400,
00425                 ScrollViewer = scrollViewer
00426             };
00427         }
00428
00429         private DataTemplate GetDataTemplate(string content)
00430         {
00431             return (DataTemplate)XamlReader.Load(
00432                        string.Format(@"<DataTemplate
00433                             xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00434                            {0}
00435                         </DataTemplate>", content));
00436         }
00437     }
00438 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeNode Member List

This is the complete list of members for TreeNode, including all inherited members.
Children | TreeNode |
CustomAutomationName | TreeNode |
GetBreadCrumbPath() | TreeNode | [inline]
Name | TreeNode |
Parent | TreeNode | [private]
ToString() | TreeNode | [inline]
UpdateParents(TreeNode parent) | TreeNode | [inline]
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RatingItemImageInfo.properties.cpp Source File

  • Generated

RatingItemImageInfo.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RatingItemImageInfo.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(RatingItemImageInfo)
00012 }
00013
00014 #include "RatingItemImageInfo.g.cpp"
00015
00016 GlobalDependencyProperty RatingItemImageInfoProperties::s_DisabledImageProperty{ nullptr };
00017 GlobalDependencyProperty RatingItemImageInfoProperties::s_ImageProperty{ nullptr };
00018 GlobalDependencyProperty RatingItemImageInfoProperties::s_PlaceholderImageProperty{ nullptr };
00019 GlobalDependencyProperty RatingItemImageInfoProperties::s_PointerOverImageProperty{ nullptr };
00020 GlobalDependencyProperty RatingItemImageInfoProperties::s_PointerOverPlaceholderImageProperty{ nullptr };
00021 GlobalDependencyProperty RatingItemImageInfoProperties::s_UnsetImageProperty{ nullptr };
00022
00023 RatingItemImageInfoProperties::RatingItemImageInfoProperties()
00024 {
00025     EnsureProperties();
00026 }
00027
00028 void RatingItemImageInfoProperties::EnsureProperties()
00029 {
00030     if (!s_DisabledImageProperty)
00031     {
00032         s_DisabledImageProperty =
00033             InitializeDependencyProperty(
00034                 L"DisabledImage",
00035                 winrt::name_of<winrt::ImageSource>(),
00036                 winrt::name_of<winrt::RatingItemImageInfo>(),
00037                 false /* isAttached */,
00038                 ValueHelper<winrt::ImageSource>::BoxedDefaultValue(),
00039                 nullptr);
00040     }
00041     if (!s_ImageProperty)
00042     {
00043         s_ImageProperty =
00044             InitializeDependencyProperty(
00045                 L"Image",
00046                 winrt::name_of<winrt::ImageSource>(),
00047                 winrt::name_of<winrt::RatingItemImageInfo>(),
00048                 false /* isAttached */,
00049                 ValueHelper<winrt::ImageSource>::BoxedDefaultValue(),
00050                 nullptr);
00051     }
00052     if (!s_PlaceholderImageProperty)
00053     {
00054         s_PlaceholderImageProperty =
00055             InitializeDependencyProperty(
00056                 L"PlaceholderImage",
00057                 winrt::name_of<winrt::ImageSource>(),
00058                 winrt::name_of<winrt::RatingItemImageInfo>(),
00059                 false /* isAttached */,
00060                 ValueHelper<winrt::ImageSource>::BoxedDefaultValue(),
00061                 nullptr);
00062     }
00063     if (!s_PointerOverImageProperty)
00064     {
00065         s_PointerOverImageProperty =
00066             InitializeDependencyProperty(
00067                 L"PointerOverImage",
00068                 winrt::name_of<winrt::ImageSource>(),
00069                 winrt::name_of<winrt::RatingItemImageInfo>(),
00070                 false /* isAttached */,
00071                 ValueHelper<winrt::ImageSource>::BoxedDefaultValue(),
00072                 nullptr);
00073     }
00074     if (!s_PointerOverPlaceholderImageProperty)
00075     {
00076         s_PointerOverPlaceholderImageProperty =
00077             InitializeDependencyProperty(
00078                 L"PointerOverPlaceholderImage",
00079                 winrt::name_of<winrt::ImageSource>(),
00080                 winrt::name_of<winrt::RatingItemImageInfo>(),
00081                 false /* isAttached */,
00082                 ValueHelper<winrt::ImageSource>::BoxedDefaultValue(),
00083                 nullptr);
00084     }
00085     if (!s_UnsetImageProperty)
00086     {
00087         s_UnsetImageProperty =
00088             InitializeDependencyProperty(
00089                 L"UnsetImage",
00090                 winrt::name_of<winrt::ImageSource>(),
00091                 winrt::name_of<winrt::RatingItemImageInfo>(),
00092                 false /* isAttached */,
00093                 ValueHelper<winrt::ImageSource>::BoxedDefaultValue(),
00094                 nullptr);
00095     }
00096 }
00097
00098 void RatingItemImageInfoProperties::ClearProperties()
00099 {
00100     s_DisabledImageProperty = nullptr;
00101     s_ImageProperty = nullptr;
00102     s_PlaceholderImageProperty = nullptr;
00103     s_PointerOverImageProperty = nullptr;
00104     s_PointerOverPlaceholderImageProperty = nullptr;
00105     s_UnsetImageProperty = nullptr;
00106 }
00107
00108 void RatingItemImageInfoProperties::DisabledImage(winrt::ImageSource const& value)
00109 {
00110     [[gsl::suppress(con)]]
00111     {
00112     static_cast<RatingItemImageInfo*>(this)->SetValue(s_DisabledImageProperty, ValueHelper<winrt::ImageSource>::BoxValueIfNecessary(value));
00113     }
00114 }
00115
00116 winrt::ImageSource RatingItemImageInfoProperties::DisabledImage()
00117 {
00118     return ValueHelper<winrt::ImageSource>::CastOrUnbox(static_cast<RatingItemImageInfo*>(this)->GetValue(s_DisabledImageProperty));
00119 }
00120
00121 void RatingItemImageInfoProperties::Image(winrt::ImageSource const& value)
00122 {
00123     [[gsl::suppress(con)]]
00124     {
00125     static_cast<RatingItemImageInfo*>(this)->SetValue(s_ImageProperty, ValueHelper<winrt::ImageSource>::BoxValueIfNecessary(value));
00126     }
00127 }
00128
00129 winrt::ImageSource RatingItemImageInfoProperties::Image()
00130 {
00131     return ValueHelper<winrt::ImageSource>::CastOrUnbox(static_cast<RatingItemImageInfo*>(this)->GetValue(s_ImageProperty));
00132 }
00133
00134 void RatingItemImageInfoProperties::PlaceholderImage(winrt::ImageSource const& value)
00135 {
00136     [[gsl::suppress(con)]]
00137     {
00138     static_cast<RatingItemImageInfo*>(this)->SetValue(s_PlaceholderImageProperty, ValueHelper<winrt::ImageSource>::BoxValueIfNecessary(value));
00139     }
00140 }
00141
00142 winrt::ImageSource RatingItemImageInfoProperties::PlaceholderImage()
00143 {
00144     return ValueHelper<winrt::ImageSource>::CastOrUnbox(static_cast<RatingItemImageInfo*>(this)->GetValue(s_PlaceholderImageProperty));
00145 }
00146
00147 void RatingItemImageInfoProperties::PointerOverImage(winrt::ImageSource const& value)
00148 {
00149     [[gsl::suppress(con)]]
00150     {
00151     static_cast<RatingItemImageInfo*>(this)->SetValue(s_PointerOverImageProperty, ValueHelper<winrt::ImageSource>::BoxValueIfNecessary(value));
00152     }
00153 }
00154
00155 winrt::ImageSource RatingItemImageInfoProperties::PointerOverImage()
00156 {
00157     return ValueHelper<winrt::ImageSource>::CastOrUnbox(static_cast<RatingItemImageInfo*>(this)->GetValue(s_PointerOverImageProperty));
00158 }
00159
00160 void RatingItemImageInfoProperties::PointerOverPlaceholderImage(winrt::ImageSource const& value)
00161 {
00162     [[gsl::suppress(con)]]
00163     {
00164     static_cast<RatingItemImageInfo*>(this)->SetValue(s_PointerOverPlaceholderImageProperty, ValueHelper<winrt::ImageSource>::BoxValueIfNecessary(value));
00165     }
00166 }
00167
00168 winrt::ImageSource RatingItemImageInfoProperties::PointerOverPlaceholderImage()
00169 {
00170     return ValueHelper<winrt::ImageSource>::CastOrUnbox(static_cast<RatingItemImageInfo*>(this)->GetValue(s_PointerOverPlaceholderImageProperty));
00171 }
00172
00173 void RatingItemImageInfoProperties::UnsetImage(winrt::ImageSource const& value)
00174 {
00175     [[gsl::suppress(con)]]
00176     {
00177     static_cast<RatingItemImageInfo*>(this)->SetValue(s_UnsetImageProperty, ValueHelper<winrt::ImageSource>::BoxValueIfNecessary(value));
00178     }
00179 }
00180
00181 winrt::ImageSource RatingItemImageInfoProperties::UnsetImage()
00182 {
00183     return ValueHelper<winrt::ImageSource>::CastOrUnbox(static_cast<RatingItemImageInfo*>(this)->GetValue(s_UnsetImageProperty));
00184 }
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Customer Member List

This is the complete list of members for Customer, including all inherited members.
Address | Customer |
Customer(String firstName, String lastName, String address) | Customer | [inline]
FirstName | Customer |
LastName | Customer |
Generated on Sun Dec 1 2024 20:54:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressBar/TestUI/ProgressBarReTemplatePage.xaml.cs Source File

  • ProgressBar
  • TestUI

ProgressBarReTemplatePage.xaml.cs

Go to the documentation of this file.
00001 ﻿using System;
00002 using Microsoft.UI.Xaml;
00003 using Microsoft.UI.Xaml.Controls;
00004 using Microsoft.UI.Xaml.Media;
00005 using Microsoft.UI.Xaml.Shapes;
00006
00007 namespace MUXControlsTestApp
00008 {
00009     public sealed partial class ProgressBarReTemplatePage : TestPage
00010     {
00011         public ProgressBarReTemplatePage()
00012         {
00013             this.InitializeComponent();
00014             Loaded += ProgressBarReTemplatePage_Loaded;
00015         }
00016
00017         private void ProgressBarReTemplatePage_Loaded(object sender, RoutedEventArgs e)
00018         {
00019             var layoutRoot = (Grid)VisualTreeHelper.GetChild(TestProgressBar, 0);
00020
00021             VisualStateManager.GetVisualStateGroups(layoutRoot)[0].CurrentStateChanged += this.ProgressBarReTemplatePage_CurrentStateChanged;
00022             VisualStateText.Text = VisualStateManager.GetVisualStateGroups(layoutRoot)[0].CurrentState.Name;
00023
00024             var progressBarRoot = VisualTreeHelper.GetChild(layoutRoot, 1);
00025             var clip = VisualTreeHelper.GetChild(progressBarRoot, 0);
00026             var indicator = VisualTreeHelper.GetChild(clip, 0) as Rectangle;
00027
00028             indicator.SizeChanged += this.Indicator_SizeChanged;
00029
00030             IndicatorWidthText.Text = indicator.ActualWidth.ToString();
00031             ROValueText.Text = TestProgressBar.Value.ToString();
00032
00033             Loaded -= ProgressBarReTemplatePage_Loaded;
00034         }
00035
00036         private void Indicator_SizeChanged(object sender, SizeChangedEventArgs e)
00037         {
00038             IndicatorWidthText.Text = ((Rectangle)sender).ActualWidth.ToString();
00039         }
00040
00041         private void ProgressBarReTemplatePage_CurrentStateChanged(object sender, VisualStateChangedEventArgs e)
00042         {
00043             VisualStateText.Text = e.NewState.Name;
00044         }
00045
00046         public void UpdateMinMax_Click(object sender, RoutedEventArgs e)
00047         {
00048             TestProgressBar.Maximum = String.IsNullOrEmpty(MaximumInput.Text) ? Double.Parse(MaximumInput.PlaceholderText) : Double.Parse(MaximumInput.Text);
00049             TestProgressBar.Minimum = String.IsNullOrEmpty(MinimumInput.Text) ? Double.Parse(MinimumInput.PlaceholderText) : Double.Parse(MinimumInput.Text);
00050             ROValueText.Text = TestProgressBar.Value.ToString();
00051         }
00052
00053         public void UpdateWidth_Click(object sender, RoutedEventArgs e)
00054         {
00055             TestProgressBar.Width = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00056         }
00057
00058         public void UpdateValue_Click(object sender, RoutedEventArgs e)
00059         {
00060             TestProgressBar.Value = String.IsNullOrEmpty(ValueInput.Text) ? Double.Parse(ValueInput.PlaceholderText) : Double.Parse(ValueInput.Text);
00061             ROValueText.Text = TestProgressBar.Value.ToString();
00062         }
00063
00064         public void ChangeValue_Click(object sender, RoutedEventArgs e)
00065         {
00066             if (TestProgressBar.Value + 1 > TestProgressBar.Maximum)
00067             {
00068                 TestProgressBar.Value = (int)(TestProgressBar.Minimum + 0.5);
00069             }
00070             else
00071             {
00072                 TestProgressBar.Value += 1;
00073             }
00074             ROValueText.Text = TestProgressBar.Value.ToString();
00075         }
00076
00077         public void UpdatePadding_Click(object sender, RoutedEventArgs e)
00078         {
00079             double paddingLeft = String.IsNullOrEmpty(PaddingLeftInput.Text) ? Double.Parse(PaddingLeftInput.PlaceholderText) : Double.Parse(PaddingLeftInput.Text);
00080             double paddingRight = String.IsNullOrEmpty(PaddingRightInput.Text) ? Double.Parse(PaddingRightInput.PlaceholderText) : Double.Parse(PaddingRightInput.Text);
00081
00082             TestProgressBar.Padding = new Thickness(paddingLeft, 0, paddingRight, 0);
00083             ROValueText.Text = TestProgressBar.Value.ToString();
00084         }
00085     }
00086 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ProgressBar Member List

This is the complete list of members for ProgressBar, including all inherited members.
abi_enter() | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
CheckThread() | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
ClearProperties() | ProgressBarProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< ProgressBar > &&self) noexcept | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline, static]
EnsureProperties() | ProgressBarProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
final_release(std::unique_ptr< ProgressBar > &&self) | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline, static]
GetBase() | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
GetInner() | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
IsIndeterminate(bool value) | ProgressBarProperties |
IsIndeterminate() | ProgressBarProperties |
IsIndeterminateProperty() | ProgressBarProperties | [inline, static]
IsOnThread() | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
OnApplyTemplate() | ProgressBar |
OnCreateAutomationPeer() | ProgressBar |
OnIndicatorWidthComponentChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | ProgressBar | [private]
OnIsIndeterminatePropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | ProgressBar |
ProgressBarProperties::OnIsIndeterminatePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ProgressBarProperties | [static]
OnShowErrorPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | ProgressBar |
ProgressBarProperties::OnShowErrorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ProgressBarProperties | [static]
OnShowPausedPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | ProgressBar |
ProgressBarProperties::OnShowPausedPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ProgressBarProperties | [static]
OnSizeChanged(const winrt::IInspectable &, const winrt::IInspectable &) | ProgressBar | [private]
OnVisibilityPropertyChanged(const winrt::DependencyObject &sender, const winrt::DependencyProperty &args) | ProgressBar | [private]
ProgressBar() | ProgressBar |
ProgressBarProperties() | ProgressBarProperties |
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< ProgressBar, winrt::implementation::ProgressBarT > | [inline]
s_IsIndeterminateProperty | ProgressBarProperties | [static]
s_ShowErrorProperty | ProgressBarProperties | [static]
s_ShowPausedProperty | ProgressBarProperties | [static]
s_TemplateSettingsProperty | ProgressBarProperties | [static]
SetProgressBarIndicatorWidth() | ProgressBar | [private]
ShowError(bool value) | ProgressBarProperties |
ShowError() | ProgressBarProperties |
ShowErrorProperty() | ProgressBarProperties | [inline, static]
ShowPaused(bool value) | ProgressBarProperties |
ShowPaused() | ProgressBarProperties |
ShowPausedProperty() | ProgressBarProperties | [inline, static]
TemplateSettings(winrt::ProgressBarTemplateSettings const &value) | ProgressBarProperties |
TemplateSettings() | ProgressBarProperties |
TemplateSettingsProperty() | ProgressBarProperties | [inline, static]
UpdateStates() | ProgressBar | [private]
UpdateWidthBasedTemplateSettings() | ProgressBar | [private]
Generated on Sun Dec 1 2024 20:53:01 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

LinearTransferEffect Member List

This is the complete list of members for LinearTransferEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1LinearTransfer) | LinearTransferEffect
DECLARE_NAMED_PROPERTY_MAPPING({L"RedOffset", D2D1_LINEARTRANSFER_PROP_RED_Y_INTERCEPT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"RedSlope", D2D1_LINEARTRANSFER_PROP_RED_SLOPE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"RedDisable", D2D1_LINEARTRANSFER_PROP_RED_DISABLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"GreenOffset", D2D1_LINEARTRANSFER_PROP_GREEN_Y_INTERCEPT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"GreenSlope", D2D1_LINEARTRANSFER_PROP_GREEN_SLOPE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"GreenDisable", D2D1_LINEARTRANSFER_PROP_GREEN_DISABLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"BlueOffset", D2D1_LINEARTRANSFER_PROP_BLUE_Y_INTERCEPT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"BlueSlope", D2D1_LINEARTRANSFER_PROP_BLUE_SLOPE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"BlueDisable", D2D1_LINEARTRANSFER_PROP_BLUE_DISABLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"AlphaOffset", D2D1_LINEARTRANSFER_PROP_ALPHA_Y_INTERCEPT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"AlphaSlope", D2D1_LINEARTRANSFER_PROP_ALPHA_SLOPE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"AlphaDisable", D2D1_LINEARTRANSFER_PROP_ALPHA_DISABLE, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT},{L"ClampOutput", D2D1_LINEARTRANSFER_PROP_CLAMP_OUTPUT, PropertyMapping::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT}) | LinearTransferEffect
DECLARE_POD_PROPERTY(RedOffset, float, 0.0f, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(RedSlope, float, 1.0f, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(RedDisable, bool, false, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(GreenOffset, float, 0.0f, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(GreenSlope, float, 1.0f, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(GreenDisable, bool, false, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(BlueOffset, float, 0.0f, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(BlueSlope, float, 1.0f, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(BlueDisable, bool, false, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(AlphaOffset, float, 0.0f, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(AlphaSlope, float, 1.0f, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(AlphaDisable, bool, false, true) | LinearTransferEffect
DECLARE_POD_PROPERTY(ClampOutput, bool, false, true) | LinearTransferEffect
DECLARE_SINGLE_SOURCE(Source) | LinearTransferEffect
GetProperty(UINT index, _Outptr_ abi::IPropertyValue **value) override | LinearTransferEffect | [inline]
GetPropertyCount(_Out_ UINT *count) override | LinearTransferEffect | [inline]
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommandBarFlyout/CommandBarFlyoutCommandBar.cpp Source File

  • CommandBarFlyout

CommandBarFlyoutCommandBar.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "CommandBarFlyout.h"
00007 #include "CommandBarFlyoutCommandBar.h"
00008 #include "CommandBarFlyoutCommandBarTemplateSettings.h"
00009 #include "ResourceAccessor.h"
00010 #include "TypeLogging.h"
00011 #include "Vector.h"
00012
00013 CommandBarFlyoutCommandBar::CommandBarFlyoutCommandBar()
00014 {
00015     SetDefaultStyleKey(this);
00016
00017     SetValue(s_FlyoutTemplateSettingsProperty, winrt::make<CommandBarFlyoutCommandBarTemplateSettings>());
00018
00019     Loaded({
00020         [this](auto const&, auto const&)
00021         {
00022             COMMANDBARFLYOUT_TRACE_INFO_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"Loaded");
00023
00024             UpdateUI(!m_commandBarFlyoutIsOpening);
00025
00026             if (auto owningFlyout = m_owningFlyout.get())
00027             {
00028                 // We only want to focus an initial element if we're opening in standard mode -
00029                 // in transient mode, we don't want to be taking focus.
00030                 if (owningFlyout.ShowMode() == winrt::FlyoutShowMode::Standard)
00031                 {
00032                     // Programmatically focus the first primary command if any, else programmatically focus the first secondary command if any.
00033                     auto commands = PrimaryCommands().Size() > 0 ? PrimaryCommands() : (SecondaryCommands().Size() > 0 ? SecondaryCommands() : nullptr);
00034
00035                     if (commands)
00036                     {
00037                         const bool usingPrimaryCommands = commands == PrimaryCommands();
00038                         const bool ensureTabStopUniqueness = usingPrimaryCommands;
00039                         const auto firstCommandAsFrameworkElement = commands.GetAt(0).try_as<winrt::FrameworkElement>();
00040
00041                         if (firstCommandAsFrameworkElement)
00042                         {
00043                             if (firstCommandAsFrameworkElement.IsLoaded())
00044                             {
00045                                 FocusCommand(
00046                                     commands,
00047                                     usingPrimaryCommands ? m_moreButton.get() : nullptr /*moreButton*/,
00048                                     winrt::FocusState::Programmatic /*focusState*/,
00049                                     true /*firstCommand*/,
00050                                     ensureTabStopUniqueness);
00051                             }
00052                             else
00053                             {
00054                                 m_firstItemLoadedRevoker = firstCommandAsFrameworkElement.Loaded(winrt::auto_revoke,
00055                                 {
00056                                     [this, commands, usingPrimaryCommands, ensureTabStopUniqueness](winrt::IInspectable const& sender, auto const&)
00057                                     {
00058                                         FocusCommand(
00059                                             commands,
00060                                             usingPrimaryCommands ? m_moreButton.get() : nullptr /*moreButton*/,
00061                                             winrt::FocusState::Programmatic /*focusState*/,
00062                                             true /*firstCommand*/,
00063                                             ensureTabStopUniqueness);
00064                                         m_firstItemLoadedRevoker.revoke();
00065                                     }
00066                                 });
00067                             }
00068                         }
00069                     }
00070                 }
00071             }
00072
00073             TryConnectSystemBackdrop();
00074             // If we have a SystemBackdrop, it should be connected by now.
00075             MUX_ASSERT(m_registeredWithSystemBackdrop || !m_systemBackdrop);
00076         }
00077     });
00078
00079     SizeChanged({
00080         [this](auto const&, auto const&)
00081         {
00082             COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"SizeChanged");
00083
00084             UpdateUI(!m_commandBarFlyoutIsOpening, true /*isForSizeChange*/);
00085         }
00086     });
00087
00088     Closing({
00089         [this](auto const&, auto const&)
00090         {
00091             COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"Closing");
00092
00093             if (auto owningFlyout = m_owningFlyout.get())
00094             {
00095                 if (owningFlyout.AlwaysExpanded())
00096                 {
00097                     // Don't close the secondary commands list when the flyout is AlwaysExpanded.
00098                     IsOpen(true);
00099                 }
00100             }
00101         }
00102     });
00103
00104     Closed({
00105         [this](auto const&, auto const&)
00106         {
00107             COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"Closed");
00108
00109             m_secondaryItemsRootSized = false;
00110         }
00111     });
00112
00113     RegisterPropertyChangedCallback(
00114         winrt::AppBar::IsOpenProperty(),
00115         [this](auto const&, auto const&)
00116         {
00117             COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"IsOpenProperty changed");
00118
00119             UpdateFlowsFromAndFlowsTo();
00120             UpdateUI(!m_commandBarFlyoutIsOpening);
00121         });
00122
00123     // Since we own these vectors, we don't need to cache the event tokens -
00124     // in fact, if we tried to remove these handlers in our destructor,
00125     // these properties will have already been cleared, and we'll nullref.
00126     PrimaryCommands().VectorChanged({
00127         [this](auto const&, auto const&)
00128         {
00129             COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"PrimaryCommands VectorChanged");
00130
00131             EnsureLocalizedControlTypes();
00132             PopulateAccessibleControls();
00133             UpdateFlowsFromAndFlowsTo();
00134             UpdateUI(!m_commandBarFlyoutIsOpening);
00135             AttachItemEventHandlers();
00136         }
00137     });
00138
00139     SecondaryCommands().VectorChanged({
00140         [this](auto const&, auto const&)
00141         {
00142             COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"SecondaryCommands VectorChanged");
00143
00144             m_secondaryItemsRootSized = false;
00145             EnsureLocalizedControlTypes();
00146             PopulateAccessibleControls();
00147             UpdateFlowsFromAndFlowsTo();
00148             UpdateUI(!m_commandBarFlyoutIsOpening);
00149             AttachItemEventHandlers();
00150         }
00151     });
00152 }
00153
00154 CommandBarFlyoutCommandBar::~CommandBarFlyoutCommandBar()
00155 {
00156     // The SystemBackdrop DP has already been cleared out. Use our cached field.
00157     if (m_registeredWithSystemBackdrop)
00158     {
00159         if (auto systemBackdrop = m_systemBackdrop.get())
00160         {
00161             systemBackdrop.OnTargetDisconnected(m_backdropLink);
00162             systemBackdrop.OnTargetDisconnected(m_overflowPopupBackdropLink);
00163         }
00164     }
00165 }
00166
00167 void CommandBarFlyoutCommandBar::OnApplyTemplate()
00168 {
00169     COMMANDBARFLYOUT_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00170
00171     __super::OnApplyTemplate();
00172     DetachEventHandlers();
00173
00174     if (auto& overflowPopup = m_overflowPopup.get())
00175     {
00176         overflowPopup.PlacementTarget(nullptr);
00177         overflowPopup.DesiredPlacement(winrt::PopupPlacementMode::Auto);
00178     }
00179
00180     winrt::AutomationProperties::SetLocalizedControlType(*this, ResourceAccessor::GetLocalizedStringResource(SR_CommandBarFlyoutCommandBarLocalizedControlType));
00181     EnsureLocalizedControlTypes();
00182
00183     winrt::IControlProtected thisAsControlProtected = *this;
00184
00185     m_primaryItemsRoot.set(GetTemplateChildT<winrt::FrameworkElement>(L"PrimaryItemsRoot", thisAsControlProtected));
00186     m_overflowPopup.set(GetTemplateChildT<winrt::Popup>(L"OverflowPopup", thisAsControlProtected));
00187     m_secondaryItemsRoot.set(GetTemplateChildT<winrt::FrameworkElement>(L"OverflowContentRoot", thisAsControlProtected));
00188     m_moreButton.set(GetTemplateChildT<winrt::ButtonBase>(L"MoreButton", thisAsControlProtected));
00189     m_openingStoryboard.set([this, thisAsControlProtected]()
00190         {
00191             if (auto const opacityStoryBoard = GetTemplateChildT<winrt::Storyboard>(L"OpeningOpacityStoryboard", thisAsControlProtected))
00192             {
00193                 m_openAnimationKind = CommandBarFlyoutOpenCloseAnimationKind::Opacity;
00194                 return opacityStoryBoard;
00195             }
00196             m_openAnimationKind = CommandBarFlyoutOpenCloseAnimationKind::Clip;
00197             return GetTemplateChildT<winrt::Storyboard>(L"OpeningStoryboard", thisAsControlProtected);
00198         }());
00199     m_closingStoryboard.set([this, thisAsControlProtected]()
00200         {
00201             if (auto const opacityStoryBoard = GetTemplateChildT<winrt::Storyboard>(L"ClosingOpacityStoryboard", thisAsControlProtected))
00202             {
00203                 return opacityStoryBoard;
00204             }
00205             return GetTemplateChildT<winrt::Storyboard>(L"ClosingStoryboard", thisAsControlProtected);
00206         }());
00207
00208     m_primaryItemsSystemBackdropRoot.set(GetTemplateChildT<winrt::FrameworkElement>(L"PrimaryItemsSystemBackdropRoot", thisAsControlProtected));
00209     m_overflowPopupSystemBackdropRoot.set(GetTemplateChildT<winrt::FrameworkElement>(L"OverflowPopupSystemBackdropRoot", thisAsControlProtected));
00210     m_outerOverflowContentRootV2.set(GetTemplateChildT<winrt::FrameworkElement>(L"OuterOverflowContentRootV2", thisAsControlProtected));
00211
00212     auto& primaryItemsRoot = m_primaryItemsRoot.get();
00213     auto& primaryItemsSystemBackdropRoot = m_primaryItemsSystemBackdropRoot.get();
00214     if (primaryItemsRoot && primaryItemsSystemBackdropRoot && m_backdropLink)
00215     {
00216         winrt::Visual placementVisual = m_backdropLink.PlacementVisual();
00217
00218         // Hard-code a large size for the placement visual. The size and position of this lifted visual controls the
00219         // size and position of the system visual with the backdrop. This visual is parented in a windowed popup, so it
00220         // should use the popup's coordinate space, but we're seeing it use the main island's coordinate space instead.
00221         // We don't easily have the popup island's offset from outside MUX.dll, so just size the placement visual to a
00222         // large number to cover everything. We'll apply a clip to this placement visual later to size it to the
00223         // CommandBarFlyoutCommandBar's contents.
00224         placementVisual.Size({10000, 10000});
00225         // Replace with this when the coordinate space issue is fixed - http://task.ms/44279950
00226         //placementVisual.Size({static_cast<float>(primaryItemsRoot.ActualWidth()), static_cast<float>(primaryItemsRoot.ActualHeight())});
00227
00228         winrt::ElementCompositionPreview::SetElementChildVisual(primaryItemsSystemBackdropRoot, placementVisual);
00229     }
00230
00231     const auto& overflowContentRootV2 = m_outerOverflowContentRootV2.get();
00232     const auto& overflowPopupSystemBackdropRoot = m_overflowPopupSystemBackdropRoot.get();
00233     if (overflowContentRootV2 && overflowPopupSystemBackdropRoot && m_overflowPopupBackdropLink)
00234     {
00235         winrt::Visual popupPlacementVisual = m_overflowPopupBackdropLink.PlacementVisual();
00236
00237         // Use a hardcoded size. See above.
00238         popupPlacementVisual.Size({10000, 10000});
00239         // Replace with this when the coordinate space issue is fixed - http://task.ms/44279950
00240         //popupPlacementVisual.Size({static_cast<float>(overflowContentRootV2.ActualWidth()), static_cast<float>(overflowContentRootV2.ActualHeight())});
00241
00242         // Don't put the overflow popup's backdrop visual in the tree yet. The popup may not be open yet and we don't
00243         // want anything to flicker. The backdrop will be put in the tree in UpdateVisualState once we've opened and
00244         // measured the overflow popup.
00245     }
00246
00247     if (auto& overflowPopup = m_overflowPopup.get())
00248     {
00249         overflowPopup.PlacementTarget(m_primaryItemsRoot.get());
00250         overflowPopup.DesiredPlacement(winrt::PopupPlacementMode::BottomEdgeAlignedLeft);
00251     }
00252
00253     if (auto& moreButton = m_moreButton.get())
00254     {
00255         // Initially only the first focusable primary and secondary commands
00256         // keep their IsTabStop set to True.
00257         if (moreButton.IsTabStop())
00258         {
00259             moreButton.IsTabStop(false);
00260         }
00261     }
00262
00263     if (m_owningFlyout)
00264     {
00265         AttachEventsToSecondaryStoryboards();
00266     }
00267
00268     // Keep the owning FlyoutPresenter's corner radius in sync with the
00269     // primary commands's corner radius.
00270     BindOwningFlyoutPresenterToCornerRadius();
00271
00272     AttachControlEventHandlers();
00273     AttachItemEventHandlers();
00274     PopulateAccessibleControls();
00275     UpdateFlowsFromAndFlowsTo();
00276     UpdateUI(false /* useTransitions */);
00277     SetPresenterName(m_flyoutPresenter.get());
00278 }
00279
00280 void CommandBarFlyoutCommandBar::SetOwningFlyout(
00281     winrt::CommandBarFlyout const& owningFlyout)
00282 {
00283     m_owningFlyout = owningFlyout;
00284 }
00285
00286 void CommandBarFlyoutCommandBar::AttachControlEventHandlers()
00287 {
00288     COMMANDBARFLYOUT_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00289
00290     if (auto overflowPopup = m_overflowPopup.get())
00291     {
00292         m_overflowPopupActualPlacementChangedRevoker = overflowPopup.ActualPlacementChanged(winrt::auto_revoke,
00293         {
00294             [this](auto const&, auto const&)
00295             {
00296                 COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"OverflowPopup ActualPlacementChanged");
00297
00298                 UpdateUI();
00299             }
00300         });
00301     }
00302
00303     if (auto secondaryItemsRoot = m_secondaryItemsRoot.get())
00304     {
00305         m_secondaryItemsRootSizeChangedRevoker = secondaryItemsRoot.SizeChanged(winrt::auto_revoke,
00306         {
00307             [this](auto const&, auto const&)
00308             {
00309                 COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR, METH_NAME, this, L"secondaryItemsRoot SizeChanged");
00310
00311                 m_secondaryItemsRootSized = true;
00312                 UpdateUI(!m_commandBarFlyoutIsOpening, true /*isForSizeChange*/);
00313             }
00314         });
00315
00316         m_secondaryItemsRootPreviewKeyDownRevoker = secondaryItemsRoot.PreviewKeyDown(winrt::auto_revoke,
00317         {
00318             [this](auto const&, winrt::KeyRoutedEventArgs const& args)
00319             {
00320                 COMMANDBARFLYOUT_TRACE_INFO(*this, TRACE_MSG_METH_STR, METH_NAME, this,
00321                     TypeLogging::KeyRoutedEventArgsToString(args).c_str());
00322
00323                 if (args.Handled())
00324                 {
00325                     return;
00326                 }
00327
00328                 switch (args.Key())
00329                 {
00330                 case winrt::VirtualKey::Escape:
00331                 {
00332                     // In addition to closing the CommandBar if someone hits the escape key,
00333                     // we also want to close the whole flyout.
00334                     if (auto owningFlyout = m_owningFlyout.get())
00335                     {
00336                         owningFlyout.Hide();
00337                     }
00338                     break;
00339                 }
00340
00341                 case winrt::VirtualKey::Down:
00342                 case winrt::VirtualKey::Up:
00343                 {
00344                     OnKeyDown(args);
00345                     break;
00346                 }
00347                 }
00348             }
00349         });
00350     }
00351
00352     if (m_openingStoryboard)
00353     {
00354         m_openingStoryboardCompletedRevoker =
00355             m_openingStoryboard.get().Completed(winrt::auto_revoke,
00356             {
00357                 [this](auto const&, auto const&) { m_openingStoryboard.get().Stop(); }
00358             });
00359     }
00360 }
00361
00362 void CommandBarFlyoutCommandBar::AttachItemEventHandlers()
00363 {
00364     m_itemLoadedRevokerVector.clear();
00365     m_itemSizeChangedRevokerVector.clear();
00366
00367     for (auto const& command : PrimaryCommands())
00368     {
00369         if (auto commandAsFE = command.try_as<winrt::FrameworkElement>())
00370         {
00371             m_itemLoadedRevokerVector.push_back(commandAsFE.Loaded(winrt::auto_revoke, {
00372                 [this](winrt::IInspectable const& sender, auto const&)
00373                 {
00374                     UpdateItemVisualState(sender.as<winrt::Control>(), true /* isPrimaryControl */);
00375                     UpdateTemplateSettings();
00376                 }
00377             }));
00378
00379             m_itemSizeChangedRevokerVector.push_back(commandAsFE.SizeChanged(winrt::auto_revoke, {
00380                 [this](winrt::IInspectable const& sender, auto const&)
00381                 {
00382                     UpdateItemVisualState(sender.as<winrt::Control>(), true /* isPrimaryControl */);
00383                     UpdateTemplateSettings();
00384                 }
00385             }));
00386         }
00387     }
00388
00389     for (auto const& command : SecondaryCommands())
00390     {
00391         if (auto commandAsFE = command.try_as<winrt::FrameworkElement>())
00392         {
00393             m_itemLoadedRevokerVector.push_back(commandAsFE.Loaded(winrt::auto_revoke, {
00394                 [this](winrt::IInspectable const& sender, auto const&)
00395                 {
00396                     UpdateItemVisualState(sender.as<winrt::Control>(), false /* isPrimaryControl */);
00397                     UpdateTemplateSettings();
00398                 }
00399             }));
00400
00401             m_itemSizeChangedRevokerVector.push_back(commandAsFE.SizeChanged(winrt::auto_revoke, {
00402                 [this](winrt::IInspectable const& sender, auto const&)
00403                 {
00404                     UpdateItemVisualState(sender.as<winrt::Control>(), false /* isPrimaryControl */);
00405                     UpdateTemplateSettings();
00406                 }
00407             }));
00408         }
00409     }
00410 }
00411
00412 void CommandBarFlyoutCommandBar::DetachEventHandlers()
00413 {
00414     COMMANDBARFLYOUT_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00415
00416     m_keyDownRevoker.revoke();
00417     m_secondaryItemsRootPreviewKeyDownRevoker.revoke();
00418     m_secondaryItemsRootSizeChangedRevoker.revoke();
00419     m_firstItemLoadedRevoker.revoke();
00420     m_itemLoadedRevokerVector.clear();
00421     m_openingStoryboardCompletedRevoker.revoke();
00422     m_closingStoryboardCompletedCallbackRevoker.revoke();
00423     m_expandedUpToCollapsedStoryboardRevoker.revoke();
00424     m_expandedDownToCollapsedStoryboardRevoker.revoke();
00425     m_collapsedToExpandedUpStoryboardRevoker.revoke();
00426     m_collapsedToExpandedDownStoryboardRevoker.revoke();
00427 }
00428
00429 bool CommandBarFlyoutCommandBar::HasOpenAnimation()
00430 {
00431     return static_cast<bool>(m_openingStoryboard) && SharedHelpers::IsAnimationsEnabled();
00432 }
00433
00434 void CommandBarFlyoutCommandBar::PlayOpenAnimation()
00435 {
00436     if (auto const& closingStoryboard = m_closingStoryboard.get())
00437     {
00438         closingStoryboard.Stop();
00439     }
00440
00441     if (auto openingStoryboard = m_openingStoryboard.get())
00442     {
00443         if (openingStoryboard.GetCurrentState() != winrt::ClockState::Active)
00444         {
00445             openingStoryboard.Begin();
00446         }
00447     }
00448 }
00449
00450 bool CommandBarFlyoutCommandBar::HasCloseAnimation()
00451 {
00452     return static_cast<bool>(m_closingStoryboard) && SharedHelpers::IsAnimationsEnabled();
00453 }
00454
00455 void CommandBarFlyoutCommandBar::PlayCloseAnimation(
00456     const winrt::weak_ref<winrt::CommandBarFlyout>& weakCommandBarFlyout,
00457     std::function<void()> onCompleteFunc)
00458 {
00459     COMMANDBARFLYOUT_TRACE_INFO(*this, TRACE_MSG_METH, METH_NAME, this);
00460
00461     if (auto closingStoryboard = m_closingStoryboard.get())
00462     {
00463         if (closingStoryboard.GetCurrentState() != winrt::ClockState::Active)
00464         {
00465             m_closingStoryboardCompletedCallbackRevoker = closingStoryboard.Completed(winrt::auto_revoke,
00466             {
00467                 [this, weakCommandBarFlyout, onCompleteFunc](auto const&, auto const&)
00468                 {
00469                     if (weakCommandBarFlyout.get())
00470                     {
00471                         onCompleteFunc();
00472                     }
00473                 }
00474             });
00475
00476             UpdateTemplateSettings();
00477             closingStoryboard.Begin();
00478         }
00479     }
00480     else
00481     {
00482         onCompleteFunc();
00483     }
00484 }
00485
00486 void CommandBarFlyoutCommandBar::UpdateFlowsFromAndFlowsTo()
00487 {
00488     auto moreButton = m_moreButton.get();
00489
00490     // Ensure there is only one focusable command with IsTabStop set to True
00491     // to enable tabbing from primary to secondary commands and vice-versa
00492     // with a single Tab keystroke.
00493     EnsureTabStopUniqueness(PrimaryCommands(), moreButton);
00494     EnsureTabStopUniqueness(SecondaryCommands(), nullptr);
00495
00496     // Ensure the SizeOfSet and PositionInSet automation properties
00497     // for the primary commands and the MoreButton account for the
00498     // potential MoreButton.
00499     EnsureAutomationSetCountAndPosition();
00500
00501     if (m_currentPrimaryItemsEndElement)
00502     {
00503         winrt::AutomationProperties::GetFlowsTo(m_currentPrimaryItemsEndElement.get()).Clear();
00504         m_currentPrimaryItemsEndElement.set(nullptr);
00505     }
00506
00507     if (m_currentSecondaryItemsStartElement)
00508     {
00509         winrt::AutomationProperties::GetFlowsFrom(m_currentSecondaryItemsStartElement.get()).Clear();
00510         m_currentSecondaryItemsStartElement.set(nullptr);
00511     }
00512
00513     // If we're not open, then we don't want to do anything special - the only time we do need to do something special
00514     // is when the secondary commands are showing, in which case we want to connect the primary and secondary command lists.
00515     if (IsOpen())
00516     {
00517         auto isElementFocusable = [](winrt::ICommandBarElement const& element)
00518         {
00519             winrt::Control primaryCommandAsControl = element.try_as<winrt::Control>();
00520             return IsControlFocusable(primaryCommandAsControl, false);
00521         };
00522
00523         auto primaryCommands = PrimaryCommands();
00524         for (int i = static_cast<int>(primaryCommands.Size() - 1); i >= 0; i--)
00525         {
00526             auto primaryCommand = primaryCommands.GetAt(i);
00527             if (isElementFocusable(primaryCommand))
00528             {
00529                 m_currentPrimaryItemsEndElement.set(primaryCommand.try_as<winrt::FrameworkElement>());
00530                 break;
00531             }
00532         }
00533
00534         // If we have a more button and at least one focusable primary item, then
00535         // we'll use the more button as the last element in our primary items list.
00536         if (moreButton && moreButton.Visibility() == winrt::Visibility::Visible && m_currentPrimaryItemsEndElement)
00537         {
00538             m_currentPrimaryItemsEndElement.set(moreButton);
00539         }
00540
00541         for (const auto& secondaryCommand : SecondaryCommands())
00542         {
00543             if (isElementFocusable(secondaryCommand))
00544             {
00545                 m_currentSecondaryItemsStartElement.set(secondaryCommand.try_as<winrt::FrameworkElement>());
00546                 break;
00547             }
00548         }
00549
00550         if (m_currentPrimaryItemsEndElement && m_currentSecondaryItemsStartElement)
00551         {
00552             winrt::AutomationProperties::GetFlowsTo(m_currentPrimaryItemsEndElement.get()).Append(m_currentSecondaryItemsStartElement.get());
00553             winrt::AutomationProperties::GetFlowsFrom(m_currentSecondaryItemsStartElement.get()).Append(m_currentPrimaryItemsEndElement.get());
00554         }
00555     }
00556 }
00557
00558 void CommandBarFlyoutCommandBar::UpdateUI(
00559     bool useTransitions, bool isForSizeChange)
00560 {
00561     COMMANDBARFLYOUT_TRACE_VERBOSE(*this, TRACE_MSG_METH_INT_INT, METH_NAME, this, useTransitions, isForSizeChange);
00562
00563     UpdateTemplateSettings();
00564     UpdateVisualState(useTransitions, isForSizeChange);
00565 }
00566
00567 void CommandBarFlyoutCommandBar::UpdateVisualState(
00568     bool useTransitions,
00569     bool isForSizeChange)
00570 {
00571     if (IsOpen())
00572     {
00573         //
00574         // If we're currently open, have overflow items, and haven't yet sized our overflow item root, then we want to
00575         // wait until then to update visual state - otherwise, we'll be animating to incorrect values.  Animations only
00576         // retrieve values from bindings when they begin, so if we begin an animation and then update a bound template
00577         // setting, that won't take effect.
00578         //
00579         // This also skips copying the size into the placement visual's clip. If the secondary items haven't been sized
00580         // yet, then we can't copy that size into the clip. Note that we don't want to remove the backdrop placement
00581         // visual from the tree. It's possible for the items to change while their layout size stay the same, in which
00582         // case the m_secondaryItemsRootSized flag will never be reset. In that case the old placement visual still has
00583         // the correct size, so leave it in the tree.
00584         //
00585         if (!m_secondaryItemsRootSized)
00586         {
00587             return;
00588         }
00589
00590         bool shouldExpandUp = false;
00591         bool hadActualPlacement = false;
00592
00593         if (auto overflowPopup = m_overflowPopup.get())
00594         {
00595             // If we have a value set for ActualPlacement, then we'll directly use that -
00596             // that tells us where our popup's been placed, so we don't need to try to
00597             // infer where it should go.
00598             if (overflowPopup.ActualPlacement() != winrt::PopupPlacementMode::Auto)
00599             {
00600                 hadActualPlacement = true;
00601                 shouldExpandUp =
00602                     overflowPopup.ActualPlacement() == winrt::PopupPlacementMode::TopEdgeAlignedLeft ||
00603                     overflowPopup.ActualPlacement() == winrt::PopupPlacementMode::TopEdgeAlignedRight;
00604             }
00605         }
00606
00607         // If there isn't enough space to display the overflow below the command bar,
00608         // and if there is enough space above, then we'll display it above instead.
00609         if (m_secondaryItemsRoot)
00610         {
00611             double availableHeight = -1;
00612             const auto controlBounds = TransformToVisual(nullptr).TransformBounds({ 0, 0, static_cast<float>(ActualWidth()), static_cast<float>(ActualHeight()) });
00613
00614             if (winrt::CoreWindow::GetForCurrentThread())
00615             {
00616                 try
00617                 {
00618                     // Note: this doesn't work right for islands scenarios
00619                     // Bug 19617460: CommandBarFlyoutCommandBar isn't able to decide whether to open up or down because it doesn't know where it is relative to the monitor
00620                     auto view = winrt::ApplicationView::GetForCurrentView();
00621                     availableHeight = view.VisibleBounds().Height;
00622                 }
00623                 catch (winrt::hresult_error)
00624                 {
00625                     // Calling GetForCurrentView on threads without a CoreWindow throws an error. This comes up in places like LogonUI.
00626                     // In this circumstance, we'll just always expand down, since we can't get bounds information.
00627                 }
00628             }
00629
00630             if (availableHeight >= 0)
00631             {
00632                 m_secondaryItemsRoot.get().Measure({ std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity() });
00633                 const auto overflowPopupSize = m_secondaryItemsRoot.get().DesiredSize();
00634
00635                 shouldExpandUp =
00636                     static_cast<double>(controlBounds.Y) + controlBounds.Height + overflowPopupSize.Height > availableHeight &&
00637                     controlBounds.Y - overflowPopupSize.Height >= 0;
00638             }
00639         }
00640
00641         if (isForSizeChange)
00642         {
00643             // UpdateVisualState is called as a result of a size change (for instance caused by a secondary command bar element dependency property change). This CommandBarFlyoutCommandBar is already open
00644             // and expanded. Jump to the Collapsed and back to ExpandedUp/ExpandedDown state to apply all refreshed CommandBarFlyoutCommandBarTemplateSettings values.
00645             winrt::VisualStateManager::GoToState(*this, L"Collapsed", false);
00646         }
00647
00648         winrt::VisualStateManager::GoToState(*this, shouldExpandUp ? L"ExpandedUp" : L"ExpandedDown", useTransitions && !isForSizeChange);
00649
00650         // Union of AvailableCommandsStates and ExpansionStates
00651         bool hasPrimaryCommands = (PrimaryCommands().Size() != 0);
00652         if (hasPrimaryCommands)
00653         {
00654             if (shouldExpandUp)
00655             {
00656                 winrt::VisualStateManager::GoToState(*this, L"NoOuterOverflowContentRootShadow", useTransitions);
00657                 winrt::VisualStateManager::GoToState(*this, L"ExpandedUpWithPrimaryCommands", useTransitions);
00658             }
00659             else
00660             {
00661                 winrt::VisualStateManager::GoToState(*this, L"OuterOverflowContentRootShadow", useTransitions);
00662                 winrt::VisualStateManager::GoToState(*this, L"ExpandedDownWithPrimaryCommands", useTransitions);
00663             }
00664         }
00665         else
00666         {
00667             winrt::VisualStateManager::GoToState(*this, L"OuterOverflowContentRootShadow", useTransitions);
00668             if (shouldExpandUp)
00669             {
00670                 winrt::VisualStateManager::GoToState(*this, L"ExpandedUpWithoutPrimaryCommands", useTransitions);
00671             }
00672             else
00673             {
00674                 winrt::VisualStateManager::GoToState(*this, L"ExpandedDownWithoutPrimaryCommands", useTransitions);
00675             }
00676         }
00677
00678         // Update the corner radius clip on the backdrop. We copy the corner radius from the elements in the template,
00679         // which depends on the visual state of the CommandBarFlyoutCommandBar.
00680         if (m_overflowPopupBackdropLink && m_outerOverflowContentRootV2)
00681         {
00682             winrt::Visual popupPlacementVisual = m_overflowPopupBackdropLink.PlacementVisual();
00683             winrt::Grid overflowContentRootV2 = m_outerOverflowContentRootV2.get().try_as<winrt::Grid>();
00684             auto cornerRadius = overflowContentRootV2.CornerRadius();
00685
00686             auto compositor = popupPlacementVisual.Compositor();
00687             winrt::RectangleClip rectangleClip = compositor.CreateRectangleClip();
00688             rectangleClip.Right(static_cast<float>(overflowContentRootV2.ActualWidth()));
00689             rectangleClip.Bottom(static_cast<float>(overflowContentRootV2.ActualHeight()));
00690             rectangleClip.TopLeftRadius({static_cast<float>(cornerRadius.TopLeft), static_cast<float>(cornerRadius.TopLeft)});
00691             rectangleClip.TopRightRadius({static_cast<float>(cornerRadius.TopRight), static_cast<float>(cornerRadius.TopRight)});
00692             rectangleClip.BottomLeftRadius({static_cast<float>(cornerRadius.BottomLeft), static_cast<float>(cornerRadius.BottomLeft)});
00693             rectangleClip.BottomRightRadius({static_cast<float>(cornerRadius.BottomRight), static_cast<float>(cornerRadius.BottomRight)});
00694             popupPlacementVisual.Clip(rectangleClip);
00695         }
00696
00697         if (m_overflowPopupBackdropLink && m_overflowPopupSystemBackdropRoot)
00698         {
00699             winrt::Visual popupPlacementVisual = m_overflowPopupBackdropLink.PlacementVisual();
00700             const auto& overflowPopupSystemBackdropRoot = m_overflowPopupSystemBackdropRoot.get();
00701             winrt::ElementCompositionPreview::SetElementChildVisual(overflowPopupSystemBackdropRoot, popupPlacementVisual);
00702         }
00703     }
00704     else
00705     {
00706         winrt::VisualStateManager::GoToState(*this, L"NoOuterOverflowContentRootShadow", useTransitions);
00707         winrt::VisualStateManager::GoToState(*this, L"Default", useTransitions);
00708         winrt::VisualStateManager::GoToState(*this, L"Collapsed", useTransitions);
00709
00710         // Take the backdrop behind the overflow popup out of the tree. If the entire CommandBarFlyoutCommandBar is
00711         // closed and reopens, the overflow popup could be closed and we don't want the backdrop behind the overflow
00712         // popup to flicker.
00713         if (m_overflowPopupBackdropLink && m_overflowPopupSystemBackdropRoot)
00714         {
00715             const auto& overflowPopupSystemBackdropRoot = m_overflowPopupSystemBackdropRoot.get();
00716             winrt::ElementCompositionPreview::SetElementChildVisual(overflowPopupSystemBackdropRoot, nullptr);
00717         }
00718     }
00719
00720     // Update the corner radius clip on the backdrop. We copy the corner radius from the elements in the template, which
00721     // depends on the visual state of the CommandBarFlyoutCommandBar.
00722     if (m_backdropLink && m_primaryItemsRoot)
00723     {
00724         winrt::Visual placementVisual = m_backdropLink.PlacementVisual();
00725
00726         winrt::Grid primaryItemsRoot = m_primaryItemsRoot.get().try_as<winrt::Grid>();
00727         auto cornerRadius = primaryItemsRoot.CornerRadius();
00728
00729         // Copy the rounded corner clip from the templated element with the rounded corner clip set on it
00730         auto compositor = placementVisual.Compositor();
00731         winrt::RectangleClip rectangleClip = compositor.CreateRectangleClip();
00732         rectangleClip.Right(static_cast<float>(primaryItemsRoot.ActualWidth()));
00733         rectangleClip.Bottom(static_cast<float>(primaryItemsRoot.ActualHeight()));
00734         rectangleClip.TopLeftRadius({static_cast<float>(cornerRadius.TopLeft), static_cast<float>(cornerRadius.TopLeft)});
00735         rectangleClip.TopRightRadius({static_cast<float>(cornerRadius.TopRight), static_cast<float>(cornerRadius.TopRight)});
00736         rectangleClip.BottomLeftRadius({static_cast<float>(cornerRadius.BottomLeft), static_cast<float>(cornerRadius.BottomLeft)});
00737         rectangleClip.BottomRightRadius({static_cast<float>(cornerRadius.BottomRight), static_cast<float>(cornerRadius.BottomRight)});
00738         placementVisual.Clip(rectangleClip);
00739     }
00740
00741     // If no primary command has labels, then we'll shrink down the size of primary commands since the extra space to accommodate labels is unnecessary.
00742     bool hasPrimaryCommandLabels = false;
00743     for (auto const& primaryCommand : PrimaryCommands())
00744     {
00745         if (HasVisibleLabel(primaryCommand.try_as<winrt::AppBarButton>()) ||
00746             HasVisibleLabel(primaryCommand.try_as<winrt::AppBarToggleButton>()))
00747         {
00748             hasPrimaryCommandLabels = true;
00749             break;
00750         }
00751     }
00752
00753     for (auto const& command : PrimaryCommands())
00754     {
00755         if (auto commandControl = command.try_as<winrt::Control>())
00756         {
00757             winrt::VisualStateManager::GoToState(commandControl, hasPrimaryCommandLabels ? L"HasPrimaryLabels" : L"NoPrimaryLabels", useTransitions);
00758         }
00759     }
00760
00761     // Secondary commands by definition will not have any primary commands that they need to accommodate, so we'll set all of them to that state.
00762     for (auto const& command : SecondaryCommands())
00763     {
00764         if (auto commandControl = command.try_as<winrt::Control>())
00765         {
00766             winrt::VisualStateManager::GoToState(commandControl, L"NoPrimaryLabels", useTransitions);
00767         }
00768     }
00769
00770     winrt::VisualStateManager::GoToState(*this, hasPrimaryCommandLabels ? L"HasPrimaryLabels" : L"NoPrimaryLabels", useTransitions);
00771 }
00772
00773 void CommandBarFlyoutCommandBar::UpdateItemVisualState(winrt::Control const& item, bool isPrimaryItem)
00774 {
00775     if (isPrimaryItem)
00776     {
00777         bool hasPrimaryCommandLabels = false;
00778         for (auto const& primaryCommand : PrimaryCommands())
00779         {
00780             if (HasVisibleLabel(primaryCommand.try_as<winrt::AppBarButton>()) ||
00781                 HasVisibleLabel(primaryCommand.try_as<winrt::AppBarToggleButton>()))
00782             {
00783                 hasPrimaryCommandLabels = true;
00784                 break;
00785             }
00786         }
00787
00788         winrt::VisualStateManager::GoToState(item, hasPrimaryCommandLabels ? L"HasPrimaryLabels" : L"NoPrimaryLabels", false /* useTransitions */);
00789     }
00790     else
00791     {
00792         winrt::VisualStateManager::GoToState(item, L"NoPrimaryLabels", false /* useTransitions */);
00793     }
00794 }
00795
00796 void CommandBarFlyoutCommandBar::UpdateTemplateSettings()
00797 {
00798     COMMANDBARFLYOUT_TRACE_INFO(*this, TRACE_MSG_METH_INT, METH_NAME, this, IsOpen());
00799
00800     if (m_primaryItemsRoot && m_secondaryItemsRoot)
00801     {
00802         const auto flyoutTemplateSettings = winrt::get_self<CommandBarFlyoutCommandBarTemplateSettings>(FlyoutTemplateSettings());
00803         const auto maxWidth = static_cast<float>(MaxWidth());
00804
00805         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"old ExpandedWidth:", flyoutTemplateSettings->ExpandedWidth());
00806         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"old CurrentWidth:", flyoutTemplateSettings->CurrentWidth());
00807         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"old WidthExpansionDelta:", flyoutTemplateSettings->WidthExpansionDelta());
00808         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"old WidthExpansionAnimationStartPosition:", flyoutTemplateSettings->WidthExpansionAnimationStartPosition());
00809         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"old WidthExpansionAnimationEndPosition:", flyoutTemplateSettings->WidthExpansionAnimationEndPosition());
00810         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"old OpenAnimationStartPosition:", flyoutTemplateSettings->OpenAnimationStartPosition());
00811         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"old OpenAnimationEndPosition:", flyoutTemplateSettings->OpenAnimationEndPosition());
00812         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"old CloseAnimationEndPosition:", flyoutTemplateSettings->CloseAnimationEndPosition());
00813         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"MaxWidth:", maxWidth);
00814
00815         const winrt::Size infiniteSize = { std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity() };
00816         m_primaryItemsRoot.get().Measure(infiniteSize);
00817         const winrt::Size primaryItemsRootDesiredSize = m_primaryItemsRoot.get().DesiredSize();
00818         float collapsedWidth = std::min(maxWidth, primaryItemsRootDesiredSize.Width);
00819
00820         if (m_secondaryItemsRoot)
00821         {
00822             m_secondaryItemsRoot.get().Measure(infiniteSize);
00823             const auto overflowPopupSize = m_secondaryItemsRoot.get().DesiredSize();
00824
00825             flyoutTemplateSettings->ExpandedWidth(std::min(maxWidth, std::max(collapsedWidth, overflowPopupSize.Width)));
00826             flyoutTemplateSettings->ExpandUpOverflowVerticalPosition(-overflowPopupSize.Height);
00827             flyoutTemplateSettings->ExpandUpAnimationStartPosition(overflowPopupSize.Height / 2);
00828             flyoutTemplateSettings->ExpandUpAnimationEndPosition(0);
00829             flyoutTemplateSettings->ExpandUpAnimationHoldPosition(overflowPopupSize.Height);
00830             flyoutTemplateSettings->ExpandDownAnimationStartPosition(-overflowPopupSize.Height / 2);
00831             flyoutTemplateSettings->ExpandDownAnimationEndPosition(0);
00832             flyoutTemplateSettings->ExpandDownAnimationHoldPosition(-overflowPopupSize.Height);
00833             // This clip needs to cover the border at the bottom of the overflow otherwise it'll
00834             // clip the border. The measure size seems slightly off from what we eventually require
00835             // so we're going to compensate just a bit to make sure there's room for any borders.
00836             flyoutTemplateSettings->OverflowContentClipRect({ 0, 0, static_cast<float>(flyoutTemplateSettings->ExpandedWidth()), overflowPopupSize.Height + 2 });
00837         }
00838         else
00839         {
00840             flyoutTemplateSettings->ExpandedWidth(collapsedWidth);
00841             flyoutTemplateSettings->ExpandUpOverflowVerticalPosition(0);
00842             flyoutTemplateSettings->ExpandUpAnimationStartPosition(0);
00843             flyoutTemplateSettings->ExpandUpAnimationEndPosition(0);
00844             flyoutTemplateSettings->ExpandUpAnimationHoldPosition(0);
00845             flyoutTemplateSettings->ExpandDownAnimationStartPosition(0);
00846             flyoutTemplateSettings->ExpandDownAnimationEndPosition(0);
00847             flyoutTemplateSettings->ExpandDownAnimationHoldPosition(0);
00848             flyoutTemplateSettings->OverflowContentClipRect({ 0, 0, 0, 0 });
00849         }
00850
00851         const double expandedWidth = flyoutTemplateSettings->ExpandedWidth();
00852
00853         // If collapsedWidth is 0, then we'll never be showing in collapsed mode,
00854         // so we'll set it equal to expandedWidth to ensure that our open/close animations are correct.
00855         if (collapsedWidth == 0)
00856         {
00857             collapsedWidth = static_cast<float>(expandedWidth);
00858         }
00859
00860         flyoutTemplateSettings->WidthExpansionDelta(collapsedWidth - expandedWidth);
00861         flyoutTemplateSettings->WidthExpansionAnimationStartPosition(-flyoutTemplateSettings->WidthExpansionDelta() / 2.0);
00862         flyoutTemplateSettings->WidthExpansionAnimationEndPosition(-flyoutTemplateSettings->WidthExpansionDelta());
00863         flyoutTemplateSettings->ContentClipRect({ 0, 0, static_cast<float>(expandedWidth), primaryItemsRootDesiredSize.Height });
00864
00865         if (IsOpen())
00866         {
00867             flyoutTemplateSettings->CurrentWidth(expandedWidth);
00868         }
00869         else
00870         {
00871             flyoutTemplateSettings->CurrentWidth(collapsedWidth);
00872         }
00873
00874         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"collapsedWidth:", collapsedWidth);
00875         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"new ExpandedWidth:", expandedWidth);
00876         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"new CurrentWidth:", flyoutTemplateSettings->CurrentWidth());
00877         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"new WidthExpansionDelta:", flyoutTemplateSettings->WidthExpansionDelta());
00878         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"new WidthExpansionAnimationStartPosition:", flyoutTemplateSettings->WidthExpansionAnimationStartPosition());
00879         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"new WidthExpansionAnimationEndPosition:", flyoutTemplateSettings->WidthExpansionAnimationEndPosition());
00880
00881         // If we're currently playing the close animation, don't update these properties -
00882         // the animation is expecting them not to change out from under it.
00883         // After the close animation has completed, the flyout will close and no further
00884         // visual updates will occur, so there's no need to update these values in that case.
00885         bool isPlayingCloseAnimation = false;
00886
00887         if (auto closingStoryboard = m_closingStoryboard.get())
00888         {
00889             isPlayingCloseAnimation = closingStoryboard.GetCurrentState() == winrt::ClockState::Active;
00890         }
00891
00892         if (!isPlayingCloseAnimation)
00893         {
00894             if (IsOpen())
00895             {
00896                 flyoutTemplateSettings->OpenAnimationStartPosition(-expandedWidth / 2);
00897                 flyoutTemplateSettings->OpenAnimationEndPosition(0);
00898             }
00899             else
00900             {
00901                 flyoutTemplateSettings->OpenAnimationStartPosition(flyoutTemplateSettings->WidthExpansionDelta() - collapsedWidth / 2);
00902                 flyoutTemplateSettings->OpenAnimationEndPosition(flyoutTemplateSettings->WidthExpansionDelta());
00903             }
00904
00905             flyoutTemplateSettings->CloseAnimationEndPosition(-expandedWidth);
00906         }
00907
00908         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"new OpenAnimationStartPosition:", flyoutTemplateSettings->OpenAnimationStartPosition());
00909         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"new OpenAnimationEndPosition:", flyoutTemplateSettings->OpenAnimationEndPosition());
00910         COMMANDBARFLYOUT_TRACE_VERBOSE_DBG(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"new CloseAnimationEndPosition:", flyoutTemplateSettings->CloseAnimationEndPosition());
00911
00912         flyoutTemplateSettings->WidthExpansionMoreButtonAnimationStartPosition(flyoutTemplateSettings->WidthExpansionDelta() / 2);
00913         flyoutTemplateSettings->WidthExpansionMoreButtonAnimationEndPosition(flyoutTemplateSettings->WidthExpansionDelta());
00914
00915         if (PrimaryCommands().Size() > 0)
00916         {
00917             // This needs to be calculated like these other properties, but because this property needs to be set on the CommandBarFlyoutCommandBar itself,
00918             // we can't use a template setting.  So we'll just set the property itself here.
00919             Height(primaryItemsRootDesiredSize.Height);
00920
00921             flyoutTemplateSettings->ExpandDownOverflowVerticalPosition(primaryItemsRootDesiredSize.Height);
00922         }
00923         else
00924         {
00925             flyoutTemplateSettings->ExpandDownOverflowVerticalPosition(0);
00926         }
00927     }
00928 }
00929
00930 void CommandBarFlyoutCommandBar::EnsureAutomationSetCountAndPosition()
00931 {
00932     COMMANDBARFLYOUT_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00933
00934     auto moreButton = m_moreButton.get();
00935     int sizeOfSet = 0;
00936
00937     for (const auto& command : PrimaryCommands())
00938     {
00939         if (auto commandAsUIElement = command.try_as<winrt::UIElement>())
00940         {
00941             // Don't count AppBarSeparator if IsTabStop is false
00942             if (auto separator = commandAsUIElement.try_as<winrt::AppBarSeparator>())
00943             {
00944                 if (!separator.IsTabStop())
00945                 {
00946                     continue;
00947                 }
00948             }
00949             else if (commandAsUIElement.Visibility() == winrt::Visibility::Visible)
00950             {
00951                 sizeOfSet++;
00952             }
00953         }
00954     }
00955
00956     if (moreButton && moreButton.Visibility() == winrt::Visibility::Visible)
00957     {
00958         // Accounting for the MoreButton
00959         sizeOfSet++;
00960     }
00961
00962     for (const auto& command : PrimaryCommands())
00963     {
00964         if (auto commandAsUIElement = command.try_as<winrt::UIElement>())
00965         {
00966             // Don't count AppBarSeparator if IsTabStop is false
00967             if (auto separator = commandAsUIElement.try_as<winrt::AppBarSeparator>())
00968             {
00969                 if (!separator.IsTabStop())
00970                 {
00971                     continue;
00972                 }
00973             }
00974             else if (commandAsUIElement.Visibility() == winrt::Visibility::Visible)
00975             {
00976                 winrt::AutomationProperties::SetSizeOfSet(commandAsUIElement, sizeOfSet);
00977             }
00978         }
00979     }
00980
00981     if (moreButton && moreButton.Visibility() == winrt::Visibility::Visible)
00982     {
00983         winrt::AutomationProperties::SetSizeOfSet(moreButton, sizeOfSet);
00984         winrt::AutomationProperties::SetPositionInSet(moreButton, sizeOfSet);
00985     }
00986 }
00987
00988 void CommandBarFlyoutCommandBar::EnsureLocalizedControlTypes()
00989 {
00990     COMMANDBARFLYOUT_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
00991
00992     for (auto const& command : PrimaryCommands())
00993     {
00994         SetKnownCommandLocalizedControlTypes(command);
00995     }
00996
00997     for (auto const& command : SecondaryCommands())
00998     {
00999         SetKnownCommandLocalizedControlTypes(command);
01000     }
01001 }
01002
01003 void CommandBarFlyoutCommandBar::CacheLocalizedStringResources()
01004 {
01005     m_localizedCommandBarFlyoutAppBarButtonControlType = ResourceAccessor::GetLocalizedStringResource(SR_CommandBarFlyoutAppBarButtonLocalizedControlType);
01006     m_localizedCommandBarFlyoutAppBarToggleButtonControlType = ResourceAccessor::GetLocalizedStringResource(SR_CommandBarFlyoutAppBarToggleButtonLocalizedControlType);
01007     m_areLocalizedStringResourcesCached = true;
01008 }
01009
01010 void CommandBarFlyoutCommandBar::ClearLocalizedStringResourceCache()
01011 {
01012     m_areLocalizedStringResourcesCached = false;
01013     m_localizedCommandBarFlyoutAppBarButtonControlType.clear();
01014     m_localizedCommandBarFlyoutAppBarToggleButtonControlType.clear();
01015 }
01016
01017 void CommandBarFlyoutCommandBar::SetKnownCommandLocalizedControlTypes(winrt::ICommandBarElement const& command)
01018 {
01019     COMMANDBARFLYOUT_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01020
01021     if (auto const& appBarButton = command.try_as<winrt::AppBarButton>())
01022     {
01023         if (m_areLocalizedStringResourcesCached)
01024         {
01025             MUX_ASSERT(!m_localizedCommandBarFlyoutAppBarButtonControlType.empty());
01026             winrt::AutomationProperties::SetLocalizedControlType(appBarButton, m_localizedCommandBarFlyoutAppBarButtonControlType);
01027         }
01028         else
01029         {
01030             winrt::AutomationProperties::SetLocalizedControlType(appBarButton, ResourceAccessor::GetLocalizedStringResource(SR_CommandBarFlyoutAppBarButtonLocalizedControlType));
01031         }
01032     }
01033     else if (auto const& appBarToggleButton = command.try_as<winrt::AppBarToggleButton>())
01034     {
01035         if (m_areLocalizedStringResourcesCached)
01036         {
01037             MUX_ASSERT(!m_localizedCommandBarFlyoutAppBarToggleButtonControlType.empty());
01038             winrt::AutomationProperties::SetLocalizedControlType(appBarToggleButton, m_localizedCommandBarFlyoutAppBarToggleButtonControlType);
01039         }
01040         else
01041         {
01042             winrt::AutomationProperties::SetLocalizedControlType(appBarToggleButton, ResourceAccessor::GetLocalizedStringResource(SR_CommandBarFlyoutAppBarToggleButtonLocalizedControlType));
01043         }
01044     }
01045 }
01046
01047 void CommandBarFlyoutCommandBar::PopulateAccessibleControls()
01048 {
01049     COMMANDBARFLYOUT_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01050
01051     // The primary commands and the more button are the only controls accessible
01052     // using left and right arrow keys. All of the commands are accessible using
01053     // the up and down arrow keys.
01054     if (!m_horizontallyAccessibleControls)
01055     {
01056         MUX_ASSERT(!m_verticallyAccessibleControls);
01057
01058         m_horizontallyAccessibleControls = winrt::make<Vector<winrt::Control>>();
01059         m_verticallyAccessibleControls = winrt::make<Vector<winrt::Control>>();
01060     }
01061     else
01062     {
01063         MUX_ASSERT(m_verticallyAccessibleControls);
01064
01065         m_horizontallyAccessibleControls.Clear();
01066         m_verticallyAccessibleControls.Clear();
01067     }
01068
01069     const auto primaryCommands = PrimaryCommands();
01070
01071     for (winrt::ICommandBarElement const& command : primaryCommands)
01072     {
01073         if (auto const& commandAsControl = command.try_as<winrt::Control>())
01074         {
01075             m_horizontallyAccessibleControls.Append(commandAsControl);
01076             m_verticallyAccessibleControls.Append(commandAsControl);
01077         }
01078     }
01079
01080     if (auto const& moreButton = m_moreButton.get())
01081     {
01082         if (primaryCommands.Size() > 0)
01083         {
01084             m_horizontallyAccessibleControls.Append(moreButton);
01085             m_verticallyAccessibleControls.Append(moreButton);
01086         }
01087     }
01088
01089     for (winrt::ICommandBarElement const& command : SecondaryCommands())
01090     {
01091         if (auto const& commandAsControl = command.try_as<winrt::Control>())
01092         {
01093             m_verticallyAccessibleControls.Append(commandAsControl);
01094         }
01095     }
01096 }
01097
01098 void CommandBarFlyoutCommandBar::OnKeyDown(
01099     winrt::KeyRoutedEventArgs const& args)
01100 {
01101     COMMANDBARFLYOUT_TRACE_INFO(*this, TRACE_MSG_METH_STR, METH_NAME, this,
01102         TypeLogging::KeyRoutedEventArgsToString(args).c_str());
01103
01104     if (args.Handled())
01105     {
01106         return;
01107     }
01108
01109     switch (args.Key())
01110     {
01111     case winrt::VirtualKey::Tab:
01112     {
01113         if (SecondaryCommands().Size() > 0 && !IsOpen())
01114         {
01115             // Ensure the secondary commands flyout is open ...
01116             IsOpen(true);
01117
01118             // ... and focus the first focusable command
01119             FocusCommand(
01120                 SecondaryCommands() /*commands*/,
01121                 nullptr /*moreButton*/,
01122                 winrt::FocusState::Keyboard /*focusState*/,
01123                 true /*firstCommand*/,
01124                 true /*ensureTabStopUniqueness*/);
01125         }
01126         break;
01127     }
01128
01129     case winrt::VirtualKey::Escape:
01130     {
01131         if (auto owningFlyout = m_owningFlyout.get())
01132         {
01133             owningFlyout.Hide();
01134             args.Handled(true);
01135         }
01136         break;
01137     }
01138
01139     case winrt::VirtualKey::Right:
01140     case winrt::VirtualKey::Left:
01141     case winrt::VirtualKey::Down:
01142     case winrt::VirtualKey::Up:
01143     {
01144         const bool isRightToLeft = m_primaryItemsRoot && m_primaryItemsRoot.get().FlowDirection() == winrt::FlowDirection::RightToLeft;
01145         const bool isLeft = (args.Key() == winrt::VirtualKey::Left && !isRightToLeft) || (args.Key() == winrt::VirtualKey::Right && isRightToLeft);
01146         const bool isRight = (args.Key() == winrt::VirtualKey::Right && !isRightToLeft) || (args.Key() == winrt::VirtualKey::Left && isRightToLeft);
01147         const bool isDown = args.Key() == winrt::VirtualKey::Down;
01148         const bool isUp = args.Key() == winrt::VirtualKey::Up;
01149
01150         // To avoid code duplication, we'll use the key directionality to determine
01151         // both which control list to use and in which direction to iterate through
01152         // it to find the next control to focus.  Then we'll do that iteration
01153         // to focus the next control.
01154         auto const& accessibleControls{ isUp || isDown ? m_verticallyAccessibleControls : m_horizontallyAccessibleControls };
01155         int const startIndex = isLeft || isUp ? accessibleControls.Size() - 1 : 0;
01156         int const endIndex = isLeft || isUp ? -1 : accessibleControls.Size();
01157         int const deltaIndex = isLeft || isUp ? -1 : 1;
01158         bool const shouldLoop = isUp || isDown;
01159         winrt::Control focusedControl{ nullptr };
01160         int focusedControlIndex = -1;
01161
01162         for (int i = startIndex;
01163             // We'll stop looping at the end index unless we're looping,
01164             // in which case we want to wrap back around to the start index.
01165             (i != endIndex || shouldLoop) ||
01166             // If we found a focused control but have looped all the way back around,
01167             // then there wasn't another control to focus, so we should quit.
01168             (focusedControlIndex > 0 && i == focusedControlIndex);
01169             i += deltaIndex)
01170         {
01171             // If we've reached the end index, that means we want to loop.
01172             // We'll wrap around to the start index.
01173             if (i == endIndex)
01174             {
01175                 MUX_ASSERT(shouldLoop);
01176
01177                 if (focusedControl)
01178                 {
01179                     i = startIndex;
01180                 }
01181                 else
01182                 {
01183                     // If no focused control was found after going through the entire list of controls,
01184                     // then we have nowhere for focus to go.  Let's early-out in that case.
01185                     break;
01186                 }
01187             }
01188
01189             auto const& control = accessibleControls.GetAt(i);
01190
01191             // If we've yet to find the focused control, we'll keep looking for it.
01192             // Otherwise, we'll try to focus the next control after it.
01193             if (!focusedControl)
01194             {
01195                 if (control.FocusState() != winrt::FocusState::Unfocused)
01196                 {
01197                     focusedControl = control;
01198                     focusedControlIndex = i;
01199                 }
01200             }
01201             else if (IsControlFocusable(control, false /*checkTabStop*/))
01202             {
01203                 // If the control we're trying to focus is in the secondary command list,
01204                 // then we'll make sure that that list is open before trying to focus the control.
01205                 if (auto const& controlAsCommandBarElement = control.try_as<winrt::ICommandBarElement>())
01206                 {
01207                     uint32_t index = 0;
01208                     if (SecondaryCommands().IndexOf(controlAsCommandBarElement, index) && !IsOpen())
01209                     {
01210                         IsOpen(true);
01211                     }
01212                 }
01213
01214                 FocusControl(
01215                     accessibleControls.GetAt(i) /*newFocus*/,
01216                     focusedControl /*oldFocus*/,
01217                     winrt::FocusState::Keyboard /*focusState*/,
01218                     true /*updateTabStop*/);
01219
01220                 args.Handled(true);
01221                 break;
01222             }
01223         }
01224
01225         if (!args.Handled())
01226         {
01227             // Occurs for example with Right key while MoreButton has focus. Stay on that MoreButton.
01228             args.Handled(true);
01229         }
01230         break;
01231     }
01232     }
01233
01234     __super::OnKeyDown(args);
01235 }
01236
01237 bool CommandBarFlyoutCommandBar::IsControlFocusable(
01238     winrt::Control const& control,
01239     bool checkTabStop)
01240 {
01241     return control &&
01242         control.Visibility() == winrt::Visibility::Visible &&
01243         (control.IsEnabled() || control.AllowFocusWhenDisabled()) &&
01244         (control.IsTabStop() || (!checkTabStop && !control.try_as<winrt::AppBarSeparator>())); // AppBarSeparator is not focusable if IsTabStop is false
01245 }
01246
01247 winrt::Control CommandBarFlyoutCommandBar::GetFirstTabStopControl(
01248     winrt::IObservableVector<winrt::ICommandBarElement> const& commands)
01249 {
01250     for (const auto& command : commands)
01251     {
01252         if (auto commandAsControl = command.try_as<winrt::Control>())
01253         {
01254             if (commandAsControl.IsTabStop())
01255             {
01256                 return commandAsControl;
01257             }
01258         }
01259     }
01260     return nullptr;
01261 }
01262
01263 winrt::IAsyncOperation<bool> CommandBarFlyoutCommandBar::FocusControl(
01264     winrt::Control newFocus,
01265     winrt::Control oldFocus,
01266     winrt::FocusState focusState,
01267     bool updateTabStop)
01268 {
01269     MUX_ASSERT(newFocus);
01270
01271     if (updateTabStop)
01272     {
01273         newFocus.IsTabStop(true);
01274     }
01275
01276     // Setting focus can cause us to enter the window message handler loop, which is bad if
01277     // CXcpDispatcher::OnReentrancyProtectedWindowMessage is on the callstack, since that can lead to reentry.
01278     // Switching to a background thread and then back to the UI thread ensures that this call to Control.Focus()
01279     // occurs outside that callstack.
01280     winrt::apartment_context uiThread;
01281     co_await winrt::resume_background();
01282     co_await uiThread;
01283
01284     if (newFocus.Focus(focusState))
01285     {
01286         if (oldFocus && updateTabStop && oldFocus != newFocus)
01287         {
01288             oldFocus.IsTabStop(false);
01289         }
01290         co_return true;
01291     }
01292     co_return false;
01293 }
01294
01295 winrt::IAsyncOperation<bool> CommandBarFlyoutCommandBar::FocusCommand(
01296     winrt::IObservableVector<winrt::ICommandBarElement> commands,
01297     winrt::Control moreButton,
01298     winrt::FocusState focusState,
01299     bool firstCommand,
01300     bool ensureTabStopUniqueness)
01301 {
01302     COMMANDBARFLYOUT_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, nullptr);
01303
01304     MUX_ASSERT(commands);
01305
01306     // Give focus to the first or last focusable command
01307     winrt::Control focusedControl = nullptr;
01308     int startIndex = 0;
01309     int endIndex = static_cast<int>(commands.Size());
01310     int deltaIndex = 1;
01311
01312     if (!firstCommand)
01313     {
01314         deltaIndex = -1;
01315         startIndex = endIndex - 1;
01316         endIndex = -1;
01317     }
01318
01319     for (int index = startIndex; index != endIndex; index += deltaIndex)
01320     {
01321         auto command = commands.GetAt(index);
01322
01323         if (auto commandAsControl = command.try_as<winrt::Control>())
01324         {
01325             if (IsControlFocusable(commandAsControl, !ensureTabStopUniqueness /*checkTabStop*/))
01326             {
01327                 if (!focusedControl)
01328                 {
01329                     if (co_await FocusControl(
01330                         commandAsControl /*newFocus*/,
01331                         nullptr /*oldFocus*/,
01332                         focusState /*focusState*/,
01333                         ensureTabStopUniqueness /*updateTabStop*/))
01334                     {
01335                         if (ensureTabStopUniqueness && moreButton && moreButton.IsTabStop())
01336                         {
01337                             moreButton.IsTabStop(false);
01338                         }
01339
01340                         focusedControl = commandAsControl;
01341
01342                         if (!ensureTabStopUniqueness)
01343                         {
01344                             break;
01345                         }
01346                     }
01347                 }
01348                 else if (focusedControl && commandAsControl.IsTabStop())
01349                 {
01350                     commandAsControl.IsTabStop(false);
01351                 }
01352             }
01353         }
01354     }
01355
01356     co_return focusedControl != nullptr;
01357 }
01358
01359 void CommandBarFlyoutCommandBar::EnsureTabStopUniqueness(
01360     winrt::IObservableVector<winrt::ICommandBarElement> const& commands,
01361     winrt::Control const& moreButton)
01362 {
01363     COMMANDBARFLYOUT_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, nullptr);
01364
01365     MUX_ASSERT(commands);
01366
01367     bool tabStopSeen = moreButton && moreButton.IsTabStop();
01368
01369     if (tabStopSeen || GetFirstTabStopControl(commands))
01370     {
01371         // Make sure only one command or the MoreButton has IsTabStop set
01372         for (const auto& command : commands)
01373         {
01374             if (auto commandAsControl = command.try_as<winrt::Control>())
01375             {
01376                 if (IsControlFocusable(commandAsControl, false /*checkTabStop*/) && commandAsControl.IsTabStop())
01377                 {
01378                     if (!tabStopSeen)
01379                     {
01380                         tabStopSeen = true;
01381                     }
01382                     else
01383                     {
01384                         commandAsControl.IsTabStop(false);
01385                     }
01386                 }
01387             }
01388         }
01389     }
01390     else
01391     {
01392         // Set IsTabStop to first focusable command
01393         for (const auto& command : commands)
01394         {
01395             if (auto commandAsControl = command.try_as<winrt::Control>())
01396             {
01397                 if (IsControlFocusable(commandAsControl, false /*checkTabStop*/))
01398                 {
01399                     commandAsControl.IsTabStop(true);
01400                     break;
01401                 }
01402             }
01403         }
01404     }
01405 }
01406
01407 void CommandBarFlyoutCommandBar::ClearShadow()
01408 {
01409     winrt::VisualStateManager::GoToState(*this, L"NoOuterOverflowContentRootShadow", true/*useTransitions*/);
01410 }
01411
01412 void CommandBarFlyoutCommandBar::SetPresenter(winrt::FlyoutPresenter const& presenter)
01413 {
01414     m_flyoutPresenter = winrt::make_weak(presenter);
01415 }
01416
01417 void CommandBarFlyoutCommandBar::SetPresenterName(winrt::FlyoutPresenter const& presenter)
01418 {
01419     // Since DropShadows don't play well with clip entrance animations for the presenter,
01420     // we'll need to fade it in. This name helps us locate the element to set the fade in
01421     // flag in the OS code.
01422     if (presenter)
01423     {
01424         if (OpenAnimationKind() == CommandBarFlyoutOpenCloseAnimationKind::Clip)
01425         {
01426             presenter.Name(L"DropShadowFadeInTarget");
01427         }
01428         else
01429         {
01430             presenter.Name(L"");
01431         }
01432     }
01433 }
01434
01435 bool CommandBarFlyoutCommandBar::HasSecondaryOpenCloseAnimations()
01436 {
01437     return SharedHelpers::IsAnimationsEnabled() &&
01438            static_cast<bool>(m_expandedDownToCollapsedStoryboardRevoker ||
01439                              m_expandedUpToCollapsedStoryboardRevoker ||
01440                              m_collapsedToExpandedUpStoryboardRevoker ||
01441                              m_collapsedToExpandedDownStoryboardRevoker);
01442 }
01443
01444 void CommandBarFlyoutCommandBar::AttachEventsToSecondaryStoryboards()
01445 {
01446     winrt::IControlProtected thisAsControlProtected = *this;
01447
01448     const auto addDropShadowFunc = [this](auto const&, auto const&)
01449     {
01450         if (SharedHelpers::IsAnimationsEnabled())
01451         {
01452             if (const auto owningFlyout = m_owningFlyout.get())
01453             {
01454                 if (const auto actualFlyout = winrt::get_self<CommandBarFlyout>(owningFlyout))
01455                 {
01456                     actualFlyout->AddDropShadow();
01457                 }
01458             }
01459         }
01460     };
01461
01462     if (const auto expandedDownToCollapsed = GetTemplateChildT<winrt::Storyboard>(L"ExpandedDownToCollapsed", thisAsControlProtected))
01463     {
01464         m_expandedDownToCollapsedStoryboardRevoker = expandedDownToCollapsed.Completed(winrt::auto_revoke, addDropShadowFunc);
01465     }
01466
01467     if (const auto expandedUpToCollapsed = GetTemplateChildT<winrt::Storyboard>(L"ExpandedUpToCollapsed", thisAsControlProtected))
01468     {
01469         m_expandedUpToCollapsedStoryboardRevoker = expandedUpToCollapsed.Completed(winrt::auto_revoke, addDropShadowFunc);
01470     }
01471
01472     if (const auto collapsedToExpandedUp = GetTemplateChildT<winrt::Storyboard>(L"CollapsedToExpandedUp", thisAsControlProtected))
01473     {
01474         m_collapsedToExpandedUpStoryboardRevoker = collapsedToExpandedUp.Completed(winrt::auto_revoke, addDropShadowFunc);
01475     }
01476
01477     if (const auto collapsedToExpandedDown = GetTemplateChildT<winrt::Storyboard>(L"CollapsedToExpandedDown", thisAsControlProtected))
01478     {
01479         m_collapsedToExpandedDownStoryboardRevoker = collapsedToExpandedDown.Completed(winrt::auto_revoke, addDropShadowFunc);
01480     }
01481 }
01482
01483 void CommandBarFlyoutCommandBar::BindOwningFlyoutPresenterToCornerRadius()
01484 {
01485     if (const auto owningFlyout = m_owningFlyout.get())
01486     {
01487         if (const auto actualFlyout = winrt::get_self<CommandBarFlyout>(owningFlyout))
01488         {
01489             winrt::IControlProtected thisAsControlProtected = *this;
01490             if (const auto root = GetTemplateChildT<winrt::Grid>(L"LayoutRoot", thisAsControlProtected))
01491             {
01492                 winrt::Binding binding;
01493                 binding.Source(root);
01494                 binding.Path(winrt::PropertyPath(L"CornerRadius"));
01495                 binding.Mode(winrt::BindingMode::OneWay);
01496                 if (auto&& presenter = actualFlyout->GetPresenter().get())
01497                 {
01498                     presenter.SetBinding(winrt::Control::CornerRadiusProperty(), binding);
01499                 }
01500             }
01501         }
01502     }
01503 }
01504
01505 // Invoked by CommandBarFlyout when a secondary AppBarButton or AppBarToggleButton dependency property changed.
01506 void CommandBarFlyoutCommandBar::OnCommandBarElementDependencyPropertyChanged()
01507 {
01508     COMMANDBARFLYOUT_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this);
01509
01510     // Only refresh the UI when the CommandBarFlyoutCommandBar is already open since it will be refreshed anyways in the event it gets opened.
01511     if (IsOpen())
01512     {
01513         UpdateUI(!m_commandBarFlyoutIsOpening, true /*isForSizeChange*/);
01514     }
01515 }
01516
01517 void CommandBarFlyoutCommandBar::OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
01518 {
01519     const winrt::IDependencyProperty& property = args.Property();
01520
01521     if (property == s_SystemBackdropProperty)
01522     {
01523         if (args.NewValue() != args.OldValue())
01524         {
01525             const auto& oldSystemBackdrop = args.OldValue().try_as<winrt::SystemBackdrop>();
01526             const auto& newSystemBackdrop = args.NewValue().try_as<winrt::SystemBackdrop>();
01527
01528             if (oldSystemBackdrop)
01529             {
01530                 oldSystemBackdrop.OnTargetDisconnected(m_backdropLink);
01531                 oldSystemBackdrop.OnTargetDisconnected(m_overflowPopupBackdropLink);
01532                 m_registeredWithSystemBackdrop = false;
01533             }
01534
01535             m_systemBackdrop = newSystemBackdrop;
01536
01537             if (newSystemBackdrop)
01538             {
01539                 if (!m_backdropLink)
01540                 {
01541                     auto visual = winrt::ElementCompositionPreview::GetElementVisual(*this);
01542                     auto compositor = visual.Compositor();
01543                     m_backdropLink = winrt::ContentExternalBackdropLink::Create(compositor);
01544                     m_overflowPopupBackdropLink = winrt::ContentExternalBackdropLink::Create(compositor);
01545                 }
01546
01547                 TryConnectSystemBackdrop();
01548             }
01549             else
01550             {
01551                 m_backdropLink = nullptr;
01552                 m_overflowPopupBackdropLink = nullptr;
01553             }
01554         }
01555     }
01556 }
01557
01558 void CommandBarFlyoutCommandBar::TryConnectSystemBackdrop()
01559 {
01560     if (!m_registeredWithSystemBackdrop)
01561     {
01562         if (auto systemBackdrop = m_systemBackdrop.get())
01563         {
01564             MUX_ASSERT(m_backdropLink);
01565             MUX_ASSERT(m_overflowPopupBackdropLink);
01566
01567             auto xamlRoot = XamlRoot();
01568
01569             if (xamlRoot)
01570             {
01571                 systemBackdrop.OnTargetConnected(m_backdropLink, XamlRoot());
01572                 systemBackdrop.OnTargetConnected(m_overflowPopupBackdropLink, XamlRoot());
01573                 m_registeredWithSystemBackdrop = true;
01574             }
01575         }
01576     }
01577 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AnimatedChevronDownSmallVisualSource.properties.cpp Source File

  • Generated

AnimatedChevronDownSmallVisualSource.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "AnimatedChevronDownSmallVisualSource.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::AnimatedVisuals
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(AnimatedChevronDownSmallVisualSource)
00012 }
00013
00014 #include "AnimatedChevronDownSmallVisualSource.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ViewportManagerDownlevel.cpp Source File

  • Repeater

ViewportManagerDownlevel.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "ViewportManagerDownLevel.h"
00008 #include "ItemsRepeater.h"
00009 #include "layout.h"
00010
00011 // Pixel delta by which to inflate the cache buffer on each side.  Rather than fill the entire
00012 // cache buffer all at once, we chunk the work to make the UI thread more responsive.  We inflate
00013 // the cache buffer from 0 to a max value determined by the Maximum[Horizontal,Vertical]CacheLength
00014 // properties.
00015 static double CacheBufferPerSideInflationPixelDelta = 40.0;
00016
00017 ViewportManagerDownLevel::ViewportManagerDownLevel(ItemsRepeater* owner) :
00018     m_owner(owner),
00019     m_horizontalScroller(owner),
00020     m_verticalScroller(owner),
00021     m_innerScrollableScroller(owner),
00022     m_makeAnchorElement(owner),
00023     m_cacheBuildAction(owner)
00024 {
00025     // ItemsRepeater is not fully constructed yet. Don't interact with it.
00026 }
00027
00028 winrt::UIElement ViewportManagerDownLevel::SuggestedAnchor() const
00029 {
00030     // The element generated during the ItemsRepeater.MakeAnchor call has precedence over the next tick.
00031     winrt::UIElement suggestedAnchor = m_makeAnchorElement.get();
00032     winrt::UIElement owner = *m_owner;
00033
00034     if (!suggestedAnchor)
00035     {
00036         // We only care about what the first scrollable scroller is tracking (i.e. inner most).
00037         // A scroller is considered scrollable if IRepeaterScrollingSurface.IsHorizontallyScrollable
00038         // or IsVerticallyScroller is true.
00039         const auto anchorElement =
00040             m_innerScrollableScroller ?
00041             m_innerScrollableScroller.get().AnchorElement() :
00042             nullptr;
00043
00044         if (anchorElement)
00045         {
00046             // We can't simply return anchorElement because, in case of nested Repeaters, it may not
00047             // be a direct child of ours, or even an indirect child. We need to walk up the tree starting
00048             // from anchorElement to figure out what child of ours (if any) to use as the suggested element.
00049
00050             auto child = anchorElement;
00051             auto parent = CachedVisualTreeHelpers::GetParent(child).as<winrt::UIElement>();
00052             while (parent)
00053             {
00054                 if (parent == owner)
00055                 {
00056                     suggestedAnchor = child;
00057                     break;
00058                 }
00059
00060                 child = parent;
00061                 parent = CachedVisualTreeHelpers::GetParent(parent).as<winrt::UIElement>();
00062             }
00063         }
00064     }
00065
00066     return suggestedAnchor;
00067 }
00068
00069 void ViewportManagerDownLevel::HorizontalCacheLength(double value)
00070 {
00071     if (m_maximumHorizontalCacheLength != value)
00072     {
00073         ValidateCacheLength(value);
00074         m_maximumHorizontalCacheLength = value;
00075         ResetCacheBuffer();
00076     }
00077 }
00078
00079 void ViewportManagerDownLevel::VerticalCacheLength(double value)
00080 {
00081     if (m_maximumVerticalCacheLength != value)
00082     {
00083         ValidateCacheLength(value);
00084         m_maximumVerticalCacheLength = value;
00085         ResetCacheBuffer();
00086     }
00087 }
00088
00089 winrt::Rect ViewportManagerDownLevel::GetLayoutVisibleWindow() const
00090 {
00091     auto visibleWindow = m_visibleWindow;
00092
00093     if (m_makeAnchorElement && m_isAnchorOutsideRealizedRange)
00094     {
00095         // The anchor is not necessarily laid out yet. Its position should default
00096         // to zero and the layout origin is expected to change once layout is done.
00097         // Until then, we need a window that's going to protect the anchor from
00098         // getting recycled.
00099
00100         // Also, we only want to mess with the realization rect iff the anchor is not inside it.
00101         // If we fiddle with an anchor that is already inside the realization rect,
00102         // shifting the realization rect results in repeater, layout and scroller thinking that it needs to act upon StartBringIntoView.
00103         // We do NOT want that!
00104         visibleWindow.X = 0.0f;
00105         visibleWindow.Y = 0.0f;
00106     }
00107     else if (HasScrollers())
00108     {
00109         visibleWindow.X += m_layoutExtent.X + m_expectedViewportShift.X;
00110         visibleWindow.Y += m_layoutExtent.Y + m_expectedViewportShift.Y;
00111     }
00112
00113     return visibleWindow;
00114 }
00115
00116 winrt::Rect ViewportManagerDownLevel::GetLayoutRealizationWindow() const
00117 {
00118     auto realizationWindow = GetLayoutVisibleWindow();
00119     if (HasScrollers())
00120     {
00121         realizationWindow.X -= static_cast<float>(m_horizontalCacheBufferPerSide);
00122         realizationWindow.Y -= static_cast<float>(m_verticalCacheBufferPerSide);
00123         realizationWindow.Width += static_cast<float>(m_horizontalCacheBufferPerSide) * 2.0f;
00124         realizationWindow.Height += static_cast<float>(m_verticalCacheBufferPerSide) * 2.0f;
00125     }
00126
00127     return realizationWindow;
00128 }
00129
00130 void ViewportManagerDownLevel::SetLayoutExtent(const winrt::Rect& extent)
00131 {
00132     m_expectedViewportShift.X += m_layoutExtent.X - extent.X;
00133     m_expectedViewportShift.Y += m_layoutExtent.Y - extent.Y;
00134
00135     // We tolerate viewport imprecisions up to 1 pixel to avoid invaliding layout too much.
00136     if (std::abs(m_expectedViewportShift.X) > 1.f || std::abs(m_expectedViewportShift.Y) > 1.f)
00137     {
00138         REPEATER_TRACE_INFO(L"%ls: \tExpecting viewport shift of (%.0f,%.0f) \n",
00139             GetLayoutId().data(), m_expectedViewportShift.X, m_expectedViewportShift.Y);
00140     }
00141
00142     m_layoutExtent = extent;
00143
00144     // We just finished a measure pass and have a new extent.
00145     // Let's make sure the scrollers will run its arrange so that they track the anchor.
00146     const auto outerScroller = GetOuterScroller();
00147     if (outerScroller) { outerScroller.as<winrt::UIElement>().InvalidateArrange(); }
00148     if (m_horizontalScroller && m_horizontalScroller != outerScroller) { m_horizontalScroller.as<winrt::UIElement>().InvalidateArrange(); }
00149     if (m_verticalScroller && m_verticalScroller != outerScroller) { m_verticalScroller.as<winrt::UIElement>().InvalidateArrange(); }
00150 }
00151
00152 void ViewportManagerDownLevel::OnLayoutChanged(bool isVirtualizing)
00153 {
00154     m_managingViewportDisabled = !isVirtualizing;
00155     m_layoutExtent = {};
00156     m_expectedViewportShift = {};
00157     ResetCacheBuffer();
00158 }
00159
00160 void ViewportManagerDownLevel::OnElementCleared(const winrt::UIElement& element)
00161 {
00162     if (m_horizontalScroller)
00163     {
00164         m_horizontalScroller.get().UnregisterAnchorCandidate(element);
00165     }
00166
00167     if (m_verticalScroller && m_verticalScroller != m_horizontalScroller)
00168     {
00169         m_verticalScroller.get().UnregisterAnchorCandidate(element);
00170     }
00171 }
00172
00173 void ViewportManagerDownLevel::OnOwnerMeasuring()
00174 {
00175     winrt::Rect currentLayoutRealizationWindow = GetLayoutRealizationWindow();
00176
00177     if ((m_horizontalCacheBufferPerSide != 0.0 || m_verticalCacheBufferPerSide != 0.0) &&
00178         (m_lastLayoutRealizationWindow.Width <= 0.0f || m_lastLayoutRealizationWindow.Height <= 0.0f ||
00179             currentLayoutRealizationWindow.Width <= 0.0f || currentLayoutRealizationWindow.Height <= 0.0f ||
00180             !SharedHelpers::DoRectsIntersect(m_lastLayoutRealizationWindow, currentLayoutRealizationWindow)))
00181     {
00182         // Two consecutive measure passes use disconnected realization windows.
00183         // Reset the potential cache buffer so that it regrows from scratch.
00184         ResetLayoutRealizationWindowCacheBuffer();
00185     }
00186
00187     m_lastLayoutRealizationWindow = currentLayoutRealizationWindow;
00188 }
00189
00190 void ViewportManagerDownLevel::OnOwnerArranged()
00191 {
00192     if (m_managingViewportDisabled)
00193     {
00194         return;
00195     }
00196
00197     m_expectedViewportShift = {};
00198
00199     EnsureScrollers();
00200
00201     if (HasScrollers())
00202     {
00203         const double maximumHorizontalCacheBufferPerSide = m_maximumHorizontalCacheLength * m_visibleWindow.Width / 2.0;
00204         const double maximumVerticalCacheBufferPerSide = m_maximumVerticalCacheLength * m_visibleWindow.Height / 2.0;
00205
00206         const bool continueBuildingCache =
00207             m_horizontalCacheBufferPerSide < maximumHorizontalCacheBufferPerSide ||
00208             m_verticalCacheBufferPerSide < maximumVerticalCacheBufferPerSide;
00209
00210         if (continueBuildingCache)
00211         {
00212             m_horizontalCacheBufferPerSide += CacheBufferPerSideInflationPixelDelta;
00213             m_verticalCacheBufferPerSide += CacheBufferPerSideInflationPixelDelta;
00214
00215             m_horizontalCacheBufferPerSide = std::min(m_horizontalCacheBufferPerSide, maximumHorizontalCacheBufferPerSide);
00216             m_verticalCacheBufferPerSide = std::min(m_verticalCacheBufferPerSide, maximumVerticalCacheBufferPerSide);
00217
00218             // Since we grow the cache buffer at the end of the arrange pass,
00219             // we need to register work even if we just reached cache potential.
00220             RegisterCacheBuildWork();
00221         }
00222     }
00223 }
00224
00225 void ViewportManagerDownLevel::OnMakeAnchor(const winrt::UIElement& anchor, const bool isAnchorOutsideRealizedRange)
00226 {
00227     m_makeAnchorElement.set(anchor);
00228     m_isAnchorOutsideRealizedRange = isAnchorOutsideRealizedRange;
00229 }
00230
00231 void ViewportManagerDownLevel::OnBringIntoViewRequested(const winrt::BringIntoViewRequestedEventArgs& args)
00232 {
00233     if (!m_managingViewportDisabled)
00234     {
00235         // We do not animate bring-into-view operations where the anchor is disconnected because
00236         // it doesn't look good (the blank space is obvious because the layout can't keep track
00237         // of two realized ranges while the animation is going on).
00238         if (m_isAnchorOutsideRealizedRange)
00239         {
00240             args.AnimationDesired(false);
00241         }
00242     }
00243 }
00244
00245 void ViewportManagerDownLevel::ResetScrollers()
00246 {
00247     m_parentScrollers.clear();
00248     m_horizontalScroller.set(nullptr);
00249     m_verticalScroller.set(nullptr);
00250     m_innerScrollableScroller.set(nullptr);
00251
00252     m_ensuredScrollers = false;
00253 }
00254
00255 void ViewportManagerDownLevel::OnCacheBuildActionCompleted()
00256 {
00257     m_cacheBuildAction.set(nullptr);
00258     m_owner->InvalidateMeasure();
00259 }
00260
00261 void ViewportManagerDownLevel::OnViewportChanged(const winrt::IRepeaterScrollingSurface&, const bool isFinal)
00262 {
00263     if (!m_managingViewportDisabled)
00264     {
00265         if (isFinal)
00266         {
00267             // Note that isFinal will never be true for input based manipulations.
00268             m_makeAnchorElement.set(nullptr);
00269             m_isAnchorOutsideRealizedRange = false;
00270         }
00271
00272         TryInvalidateMeasure();
00273     }
00274 }
00275
00276 void ViewportManagerDownLevel::OnPostArrange(const winrt::IRepeaterScrollingSurface&)
00277 {
00278     if (!m_managingViewportDisabled)
00279     {
00280         UpdateViewport();
00281
00282         if (m_visibleWindow == winrt::Rect())
00283         {
00284             // We got cleared.
00285             m_layoutExtent = {};
00286         }
00287         else
00288         {
00289             // Register our non-recycled children as candidates for element tracking.
00290             if (m_horizontalScroller || m_verticalScroller)
00291             {
00292                 auto children = m_owner->Children();
00293                 for (unsigned i = 0u; i < children.Size(); ++i)
00294                 {
00295                     const auto element = children.GetAt(i);
00296                     const auto virtInfo = ItemsRepeater::GetVirtualizationInfo(element);
00297                     if (virtInfo->IsHeldByLayout())
00298                     {
00299                         if (m_horizontalScroller)
00300                         {
00301                             m_horizontalScroller.get().RegisterAnchorCandidate(element);
00302                         }
00303
00304                         if (m_verticalScroller && m_verticalScroller != m_horizontalScroller)
00305                         {
00306                             m_verticalScroller.get().RegisterAnchorCandidate(element);
00307                         }
00308                     }
00309                 }
00310             }
00311         }
00312     }
00313 }
00314
00315 void ViewportManagerDownLevel::OnConfigurationChanged(const winrt::IRepeaterScrollingSurface& sender)
00316 {
00317     m_ensuredScrollers = false;
00318     TryInvalidateMeasure();
00319 }
00320
00321 void ViewportManagerDownLevel::EnsureScrollers()
00322 {
00323     if (!m_ensuredScrollers)
00324     {
00325         ResetScrollers();
00326
00327         auto parent = CachedVisualTreeHelpers::GetParent(*m_owner);
00328         while (parent)
00329         {
00330             const auto scroller = parent.try_as<winrt::IRepeaterScrollingSurface>();
00331             if (scroller && AddScroller(scroller))
00332             {
00333                 break;
00334             }
00335
00336             parent = CachedVisualTreeHelpers::GetParent(parent);
00337         }
00338
00339         if (m_parentScrollers.empty())
00340         {
00341             // We usually update the viewport in the post arrange handler. But, since we don't have
00342             // a scroller, let's do it now.
00343             UpdateViewport();
00344         }
00345         else
00346         {
00347             auto& outerScrollerInfo = m_parentScrollers.back();
00348             outerScrollerInfo.PostArrangeToken = outerScrollerInfo.Scroller().PostArrange(winrt::auto_revoke, { this, &ViewportManagerDownLevel::OnPostArrange });
00349         }
00350
00351         m_ensuredScrollers = true;
00352     }
00353 }
00354
00355 bool ViewportManagerDownLevel::AddScroller(const winrt::IRepeaterScrollingSurface& scroller)
00356 {
00357     MUX_ASSERT(!(m_horizontalScroller && m_verticalScroller));
00358
00359     const bool isHorizontallyScrollable = scroller.IsHorizontallyScrollable();
00360     const bool isVerticallyScrollable = scroller.IsVerticallyScrollable();
00361     const bool allScrollersSet = (m_horizontalScroller || isHorizontallyScrollable) && (m_verticalScroller || isVerticallyScrollable);
00362     const bool setHorizontalScroller = !m_horizontalScroller && isHorizontallyScrollable;
00363     const bool setVerticalScroller = !m_verticalScroller && isVerticallyScrollable;
00364     const bool setInnerScrollableScroller = !m_innerScrollableScroller && (setHorizontalScroller || setVerticalScroller);
00365
00366     if (setHorizontalScroller) { m_horizontalScroller.set(scroller); }
00367     if (setVerticalScroller) { m_verticalScroller.set(scroller); }
00368     if (setInnerScrollableScroller) { m_innerScrollableScroller.set(scroller); }
00369
00370     auto scrollerInfo = ScrollerInfo(
00371         m_owner,
00372         scroller);
00373
00374     scrollerInfo.ConfigurationChangedToken = scroller.ConfigurationChanged(winrt::auto_revoke, { this, &ViewportManagerDownLevel::OnConfigurationChanged });
00375     if (setHorizontalScroller || setVerticalScroller)
00376     {
00377         scrollerInfo.ViewportChangedToken = scroller.ViewportChanged(winrt::auto_revoke, { this, &ViewportManagerDownLevel::OnViewportChanged });
00378     }
00379
00380     m_parentScrollers.push_back(std::move(scrollerInfo));
00381     return allScrollersSet;
00382 }
00383
00384 void ViewportManagerDownLevel::UpdateViewport()
00385 {
00386     assert(!m_managingViewportDisabled);
00387
00388     const auto previousVisibleWindow = m_visibleWindow;
00389     const auto horizontalVisibleWindow =
00390         m_horizontalScroller ?
00391         m_horizontalScroller.get().GetRelativeViewport(*m_owner) :
00392         winrt::Rect();
00393     const auto verticalVisibleWindow =
00394         m_verticalScroller ?
00395         (m_verticalScroller.get() == m_horizontalScroller.get() ?
00396             horizontalVisibleWindow :
00397             m_verticalScroller.get().GetRelativeViewport(*m_owner)) :
00398         winrt::Rect();
00399     const auto currentVisibleWindow =
00400         HasScrollers() ?
00401         winrt::Rect
00402         {
00403             m_horizontalScroller ? horizontalVisibleWindow.X : verticalVisibleWindow.X,
00404             m_verticalScroller ? verticalVisibleWindow.Y : horizontalVisibleWindow.Y,
00405             m_horizontalScroller ? horizontalVisibleWindow.Width : verticalVisibleWindow.Width,
00406             m_verticalScroller ? verticalVisibleWindow.Height : horizontalVisibleWindow.Height
00407         } :
00408         winrt::Rect{ 0.0f, 0.0f, std::numeric_limits<float>::max(), std::numeric_limits<float>::max() };
00409
00410     if (-currentVisibleWindow.X <= ItemsRepeater::ClearedElementsArrangePosition.X &&
00411         -currentVisibleWindow.Y <= ItemsRepeater::ClearedElementsArrangePosition.Y)
00412     {
00413         // We got cleared.
00414         m_visibleWindow = {};
00415     }
00416     else
00417     {
00418         REPEATER_TRACE_INFO(L"%ls: \tViewport: (%.0f,%.0f,%.0f,%.0f)->(%.0f,%.0f,%.0f,%.0f). \n",
00419             GetLayoutId().data(),
00420             previousVisibleWindow.X, previousVisibleWindow.Y, previousVisibleWindow.Width, previousVisibleWindow.Height,
00421             currentVisibleWindow.X, currentVisibleWindow.Y, currentVisibleWindow.Width, currentVisibleWindow.Height);
00422         m_visibleWindow = currentVisibleWindow;
00423     }
00424
00425     const bool viewportChanged =
00426         std::abs(m_visibleWindow.X - previousVisibleWindow.X) > 1 ||
00427         std::abs(m_visibleWindow.Y - previousVisibleWindow.Y) > 1 ||
00428         m_visibleWindow.Width != previousVisibleWindow.Width ||
00429         m_visibleWindow.Height != previousVisibleWindow.Height;
00430
00431     if (viewportChanged)
00432     {
00433         TryInvalidateMeasure();
00434     }
00435 }
00436
00437 void ViewportManagerDownLevel::ResetLayoutRealizationWindowCacheBuffer()
00438 {
00439     ResetCacheBuffer(false /*registerCacheBuildWork*/);
00440 }
00441
00442 void ViewportManagerDownLevel::ResetCacheBuffer(bool registerCacheBuildWork)
00443 {
00444     m_horizontalCacheBufferPerSide = 0.0;
00445     m_verticalCacheBufferPerSide = 0.0;
00446
00447     if (!m_managingViewportDisabled && registerCacheBuildWork)
00448     {
00449         // We need to start building the realization buffer again.
00450         RegisterCacheBuildWork();
00451     }
00452 }
00453
00454 void ViewportManagerDownLevel::ValidateCacheLength(double cacheLength)
00455 {
00456     if (cacheLength < 0.0 || std::isinf(cacheLength) || std::isnan(cacheLength))
00457     {
00458         throw winrt::hresult_invalid_argument(L"The maximum cache length must be equal or superior to zero.");
00459     }
00460 }
00461
00462 void ViewportManagerDownLevel::RegisterCacheBuildWork()
00463 {
00464     if (m_owner->Layout() &&
00465         !m_cacheBuildAction)
00466     {
00467         auto strongOwner = m_owner->get_strong();
00468         m_cacheBuildAction.set(m_owner
00469             ->Dispatcher()
00470             // We capture 'owner' (a strong refernce on ItemsRepeater) to make sure ItemsRepeater is still around
00471             // when the async action completes. By protecting ItemsRepeater, we also ensure that this instance
00472             // of ViewportManager (referenced by 'this' pointer) is valid because the lifetime of ItemsRepeater
00473             // and ViewportManager is the same (see ItemsRepeater::m_viewportManager).
00474             // We can't simply hold a strong reference on ViewportManager because it's not a COM object.
00475             .RunIdleAsync([this, strongOwner](const winrt::IdleDispatchedHandlerArgs&)
00476             {
00477                 OnCacheBuildActionCompleted();
00478             }));
00479     }
00480 }
00481
00482 void ViewportManagerDownLevel::TryInvalidateMeasure()
00483 {
00484     // Don't invalidate measure if we have an invalid window.
00485     if (m_visibleWindow != winrt::Rect())
00486     {
00487         // We invalidate measure instead of just invalidating arrange because
00488         // we don't invalidate measure in UpdateViewport if the view is changing to
00489         // avoid layout cycles.
00490         REPEATER_TRACE_INFO(L"%ls: \tInvalidating measure due to viewport change. \n", GetLayoutId().data());
00491         m_owner->InvalidateMeasure();
00492     }
00493 }
00494
00495 winrt::IRepeaterScrollingSurface ViewportManagerDownLevel::GetOuterScroller() const
00496 {
00497     winrt::IRepeaterScrollingSurface scroller = nullptr;
00498
00499     if (!m_parentScrollers.empty())
00500     {
00501         scroller = m_parentScrollers.back().Scroller();
00502     }
00503
00504     return scroller;
00505 }
00506
00507 winrt::hstring ViewportManagerDownLevel::GetLayoutId()
00508 {
00509     winrt::hstring layoutId{};
00510     if (auto layout = m_owner->Layout())
00511     {
00512         layoutId = layout.as<Layout>()->LayoutId();
00513     }
00514
00515     return layoutId;
00516 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewCollapsedEventArgs Member List

This is the complete list of members for TreeViewCollapsedEventArgs, including all inherited members.
abi_enter() | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
CheckThread() | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
DeleteInstanceOnUIThread(std::unique_ptr< TreeViewCollapsedEventArgs > &&self) noexcept | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
final_release(std::unique_ptr< TreeViewCollapsedEventArgs > &&self) | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline, static]
GetBase() | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
GetInner() | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
IsOnThread() | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
Item() | TreeViewCollapsedEventArgs |
Node() | TreeViewCollapsedEventArgs |
Node(const winrt::TreeViewNode &value) | TreeViewCollapsedEventArgs |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< TreeViewCollapsedEventArgs, winrt::implementation::TreeViewCollapsedEventArgsT, winrt::composing, winrt::composable > | [inline]
Generated on Sun Dec 1 2024 20:53:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressRing/InteractionTests/ProgressRingTests.cs Source File

  • ProgressRing
  • InteractionTests

ProgressRingTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00007 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00008 using System.Collections.Generic;
00009
00010 using WEX.TestExecution;
00011 using WEX.TestExecution.Markup;
00012 using WEX.Logging.Interop;
00013
00014 using Microsoft.Windows.Apps.Test.Automation;
00015 using Microsoft.Windows.Apps.Test.Foundation;
00016 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00017 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00018 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00019 using ToggleButton = Microsoft.Windows.Apps.Test.Foundation.Controls.ToggleButton;
00020 using MUXTestInfra.Shared.Infra;
00021
00022 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00023 {
00024     [TestClass]
00025     public class ProgressRingTests
00026     {
00027         [ClassInitialize]
00028         [TestProperty("RunAs", "User")]
00029         [TestProperty("Classification", "Integration")]
00030         [TestProperty("Platform", "Any")]
00031         [TestProperty("MUXControlsTestSuite", "SuiteB")]
00032         public static void ClassInitialize(TestContext testContext)
00033         {
00034             TestEnvironment.Initialize(testContext);
00035         }
00036
00037         public void TestCleanup()
00038         {
00039             TestCleanupHelper.Cleanup();
00040         }
00041
00042         [TestMethod]
00043         public void VerifyAxeScanPasses()
00044         {
00045             using (var setup = new TestSetupHelper("ProgressRing-Axe"))
00046             {
00047                 AxeTestHelper.TestForAxeIssues();
00048             }
00049         }
00050
00051         [TestMethod]
00052         public void ChangeStateTest()
00053         {
00054             using (var setup = new TestSetupHelper("ProgressRing Tests"))
00055             {
00056                 Log.Comment("Verify IsActive and IsIndeterminate property is set to true by default for testing");
00057
00058                 ToggleButton isActiveCheckBox = FindElement.ByName<ToggleButton>("ShowIsActiveCheckBox");
00059                 ToggleButton isIndeterminateCheckBox = FindElement.ByName<ToggleButton>("ShowIsIndeterminateCheckBox");
00060
00061                 TextBlock isActiveText = FindElement.ByName<TextBlock>("ShowIsActiveText");
00062                 TextBlock isIsIndeterminateText = FindElement.ByName<TextBlock>("ShowIsIndeterminateText");
00063                 TextBlock isPlayingText = FindElement.ByName<TextBlock>("IsPlayingText");
00064                 TextBlock visualStateText = FindElement.ByName<TextBlock>("VisualStateText");
00065                 TextBlock opacityText = FindElement.ByName<TextBlock>("OpacityText");
00066
00067                 Verify.IsTrue(Convert.ToBoolean(isActiveText.DocumentText));
00068                 Verify.IsTrue(Convert.ToBoolean(isIsIndeterminateText.DocumentText));
00069
00070                 Log.Comment("IsActive and IsIndeterminate set to true updates ProgressRing to Active state");
00071
00072                 Verify.AreEqual("Active", visualStateText.DocumentText);
00073
00074                 Log.Comment("Verity that opacity is 1 when Active");
00075                 Verify.AreEqual("1", opacityText.DocumentText);
00076
00077                 Log.Comment("Verify Lottie animation is playing when in Active state");
00078
00079                 Verify.IsTrue(Convert.ToBoolean(isPlayingText.DocumentText));
00080
00081                 Log.Comment("IsActive set to True and IsIndeterminate set to false updates ProgressRing to DeterminateActive state");
00082
00083                 isIndeterminateCheckBox.ToggleAndWait();
00084
00085                 Verify.IsFalse(Convert.ToBoolean(isIsIndeterminateText.DocumentText));
00086
00087                 Verify.AreEqual("DeterminateActive", visualStateText.DocumentText);
00088
00089                 Log.Comment("Verify Lottie animation for Indeterminate player is not playing when in DeterminateActive state");
00090                 Verify.IsFalse(Convert.ToBoolean(isPlayingText.DocumentText));
00091
00092                 Log.Comment("IsActive set to false updates ProgressRing to Inactive state");
00093
00094                 isActiveCheckBox.ToggleAndWait();
00095
00096                 Verify.AreEqual("Inactive", visualStateText.DocumentText);
00097
00098                 Log.Comment("Verify Lottie animation is not playing when in Inactive state");
00099                 Verify.IsFalse(Convert.ToBoolean(isPlayingText.DocumentText));
00100
00101                 Wait.ForIdle();
00102
00103                 Log.Comment("Verity that opacity is 0 when Inactive");
00104                 Verify.AreEqual("0", opacityText.DocumentText);
00105
00106             }
00107         }
00108
00109         [TestMethod]
00110         public void LottieCustomSourceTest()
00111         {
00112             using (var setup = new TestSetupHelper("ProgressRing Tests"))
00113             {
00114                 Log.Comment("Navigate to Progress Ring Custom Lottie Source Page");
00115
00116                 Button navigateToCustomLottieSourcePage = FindElement.ByName<Button>("NavigateToCustomLottieSourcePage");
00117
00118                 navigateToCustomLottieSourcePage.InvokeAndWait();
00119
00120                 Log.Comment("Verify IsActive and IsIndeterminate property is set to true by default for testing");
00121
00122                 ToggleButton isActiveCheckBox = FindElement.ByName<ToggleButton>("ShowIsActiveCheckBox_CLS");
00123                 ToggleButton isIndeterminateCheckBox = FindElement.ByName<ToggleButton>("ShowIsIndeterminateCheckBox_CLS");
00124
00125                 TextBlock isActiveText = FindElement.ByName<TextBlock>("ShowIsActiveText");
00126                 TextBlock isIsIndeterminateText = FindElement.ByName<TextBlock>("ShowIsIndeterminateText");
00127                 TextBlock isPlayingText = FindElement.ByName<TextBlock>("IsPlayingText");
00128                 TextBlock visualStateText = FindElement.ByName<TextBlock>("VisualStateText");
00129                 TextBlock opacityText = FindElement.ByName<TextBlock>("OpacityText");
00130
00131                 Verify.IsTrue(Convert.ToBoolean(isActiveText.DocumentText));
00132                 Verify.IsTrue(Convert.ToBoolean(isIsIndeterminateText.DocumentText));
00133
00134                 Log.Comment("IsActive and IsIndeterminate set to true updates ProgressRing to Active state");
00135
00136                 Verify.AreEqual("Active", visualStateText.DocumentText);
00137
00138                 Log.Comment("Verity that opacity is 1 when Active");
00139                 Verify.AreEqual("1", opacityText.DocumentText);
00140
00141                 Log.Comment("Verify Lottie animation is playing when in Active state");
00142
00143                 Verify.IsTrue(Convert.ToBoolean(isPlayingText.DocumentText));
00144
00145                 Log.Comment("IsActive set to True and IsIndeterminate set to false updates ProgressRing to DeterminateActive state");
00146
00147                 isIndeterminateCheckBox.ToggleAndWait();
00148
00149                 Verify.IsFalse(Convert.ToBoolean(isIsIndeterminateText.DocumentText));
00150
00151                 Verify.AreEqual("DeterminateActive", visualStateText.DocumentText);
00152
00153                 Log.Comment("Verify Lottie animation for Indeterminate player is not playing when in DeterminateActive state");
00154                 Verify.IsFalse(Convert.ToBoolean(isPlayingText.DocumentText));
00155
00156                 Log.Comment("IsActive set to false updates ProgressRing to Inactive state");
00157
00158                 isActiveCheckBox.ToggleAndWait();
00159
00160                 Verify.AreEqual("Inactive", visualStateText.DocumentText);
00161
00162                 Log.Comment("Verify Lottie animation is not playing when in Inactive state");
00163                 Verify.IsFalse(Convert.ToBoolean(isPlayingText.DocumentText));
00164
00165                 Wait.ForIdle();
00166
00167                 Log.Comment("Verity that opacity is 0 when Inactive");
00168                 Verify.AreEqual("0", opacityText.DocumentText);
00169             }
00170         }
00171
00172         [TestMethod]
00173         public void StoryboardAnimationRetemplateTest()
00174         {
00175             using (var setup = new TestSetupHelper("ProgressRing Tests"))
00176             {
00177                 Log.Comment("Navigate to Progress Ring Storyboard Animation Page");
00178
00179                 Button navigateToStoryBoardAnimationPage = FindElement.ByName<Button>("NavigateToStoryBoardAnimationPage");
00180
00181                 navigateToStoryBoardAnimationPage.InvokeAndWait();
00182
00183                 Log.Comment("Verify IsActive property is set to true by default for testing");
00184
00185                 ToggleButton storyboardAnimationIsActiveCheckBox = FindElement.ByName<ToggleButton>("StoryboardAnimationIsActiveCheckBox");
00186
00187                 TextBlock isActiveText = FindElement.ByName<TextBlock>("ShowIsActiveText");
00188                 TextBlock visualStateText = FindElement.ByName<TextBlock>("VisualStateText");
00189
00190                 Verify.IsTrue(Convert.ToBoolean(isActiveText.DocumentText));
00191
00192                 Log.Comment("IsActive set to true updates ProgressRing to Active state");
00193
00194                 Verify.AreEqual("Active", visualStateText.DocumentText);
00195
00196                 storyboardAnimationIsActiveCheckBox.ToggleAndWait();
00197
00198                 Log.Comment("IsActive set to false updates ProgressRing to Inactive state");
00199                 Verify.AreEqual("Inactive", visualStateText.DocumentText);
00200             }
00201         }
00202
00203         [TestMethod]
00204         public void ChangeValueTest()
00205         {
00206             using (var setup = new TestSetupHelper("ProgressRing Tests"))
00207             {
00208                 Log.Comment("Changing Value of ProgressRing");
00209
00210                 CheckBox indeterminateCheckBox = FindElement.ByName<CheckBox>("ShowIsIndeterminateCheckBox");
00211                 indeterminateCheckBox.Uncheck();
00212
00213                 RangeValueSpinner progressRing = FindElement.ByName<RangeValueSpinner>("TestProgressRing");
00214                 Verify.AreEqual(0, progressRing.Value);
00215
00216                 double oldValue = progressRing.Value;
00217
00218                 // NOTE: Interaction tests can only access what accessibility tools see. In this case, we can find the button because we
00219                 // set AutomationProperties.Name on the button in ProgressRingPage.xaml
00220                 Button changeValueButton = FindElement.ByName<Button>("ChangeValueButton");
00221                 changeValueButton.InvokeAndWait();
00222
00223                 double newValue = progressRing.Value;
00224                 double diff = Math.Abs(oldValue - newValue);
00225
00226                 Log.Comment("ProgressRing value changed");
00227                 Verify.IsGreaterThan(diff, 0.0);
00228             }
00229         }
00230
00231         [TestMethod]
00232         public void UpdateMinMaxTest()
00233         {
00234             using (var setup = new TestSetupHelper("ProgressRing Tests"))
00235             {
00236                 Log.Comment("Updating Minimum and Maximum value of ProgressBar");
00237
00238                 CheckBox indeterminateCheckBox = FindElement.ByName<CheckBox>("ShowIsIndeterminateCheckBox");
00239                 indeterminateCheckBox.Uncheck();
00240
00241                 RangeValueSpinner progressRing = FindElement.ByName<RangeValueSpinner>("TestProgressRing");
00242
00243                 double oldMinimumInputText = progressRing.Minimum;
00244                 double oldMaximumInputText = progressRing.Maximum;
00245
00246                 Edit minimumInput = FindElement.ByName<Edit>("MinimumInput");
00247                 Edit maximumInput = FindElement.ByName<Edit>("MaximumInput");
00248
00249                 minimumInput.SetValue("10");
00250                 maximumInput.SetValue("15");
00251
00252                 Button updateMinMaxButton = FindElement.ByName<Button>("UpdateMinMaxButton");
00253                 updateMinMaxButton.InvokeAndWait();
00254
00255                 double newMinimumInputText = progressRing.Minimum;
00256                 double newMaximumInputText = progressRing.Maximum;
00257
00258                 Verify.AreNotSame(oldMinimumInputText, newMinimumInputText, "Minimum updated");
00259                 Verify.AreNotSame(oldMaximumInputText, newMaximumInputText, "Maximum updated");
00260
00261                 // Below edge cases are handled by Rangebase
00262
00263                 Log.Comment("Updating Minimum and Maximum when Maximum < Minimum");
00264
00265                 maximumInput.SetValue("5");
00266                 updateMinMaxButton.InvokeAndWait();
00267
00268                 Verify.AreEqual(progressRing.Minimum, progressRing.Maximum, "Maximum updates to equal Minimum");
00269
00270                 Log.Comment("Updating Minimum and Maximum when Minimum > Value");
00271
00272                 minimumInput.SetValue("15");
00273                 updateMinMaxButton.InvokeAndWait();
00274
00275                 Verify.AreEqual(progressRing.Value, progressRing.Minimum, "Value updates to equal Minimum");
00276                 Verify.AreEqual(progressRing.Maximum, progressRing.Minimum, "Maximum also updates to equal Minimum");
00277
00278                 Log.Comment("Updating Minimum and Maximum to be a decimal number");
00279
00280                 minimumInput.SetValue("0.1");
00281                 maximumInput.SetValue("1.1");
00282
00283                 updateMinMaxButton.InvokeAndWait();
00284
00285                 double oldValue = progressRing.Value;
00286
00287                 Button changeValueButton = FindElement.ByName<Button>("ChangeValueButton");
00288                 changeValueButton.InvokeAndWait();
00289
00290                 double newValue = progressRing.Value;
00291                 double diff = Math.Abs(oldValue - newValue);
00292
00293                 Verify.IsGreaterThan(diff, Convert.ToDouble(0), "Value of ProgressBar increments properly within range with decimal Minimum and Maximum");
00294             }
00295         }
00296
00297         [TestMethod]
00298         public void VerifyIndeterminateProgressRingDoesNotImplementRangeValuePattern()
00299         {
00300             using (var setup = new TestSetupHelper("ProgressRing Tests"))
00301             {
00302                 UIObject progressRing = FindElement.ByName("Busy TestProgressRing");
00303
00304                 Verify.IsNotNull(progressRing);
00305
00306                 RangeValueImplementation rangeValueImplementation = new RangeValueImplementation(progressRing);
00307
00308                 Verify.IsFalse(rangeValueImplementation.IsAvailable);
00309             }
00310         }
00311     }
00312 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RatingControl/RatingItemImageInfo.h Source File

  • RatingControl

RatingItemImageInfo.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "RatingItemInfo.h"
00006
00007 #include "RatingItemImageInfo.g.h"
00008 #include "RatingItemImageInfo.properties.h"
00009
00010 class RatingItemImageInfo :
00011     public winrt::implementation::RatingItemImageInfoT<RatingItemImageInfo, RatingItemInfo>,
00012     public RatingItemImageInfoProperties
00013 {
00014 public:
00015     ForwardRefToBaseReferenceTracker(RatingItemInfo)
00016 };
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewInitPage Member List

This is the complete list of members for NavigationViewInitPage, including all inherited members.
AddButton_Click(object sender, RoutedEventArgs e) | NavigationViewInitPage | [inline, private]
AddFooterButton_Click(object sender, RoutedEventArgs e) | NavigationViewInitPage | [inline, private]
ChangePaneVisibleButton_Click(object sender, RoutedEventArgs e) | NavigationViewInitPage | [inline, private]
ChangeToIEnumerableButton_Clicks(object sender, RoutedEventArgs e) | NavigationViewInitPage | [inline, private]
FlipOrientation_Click(object sender, RoutedEventArgs e) | NavigationViewInitPage | [inline, private]
m_footerItems | NavigationViewInitPage | [private]
m_menuItems | NavigationViewInitPage | [private]
m_menuItemsEnumerable | NavigationViewInitPage | [private]
NavigationViewInitPage() | NavigationViewInitPage | [inline]
NavView2_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) | NavigationViewInitPage | [inline, private]
NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) | NavigationViewInitPage | [inline, private]
NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) | NavigationViewInitPage | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | NavigationViewInitPage | [inline, protected]
RemoveButton_Click(object sender, RoutedEventArgs e) | NavigationViewInitPage | [inline, private]
RemoveFooterButton_Click(object sender, RoutedEventArgs e) | NavigationViewInitPage | [inline, private]
SwitchFrame_Click(object sender, RoutedEventArgs e) | NavigationViewInitPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewSelectionChangedEventArgs.h Source File

  • TreeView

TreeViewSelectionChangedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005 #include "TreeViewSelectionChangedEventArgs.g.h"
00006
00007 class TreeViewSelectionChangedEventArgs :
00008     public ReferenceTracker<TreeViewSelectionChangedEventArgs, winrt::implementation::TreeViewSelectionChangedEventArgsT, winrt::composing, winrt::composable>
00009 {
00010 public:
00011     TreeViewSelectionChangedEventArgs(const winrt::IVector<winrt::IInspectable> addedItems, const winrt::IVector<winrt::IInspectable> removedItems);
00012     winrt::IVector<winrt::IInspectable> AddedItems();
00013     winrt::IVector<winrt::IInspectable> RemovedItems();
00014
00015 private:
00016     tracker_ref<winrt::IVector<winrt::IInspectable>> m_addedItems{ this };
00017     tracker_ref<winrt::IVector<winrt::IInspectable>> m_removedItems{ this };
00018 };
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InkToolBar Member List

This is the complete list of members for InkToolBar, including all inherited members.
abi_enter() | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
ActiveTool() | InkToolBar | [inline]
ActiveTool(winrt::InkToolBarToolButton value) | InkToolBar | [inline]
InkToolBarProperties::ActiveTool(winrt::InkToolBarToolButton const &value) | InkToolBarProperties |
ActiveToolChanged(winrt::TypedEventHandler< winrt::InkToolBar, winrt::IInspectable > const &value) | InkToolBarProperties |
ActiveToolChanged(winrt::event_token const &token) | InkToolBarProperties |
ActiveToolProperty() | InkToolBarProperties | [inline, static]
ButtonFlyoutPlacement() | InkToolBar | [inline]
ButtonFlyoutPlacement(winrt::InkToolBarButtonFlyoutPlacement value) | InkToolBar | [inline]
InkToolBarProperties::ButtonFlyoutPlacement(winrt::InkToolBarButtonFlyoutPlacement const &value) | InkToolBarProperties |
ButtonFlyoutPlacementProperty() | InkToolBarProperties | [inline, static]
CheckThread() | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
Children() | InkToolBar | [inline]
InkToolBarProperties::Children(winrt::DependencyObjectCollection const &value) | InkToolBarProperties |
ChildrenProperty() | InkToolBarProperties | [inline, static]
ClearProperties() | InkToolBarProperties | [static]
DeleteInstanceOnUIThread(std::unique_ptr< InkToolBar > &&self) noexcept | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline, static]
EnsureProperties() | InkToolBarProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
EraseAllClicked(winrt::TypedEventHandler< winrt::InkToolBar, winrt::IInspectable > const &value) | InkToolBarProperties |
EraseAllClicked(winrt::event_token const &token) | InkToolBarProperties |
EraserFlyoutItemClicked(winrt::TypedEventHandler< winrt::InkToolBarEraserFlyoutItemClickedEventArgs, winrt::IInspectable > const &value) | InkToolBarProperties |
EraserFlyoutItemClicked(winrt::event_token const &token) | InkToolBarProperties |
final_release(std::unique_ptr< InkToolBar > &&self) | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline, static]
GetBase() | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
GetInner() | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
GetMenuButton(winrt::InkToolBarMenuKind menu) | InkToolBar | [inline]
GetToggleButton(winrt::InkToolBarToggle tool) | InkToolBar | [inline]
GetToolButton(winrt::InkToolBarTool tool) | InkToolBar | [inline]
InitialControls() | InkToolBar | [inline]
InitialControls(winrt::InkToolBarInitialControls value) | InkToolBar | [inline]
InkToolBarProperties::InitialControls(winrt::InkToolBarInitialControls const &value) | InkToolBarProperties |
InitialControlsProperty() | InkToolBarProperties | [inline, static]
InkDrawingAttributes() | InkToolBar | [inline]
InkToolBarProperties::InkDrawingAttributes(winrt::InkDrawingAttributes const &value) | InkToolBarProperties |
InkDrawingAttributesChanged(winrt::TypedEventHandler< winrt::InkToolBar, winrt::IInspectable > const &value) | InkToolBarProperties |
InkDrawingAttributesChanged(winrt::event_token const &token) | InkToolBarProperties |
InkDrawingAttributesProperty() | InkToolBarProperties | [inline, static]
InkToolBarProperties() | InkToolBarProperties |
IsOnThread() | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
IsRulerButtonChecked() | InkToolBar | [inline]
IsRulerButtonChecked(bool value) | InkToolBar | [inline]
IsRulerButtonCheckedProperty() | InkToolBarProperties | [inline, static]
IsStencilButtonChecked() | InkToolBar | [inline]
IsStencilButtonChecked(bool value) | InkToolBar | [inline]
IsStencilButtonCheckedChanged(winrt::TypedEventHandler< winrt::InkToolBar, winrt::InkToolBarIsStencilButtonCheckedChangedEventArgs > const &value) | InkToolBarProperties |
IsStencilButtonCheckedChanged(winrt::event_token const &token) | InkToolBarProperties |
IsStencilButtonCheckedProperty() | InkToolBarProperties | [inline, static]
m_activeToolChangedEventSource | InkToolBarProperties |
m_eraseAllClickedEventSource | InkToolBarProperties |
m_eraserFlyoutItemClickedEventSource | InkToolBarProperties |
m_inkDrawingAttributesChangedEventSource | InkToolBarProperties |
m_isStencilButtonCheckedChangedEventSource | InkToolBarProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
Orientation() | InkToolBar | [inline]
Orientation(winrt::Orientation value) | InkToolBar | [inline]
InkToolBarProperties::Orientation(winrt::Orientation const &value) | InkToolBarProperties |
OrientationProperty() | InkToolBarProperties | [inline, static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< InkToolBar, winrt::implementation::InkToolBarT > | [inline]
s_ActiveToolProperty | InkToolBarProperties | [static]
s_ButtonFlyoutPlacementProperty | InkToolBarProperties | [static]
s_ChildrenProperty | InkToolBarProperties | [static]
s_InitialControlsProperty | InkToolBarProperties | [static]
s_InkDrawingAttributesProperty | InkToolBarProperties | [static]
s_IsRulerButtonCheckedProperty | InkToolBarProperties | [static]
s_IsStencilButtonCheckedProperty | InkToolBarProperties | [static]
s_OrientationProperty | InkToolBarProperties | [static]
s_TargetInkCanvasProperty | InkToolBarProperties | [static]
s_TargetInkPresenterProperty | InkToolBarProperties | [static]
TargetInkCanvas() | InkToolBar | [inline]
TargetInkCanvas(winrt::InkCanvas value) | InkToolBar | [inline]
InkToolBarProperties::TargetInkCanvas(winrt::InkCanvas const &value) | InkToolBarProperties |
TargetInkCanvasProperty() | InkToolBarProperties | [inline, static]
TargetInkPresenter() | InkToolBar | [inline]
TargetInkPresenter(winrt::IInspectable value) | InkToolBar | [inline]
InkToolBarProperties::TargetInkPresenter(winrt::IInspectable const &value) | InkToolBarProperties |
TargetInkPresenterProperty() | InkToolBarProperties | [inline, static]
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SplitButton/SplitButtonTestApi.h Source File

  • SplitButton

SplitButtonTestApi.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "SplitButtonTestApi.g.h"
00007
00008 class SplitButtonTestApi :
00009     public winrt::implementation::SplitButtonTestApiT<SplitButtonTestApi>
00010 {
00011 public:
00012     static bool SimulateTouch();
00013     static void SimulateTouch(bool value);
00014 };
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressRing/TestUI/ProgressRingPage.xaml.cs Source File

  • ProgressRing
  • TestUI

ProgressRingPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Controls.Primitives;
00008 using Microsoft.UI.Xaml.Media;
00009 using Microsoft.UI.Xaml.Markup;
00010 using Windows.UI;
00011 using System.Windows.Input;
00012
00013 namespace MUXControlsTestApp
00014 {
00015     [TopLevelTestPage(Name = "ProgressRing")]
00016     public sealed partial class ProgressRingPage : TestPage
00017     {
00018         public ProgressRingPage()
00019         {
00020             this.InitializeComponent();
00021             Loaded += ProgressRingPage_Loaded;
00022
00023             NavigateToCustomLottieSourcePage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ProgressRingCustomLottieSourcePage), 0); };
00024             NavigateToStoryboardAnimationPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(ProgressRingStoryboardAnimationPage), 0); };
00025         }
00026
00027         private void ProgressRingPage_Loaded(object sender, RoutedEventArgs e)
00028         {
00029             var layoutRoot = (Grid)VisualTreeHelper.GetChild(TestProgressRing, 0);
00030
00031             var commonStatesGroup = VisualStateManager.GetVisualStateGroups(layoutRoot)[0];
00032             commonStatesGroup.CurrentStateChanged += this.ProgressRingPage_CurrentStateChanged;
00033             VisualStateText.Text = commonStatesGroup.CurrentState.Name;
00034
00035             //for (int i = 0; i < commonStatesGroup.Transitions[0].Storyboard.Children.Count; i++)
00036             //{
00037             //    // Change the animation to 0 duration to avoid timing issues in the test.
00038             //    commonStatesGroup.Transitions[0].Storyboard.Children[i].Duration = new Duration(TimeSpan.FromSeconds(0));
00039             //}
00040
00041             var animatedVisualPlayer = (Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer)VisualTreeHelper.GetChild(layoutRoot, 0);
00042
00043             IsPlayingText.Text = animatedVisualPlayer.IsPlaying.ToString();
00044             OpacityText.Text = layoutRoot.Opacity.ToString();
00045
00046             Loaded -= ProgressRingPage_Loaded;
00047         }
00048
00049         private void ProgressRingPage_CurrentStateChanged(object sender, VisualStateChangedEventArgs e)
00050         {
00051             VisualStateText.Text = e.NewState.Name;
00052
00053             var layoutRoot = (Grid)VisualTreeHelper.GetChild(TestProgressRing, 0);
00054             var animatedVisualPlayer = (Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer)VisualTreeHelper.GetChild(layoutRoot, 0);
00055             IsPlayingText.Text = animatedVisualPlayer.IsPlaying.ToString();
00056             OpacityText.Text = layoutRoot.Opacity.ToString();
00057         }
00058
00059         public void UpdateMinMax_Click(object sender, RoutedEventArgs e)
00060         {
00061             TestProgressRing.Maximum = String.IsNullOrEmpty(MaximumInput.Text) ? Double.Parse(MaximumInput.PlaceholderText) : Double.Parse(MaximumInput.Text);
00062             TestProgressRing.Minimum = String.IsNullOrEmpty(MinimumInput.Text) ? Double.Parse(MinimumInput.PlaceholderText) : Double.Parse(MinimumInput.Text);
00063         }
00064
00065         public void UpdateWidth_Click(object sender, RoutedEventArgs e)
00066         {
00067             TestProgressRing.Width = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00068             TestProgressRing.Height = String.IsNullOrEmpty(WidthInput.Text) ? Double.Parse(WidthInput.PlaceholderText) : Double.Parse(WidthInput.Text);
00069         }
00070
00071         public void UpdateValue_Click(object sender, RoutedEventArgs e)
00072         {
00073             TestProgressRing.Value = String.IsNullOrEmpty(ValueInput.Text) ? Double.Parse(ValueInput.PlaceholderText) : Double.Parse(ValueInput.Text);
00074         }
00075         public void ChangeValue_Click(object sender, RoutedEventArgs e)
00076         {
00077             if (TestProgressRing.Value + 1 > TestProgressRing.Maximum)
00078             {
00079                 TestProgressRing.Value = (int)(TestProgressRing.Minimum + 0.5);
00080             }
00081             else
00082             {
00083                 TestProgressRing.Value += 1;
00084             }
00085         }
00086     }
00087 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollingZoomOptions Member List

This is the complete list of members for ScrollingZoomOptions, including all inherited members.
AnimationMode() const | ScrollingZoomOptions |
AnimationMode(winrt::ScrollingAnimationMode const &animationMode) | ScrollingZoomOptions |
ScrollingZoomOptions(winrt::ScrollingAnimationMode const &animationMode) | ScrollingZoomOptions |
ScrollingZoomOptions(winrt::ScrollingAnimationMode const &animationMode, winrt::ScrollingSnapPointsMode const &snapPointsMode) | ScrollingZoomOptions |
SnapPointsMode() const | ScrollingZoomOptions |
SnapPointsMode(winrt::ScrollingSnapPointsMode const &snapPointsMode) | ScrollingZoomOptions |
~ScrollingZoomOptions() | ScrollingZoomOptions | [inline]
Generated on Sun Dec 1 2024 20:53:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemPresenter.idl Source File

  • NavigationView

NavigationViewItemPresenter.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XCP_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 unsealed runtimeclass NavigationViewItemPresenter : Microsoft.UI.Xaml.Controls.ContentControl
00007 {
00008     NavigationViewItemPresenter();
00009
00010     Microsoft.UI.Xaml.Controls.IconElement Icon { get; set; };
00011     NavigationViewItemPresenterTemplateSettings TemplateSettings{ get; };
00012
00013     static Microsoft.UI.Xaml.DependencyProperty IconProperty { get; };
00014     static Microsoft.UI.Xaml.DependencyProperty TemplateSettingsProperty{ get; };
00015
00016
00017     [MUX_PUBLIC_V3]
00018     {
00019         Microsoft.UI.Xaml.Controls.InfoBadge InfoBadge{ get; set; };
00020         static Microsoft.UI.Xaml.DependencyProperty InfoBadgeProperty{ get; };
00021     }
00022 }
00023
00024 [MUX_PUBLIC]
00025 [webhosthidden]
00026 unsealed runtimeclass NavigationViewItemPresenterTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00027 {
00028     NavigationViewItemPresenterTemplateSettings();
00029
00030     Double IconWidth{ get; };
00031     Double SmallerIconWidth{ get; };
00032
00033     static Microsoft.UI.Xaml.DependencyProperty IconWidthProperty{ get; };
00034     static Microsoft.UI.Xaml.DependencyProperty SmallerIconWidthProperty{ get; };
00035
00036 }
00037
00038 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewViewModel Member List

This is the complete list of members for TreeViewViewModel, including all inherited members.
Items | TreeViewViewModel |
TreeViewViewModel() | TreeViewViewModel | [inline]
Generated on Sun Dec 1 2024 20:54:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnnotatedScrollBarLabel Member List

This is the complete list of members for AnnotatedScrollBarLabel, including all inherited members.
abi_enter() | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
AnnotatedScrollBarLabel(const winrt::IInspectable &content, double scrollOffset) | AnnotatedScrollBarLabel |
CheckThread() | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
Content() | AnnotatedScrollBarLabel |
DeleteInstanceOnUIThread(std::unique_ptr< AnnotatedScrollBarLabel > &&self) noexcept | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline, static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
final_release(std::unique_ptr< AnnotatedScrollBarLabel > &&self) | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline, static]
GetBase() | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
GetInner() | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
IsOnThread() | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
ReferenceTracker(Args &&...args) | ReferenceTracker< AnnotatedScrollBarLabel, winrt::implementation::AnnotatedScrollBarLabelT, winrt::composable, winrt::composing > | [inline]
ScrollOffset() | AnnotatedScrollBarLabel |
Generated on Sun Dec 1 2024 20:52:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/ViewManagerTests.cs Source File

  • Repeater
  • APITests

ViewManagerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common;
00005 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common.Mocks;
00006 using MUXControlsTestApp.Utilities;
00007 using System;
00008 using System.Collections.Generic;
00009 using System.Collections.ObjectModel;
00010 using System.Linq;
00011 using System.Threading;
00012 using Windows.Foundation;
00013 using Microsoft.UI.Xaml;
00014 using Microsoft.UI.Xaml.Controls;
00015 using Microsoft.UI.Xaml.Input;
00016 using Microsoft.UI.Xaml.Markup;
00017 using Microsoft.UI.Xaml.Media;
00018 using Common;
00019
00020 using WEX.TestExecution;
00021 using WEX.TestExecution.Markup;
00022 using WEX.Logging.Interop;
00023
00024 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests
00025 {
00026     [TestClass]
00027     public class ViewManagerTests : ApiTestBase
00028     {
00029         [TestMethod]
00030         public void CanQueryElementFactory()
00031         {
00032             RunOnUIThread.Execute(() =>
00033             {
00034                 var data = new ObservableCollection<string>();
00035                 var dataSource = MockItemsSource.CreateDataSource(data, supportsUniqueIds: false);
00036                 var elementFactory = MockElementFactory.CreateElementFactory(new List<UIElement> { new ContentControl() });
00037                 var repeater = CreateRepeater(dataSource, elementFactory);
00038
00039                 Content = repeater;
00040                 repeater.UpdateLayout();
00041
00042                 // Our layout will query the size though once for every layout pass.
00043                 // The first layout pass is a bit special because we don't have a viewport and
00044                 // we will invalidate measure when we get one after the first arrange pass.
00045                 dataSource.ValidateGetSizeCalls(1); // GetSize calls are cached by ItemsSourceView.
00046                 elementFactory.ValidateRecycleElementCalls();
00047
00048                 data.Add("Item #1");
00049                 repeater.UpdateLayout();
00050
00051                 var item1 = (UIElement)VisualTreeHelper.GetChild(repeater, 0);
00052
00053                 // One GetSize invocation from the layout, another one from the view manager.
00054                 dataSource.ValidateGetSizeCalls(2); // GetSize calls are cached by ItemsSourceView
00055                 dataSource.ValidateGetAtCalls(new MockItemsSource.GetAtCallInfo(0));
00056                 elementFactory.ValidateGetElementCalls(new MockElementFactory.GetElementCallInfo(0, repeater));
00057                 elementFactory.ValidateRecycleElementCalls();
00058                 Verify.AreEqual(item1, repeater.TryGetElement(0));
00059
00060                 data.RemoveAt(0);
00061                 repeater.UpdateLayout();
00062
00063                 dataSource.ValidateGetAtCalls();
00064                 dataSource.ValidateGetSizeCalls(1); // GetSize calls are cached by ItemsSourceView
00065                 // Whenever we get an element from the view generator, we call HasKeyIndexMapping to see if we should
00066                 // store its unique id or not.
00067                 dataSource.ValidateGetItemIdCalls();
00068                 elementFactory.ValidateGetElementCalls();
00069                 elementFactory.ValidateRecycleElementCalls(new MockElementFactory.RecycleElementCallInfo(item1, repeater));
00070             });
00071         }
00072
00073         [TestMethod] //Issue #1018
00074         [TestProperty("Ignore", "True")]
00075         public void CanPinFocusedElements()
00076         {
00077             // Setup a grouped repeater scenario with two groups each containing two items.
00078             var data = new ObservableCollection<ObservableCollection<string>>(Enumerable
00079                 .Range(0, 2)
00080                 .Select(i => new ObservableCollection<string>(Enumerable
00081                     .Range(0, 2)
00082                     .Select(j => string.Format("Item #{0}.{1}", i, j)))));
00083             List<ContentControl>[] itemElements = null;
00084             ItemsRepeater[] innerRepeaters = null;
00085             List<StackPanel> groupElements = null;
00086             ItemsRepeater rootRepeater = null;
00087             var gotFocus = new ManualResetEvent(false);
00088
00089             RunOnUIThread.Execute(() =>
00090             {
00091                 itemElements = new[] {
00092                     Enumerable.Range(0, 2).Select(i => new ContentControl()).ToList(),
00093                     Enumerable.Range(0, 2).Select(i => new ContentControl()).ToList()
00094                 };
00095
00096                 itemElements[0][0].GotFocus += delegate { gotFocus.Set(); };
00097
00098                 innerRepeaters = Enumerable.Range(0, 2).Select(i => CreateRepeater(
00099                     MockItemsSource.CreateDataSource(data[i], supportsUniqueIds: false),
00100                     MockElementFactory.CreateElementFactory(itemElements[i]))).ToArray();
00101
00102                 groupElements = Enumerable.Range(0, 2).Select(i =>
00103                 {
00104                     var panel = new StackPanel();
00105                     panel.Children.Add(new ContentControl());
00106                     panel.Children.Add(innerRepeaters[i]);
00107                     return panel;
00108                 }).ToList();
00109
00110                 rootRepeater = CreateRepeater(
00111                    MockItemsSource.CreateDataSource(data, supportsUniqueIds: false),
00112                    MockElementFactory.CreateElementFactory(groupElements));
00113                 Content = rootRepeater;
00114                 rootRepeater.UpdateLayout();
00115
00116                 itemElements[0][0].Focus(FocusState.Keyboard);
00117             });
00118
00119             Verify.IsTrue(gotFocus.WaitOne(DefaultWaitTimeInMS), "Waiting for focus event on the first element of the first group.");
00120             IdleSynchronizer.Wait();
00121
00122             RunOnUIThread.Execute(() =>
00123             {
00124                 Log.Comment("Recycle focused element 0.0 and validate it's still realized because it is pinned.");
00125                 {
00126                     var ctx = (VirtualizingLayoutContext)innerRepeaters[0].Tag;
00127                     ctx.RecycleElement(itemElements[0][0]);
00128                     Verify.AreEqual(0, innerRepeaters[0].GetElementIndex(itemElements[0][0]));
00129                 }
00130
00131                 Log.Comment("Recycle element 0.1 and validate it's no longer realized because it is not pinned.");
00132                 {
00133                     var ctx = (VirtualizingLayoutContext)innerRepeaters[0].Tag;
00134                     ctx.RecycleElement(itemElements[0][1]);
00135                     Verify.AreEqual(-1, innerRepeaters[0].GetElementIndex(itemElements[0][1]));
00136                 }
00137
00138                 Log.Comment("Recycle group 0 and validate it's still realized because one of its items is pinned.");
00139                 {
00140                     var ctx = (VirtualizingLayoutContext)rootRepeater.Tag;
00141                     ctx.RecycleElement(groupElements[0]);
00142                     Verify.AreEqual(0, rootRepeater.GetElementIndex(groupElements[0]));
00143                 }
00144
00145                 itemElements[1][1].GotFocus += delegate { gotFocus.Set(); };
00146                 itemElements[1][1].Focus(FocusState.Keyboard);
00147             });
00148
00149             Verify.IsTrue(gotFocus.WaitOne(DefaultWaitTimeInMS), "Waiting for focus event on the second element of the second group.");
00150             IdleSynchronizer.Wait();
00151
00152             RunOnUIThread.Execute(() =>
00153             {
00154                 Log.Comment(@"Move focus to item 1.1 and validate item 0.0 and group 0 are recycled because
00155                  the only thing keeping them around is the fact that item 0.0 was focus pinned");
00156                 {
00157                     ((VirtualizingLayoutContext)rootRepeater.Tag).RecycleElement(groupElements[0]);
00158                     ((VirtualizingLayoutContext)innerRepeaters[0].Tag).RecycleElement(itemElements[0][0]);
00159
00160                     Verify.AreEqual(-1, rootRepeater.GetElementIndex(groupElements[0]));
00161                     Verify.AreEqual(-1, innerRepeaters[0].GetElementIndex(itemElements[0][0]));
00162                     Verify.AreEqual(1, innerRepeaters[0].GetElementIndex(itemElements[1][1]));
00163                 }
00164
00165                 Log.Comment(@"Delete item 1.1 from the data. This will force the element to get recycled even if it's pinned.");
00166                 {
00167                     data[1].RemoveAt(1);
00168                     rootRepeater.UpdateLayout();
00169
00170                     Verify.AreEqual(-1, innerRepeaters[1].GetElementIndex(itemElements[1][1]));
00171                 }
00172             });
00173         }
00174
00175         [TestMethod] //Issue 1018
00176         [TestProperty("Ignore", "True")]
00177         public void CanReuseElementsDuringUniqueIdReset()
00178         {
00179             var data = new WinRTCollection(Enumerable.Range(0, 2).Select(i => string.Format("Item #{0}", i)));
00180             List<UIElement> mapping = null;
00181             ItemsRepeater repeater = null;
00182             MockElementFactory elementFactory = null;
00183             ContentControl focusedElement = null;
00184
00185             RunOnUIThread.Execute(() =>
00186             {
00187                 mapping = new List<UIElement> { new ContentControl(), new ContentControl() };
00188                 repeater = CreateRepeater(
00189                     MockItemsSource.CreateDataSource(data, supportsUniqueIds: true),
00190                     MockElementFactory.CreateElementFactory(mapping));
00191                 elementFactory = (MockElementFactory)repeater.ItemTemplate;
00192
00193                 Content = repeater;
00194                 repeater.UpdateLayout();
00195
00196                 focusedElement = (ContentControl)repeater.TryGetElement(1);
00197                 focusedElement.Focus(FocusState.Keyboard);
00198             });
00199             IdleSynchronizer.Wait();
00200
00201             RunOnUIThread.Execute(() =>
00202             {
00203                 elementFactory.ValidateGetElementCalls(
00204                 new MockElementFactory.GetElementCallInfo(0, repeater),
00205                 new MockElementFactory.GetElementCallInfo(1, repeater));
00206                 elementFactory.ValidateRecycleElementCalls();
00207
00208                 data.ResetWith(new[] { data[0], "New item" });
00209
00210                 Verify.AreEqual(0, repeater.GetElementIndex(mapping[0]));
00211                 Verify.AreEqual(1, repeater.GetElementIndex(mapping[1]));
00212                 Verify.IsNull(repeater.TryGetElement(0));
00213                 Verify.IsNull(repeater.TryGetElement(1));
00214
00215                 elementFactory.ValidateGetElementCalls(/* GetElement should not be called */);
00216                 elementFactory.ValidateRecycleElementCalls(/* RecycleElement should not be called */);
00217
00218                 mapping[1] = new ContentControl(); // For "New Item"
00219
00220                 repeater.UpdateLayout();
00221
00222                 Verify.AreEqual(0, repeater.GetElementIndex(mapping[0]));
00223                 Verify.AreEqual(1, repeater.GetElementIndex(mapping[1]));
00224                 Verify.AreEqual(mapping[0], repeater.TryGetElement(0));
00225                 Verify.AreEqual(mapping[1], repeater.TryGetElement(1));
00226
00227                 elementFactory.ValidateGetElementCalls(
00228                     new MockElementFactory.GetElementCallInfo(1, repeater));
00229                 elementFactory.ValidateRecycleElementCalls(
00230                     new MockElementFactory.RecycleElementCallInfo(focusedElement, repeater));
00231
00232                 // If the focused element survived the reset, we will keep focus on it. If not, we
00233                 // try to find one based on the index. In this case, the focused element (index 1)
00234                 // got recycled, and we still have index 1 after the stable reset, so the new index 1
00235                 // will get focused. Note that recycling the elements to view generator in the case of
00236                 // stable reset happens during the arrange, so by that time we will have pulled elements
00237                 // from the stable reset pool and maybe created some new elements as well.
00238                 int index = repeater.GetElementIndex(focusedElement);
00239                 Log.Comment("focused index " + index);
00240                 Verify.AreEqual(mapping[1], FocusManager.GetFocusedElement(repeater.XamlRoot));
00241             });
00242         }
00243
00244         [TestMethod]
00245         public void CanChangeFocusAfterUniqueIdReset()
00246         {
00247             var data = new WinRTCollection(Enumerable.Range(0, 2).Select(i => string.Format("Item #{0}", i)));
00248             object dataSource = null;
00249             RunOnUIThread.Execute(() => dataSource = MockItemsSource.CreateDataSource(data, supportsUniqueIds: true));
00250             ItemsRepeater repeater = SetupRepeater(dataSource);
00251             Control focusedElement = null;
00252
00253             RunOnUIThread.Execute(() =>
00254             {
00255                 focusedElement = (Control)repeater.TryGetElement(0);
00256                 focusedElement.Focus(FocusState.Keyboard);
00257             });
00258
00259             IdleSynchronizer.Wait();
00260             RunOnUIThread.Execute(() =>
00261             {
00262                 data.Reset();
00263             });
00264
00265             IdleSynchronizer.Wait();
00266             RunOnUIThread.Execute(() =>
00267             {
00268                 // Still focused.
00269                 Verify.AreEqual(focusedElement, FocusManager.GetFocusedElement(repeater.XamlRoot));
00270
00271                 // Change focused element.
00272                 focusedElement = (Control)repeater.TryGetElement(1);
00273                 focusedElement.Focus(FocusState.Keyboard);
00274             });
00275
00276             IdleSynchronizer.Wait();
00277             RunOnUIThread.Execute(() =>
00278             {
00279                 // Focus is on the new element.
00280                 Verify.AreEqual(focusedElement, FocusManager.GetFocusedElement(repeater.XamlRoot));
00281             });
00282         }
00283
00284         [TestMethod]
00285         [TestProperty("Description", "Verifies the correct items are generated when invoking StartBringIntoView for a disconnected item.")]
00286         public void ValidateBringIntoViewOperations()
00287         {
00288             ValidateBringIntoViewOperations(0.0 /*cacheLengths*/);
00289             ValidateBringIntoViewOperations(2.0 /*cacheLengths*/);
00290         }
00291
00292         private void ValidateBringIntoViewOperations(double cacheLengths)
00293         {
00294             Log.Comment("\r\nValidateBringIntoViewOperations cacheLengths: " + cacheLengths);
00295
00296             string strRealizedItemsIndices = null;
00297             List<int> realizedItemsIndices = null;
00298             CustomItemsSource dataSource = null;
00299             RunOnUIThread.Execute(() => dataSource = new CustomItemsSource(Enumerable.Range(0, 200).ToList()));
00300
00301             ItemsRepeater itemsRepeater = SetupRepeater(dataSource: null, itemContent: @"<TextBlock Text='{Binding}' Height='24'/>");
00302
00303             RunOnUIThread.Execute(() =>
00304             {
00305                 realizedItemsIndices = new List<int>();
00306
00307                 itemsRepeater.ElementPrepared += (sender, args) =>
00308                 {
00309                     realizedItemsIndices.Add(args.Index);
00310                 };
00311
00312                 itemsRepeater.ElementClearing += (sender, args) =>
00313                 {
00314                     int index = sender.GetElementIndex(args.Element);
00315                     realizedItemsIndices.Remove(index);
00316                 };
00317
00318                 itemsRepeater.HorizontalCacheLength = cacheLengths;
00319                 itemsRepeater.VerticalCacheLength = cacheLengths;
00320                 itemsRepeater.ItemsSource = dataSource;
00321             });
00322
00323             // The viewport size being 200px and realization window increase being 40px per measure pass,
00324             // make sure there are 2.5 x cacheLengths passes to land on the final realized items.
00325             // cacheLengths: number of viewports constituting the pre-fetch buffer, once completely built.
00326             //               Half of it is before the current viewport, and half after.
00327             // viewport: 200px
00328             // cacheIncrement: 40px (buffer increment per measure pass on each side)
00329             // Measure passes needed to fill the pre-fetch buffer: viewport / cacheIncrement / 2 x cacheLengths = 2.5 x cacheLengths
00330
00331             IdleSynchronizer.Wait();
00332             strRealizedItemsIndices = LogRealizedIndices(realizedItemsIndices, (int)(2.5 * cacheLengths + 1));
00333             Verify.AreEqual(
00334                 cacheLengths == 0 ? " 0 1 2 3 4 5 6 7 8 9" : " 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17",
00335                 strRealizedItemsIndices);
00336
00337             StartBringIndexIntoView(itemsRepeater, index: 99);
00338             strRealizedItemsIndices = LogRealizedIndices(realizedItemsIndices, (int)(2.5 * cacheLengths + 1));
00339             Verify.AreEqual(
00340                 cacheLengths == 0 ? " 99 100 98 97 96 95 94 93 92 91 90" : " 99 100 101 102 103 104 105 106 107 108 109 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82",
00341                 strRealizedItemsIndices);
00342
00343             StartBringIndexIntoView(itemsRepeater, index: 199);
00344             strRealizedItemsIndices = LogRealizedIndices(realizedItemsIndices, (int)(2.5 * cacheLengths + 1));
00345             Verify.AreEqual(
00346                 cacheLengths == 0 ? " 199 198 197 196 195 194 193 192 191 190" : " 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182",
00347                 strRealizedItemsIndices);
00348
00349             StartBringIndexIntoView(itemsRepeater, index: 49);
00350             strRealizedItemsIndices = LogRealizedIndices(realizedItemsIndices, (int)(2.5 * cacheLengths + 1));
00351             Verify.AreEqual(
00352                 cacheLengths == 0 ? " 49 50 51 52 53 54 55 56 57 58 48" : " 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 48 47 46 45 44 43 42 41 40 39",
00353                 strRealizedItemsIndices);
00354
00355             StartBringIndexIntoView(itemsRepeater, index: 0);
00356             strRealizedItemsIndices = LogRealizedIndices(realizedItemsIndices, (int)(2.5 * cacheLengths + 1));
00357             Verify.AreEqual(
00358                 cacheLengths == 0 ? " 0 1 2 3 4 5 6 7 8 9" : " 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17",
00359                 strRealizedItemsIndices);
00360         }
00361
00362         private void StartBringIndexIntoView(ItemsRepeater itemsRepeater, int index)
00363         {
00364             RunOnUIThread.Execute(() =>
00365             {
00366                 Log.Comment("\r\nItemsRepeater.GetOrCreateElement(" + index + ")");
00367                 var item = itemsRepeater.GetOrCreateElement(index);
00368
00369                 // Make sure the newly created item is measured so that its size is
00370                 // identified and can be used to bring it entirely into view.
00371                 Log.Comment("UIElement.UpdateLayout()");
00372                 item.UpdateLayout();
00373
00374                 Log.Comment("UIElement.StartBringIntoView()");
00375                 item.StartBringIntoView();
00376             });
00377
00378             IdleSynchronizer.Wait();
00379         }
00380
00381         private string LogRealizedIndices(List<int> realizedItemsIndices, int ticks)
00382         {
00383             string strRealizedItemsIndices = null;
00384
00385             do
00386             {
00387                 RunOnUIThread.Execute(() =>
00388                 {
00389                     strRealizedItemsIndices = string.Empty;
00390
00391                     foreach (int i in realizedItemsIndices)
00392                     {
00393                         strRealizedItemsIndices += " " + i;
00394                     }
00395
00396                     Log.Comment("Realized indices:" + strRealizedItemsIndices);
00397                 });
00398
00399                 ticks--;
00400                 CompositionPropertySpy.SynchronouslyTickUIThread(1);
00401             }
00402             while (ticks >= 0);
00403
00404             return strRealizedItemsIndices;
00405         }
00406
00407         [TestMethod]
00408         public void ValidateElementEvents()
00409         {
00410             CustomItemsSource dataSource = null;
00411             RunOnUIThread.Execute(() => dataSource = new CustomItemsSource(Enumerable.Range(0, 10).ToList()));
00412
00413             var repeater = SetupRepeater(dataSource);
00414
00415             RunOnUIThread.Execute(() =>
00416             {
00417                 List<int> preparedIndices = new List<int>();
00418                 List<int> clearedIndices = new List<int>();
00419                 List<KeyValuePair<int, int>> changedIndices = new List<KeyValuePair<int, int>>();
00420
00421                 repeater.ElementPrepared += (sender, args) =>
00422                 {
00423                     preparedIndices.Add(args.Index);
00424                 };
00425
00426                 repeater.ElementClearing += (sender, args) =>
00427                 {
00428                     clearedIndices.Add(sender.GetElementIndex(args.Element));
00429                 };
00430
00431                 repeater.ElementIndexChanged += (sender, args) =>
00432                 {
00433                     changedIndices.Add(new KeyValuePair<int, int>(args.OldIndex, args.NewIndex));
00434                 };
00435
00436                 Log.Comment("Insert in realized range: Inserting 1 item at index 1");
00437                 dataSource.Insert(index: 1, count: 1, reset: false);
00438                 repeater.UpdateLayout();
00439
00440                 Verify.AreEqual(1, preparedIndices.Count);
00441                 Verify.AreEqual(1, preparedIndices[0]);
00442                 Verify.AreEqual(2, changedIndices.Count);
00443                 Verify.IsTrue(changedIndices.Contains(new KeyValuePair<int, int>(1, 2)));
00444                 Verify.IsTrue(changedIndices.Contains(new KeyValuePair<int, int>(2, 3)));
00445                 Verify.AreEqual(1, clearedIndices.Count);
00446                 Verify.AreEqual(3, clearedIndices[0]);
00447
00448                 preparedIndices.Clear();
00449                 clearedIndices.Clear();
00450                 changedIndices.Clear();
00451
00452                 Log.Comment("Remove in realized range: Removing 1 item at index 0");
00453                 dataSource.Remove(index: 0, count: 1, reset: false);
00454                 repeater.UpdateLayout();
00455                 Verify.AreEqual(1, clearedIndices.Count);
00456                 Verify.AreEqual(0, clearedIndices[0]);
00457                 Verify.AreEqual(0, preparedIndices.Count);
00458                 Verify.AreEqual(2, changedIndices.Count);
00459                 Verify.IsTrue(changedIndices.Contains(new KeyValuePair<int, int>(1, 0)));
00460                 Verify.IsTrue(changedIndices.Contains(new KeyValuePair<int, int>(2, 1)));
00461             });
00462         }
00463
00464         [TestMethod]
00465         public void ValidateElementIndexChangedEventOnStableReset()
00466         {
00467             CustomItemsSource dataSource = null;
00468             RunOnUIThread.Execute(() => dataSource = new CustomItemsSourceWithUniqueId(Enumerable.Range(0, 10).ToList()));
00469
00470             var repeater = SetupRepeater(dataSource);
00471
00472             RunOnUIThread.Execute(() =>
00473             {
00474                 List<int> preparedIndices = new List<int>();
00475                 List<int> clearedIndices = new List<int>();
00476                 List<KeyValuePair<int, int>> changedIndices = new List<KeyValuePair<int, int>>();
00477
00478                 repeater.ElementPrepared += (sender, args) =>
00479                 {
00480                     preparedIndices.Add(args.Index);
00481                 };
00482
00483                 repeater.ElementClearing += (sender, args) =>
00484                 {
00485                     clearedIndices.Add(sender.GetElementIndex(args.Element));
00486                 };
00487
00488                 repeater.ElementIndexChanged += (sender, args) =>
00489                 {
00490                     changedIndices.Add(new KeyValuePair<int, int>(args.OldIndex, args.NewIndex));
00491                 };
00492
00493                 Log.Comment("(UniqueId Reset) Insert in realized range: Inserting 1 item at index 1");
00494                 dataSource.Insert(index: 1, count: 1, reset: true, valueStart: 2000);
00495                 repeater.UpdateLayout();
00496
00497                 Verify.AreEqual(1, preparedIndices.Count);
00498                 Verify.AreEqual(1, preparedIndices[0]);
00499                 Verify.AreEqual(1, changedIndices.Count);
00500                 Verify.IsTrue(changedIndices.Contains(new KeyValuePair<int, int>(1, 2)));
00501                 foreach (var ch in changedIndices)
00502                 {
00503                     Log.Comment("Changed " + ch.Key + " " + ch.Value);
00504                 }
00505                 Verify.AreEqual(1, clearedIndices.Count);
00506                 Verify.AreEqual(2, clearedIndices[0]);
00507
00508                 preparedIndices.Clear();
00509                 clearedIndices.Clear();
00510                 changedIndices.Clear();
00511
00512                 Log.Comment("(UniqueId Reset) Remove in realized range: Removing 1 item at index 0");
00513                 dataSource.Remove(index: 0, count: 1, reset: true);
00514                 repeater.UpdateLayout();
00515                 Verify.AreEqual(1, clearedIndices.Count);
00516                 Verify.AreEqual(0, clearedIndices[0]);
00517                 foreach (var ch in changedIndices)
00518                 {
00519                     Log.Comment("Changed " + ch.Key + " " + ch.Value);
00520                 }
00521                 Verify.AreEqual(1, preparedIndices.Count);
00522                 Verify.AreEqual(2, preparedIndices[0]);
00523                 Verify.AreEqual(2, changedIndices.Count);
00524                 Verify.IsTrue(changedIndices.Contains(new KeyValuePair<int, int>(1, 0)));
00525                 Verify.IsTrue(changedIndices.Contains(new KeyValuePair<int, int>(2, 1)));
00526             });
00527         }
00528
00529         [TestMethod]
00530         public void ValidateGetElementAtCachingForLayout()
00531         {
00532             List<int> data = Enumerable.Range(0, 15).ToList();
00533             ItemsSourceView dataSource = null;
00534             RunOnUIThread.Execute(() => dataSource = new ItemsSourceView(data));
00535             ScrollViewer scrollViewer = null;
00536             var repeater = SetupRepeater(dataSource, null /*layout*/, out scrollViewer);
00537             bool layoutRan = false;
00538
00539             RunOnUIThread.Execute(() =>
00540             {
00541                 var layout = new MockVirtualizingLayout();
00542                 layout.MeasureLayoutFunc = (availableSize, context) =>
00543                 {
00544                     Verify.AreEqual(15, context.ItemCount);
00545                     var element0 = context.GetOrCreateElementAt(0);
00546                     Verify.IsNotNull(element0);
00547                     var element1 = context.GetOrCreateElementAt(1);
00548                     Verify.IsNotNull(element1);
00549                     Verify.AreNotSame(element0, element1);
00550
00551                     var element1again = context.GetOrCreateElementAt(1);
00552                     Verify.AreSame(element1, element1again);
00553
00554                     var element10 = context.GetOrCreateElementAt(10);
00555                     Verify.IsNotNull(element10);
00556                     Verify.AreNotSame(element0, element10);
00557                     Verify.AreNotSame(element1, element10);
00558
00559                     context.RecycleElement(element1);
00560
00561                     var element0New = context.GetOrCreateElementAt(0);
00562                     Verify.AreSame(element0, element0New);
00563
00564                     context.RecycleElement(element10);
00565                     context.RecycleElement(element0);
00566
00567                     layoutRan = true;
00568                     return new Size(10, 10);
00569                 };
00570
00571                 repeater.Layout = layout;
00572                 repeater.UpdateLayout();
00573                 Verify.IsTrue(layoutRan);
00574             });
00575
00576             IdleSynchronizer.Wait();
00577         }
00578
00579         // Validate that when we clear containers during panning in flow layouts, we always do it
00580         // from the end of the range inwards. This allows us to better track first/last realized indices in
00581         // ViewManager. Breaking this can cause a performance regression.
00582         [TestMethod]
00583         public void ValidateElementClearingOrderFromFlowLayout()
00584         {
00585             ItemsSourceView dataSource = null;
00586             RunOnUIThread.Execute(() => dataSource = new ItemsSourceView(Enumerable.Range(0, 15).ToList()));
00587             ScrollViewer scrollViewer = null;
00588             var repeater = SetupRepeater(dataSource, null /*layout*/, out scrollViewer);
00589             List<int> clearedIndices = new List<int>();
00590             var viewChangedEvent = new ManualResetEvent(false);
00591
00592             RunOnUIThread.Execute(() =>
00593             {
00594                 scrollViewer.ViewChanged += (sender, args) =>
00595                 {
00596                     if (!args.IsIntermediate)
00597                     {
00598                         viewChangedEvent.Set();
00599                     }
00600                 };
00601
00602                 repeater.Layout = new StackLayout();
00603                 repeater.ElementPrepared += (sender, args) =>
00604                 {
00605                     ((FrameworkElement)args.Element).Height = 20;
00606                 };
00607                 repeater.UpdateLayout();
00608
00609                 repeater.ElementClearing += (sender, args) =>
00610                 {
00611                     int index = repeater.GetElementIndex(args.Element);
00612                     Log.Comment("Clearing.." + index);
00613                     clearedIndices.Add(index);
00614                 };
00615
00616                 scrollViewer.ChangeView(null, 100.0, null, disableAnimation: true);
00617             });
00618
00619             Verify.IsTrue(viewChangedEvent.WaitOne(DefaultWaitTime), "Waiting for ViewChanged.");
00620             IdleSynchronizer.Wait();
00621
00622             RunOnUIThread.Execute(() =>
00623             {
00624                 // Validate order is 0, 1, 2, 3
00625                 for (int i = 0; i < 4; i++)
00626                 {
00627                     Verify.AreEqual(i, clearedIndices[i]);
00628                 }
00629
00630                 clearedIndices.Clear();
00631                 viewChangedEvent.Reset();
00632                 scrollViewer.ChangeView(null, 0.0, null, disableAnimation: true);
00633             });
00634
00635             Verify.IsTrue(viewChangedEvent.WaitOne(DefaultWaitTime), "Waiting for ViewChanged.");
00636             IdleSynchronizer.Wait();
00637
00638             RunOnUIThread.Execute(() =>
00639             {
00640                 // Validate order is backwards 14, 13, 12, 11
00641                 for (int i = 0; i < 4; i++)
00642                 {
00643                     Verify.AreEqual(14 - i, clearedIndices[i]);
00644                 }
00645             });
00646         }
00647
00648         [TestMethod]
00649         public void ValidateDataContextDoesNotGetOverwritten()
00650         {
00651             const string c_element1DataContext = "Element1_DataContext";
00652
00653             RunOnUIThread.Execute(() =>
00654             {
00655                 var data = new List<Button>()
00656                 {
00657                     new Button()
00658                     {
00659                             Content = "Element1_Content",
00660                             DataContext = c_element1DataContext
00661                     }
00662                 };
00663
00664                 var elementFactory = new DataAsElementElementFactory();
00665
00666                 var repeater = new ItemsRepeater() {
00667                     ItemsSource = data,
00668                     ItemTemplate = elementFactory
00669                 };
00670
00671                 Content = repeater;
00672
00673                 Content.UpdateLayout();
00674
00675                 // Verify that DataContext is still the same
00676                 var firstElement = repeater.TryGetElement(0) as Button;
00677                 var retrievedDataContextItem1 = firstElement.DataContext as string;
00678                 Verify.IsTrue(retrievedDataContextItem1 == c_element1DataContext);
00679
00680             });
00681         }
00682
00683         [TestMethod]
00684         public void ValidateDataContextGetsPropagated()
00685         {
00686             const string c_element1DataContext = "Element1_DataContext";
00687
00688             RunOnUIThread.Execute(() =>
00689             {
00690                 var data = new List<Button>()
00691                 {
00692                     new Button()
00693                     {
00694                             Content = "Element1_Content",
00695                             DataContext = c_element1DataContext
00696                     }
00697                 };
00698
00699                 var elementFactory = new ElementFromElementElementFactory();
00700
00701                 var repeater = new ItemsRepeater()
00702                 {
00703                     ItemsSource = data,
00704                     ItemTemplate = elementFactory
00705                 };
00706
00707                 Content = repeater;
00708
00709                 Content.UpdateLayout();
00710
00711                 // Verify that DataContext of data has propagated to the container
00712                 var firstElement = repeater.TryGetElement(0) as Button;
00713                 var retrievedDataContextItem1 = firstElement.DataContext as string;
00714                 Verify.IsTrue(data[0] == firstElement.Content);
00715                 Verify.IsTrue(retrievedDataContextItem1 == c_element1DataContext);
00716
00717             });
00718         }
00719
00720         [TestMethod]// Issue 1018
00721         [TestProperty("Ignore", "True")]
00722         public void ValidateFocusMoveOnElementCleared()
00723         {
00724             ItemsRepeater repeater = null;
00725             CustomItemsSource dataSource = null;
00726             RunOnUIThread.Execute(() =>
00727             {
00728                 dataSource = new CustomItemsSource(Enumerable.Range(0, 5).ToList());
00729             });
00730
00731             repeater = SetupRepeater(dataSource, "<Button Content='{Binding}' Height='10'/>");
00732
00733             // dataSource: 0 1 2 3 4
00734             // Index 0 deleted, focus should be on the new element which has index 0
00735             SharedHelpers.RunActionsWithWait(
00736                 new Action[]
00737                 {
00738                     () => { MoveFocusToIndex(repeater, 0); },
00739                     () => { dataSource.Remove(0 /* index */, 1 /* count */, false /* reset*/); },
00740                     () => { ValidateCurrentFocus(repeater, 0 /*expectedIndex */, "1" /* expectedContent */); }
00741                 });
00742
00743             // dataSource: 1 2 3 4
00744             // Last element deleted, focus should move to the previous element
00745             int lastIndex = dataSource.Inner.Count - 1;
00746             SharedHelpers.RunActionsWithWait(
00747                 new Action[]
00748                 {
00749                     () => { MoveFocusToIndex(repeater, lastIndex); },
00750                     () => { dataSource.Remove(lastIndex /* index */, 1 /* count */, false /* reset*/); },
00751                     () => { ValidateCurrentFocus(repeater, 2 /*expectedIndex */, "3" /* expectedContent */); }
00752                 });
00753
00754             // dataSource: 1 2 3
00755             // Remove multiple elements
00756             SharedHelpers.RunActionsWithWait(
00757                 new Action[]
00758                 {
00759                     () => { MoveFocusToIndex(repeater, 0); },
00760                     () => { dataSource.Remove(0 /* index */, 2 /* count */, false /* reset*/); },
00761                     () => { ValidateCurrentFocus(repeater, 0 /*expectedIndex */, "3" /* expectedContent */); }
00762                 });
00763         }
00764
00765         [TestMethod] //Issue 1018
00766         [TestProperty("Ignore", "True")]
00767         public void ValidateFocusMoveOnElementClearedWithUniqueIds()
00768         {
00769             ItemsRepeater repeater = null;
00770             CustomItemsSource dataSource = null;
00771             RunOnUIThread.Execute(() =>
00772             {
00773                 dataSource = new CustomItemsSourceWithUniqueId(Enumerable.Range(0, 5).ToList());
00774             });
00775
00776             repeater = SetupRepeater(dataSource, "<Button Content='{Binding}' Height='10'/>");
00777
00778             // dataSource: 0 1 2 3 4
00779             // Index 0 deleted, focus should be on the new element which has index 0
00780             SharedHelpers.RunActionsWithWait(
00781                 new Action[]
00782                 {
00783                     () => { MoveFocusToIndex(repeater, 0); },
00784                     () => { dataSource.Remove(0 /* index */, 1 /* count */, true /* reset*/); },
00785                     () => { ValidateCurrentFocus(repeater, 0 /*expectedIndex */, "1" /* expectedContent */); }
00786                 });
00787
00788             // dataSource: 1 2 3 4
00789             // Last element deleted, focus should move to the previous element
00790             int lastIndex = dataSource.Inner.Count - 1;
00791             SharedHelpers.RunActionsWithWait(
00792                 new Action[]
00793                 {
00794                     () => { MoveFocusToIndex(repeater, lastIndex); },
00795                     () => { dataSource.Remove(lastIndex /* index */, 1 /* count */, true /* reset*/); },
00796                     () => { ValidateCurrentFocus(repeater, 2 /*expectedIndex */, "3" /* expectedContent */); }
00797                 });
00798
00799             // dataSource: 1 2 3
00800             // Reset should keep the focused element as long as the unique id matches.
00801             SharedHelpers.RunActionsWithWait(
00802                 new Action[]
00803                 {
00804                     () => { MoveFocusToIndex(repeater, 0); },
00805                     () => { dataSource.Reset(); },
00806                     () =>
00807                     {
00808                         int newIndex = dataSource.Inner.IndexOf(1);
00809                         ValidateCurrentFocus(repeater, newIndex /*expectedIndex */, "1" /* expectedContent */);
00810                     }
00811                 });
00812
00813             // dataSource: 1 2 3
00814             // Remove multiple elements
00815             SharedHelpers.RunActionsWithWait(
00816                 new Action[]
00817                 {
00818                     () => { MoveFocusToIndex(repeater, 0); },
00819                     () => { dataSource.Remove(0 /* index */, 2 /* count */, true /* reset*/); },
00820                     () => { ValidateCurrentFocus(repeater, 0 /*expectedIndex */, "3" /* expectedContent */); }
00821                 });
00822         }
00823
00824         [TestMethod]
00825         // Why does this test work?
00826         // When the elements get created from the RecyclingElementFactory, we get already "existing" data templates.
00827         // However, the reason for the crash in #2384 is that those "empty" data templates actually still had their data context
00828         // If that data context is not null, that means it did not get cleared when the element was recycled, which is the wrong behavior.
00829         // To check if the clearing is working correctly, we are checking this inside the ElementFactory's RecycleElement function.
00830         public void ValidateElementClearingClearsDataContext()
00831         {
00832             ItemsRepeater repeater = null;
00833             MockElementFactory elementFactory = null;
00834             int elementClearingRaisedCount = 0;
00835             Log.Comment("Initialize ItemsRepeater");
00836             RunOnUIThread.Execute(() =>
00837             {
00838                 elementFactory = new MockElementFactory() {
00839                     GetElementFunc = delegate (int index, UIElement owner) {
00840                         return new Button() { Content = index };
00841                            },
00842
00843                     ClearElementFunc = delegate (UIElement element, UIElement owner) {
00844                         elementClearingRaisedCount++;
00845                         Verify.IsNull((element as FrameworkElement).DataContext);
00846                     }
00847                 };
00848
00849                 repeater = CreateRepeater(Enumerable.Range(0, 100),
00850                     elementFactory);
00851
00852                 repeater.Layout = new StackLayout();
00853
00854                 Content = repeater;
00855                 repeater.UpdateLayout();
00856
00857                 repeater.ItemsSource = null;
00858
00859                 Log.Comment("Verify ItemsRepeater cleared data contexts correctly");
00860                 Verify.IsTrue(elementClearingRaisedCount > 0, "ItemsRepeater should have cleared some elements");
00861             });
00862         }
00863
00864
00865         private void MoveFocusToIndex(ItemsRepeater repeater, int index)
00866         {
00867             var element = repeater.TryGetElement(index) as Control;
00868             element.Focus(FocusState.Programmatic);
00869         }
00870
00871         private void ValidateCurrentFocus(ItemsRepeater repeater, int expectedIndex, string expectedContent)
00872         {
00873             var currentFocus = FocusManager.GetFocusedElement(repeater.XamlRoot) as ContentControl;
00874             var currentFocusedIndex = repeater.GetElementIndex(currentFocus);
00875             Log.Comment("expectedIndex: " + expectedIndex + " actual : " + currentFocusedIndex);
00876             Verify.AreEqual(expectedIndex, currentFocusedIndex);
00877             Log.Comment("expectedContent: " + expectedContent + " actual : " + currentFocus.Content.ToString());
00878             Verify.AreEqual(expectedContent, currentFocus.Content.ToString());
00879         }
00880
00881         private ItemsRepeater CreateRepeater(object dataSource, object elementFactory)
00882         {
00883             var repeater = new ItemsRepeater
00884             {
00885                 ItemsSource = dataSource,
00886                 ItemTemplate = elementFactory
00887             };
00888             repeater.Layout = CreateLayout(repeater);
00889             return repeater;
00890         }
00891
00892         private VirtualizingLayout CreateLayout(ItemsRepeater repeater)
00893         {
00894             var layout = new MockVirtualizingLayout();
00895             var children = new List<UIElement>();
00896
00897             layout.MeasureLayoutFunc = (availableSize, context) =>
00898             {
00899                 repeater.Tag = repeater.Tag ?? context;
00900                 children.Clear();
00901                 var itemCount = context.ItemCount;
00902
00903                 for (int i = 0; i < itemCount; ++i)
00904                 {
00905                     var element = context.GetOrCreateElementAt(i);
00906                     element.Measure(availableSize);
00907                     children.Add(element);
00908                 }
00909
00910                 return new Size(10, 10);
00911             };
00912
00913             return layout;
00914         }
00915
00916         private ItemsRepeater SetupRepeater(object dataSource=null, string itemContent= @"<Button Content='{Binding}' Height='100'/>")
00917         {
00918             VirtualizingLayout layout = null;
00919             RunOnUIThread.Execute(() => layout = new StackLayout());
00920             ScrollViewer scrollViewer = null;
00921             return SetupRepeater(dataSource, layout, itemContent, out scrollViewer);
00922         }
00923
00924         private ItemsRepeater SetupRepeater(object dataSource, VirtualizingLayout layout, out ScrollViewer scrollViewer)
00925         {
00926             return SetupRepeater( dataSource, layout, @"<Button Content='{Binding}' Height='100'/>", out scrollViewer);
00927         }
00928
00929         private ItemsRepeater SetupRepeater(object dataSource, VirtualizingLayout layout, string itemContent, out ScrollViewer scrollViewer)
00930         {
00931             ItemsRepeater itemsRepeater = null;
00932             ScrollViewer sv = null;
00933             RunOnUIThread.Execute(() =>
00934             {
00935                 var elementFactory = new RecyclingElementFactory();
00936                 elementFactory.RecyclePool = new RecyclePool();
00937                 elementFactory.Templates["Item"] = XamlReader.Load(@"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>" + itemContent + @"</DataTemplate>") as DataTemplate;
00938
00939                 itemsRepeater = new ItemsRepeater()
00940                 {
00941                     ItemsSource = dataSource,
00942                     ItemTemplate = elementFactory,
00943                     Layout = layout,
00944                     HorizontalCacheLength = 0.0,
00945                     VerticalCacheLength = 0.0
00946                 };
00947
00948                 sv = new ScrollViewer
00949                 {
00950                     Content = itemsRepeater
00951                 };
00952
00953                 Content = new ItemsRepeaterScrollHost()
00954                 {
00955                     Width = 200,
00956                     Height = 200,
00957                     ScrollViewer = sv
00958                 };
00959             });
00960
00961             IdleSynchronizer.Wait();
00962             scrollViewer = sv;
00963             return itemsRepeater;
00964         }
00965
00966         private int DefaultWaitTime = 2000;
00967     }
00968 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Interactions/SliderInteraction/APITests/SliderInteractionTests.cs Source File

  • Interactions
  • SliderInteraction
  • APITests

SliderInteractionTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005
00006 using MUXControlsTestApp.Utilities;
00007
00008 using Microsoft.UI.Private.Controls;
00009
00010 using Microsoft.UI.Xaml.Controls;
00011 using Microsoft.UI.Xaml.Media;
00012 using Windows.UI.Text;
00013 using Windows.Foundation.Metadata;
00014 using Common;
00015
00016 using WEX.TestExecution;
00017 using WEX.TestExecution.Markup;
00018 using WEX.Logging.Interop;
00019
00020 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00021 {
00022     //[TestClass] This feature requires the Xaml2018 feature, which is currently disabled by Velocity
00023     public class SliderInteractionTests
00024     {
00025         [TestMethod]
00026         public void ValidateDefaultValues()
00027         {
00028             if (!ApiInformation.IsPropertyPresent("Microsoft.UI.Xaml.UIElement", "Interactions"))
00029             {
00030                 Log.Warning("UIElement.Interactions not supported on this build.");
00031                 return;
00032             }
00033
00034             RunOnUIThread.Execute(() =>
00035             {
00036                 var interaction = new SliderInteraction();
00037
00038                 Verify.AreEqual(Orientation.Horizontal, interaction.Orientation);
00039                 Verify.AreEqual(0.0, interaction.Minimum);
00040                 Verify.AreEqual(100.0, interaction.Maximum);
00041                 Verify.AreEqual(0.0, interaction.Position);
00042                 Verify.AreEqual(1.0, interaction.SmallChange);
00043                 Verify.AreEqual(10.0, interaction.LargeChange);
00044             });
00045         }
00046
00047         [TestMethod]
00048         public void DoesAdvertiseSupportedEvents()
00049         {
00050             if (!ApiInformation.IsPropertyPresent("Microsoft.UI.Xaml.UIElement", "Interactions"))
00051             {
00052                 Log.Warning("UIElement.Interactions not supported on this build.");
00053                 return;
00054             }
00055
00056             RunOnUIThread.Execute(() =>
00057             {
00058                 var interaction = new SliderInteraction();
00059                 var supportedEvents = interaction.GetSupportedEvents();
00060
00061                 Verify.IsGreaterThan(supportedEvents.Count, 0);
00062             });
00063         }
00064     }
00065 }
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

InitialsGenerator Member List

This is the complete list of members for InitialsGenerator, including all inherited members.
GetCharacterType(const wstring_view &str) | InitialsGenerator | [static]
GetCharacterType(wchar_t character) | InitialsGenerator | [static]
GetFirstFullCharacter(const std::wstring &str) | InitialsGenerator | [private, static]
InitialsFromContactObject(const winrt::Contact &contact) | InitialsGenerator | [static]
InitialsFromDisplayName(const wstring_view &contactDisplayName) | InitialsGenerator | [static]
Split(const std::wstring &source, wchar_t delim, int maxIterations=25) | InitialsGenerator | [private, static]
StripTrailingBrackets(std::wstring &source) | InitialsGenerator | [private, static]
Generated on Sun Dec 1 2024 20:52:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MyColorSpectrum Member List

This is the complete list of members for MyColorSpectrum, including all inherited members.
abi_enter() | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
CheckThread() | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
ClearProperties() | ColorSpectrumProperties | [static]
Color(winrt::Color const &value) | ColorSpectrumProperties |
Color() | ColorSpectrumProperties |
ColorChanged(winrt::TypedEventHandler< winrt::ColorSpectrum, winrt::ColorChangedEventArgs > const &value) | ColorSpectrumProperties |
ColorChanged(winrt::event_token const &token) | ColorSpectrumProperties |
ColorProperty() | ColorSpectrumProperties | [inline, static]
ColorSpectrum() | ColorSpectrum |
ColorSpectrumProperties() | ColorSpectrumProperties |
Components(winrt::ColorSpectrumComponents const &value) | ColorSpectrumProperties |
Components() | ColorSpectrumProperties |
ComponentsProperty() | ColorSpectrumProperties | [inline, static]
DeleteInstanceOnUIThread(std::unique_ptr< ColorSpectrum > &&self) noexcept | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline, static]
EnsureProperties() | ColorSpectrumProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
final_release(std::unique_ptr< ColorSpectrum > &&self) | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline, static]
GetBase() | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
GetBoundingRectangle() | ColorSpectrum |
GetInner() | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
HsvColor(winrt::float4 const &value) | ColorSpectrumProperties |
HsvColor() | ColorSpectrumProperties |
HsvColorProperty() | ColorSpectrumProperties | [inline, static]
IsOnThread() | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
m_colorChangedEventSource | ColorSpectrumProperties |
MaxHue(int value) | ColorSpectrumProperties |
MaxHue() | ColorSpectrumProperties |
MaxHueProperty() | ColorSpectrumProperties | [inline, static]
MaxSaturation(int value) | ColorSpectrumProperties |
MaxSaturation() | ColorSpectrumProperties |
MaxSaturationProperty() | ColorSpectrumProperties | [inline, static]
MaxValue(int value) | ColorSpectrumProperties |
MaxValue() | ColorSpectrumProperties |
MaxValueProperty() | ColorSpectrumProperties | [inline, static]
MinHue(int value) | ColorSpectrumProperties |
MinHue() | ColorSpectrumProperties |
MinHueProperty() | ColorSpectrumProperties | [inline, static]
MinSaturation(int value) | ColorSpectrumProperties |
MinSaturation() | ColorSpectrumProperties |
MinSaturationProperty() | ColorSpectrumProperties | [inline, static]
MinValue(int value) | ColorSpectrumProperties |
MinValue() | ColorSpectrumProperties |
MinValueProperty() | ColorSpectrumProperties | [inline, static]
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
OnApplyTemplate() | MyColorSpectrum | [inline, protected]
OnColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnComponentsPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnCreateAutomationPeer() | ColorSpectrum |
OnGotFocus(winrt::RoutedEventArgs const &e) | ColorSpectrum |
OnHsvColorPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnKeyDown(winrt::KeyRoutedEventArgs const &e) | ColorSpectrum |
OnLostFocus(winrt::RoutedEventArgs const &e) | ColorSpectrum |
OnMaxHuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnMaxSaturationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnMaxValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnMinHuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnMinSaturationPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnMinValuePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
OnPropertyChanged(winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrum |
OnShapePropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ColorSpectrumProperties | [static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
RaiseColorChanged() | ColorSpectrum |
ReferenceTracker(Args &&...args) | ReferenceTracker< ColorSpectrum, winrt::implementation::ColorSpectrumT > | [inline]
s_ColorProperty | ColorSpectrumProperties | [static]
s_ComponentsProperty | ColorSpectrumProperties | [static]
s_HsvColorProperty | ColorSpectrumProperties | [static]
s_MaxHueProperty | ColorSpectrumProperties | [static]
s_MaxSaturationProperty | ColorSpectrumProperties | [static]
s_MaxValueProperty | ColorSpectrumProperties | [static]
s_MinHueProperty | ColorSpectrumProperties | [static]
s_MinSaturationProperty | ColorSpectrumProperties | [static]
s_MinValueProperty | ColorSpectrumProperties | [static]
s_ShapeProperty | ColorSpectrumProperties | [static]
Shape(winrt::ColorSpectrumShape const &value) | ColorSpectrumProperties |
Shape() | ColorSpectrumProperties |
ShapeProperty() | ColorSpectrumProperties | [inline, static]
Generated on Sun Dec 1 2024 20:54:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Lights/MaterialHelper.cpp Source File

  • Lights

MaterialHelper.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "MaterialHelper.h"
00007 #include "AcrylicBrush.h"
00008 #include "RevealBrush.h"
00009 #include "XamlAmbientLight.h"
00010 #include "RevealBorderLight.h"
00011 #include "RevealHoverLight.h"
00012 #include "ResourceAccessor.h"
00013 #include "LifetimeHandler.h"
00014
00015 /* static */
00016 bool MaterialHelperBase::SimulateDisabledByPolicy()
00017 {
00018     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00019     return instance ? instance->m_simulateDisabledByPolicy : false;
00020 }
00021
00022 /* static */
00023 void MaterialHelperBase::SimulateDisabledByPolicy(bool value)
00024 {
00025     const auto instance = LifetimeHandler::GetMaterialHelperInstance();
00026     const bool oldValue = instance->m_simulateDisabledByPolicy;
00027     if (oldValue != value)
00028     {
00029         instance->m_simulateDisabledByPolicy = value;
00030         instance->UpdatePolicyStatus();
00031     }
00032 }
00033
00034 /* static */
00035 bool MaterialHelperBase::IgnoreAreEffectsFast()
00036 {
00037     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00038     return instance ? instance->m_ignoreAreEffectsFast : false;
00039 }
00040
00041 /* static */
00042 void MaterialHelperBase::IgnoreAreEffectsFast(bool value)
00043 {
00044     const auto instance = LifetimeHandler::GetMaterialHelperInstance();
00045     const bool oldValue = instance->m_ignoreAreEffectsFast;
00046     if (oldValue != value)
00047     {
00048         instance->m_ignoreAreEffectsFast = value;
00049         instance->UpdatePolicyStatus();
00050     }
00051 }
00052
00053 /* static */
00054 void MaterialHelperBase::OnRevealBrushConnected()
00055 {
00056     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00057     instance->m_revealBrushConnectedCount++;
00058
00059     if (instance->m_revealBrushConnectedCount == 1)
00060     {
00061         // If this is the first connected brush, attach lights.
00062         if (instance->m_revealLightsToRemove.size() == 0)
00063         {
00064             RevealBrush::AttachLights();
00065         }
00066     }
00067 }
00068
00069 /* static */
00070 void MaterialHelperBase::OnRevealBrushDisconnected()
00071 {
00072     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00073
00074     MUX_ASSERT(instance->m_revealBrushConnectedCount > 0);
00075     instance->m_revealBrushConnectedCount--;
00076
00077     if (instance->m_revealBrushConnectedCount == 0)
00078     {
00079         // Remove all the lights we created/attached previously now that there's no RevealBrushes active.
00080         for (auto pair : instance->m_revealLightsToRemove)
00081         {
00082             for (auto lightToRemove : pair.second)
00083             {
00084                 uint32_t index{};
00085                 if (pair.first.IndexOf(lightToRemove, index))
00086                 {
00087                     pair.first.RemoveAt(index);
00088                 }
00089             }
00090         }
00091
00092         instance->m_revealLightsToRemove.clear();
00093
00094         // We just removed all lights from the tree. If we were still in the middle of multi-step process of attaching lights,
00095         // then don't finish attaching the rest. Otherwise we'll leave the tree in a partially-lit state.
00096         RevealBrush::StopAttachingLights();
00097     }
00098 }
00099
00100 /* static */
00101 void MaterialHelperBase::TrackRevealLightsToRemove(const winrt::IVector<winrt::XamlLight>& lights, const std::vector<winrt::XamlLight>& revealLightsToRemove)
00102 {
00103     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00104     instance->m_revealLightsToRemove.emplace_back(lights, revealLightsToRemove);
00105 }
00106
00107 /* static */
00108 winrt::CompositionEffectFactory MaterialHelperBase::GetOrCreateAcrylicBrushCompositionEffectFactoryFromCache(
00109     const winrt::Compositor& compositor,
00110     bool shouldBrushBeOpaque,
00111     bool useCrossFadeEffect,
00112     bool useCache,
00113     std::function<winrt::CompositionEffectFactory()> cacheMissingCallback)
00114 {
00115     winrt::CompositionEffectFactory factory{ nullptr };
00116
00117     if (useCache)
00118     {
00119         auto instance = LifetimeHandler::GetMaterialHelperInstance();
00120         instance->AssertUniqueCompositorOrUpdate(compositor);
00121
00122         const auto key = BuildAcrylicBrushCompositionEffectFactoryKey(shouldBrushBeOpaque, useCrossFadeEffect);
00123         auto value = instance->m_acrylicBrushCompositionEffectFactoryCache[key];
00124         if (value)
00125         {
00126             // hit cache
00127             factory = static_cast<winrt::CompositionEffectFactory&>(value);
00128         }
00129         else
00130         {
00131             // miss, request to create new one and update cache
00132             factory = cacheMissingCallback();
00133             instance->m_acrylicBrushCompositionEffectFactoryCache[key] = factory;
00134         }
00135     }
00136     else
00137     {
00138         // always create a new one
00139         factory = cacheMissingCallback();
00140     }
00141     return factory;
00142 }
00143
00144 /* static */
00145 winrt::CompositionEffectFactory
00146 MaterialHelperBase::GetOrCreateRevealBrushCompositionEffectFactoryFromCache(
00147     bool isBorder,
00148     bool isInverted,
00149     bool hasBaseColor,
00150     std::function<winrt::CompositionEffectFactory()> cacheMissingCallback)
00151 {
00152     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00153
00154     int key = 0;
00155     key |= isBorder ? static_cast<int>(RevealBrushCacheFlags::IsBorder) : 0;
00156     key |= isInverted ? static_cast<int>(RevealBrushCacheFlags::IsInverted) : 0;
00157     key |= hasBaseColor ? static_cast<int>(RevealBrushCacheFlags::HasBaseColor) : 0;
00158
00159     winrt::ICompositionEffectFactory& factory =
00160         instance->m_revealBrushCompositionEffectFactoryCache[key];
00161
00162     if (!factory)
00163     {
00164         // miss cache, write the result back into the field we grabbed above.
00165         factory = cacheMissingCallback();
00166     }
00167
00168     return static_cast<winrt::CompositionEffectFactory&>(factory);
00169 }
00170
00171 /* static */
00172 int constexpr MaterialHelperBase::BuildAcrylicBrushCompositionEffectFactoryKey(
00173     bool shouldBrushBeOpaque,
00174     bool useCrossFadeEffect)
00175 {
00176     int key = 0;
00177     key |= shouldBrushBeOpaque ? AcrylicBrushCacheHelperParam::ShouldBrushBeOpaque : 0;
00178     key |= useCrossFadeEffect ? AcrylicBrushCacheHelperParam::UseCrossFadeEffect : 0;
00179     return key;
00180 }
00181
00182 void MaterialHelperBase::AssertUniqueCompositorOrUpdate(const winrt::Compositor& compositor)
00183 {
00184     if (m_acrylicCompositor)
00185     {
00186         MUX_ASSERT(compositor == m_acrylicCompositor);
00187     }
00188     else
00189     {
00190         m_acrylicCompositor = compositor;
00191     }
00192 }
00193
00194 winrt::CompositionSurfaceBrush MaterialHelperBase::CreateScaledBrush(int dpiScale)
00195 {
00196     winrt::Compositor compositor = winrt::CompositionTarget::GetCompositorForCurrentThread();
00197     winrt::LoadedImageSurface surface{ ResourceAccessor::GetImageSurface(IR_NoiseAsset_256X256_PNG, { 256, 256 }) };
00198     winrt::CompositionSurfaceBrush noiseBrush = compositor.CreateSurfaceBrush(surface);
00199
00200     // Noise should never be stretched (we tile it instead)
00201     noiseBrush.Stretch(winrt::CompositionStretch::None);
00202     // Align the noise to the top-left. This way it doesn't move around when the element gets resized to the right or bottom.
00203     // The default has it centered, which moves the noise texture as elements are resized and makes them shimmer.
00204     noiseBrush.HorizontalAlignmentRatio(0.0f);
00205     noiseBrush.VerticalAlignmentRatio(0.0f);
00206
00207     // Undo dpi scale on the noise (we tile it instead)
00208     noiseBrush.Scale(winrt::float2(1.0f / (static_cast<float>(dpiScale) / 100.0f)));
00209
00210     return noiseBrush;
00211 }
00212
00213 template <typename T>
00214 /*static*/ void MaterialHelperBase::LightPolicyChangedHelper(T* instance, bool isDisabledByMaterialPolicy)
00215 {
00216     if (instance->m_isDisabledByMaterialPolicy != isDisabledByMaterialPolicy)
00217     {
00218         instance->m_isDisabledByMaterialPolicy = isDisabledByMaterialPolicy;
00219
00220         if (instance->m_isDisabledByMaterialPolicy)
00221         {
00222             instance->ReleaseCompositionResources();
00223         }
00224         else
00225         {
00226             instance->EnsureCompositionResources();
00227         }
00228     }
00229 }
00230 template void MaterialHelperBase::LightPolicyChangedHelper<XamlAmbientLight>(XamlAmbientLight* instance, bool isDisabledByMaterialPolicy);
00231 template void MaterialHelperBase::LightPolicyChangedHelper<RevealBorderLight>(RevealBorderLight* instance, bool isDisabledByMaterialPolicy);
00232 template void MaterialHelperBase::LightPolicyChangedHelper<RevealHoverLight>(RevealHoverLight* instance, bool isDisabledByMaterialPolicy);
00233
00234 // *****************************************
00235 // ***** MUX version of MaterialHelper *****
00236 // *****************************************
00237 /* static */
00238 winrt::event_token MaterialHelper::PolicyChanged(const std::function<void(const com_ptr<MaterialHelperBase>&, bool)>& handler)
00239 {
00240     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00241     handler(instance, instance->m_isDisabledByMaterialPolicy);
00242     return instance->m_policyChangedListeners.add(handler);
00243 }
00244
00245 /* static */
00246 void MaterialHelper::PolicyChanged(winrt::event_token removeToken)
00247 {
00248     if (auto instance = LifetimeHandler::TryGetMaterialHelperInstance())
00249     {
00250         instance->m_policyChangedListeners.remove(removeToken);
00251     }
00252 }
00253
00254 /* static */
00255 winrt::event_token MaterialHelper::NoiseChanged(const std::function<void(const com_ptr<MaterialHelperBase>&)>& handler)
00256 {
00257     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00258     handler(instance);
00259     return instance->m_noiseChangedListeners.add(handler);
00260 }
00261
00262 /* static */
00263 void MaterialHelper::NoiseChanged(winrt::event_token removeToken)
00264 {
00265     if (auto instance = LifetimeHandler::TryGetMaterialHelperInstance())
00266     {
00267         instance->m_noiseChangedListeners.remove(removeToken);
00268     }
00269 }
00270
00271 MaterialHelper::MaterialHelper()
00272 {
00273     try
00274     {
00275         m_energySaverStatusChangedRevoker = winrt::PowerManager::EnergySaverStatusChanged(winrt::auto_revoke, { this, &MaterialHelper::OnEnergySaverStatusChanged });
00276         m_energySaverStatusChangedRevokerValid = true;
00277     }
00278     catch (winrt::hresult_error)
00279     {
00280         // Some processes like EdgeCP don't have access to activate PowerManager. In those cases, just
00281         // always run in fallback mode.
00282     }
00283
00284     // Sometimes we are called so early that we can't access the CoreWindow yet. In these cases we know that
00285     // the CompositionCapabilities API will also fail. So don't try to do that until CompositionTarget::Rendering.
00286     // Same for accessing DisplayInformation and obtainting CoreWindow for this view.
00287     m_dispatcherQueue = winrt::DispatcherQueue::GetForCurrentThread();
00288     const auto coreWindow = winrt::CoreWindow::GetForCurrentThread();
00289     if (coreWindow)
00290     {
00291         EnsureCompositionCapabilities();
00292         HookupDpiChangedHandler();
00293     }
00294     else
00295     {
00296         auto strongThis = get_strong();
00297         SharedHelpers::QueueCallbackForCompositionRendering([strongThis]() {
00298             // Try again to evaluate composition capabilities.
00299             strongThis->EnsureCompositionCapabilities();
00300             strongThis->UpdatePolicyStatus(true /* onUIThread */);
00301
00302             // ... and DisplayInformation to sign up for DpiChanged
00303             strongThis->HookupDpiChangedHandler();
00304         });
00305     }
00306
00307     winrt::UISettings uiSettings; // Make an instance to be able to listen for changes.
00308     m_uiSettings = uiSettings.try_as<winrt::IUISettings4>();
00309     m_advancedEffectsEnabledChangedToken = m_uiSettings.AdvancedEffectsEnabledChanged({ this, &MaterialHelper::OnUISettingsChanged });
00310
00311     UpdatePolicyStatus(true /* onUIThread */);
00312 }
00313
00314 void MaterialHelper::HookupDpiChangedHandler()
00315 {
00316     if (auto currentView = SharedHelpers::TryGetCurrentCoreApplicationView())
00317     {
00318         winrt::DisplayInformation displayInformation = winrt::DisplayInformation::GetForCurrentView();
00319         m_dpiChangedRevoker = displayInformation.DpiChanged(winrt::auto_revoke, { this, &MaterialHelper::OnDpiChanged });
00320         m_logicalDpi = displayInformation.LogicalDpi();
00321     }
00322     else
00323     {
00324         // Calling GetForCurrentView on threads without a CoreWindow throws an error. This comes up in places like LogonUI.
00325         // Ignore the error and assume a DPI.
00326
00327         m_logicalDpi = 96;  // This isn't correct. Xaml has internal code that handles XamlPresenter scenarios, but that isn't available through public APIs. We can fix this for WUXC but not MUX.
00328     }
00329 }
00330
00331 void MaterialHelper::EnsureCompositionCapabilities()
00332 {
00333     if (!m_compositionCapabilities)
00334     {
00335         try
00336         {
00337             m_compositionCapabilities = winrt::CompositionCapabilities();
00338             m_compositionCapabilitiesChangedToken = m_compositionCapabilities.Changed({ this, &MaterialHelper::OnCompositionCapabilitiesChanged });
00339         }
00340         catch (winrt::hresult_error)
00341         {
00342             // Some processes don't have access to activate CompositionCapabilities. In those cases, just
00343             // always run in fallback mode.
00344         }
00345     }
00346 }
00347
00348 MaterialHelper::~MaterialHelper()
00349 {
00350     if (m_compositionCapabilities)
00351     {
00352         m_compositionCapabilities.Changed(m_compositionCapabilitiesChangedToken);
00353     }
00354
00355     if (m_uiSettings)
00356     {
00357         m_uiSettings.AdvancedEffectsEnabledChanged(m_advancedEffectsEnabledChangedToken);
00358     }
00359 }
00360
00361 void MaterialHelper::OnEnergySaverStatusChanged(const winrt::IInspectable& /*sender*/, const winrt::IInspectable& /*args*/)
00362 {
00363     UpdatePolicyStatus();
00364 }
00365
00366 void MaterialHelper::OnCompositionCapabilitiesChanged(const winrt::CompositionCapabilities& /*sender*/, const winrt::IInspectable& /*args*/)
00367 {
00368     UpdatePolicyStatus();
00369 }
00370
00371 void MaterialHelper::OnUISettingsChanged(const winrt::UISettings& /*sender*/, const winrt::IInspectable& /*args*/)
00372 {
00373     UpdatePolicyStatus();
00374 }
00375
00376 // If plateau scale changed (eg by moving between different res screens in multimon),
00377 // reload the noise surface to prevent noise from being scaled
00378 void MaterialHelper::OnDpiChanged(const winrt::IInspectable& sender, const winrt::IInspectable& /*args*/)
00379 {
00380     const auto previousLogicalDpi = m_logicalDpi;
00381
00382     try
00383     {
00384         m_logicalDpi = (sender.as<winrt::DisplayInformation>()).LogicalDpi();
00385     }
00386     catch (winrt::hresult_error)
00387     {
00388         // Watson Bugs 12990478 and 13071055 suggest CDisplayInformation::get_LogicalDpi can fail with
00389         // 0x80070578 : ERROR_INVALID_WINDOW_HANDLE  if the current view  is somehow not available.
00390         // This likely means the view has been closed and its logical DPI is no longer relevant.
00391         // Ignore the error and do not notify subscriber materials in this case.
00392
00393         // TODO: Consider adding below assert to get data on whether we are swallowing other errors here.
00394         //MUX_ASSERT(e.to_abi() == ERROR_INVALID_WINDOW_HANDLE);
00395     }
00396
00397     // We also get here in case of (logical) Resolution change, ignore that case
00398     if (previousLogicalDpi != m_logicalDpi)
00399     {
00400         ResetNoise();
00401         auto strongThis = get_strong();
00402         m_noiseChangedListeners(strongThis);
00403     }
00404 }
00405
00406 void MaterialHelper::UpdatePolicyStatus(bool onUIThread)
00407 {
00408     auto strongThis = get_strong();
00409     auto callback = [strongThis, this]() {
00410         const bool isEnergySaverMode = m_energySaverStatusChangedRevokerValid ? winrt::PowerManager::EnergySaverStatus() == winrt::EnergySaverStatus::On : true;
00411         const bool areEffectsFast = m_compositionCapabilities ? (m_compositionCapabilities.AreEffectsFast() || m_ignoreAreEffectsFast) : false;
00412
00413         // We are hitting an issue in Photos where UISettings::AdvancedEffectsEnabled is returning RPC_E_WRONG_THREAD.
00414         // We work around this issue by;
00415         //   1. Use a fresh instance of UISettings instead of the cached m_uiSettings.
00416         //   2. Ignore RPC_E_WRONG_THREAD and use a fallback value.
00417         bool advancedEffectsEnabled = false;
00418         try
00419         {
00420             winrt::UISettings uiSettings;
00421             advancedEffectsEnabled = uiSettings.AdvancedEffectsEnabled();
00422         }
00423         catch (winrt::hresult_error e)
00424         {
00425             if (e.to_abi() != RPC_E_WRONG_THREAD) { throw; }
00426         }
00427
00428         bool isDisabledByPolicy = m_simulateDisabledByPolicy || (isEnergySaverMode || !areEffectsFast || !advancedEffectsEnabled);
00429
00430         if (m_isDisabledByMaterialPolicy != isDisabledByPolicy)
00431         {
00432             m_isDisabledByMaterialPolicy = isDisabledByPolicy;
00433             m_policyChangedListeners(strongThis, m_isDisabledByMaterialPolicy);
00434         }
00435     };
00436
00437     if (onUIThread)
00438     {
00439         callback();
00440     }
00441     else
00442     {
00443         if (m_dispatcherQueue) // We might have no dispatcher in XamlPresenter scenarios, in this case we will always be in the disabled state.
00444         {
00445             if (m_dispatcherQueue.HasThreadAccess())
00446             {
00447                 callback();
00448             }
00449             else
00450             {
00451                 m_dispatcherQueue.TryEnqueue(callback);
00452             }
00453         }
00454     }
00455 }
00456
00457 void MaterialHelper::ResetNoise()
00458 {
00459     if (m_noiseSurface)
00460     {
00461         m_noiseSurface.Close();
00462         m_noiseSurface = nullptr;
00463     }
00464
00465     if (m_noiseBrush)
00466     {
00467         m_noiseBrush.Close();
00468         m_noiseBrush = nullptr;
00469     }
00470 }
00471
00472 /* static */
00473 winrt::CompositionSurfaceBrush MaterialHelper::GetNoiseBrush()
00474 {
00475     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00476     return instance->GetNoiseBrushImpl();
00477 }
00478
00479 winrt::CompositionSurfaceBrush MaterialHelper::GetNoiseBrushImpl()
00480 {
00481     if (!m_noiseBrush)
00482     {
00483         int resScaleInt = 100; // maps to winrt::ResolutionScale::Scale100Percent;
00484
00485         if (winrt::CoreWindow::GetForCurrentThread())
00486         {
00487             try
00488             {
00489                 winrt::ResolutionScale resScale{ winrt::DisplayInformation::GetForCurrentView().ResolutionScale() };
00490                 if (resScale != winrt::ResolutionScale::Invalid)
00491                 {
00492                     resScaleInt = static_cast<int>(resScale);
00493                 }
00494                 else
00495                 {
00496                     MUX_ASSERT_MSG(false, "Could not get ResolutionScale for display.");
00497                 }
00498             }
00499             catch (const winrt::hresult_error&)
00500             {
00501                 // Calling GetForCurrentView on threads without a CoreWindow throws an error. This comes up in places like LogonUI.
00502                 // Assume 1.0 scaling and don't touch the noise brush.
00503                 // Assuming 1.0 scaling isn't correct. Xaml has internal code that handles XamlPresenter scenarios, but that isn't available through public APIs. We can fix this for WUXC but not MUX.
00504             }
00505         }
00506
00507         m_noiseBrush = CreateScaledBrush(resScaleInt);
00508     }
00509
00510     return m_noiseBrush;
00511 }
00512
00513 // On RS2, we could be waiting for deferred noise recreation via OnVisibilityChanged.
00514 // In this case, it's not safe yet to recreate the brush.
00515 /* static */
00516 bool MaterialHelper::RS2IsSafeToCreateNoise()
00517 {
00518     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00519     return !instance->m_wasWindowHidden && !instance->m_waitingForRenderingAfterBecomingVisible;
00520 }
00521
00522 /* static */
00523 void MaterialHelper::SetShouldBeginAttachingLights(bool shouldBeginAttachingLights)
00524 {
00525     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00526     instance->m_shouldBeginAttachingLights = shouldBeginAttachingLights;
00527 }
00528
00529 /* static */
00530 bool MaterialHelper::ShouldBeginAttachingLights()
00531 {
00532     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00533     return instance->m_shouldBeginAttachingLights;
00534 }
00535
00536 /* static */
00537 void MaterialHelper::SetShouldContinueAttachingLights(bool shouldContinueAttachingLights)
00538 {
00539     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00540     instance->m_shouldContinueAttachingLights = shouldContinueAttachingLights;
00541 }
00542
00543 /* static */
00544 bool MaterialHelper::ShouldContinueAttachingLights()
00545 {
00546     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00547     return instance->m_shouldContinueAttachingLights;
00548 }
00549
00550 /* static */
00551 void MaterialHelper::ResetFailedToAttachLightsCount()
00552 {
00553     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00554     instance->m_failedToAttachLightsCount = 0;
00555 }
00556
00557 /* static */
00558 bool MaterialHelper::IncrementAndCheckFailedToAttachLightsCount()
00559 {
00560     auto instance = LifetimeHandler::GetMaterialHelperInstance();
00561     instance->m_failedToAttachLightsCount++;
00562     return instance->FailedToAttachLights();
00563 }
00564
00565 bool MaterialHelper::FailedToAttachLights()
00566 {
00567     return m_failedToAttachLightsCount > sc_maxFailedToAttachLightsCount;
00568 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ViewManager.h Source File

  • Repeater

ViewManager.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "UniqueIdElementPool.h"
00007 #include "VirtualizationInfo.h"
00008 #include "Phaser.h"
00009
00010 class ItemsRepeater;
00011
00012 // Manages elements on behalf of ItemsRepeater.
00013 // ViewManager automatically pins focused elements.
00014 class ViewManager final
00015 {
00016 public:
00017     ViewManager(ItemsRepeater* owner);
00018
00019     winrt::UIElement GetElement(int index, bool forceCreate, bool suppressAutoRecycle);
00020     void ClearElement(const winrt::UIElement& element, bool isClearedDueToCollectionChange);
00021     void ClearElementToElementFactory(const winrt::UIElement& element);
00022     int GetElementIndex(const winrt::com_ptr<VirtualizationInfo>& virtInfo);
00023
00024     void PrunePinnedElements();
00025     void UpdatePin(const winrt::UIElement& element, bool addPin);
00026
00027     void OnItemsSourceChanged(const winrt::IInspectable& source, const winrt::NotifyCollectionChangedEventArgs& args);
00028     void OnLayoutChanging();
00029     void OnOwnerArranged();
00030
00031 private:
00032 #pragma region GetElement providers
00033
00034     winrt::UIElement GetElementIfAlreadyHeldByLayout(int index);
00035     winrt::UIElement GetElementFromUniqueIdResetPool(int index);
00036     winrt::UIElement GetElementFromPinnedElements(int index);
00037     winrt::UIElement GetElementFromElementFactory(int index);
00038
00039 #pragma endregion
00040
00041 #pragma region RecycleElement handlers
00042
00043     bool ClearElementToUniqueIdResetPool(const winrt::UIElement& element, const winrt::com_ptr<VirtualizationInfo>& virtInfo);
00044     bool ClearElementToAnimator(const winrt::UIElement& element, const winrt::com_ptr<VirtualizationInfo>& virtInfo);
00045     bool ClearElementToPinnedPool(const winrt::UIElement& element, const winrt::com_ptr<VirtualizationInfo>& virtInfo, bool isClearedDueToCollectionChange);
00046
00047 #pragma endregion
00048
00049     void UpdateFocusedElement();
00050     void OnFocusChanged(const winrt::IInspectable& sender, const winrt::RoutedEventArgs& args);
00051     void MoveFocusFromClearedIndex(int clearedIndex);
00052     winrt::Control FindFocusCandidate(int clearedIndex, winrt::UIElement& focusedChild);
00053
00054     void EnsureEventSubscriptions();
00055
00056     void UpdateElementIndex(const winrt::UIElement& element, const winrt::com_ptr<VirtualizationInfo>& virtInfo, int index);
00057
00058     void InvalidateRealizedIndicesHeldByLayout();
00059     void EnsureFirstLastRealizedIndices();
00060
00061     struct PinnedElementInfo
00062     {
00063         PinnedElementInfo(const ITrackerHandleManager* owner, const winrt::UIElement& element);
00064
00065         winrt::UIElement PinnedElement() const { return m_pinnedElement.get(); }
00066         winrt::com_ptr<VirtualizationInfo> VirtualizationInfo() const { return m_virtInfo.get(); }
00067
00068     private:
00069         tracker_ref<winrt::UIElement> m_pinnedElement;
00070
00071         // We hold on VirtualizationInfo to make sure we can
00072         // quickly access its content rather than go through
00073         // ItemsRepeater.GetVirtualizationInfo(element) which is
00074         // slower (assuming it's implemented using attached
00075         // properties).
00076         tracker_com_ref<::VirtualizationInfo> m_virtInfo;
00077     };
00078
00079     ItemsRepeater* m_owner{ nullptr };
00080
00081     // Pinned elements that are currently owned by layout are *NOT* in this pool.
00082     std::vector<PinnedElementInfo> m_pinnedPool;
00083     UniqueIdElementPool m_resetPool;
00084
00085     // _lastFocusedElement is listed in _pinnedPool.
00086     // It has to be an element we own (i.e. a direct child).
00087     tracker_ref<winrt::UIElement> m_lastFocusedElement;
00088     bool m_isDataSourceStableResetPending{};
00089
00090     // Event tokens
00091     winrt::UIElement::GotFocus_revoker m_gotFocus{};
00092     winrt::UIElement::LostFocus_revoker m_lostFocus{};
00093
00094     ::Phaser m_phaser;
00095
00096     // Cached generate/clear contexts to avoid cost of creation every time.
00097     tracker_ref<winrt::Microsoft::UI::Xaml::ElementFactoryGetArgs> m_ElementFactoryGetArgs;
00098     tracker_ref<winrt::Microsoft::UI::Xaml::ElementFactoryRecycleArgs> m_ElementFactoryRecycleArgs;
00099
00100     // These are first/last indices requested by layout and not cleared yet.
00101     // These are also not truly first / last because they are a lower / upper bound on the known realized range.
00102     // For example, if we didn't have the optimization in ElementManager.cpp, m_lastRealizedElementIndexHeldByLayout
00103     // will not be accurate. Rather, it will be an upper bound on what we think is the last realized index.
00104     int m_firstRealizedElementIndexHeldByLayout{ FirstRealizedElementIndexDefault };
00105     int m_lastRealizedElementIndexHeldByLayout{ LastRealizedElementIndexDefault };
00106     static constexpr int FirstRealizedElementIndexDefault = std::numeric_limits<int>::max();
00107     static constexpr int LastRealizedElementIndexDefault = std::numeric_limits<int>::min();
00108 };
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SnapPointSortPredicate Member List

This is the complete list of members for SnapPointSortPredicate, including all inherited members.
primary | SnapPointSortPredicate
secondary | SnapPointSortPredicate
tertiary | SnapPointSortPredicate
Generated on Sun Dec 1 2024 20:53:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

PullToRefreshHelperTestApi Member List

This is the complete list of members for PullToRefreshHelperTestApi, including all inherited members.
CreateRefreshInteractionRatioChangedEventArgsInstance(double value) | PullToRefreshHelperTestApi | [static]
CreateRefreshRequestedEventArgsInstance(winrt::Deferral const &handler) | PullToRefreshHelperTestApi | [static]
CreateRefreshStateChangedEventArgsInstance(winrt::RefreshVisualizerState const &oldValue, winrt::RefreshVisualizerState const &newValue) | PullToRefreshHelperTestApi | [static]
Generated on Sun Dec 1 2024 20:53:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorPickerSliderProperties Member List

This is the complete list of members for ColorPickerSliderProperties, including all inherited members.
ClearProperties() | ColorPickerSliderProperties | [static]
ColorChannel(winrt::ColorPickerHsvChannel const &value) | ColorPickerSliderProperties |
ColorChannel() | ColorPickerSliderProperties |
ColorChannelProperty() | ColorPickerSliderProperties | [inline, static]
ColorPickerSliderProperties() | ColorPickerSliderProperties |
EnsureProperties() | ColorPickerSliderProperties | [static]
s_ColorChannelProperty | ColorPickerSliderProperties | [static]
Generated on Sun Dec 1 2024 20:52:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

DialogWithNavView Member List

This is the complete list of members for DialogWithNavView, including all inherited members.
ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) | DialogWithNavView | [inline, private]
ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) | DialogWithNavView | [inline, private]
DialogWithNavView() | DialogWithNavView | [inline]
Generated on Sun Dec 1 2024 20:54:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RadioButtonsTestHooks.properties.cpp Source File

  • Generated

RadioButtonsTestHooks.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RadioButtonsTestHooks.h"
00008
00009 namespace winrt::Microsoft::UI::Private::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(RadioButtonsTestHooks)
00012 }
00013
00014 #include "RadioButtonsTestHooks.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/Reveal/TestUI/RevealSimpleListPage.xaml.cs Source File

  • Materials
  • Reveal
  • TestUI

RevealSimpleListPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Linq;
00005 using Windows.UI;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Media;
00008 using Windows.UI.ViewManagement;
00009 using System.Collections.ObjectModel;
00010 using MUXControlsTestApp.Utilities;
00011 using Microsoft.UI.Dispatching;
00012
00013 namespace MUXControlsTestApp
00014 {
00015     public class RevealItem
00016     {
00017         public string Header;
00018         public string SubHeader;
00019         public string Icon;
00020     }
00021
00022     public sealed partial class RevealSimpleListPage : TestPage
00023     {
00024         bool accent;
00025         Color accentColor;
00026         UISettings settings = new UISettings();
00027         ObservableCollection<RevealItem> source = new ObservableCollection<RevealItem>();
00028
00029         public RevealSimpleListPage()
00030         {
00031             this.InitializeComponent();
00032
00033             source.Add(new RevealItem { Header = "System", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00034             source.Add(new RevealItem { Header = "Devices", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00035             source.Add(new RevealItem { Header = "Network & Internet", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00036             source.Add(new RevealItem { Header = "Personalization", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00037             source.Add(new RevealItem { Header = "Apps", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00038             source.Add(new RevealItem { Header = "Accounts", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00039             source.Add(new RevealItem { Header = "Time & Language", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00040             source.Add(new RevealItem { Header = "Gaming", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00041             source.Add(new RevealItem { Header = "Ease of Access", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00042             source.Add(new RevealItem { Header = "Privacy", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00043             source.Add(new RevealItem { Header = "Update & Security", SubHeader = "Display, notifications, power", Icon = "\uE105" });
00044
00045             RevealList.ItemsSource = source;
00046             this.accent = false;
00047
00048             settings.ColorValuesChanged += Settings_ColorValuesChanged;
00049
00050             StyleChooser_SelectionChanged(null, null);
00051         }
00052
00053         private void Settings_ColorValuesChanged(UISettings sender, object args)
00054         {
00055             var ignored = this.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Normal, OnColorValuesChanged);
00056         }
00057
00058         private void OnColorValuesChanged()
00059         {
00060             this.accentColor = this.settings.UIElementColor(Windows.UI.ViewManagement.UIElementType.Highlight);
00061             if (this.accent)
00062             {
00063                 RootCanvas.Background = new SolidColorBrush(this.accentColor);
00064             }
00065             else
00066             {
00067                 if (RequestedTheme == ElementTheme.Dark)
00068                     RootCanvas.Background = new SolidColorBrush(Microsoft.UI.Colors.Black);
00069                 else
00070                     RootCanvas.Background = new SolidColorBrush(Microsoft.UI.Colors.White);
00071             }
00072         }
00073
00074         private void BorderColorButton_Click(object sender, RoutedEventArgs e)
00075         {
00076             if (this.accent)
00077             {
00078                 this.accent = false;
00079             }
00080             else
00081             {
00082                 this.accent = true;
00083             }
00084             OnColorValuesChanged();
00085         }
00086
00087         private void BackgroundColorButton_Click(object sender, RoutedEventArgs e)
00088         {
00089             if (RequestedTheme == ElementTheme.Dark)
00090             {
00091                 RequestedTheme = ElementTheme.Light;
00092             }
00093             else
00094             {
00095                 RequestedTheme = ElementTheme.Dark;
00096             }
00097             OnColorValuesChanged();
00098         }
00099
00100         private void StyleChooser_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e)
00101         {
00102             if (RevealList != null)
00103             {
00104                 RevealList.ItemTemplate = (DataTemplate)Resources[(string)StyleChooser.SelectedItem];
00105                 RevealList.ItemContainerStyle = (Style)Resources[(string)RevealStyleChooser.SelectedItem];
00106             }
00107         }
00108     }
00109 }
Generated on Sun Dec 1 2024 20:52:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: dll/MUXControlsFactory.h Source File

  • dll

MUXControlsFactory.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "XamlMetadataProvider.h"
00007 #include "XamlControlsXamlMetaDataProvider.g.h"
00008
00009 class MUXControlsFactory :
00010     public winrt::factory_implementation::XamlControlsXamlMetaDataProviderT<MUXControlsFactory, XamlMetadataProvider>
00011 {
00012 public:
00013
00014     static void EnsureInitialized();
00015
00016     static void VerifyInitialized();
00017
00018     static bool IsInitialized()
00019     {
00020         return s_initialized;
00021     }
00022
00023     static void Deinitialize()
00024     {
00025         s_initialized = false;
00026     }
00027
00028 private:
00029     static bool s_initialized;
00030 };
00031
00032 namespace winrt::Microsoft::UI::Xaml::XamlTypeInfo
00033 {
00034     namespace factory_implementation { using XamlControlsXamlMetaDataProvider = MUXControlsFactory; }
00035     namespace implementation { using XamlControlsXamlMetaDataProvider = XamlMetadataProvider; }
00036 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MySelector Member List

This is the complete list of members for MySelector, including all inherited members.
SelectTemplateCore(object item) | MySelector | [inline, protected]
TemplateEven | MySelector |
TemplateOdd | MySelector |
Generated on Sun Dec 1 2024 20:54:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/RecyclePool.h Source File

  • Repeater

RecyclePool.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "RecyclePool.g.h"
00007
00008 // For MuxFinal builds we don't include RecyclePool in the WinMD
00009 // and we use custom definition of the dependency properties
00010 #ifdef MUX_PRERELEASE
00011 #include "RecyclePool.properties.h"
00012 #endif
00013
00014 class RecyclePool :
00015     public ReferenceTracker<RecyclePool, winrt::implementation::RecyclePoolT, winrt::composing>
00016 #ifdef MUX_PRERELEASE
00017     , public RecyclePoolProperties
00018 #endif
00019 {
00020 public:
00021     RecyclePool();
00022
00023 #ifndef MUX_PRERELEASE
00024     // We're using this runtime instance in a place that it might leak out and .NET Core gets upset when
00025     // it sees types not in the public surface area. Return object since no one needs to know the real type.
00026     hstring GetRuntimeClassName() const
00027     {
00028         return winrt::hstring_name_of<winrt::IInspectable>();
00029     }
00030 #endif
00031
00032 #pragma region IRecyclePool
00033     void PutElement(
00034         winrt::UIElement const& element,
00035         winrt::hstring const& key);
00036     void PutElement(
00037         winrt::UIElement const& element,
00038         winrt::hstring const& key,
00039         winrt::UIElement const& owner);
00040     winrt::UIElement TryGetElement(
00041         winrt::hstring const& key);
00042     winrt::UIElement TryGetElement(
00043         winrt::hstring const& key,
00044         winrt::UIElement const& owner);
00045 #pragma endregion
00046
00047 #pragma region IRecyclePoolOverrides
00048     void PutElementCore(
00049         winrt::UIElement const& element,
00050         winrt::hstring const& key,
00051         winrt::UIElement const& owner);
00052     winrt::UIElement TryGetElementCore(
00053         winrt::hstring const& key,
00054         winrt::UIElement const& owner);
00055 #pragma endregion
00056
00057 #pragma region IRecyclePoolStatics
00058     static winrt::DependencyProperty ReuseKeyProperty() { return s_reuseKeyProperty; }
00059     static winrt::hstring GetReuseKey(winrt::UIElement const& element);
00060     static void SetReuseKey(winrt::UIElement const& element, winrt::hstring const& value);
00061
00062 #ifndef MUX_PRERELEASE
00063     static winrt::DependencyProperty PoolInstanceProperty() { return s_PoolInstanceProperty; }
00064 #endif
00065     static winrt::RecyclePool GetPoolInstance(winrt::DataTemplate const& dataTemplate);
00066     static void SetPoolInstance(winrt::DataTemplate const& dataTemplate, winrt::RecyclePool const& recyclePool);
00067 #pragma endregion
00068
00069     static void EnsureProperties();
00070     static void ClearProperties();
00071
00072     /* internal */
00073     static winrt::DataTemplate GetOriginTemplate(winrt::UIElement const& element);
00074     static void SetOriginTemplate(winrt::UIElement const& element, winrt::DataTemplate const& value);
00075
00076 private:
00077 #ifndef MUX_PRERELEASE
00078     static GlobalDependencyProperty s_PoolInstanceProperty;
00079 #endif
00080     static GlobalDependencyProperty s_reuseKeyProperty;
00081     static GlobalDependencyProperty s_originTemplateProperty;
00082
00083     winrt::Panel EnsureOwnerIsPanelOrNull(const winrt::UIElement& owner);
00084
00085     struct ElementInfo
00086     {
00087         ElementInfo(const ITrackerHandleManager* refManager, const winrt::UIElement& element, const winrt::Panel& owner)
00088             :m_element(refManager, element), m_owner(refManager, owner) {}
00089
00090         winrt::UIElement Element() const { return m_element.get(); };
00091         winrt::Panel Owner() const { return m_owner.get(); };
00092
00093     private:
00094         tracker_ref<winrt::UIElement> m_element;
00095         tracker_ref<winrt::Panel> m_owner;
00096     };
00097
00098     std::map<winrt::hstring /*key*/, std::vector<ElementInfo>> m_elements;
00099 };
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/NestedLayoutSamples/LayoutHelper.cs Source File

  • Repeater
  • TestUI
  • Samples
  • NestedLayoutSamples

LayoutHelper.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml.Controls;
00006
00007 namespace MUXControlsTestApp.Samples
00008 {
00009     public static class LayoutHelper
00010     {
00011         public static void SetMaxRowsOrColumns(Layout layout, int value)
00012         {
00013             if (layout is UniformGridLayout)
00014             {
00015                 ((UniformGridLayout)layout).MaximumRowsOrColumns = value;
00016             }
00017         }
00018
00019         public static void SetMinRowSpacing(Layout layout, double value)
00020         {
00021             if (layout is UniformGridLayout)
00022             {
00023                 ((UniformGridLayout)layout).MinRowSpacing = value;
00024             }
00025             else if (layout is FlowLayout)
00026             {
00027                 ((FlowLayout)layout).MinRowSpacing = value;
00028             }
00029             else if (layout is StackLayout)
00030             {
00031                 // no-op
00032             }
00033         }
00034
00035         public static void SetMinColumnSpacing(Layout layout, double value)
00036         {
00037             if (layout is UniformGridLayout)
00038             {
00039                 ((UniformGridLayout)layout).MinColumnSpacing = value;
00040             }
00041             else if (layout is FlowLayout)
00042             {
00043                 ((FlowLayout)layout).MinColumnSpacing = value;
00044             }
00045             else if (layout is StackLayout)
00046             {
00047                 ((StackLayout)layout).Spacing = value;
00048             }
00049         }
00050
00051         public static void SetLineAlignment(Layout layout, string value)
00052         {
00053             if (layout is UniformGridLayout)
00054             {
00055                 var alignment = (UniformGridLayoutItemsJustification)Enum.Parse(typeof(UniformGridLayoutItemsJustification), value);
00056                 ((UniformGridLayout)layout).ItemsJustification = alignment;
00057             }
00058             else if (layout is FlowLayout)
00059             {
00060                 var alignment = (FlowLayoutLineAlignment)Enum.Parse(typeof(FlowLayoutLineAlignment), value);
00061                 ((FlowLayout)layout).LineAlignment = alignment;
00062             }
00063             else if (layout is StackLayout)
00064             {
00065                 // no-op
00066             }
00067         }
00068
00069         public static void SetItemsStretch(Layout layout, string value)
00070         {
00071             if (layout is UniformGridLayout)
00072             {
00073                 var stretch = (UniformGridLayoutItemsStretch)Enum.Parse(typeof(UniformGridLayoutItemsStretch), value);
00074                 ((UniformGridLayout)layout).ItemsStretch = stretch;
00075             }
00076             else
00077             {
00078                 // no-op
00079             }
00080         }
00081     }
00082 }
Generated on Sun Dec 1 2024 20:52:10 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/VirtualizingLayoutContext.cpp Source File

  • Repeater

VirtualizingLayoutContext.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include <pch.h>
00005 #include <common.h>
00006 #include "ItemsRepeater.common.h"
00007 #include "VirtualizingLayoutContext.h"
00008 #include "VirtualLayoutContextAdapter.h"
00009
00010 #include "VirtualizingLayoutContext.properties.cpp"
00011
00012 #pragma region IVirtualizingLayoutContext
00013
00014 int32_t VirtualizingLayoutContext::ItemCount()
00015 {
00016     return overridable().ItemCountCore();
00017 }
00018
00019 winrt::IInspectable VirtualizingLayoutContext::GetItemAt(int index)
00020 {
00021     return overridable().GetItemAtCore(index);
00022 }
00023
00024 winrt::UIElement VirtualizingLayoutContext::GetOrCreateElementAt(int index)
00025 {
00026     // Calling this way because GetOrCreateElementAtCore is ambiguous.
00027     // Use .as instead of try_as because try_as uses non-delegating inner and we need to call the outer for overrides.
00028     return get_strong().as<winrt::IVirtualizingLayoutContextOverrides>().GetOrCreateElementAtCore(index, winrt::ElementRealizationOptions::None);
00029 }
00030
00031 winrt::UIElement VirtualizingLayoutContext::GetOrCreateElementAt(int index, winrt::ElementRealizationOptions const& options)
00032 {
00033     // Calling this way because GetOrCreateElementAtCore is ambiguous.
00034     // Use .as instead of try_as because try_as uses non-delegating inner and we need to call the outer for overrides.
00035     return get_strong().as<winrt::IVirtualizingLayoutContextOverrides>().GetOrCreateElementAtCore(index, options);
00036 }
00037
00038 void VirtualizingLayoutContext::RecycleElement(winrt::UIElement const& element)
00039 {
00040     overridable().RecycleElementCore(element);
00041 }
00042
00043 winrt::Rect VirtualizingLayoutContext::VisibleRect()
00044 {
00045     return overridable().VisibleRectCore();
00046 }
00047
00048 winrt::Rect VirtualizingLayoutContext::RealizationRect()
00049 {
00050     return overridable().RealizationRectCore();
00051 }
00052
00053 int32_t VirtualizingLayoutContext::RecommendedAnchorIndex()
00054 {
00055     return overridable().RecommendedAnchorIndexCore();
00056 }
00057
00058 winrt::Point VirtualizingLayoutContext::LayoutOrigin()
00059 {
00060     return overridable().LayoutOriginCore();
00061 }
00062
00063 void VirtualizingLayoutContext::LayoutOrigin(winrt::Point const& value)
00064 {
00065     overridable().LayoutOriginCore(value);
00066 }
00067
00068 #pragma endregion
00069
00070 #pragma region IVirtualizingLayoutContextOverrides
00071
00072 winrt::IInspectable VirtualizingLayoutContext::GetItemAtCore(int /*index*/)
00073 {
00074     throw winrt::hresult_not_implemented();
00075 }
00076
00077 winrt::UIElement VirtualizingLayoutContext::GetOrCreateElementAtCore(int /*index*/, winrt::ElementRealizationOptions const& /* options */)
00078 {
00079     throw winrt::hresult_not_implemented();
00080 }
00081
00082 void VirtualizingLayoutContext::RecycleElementCore(winrt::UIElement const& /*element*/)
00083 {
00084     throw winrt::hresult_not_implemented();
00085 }
00086
00087 winrt::Rect VirtualizingLayoutContext::VisibleRectCore()
00088 {
00089     throw winrt::hresult_not_implemented();
00090 }
00091
00092 winrt::Rect VirtualizingLayoutContext::RealizationRectCore()
00093 {
00094     throw winrt::hresult_not_implemented();
00095 }
00096
00097 int32_t VirtualizingLayoutContext::RecommendedAnchorIndexCore()
00098 {
00099     throw winrt::hresult_not_implemented();
00100 }
00101
00102 winrt::Point VirtualizingLayoutContext::LayoutOriginCore()
00103 {
00104     throw winrt::hresult_not_implemented();
00105 }
00106
00107 void VirtualizingLayoutContext::LayoutOriginCore(winrt::Point const& /*value*/)
00108 {
00109     throw winrt::hresult_not_implemented();
00110 }
00111
00112 int32_t VirtualizingLayoutContext::ItemCountCore()
00113 {
00114     throw winrt::hresult_not_implemented();
00115 }
00116
00117 #pragma endregion
00118
00119 winrt::NonVirtualizingLayoutContext VirtualizingLayoutContext::GetNonVirtualizingContextAdapter()
00120 {
00121     if (!m_contextAdapter)
00122     {
00123         m_contextAdapter = winrt::make<VirtualLayoutContextAdapter>(get_strong().as<winrt::VirtualizingLayoutContext>());
00124     }
00125
00126     return m_contextAdapter;
00127 }
Generated on Sun Dec 1 2024 20:52:12 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollPresenter/OffsetsChange.h Source File

  • ScrollPresenter

OffsetsChange.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ViewChange.h"
00007
00008 class OffsetsChange : public ViewChange
00009 {
00010 public:
00011     OffsetsChange(
00012         double zoomedHorizontalOffset,
00013         double zoomedVerticalOffset,
00014         ScrollPresenterViewKind offsetsKind,
00015         winrt::IInspectable const& options);
00016     ~OffsetsChange();
00017
00018     double ZoomedHorizontalOffset() const
00019     {
00020         return m_zoomedHorizontalOffset;
00021     }
00022
00023     double ZoomedVerticalOffset() const
00024     {
00025         return m_zoomedVerticalOffset;
00026     }
00027
00028     void ZoomedHorizontalOffset(double zoomedHorizontalOffset);
00029     void ZoomedVerticalOffset(double zoomedVerticalOffset);
00030
00031 private:
00032     double m_zoomedHorizontalOffset{};
00033     double m_zoomedVerticalOffset{};
00034 };
00035
Generated on Sun Dec 1 2024 20:52:13 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SplitButtonTests Member List

This is the complete list of members for SplitButtonTests, including all inherited members.
VerifyDefaultsAndBasicSetting() | SplitButtonTests | [inline]
VerifyIsCheckedProperty() | SplitButtonTests | [inline]
Generated on Sun Dec 1 2024 20:53:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/InspectingDataSourceTests.cs Source File

  • Repeater
  • APITests

InspectingDataSourceTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common;
00005 using MUXControlsTestApp.Utilities;
00006 using System.Collections;
00007 using System.Collections.Generic;
00008 using System.Collections.ObjectModel;
00009 using System.Collections.Specialized;
00010 using System.Linq;
00011 using Windows.Foundation.Collections;
00012 using Common;
00013 using System;
00014 using Microsoft.UI.Xaml.Controls;
00015 using MUXControlsTestApp.Utils;
00016
00017 using WEX.TestExecution;
00018 using WEX.TestExecution.Markup;
00019 using WEX.Logging.Interop;
00020
00021 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests
00022 {
00023
00024     [TestClass]
00025     public class InspectingDataSourceTests : ApiTestBase
00026     {
00027         [TestMethod]
00028         public void CanCreateFromIBindableIterable()
00029         {
00030             RunOnUIThread.Execute(() =>
00031             {
00032                 var dataSource = new ItemsSourceView(Enumerable.Range(0, 100));
00033                 Verify.AreEqual(100, dataSource.Count);
00034                 Verify.AreEqual(4, dataSource.GetAt(4));
00035             });
00036         }
00037
00038         //[TestMethod] 24022837
00039         public void CanCreateFromInccIBindableVector()
00040         {
00041             RunOnUIThread.Execute(() =>
00042             {
00043                 var data = new ObservableCollection<string>(Enumerable.Range(0, 100).Select(i => string.Format("Item #{0}", i)));
00044                 var dataSource = new ItemsSourceView(data);
00045                 var recorder = new CollectionChangeRecorder(dataSource);
00046                 Verify.AreEqual(100, dataSource.Count);
00047                 Verify.AreEqual("Item #4", (string)dataSource.GetAt(4));
00048
00049                 data.Insert(4, "Inserted Item");
00050                 data.RemoveAt(7);
00051                 data[15] = "Replaced Item";
00052                 data.Clear();
00053
00054                 VerifyRecordedCollectionChanges(
00055                     expected: new NotifyCollectionChangedEventArgs[]
00056                     {
00057                         CollectionChangeEventArgsConverters.CreateNotifyArgs(NotifyCollectionChangedAction.Add, -1, 0, 4, 1),
00058                         CollectionChangeEventArgsConverters.CreateNotifyArgs(NotifyCollectionChangedAction.Remove, 7, 1, -1, 0),
00059                         CollectionChangeEventArgsConverters.CreateNotifyArgs(NotifyCollectionChangedAction.Replace, 15, 1, 15, 1),
00060                         CollectionChangeEventArgsConverters.CreateNotifyArgs(NotifyCollectionChangedAction.Reset, -1, 0, -1, 0)
00061                     },
00062                     actual: recorder.RecordedArgs);
00063             });
00064         }
00065
00066         [TestMethod]
00067         [TestProperty("Ignore", "True")] // TODO 33571470: MUXC desktop disabled test: CanCreateFromIObservableVector
00068         public void CanCreateFromIObservableVector()
00069         {
00070             RunOnUIThread.Execute(() =>
00071             {
00072                 var data = new WinRTObservableVector(Enumerable.Range(0, 100).Select(i => string.Format("Item #{0}", i)));
00073                 var dataSource = new ItemsSourceView(data);
00074                 var recorder = new CollectionChangeRecorder(dataSource);
00075                 Verify.AreEqual(100, dataSource.Count);
00076                 Verify.AreEqual("Item #4", (string)dataSource.GetAt(4));
00077                 Verify.IsFalse(dataSource.HasKeyIndexMapping);
00078
00079                 data.Insert(4, "Inserted Item");
00080                 data.RemoveAt(7);
00081                 data[15] = "Replaced Item";
00082                 data.Clear();
00083
00084                 VerifyRecordedCollectionChanges(
00085                     expected: new NotifyCollectionChangedEventArgs[]
00086                     {
00087                      CollectionChangeEventArgsConverters.CreateNotifyArgs(NotifyCollectionChangedAction.Add, -1, 0, 4, 1),
00088                      CollectionChangeEventArgsConverters.CreateNotifyArgs(NotifyCollectionChangedAction.Remove, 7, 1, -1, 0),
00089                      CollectionChangeEventArgsConverters.CreateNotifyArgs(NotifyCollectionChangedAction.Replace, 15, 1, 15, 1),
00090                      CollectionChangeEventArgsConverters.CreateNotifyArgs(NotifyCollectionChangedAction.Reset, -1, 0, -1, 0),
00091                     },
00092                     actual: recorder.RecordedArgs);
00093             });
00094         }
00095
00096         [TestMethod]
00097         public void VerifyUniqueIdMappingInterface()
00098         {
00099             RunOnUIThread.Execute(() =>
00100             {
00101                 var data = new ObservableVectorWithUniqueIds(Enumerable.Range(0, 10));
00102                 var dataSource = new ItemsSourceView(data);
00103                 Verify.AreEqual(10, dataSource.Count);
00104                 Verify.AreEqual(true, dataSource.HasKeyIndexMapping);
00105                 Verify.AreEqual(5, dataSource.IndexFromKey("5"));
00106                 Verify.AreEqual("5", dataSource.KeyFromIndex(5));
00107             });
00108         }
00109
00110         [TestMethod]
00111         public void VerifyIndexOfBehavior()
00112         {
00113             RunOnUIThread.Execute(() =>
00114             {
00115                 var collections = new List<IEnumerable>();
00116                 collections.Add(new ObservableVectorWithUniqueIds(Enumerable.Range(0, 10)));
00117                 collections.Add(new ObservableCollection<int>(Enumerable.Range(0,10)));
00118
00119                 foreach(var collection in collections)
00120                 {
00121                     var dataSource = new ItemsSourceView(collection);
00122                     foreach(int i in collection)
00123                     {
00124                         Verify.AreEqual(i, dataSource.IndexOf(i));
00125                     }
00126
00127                     Verify.AreEqual(-1, dataSource.IndexOf(11));
00128                 }
00129
00130                 // Enumerabl.Range returns IEnumerable which does not provide IndexOf
00131                 var testingItemsSourceView = new ItemsSourceView(Enumerable.Range(0, 10));
00132                 var index = -1;
00133                 try
00134                 {
00135                     index = testingItemsSourceView.IndexOf(0);
00136                 }catch(Exception){ }
00137                 Verify.AreEqual(-1, index);
00138
00139
00140                 var nullContainingEnumerable = new CustomEnumerable();
00141                 testingItemsSourceView = new ItemsSourceView(nullContainingEnumerable);
00142
00143                 Verify.AreEqual(1,testingItemsSourceView.IndexOf(null));
00144
00145             });
00146         }
00147
00148         // Calling Reset multiple times before layout runs causes a crash
00149         // in unique ids. We end up thinking we have multiple elements with the same id.
00150         #if MUX_PRERELEASE // 35797846
00151         [TestMethod]
00152         #endif
00153         public void VerifyCallingResetMultipleTimesOnUniqueIdItemsSource()
00154         {
00155             RunOnUIThread.Execute(() =>
00156             {
00157                 var data = new CustomItemsSourceWithUniqueId(Enumerable.Range(0, 5).ToList());
00158                 var repeater = new ItemsRepeater()
00159                 {
00160                     ItemsSource = data,
00161                     ItemTransitionProvider = new DefaultItemCollectionTransitionProvider()
00162                 };
00163
00164                 Content = new Microsoft.UI.Xaml.Controls.ScrollViewer()
00165                 {
00166                     Width=400,
00167                     Height=400,
00168                     Content = repeater
00169                 };
00170                 Content.UpdateLayout();
00171
00172                 data.Reset();
00173                 data.Reset();
00174
00175                 Content.UpdateLayout();
00176
00177                 Verify.AreEqual(5, repeater.ItemsSourceView.Count);
00178                 for(int i=0; i< 5; i++)
00179                 {
00180                     Verify.IsNotNull(repeater.TryGetElement(i));
00181                 }
00182             });
00183         }
00184
00185         [TestMethod]
00186         public void ValidateSwitchingItemsSourceRefreshesElementsNonVirtualLayout()
00187         {
00188             ValidateSwitchingItemsSourceRefreshesElements(isVirtualLayout: false);
00189         }
00190
00191         [TestMethod]
00192         public void ValidateSwitchingItemsSourceRefreshesElementsVirtualLayout()
00193         {
00194             ValidateSwitchingItemsSourceRefreshesElements(isVirtualLayout: true);
00195         }
00196
00197         [TestMethod]
00198         [TestProperty("Ignore", "True")] // TODO 31348426: Re-enable when fixed.
00199         public void VerifyReadOnlyListCompatibility()
00200         {
00201             RunOnUIThread.Execute(() =>
00202             {
00203                 var collection = new ReadOnlyNotifyPropertyChangedCollection<object>();
00204                 var firstItem = "something1";
00205
00206                 collection.Data = new ObservableCollection<object>();
00207
00208                 collection.Data.Add(firstItem);
00209                 collection.Data.Add("something2");
00210                 collection.Data.Add("something3");
00211
00212                 var itemsSourceView = new ItemsSourceView(collection);
00213                 Verify.AreEqual(3, itemsSourceView.Count);
00214
00215                 collection.Data.Add("something4");
00216                 Verify.AreEqual(4, itemsSourceView.Count);
00217
00218                 Verify.AreEqual(firstItem,itemsSourceView.GetAt(0));
00219                 Verify.AreEqual(0, itemsSourceView.IndexOf(firstItem));
00220             });
00221         }
00222
00223         [TestMethod]
00224         [TestProperty("Ignore", "True")] // TODO 31348426: Re-enable when fixed.
00225         public void VerifyNotifyCollectionChangeWithReadonlyListBehavior()
00226         {
00227             int invocationCount = 0;
00228
00229             RunOnUIThread.Execute(() =>
00230             {
00231                 var collection = new ReadOnlyNotifyPropertyChangedCollection<object>();
00232
00233                 var itemsSourceView = new ItemsSourceView(collection);
00234                 itemsSourceView.CollectionChanged += ItemsSourceView_CollectionChanged;
00235
00236                 var underlyingData = new ObservableCollection<object>();
00237                 collection.Data = underlyingData;
00238
00239                 Verify.AreEqual(1, invocationCount);
00240             });
00241
00242             void ItemsSourceView_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
00243             {
00244                 invocationCount++;
00245             }
00246         }
00247
00248         public void ValidateSwitchingItemsSourceRefreshesElements(bool isVirtualLayout)
00249         {
00250             RunOnUIThread.Execute(() =>
00251             {
00252                 ItemsRepeater repeater = null;
00253                 const int numItems = 10;
00254
00255                 repeater = new ItemsRepeater() {
00256                     ItemsSource = Enumerable.Range(0, numItems),
00257                 };
00258
00259                 // By default we use stack layout that is virtualizing.
00260                 if (!isVirtualLayout)
00261                 {
00262                     repeater.Layout = new NonVirtualStackLayout();
00263                 }
00264
00265                 Content = new ItemsRepeaterScrollHost() {
00266                     Width = 400,
00267                     Height = 400,
00268                     ScrollViewer = new Microsoft.UI.Xaml.Controls.ScrollViewer() {
00269                         Content = repeater
00270                     }
00271                 };
00272
00273                 Content.UpdateLayout();
00274                 for (int i = 0; i < numItems; i++)
00275                 {
00276                     var element = (TextBlock)repeater.TryGetElement(i);
00277                     Verify.AreEqual(i.ToString(), element.Text);
00278                 }
00279
00280                 repeater.ItemsSource = Enumerable.Range(20, numItems);
00281                 Content.UpdateLayout();
00282
00283                 for (int i = 0; i < numItems; i++)
00284                 {
00285                     var element = (TextBlock)repeater.TryGetElement(i);
00286                     Verify.AreEqual((i + 20).ToString(), element.Text);
00287                 }
00288             });
00289         }
00290
00291         private static void VerifyRecordedCollectionChanges(NotifyCollectionChangedEventArgs[] expected, List<NotifyCollectionChangedEventArgs> actual)
00292         {
00293             Verify.AreEqual(expected.Length, actual.Count);
00294
00295             for (int i = 0; i < expected.Length; ++i)
00296             {
00297                 Verify.AreEqual(expected[i].Action, actual[i].Action);
00298                 Verify.AreEqual(expected[i].NewStartingIndex, actual[i].NewStartingIndex);
00299                 Verify.AreEqual(expected[i].OldStartingIndex, actual[i].OldStartingIndex);
00300                 Verify.AreEqual(GetCount(expected[i].NewItems), GetCount(actual[i].NewItems));
00301                 Verify.AreEqual(GetCount(expected[i].OldItems), GetCount(actual[i].OldItems));
00302             }
00303         }
00304
00305         private static int GetCount(IList vector)
00306         {
00307             return vector == null ? -1 : (int)vector.Count;
00308         }
00309
00310         class CollectionChangeRecorder
00311         {
00312             private List<NotifyCollectionChangedEventArgs> _recordedArgs = new List<NotifyCollectionChangedEventArgs>();
00313
00314             public List<NotifyCollectionChangedEventArgs> RecordedArgs { get { return _recordedArgs; } }
00315
00316             public CollectionChangeRecorder(ItemsSourceView source)
00317             {
00318                 source.CollectionChanged += (sender, args) => RecordedArgs.Add(Clone(args));
00319             }
00320
00321             private static NotifyCollectionChangedEventArgs Clone(NotifyCollectionChangedEventArgs args)
00322             {
00323                 return CollectionChangeEventArgsConverters.CreateNotifyArgs(
00324                     args.Action,
00325                     args.OldStartingIndex,
00326                     args.OldItems == null ? -1 : (int)args.OldItems.Count,
00327                     args.NewStartingIndex,
00328                     args.NewItems == null ? -1 : (int)args.NewItems.Count);
00329             }
00330         }
00331
00332         class WinRTObservableVector : IObservableVector<object>
00333         {
00334             private IList<object> _items;
00335
00336             public object this[int index]
00337             {
00338                 get { return _items[index]; }
00339                 set
00340                 {
00341                     _items[index] = value;
00342                     if (VectorChanged != null) { VectorChanged(this, new WinRTVectorChangedEventArgs(CollectionChange.ItemChanged, index)); }
00343                 }
00344             }
00345
00346             public int Count { get { return _items.Count; } }
00347
00348             public bool IsReadOnly { get { return false; } }
00349
00350             public event VectorChangedEventHandler<object> VectorChanged;
00351
00352             public WinRTObservableVector()
00353             {
00354                 _items = new List<object>();
00355             }
00356
00357             public WinRTObservableVector(IEnumerable<object> items)
00358             {
00359                 _items = new List<object>(items);
00360             }
00361
00362             public void Add(object item)
00363             {
00364                 _items.Add(item);
00365                 if (VectorChanged != null) { VectorChanged(this, new WinRTVectorChangedEventArgs(CollectionChange.ItemInserted, _items.Count - 1)); }
00366             }
00367
00368             public void Clear()
00369             {
00370                 _items.Clear();
00371                 if (VectorChanged != null) { VectorChanged(this, new WinRTVectorChangedEventArgs(CollectionChange.Reset, 0)); }
00372             }
00373
00374             public bool Contains(object item)
00375             {
00376                 return _items.Contains(item);
00377             }
00378
00379             public void CopyTo(object[] array, int arrayIndex)
00380             {
00381                 _items.CopyTo(array, arrayIndex);
00382             }
00383
00384             public IEnumerator<object> GetEnumerator()
00385             {
00386                 return _items.GetEnumerator();
00387             }
00388
00389             public int IndexOf(object item)
00390             {
00391                 return _items.IndexOf(item);
00392             }
00393
00394             public void Insert(int index, object item)
00395             {
00396                 _items.Insert(index, item);
00397                 if (VectorChanged != null) { VectorChanged(this, new WinRTVectorChangedEventArgs(CollectionChange.ItemInserted, index)); }
00398             }
00399
00400             public bool Remove(object item)
00401             {
00402                 RemoveAt(_items.IndexOf(item));
00403                 return true;
00404             }
00405
00406             public void RemoveAt(int index)
00407             {
00408                 _items.RemoveAt(index);
00409                 if (VectorChanged != null) { VectorChanged(this, new WinRTVectorChangedEventArgs(CollectionChange.ItemRemoved, index)); }
00410             }
00411
00412             IEnumerator IEnumerable.GetEnumerator()
00413             {
00414                 return _items.GetEnumerator();
00415             }
00416
00417             private class WinRTVectorChangedEventArgs : IVectorChangedEventArgs
00418             {
00419                 public CollectionChange CollectionChange { get; private set; }
00420
00421                 private uint _index;
00422                 public uint Index
00423                 {
00424                     get
00425                     {
00426                         if (CollectionChange == CollectionChange.Reset)
00427                         {
00428                             // C++/CX observable collection fails if accessing index
00429                             // when the args is for a Reset, so emulating that behavior here.
00430                             throw new InvalidOperationException();
00431                         }
00432
00433                         return _index;
00434                     }
00435
00436                     private set
00437                     {
00438                         _index = value;
00439                     }
00440                 }
00441
00442                 public WinRTVectorChangedEventArgs(CollectionChange change, int index)
00443                 {
00444                     CollectionChange = change;
00445                     Index = (uint)index;
00446                 }
00447             }
00448         }
00449
00450         class ObservableVectorWithUniqueIds : ObservableCollection<int>, IKeyIndexMapping
00451         {
00452             public ObservableVectorWithUniqueIds(IEnumerable<int> data) : base(data) { }
00453
00454             // Note: In real world scenarios the mapping would be based on the object,
00455             // but for testing purposes we can just use the index here.
00456             public string KeyFromIndex(int index)
00457             {
00458                 return index.ToString();
00459             }
00460
00461             public int IndexFromKey(string id)
00462             {
00463                 return int.Parse(id);
00464             }
00465         }
00466
00467         class CustomEnumerable : IEnumerable<object>
00468         {
00469             private List<string> myList = new List<string>();
00470
00471             public CustomEnumerable()
00472             {
00473                 myList.Add("text");
00474                 myList.Add(null);
00475                 myList.Add("foobar");
00476                 myList.Add("WinUI is awesome");
00477             }
00478
00479             public IEnumerator<object> GetEnumerator()
00480             {
00481                 return myList.GetEnumerator();
00482             }
00483
00484             IEnumerator IEnumerable.GetEnumerator()
00485             {
00486                 return myList.GetEnumerator();
00487             }
00488         }
00489     }
00490 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ViewportManager Member List

This is the complete list of members for ViewportManager, including all inherited members.
GetLayoutExtent() const =0 | ViewportManager | [pure virtual]
GetLayoutRealizationWindow() const =0 | ViewportManager | [pure virtual]
GetLayoutVisibleWindow() const =0 | ViewportManager | [pure virtual]
GetOrigin() const =0 | ViewportManager | [pure virtual]
HorizontalCacheLength() const =0 | ViewportManager | [pure virtual]
HorizontalCacheLength(double value)=0 | ViewportManager | [pure virtual]
MadeAnchor() const =0 | ViewportManager | [pure virtual]
OnBringIntoViewRequested(const winrt::BringIntoViewRequestedEventArgs &args)=0 | ViewportManager | [pure virtual]
OnElementCleared(const winrt::UIElement &element)=0 | ViewportManager | [pure virtual]
OnElementPrepared(const winrt::UIElement &element)=0 | ViewportManager | [pure virtual]
OnLayoutChanged(bool isVirtualizing)=0 | ViewportManager | [pure virtual]
OnMakeAnchor(const winrt::UIElement &anchor, const bool isAnchorOutsideRealizedRange)=0 | ViewportManager | [pure virtual]
OnOwnerArranged()=0 | ViewportManager | [pure virtual]
OnOwnerMeasuring()=0 | ViewportManager | [pure virtual]
ResetLayoutRealizationWindowCacheBuffer()=0 | ViewportManager | [pure virtual]
ResetScrollers()=0 | ViewportManager | [pure virtual]
SetLayoutExtent(const winrt::Rect &layoutExtent)=0 | ViewportManager | [pure virtual]
SuggestedAnchor() const =0 | ViewportManager | [pure virtual]
VerticalCacheLength() const =0 | ViewportManager | [pure virtual]
VerticalCacheLength(double value)=0 | ViewportManager | [pure virtual]
Generated on Sun Dec 1 2024 20:53:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

UnPremultiplyEffect Member List

This is the complete list of members for UnPremultiplyEffect, including all inherited members.
DECLARE_D2D_GUID(CLSID_D2D1UnPremultiply) | UnPremultiplyEffect
DECLARE_SINGLE_SOURCE(Source) | UnPremultiplyEffect
Generated on Sun Dec 1 2024 20:53:33 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemPresenterTemplateSettings.cpp Source File

  • NavigationView

NavigationViewItemPresenterTemplateSettings.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "NavigationViewItemPresenterTemplateSettings.h"
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewItemTemplatePage Member List

This is the complete list of members for NavigationViewItemTemplatePage, including all inherited members.
FlipOrientation_Click(object sender, RoutedEventArgs e) | NavigationViewItemTemplatePage | [inline, private]
NavigationViewItemTemplatePage() | NavigationViewItemTemplatePage | [inline]
NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) | NavigationViewItemTemplatePage | [inline, private]
NavView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args) | NavigationViewItemTemplatePage | [inline, private]
Generated on Sun Dec 1 2024 20:54:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NonVirtualStackLayout Member List

This is the complete list of members for NonVirtualStackLayout, including all inherited members.
ArrangeOverride(NonVirtualizingLayoutContext context, Size finalSize) | NonVirtualStackLayout | [inline, protected]
NonVirtualizingLayout::ArrangeOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &finalSize) | NonVirtualizingLayout | [virtual]
InitializeForContextCore(winrt::LayoutContext const &context) | NonVirtualizingLayout | [virtual]
MeasureOverride(NonVirtualizingLayoutContext context, Size availableSize) | NonVirtualStackLayout | [inline, protected]
NonVirtualizingLayout::MeasureOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &availableSize) | NonVirtualizingLayout | [virtual]
NonVirtualizingLayout() | NonVirtualizingLayout |
UninitializeForContextCore(winrt::LayoutContext const &context) | NonVirtualizingLayout | [virtual]
Generated on Sun Dec 1 2024 20:54:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/ListViewAnchoringPage.xaml.cs Source File

  • CommonStyles
  • TestUI

ListViewAnchoringPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005 using Microsoft.UI.Xaml.Controls;
00006 using Microsoft.UI.Xaml.Controls.Primitives;
00007 using Microsoft.UI.Xaml.Data;
00008 using Microsoft.UI.Xaml.Media;
00009 using System;
00010 using System.Collections.ObjectModel;
00011
00012 namespace MUXControlsTestApp
00013 {
00014     public sealed partial class ListViewAnchoringPage : TestPage
00015     {
00016         [Flags]
00017         private enum QueuedOperationType
00018         {
00019             None = 0,
00020             PageShrinkSize = 1,
00021             SourceInsertItem = 2,
00022             SourceAppendItem = 4,
00023             SourceRemoveFirstItem = 8,
00024             SourceRemoveLastItem = 16
00025         }
00026
00027         private GroupedListViewBaseViewModel _groupedListViewBaseViewModel;
00028         private CollectionViewSource _cvs;
00029         private ItemsPanelTemplate _itemsStackPanelTemplate;
00030         private DispatcherTimer _pageOperationTimer;
00031         private int _pageOperationCount;
00032         private QueuedOperationType _pageOperations = QueuedOperationType.None;
00033
00034         public ListViewAnchoringPage()
00035         {
00036             this.InitializeComponent();
00037
00038             _pageOperationTimer = new DispatcherTimer();
00039             _pageOperationTimer.Interval = new TimeSpan(0, 0, 0, 0, 125 /*ms*/);
00040             _pageOperationTimer.Tick += PageOperationTimer_Tick;
00041
00042             Loaded += ListViewAnchoringPage_Loaded;
00043         }
00044
00045         private void ListViewAnchoringPage_Loaded(object sender, RoutedEventArgs e)
00046         {
00047             if (listView != null)
00048             {
00049                 _itemsStackPanelTemplate = listView.ItemsPanel;
00050             }
00051         }
00052
00053         private void PageOperationTimer_Tick(object sender, object e)
00054         {
00055             try
00056             {
00057                 _pageOperationCount++;
00058
00059                 int maxOperationCount = 10;
00060
00061                 if (txtPageOperationCount != null)
00062                 {
00063                     maxOperationCount = int.Parse(txtPageOperationCount.Text);
00064                 }
00065
00066                 if ((_pageOperations & QueuedOperationType.PageShrinkSize) == QueuedOperationType.PageShrinkSize)
00067                 {
00068                     Width = ActualWidth - 10.0;
00069                     Height = ActualHeight - 10.0;
00070                 }
00071
00072                 if (listView != null)
00073                 {
00074                     if ((_pageOperations & QueuedOperationType.SourceInsertItem) == QueuedOperationType.SourceInsertItem)
00075                     {
00076                         if (listView.ItemsSource == null)
00077                         {
00078                             listView.ItemsSource = new ObservableCollection<GroupedListViewBaseItem>()
00079                             {
00080                                 new GroupedListViewBaseItem("ListView Item 0")
00081                             };
00082                         }
00083                         else
00084                         {
00085                             ObservableCollection<GroupedListViewBaseItem> source = listView.ItemsSource as ObservableCollection<GroupedListViewBaseItem>;
00086                             if (source != null)
00087                             {
00088                                 source.Insert(0, new GroupedListViewBaseItem("ListView Item " + source.Count));
00089                             }
00090                             else
00091                             {
00092                                 int count = _groupedListViewBaseViewModel.Items.Count;
00093                                 string groupName = ((char)(65 + count)).ToString();
00094                                 GroupedListViewBaseGroupItem group = new GroupedListViewBaseGroupItem("Group " + groupName);
00095                                 group.Items.Add(new GroupedListViewBaseItem("id" + groupName + "1"));
00096                                 _groupedListViewBaseViewModel.Items.Insert(0, group);
00097                             }
00098                         }
00099                     }
00100
00101                     if ((_pageOperations & QueuedOperationType.SourceAppendItem) == QueuedOperationType.SourceAppendItem)
00102                     {
00103                         if (listView.ItemsSource == null)
00104                         {
00105                             listView.ItemsSource = new ObservableCollection<GroupedListViewBaseItem>()
00106                             {
00107                                 new GroupedListViewBaseItem("ListView Item 0")
00108                             };
00109                         }
00110                         else
00111                         {
00112                             ObservableCollection<GroupedListViewBaseItem> source = listView.ItemsSource as ObservableCollection<GroupedListViewBaseItem>;
00113                             if (source != null)
00114                             {
00115                                 source.Add(new GroupedListViewBaseItem("ListView Item " + source.Count));
00116                             }
00117                             else
00118                             {
00119                                 int count = _groupedListViewBaseViewModel.Items.Count;
00120                                 string groupName = ((char)(65 + count)).ToString();
00121                                 GroupedListViewBaseGroupItem group = new GroupedListViewBaseGroupItem("Group " + groupName);
00122                                 group.Items.Add(new GroupedListViewBaseItem("id" + groupName + "1"));
00123                                 _groupedListViewBaseViewModel.Items.Add(group);
00124                             }
00125                         }
00126                     }
00127
00128                     if (listView.ItemsSource != null &&
00129                         (_pageOperations & QueuedOperationType.SourceRemoveFirstItem) == QueuedOperationType.SourceRemoveFirstItem)
00130                     {
00131                         ObservableCollection<GroupedListViewBaseItem> source = listView.ItemsSource as ObservableCollection<GroupedListViewBaseItem>;
00132                         if (source != null)
00133                         {
00134                             if (source.Count > 0)
00135                             {
00136                                 source.RemoveAt(0);
00137                             }
00138                         }
00139                         else
00140                         {
00141                             int count = _groupedListViewBaseViewModel.Items.Count;
00142                             if (count > 0)
00143                             {
00144                                 GroupedListViewBaseGroupItem group = _groupedListViewBaseViewModel.Items[0];
00145                                 group.Items.RemoveAt(0);
00146                                 if (group.Items.Count == 0)
00147                                 {
00148                                     _groupedListViewBaseViewModel.Items.RemoveAt(0);
00149                                 }
00150                             }
00151                         }
00152                     }
00153
00154                     if (listView.ItemsSource != null &&
00155                         (_pageOperations & QueuedOperationType.SourceRemoveLastItem) == QueuedOperationType.SourceRemoveLastItem)
00156                     {
00157                         ObservableCollection<GroupedListViewBaseItem> source = listView.ItemsSource as ObservableCollection<GroupedListViewBaseItem>;
00158                         if (source != null)
00159                         {
00160                             if (source.Count > 0)
00161                             {
00162                                 source.RemoveAt(source.Count - 1);
00163                             }
00164                         }
00165                         else
00166                         {
00167                             int count = _groupedListViewBaseViewModel.Items.Count;
00168                             if (count > 0)
00169                             {
00170                                 GroupedListViewBaseGroupItem group = _groupedListViewBaseViewModel.Items[count - 1];
00171                                 group.Items.RemoveAt(group.Items.Count - 1);
00172                                 if (group.Items.Count == 0)
00173                                 {
00174                                     _groupedListViewBaseViewModel.Items.RemoveAt(count - 1);
00175                                 }
00176                             }
00177                         }
00178                     }
00179
00180                     if (_pageOperationCount == maxOperationCount)
00181                     {
00182                         _pageOperations = QueuedOperationType.None;
00183
00184                         if (_pageOperationTimer != null)
00185                         {
00186                             _pageOperationTimer.Stop();
00187                         }
00188                     }
00189                 }
00190             }
00191             catch (Exception ex)
00192             {
00193                 txtExceptionReport.Text = ex.ToString();
00194             }
00195         }
00196
00197         private void CmbListViewItemsPanelType_SelectionChanged(object sender, SelectionChangedEventArgs e)
00198         {
00199             try
00200             {
00201                 if (listView != null && cmbListViewItemsPanelType != null)
00202                 {
00203                     switch (cmbListViewItemsPanelType.SelectedIndex)
00204                     {
00205                         case 0:
00206                             if (_itemsStackPanelTemplate != null && _itemsStackPanelTemplate != listView.ItemsPanel)
00207                             {
00208                                 listView.ItemsPanel = _itemsStackPanelTemplate;
00209                             }
00210                             break;
00211                         case 1: // Use the itemsWrapGridItemsPanelTemplate resource
00212                             listView.ItemsPanel = Resources["itemsWrapGridItemsPanelTemplate"] as ItemsPanelTemplate;
00213                             break;
00214                         case 2: // Use the stackPanelItemsPanelTemplate resource
00215                             listView.ItemsPanel = Resources["stackPanelItemsPanelTemplate"] as ItemsPanelTemplate;
00216                             break;
00217                     }
00218                 }
00219             }
00220             catch (Exception ex)
00221             {
00222                 txtExceptionReport.Text = ex.ToString();
00223             }
00224         }
00225
00226         private void BtnGetItemsStackPanelItemsUpdatingScrollMode_Click(object sender, RoutedEventArgs e)
00227         {
00228             try
00229             {
00230                 if (listView != null)
00231                 {
00232                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00233
00234                     if (itemsStackPanel != null)
00235                     {
00236                         cmbItemsStackPanelItemsUpdatingScrollMode.SelectedIndex = (int)itemsStackPanel.ItemsUpdatingScrollMode;
00237                     }
00238                 }
00239             }
00240             catch (Exception ex)
00241             {
00242                 txtExceptionReport.Text = ex.ToString();
00243             }
00244         }
00245
00246         private void BtnSetItemsStackPanelItemsUpdatingScrollMode_Click(object sender, RoutedEventArgs e)
00247         {
00248             try
00249             {
00250                 if (listView != null)
00251                 {
00252                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00253
00254                     if (itemsStackPanel != null)
00255                     {
00256                         itemsStackPanel.ItemsUpdatingScrollMode = (ItemsUpdatingScrollMode)cmbItemsStackPanelItemsUpdatingScrollMode.SelectedIndex;
00257                     }
00258                 }
00259             }
00260             catch (Exception ex)
00261             {
00262                 txtExceptionReport.Text = ex.ToString();
00263             }
00264         }
00265
00266         private void BtnGetModernCollectionBasePanelGroupPadding_Click(object sender, RoutedEventArgs e)
00267         {
00268             try
00269             {
00270                 if (listView != null && txtModernCollectionBasePanelGroupPadding != null)
00271                 {
00272                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00273
00274                     if (itemsStackPanel != null)
00275                     {
00276                         txtModernCollectionBasePanelGroupPadding.Text = itemsStackPanel.GroupPadding.ToString();
00277                     }
00278                     else
00279                     {
00280                         ItemsWrapGrid itemsWrapGrid = GetItemsWrapGrid();
00281
00282                         if (itemsWrapGrid != null)
00283                         {
00284                             txtModernCollectionBasePanelGroupPadding.Text = itemsWrapGrid.GroupPadding.ToString();
00285                         }
00286                     }
00287                 }
00288             }
00289             catch (Exception ex)
00290             {
00291                 txtExceptionReport.Text = ex.ToString();
00292             }
00293         }
00294
00295         private void BtnSetModernCollectionBasePanelGroupPadding_Click(object sender, RoutedEventArgs e)
00296         {
00297             try
00298             {
00299                 if (listView != null && txtModernCollectionBasePanelGroupPadding != null)
00300                 {
00301                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00302
00303                     if (itemsStackPanel != null)
00304                     {
00305                         itemsStackPanel.GroupPadding = GetThicknessFromString(txtModernCollectionBasePanelGroupPadding.Text);
00306                     }
00307                     else
00308                     {
00309                         ItemsWrapGrid itemsWrapGrid = GetItemsWrapGrid();
00310
00311                         if (itemsWrapGrid != null)
00312                         {
00313                             itemsWrapGrid.GroupPadding = GetThicknessFromString(txtModernCollectionBasePanelGroupPadding.Text);
00314                         }
00315                     }
00316                 }
00317             }
00318             catch (Exception ex)
00319             {
00320                 txtExceptionReport.Text = ex.ToString();
00321             }
00322         }
00323
00324         private void BtnGetModernCollectionBasePanelVerticalAlignment_Click(object sender, RoutedEventArgs e)
00325         {
00326             try
00327             {
00328                 if (listView != null && cmbModernCollectionBasePanelVerticalAlignment != null)
00329                 {
00330                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00331
00332                     if (itemsStackPanel != null)
00333                     {
00334                         cmbModernCollectionBasePanelVerticalAlignment.SelectedIndex = (int)itemsStackPanel.VerticalAlignment;
00335                     }
00336                     else
00337                     {
00338                         ItemsWrapGrid itemsWrapGrid = GetItemsWrapGrid();
00339
00340                         if (itemsWrapGrid != null)
00341                         {
00342                             cmbModernCollectionBasePanelVerticalAlignment.SelectedIndex = (int)itemsWrapGrid.VerticalAlignment;
00343                         }
00344                     }
00345                 }
00346             }
00347             catch (Exception ex)
00348             {
00349                 txtExceptionReport.Text = ex.ToString();
00350             }
00351         }
00352
00353         private void BtnSetModernCollectionBasePanelVerticalAlignment_Click(object sender, RoutedEventArgs e)
00354         {
00355             try
00356             {
00357                 if (listView != null && cmbModernCollectionBasePanelVerticalAlignment != null)
00358                 {
00359                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00360
00361                     if (itemsStackPanel != null)
00362                     {
00363                         itemsStackPanel.VerticalAlignment = (VerticalAlignment)cmbModernCollectionBasePanelVerticalAlignment.SelectedIndex;
00364                     }
00365                     else
00366                     {
00367                         ItemsWrapGrid itemsWrapGrid = GetItemsWrapGrid();
00368
00369                         if (itemsWrapGrid != null)
00370                         {
00371                             itemsWrapGrid.VerticalAlignment = (VerticalAlignment)cmbModernCollectionBasePanelVerticalAlignment.SelectedIndex;
00372                         }
00373                     }
00374                 }
00375             }
00376             catch (Exception ex)
00377             {
00378                 txtExceptionReport.Text = ex.ToString();
00379             }
00380         }
00381
00382         private void BtnGetStackPanelVerticalAlignment_Click(object sender, RoutedEventArgs e)
00383         {
00384             try
00385             {
00386                 if (listView != null && cmbStackPanelVerticalAlignment != null)
00387                 {
00388                     StackPanel stackPanel = GetStackPanel();
00389
00390                     if (stackPanel != null)
00391                     {
00392                         cmbStackPanelVerticalAlignment.SelectedIndex = (int)stackPanel.VerticalAlignment;
00393                     }
00394                 }
00395             }
00396             catch (Exception ex)
00397             {
00398                 txtExceptionReport.Text = ex.ToString();
00399             }
00400         }
00401
00402         private void BtnSetStackPanelVerticalAlignment_Click(object sender, RoutedEventArgs e)
00403         {
00404             try
00405             {
00406                 if (listView != null && cmbStackPanelVerticalAlignment != null)
00407                 {
00408                     StackPanel stackPanel = GetStackPanel();
00409
00410                     if (stackPanel != null)
00411                     {
00412                         stackPanel.VerticalAlignment = (VerticalAlignment)cmbStackPanelVerticalAlignment.SelectedIndex;
00413                     }
00414                 }
00415             }
00416             catch (Exception ex)
00417             {
00418                 txtExceptionReport.Text = ex.ToString();
00419             }
00420         }
00421
00422         private void BtnGetModernCollectionBasePanelGroupHeaderPlacement_Click(object sender, RoutedEventArgs e)
00423         {
00424             try
00425             {
00426                 if (cmbModernCollectionBasePanelGroupHeaderPlacement != null)
00427                 {
00428                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00429
00430                     if (itemsStackPanel != null)
00431                     {
00432                         cmbModernCollectionBasePanelGroupHeaderPlacement.SelectedIndex = (int)itemsStackPanel.GroupHeaderPlacement;
00433                     }
00434                     else
00435                     {
00436                         ItemsWrapGrid itemsWrapGrid = GetItemsWrapGrid();
00437
00438                         if (itemsWrapGrid != null)
00439                         {
00440                             cmbModernCollectionBasePanelGroupHeaderPlacement.SelectedIndex = (int)itemsWrapGrid.GroupHeaderPlacement;
00441                         }
00442                     }
00443                 }
00444             }
00445             catch (Exception ex)
00446             {
00447                 txtExceptionReport.Text = ex.ToString();
00448             }
00449         }
00450
00451         private void BtnSetModernCollectionBasePanelGroupHeaderPlacement_Click(object sender, RoutedEventArgs e)
00452         {
00453             try
00454             {
00455                 if (cmbModernCollectionBasePanelGroupHeaderPlacement != null)
00456                 {
00457                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00458
00459                     if (itemsStackPanel != null)
00460                     {
00461                         itemsStackPanel.GroupHeaderPlacement = (GroupHeaderPlacement)cmbModernCollectionBasePanelGroupHeaderPlacement.SelectedIndex;
00462                     }
00463                     else
00464                     {
00465                         ItemsWrapGrid itemsWrapGrid = GetItemsWrapGrid();
00466
00467                         if (itemsWrapGrid != null)
00468                         {
00469                             itemsWrapGrid.GroupHeaderPlacement = (GroupHeaderPlacement)cmbModernCollectionBasePanelGroupHeaderPlacement.SelectedIndex;
00470                         }
00471                     }
00472                 }
00473             }
00474             catch (Exception ex)
00475             {
00476                 txtExceptionReport.Text = ex.ToString();
00477             }
00478         }
00479
00480         private void ChkModernCollectionBasePanelAreStickyGroupHeadersEnabled_IsCheckedChanged(object sender, RoutedEventArgs e)
00481         {
00482             try
00483             {
00484                 if (chkModernCollectionBasePanelAreStickyGroupHeadersEnabled != null)
00485                 {
00486                     ItemsStackPanel itemsStackPanel = GetItemsStackPanel();
00487
00488                     if (itemsStackPanel != null)
00489                     {
00490                         itemsStackPanel.AreStickyGroupHeadersEnabled = (bool)chkModernCollectionBasePanelAreStickyGroupHeadersEnabled.IsChecked;
00491                     }
00492                     else
00493                     {
00494                         ItemsWrapGrid itemsWrapGrid = GetItemsWrapGrid();
00495
00496                         if (itemsWrapGrid != null)
00497                         {
00498                             itemsWrapGrid.AreStickyGroupHeadersEnabled = (bool)chkModernCollectionBasePanelAreStickyGroupHeadersEnabled.IsChecked;
00499                         }
00500                     }
00501                 }
00502             }
00503             catch (Exception ex)
00504             {
00505                 txtExceptionReport.Text = ex.ToString();
00506             }
00507         }
00508
00509         private void BtnSetListViewFlatItemsSource_Click(object sender, RoutedEventArgs e)
00510         {
00511             try
00512             {
00513                 if (listView != null)
00514                 {
00515                     listView.ItemsSource = new ObservableCollection<GroupedListViewBaseItem>()
00516                     {
00517                         new GroupedListViewBaseItem("ListView Item 0"),
00518                         new GroupedListViewBaseItem("ListView Item 1"),
00519                         new GroupedListViewBaseItem("ListView Item 2"),
00520                         new GroupedListViewBaseItem("ListView Item 3"),
00521                         new GroupedListViewBaseItem("ListView Item 4"),
00522                         new GroupedListViewBaseItem("ListView Item 5")
00523                     };
00524                 }
00525             }
00526             catch (Exception ex)
00527             {
00528                 txtExceptionReport.Text = ex.ToString();
00529             }
00530         }
00531
00532         private void BtnSetListViewGroupedItemsSource_Click(object sender, RoutedEventArgs e)
00533         {
00534             try
00535             {
00536                 if (listView != null)
00537                 {
00538                     _groupedListViewBaseViewModel = new GroupedListViewBaseViewModel();
00539                     _cvs = new CollectionViewSource();
00540
00541                     _cvs.Source = _groupedListViewBaseViewModel.Items;
00542                     _cvs.IsSourceGrouped = true;
00543                     _cvs.ItemsPath = new PropertyPath("Items");
00544
00545                     listView.ItemsSource = _cvs.View;
00546                 }
00547             }
00548             catch (Exception ex)
00549             {
00550                 txtExceptionReport.Text = ex.ToString();
00551             }
00552         }
00553
00554         private void BtnClearListViewItemsSource_Click(object sender, RoutedEventArgs e)
00555         {
00556             try
00557             {
00558                 if (listView != null)
00559                 {
00560                     ObservableCollection<GroupedListViewBaseItem> source = listView.ItemsSource as ObservableCollection<GroupedListViewBaseItem>;
00561                     if (source != null)
00562                     {
00563                         source.Clear();
00564                     }
00565                     else if (_groupedListViewBaseViewModel != null)
00566                     {
00567                         _groupedListViewBaseViewModel.Items.Clear();
00568                     }
00569                 }
00570             }
00571             catch (Exception ex)
00572             {
00573                 txtExceptionReport.Text = ex.ToString();
00574             }
00575         }
00576
00577         private void BtnResetListViewItemsSource_Click(object sender, RoutedEventArgs e)
00578         {
00579             try
00580             {
00581                 if (listView != null)
00582                 {
00583                     listView.ItemsSource = null;
00584                 }
00585             }
00586             catch (Exception ex)
00587             {
00588                 txtExceptionReport.Text = ex.ToString();
00589             }
00590         }
00591
00592         private void BtnGetListViewSize_Click(object sender, RoutedEventArgs e)
00593         {
00594             try
00595             {
00596                 if (listView != null && txtListViewWidth != null && txtListViewHeight != null)
00597                 {
00598                     txtListViewWidth.Text = "AW: " + listView.ActualWidth.ToString();
00599                     txtListViewHeight.Text = "AH: " + listView.ActualHeight.ToString();
00600                 }
00601             }
00602             catch (Exception ex)
00603             {
00604                 txtExceptionReport.Text = ex.ToString();
00605             }
00606         }
00607
00608         private void BtnGetScrollViewerVerticalAnchorRatio_Click(object sender, RoutedEventArgs e)
00609         {
00610             try
00611             {
00612                 if (listView != null && txtScrollViewerVerticalAnchorRatio != null)
00613                 {
00614                     ScrollViewer scrollViewer = FindElementOfTypeInSubtree<ScrollViewer>(listView);
00615
00616                     if (scrollViewer != null)
00617                     {
00618                         txtScrollViewerVerticalAnchorRatio.Text = scrollViewer.VerticalAnchorRatio.ToString();
00619                     }
00620                 }
00621             }
00622             catch (Exception ex)
00623             {
00624                 txtExceptionReport.Text = ex.ToString();
00625             }
00626         }
00627
00628         private void BtnSetScrollViewerVerticalAnchorRatio_Click(object sender, RoutedEventArgs e)
00629         {
00630             try
00631             {
00632                 if (listView != null && txtScrollViewerVerticalAnchorRatio != null)
00633                 {
00634                     ScrollViewer scrollViewer = FindElementOfTypeInSubtree<ScrollViewer>(listView);
00635
00636                     if (scrollViewer != null)
00637                     {
00638                         scrollViewer.VerticalAnchorRatio = double.Parse(txtScrollViewerVerticalAnchorRatio.Text);
00639                     }
00640                 }
00641             }
00642             catch (Exception ex)
00643             {
00644                 txtExceptionReport.Text = ex.ToString();
00645             }
00646         }
00647
00648         private void BtnGetScrollViewerVerticalOffset_Click(object sender, RoutedEventArgs e)
00649         {
00650             try
00651             {
00652                 if (listView != null && txtScrollViewerVerticalOffset != null)
00653                 {
00654                     ScrollViewer scrollViewer = FindElementOfTypeInSubtree<ScrollViewer>(listView);
00655
00656                     if (scrollViewer != null)
00657                     {
00658                         txtScrollViewerVerticalOffset.Text = scrollViewer.VerticalOffset.ToString();
00659                     }
00660                 }
00661             }
00662             catch (Exception ex)
00663             {
00664                 txtExceptionReport.Text = ex.ToString();
00665             }
00666         }
00667
00668         private void BtnSetScrollViewerVerticalOffset_Click(object sender, RoutedEventArgs e)
00669         {
00670             try
00671             {
00672                 if (listView != null && txtScrollViewerVerticalOffset != null)
00673                 {
00674                     ScrollViewer scrollViewer = FindElementOfTypeInSubtree<ScrollViewer>(listView);
00675
00676                     if (scrollViewer != null)
00677                     {
00678                         scrollViewer.ChangeView(null, double.Parse(txtScrollViewerVerticalOffset.Text), null, true);
00679                     }
00680                 }
00681             }
00682             catch (Exception ex)
00683             {
00684                 txtExceptionReport.Text = ex.ToString();
00685             }
00686         }
00687
00688         private void BtnGetListViewItemActualHeight_Click(object sender, RoutedEventArgs e)
00689         {
00690             try
00691             {
00692                 if (listView != null && txtListViewItemIndex != null && txtListViewItemActualHeight != null)
00693                 {
00694                     int listViewItemIndex = int.Parse(txtListViewItemIndex.Text);
00695                     ListViewItem listViewItem = listView.ContainerFromIndex(listViewItemIndex) as ListViewItem;
00696                     txtListViewItemActualHeight.Text = listViewItem.ActualHeight.ToString();
00697                 }
00698             }
00699             catch (Exception ex)
00700             {
00701                 txtExceptionReport.Text = ex.ToString();
00702             }
00703         }
00704
00705         private void BtnGetListViewItemHeight_Click(object sender, RoutedEventArgs e)
00706         {
00707             try
00708             {
00709                 if (listView != null && txtListViewItemIndex != null && txtListViewItemHeight != null)
00710                 {
00711                     int listViewItemIndex = int.Parse(txtListViewItemIndex.Text);
00712                     ListViewItem listViewItem = listView.ContainerFromIndex(listViewItemIndex) as ListViewItem;
00713                     txtListViewItemHeight.Text = listViewItem.Height.ToString();
00714                 }
00715             }
00716             catch (Exception ex)
00717             {
00718                 txtExceptionReport.Text = ex.ToString();
00719             }
00720         }
00721
00722         private void BtnSetListViewItemHeight_Click(object sender, RoutedEventArgs e)
00723         {
00724             try
00725             {
00726                 if (listView != null && txtListViewItemIndex != null && txtListViewItemHeight != null)
00727                 {
00728                     int listViewItemIndex = int.Parse(txtListViewItemIndex.Text);
00729                     ListViewItem listViewItem = listView.ContainerFromIndex(listViewItemIndex) as ListViewItem;
00730                     listViewItem.Height = double.Parse(txtListViewItemHeight.Text);
00731                 }
00732             }
00733             catch (Exception ex)
00734             {
00735                 txtExceptionReport.Text = ex.ToString();
00736             }
00737         }
00738
00739         private void BtnGetPageSize_Click(object sender, RoutedEventArgs e)
00740         {
00741             try
00742             {
00743                 if (txtPageWidth != null && txtPageHeight != null)
00744                 {
00745                     txtPageWidth.Text = ActualWidth.ToString();
00746                     txtPageHeight.Text = ActualHeight.ToString();
00747                 }
00748             }
00749             catch (Exception ex)
00750             {
00751                 txtExceptionReport.Text = ex.ToString();
00752             }
00753         }
00754
00755         private void BtnSetPageSize_Click(object sender, RoutedEventArgs e)
00756         {
00757             try
00758             {
00759                 if (txtPageWidth != null && txtPageHeight != null)
00760                 {
00761                     Width = double.Parse(txtPageWidth.Text);
00762                     Height = double.Parse(txtPageHeight.Text);
00763                 }
00764             }
00765             catch (Exception ex)
00766             {
00767                 txtExceptionReport.Text = ex.ToString();
00768             }
00769         }
00770
00771         private void BtnPageShrinkSize_Click(object sender, RoutedEventArgs e)
00772         {
00773             try
00774             {
00775                 if (_pageOperationTimer != null)
00776                 {
00777                     _pageOperations |= QueuedOperationType.PageShrinkSize;
00778                     _pageOperationCount = 0;
00779                     _pageOperationTimer.Start();
00780                 }
00781             }
00782             catch (Exception ex)
00783             {
00784                 txtExceptionReport.Text = ex.ToString();
00785             }
00786         }
00787
00788         private void BtnSourceInsertItem_Click(object sender, RoutedEventArgs e)
00789         {
00790             try
00791             {
00792                 if (_pageOperationTimer != null)
00793                 {
00794                     _pageOperations |= QueuedOperationType.SourceInsertItem;
00795                     _pageOperationCount = 0;
00796                     _pageOperationTimer.Start();
00797                 }
00798             }
00799             catch (Exception ex)
00800             {
00801                 txtExceptionReport.Text = ex.ToString();
00802             }
00803         }
00804
00805         private void BtnSourceAppendItem_Click(object sender, RoutedEventArgs e)
00806         {
00807             try
00808             {
00809                 if (_pageOperationTimer != null)
00810                 {
00811                     _pageOperations |= QueuedOperationType.SourceAppendItem;
00812                     _pageOperationCount = 0;
00813                     _pageOperationTimer.Start();
00814                 }
00815             }
00816             catch (Exception ex)
00817             {
00818                 txtExceptionReport.Text = ex.ToString();
00819             }
00820         }
00821
00822         private void BtnSourceRemoveFirstItem_Click(object sender, RoutedEventArgs e)
00823         {
00824             try
00825             {
00826                 if (_pageOperationTimer != null)
00827                 {
00828                     _pageOperations |= QueuedOperationType.SourceRemoveFirstItem;
00829                     _pageOperationCount = 0;
00830                     _pageOperationTimer.Start();
00831                 }
00832             }
00833             catch (Exception ex)
00834             {
00835                 txtExceptionReport.Text = ex.ToString();
00836             }
00837         }
00838
00839         private void BtnSourceRemoveLastItem_Click(object sender, RoutedEventArgs e)
00840         {
00841             try
00842             {
00843                 if (_pageOperationTimer != null)
00844                 {
00845                     _pageOperations |= QueuedOperationType.SourceRemoveLastItem;
00846                     _pageOperationCount = 0;
00847                     _pageOperationTimer.Start();
00848                 }
00849             }
00850             catch (Exception ex)
00851             {
00852                 txtExceptionReport.Text = ex.ToString();
00853             }
00854         }
00855
00856         private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
00857         {
00858             txtExceptionReport.Text = string.Empty;
00859         }
00860
00861         private ItemsStackPanel GetItemsStackPanel()
00862         {
00863             if (listView != null)
00864             {
00865                 return listView.ItemsPanelRoot as ItemsStackPanel;
00866             }
00867             return null;
00868         }
00869
00870         private Thickness GetThicknessFromString(string thickness)
00871         {
00872             string[] lengths = thickness.Split(',');
00873             if (lengths.Length < 4)
00874                 return new Thickness(
00875                     Convert.ToDouble(lengths[0]));
00876             else
00877                 return new Thickness(
00878                     Convert.ToDouble(lengths[0]), Convert.ToDouble(lengths[1]), Convert.ToDouble(lengths[2]), Convert.ToDouble(lengths[3]));
00879         }
00880
00881         private ItemsWrapGrid GetItemsWrapGrid()
00882         {
00883             if (listView != null)
00884             {
00885                 return listView.ItemsPanelRoot as ItemsWrapGrid;
00886             }
00887             return null;
00888         }
00889
00890         private StackPanel GetStackPanel()
00891         {
00892             if (listView != null)
00893             {
00894                 return listView.ItemsPanelRoot as StackPanel;
00895             }
00896             return null;
00897         }
00898
00899         private static T FindElementOfTypeInSubtree<T>(DependencyObject element) where T : DependencyObject
00900         {
00901             if (element == null)
00902                 return null;
00903
00904             if (element is T)
00905                 return (T)element;
00906
00907             int childrenCount = VisualTreeHelper.GetChildrenCount(element);
00908             for (int i = 0; i < childrenCount; i++)
00909             {
00910                 var result = FindElementOfTypeInSubtree<T>(VisualTreeHelper.GetChild(element, i));
00911                 if (result != null)
00912                     return result;
00913             }
00914
00915             return null;
00916         }
00917     }
00918 }
Generated on Sun Dec 1 2024 20:51:47 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemsRepeater.idl Source File

  • Repeater

ItemsRepeater.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 runtimeclass ItemsSourceView;
00005 runtimeclass ItemsRepeater;
00006 runtimeclass ElementFactory;
00007 runtimeclass LayoutContext;
00008 runtimeclass VirtualizingLayoutContext;
00009 runtimeclass Layout;
00010 runtimeclass VirtualizingLayout;
00011 runtimeclass ItemCollectionTransition;
00012 runtimeclass ItemCollectionTransitionProgress;
00013 runtimeclass ItemCollectionTransitionProvider;
00014 runtimeclass LinedFlowLayoutItemCollectionTransitionProvider;
00015 runtimeclass ItemsRepeaterScrollHost;
00016 runtimeclass ItemsRepeaterElementPreparedEventArgs;
00017 runtimeclass ItemsRepeaterElementClearingEventArgs;
00018 runtimeclass ItemsRepeaterElementIndexChangedEventArgs;
00019 runtimeclass LinedFlowLayout;
00020 runtimeclass LinedFlowLayoutItemsInfoRequestedEventArgs;
00021 runtimeclass UniformGridLayoutState;
00022 runtimeclass UniformGridLayout;
00023 runtimeclass StackLayoutState;
00024 runtimeclass StackLayout;
00025 runtimeclass FlowLayoutState;
00026 runtimeclass FlowLayout;
00027 runtimeclass RecyclePool;
00028 runtimeclass SelectTemplateEventArgs;
00029 runtimeclass RecyclingElementFactory;
00030 runtimeclass IndexPath;
00031 runtimeclass SelectionModelSelectionChangedEventArgs;
00032 runtimeclass SelectionModelChildrenRequestedEventArgs;
00033 runtimeclass SelectionModel;
00034
00035 [MUX_PUBLIC_V5]
00036 [webhosthidden]
00037 [flags]
00038 enum ItemCollectionTransitionTriggers
00039 {
00040     CollectionChangeAdd = 1,
00041     CollectionChangeRemove = 2,
00042     CollectionChangeReset = 4,
00043     LayoutTransition = 8,
00044 };
00045
00046 [MUX_PUBLIC_V5]
00047 [webhosthidden]
00048 enum ItemCollectionTransitionOperation
00049 {
00050     Add = 0,
00051     Remove = 1,
00052     Move = 2
00053 };
00054
00055 [MUX_PUBLIC]
00056 [webhosthidden]
00057 [flags]
00058 enum ElementRealizationOptions
00059 {
00060     None = 0,
00061     ForceCreate = 1,
00062     SuppressAutoRecycle = 2
00063 };
00064
00065 [MUX_PUBLIC_V5]
00066 [webhosthidden]
00067 enum IndexBasedLayoutOrientation
00068 {
00069     None = 0,
00070     TopToBottom = 1,
00071     LeftToRight = 2,
00072 };
00073
00074 [MUX_PREVIEW]
00075 [webhosthidden]
00076 enum FlowLayoutLineAlignment
00077 {
00078     Start = 0,
00079     Center = 1,
00080     End = 2,
00081     SpaceAround = 3,
00082     SpaceBetween = 4,
00083     SpaceEvenly = 5
00084 };
00085
00086 [MUX_PUBLIC]
00087 [webhosthidden]
00088 enum UniformGridLayoutItemsJustification
00089 {
00090     Start = 0,
00091     Center = 1,
00092     End = 2,
00093     SpaceAround = 3,
00094     SpaceBetween = 4,
00095     SpaceEvenly = 5
00096 };
00097
00098 [MUX_PUBLIC]
00099 [webhosthidden]
00100 enum UniformGridLayoutItemsStretch
00101 {
00102     None = 0,
00103     Fill = 1,
00104     Uniform = 2
00105 };
00106
00107 [MUX_PUBLIC_V5]
00108 [webhosthidden]
00109 enum LinedFlowLayoutItemsJustification
00110 {
00111     Start = 0,
00112     Center = 1,
00113     End = 2,
00114     SpaceAround = 3,
00115     SpaceBetween = 4,
00116     SpaceEvenly = 5
00117 };
00118
00119 [MUX_PUBLIC_V5]
00120 [webhosthidden]
00121 enum LinedFlowLayoutItemsStretch
00122 {
00123     None = 0,
00124     Fill = 1
00125 };
00126
00127 [MUX_PUBLIC]
00128 [webhosthidden]
00129 interface IKeyIndexMapping
00130 {
00131     String KeyFromIndex(Int32 index);
00132     Int32 IndexFromKey(String key);
00133 }
00134
00135 [MUX_PUBLIC]
00136 [webhosthidden]
00137 unsealed runtimeclass ItemsSourceView: Microsoft.UI.Xaml.Interop.INotifyCollectionChanged
00138 {
00139     ItemsSourceView(Object source);
00140
00141     Int32 Count{ get; };
00142     Object GetAt(Int32 index);
00143
00144     Boolean HasKeyIndexMapping{ get; };
00145     String KeyFromIndex(Int32 index);
00146     Int32 IndexFromKey(String key);
00147     Int32 IndexOf(IInspectable item);
00148 }
00149
00150 [MUX_PUBLIC]
00151 [webhosthidden]
00152 [contentproperty("ItemTemplate")]
00153 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00154 unsealed runtimeclass ItemsRepeater : Microsoft.UI.Xaml.FrameworkElement
00155 {
00156     ItemsRepeater();
00157
00158     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00159     Object ItemsSource { get; set; };
00160     ItemsSourceView ItemsSourceView { get; };
00161
00162     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00163     Object ItemTemplate { get; set; };
00164
00165     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00166     Layout Layout { get; set; };
00167
00168     [MUX_PUBLIC_V5]
00169     {
00170         [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00171         ItemCollectionTransitionProvider ItemTransitionProvider{ get; set; };
00172     }
00173
00174     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00175     [MUX_DEFAULT_VALUE("2.0")]
00176     Double HorizontalCacheLength { get; set; };
00177     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00178     [MUX_DEFAULT_VALUE("2.0")]
00179     Double VerticalCacheLength { get; set; };
00180
00181     Microsoft.UI.Xaml.Media.Brush Background{ get; set; };
00182
00183     Int32 GetElementIndex(Microsoft.UI.Xaml.UIElement element);
00184     Microsoft.UI.Xaml.UIElement TryGetElement(Int32 index);
00185     Microsoft.UI.Xaml.UIElement GetOrCreateElement(Int32 index);
00186     event Windows.Foundation.TypedEventHandler<ItemsRepeater, ItemsRepeaterElementPreparedEventArgs> ElementPrepared;
00187     event Windows.Foundation.TypedEventHandler<ItemsRepeater, ItemsRepeaterElementClearingEventArgs> ElementClearing;
00188     event Windows.Foundation.TypedEventHandler<ItemsRepeater, ItemsRepeaterElementIndexChangedEventArgs> ElementIndexChanged;
00189
00190     static Microsoft.UI.Xaml.DependencyProperty ItemsSourceProperty { get; };
00191     static Microsoft.UI.Xaml.DependencyProperty ItemTemplateProperty { get; };
00192     static Microsoft.UI.Xaml.DependencyProperty LayoutProperty { get; };
00193     [MUX_PUBLIC_V5]
00194     {
00195         static Microsoft.UI.Xaml.DependencyProperty ItemTransitionProviderProperty { get; };
00196     }
00197     static Microsoft.UI.Xaml.DependencyProperty HorizontalCacheLengthProperty { get; };
00198     static Microsoft.UI.Xaml.DependencyProperty VerticalCacheLengthProperty { get; };
00199     static Microsoft.UI.Xaml.DependencyProperty BackgroundProperty{ get; };
00200 }
00201
00202 [MUX_PREVIEW]
00203 [webhosthidden]
00204 unsealed runtimeclass ElementFactory : Microsoft.UI.Xaml.DependencyObject, Microsoft.UI.Xaml.IElementFactory
00205 {
00206     ElementFactory();
00207
00208     overridable Microsoft.UI.Xaml.UIElement GetElementCore(Microsoft.UI.Xaml.ElementFactoryGetArgs args);
00209     overridable void RecycleElementCore(Microsoft.UI.Xaml.ElementFactoryRecycleArgs args);
00210 }
00211
00212 [MUX_PUBLIC]
00213 [webhosthidden]
00214 unsealed runtimeclass LayoutContext : Microsoft.UI.Xaml.DependencyObject
00215 {
00216     Object LayoutState{ get; set; };
00217     overridable Object LayoutStateCore{ get; set; };
00218 }
00219
00220
00221 [MUX_PUBLIC]
00222 [webhosthidden]
00223 unsealed runtimeclass NonVirtualizingLayoutContext : LayoutContext
00224 {
00225     NonVirtualizingLayoutContext();
00226
00227     Windows.Foundation.Collections.IVectorView<Microsoft.UI.Xaml.UIElement> Children { get; };
00228     overridable Windows.Foundation.Collections.IVectorView<Microsoft.UI.Xaml.UIElement> ChildrenCore { get; };
00229 }
00230
00231
00232 [MUX_PUBLIC]
00233 [webhosthidden]
00234 unsealed runtimeclass VirtualizingLayoutContext : LayoutContext
00235 {
00236     VirtualizingLayoutContext();
00237
00238     Int32 ItemCount{ get; };
00239     Object GetItemAt(Int32 index);
00240
00241     Windows.Foundation.Rect RealizationRect{ get; };
00242
00243     Microsoft.UI.Xaml.UIElement GetOrCreateElementAt(Int32 index);
00244     Microsoft.UI.Xaml.UIElement GetOrCreateElementAt(Int32 index, ElementRealizationOptions options);
00245     void RecycleElement(Microsoft.UI.Xaml.UIElement element);
00246
00247     Int32 RecommendedAnchorIndex{ get; };
00248
00249     Windows.Foundation.Point LayoutOrigin{ get; set; };
00250
00251     overridable Int32 ItemCountCore();
00252     overridable Object GetItemAtCore(Int32 index);
00253
00254     overridable Windows.Foundation.Rect RealizationRectCore();
00255
00256     overridable Microsoft.UI.Xaml.UIElement GetOrCreateElementAtCore(Int32 index, ElementRealizationOptions options);
00257     overridable void RecycleElementCore(Microsoft.UI.Xaml.UIElement element);
00258
00259     overridable Int32 RecommendedAnchorIndexCore{ get; };
00260
00261     overridable Windows.Foundation.Point LayoutOriginCore{ get; set; };
00262
00263     [MUX_PUBLIC_V5]
00264     {
00265         Windows.Foundation.Rect VisibleRect{ get; };
00266         overridable Windows.Foundation.Rect VisibleRectCore();
00267     }
00268 }
00269
00270 [MUX_PUBLIC]
00271 [webhosthidden]
00272 unsealed runtimeclass Layout : Microsoft.UI.Xaml.DependencyObject
00273 {
00274     void InitializeForContext(LayoutContext context);
00275     void UninitializeForContext(LayoutContext context);
00276     Windows.Foundation.Size Measure(LayoutContext context, Windows.Foundation.Size availableSize);
00277     Windows.Foundation.Size Arrange(LayoutContext context, Windows.Foundation.Size finalSize);
00278
00279     event Windows.Foundation.TypedEventHandler<Layout, Object> MeasureInvalidated;
00280     event Windows.Foundation.TypedEventHandler<Layout, Object> ArrangeInvalidated;
00281
00282     protected void InvalidateMeasure();
00283     protected void InvalidateArrange();
00284
00285     [MUX_PUBLIC_V5]
00286     {
00287         IndexBasedLayoutOrientation IndexBasedLayoutOrientation{ get; };
00288         protected void SetIndexBasedLayoutOrientation(IndexBasedLayoutOrientation orientation);
00289     }
00290
00291     [MUX_PUBLIC_V5]
00292     {
00293         overridable ItemCollectionTransitionProvider CreateDefaultItemTransitionProvider();
00294     }
00295 }
00296
00297 [MUX_PUBLIC]
00298 [webhosthidden]
00299 unsealed runtimeclass NonVirtualizingLayout : Layout
00300 {
00301     NonVirtualizingLayout();
00302
00303     overridable void InitializeForContextCore(NonVirtualizingLayoutContext context);
00304     overridable void UninitializeForContextCore(NonVirtualizingLayoutContext context);
00305     overridable Windows.Foundation.Size MeasureOverride(NonVirtualizingLayoutContext context, Windows.Foundation.Size availableSize);
00306     overridable Windows.Foundation.Size ArrangeOverride(NonVirtualizingLayoutContext context, Windows.Foundation.Size finalSize);
00307 }
00308
00309 [MUX_PUBLIC]
00310 [webhosthidden]
00311 unsealed runtimeclass VirtualizingLayout : Layout
00312 {
00313     VirtualizingLayout();
00314
00315     overridable void InitializeForContextCore(VirtualizingLayoutContext context);
00316     overridable void UninitializeForContextCore(VirtualizingLayoutContext context);
00317     overridable Windows.Foundation.Size MeasureOverride(VirtualizingLayoutContext context, Windows.Foundation.Size availableSize);
00318     overridable Windows.Foundation.Size ArrangeOverride(VirtualizingLayoutContext context, Windows.Foundation.Size finalSize);
00319
00320     overridable void OnItemsChangedCore(VirtualizingLayoutContext context, IInspectable source, Microsoft.UI.Xaml.Interop.NotifyCollectionChangedEventArgs args);
00321 }
00322
00323 [MUX_PUBLIC_V5]
00324 [webhosthidden]
00325 runtimeclass ItemCollectionTransition
00326 {
00327     ItemCollectionTransitionOperation Operation{ get; };
00328     ItemCollectionTransitionTriggers Triggers{ get; };
00329     Windows.Foundation.Rect OldBounds{ get; };
00330     Windows.Foundation.Rect NewBounds{ get; };
00331     Boolean HasStarted{ get; };
00332
00333     ItemCollectionTransitionProgress Start();
00334 }
00335
00336 [MUX_PUBLIC_V5]
00337 [webhosthidden]
00338 runtimeclass ItemCollectionTransitionProgress
00339 {
00340     ItemCollectionTransition Transition{ get; };
00341     Microsoft.UI.Xaml.UIElement Element{ get; };
00342
00343     void Complete();
00344 }
00345
00346 [MUX_PUBLIC_V5]
00347 [webhosthidden]
00348 runtimeclass ItemCollectionTransitionCompletedEventArgs
00349 {
00350     ItemCollectionTransition Transition{ get; };
00351     Microsoft.UI.Xaml.UIElement Element{ get; };
00352 }
00353
00354 [MUX_PUBLIC_V5]
00355 [webhosthidden]
00356 unsealed runtimeclass ItemCollectionTransitionProvider
00357 {
00358     ItemCollectionTransitionProvider();
00359
00360     Boolean ShouldAnimate(ItemCollectionTransition transition);
00361     overridable Boolean ShouldAnimateCore(ItemCollectionTransition transition);
00362
00363     void QueueTransition(ItemCollectionTransition transition);
00364     overridable void StartTransitions(Windows.Foundation.Collections.IVector<ItemCollectionTransition> transitions);
00365
00366     event Windows.Foundation.TypedEventHandler<ItemCollectionTransitionProvider, ItemCollectionTransitionCompletedEventArgs> TransitionCompleted;
00367 }
00368
00369 [MUX_PUBLIC_V5]
00370 [webhosthidden]
00371 unsealed runtimeclass LinedFlowLayoutItemCollectionTransitionProvider : Microsoft.UI.Xaml.Controls.ItemCollectionTransitionProvider
00372 {
00373     LinedFlowLayoutItemCollectionTransitionProvider();
00374 }
00375
00376 [MUX_PUBLIC]
00377 [webhosthidden]
00378 [contentproperty("ScrollViewer")]
00379 runtimeclass ItemsRepeaterScrollHost : Microsoft.UI.Xaml.FrameworkElement
00380 {
00381     ItemsRepeaterScrollHost();
00382
00383     Microsoft.UI.Xaml.Controls.ScrollViewer ScrollViewer { get; set; };
00384
00385     Microsoft.UI.Xaml.UIElement CurrentAnchor{ get; };
00386
00387     Double HorizontalAnchorRatio { get; set; };
00388     Double VerticalAnchorRatio { get; set; };
00389 }
00390
00391 [MUX_PUBLIC]
00392 [webhosthidden]
00393 runtimeclass ItemsRepeaterElementPreparedEventArgs
00394 {
00395     Microsoft.UI.Xaml.UIElement Element { get; };
00396     Int32 Index { get; };
00397 }
00398
00399 [MUX_PUBLIC]
00400 [webhosthidden]
00401 runtimeclass ItemsRepeaterElementClearingEventArgs
00402 {
00403     Microsoft.UI.Xaml.UIElement Element { get; };
00404 }
00405
00406 [MUX_PUBLIC]
00407 [webhosthidden]
00408 runtimeclass ItemsRepeaterElementIndexChangedEventArgs
00409 {
00410     Microsoft.UI.Xaml.UIElement Element { get; };
00411     Int32 OldIndex { get; };
00412     Int32 NewIndex { get; };
00413 }
00414
00415 [MUX_PREVIEW]
00416 [webhosthidden]
00417 struct FlowLayoutAnchorInfo
00418 {
00419     Int32 Index;
00420     Double Offset;
00421 };
00422
00423 [MUX_PREVIEW]
00424 [webhosthidden]
00425 unsealed runtimeclass UniformGridLayoutState
00426 {
00427     UniformGridLayoutState();
00428 }
00429
00430 [MUX_PUBLIC]
00431 [webhosthidden]
00432 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00433 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00434 unsealed runtimeclass UniformGridLayout : VirtualizingLayout
00435 {
00436     UniformGridLayout();
00437
00438     [MUX_DEFAULT_VALUE("winrt::Orientation::Horizontal")]
00439     Microsoft.UI.Xaml.Controls.Orientation Orientation { get; set; };
00440     [MUX_DEFAULT_VALUE("0.0")]
00441     Double MinItemWidth { get; set; };
00442     [MUX_DEFAULT_VALUE("0.0")]
00443     Double MinItemHeight { get; set; };
00444     [MUX_DEFAULT_VALUE("0.0")]
00445     Double MinRowSpacing { get; set; };
00446     [MUX_DEFAULT_VALUE("0.0")]
00447     Double MinColumnSpacing { get; set; };
00448     [MUX_DEFAULT_VALUE("winrt::UniformGridLayoutItemsJustification::Start")]
00449     UniformGridLayoutItemsJustification ItemsJustification{ get; set; };
00450     [MUX_DEFAULT_VALUE("winrt::UniformGridLayoutItemsStretch::None")]
00451     UniformGridLayoutItemsStretch ItemsStretch{ get; set; };
00452     [MUX_DEFAULT_VALUE("-1")]
00453     Int32 MaximumRowsOrColumns{ get; set; };
00454
00455     static Microsoft.UI.Xaml.DependencyProperty OrientationProperty { get; };
00456     static Microsoft.UI.Xaml.DependencyProperty MinItemWidthProperty { get; };
00457     static Microsoft.UI.Xaml.DependencyProperty MinItemHeightProperty { get; };
00458     static Microsoft.UI.Xaml.DependencyProperty MinRowSpacingProperty { get; };
00459     static Microsoft.UI.Xaml.DependencyProperty MinColumnSpacingProperty { get; };
00460     static Microsoft.UI.Xaml.DependencyProperty ItemsJustificationProperty { get; };
00461     static Microsoft.UI.Xaml.DependencyProperty ItemsStretchProperty{ get; };
00462     static Microsoft.UI.Xaml.DependencyProperty MaximumRowsOrColumnsProperty{ get; };
00463 }
00464
00465 [MUX_PREVIEW]
00466 [webhosthidden]
00467 unsealed runtimeclass StackLayoutState
00468 {
00469     StackLayoutState();
00470 }
00471
00472 [MUX_PUBLIC]
00473 [webhosthidden]
00474 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00475 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00476 unsealed runtimeclass StackLayout : VirtualizingLayout
00477 {
00478     StackLayout();
00479
00480     [MUX_DEFAULT_VALUE("winrt::Orientation::Vertical")]
00481     Microsoft.UI.Xaml.Controls.Orientation Orientation { get; set; };
00482     [MUX_DEFAULT_VALUE("0.0")]
00483     Double Spacing { get; set; };
00484
00485     static Microsoft.UI.Xaml.DependencyProperty OrientationProperty { get; };
00486     static Microsoft.UI.Xaml.DependencyProperty SpacingProperty { get; };
00487
00488     [MUX_PREVIEW]
00489     {
00490         [MUX_DEFAULT_VALUE("true")]
00491         Boolean IsVirtualizationEnabled{ get; set; };
00492         static Microsoft.UI.Xaml.DependencyProperty IsVirtualizationEnabledProperty{ get; };
00493     }
00494
00495    // Removing until we are ready to expose.
00496    // overridable FlowLayoutAnchorInfo GetAnchorForRealizationRect(Windows.Foundation.Size availableSize, VirtualizingLayoutContext context);
00497    // overridable Windows.Foundation.Rect GetExtent(Windows.Foundation.Size availableSize, VirtualizingLayoutContext context, Microsoft.UI.Xaml.UIElement firstRealized, Int32 firstRealizedItemIndex, Windows.Foundation.Rect firstRealizedLayoutBounds, Microsoft.UI.Xaml.UIElement lastRealized, Int32 lastRealizedItemIndex, Windows.Foundation.Rect lastRealizedLayoutBounds);
00498    // overridable void OnElementMeasured(Microsoft.UI.Xaml.UIElement element, Int32 index, Windows.Foundation.Size availableSize, Windows.Foundation.Size measureSize, Windows.Foundation.Size desiredSize, Windows.Foundation.Size provisionalArrangeSize, VirtualizingLayoutContext context);
00499 }
00500
00501 [MUX_PREVIEW]
00502 [webhosthidden]
00503 unsealed runtimeclass FlowLayoutState
00504 {
00505     FlowLayoutState();
00506 }
00507
00508 [MUX_PREVIEW]
00509 [webhosthidden]
00510 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00511 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00512 unsealed runtimeclass FlowLayout : VirtualizingLayout
00513 {
00514     FlowLayout();
00515
00516     [MUX_DEFAULT_VALUE("winrt::Orientation::Horizontal")]
00517     Microsoft.UI.Xaml.Controls.Orientation Orientation { get; set; };
00518     [MUX_DEFAULT_VALUE("0.0")]
00519     Double MinRowSpacing { get; set; };
00520     [MUX_DEFAULT_VALUE("0.0")]
00521     Double MinColumnSpacing { get; set; };
00522     [MUX_DEFAULT_VALUE("winrt::FlowLayoutLineAlignment::Start")]
00523     FlowLayoutLineAlignment LineAlignment { get; set; };
00524
00525     static Microsoft.UI.Xaml.DependencyProperty OrientationProperty { get; };
00526     static Microsoft.UI.Xaml.DependencyProperty MinRowSpacingProperty { get; };
00527     static Microsoft.UI.Xaml.DependencyProperty MinColumnSpacingProperty { get; };
00528     static Microsoft.UI.Xaml.DependencyProperty LineAlignmentProperty { get; };
00529
00530     overridable Windows.Foundation.Size GetMeasureSize(Int32 index, Windows.Foundation.Size availableSize);
00531     overridable Windows.Foundation.Size GetProvisionalArrangeSize(Int32 index, Windows.Foundation.Size measureSize, Windows.Foundation.Size desiredSize);
00532     overridable Boolean ShouldBreakLine(Int32 index, Double remainingSpace);
00533     overridable FlowLayoutAnchorInfo GetAnchorForRealizationRect(Windows.Foundation.Size availableSize, VirtualizingLayoutContext context);
00534     overridable FlowLayoutAnchorInfo GetAnchorForTargetElement(Int32 targetIndex, Windows.Foundation.Size availableSize, VirtualizingLayoutContext context);
00535     overridable Windows.Foundation.Rect GetExtent(Windows.Foundation.Size availableSize, VirtualizingLayoutContext context, Microsoft.UI.Xaml.UIElement firstRealized, Int32 firstRealizedItemIndex, Windows.Foundation.Rect firstRealizedLayoutBounds, Microsoft.UI.Xaml.UIElement lastRealized, Int32 lastRealizedItemIndex, Windows.Foundation.Rect lastRealizedLayoutBounds);
00536     overridable void OnElementMeasured(Microsoft.UI.Xaml.UIElement element, Int32 index, Windows.Foundation.Size availableSize, Windows.Foundation.Size measureSize, Windows.Foundation.Size desiredSize, Windows.Foundation.Size provisionalArrangeSize, VirtualizingLayoutContext context);
00537     overridable void OnLineArranged(Int32 startIndex, Int32 countInLine, Double lineSize, VirtualizingLayoutContext context);
00538 }
00539
00540 [MUX_PUBLIC_V5]
00541 [webhosthidden]
00542 runtimeclass LinedFlowLayoutItemsInfoRequestedEventArgs
00543 {
00544     Int32 ItemsRangeStartIndex{ get; set; };
00545     Int32 ItemsRangeRequestedLength{ get; };
00546     Double MinWidth{ get; set; };
00547     Double MaxWidth{ get; set; };
00548     void SetDesiredAspectRatios(Double[] values);
00549     void SetMinWidths(Double[] values);
00550     void SetMaxWidths(Double[] values);
00551 }
00552
00553 [MUX_PUBLIC_V5]
00554 [webhosthidden]
00555 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00556 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00557 unsealed runtimeclass LinedFlowLayout : VirtualizingLayout
00558 {
00559     LinedFlowLayout();
00560
00561     event Windows.Foundation.TypedEventHandler<LinedFlowLayout, LinedFlowLayoutItemsInfoRequestedEventArgs> ItemsInfoRequested;
00562     event Windows.Foundation.TypedEventHandler<LinedFlowLayout, Object> ItemsUnlocked;
00563
00564     [MUX_DEFAULT_VALUE("LinedFlowLayout::s_defaultItemsJustification")]
00565     LinedFlowLayoutItemsJustification ItemsJustification{ get; set; };
00566     [MUX_DEFAULT_VALUE("LinedFlowLayout::s_defaultItemsStretch")]
00567     LinedFlowLayoutItemsStretch ItemsStretch{ get; set; };
00568     [MUX_DEFAULT_VALUE("LinedFlowLayout::s_defaultMinItemSpacing")]
00569     Double MinItemSpacing{ get; set; };
00570     [MUX_DEFAULT_VALUE("LinedFlowLayout::s_defaultLineSpacing")]
00571     Double LineSpacing{ get; set; };
00572     [MUX_DEFAULT_VALUE("LinedFlowLayout::s_defaultLineHeight")]
00573     Double LineHeight{ get; set; };
00574     [MUX_DEFAULT_VALUE("LinedFlowLayout::s_defaultActualLineHeight")]
00575     Double ActualLineHeight{ get; };
00576     Int32 RequestedRangeStartIndex{ get; };
00577     Int32 RequestedRangeLength{ get; };
00578
00579     void InvalidateItemsInfo();
00580     Int32 LockItemToLine(Int32 itemIndex);
00581
00582     static Microsoft.UI.Xaml.DependencyProperty ItemsJustificationProperty{ get; };
00583     static Microsoft.UI.Xaml.DependencyProperty ItemsStretchProperty{ get; };
00584     static Microsoft.UI.Xaml.DependencyProperty MinItemSpacingProperty{ get; };
00585     static Microsoft.UI.Xaml.DependencyProperty LineSpacingProperty{ get; };
00586     static Microsoft.UI.Xaml.DependencyProperty LineHeightProperty{ get; };
00587     static Microsoft.UI.Xaml.DependencyProperty ActualLineHeightProperty{ get; };
00588 }
00589
00590 [MUX_PREVIEW]
00591 [webhosthidden]
00592 [MUX_OVERRIDE_ENSURE_PROPERTIES]
00593 unsealed runtimeclass RecyclePool
00594 {
00595     RecyclePool();
00596
00597     [method_name("PutElement")]
00598     void PutElement(Microsoft.UI.Xaml.UIElement element, String key);
00599     [method_name("PutElementWithOwner")]
00600     void PutElement(Microsoft.UI.Xaml.UIElement element, String key, Microsoft.UI.Xaml.UIElement owner);
00601     [method_name("TryGetElement")]
00602     Microsoft.UI.Xaml.UIElement TryGetElement(String key);
00603     [method_name("TryGetElementWithOwner")]
00604     Microsoft.UI.Xaml.UIElement TryGetElement(String key, Microsoft.UI.Xaml.UIElement owner);
00605
00606     static Microsoft.UI.Xaml.DependencyProperty PoolInstanceProperty{ get; };
00607     static RecyclePool GetPoolInstance(Microsoft.UI.Xaml.DataTemplate dataTemplate);
00608     static void SetPoolInstance(Microsoft.UI.Xaml.DataTemplate dataTemplate, RecyclePool value);
00609
00610     overridable void PutElementCore(Microsoft.UI.Xaml.UIElement element, String key, Microsoft.UI.Xaml.UIElement owner);
00611     overridable Microsoft.UI.Xaml.UIElement TryGetElementCore(String key, Microsoft.UI.Xaml.UIElement owner);
00612 }
00613
00614 [MUX_PREVIEW]
00615 [webhosthidden]
00616 runtimeclass SelectTemplateEventArgs
00617 {
00618     String TemplateKey{ get; set; };
00619     Object DataContext { get; };
00620     Microsoft.UI.Xaml.UIElement Owner { get; };
00621 }
00622
00623 [MUX_PREVIEW]
00624 [webhosthidden]
00625 [contentproperty("Templates")]
00626 unsealed runtimeclass RecyclingElementFactory : ElementFactory
00627 {
00628     RecyclingElementFactory();
00629
00630     RecyclePool RecyclePool { get; set; };
00631     Windows.Foundation.Collections.IMap<String, Microsoft.UI.Xaml.DataTemplate> Templates { get; set; };
00632     event Windows.Foundation.TypedEventHandler<RecyclingElementFactory, SelectTemplateEventArgs> SelectTemplateKey;
00633
00634     overridable String OnSelectTemplateKeyCore(Object dataContext, Microsoft.UI.Xaml.UIElement owner);
00635 }
00636
00637 [MUX_PREVIEW]
00638 [webhosthidden]
00639 runtimeclass IndexPath : Windows.Foundation.IStringable
00640 {
00641     Int32 GetSize();
00642     Int32 GetAt(Int32 index);
00643     Int32 CompareTo(IndexPath other);
00644
00645     [default_overload] [method_name("CreateFrom")]
00646     static IndexPath CreateFrom(Int32 index);
00647     [method_name("CreateFromGroupAndItemIndex")]
00648     static IndexPath CreateFrom(Int32 groupIndex, Int32 itemIndex);
00649     static IndexPath CreateFromIndices(Windows.Foundation.Collections.IVector<Int32> indices);
00650 }
00651
00652 [MUX_PREVIEW]
00653 [webhosthidden]
00654 [default_interface]
00655 runtimeclass SelectionModelSelectionChangedEventArgs
00656 {
00657 }
00658
00659 [MUX_PREVIEW]
00660 [webhosthidden]
00661 runtimeclass SelectionModelChildrenRequestedEventArgs
00662 {
00663     Object Source { get; };
00664     IndexPath SourceIndex { get; };
00665     Object Children { get; set; };
00666 }
00667
00668 [MUX_PREVIEW]
00669 [webhosthidden]
00670 unsealed runtimeclass SelectionModel : Microsoft.UI.Xaml.Data.INotifyPropertyChanged
00671 {
00672     SelectionModel();
00673
00674     event Windows.Foundation.TypedEventHandler<SelectionModel, SelectionModelSelectionChangedEventArgs> SelectionChanged;
00675     event Windows.Foundation.TypedEventHandler<SelectionModel, SelectionModelChildrenRequestedEventArgs> ChildrenRequested;
00676     Object Source { get; set; };
00677     Boolean SingleSelect { get; set; };
00678     IndexPath AnchorIndex { get; set; };
00679     IndexPath SelectedIndex { get; set; };
00680     Object SelectedItem { get; };
00681     Windows.Foundation.Collections.IVectorView<Object> SelectedItems { get; };
00682     Windows.Foundation.Collections.IVectorView<IndexPath> SelectedIndices { get; };
00683     [method_name("SetAnchorIndex")]
00684     void SetAnchorIndex(Int32 index);
00685     [method_name("SetAnchorIndexWithGroup")]
00686     void SetAnchorIndex(Int32 groupIndex, Int32 itemIndex);
00687     [default_overload] [method_name("Select")]
00688     void Select(Int32 index);
00689     [method_name("SelectWithGroup")]
00690     void Select(Int32 groupIndex, Int32 itemIndex);
00691     void SelectAt(IndexPath index);
00692     [default_overload] [method_name("Deselect")]
00693     void Deselect(Int32 index);
00694     [method_name("DeselectWithGroup")]
00695     void Deselect(Int32 groupIndex, Int32 itemIndex);
00696     void DeselectAt(IndexPath index);
00697     [default_overload] [method_name("IsSelected")]
00698     Windows.Foundation.IReference<Boolean> IsSelected(Int32 index);
00699     [method_name("IsSelectedWithGroup")]
00700     Windows.Foundation.IReference<Boolean> IsSelected(Int32 groupIndex, Int32 itemIndex);
00701     Windows.Foundation.IReference<Boolean> IsSelectedAt(IndexPath index);
00702     [default_overload] [method_name("SelectRangeFromAnchor")]
00703     void SelectRangeFromAnchor(Int32 index);
00704     [method_name("SelectRangeFromAnchorWithGroup")]
00705     void SelectRangeFromAnchor(Int32 groupIndex, Int32 itemIndex);
00706     void SelectRangeFromAnchorTo(IndexPath index);
00707     [default_overload] [method_name("DeselectRangeFromAnchor")]
00708     void DeselectRangeFromAnchor(Int32 index);
00709     [method_name("DeselectRangeFromAnchorWithGroup")]
00710     void DeselectRangeFromAnchor(Int32 groupIndex, Int32 itemIndex);
00711     void DeselectRangeFromAnchorTo(IndexPath index);
00712     void SelectRange(IndexPath start, IndexPath end);
00713     void DeselectRange(IndexPath start, IndexPath end);
00714     void SelectAll();
00715     void SelectAllFlat();
00716     void ClearSelection();
00717
00718     protected void OnPropertyChanged(String propertyName);
00719 }
00720
00721 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SelectorBar/TestUI/SelectorBarPage.xaml.cs Source File

  • SelectorBar
  • TestUI

SelectorBarPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Private.Controls;
00008
00009 using WEX.TestExecution;
00010 using WEX.TestExecution.Markup;
00011 using WEX.Logging.Interop;
00012
00013 namespace MUXControlsTestApp
00014 {
00015     [TopLevelTestPage(Name = "SelectorBar")]
00016     public sealed partial class SelectorBarPage : TestPage
00017     {
00018         public SelectorBarPage()
00019         {
00020             LogController.InitializeLogging();
00021             this.InitializeComponent();
00022
00023             navigateToSummary.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SelectorBarSummaryPage), 0); };
00024             navigateToSample.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SelectorBarSamplePage), 0); };
00025         }
00026
00027         private void CmbSelectorBarOutputDebugStringLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
00028         {
00029             if (chkSelectorBar != null && chkSelectorBar.IsChecked == true)
00030             {
00031                 MUXControlsTestHooks.SetOutputDebugStringLevelForType(
00032                     "SelectorBar",
00033                     cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2,
00034                     cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2);
00035             }
00036
00037             if (chkItemsView != null && chkItemsView.IsChecked == true)
00038             {
00039                 MUXControlsTestHooks.SetOutputDebugStringLevelForType(
00040                     "ItemsView",
00041                     cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2,
00042                     cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2);
00043             }
00044
00045             if (chkItemContainer != null && chkItemContainer.IsChecked == true)
00046             {
00047                 MUXControlsTestHooks.SetOutputDebugStringLevelForType(
00048                     "ItemContainer",
00049                     cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2,
00050                     cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2);
00051             }
00052
00053             if (chkItemsRepeater != null && chkItemsRepeater.IsChecked == true)
00054             {
00055                 MUXControlsTestHooks.SetOutputDebugStringLevelForType(
00056                     "ItemsRepeater",
00057                     cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2,
00058                     cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2);
00059             }
00060         }
00061     }
00062 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

CMethodProfileGroup< size > Member List

This is the complete list of members for CMethodProfileGroup< size >, including all inherited members.
CMethodProfileGroup(ProfileGroup group) | CMethodProfileGroup< size > | [inline]
FireEvent(bool bSuspend) noexcept override | CMethodProfileGroup< size > | [inline, virtual]
m_cMethods | CMethodProfileGroup< size > | [private]
m_Counts | CMethodProfileGroup< size > | [private]
m_group | CMethodProfileGroup< size > | [private]
RegisterMethod(UINT16 uTypeIndex, UINT16 uMethodIndex, volatile LONG *pCount) noexcept override | CMethodProfileGroup< size > | [inline, virtual]
TableSize | CMethodProfileGroup< size > | [static]
~CMethodProfileGroup() | CMethodProfileGroup< size > | [inline]
Generated on Sun Dec 1 2024 20:54:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ResourceHelper/Utils.cpp Source File

  • ResourceHelper

Utils.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "Utils.h"
00006
00007 winrt::hstring StringUtil::FormatString(std::wstring_view formatString, ...)
00008 {
00009     va_list pArgs;
00010     va_start(pArgs, formatString);
00011
00012     LPVOID formattedString = nullptr;
00013
00014     // Format the string
00015     FormatMessage(
00016         FORMAT_MESSAGE_ALLOCATE_BUFFER |
00017         FORMAT_MESSAGE_FROM_STRING,
00018         formatString.data(),
00019         0,
00020         0,
00021         (LPTSTR)&formattedString,
00022         0,
00023         &pArgs);
00024
00025     va_end(pArgs);
00026
00027     winrt::hstring result((LPTSTR)formattedString);
00028     LocalFree(formattedString);
00029
00030     return result;
00031 }
00032
00033 std::wstring StringUtil::Utf8ToUtf16(const std::string_view& utf8Str)
00034 {
00035     std::wstring converted;
00036     if (utf8Str.size() > 0)
00037     {
00038         const int length = MultiByteToWideChar(CP_UTF8, 0, utf8Str.data(), (int)utf8Str.size(), nullptr, 0);
00039         if (length > 0)
00040         {
00041             converted.resize(length);
00042             if (MultiByteToWideChar(CP_UTF8, 0, utf8Str.data(), (int)utf8Str.size(), converted.data(), (int)converted.size()) == 0)
00043             {
00044                 winrt::throw_last_error();
00045             }
00046         }
00047         else
00048         {
00049             winrt::throw_last_error();
00050         }
00051     }
00052
00053     return converted;
00054 }
00055
00056 std::string StringUtil::Utf16ToUtf8(const std::wstring_view& utf16Str)
00057 {
00058     std::string converted;
00059     if (utf16Str.size() > 0)
00060     {
00061         const int length = WideCharToMultiByte(CP_UTF8, 0, utf16Str.data(), (int)utf16Str.size(), nullptr, 0, nullptr, nullptr);
00062         if (length > 0)
00063         {
00064             converted.resize(length);
00065             if (WideCharToMultiByte(CP_UTF8, 0, utf16Str.data(), (int)utf16Str.size(), converted.data(), (int)converted.size(), nullptr, nullptr) == 0)
00066             {
00067                 winrt::throw_last_error();
00068             }
00069         }
00070         else
00071         {
00072             winrt::throw_last_error();
00073         }
00074     }
00075
00076     return converted;
00077 }
00078
00079 winrt::VisualStateGroup VisualStateUtil::GetVisualStateGroup(const winrt::FrameworkElement& control, const std::wstring_view& groupName)
00080 {
00081     winrt::VisualStateGroup group{};
00082     auto visualStateGroups = winrt::VisualStateManager::GetVisualStateGroups(control);
00083     for (auto const& visualStateGroup : visualStateGroups)
00084     {
00085         if (visualStateGroup.Name() == groupName)
00086         {
00087             group = visualStateGroup;
00088             return group;
00089         }
00090     }
00091     return group;
00092 }
00093
00094 bool VisualStateUtil::VisualStateGroupExists(const winrt::FrameworkElement& control, const std::wstring_view& groupName)
00095 {
00096     return static_cast<bool>(GetVisualStateGroup(control, groupName));
00097 }
00098
00099 void VisualStateUtil::GoToStateIfGroupExists(const winrt::Control& control, const std::wstring_view& groupName, const std::wstring_view& stateName, bool useTransitions)
00100 {
00101     auto visualStateGroup = GetVisualStateGroup(control, groupName);
00102     if (visualStateGroup)
00103     {
00104         winrt::VisualStateManager::GoToState(control, stateName, useTransitions);
00105     }
00106 }
Generated on Sun Dec 1 2024 20:52:12 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadioMenuFlyoutItem/RadioMenuFlyoutItem.h Source File

  • RadioMenuFlyoutItem

RadioMenuFlyoutItem.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008
00009 #include "RadioMenuFlyoutItem.g.h"
00010 #include "RadioMenuFlyoutItem.properties.h"
00011
00012
00013 // This type exists for RadioMenuFlyoutItem to derive publically from MenuFlyoutItem, but secretly from ToggleMenuFlyoutItem.
00014 template <typename D, typename T, typename ... I>
00015 struct __declspec(empty_bases) DeriveFromToggleMenuFlyoutItemHelper_base : winrt::Microsoft::UI::Xaml::Controls::ToggleMenuFlyoutItemT<D, winrt::default_interface<T>, winrt::composable, I...>
00016 {
00017     using composable = T;
00018     using class_type = typename T;
00019
00020     operator class_type() const noexcept
00021     {
00022         return static_cast<winrt::IInspectable>(*this).as<class_type>();
00023     }
00024
00025     hstring GetRuntimeClassName() const
00026     {
00027         return hstring{ winrt::name_of<T>() };
00028     }
00029
00030     bool InternalIsChecked()
00031     {
00032         return this->IsChecked();
00033     }
00034
00035     void InternalIsChecked(bool value)
00036     {
00037         this->IsChecked(value);
00038     }
00039 };
00040
00041 class RadioMenuFlyoutItem :
00042     public ReferenceTracker<RadioMenuFlyoutItem, DeriveFromToggleMenuFlyoutItemHelper_base, winrt::RadioMenuFlyoutItem>,
00043     public RadioMenuFlyoutItemProperties
00044 {
00045
00046 public:
00047     RadioMenuFlyoutItem();
00048
00049     void OnLoaded(winrt::IInspectable const&, winrt::RoutedEventArgs const&);
00050     void OnUnloaded(winrt::IInspectable const&, winrt::RoutedEventArgs const&);
00051
00052     // IsChecked property is ambiguous with ToggleMenuFlyoutItem, lift up RadioMenuFlyoutItem::IsChecked to disambiguate.
00053     using RadioMenuFlyoutItemProperties::IsChecked;
00054
00055     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00056
00057     static void OnAreCheckStatesEnabledPropertyChanged(const winrt::DependencyObject& sender, const winrt::DependencyPropertyChangedEventArgs& args);
00058
00059 private:
00060     void OnInternalIsCheckedChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args);
00061
00062     void UpdateCheckedItemInGroup();
00063
00064     // Copies of IsChecked & GroupName to avoid using those dependency properties in the ~RadioMenuFlyoutItem() destructor which would lead to crashes.
00065     bool m_isChecked{ false };
00066     winrt::hstring m_groupName{ L"" };
00067
00068     bool m_isSafeUncheck{ false };
00069
00070     PropertyChanged_revoker m_InternalIsCheckedChangedRevoker{};
00071
00072     static thread_local std::unique_ptr<std::map<winrt::hstring, winrt::weak_ref<RadioMenuFlyoutItem>>> s_selectionMap;
00073 };
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnimatedIconSourceProperties Member List

This is the complete list of members for AnimatedIconSourceProperties, including all inherited members.
AnimatedIconSourceProperties() | AnimatedIconSourceProperties |
ClearProperties() | AnimatedIconSourceProperties | [static]
EnsureProperties() | AnimatedIconSourceProperties | [static]
FallbackIconSource(winrt::IconSource const &value) | AnimatedIconSourceProperties |
FallbackIconSource() | AnimatedIconSourceProperties |
FallbackIconSourceProperty() | AnimatedIconSourceProperties | [inline, static]
MirroredWhenRightToLeft(bool value) | AnimatedIconSourceProperties |
MirroredWhenRightToLeft() | AnimatedIconSourceProperties |
MirroredWhenRightToLeftProperty() | AnimatedIconSourceProperties | [inline, static]
s_FallbackIconSourceProperty | AnimatedIconSourceProperties | [static]
s_MirroredWhenRightToLeftProperty | AnimatedIconSourceProperties | [static]
s_SourceProperty | AnimatedIconSourceProperties | [static]
Source(winrt::IAnimatedVisualSource2 const &value) | AnimatedIconSourceProperties |
Source() | AnimatedIconSourceProperties |
SourceProperty() | AnimatedIconSourceProperties | [inline, static]
Generated on Sun Dec 1 2024 20:52:41 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorPickerPage Member List

This is the complete list of members for ColorPickerPage, including all inherited members.
ColorBlueButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
ColorGreenButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
colorNameToolTip | ColorPickerPage | [private]
ColorNameToolTipContentChanged(DependencyObject o, DependencyProperty p) | ColorPickerPage | [inline, private]
ColorPicker_ColorChanged(ColorPicker sender, ColorChangedEventArgs args) | ColorPickerPage | [inline, private]
ColorPicker_Loaded(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
ColorPickerPage() | ColorPickerPage | [inline]
ColorRedButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
ColorSpectrumComponentsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | ColorPickerPage | [inline, private]
ColorSpectrumImage_SizeChanged(object sender, SizeChangedEventArgs e) | ColorPickerPage | [inline, private]
colorSpectrumInputTarget | ColorPickerPage | [private]
ColorSpectrumShapeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | ColorPickerPage | [inline, private]
ColorWhiteButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
FindAndGiveAutomationIdToVisualChild(string childName) | ColorPickerPage | [inline, private]
moreButton | ColorPickerPage | [private]
OrientationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | ColorPickerPage | [inline, private]
PreviousColorBlueButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
PreviousColorCurrentColorButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
PreviousColorGreenButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
PreviousColorNullButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
previousColorRectangle | ColorPickerPage | [private]
PreviousColorRectangleFillChanged(DependencyObject o, DependencyProperty p) | ColorPickerPage | [inline, private]
PreviousColorRedButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
RTLCheckBox_Checked(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
RTLCheckBox_Unchecked(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
selectionEllipse | ColorPickerPage | [private]
selectionEllipsePanel | ColorPickerPage | [private]
SelectionEllipsePositionChanged(DependencyObject o, DependencyProperty p) | ColorPickerPage | [inline, private]
SelectionEllipseStrokeChanged(DependencyObject o, DependencyProperty p) | ColorPickerPage | [inline, private]
spectrumRectangle | ColorPickerPage | [private]
SpectrumRectangleFillChanged(DependencyObject o, DependencyProperty p) | ColorPickerPage | [inline, private]
TestPage_GotFocus(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
ThemeDarkButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
ThemeLightButton_Click(object sender, RoutedEventArgs e) | ColorPickerPage | [inline, private]
UpdateHeightFromInputTarget() | ColorPickerPage | [inline, private]
UpdateSelectedColorName() | ColorPickerPage | [inline, private]
UpdateSelectionEllipseColor() | ColorPickerPage | [inline, private]
UpdateSelectionEllipsePosition() | ColorPickerPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:00 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/APITests/CalendarViewTests.cs Source File

  • CommonStyles
  • APITests

CalendarViewTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using MUXControlsTestApp.Utilities;
00006 using Microsoft.UI.Xaml.Controls;
00007 using Microsoft.UI.Xaml.Media;
00008 using System.Linq;
00009 using System.Collections.Generic;
00010 using System;
00011
00012 using WEX.TestExecution;
00013 using WEX.TestExecution.Markup;
00014 using WEX.Logging.Interop;
00015
00016 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00017 {
00018     [TestClass]
00019     public class CalendarViewTests : ApiTestBase
00020     {
00021         //Issue #6649 Some tests fail when run on OS 21H1
00022         [TestMethod]
00023         [TestProperty("Ignore", "True")] // TODO 29616788: Inconsistent visual tree after converting MUXControlsTestApp to a desktop .NET 5 app.  Re-enable when fixed.
00024         public void VerifyVisualTree()
00025         {
00026             CalendarView calendarView = null;
00027             RunOnUIThread.Execute(() =>
00028             {
00029                 calendarView = new CalendarView();
00030                 calendarView.Width = 400;
00031                 calendarView.Height = 400;
00032                 calendarView.SetDisplayDate(new DateTime(2000, 1, 1));
00033             });
00034             TestUtilities.SetAsVisualTreeRoot(calendarView);
00035
00036             VisualTreeTestHelper.VerifyVisualTree(root: calendarView, verificationFileNamePrefix: "CalendarView");
00037         }
00038     }
00039 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NumberBox/NumberBoxAutomationPeer.h Source File

  • NumberBox

NumberBoxAutomationPeer.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "NumberBox.h"
00007 #include "NumberBoxAutomationPeer.g.h"
00008
00009 class NumberBoxAutomationPeer :
00010     public ReferenceTracker<NumberBoxAutomationPeer, winrt::implementation::NumberBoxAutomationPeerT, winrt::IRangeValueProvider>
00011 {
00012
00013 public:
00014     NumberBoxAutomationPeer(winrt::NumberBox const& owner);
00015
00016     // IAutomationPeerOverrides
00017     winrt::IInspectable GetPatternCore(winrt::PatternInterface const& patternInterface);
00018     hstring GetClassNameCore();
00019     hstring GetNameCore();
00020     winrt::AutomationControlType GetAutomationControlTypeCore();
00021
00022     // IRangeValueProvider
00023     bool IsReadOnly() { return false; }
00024     double Minimum();
00025     double Maximum();
00026     double Value();
00027     double SmallChange();
00028     double LargeChange();
00029     void SetValue(double value);
00030
00031     void RaiseValueChangedEvent(double oldValue, double newValue);
00032
00033 private:
00034     com_ptr<NumberBox> GetImpl();
00035 };
00036
Generated on Sun Dec 1 2024 20:52:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RefreshContainerPage Member List

This is the complete list of members for RefreshContainerPage, including all inherited members.
AdaptButton_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
AddOrRemoveRefreshDelayButton_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
ChangeAlignmentButton_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
ChangeRefreshRequestedButton_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
containerHasHandler | RefreshContainerPage | [private]
ContainerRefreshCompletionDeferral | RefreshContainerPage | [private]
containerTimer | RefreshContainerPage | [private]
containerTimer_Tick(object sender, object e) | RefreshContainerPage | [inline, private]
containerTimer_TickImpl() | RefreshContainerPage | [inline, private]
delayRefresh | RefreshContainerPage | [private]
OnMainPageLoaded(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
OnNavigatedFrom(NavigationEventArgs e) | RefreshContainerPage | [inline, protected]
RCRefreshRequestedComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | RefreshContainerPage | [inline, private]
RCRefreshRequestedComboBoxSwitcher_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
RefreshContainer_RefreshRequested(object sender, RefreshRequestedEventArgs e) | RefreshContainerPage | [inline, private]
RefreshContainerPage() | RefreshContainerPage | [inline]
refreshCount | RefreshContainerPage | [private]
RefreshInfoProvider_InteractionRatioChanged(IRefreshInfoProvider sender, RefreshInteractionRatioChangedEventArgs args) | RefreshContainerPage | [inline, private]
RefreshOnContainerButton_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
RefreshOnVisualizerButton_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
RefreshVisualizer_RefreshRequested(object sender, RefreshRequestedEventArgs e) | RefreshContainerPage | [inline, private]
RefreshVisualizer_RefreshStateChanged(RefreshVisualizer sender, RefreshStateChangedEventArgs args) | RefreshContainerPage | [inline, private]
ResetStates_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
ResetStatesComboBox() | RefreshContainerPage | [inline, private]
RotateButton_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
RVRefreshRequestedComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | RefreshContainerPage | [inline, private]
RVRefreshRequestedComboBoxSwitcher_Click(object sender, RoutedEventArgs e) | RefreshContainerPage | [inline, private]
Sv_ViewChanging(object sender, ScrollViewerViewChangingEventArgs e) | RefreshContainerPage | [inline, private]
UpdateStatesComboBox(RefreshVisualizerState state) | RefreshContainerPage | [inline, private]
VisualizerRefreshCompletionDeferral | RefreshContainerPage | [private]
visualizerTimer | RefreshContainerPage | [private]
visualizerTimer_Tick(object sender, object e) | RefreshContainerPage | [inline, private]
visualizerTimer_TickImpl() | RefreshContainerPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:25 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/LayoutContext.h Source File

  • Repeater

LayoutContext.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "LayoutContext.g.h"
00007
00008 class LayoutContext :
00009     public winrt::implementation::LayoutContextT<LayoutContext, winrt::composable>
00010 {
00011 public:
00012 #pragma region ILayoutContext
00013     winrt::IInspectable LayoutState();
00014     void LayoutState(winrt::IInspectable const& value);
00015 #pragma endregion
00016
00017 #pragma region ILayoutContextOverrides
00018     virtual winrt::IInspectable LayoutStateCore();
00019     virtual void LayoutStateCore(winrt::IInspectable const& state);
00020 #pragma endregion
00021
00022 #ifdef DBG
00023     int Indent()
00024     {
00025         return m_indent;
00026     }
00027
00028     void Indent(int value)
00029     {
00030         m_indent = value;
00031     }
00032
00033 private:
00034     int m_indent{ 0 };
00035 #else
00036     int Indent()
00037     {
00038         return 0;
00039     }
00040 #endif
00041 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SplitButton/SplitButtonTestApi.idl Source File

  • SplitButton

SplitButtonTestApi.idl

Go to the documentation of this file.
00001 namespace MU_PRIVATE_CONTROLS_NAMESPACE
00002 {
00003
00004 [MUX_INTERNAL]
00005 [default_interface]
00006 [webhosthidden]
00007 runtimeclass SplitButtonTestApi
00008 {
00009     static Boolean SimulateTouch{ get; set; };
00010 }
00011
00012 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

auto_unbox Member List

This is the complete list of members for auto_unbox, including all inherited members.
auto_unbox(winrt::IInspectable const &value) | auto_unbox | [inline, explicit]
m_value | auto_unbox | [private]
operator T() const | auto_unbox | [inline]
Generated on Sun Dec 1 2024 20:52:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TitleBarPage Member List

This is the complete list of members for TitleBarPage, including all inherited members.
TitleBarPage() | TitleBarPage | [inline]
TitleBarWindowingButton_Click(object sender, RoutedEventArgs e) | TitleBarPage | [inline, private]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

SwipeControlPage2 Member List

This is the complete list of members for SwipeControlPage2, including all inherited members.
BtnAddItem_Click(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
BtnCancel_Click(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
BtnClose_Click(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
BtnGetBottomItems_Click(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
BtnGetLeftItems_Click(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
BtnGetRightItems_Click(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
BtnGetTopItems_Click(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkPageMethods_Checked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkPageMethods_Unchecked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeControlProperties_Checked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeControlProperties_Unchecked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeEvents_Checked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeEvents_Unchecked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeItemProperties_Checked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeItemProperties_Unchecked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeMethods_Checked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeMethods_Unchecked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeTestHooks_Checked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
ChkSwipeTestHooks_Unchecked(object sender, RoutedEventArgs args) | SwipeControlPage2 | [inline]
pastSender | SwipeControlPage2 | [private]
resetSwipeItemChoices() | SwipeControlPage2 | [inline, private]
SwipeControlPage2() | SwipeControlPage2 | [inline]
SwipeItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args) | SwipeControlPage2 | [inline, private]
Generated on Sun Dec 1 2024 20:54:38 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IDistantSpecularEffect Member List

This is the complete list of members for IDistantSpecularEffect, including all inherited members.
Azimuth([out, retval] float *value) | IDistantSpecularEffect
Azimuth([in] float value) | IDistantSpecularEffect
Elevation([out, retval] float *value) | IDistantSpecularEffect
Elevation([in] float value) | IDistantSpecularEffect
HeightMapInterpolationMode([out, retval] Microsoft.UI.Private.Composition.Effects.CanvasImageInterpolation *value) | IDistantSpecularEffect
HeightMapInterpolationMode([in] Microsoft.UI.Private.Composition.Effects.CanvasImageInterpolation value) | IDistantSpecularEffect
HeightMapKernelSize([out, retval] Windows.Foundation.Numerics.Vector2 *value) | IDistantSpecularEffect
HeightMapKernelSize([in] Windows.Foundation.Numerics.Vector2 value) | IDistantSpecularEffect
HeightMapScale([out, retval] float *value) | IDistantSpecularEffect
HeightMapScale([in] float value) | IDistantSpecularEffect
LightColor([out, retval] Windows.UI.Color *value) | IDistantSpecularEffect
LightColor([in] Windows.UI.Color value) | IDistantSpecularEffect
Source([out, retval] Windows.Graphics.Effects.IGraphicsEffectSource **source) | IDistantSpecularEffect
Source([in] Windows.Graphics.Effects.IGraphicsEffectSource *source) | IDistantSpecularEffect
SpecularAmount([out, retval] float *value) | IDistantSpecularEffect
SpecularAmount([in] float value) | IDistantSpecularEffect
SpecularExponent([out, retval] float *value) | IDistantSpecularEffect
SpecularExponent([in] float value) | IDistantSpecularEffect
Generated on Sun Dec 1 2024 20:53:32 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/VirtualizingLayout.properties.cpp Source File

  • Generated

VirtualizingLayout.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "VirtualizingLayout.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(VirtualizingLayout)
00012 }
00013
00014 #include "VirtualizingLayout.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RatingControl/RatingControl.h Source File

  • RatingControl

RatingControl.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include <RatingItemInfo.h>
00007
00008 #include "RatingControl.g.h"
00009 #include "RatingControl.properties.h"
00010 #include "DispatcherHelper.h"
00011
00012 enum class RatingControlStates
00013 {
00014     Disabled = 0,
00015     Set = 1,
00016     PointerOverSet = 2,
00017     PointerOverPlaceholder = 3, // Also functions as the pointer over unset state at the moment
00018     Placeholder = 4,
00019     Unset = 5,
00020     Null = 6
00021 };
00022
00023 enum class RatingInfoType
00024 {
00025     None,
00026     Font,
00027     Image
00028 };
00029
00030 class RatingControl :
00031     public ReferenceTracker<RatingControl, winrt::implementation::RatingControlT>,
00032     public RatingControlProperties
00033 {
00034 public:
00035     RatingControl();
00036     ~RatingControl();
00037
00038     // IFrameworkElementOverrides
00039     void OnApplyTemplate();
00040
00041     // Property changed handler.
00042     void OnPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00043
00044 public:
00045     // IUIElement / IUIElementOverridesHelper
00046     winrt::AutomationPeer OnCreateAutomationPeer();
00047
00048 private:
00049     // Methods that control rendering
00050     void StampOutRatingItems();
00051     void ReRenderCaption();
00052     void UpdateRatingItemsAppearance();
00053     void ResetControlWidth();
00054
00055     // Methods that handle data
00056     void ChangeRatingBy(double increase, bool originatedFromMouse);
00057     void SetRatingTo(double newRating, bool originatedFromMouse);
00058
00059     // Custom DependencyProperty changed event handlers
00060     void OnCaptionChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00061     void OnFontFamilyChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args);
00062     void OnInitialSetValueChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00063     void OnIsClearEnabledChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00064     void OnIsReadOnlyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00065     void OnItemInfoChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00066     void OnMaxRatingChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00067     void OnPlaceholderValueChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00068     void OnValueChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00069
00070     void OnIsEnabledChanged(const winrt::IInspectable& sender, const winrt::DependencyPropertyChangedEventArgs& args);
00071
00072     // Internal event handlers:
00073     void OnCaptionSizeChanged(const winrt::IInspectable& sender, const winrt::SizeChangedEventArgs& args);
00074     void OnPointerCancelledBackgroundStackPanel(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00075     void OnPointerCaptureLostBackgroundStackPanel(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00076     void OnPointerMovedOverBackgroundStackPanel(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00077     void OnPointerEnteredBackgroundStackPanel(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00078     void OnPointerExitedBackgroundStackPanel(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00079     void PointerExitedImpl(const winrt::PointerRoutedEventArgs& args, bool resetScaleAnimation = true);
00080     void OnPointerPressedBackgroundStackPanel(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00081     void OnPointerReleasedBackgroundStackPanel(const winrt::IInspectable& sender, const winrt::PointerRoutedEventArgs& args);
00082     void OnTextScaleFactorChanged(const winrt::UISettings& setting, const winrt::IInspectable& args);
00083
00084     // Layout calculation helpers, and animations
00085     double CalculateTotalRatingControlWidth();
00086     double CalculateStarCenter(int starIndex);
00087     double CalculateActualRatingWidth();
00088     void ApplyScaleExpressionAnimation(const winrt::UIElement& uiElement, int starIndex);
00089     void PopulateStackPanelWithItems(wstring_view templateName, const winrt::StackPanel& stackPanel, RatingControlStates state);
00090     void CustomizeRatingItem(const winrt::UIElement& ui, RatingControlStates type);
00091     void CustomizeStackPanel(const winrt::StackPanel& stackPanel, RatingControlStates state);
00092     inline bool IsItemInfoPresentAndFontInfo()
00093     {
00094         return m_infoType == RatingInfoType::Font;
00095     };
00096     inline bool IsItemInfoPresentAndImageInfo()
00097     {
00098         return m_infoType == RatingInfoType::Image;
00099     };
00100
00101     winrt::hstring GetAppropriateGlyph(RatingControlStates type);
00102     winrt::hstring GetNextGlyphIfNull(winrt::hstring glyph, RatingControlStates fallbackType = RatingControlStates::Set);
00103     winrt::ImageSource GetAppropriateImageSource(RatingControlStates type);
00104     winrt::ImageSource GetNextImageIfNull(winrt::ImageSource image, RatingControlStates fallbackType = RatingControlStates::Set);
00105
00106 public:
00107     // IControlOverrides / IControlOverridesHelper
00108     void OnKeyDown(winrt::KeyRoutedEventArgs const& e);
00109
00110     // IControlOverrides6 / IControlOverrides6Helper
00111     void OnPreviewKeyDown(winrt::KeyRoutedEventArgs const& e);
00112     void OnPreviewKeyUp(winrt::KeyRoutedEventArgs const& e);
00113
00114 private:
00115     void OnFocusEngaged(const winrt::Control& sender, const winrt::FocusEngagedEventArgs& args);
00116     void OnFocusDisengaged(const winrt::Control& sender, const winrt::FocusDisengagedEventArgs& args);
00117
00118     void EnterGamepadEngagementMode();
00119     void ExitGamepadEngagementMode();
00120
00121     void RecycleEvents(bool useSafeGet = false);
00122
00123     double CoerceValueBetweenMinAndMax(double value);
00124
00125     float RenderingRatingFontSize();
00126     float ActualRatingFontSize();
00127     double ItemSpacing();
00128     void UpdateCaptionMargins();
00129
00130     void EnsureResourcesLoaded();
00131
00132     // Private members
00133     tracker_ref<winrt::StackPanel> m_captionStackPanel{ this };
00134     tracker_ref<winrt::TextBlock> m_captionTextBlock{ this };
00135
00136     winrt::CompositionPropertySet m_sharedPointerPropertySet{ nullptr };
00137
00138     tracker_ref<winrt::StackPanel> m_backgroundStackPanel{ this };
00139     tracker_ref<winrt::StackPanel> m_foregroundStackPanel{ this };
00140
00141     bool m_isPointerOver{ false };
00142     bool m_isPointerDown{ false };
00143     bool m_hasPointerCapture{ false };
00144     double m_mousePercentage{ 0.0 };
00145     double m_firstItemOffset{ 0.0 };
00146
00147     RatingInfoType m_infoType{ RatingInfoType::Font };
00148
00149     // Holds the value of the Rating control at the moment of engagement,
00150     // used to handle cancel-disengagements where we reset the value.
00151     double m_preEngagementValue{ 0.0 };
00152     bool m_disengagedWithA{ false };
00153     bool m_shouldDiscardValue{ true };
00154
00155     winrt::event_token m_pointerCancelledToken{};
00156     winrt::event_token m_pointerCaptureLostToken{};
00157     winrt::event_token m_pointerMovedToken{};
00158     winrt::event_token m_pointerEnteredToken{};
00159     winrt::event_token m_pointerExitedToken{};
00160     winrt::event_token m_pointerPressedToken{};
00161     winrt::event_token m_pointerReleasedToken{};
00162     winrt::event_token m_captionSizeChangedToken{};
00163     winrt::event_token m_fontFamilyChangedToken{};
00164
00165     winrt::UISettings::TextScaleFactorChanged_revoker m_textScaleChangedRevoker{};
00166     static winrt::UISettings GetUISettings();
00167
00168     DispatcherHelper m_dispatcherHelper{ *this };
00169
00170     const double c_defaultFontSizeForRendering{ 32.0 };
00171     const double c_defaultItemSpacing{ 8.0 };
00172
00173     bool m_resourcesLoaded{ false };
00174     double m_fontSizeForRendering{ c_defaultFontSizeForRendering };
00175     double m_itemSpacing{ c_defaultItemSpacing };
00176 };
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ProgressBarTests Member List

This is the complete list of members for ProgressBarTests, including all inherited members.
ResourceOverridablity() ProgressBarTests [inline]
Generated on Sun Dec 1 2024 20:53:35 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/NonVirtualizingLayout.properties.cpp Source File

  • Generated

NonVirtualizingLayout.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "NonVirtualizingLayout.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(NonVirtualizingLayout)
00012 }
00013
00014 #include "NonVirtualizingLayout.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewItemHeader.cpp Source File

  • NavigationView

NavigationViewItemHeader.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "NavigationViewItemHeader.h"
00007 #include "NavigationView.h"
00008
00009 #include "NavigationViewItemHeader.properties.cpp"
00010
00011 static constexpr auto c_rootGrid = L"NavigationViewItemHeaderRootGrid"sv;
00012
00013 NavigationViewItemHeader::NavigationViewItemHeader()
00014 {
00015     SetDefaultStyleKey(this);
00016 }
00017
00018 void NavigationViewItemHeader::OnApplyTemplate()
00019 {
00020     if (auto splitView = GetSplitView())
00021     {
00022         m_splitViewIsPaneOpenChangedRevoker = RegisterPropertyChanged(splitView,
00023             winrt::SplitView::IsPaneOpenProperty(), { this, &NavigationViewItemHeader::OnSplitViewPropertyChanged });
00024         m_splitViewDisplayModeChangedRevoker = RegisterPropertyChanged(splitView,
00025             winrt::SplitView::DisplayModeProperty(), { this, &NavigationViewItemHeader::OnSplitViewPropertyChanged });
00026
00027         UpdateIsClosedCompact();
00028     }
00029
00030     if (auto rootGrid = GetTemplateChildT<winrt::Grid>(c_rootGrid, *this))
00031     {
00032         m_rootGrid.set(rootGrid);
00033     }
00034
00035     UpdateVisualState(false /*useTransitions*/);
00036     UpdateItemIndentation();
00037
00038     auto visual = winrt::ElementCompositionPreview::GetElementVisual(*this);
00039     NavigationView::CreateAndAttachHeaderAnimation(visual);
00040 }
00041
00042 void NavigationViewItemHeader::OnSplitViewPropertyChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& args)
00043 {
00044     if (args == winrt::SplitView::IsPaneOpenProperty() ||
00045         args == winrt::SplitView::DisplayModeProperty())
00046     {
00047         UpdateIsClosedCompact();
00048     }
00049 }
00050
00051 void NavigationViewItemHeader::UpdateIsClosedCompact()
00052 {
00053     if (auto splitView = GetSplitView())
00054     {
00055         // Check if the pane is closed and if the splitview is in either compact mode.
00056         m_isClosedCompact = !splitView.IsPaneOpen() && (splitView.DisplayMode() == winrt::SplitViewDisplayMode::CompactOverlay || splitView.DisplayMode() == winrt::SplitViewDisplayMode::CompactInline);
00057         UpdateVisualState(true /*useTransitions*/);
00058     }
00059 }
00060
00061 void NavigationViewItemHeader::UpdateVisualState(bool useTransitions)
00062 {
00063     winrt::VisualStateManager::GoToState(*this, m_isClosedCompact && IsTopLevelItem() ? L"HeaderTextCollapsed" : L"HeaderTextVisible", useTransitions);
00064
00065     if (auto navigationView = GetNavigationView())
00066     {
00067         winrt::VisualStateManager::GoToState(*this, navigationView.PaneDisplayMode() == winrt::NavigationViewPaneDisplayMode::Top ? L"TopMode" : L"LeftMode", useTransitions);
00068     }
00069 }
00070
00071 void NavigationViewItemHeader::OnNavigationViewItemBaseDepthChanged()
00072 {
00073     UpdateItemIndentation();
00074 }
00075
00076 void NavigationViewItemHeader::UpdateItemIndentation()
00077 {
00078     // Update item indentation based on its depth
00079     if (auto const rootGrid = m_rootGrid.get())
00080     {
00081         auto const oldMargin = rootGrid.Margin();
00082         const auto newLeftMargin = Depth() * c_itemIndentation;
00083         rootGrid.Margin({ static_cast<double>(newLeftMargin), oldMargin.Top, oldMargin.Right, oldMargin.Bottom });
00084     }
00085 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/RepeaterTests.cs Source File

  • Repeater
  • APITests

RepeaterTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using MUXControlsTestApp.Utilities;
00005 using System;
00006 using System.Linq;
00007 using Windows.UI;
00008 using Microsoft.UI.Xaml;
00009 using Microsoft.UI.Xaml.Controls;
00010 using Microsoft.UI.Xaml.Markup;
00011 using Common;
00012 using Microsoft.UI.Xaml.Media;
00013
00014 using WEX.TestExecution;
00015 using WEX.TestExecution.Markup;
00016 using WEX.Logging.Interop;
00017
00018 using System.Collections.ObjectModel;
00019 using System.Threading;
00020 using System.Collections.Generic;
00021 using Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common.Mocks;
00022 using System.Diagnostics;
00023 using System.Runtime.InteropServices;
00024
00025 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests
00026 {
00027     [TestClass]
00028     public class RepeaterTests : ApiTestBase
00029     {
00030         [TestMethod]
00031         public void ValidateElementToIndexMapping()
00032         {
00033             ItemsRepeater repeater = null;
00034             RunOnUIThread.Execute(() =>
00035             {
00036                 var elementFactory = new RecyclingElementFactory();
00037                 elementFactory.RecyclePool = new RecyclePool();
00038                 elementFactory.Templates["Item"] = (DataTemplate)XamlReader.Load(
00039                     @"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
00040                           <TextBlock Text='{Binding}' Height='50' />
00041                       </DataTemplate>");
00042
00043                 repeater = new ItemsRepeater() {
00044                     ItemsSource = Enumerable.Range(0, 10).Select(i => string.Format("Item #{0}", i)),
00045                     ItemTemplate = elementFactory,
00046                     // Default is StackLayout, so do not have to explicitly set.
00047                     // Layout = new StackLayout(),
00048                 };
00049
00050                 Content = new ItemsRepeaterScrollHost() {
00051                     Width = 400,
00052                     Height = 800,
00053                     ScrollViewer = new ScrollViewer {
00054                         Content = repeater
00055                     }
00056                 };
00057
00058                 Content.UpdateLayout();
00059
00060                 for (int i = 0; i < 10; i++)
00061                 {
00062                     var element = repeater.TryGetElement(i);
00063                     Verify.IsNotNull(element);
00064                     Verify.AreEqual(string.Format("Item #{0}", i), ((TextBlock)element).Text);
00065                     Verify.AreEqual(i, repeater.GetElementIndex(element));
00066                 }
00067
00068                 Verify.IsNull(repeater.TryGetElement(20));
00069             });
00070         }
00071
00072         [TestMethod]
00073         public void ValidateRepeaterDefaults()
00074         {
00075             RunOnUIThread.Execute(() =>
00076             {
00077                 var repeater = new ItemsRepeater() {
00078                     ItemsSource = Enumerable.Range(0, 10).Select(i => string.Format("Item #{0}", i)),
00079                 };
00080
00081                 Content = new ItemsRepeaterScrollHost() {
00082                     Width = 400,
00083                     Height = 800,
00084                     ScrollViewer = new ScrollViewer {
00085                         Content = repeater
00086                     }
00087                 };
00088
00089                 Content.UpdateLayout();
00090
00091                 for (int i = 0; i < 10; i++)
00092                 {
00093                     var element = repeater.TryGetElement(i);
00094                     Verify.IsNotNull(element);
00095                     Verify.AreEqual(string.Format("Item #{0}", i), ((TextBlock)element).Text);
00096                     Verify.AreEqual(i, repeater.GetElementIndex(element));
00097                 }
00098
00099                 Verify.IsNull(repeater.TryGetElement(20));
00100             });
00101         }
00102
00103         [TestMethod]
00104         public void CanSetItemsSource()
00105         {
00106             // In bug 12042052, we crash when we set ItemsSource to null because we try to subscribe to
00107             // the DataSourceChanged event on a null instance.
00108             RunOnUIThread.Execute(() =>
00109             {
00110                 {
00111                     var repeater = new ItemsRepeater();
00112                     repeater.ItemsSource = null;
00113                     repeater.ItemsSource = Enumerable.Range(0, 5).Select(i => string.Format("Item #{0}", i));
00114                 }
00115
00116                 {
00117                     var repeater = new ItemsRepeater();
00118                     repeater.ItemsSource = Enumerable.Range(0, 5).Select(i => string.Format("Item #{0}", i));
00119                     repeater.ItemsSource = Enumerable.Range(5, 5).Select(i => string.Format("Item #{0}", i));
00120                     repeater.ItemsSource = null;
00121                     repeater.ItemsSource = Enumerable.Range(10, 5).Select(i => string.Format("Item #{0}", i));
00122                     repeater.ItemsSource = null;
00123                 }
00124             });
00125         }
00126
00127         [TestMethod]
00128         public void ValidateGetSetItemsSource()
00129         {
00130             RunOnUIThread.Execute(() =>
00131             {
00132                 ItemsRepeater repeater = new ItemsRepeater();
00133                 var dataSource = new ItemsSourceView(Enumerable.Range(0, 10).Select(i => string.Format("Item #{0}", i)));
00134                 repeater.SetValue(ItemsRepeater.ItemsSourceProperty, dataSource);
00135                 Verify.AreSame(dataSource, repeater.GetValue(ItemsRepeater.ItemsSourceProperty) as ItemsSourceView);
00136                 Verify.AreSame(dataSource, repeater.ItemsSourceView);
00137             });
00138         }
00139
00140         [TestMethod]
00141         [TestProperty("Ignore", "True")] // Disabled until we have a fix for https://github.com/microsoft/CsWinRT/issues/430
00142         public void ValidateNullItemsSource()
00143         {
00144             RunOnUIThread.Execute(() =>
00145             {
00146                 string errorMessage = string.Empty;
00147                 ItemsRepeater repeater = new ItemsRepeater();
00148                 try
00149                 {
00150                     repeater.GetOrCreateElement(0);
00151                 }
00152                 catch (COMException e)
00153                 {
00154                     errorMessage = e.Message;
00155                 }
00156                 //Make sure that we threw E_FAIL
00157                 string expectedErrorMessage = "ItemSource doesn't have a value";
00158                 Log.Comment($"Expected error message: '{expectedErrorMessage}'");
00159                 Log.Comment($"Actual error message: '{errorMessage}'");
00160                 Verify.IsTrue(errorMessage.Contains(expectedErrorMessage));
00161             });
00162         }
00163
00164
00165         [TestMethod]
00166         public void VerifyClearingItemsSourceClearsElements()
00167         {
00168             var data = new ObservableCollection<string>(Enumerable.Range(0, 4).Select(i => "Item #" + i));
00169             var mapping = (List<ContentControl>)null;
00170
00171             RunOnUIThread.Execute(() =>
00172             {
00173                 mapping = Enumerable.Range(0, data.Count).Select(i => new ContentControl { Width = 40, Height = 40 }).ToList();
00174
00175                 var dataSource = MockItemsSource.CreateDataSource(data, supportsUniqueIds: false);
00176                 var elementFactory = MockElementFactory.CreateElementFactory(mapping);
00177                 ItemsRepeater repeater = new ItemsRepeater();
00178                 repeater.ItemsSource = dataSource;
00179                 repeater.ItemTemplate = elementFactory;
00180                 // This was an issue only for NonVirtualizing layouts
00181                 repeater.Layout = new MyCustomNonVirtualizingStackLayout();
00182                 Content = repeater;
00183                 Content.UpdateLayout();
00184
00185                 repeater.ItemsSource = null;
00186             });
00187
00188             foreach (var item in mapping)
00189             {
00190                 Verify.IsNull(item.Parent);
00191             }
00192         }
00193
00194         [TestMethod]
00195         public void ValidateGetSetBackground()
00196         {
00197             RunOnUIThread.Execute(() =>
00198             {
00199                 ItemsRepeater repeater = new ItemsRepeater();
00200                 var redBrush = new SolidColorBrush(Microsoft.UI.Colors.Red);
00201                 repeater.SetValue(ItemsRepeater.BackgroundProperty, redBrush);
00202                 Verify.AreSame(redBrush, repeater.GetValue(ItemsRepeater.BackgroundProperty) as Brush);
00203                 Verify.AreSame(redBrush, repeater.Background);
00204
00205                 var blueBrush = new SolidColorBrush(Microsoft.UI.Colors.Blue);
00206                 repeater.Background = blueBrush;
00207                 Verify.AreSame(blueBrush, repeater.Background);
00208             });
00209         }
00210
00211         //[TestMethod] 24022837
00212         public void VerifyCurrentAnchor()
00213         {
00214             if (PlatformConfiguration.IsDebugBuildConfiguration())
00215             {
00216                 // Test is failing in chk configuration due to:
00217                 // Bug #1726 Test Failure: RepeaterTests.VerifyCurrentAnchor
00218                 Log.Warning("Skipping test for Debug builds.");
00219                 return;
00220             }
00221
00222             ItemsRepeater rootRepeater = null;
00223             ScrollViewer scrollViewer = null;
00224             ItemsRepeaterScrollHost scrollhost = null;
00225             ManualResetEvent viewChanged = new ManualResetEvent(false);
00226             RunOnUIThread.Execute(() =>
00227             {
00228                 scrollhost = (ItemsRepeaterScrollHost)XamlReader.Load(
00229                   @"<controls:ItemsRepeaterScrollHost Width='400' Height='600'
00230                      xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
00231                      xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
00232                      xmlns:controls='using:Microsoft.UI.Xaml.Controls'>
00233                     <controls:ItemsRepeaterScrollHost.Resources>
00234                         <DataTemplate x:Key='ItemTemplate' >
00235                             <TextBlock Text='{Binding}' Height='50'/>
00236                         </DataTemplate>
00237                     </controls:ItemsRepeaterScrollHost.Resources>
00238                     <ScrollViewer x:Name='scrollviewer'>
00239                         <controls:ItemsRepeater x:Name='rootRepeater' ItemTemplate='{StaticResource ItemTemplate}' VerticalCacheLength='0' />
00240                     </ScrollViewer>
00241                 </controls:ItemsRepeaterScrollHost>");
00242
00243                 rootRepeater = (ItemsRepeater)scrollhost.FindName("rootRepeater");
00244                 scrollViewer = (ScrollViewer)scrollhost.FindName("scrollviewer");
00245                 scrollViewer.ViewChanged += (sender, args) =>
00246                 {
00247                     if (!args.IsIntermediate)
00248                     {
00249                         viewChanged.Set();
00250                     }
00251                 };
00252
00253                 rootRepeater.ItemsSource = Enumerable.Range(0, 500);
00254                 Content = scrollhost;
00255             });
00256
00257             // scroll down several times and validate current anchor
00258             for (int i = 1; i < 10; i++)
00259             {
00260                 IdleSynchronizer.Wait();
00261                 RunOnUIThread.Execute(() =>
00262                 {
00263                     scrollViewer.ChangeView(null, i * 200, null);
00264                 });
00265
00266                 Verify.IsTrue(viewChanged.WaitOne(DefaultWaitTimeInMS));
00267                 viewChanged.Reset();
00268                 IdleSynchronizer.Wait();
00269
00270                 RunOnUIThread.Execute(() =>
00271                 {
00272                     Verify.AreEqual(i * 200, scrollViewer.VerticalOffset);
00273                     var anchor = scrollViewer.CurrentAnchor;
00274                     var anchorIndex = rootRepeater.GetElementIndex(anchor);
00275                     Log.Comment("CurrentAnchor: " + anchorIndex);
00276                     Verify.AreEqual(i * 4, anchorIndex);
00277                 });
00278             }
00279         }
00280
00281         // Ensure that scrolling a nested repeater works when the
00282         // Itemtemplates are data templates.
00283         [TestMethod]
00284         public void NestedRepeaterWithDataTemplateScenario()
00285         {
00286             NestedRepeaterWithDataTemplateScenario(disableAnimation: true);
00287             NestedRepeaterWithDataTemplateScenario(disableAnimation: false);
00288         }
00289
00290         [TestMethod]
00291         public void VerifyFocusedItemIsRecycledOnCollectionReset()
00292         {
00293             List<Layout> layouts = new List<Layout>();
00294             RunOnUIThread.Execute(() =>
00295             {
00296                 layouts.Add(new MyCustomNonVirtualizingStackLayout());
00297                 layouts.Add(new StackLayout());
00298             });
00299
00300             foreach (var layout in layouts)
00301             {
00302                 List<string> items = new List<string> { "item0", "item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8", "item9" };
00303                 const int targetIndex = 4;
00304                 string targetItem = items[targetIndex];
00305                 ItemsRepeater repeater = null;
00306
00307                 RunOnUIThread.Execute(() =>
00308                 {
00309                     repeater = new ItemsRepeater() {
00310                         ItemsSource = items,
00311                         ItemTemplate = CreateDataTemplateWithContent(@"<Button Content='{Binding}'/>"),
00312                         Layout = layout
00313                     };
00314                     Content = repeater;
00315                 });
00316
00317                 IdleSynchronizer.Wait();
00318
00319                 RunOnUIThread.Execute(() =>
00320                 {
00321                     Log.Comment("Setting Focus on item " + targetIndex);
00322                     Button toFocus = (Button)repeater.TryGetElement(targetIndex);
00323                     Verify.AreEqual(targetItem, toFocus.Content as string);
00324                     toFocus.Focus(FocusState.Keyboard);
00325                 });
00326
00327                 IdleSynchronizer.Wait();
00328
00329                 RunOnUIThread.Execute(() =>
00330                 {
00331                     Log.Comment("Removing focused element from collection");
00332                     items.Remove(targetItem);
00333
00334                     Log.Comment("Reset the collection with an empty list");
00335                     repeater.ItemsSource = new List<string>();
00336                 });
00337
00338                 IdleSynchronizer.Wait();
00339
00340                 RunOnUIThread.Execute(() =>
00341                 {
00342                     Log.Comment("Verify new elements");
00343                     for (int i = 0; i < items.Count; i++)
00344                     {
00345                         Button currentButton = (Button)repeater.TryGetElement(i);
00346                         Verify.IsNull(currentButton);
00347                     }
00348                 });
00349             }
00350         }
00351
00352         private DataTemplate CreateDataTemplateWithContent(string content)
00353         {
00354             return (DataTemplate)XamlReader.Load(@"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>" + content + @"</DataTemplate>");
00355         }
00356
00357         private void NestedRepeaterWithDataTemplateScenario(bool disableAnimation)
00358         {
00359             if (!disableAnimation)
00360             {
00361                 Log.Warning("This test is showing consistent issues with not scrolling enough, tracked by microsoft-ui-xaml#779");
00362                 return;
00363             }
00364
00365             // Example of how to include debug tracing in an ApiTests.ItemsRepeater test's output.
00366             // using (PrivateLoggingHelper privateLoggingHelper = new PrivateLoggingHelper("ItemsRepeater"))
00367             // {
00368             ItemsRepeater rootRepeater = null;
00369             ScrollViewer scrollViewer = null;
00370             ManualResetEvent viewChanged = new ManualResetEvent(false);
00371             RunOnUIThread.Execute(() =>
00372             {
00373                 var anchorProvider = (ItemsRepeaterScrollHost)XamlReader.Load(
00374                     @"<controls:ItemsRepeaterScrollHost Width='400' Height='600'
00375                         xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
00376                         xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
00377                         xmlns:controls='using:Microsoft.UI.Xaml.Controls'>
00378                     <controls:ItemsRepeaterScrollHost.Resources>
00379                         <DataTemplate x:Key='ItemTemplate' >
00380                             <TextBlock Text='{Binding}' />
00381                         </DataTemplate>
00382                         <DataTemplate x:Key='GroupTemplate'>
00383                             <StackPanel>
00384                                 <TextBlock Text='{Binding}' />
00385                                 <controls:ItemsRepeater ItemTemplate='{StaticResource ItemTemplate}' ItemsSource='{Binding}' VerticalCacheLength='0'/>
00386                             </StackPanel>
00387                         </DataTemplate>
00388                     </controls:ItemsRepeaterScrollHost.Resources>
00389                     <ScrollViewer x:Name='scrollviewer'>
00390                         <controls:ItemsRepeater x:Name='rootRepeater' ItemTemplate='{StaticResource GroupTemplate}' VerticalCacheLength='0' />
00391                     </ScrollViewer>
00392                 </controls:ItemsRepeaterScrollHost>");
00393
00394                 rootRepeater = (ItemsRepeater)anchorProvider.FindName("rootRepeater");
00395                 rootRepeater.SizeChanged += (sender, args) =>
00396                 {
00397                     Log.Comment($"SizeChanged: Size=({rootRepeater.ActualWidth} x {rootRepeater.ActualHeight})");
00398                 };
00399
00400                 scrollViewer = (ScrollViewer)anchorProvider.FindName("scrollviewer");
00401                 scrollViewer.ViewChanging += (sender, args) =>
00402                 {
00403                     Log.Comment($"ViewChanging: Next VerticalOffset={args.NextView.VerticalOffset}, Final VerticalOffset={args.FinalView.VerticalOffset}");
00404                 };
00405                 scrollViewer.ViewChanged += (sender, args) =>
00406                 {
00407                     Log.Comment($"ViewChanged: VerticalOffset={scrollViewer.VerticalOffset}, IsIntermediate={args.IsIntermediate}");
00408
00409                     if (!args.IsIntermediate)
00410                     {
00411                         viewChanged.Set();
00412                     }
00413                 };
00414
00415                 var itemsSource = new ObservableCollection<ObservableCollection<int>>();
00416                 for (int i = 0; i < 100; i++)
00417                 {
00418                     itemsSource.Add(new ObservableCollection<int>(Enumerable.Range(0, 5)));
00419                 };
00420
00421                 rootRepeater.ItemsSource = itemsSource;
00422                 Content = anchorProvider;
00423             });
00424
00425             // scroll down several times to cause recycling of elements
00426             for (int i = 1; i < 10; i++)
00427             {
00428                 IdleSynchronizer.Wait();
00429                 RunOnUIThread.Execute(() =>
00430                 {
00431                     Log.Comment($"Size=({rootRepeater.ActualWidth} x {rootRepeater.ActualHeight})");
00432                     Log.Comment($"ChangeView(VerticalOffset={i * 200})");
00433                     scrollViewer.ChangeView(null, i * 200, null, disableAnimation);
00434                 });
00435
00436                 Log.Comment("Waiting for view change completion...");
00437                 Verify.IsTrue(viewChanged.WaitOne(DefaultWaitTimeInMS));
00438                 viewChanged.Reset();
00439                 Log.Comment("View change completed");
00440
00441                 RunOnUIThread.Execute(() =>
00442                 {
00443                     Verify.AreEqual(i * 200, scrollViewer.VerticalOffset);
00444                 });
00445             }
00446             // }
00447         }
00448
00449         // ScrollViewer scrolls vertically, but there is an inner
00450         // repeater which flows horizontally which needs corrections to be handled.
00451         //[TestMethod] 24022837
00452         public void VerifyCorrectionsInNonScrollableDirection()
00453         {
00454             ItemsRepeater rootRepeater = null;
00455             ScrollViewer scrollViewer = null;
00456             ItemsRepeaterScrollHost scrollhost = null;
00457             ManualResetEvent viewChanged = new ManualResetEvent(false);
00458             RunOnUIThread.Execute(() =>
00459             {
00460                 scrollhost = (ItemsRepeaterScrollHost)XamlReader.Load(
00461                   @"<controls:ItemsRepeaterScrollHost Width='400' Height='600'
00462                      xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
00463                      xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
00464                      xmlns:controls='using:Microsoft.UI.Xaml.Controls'>
00465                     <ScrollViewer Width='400' Height='400' x:Name='scrollviewer'>
00466                         <controls:ItemsRepeater x:Name='repeater'>
00467                             <DataTemplate>
00468                                 <StackPanel>
00469                                     <controls:ItemsRepeater ItemsSource='{Binding}'>
00470                                         <controls:ItemsRepeater.Layout>
00471                                             <controls:StackLayout Orientation='Horizontal' />
00472                                         </controls:ItemsRepeater.Layout>
00473                                     </controls:ItemsRepeater>
00474                                 </StackPanel>
00475                             </DataTemplate>
00476                         </controls:ItemsRepeater>
00477                     </ScrollViewer>
00478                 </controls:ItemsRepeaterScrollHost>");
00479
00480                 rootRepeater = (ItemsRepeater)scrollhost.FindName("repeater");
00481                 scrollViewer = (ScrollViewer)scrollhost.FindName("scrollviewer");
00482                 scrollViewer.ViewChanged += (sender, args) =>
00483                 {
00484                     if (!args.IsIntermediate)
00485                     {
00486                         viewChanged.Set();
00487                     }
00488                 };
00489
00490                 List<List<int>> items = new List<List<int>>();
00491                 for (int i = 0; i < 100; i++)
00492                 {
00493                     items.Add(Enumerable.Range(0, 4).ToList());
00494                 }
00495                 rootRepeater.ItemsSource = items;
00496                 Content = scrollhost;
00497             });
00498
00499             // scroll down several times and validate no crash
00500             for (int i = 1; i < 5; i++)
00501             {
00502                 IdleSynchronizer.Wait();
00503                 RunOnUIThread.Execute(() =>
00504                 {
00505                     scrollViewer.ChangeView(null, i * 200, null);
00506                 });
00507
00508                 Verify.IsTrue(viewChanged.WaitOne(DefaultWaitTimeInMS));
00509                 viewChanged.Reset();
00510             }
00511         }
00512
00513
00514         [TestMethod]
00515         public void VerifyStoreScenarioCache()
00516         {
00517             ItemsRepeater rootRepeater = null;
00518             RunOnUIThread.Execute(() =>
00519             {
00520                 var scrollhost = (ItemsRepeaterScrollHost)XamlReader.Load(
00521                   @" <controls:ItemsRepeaterScrollHost Width='400' Height='200'
00522                         xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
00523                         xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
00524                         xmlns:controls='using:Microsoft.UI.Xaml.Controls'>
00525                         <controls:ItemsRepeaterScrollHost.Resources>
00526                             <DataTemplate x:Key='ItemTemplate' >
00527                                 <TextBlock Text='{Binding}' Height='100' Width='100'/>
00528                             </DataTemplate>
00529                             <DataTemplate x:Key='GroupTemplate'>
00530                                 <StackPanel>
00531                                     <TextBlock Text='{Binding}' />
00532                                     <controls:ItemsRepeaterScrollHost>
00533                                         <ScrollViewer HorizontalScrollMode='Enabled' VerticalScrollMode='Disabled' HorizontalScrollBarVisibility='Auto' VerticalScrollBarVisibility='Hidden'>
00534                                             <controls:ItemsRepeater ItemTemplate='{StaticResource ItemTemplate}' ItemsSource='{Binding}'>
00535                                                 <controls:ItemsRepeater.Layout>
00536                                                     <controls:StackLayout Orientation='Horizontal' />
00537                                                 </controls:ItemsRepeater.Layout>
00538                                             </controls:ItemsRepeater>
00539                                         </ScrollViewer>
00540                                     </controls:ItemsRepeaterScrollHost>
00541                                 </StackPanel>
00542                             </DataTemplate>
00543                         </controls:ItemsRepeaterScrollHost.Resources>
00544                         <ScrollViewer x:Name='scrollviewer'>
00545                             <controls:ItemsRepeater x:Name='rootRepeater' ItemTemplate='{StaticResource GroupTemplate}'/>
00546                         </ScrollViewer>
00547                     </controls:ItemsRepeaterScrollHost>");
00548
00549                 rootRepeater = (ItemsRepeater)scrollhost.FindName("rootRepeater");
00550
00551                 List<List<int>> items = new List<List<int>>();
00552                 for (int i = 0; i < 100; i++)
00553                 {
00554                     items.Add(Enumerable.Range(0, 4).ToList());
00555                 }
00556                 rootRepeater.ItemsSource = items;
00557                 Content = scrollhost;
00558             });
00559
00560             IdleSynchronizer.Wait();
00561
00562             // Verify that first items outside the visible range but in the realized range
00563             // for the inner of the nested repeaters are realized.
00564             RunOnUIThread.Execute(() =>
00565             {
00566                 // Group2 will be outside the visible range but within the realized range.
00567                 var group2 = rootRepeater.TryGetElement(2) as StackPanel;
00568                 Verify.IsNotNull(group2);
00569
00570                 var group2Repeater = ((ItemsRepeaterScrollHost)group2.Children[1]).ScrollViewer.Content as ItemsRepeater;
00571                 Verify.IsNotNull(group2Repeater);
00572
00573                 Verify.IsNotNull(group2Repeater.TryGetElement(0));
00574             });
00575         }
00576
00577
00578         [TestMethod]
00579         public void VerifyUIElementsInItemsSource()
00580         {
00581             ItemsRepeater repeater = null;
00582             RunOnUIThread.Execute(() =>
00583             {
00584                 var scrollhost = (ItemsRepeaterScrollHost)XamlReader.Load(
00585                   @"<controls:ItemsRepeaterScrollHost
00586                      xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
00587                      xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
00588                      xmlns:local='using:MUXControlsTestApp.Samples'
00589                      xmlns:controls='using:Microsoft.UI.Xaml.Controls'>
00590                         <ScrollViewer>
00591                             <controls:ItemsRepeater x:Name='repeater'>
00592                                 <controls:ItemsRepeater.ItemsSource>
00593                                     <local:UICollection>
00594                                         <Button>0</Button>
00595                                         <Button>1</Button>
00596                                         <Button>2</Button>
00597                                         <Button>3</Button>
00598                                         <Button>4</Button>
00599                                         <Button>5</Button>
00600                                         <Button>6</Button>
00601                                         <Button>7</Button>
00602                                         <Button>8</Button>
00603                                         <Button>9</Button>
00604                                     </local:UICollection>
00605                                 </controls:ItemsRepeater.ItemsSource>
00606                             </controls:ItemsRepeater>
00607                         </ScrollViewer>
00608                     </controls:ItemsRepeaterScrollHost>");
00609
00610                 repeater = (ItemsRepeater)scrollhost.FindName("repeater");
00611                 Content = scrollhost;
00612             });
00613
00614             IdleSynchronizer.Wait();
00615
00616             RunOnUIThread.Execute(() =>
00617             {
00618                 for (int i = 0; i < 10; i++)
00619                 {
00620                     var element = repeater.TryGetElement(i) as Button;
00621                     Verify.AreEqual(i.ToString(), element.Content);
00622                 }
00623             });
00624         }
00625
00626         [TestMethod]
00627         [TestProperty("Ignore", "True")] // Task 32541584: Failing test: RepeaterTests.VerifyRepeaterDoesNotLeakItemContainers
00628         public void VerifyRepeaterDoesNotLeakItemContainers()
00629         {
00630             ObservableCollection<int> items = new ObservableCollection<int>();
00631             for (int i = 0; i < 10; i++)
00632             {
00633                 items.Add(i);
00634             }
00635
00636             ItemsRepeater repeater = null;
00637
00638             RunOnUIThread.Execute(() =>
00639             {
00640                 var template = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' "
00641                     + "xmlns:local='using:MUXControlsTestApp.Samples'>"
00642                     + "<local:DisposableUserControl Number='{Binding}'/>"
00643                     + "</DataTemplate>");
00644                 Verify.IsNotNull(template);
00645                 Verify.AreEqual(0, MUXControlsTestApp.Samples.DisposableUserControl.OpenItems, "Verify we start with 0 DisposableUserControl");
00646
00647                 repeater = new ItemsRepeater() {
00648                     ItemsSource = items,
00649                     ItemTemplate = template,
00650                     VerticalAlignment = VerticalAlignment.Top,
00651                     HorizontalAlignment = HorizontalAlignment.Left
00652                 };
00653
00654                 Content = repeater;
00655
00656             });
00657
00658             IdleSynchronizer.Wait();
00659
00660             RunOnUIThread.Execute(() =>
00661             {
00662
00663                 Verify.IsGreaterThanOrEqual(MUXControlsTestApp.Samples.DisposableUserControl.OpenItems, 10, "Verify we created at least 10 DisposableUserControl");
00664
00665                 // Clear out the repeater and make sure everything gets cleaned up.
00666                 Content = null;
00667                 repeater = null;
00668             });
00669
00670             IdleSynchronizer.Wait();
00671
00672             GC.Collect();
00673             GC.WaitForPendingFinalizers();
00674             GC.Collect();
00675
00676             Verify.AreEqual(0, MUXControlsTestApp.Samples.DisposableUserControl.OpenItems, "Verify we cleaned up all the DisposableUserControl that were created");
00677         }
00678
00679         [TestMethod]
00680         public void BringIntoViewOfExistingItemsDoesNotChangeScrollOffset()
00681         {
00682             ScrollViewer scrollViewer = null;
00683             ItemsRepeater repeater = null;
00684             AutoResetEvent scrollViewerScrolledEvent = new AutoResetEvent(false);
00685
00686             RunOnUIThread.Execute(() =>
00687             {
00688                 repeater = new ItemsRepeater();
00689                 repeater.ItemsSource = Enumerable.Range(0, 100).Select(x => x.ToString()).ToList();
00690
00691                 scrollViewer = new ScrollViewer() {
00692                     Content = repeater,
00693                     MaxHeight = 400,
00694                     MaxWidth = 200
00695                 };
00696
00697
00698                 Content = scrollViewer;
00699                 Content.UpdateLayout();
00700             });
00701
00702             IdleSynchronizer.Wait();
00703
00704             RunOnUIThread.Execute(() =>
00705             {
00706                 Log.Comment("Scroll to end");
00707                 scrollViewer.ViewChanged += (object sender, ScrollViewerViewChangedEventArgs e) =>
00708                 {
00709                     if (!e.IsIntermediate)
00710                     {
00711                         Log.Comment("ScrollViewer scrolling finished");
00712                         scrollViewerScrolledEvent.Set();
00713                     }
00714                 };
00715                 scrollViewer.ChangeView(null, repeater.ActualHeight, null);
00716                 scrollViewer.UpdateLayout();
00717             });
00718
00719             Log.Comment("Wait for scrolling");
00720             if (Debugger.IsAttached)
00721             {
00722                 scrollViewerScrolledEvent.WaitOne();
00723             }
00724             else
00725             {
00726                 if (!scrollViewerScrolledEvent.WaitOne(TimeSpan.FromMilliseconds(5000)))
00727                 {
00728                     throw new Exception("Timeout expiration in WaitForEvent.");
00729                 }
00730             }
00731
00732             IdleSynchronizer.Wait();
00733
00734             double endOfScrollOffset = 0;
00735             RunOnUIThread.Execute(() =>
00736             {
00737                 Log.Comment("Determine scrolled offset");
00738                 endOfScrollOffset = scrollViewer.VerticalOffset;
00739                 // Idea: we might not have scrolled to the end, however we should at least have moved so much that the end is not too far away
00740                 Verify.IsTrue(Math.Abs(endOfScrollOffset - repeater.ActualHeight) < 500, $"We should at least have scrolled some amount. " +
00741                     $"ScrollOffset:{endOfScrollOffset} Repeater height: {repeater.ActualHeight}");
00742
00743                 var lastItem = repeater.GetOrCreateElement(99);
00744                 lastItem.UpdateLayout();
00745                 Log.Comment("Bring last element into view");
00746                 lastItem.StartBringIntoView();
00747             });
00748
00749             IdleSynchronizer.Wait();
00750
00751             RunOnUIThread.Execute(() =>
00752             {
00753                 Log.Comment("Verify position did not change");
00754                 Verify.IsTrue(Math.Abs(endOfScrollOffset - scrollViewer.VerticalOffset) < 1);
00755             });
00756         }
00757
00758     }
00759 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ScrollView/TestUI/ScrollViewWithRTLFlowDirectionPage.xaml.cs Source File

  • ScrollView
  • TestUI

ScrollViewWithRTLFlowDirectionPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.UI.Xaml;
00005
00006 namespace MUXControlsTestApp
00007 {
00008     public sealed partial class ScrollViewWithRTLFlowDirectionPage : TestPage
00009     {
00010         public ScrollViewWithRTLFlowDirectionPage()
00011         {
00012             this.InitializeComponent();
00013         }
00014
00015         private void ChkScrollViewFlowDirection_Checked(object sender, RoutedEventArgs e)
00016         {
00017             if (muxScrollView != null && wuxScrollViewer != null)
00018             {
00019                 muxScrollView.FlowDirection = FlowDirection.RightToLeft;
00020                 wuxScrollViewer.FlowDirection = FlowDirection.RightToLeft;
00021             }
00022         }
00023
00024         private void ChkScrollViewFlowDirection_Unchecked(object sender, RoutedEventArgs e)
00025         {
00026             if (muxScrollView != null && wuxScrollViewer != null)
00027             {
00028                 muxScrollView.FlowDirection = FlowDirection.LeftToRight;
00029                 wuxScrollViewer.FlowDirection = FlowDirection.LeftToRight;
00030             }
00031         }
00032
00033         private void ChkScrollViewContentFlowDirection_Checked(object sender, RoutedEventArgs e)
00034         {
00035             if (muxScrollView != null && wuxScrollViewer != null)
00036             {
00037                 FrameworkElement content = muxScrollView.Content as FrameworkElement;
00038
00039                 if (content != null)
00040                 {
00041                     content.FlowDirection = FlowDirection.RightToLeft;
00042                 }
00043
00044                 content = wuxScrollViewer.Content as FrameworkElement;
00045
00046                 if (content != null)
00047                 {
00048                     content.FlowDirection = FlowDirection.RightToLeft;
00049                 }
00050             }
00051         }
00052
00053         private void ChkScrollViewContentFlowDirection_Unchecked(object sender, RoutedEventArgs e)
00054         {
00055             if (muxScrollView != null && wuxScrollViewer != null)
00056             {
00057                 FrameworkElement content = muxScrollView.Content as FrameworkElement;
00058
00059                 if (content != null)
00060                 {
00061                     content.FlowDirection = FlowDirection.LeftToRight;
00062                 }
00063
00064                 content = wuxScrollViewer.Content as FrameworkElement;
00065
00066                 if (content != null)
00067                 {
00068                     content.FlowDirection = FlowDirection.LeftToRight;
00069                 }
00070             }
00071         }
00072     }
00073 }
Generated on Sun Dec 1 2024 20:52:18 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/CommandBarSummaryPage.xaml.cs Source File

  • CommonStyles
  • TestUI

CommandBarSummaryPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Common;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Controls;
00007 using MUXControlsTestApp.Utilities;
00008
00009 namespace MUXControlsTestApp
00010 {
00011     public sealed partial class CommandBarSummaryPage : TestPage
00012     {
00013         public CommandBarSummaryPage()
00014         {
00015             this.InitializeComponent();
00016         }
00017
00018         private void CB_Opened(object sender, object e)
00019         {
00020             cmbIsOpen.SelectedIndex = 1;
00021         }
00022
00023         private void CB_Closed(object sender, object e)
00024         {
00025             cmbIsOpen.SelectedIndex = 0;
00026         }
00027
00028         private void CmbLabelLength_SelectionChanged(object sender, SelectionChangedEventArgs e)
00029         {
00030             if (cmbLabelLength == null || tb == null) return;
00031
00032             switch (cmbLabelLength.SelectedIndex)
00033             {
00034                 case 0:
00035                     tb.Label = "Dog";
00036                     break;
00037                 case 1:
00038                     tb.Label = "Golden Retriever";
00039                     break;
00040                 default:
00041                     tb.Label = "Distinguished & Unique Old English Sheepdog";
00042                     break;
00043             }
00044         }
00045
00046         private void CmbDefaultLabelPosition_SelectionChanged(object sender, SelectionChangedEventArgs e)
00047         {
00048             if (cmbDefaultLabelPosition == null || cb == null) return;
00049
00050             cb.DefaultLabelPosition = (CommandBarDefaultLabelPosition)cmbDefaultLabelPosition.SelectedIndex;
00051         }
00052
00053         private void CmbClosedDisplayMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
00054         {
00055             if (cmbClosedDisplayMode == null || cb == null) return;
00056
00057             cb.ClosedDisplayMode = (AppBarClosedDisplayMode)cmbClosedDisplayMode.SelectedIndex;
00058         }
00059
00060         private void CmbFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
00061         {
00062             if (cmbFontSize == null) return;
00063
00064             double fontSize = cmbFontSize.SelectedIndex == 0 ? 14 : 40;
00065
00066             if (tb != null)
00067             {
00068                 tb.FontSize = fontSize;
00069             }
00070             if (sb != null)
00071             {
00072                 sb.FontSize = fontSize;
00073             }
00074             if (tsb != null)
00075             {
00076                 tsb.FontSize = fontSize;
00077             }
00078         }
00079
00080         private void CmbIsOpen_SelectionChanged(object sender, SelectionChangedEventArgs e)
00081         {
00082             if (cmbIsOpen == null || cb == null) return;
00083
00084             cb.IsOpen = cmbIsOpen.SelectedIndex == 1;
00085         }
00086
00087         private void CmbIsDynamicOverflowEnabled_SelectionChanged(object sender, SelectionChangedEventArgs e)
00088         {
00089             if (cmbIsDynamicOverflowEnabled == null || cb == null) return;
00090
00091             cb.IsDynamicOverflowEnabled = cmbIsDynamicOverflowEnabled.SelectedIndex == 1;
00092         }
00093
00094         private void CmbHasSecondaryCommand_SelectionChanged(object sender, SelectionChangedEventArgs e)
00095         {
00096             if (cmbHasSecondaryCommand == null || cb == null) return;
00097
00098             if (cmbHasSecondaryCommand.SelectedIndex == 1 && cb.SecondaryCommands.Count == 0)
00099             {
00100                 cb.SecondaryCommands.Add(sc);
00101             }
00102             else if (cmbHasSecondaryCommand.SelectedIndex == 0 && cb.SecondaryCommands.Count == 1)
00103             {
00104                 cb.SecondaryCommands.Clear();
00105             }
00106         }
00107
00108         private void CmbHasSplitButton_SelectionChanged(object sender, SelectionChangedEventArgs e)
00109         {
00110             if (cmbHasSplitButton == null || ecsb == null) return;
00111
00112             if (cmbHasSplitButton.SelectedIndex == 1 && !ecsb.IsLoaded)
00113             {
00114                 cb.PrimaryCommands.Add(ecsb);
00115             }
00116             else if (cmbHasSplitButton.SelectedIndex == 0 && ecsb.IsLoaded)
00117             {
00118                 cb.PrimaryCommands.Remove(ecsb);
00119             }
00120         }
00121
00122         private void CmbHasToggleSplitButton_SelectionChanged(object sender, SelectionChangedEventArgs e)
00123         {
00124             if (cmbHasToggleSplitButton == null || ectsb == null) return;
00125
00126             if (cmbHasToggleSplitButton.SelectedIndex == 1 && !ectsb.IsLoaded)
00127             {
00128                 cb.PrimaryCommands.Add(ectsb);
00129             }
00130             else if (cmbHasToggleSplitButton.SelectedIndex == 0 && ectsb.IsLoaded)
00131             {
00132                 cb.PrimaryCommands.Remove(ectsb);
00133             }
00134         }
00135     }
00136 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: inc/CastHelpers.h Source File

  • inc

CastHelpers.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 struct auto_cast
00007 {
00008     explicit auto_cast(winrt::IInspectable const& value) : m_value(value)
00009     {
00010     }
00011
00012     template <typename T>
00013     operator T() const
00014     {
00015         return m_value.as<T>();
00016     }
00017
00018 private:
00019     winrt::IInspectable const& m_value;
00020 };
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: SwipeControl/SwipeControlInteractionTrackerOwner.h Source File

  • SwipeControl

SwipeControlInteractionTrackerOwner.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "common.h"
00007
00008 // Class that handles the InteractionTracker callbacks. Has a weak reference back to the ScrollPresenter so it can be garbage-collected,
00009 // since the InteractionTracker keeps a strong reference to this object.
00010 class SwipeControlInteractionTrackerOwner
00011     : public winrt::implements<SwipeControlInteractionTrackerOwner, winrt::IInteractionTrackerOwner>
00012 {
00013 public:
00014     SwipeControlInteractionTrackerOwner(const winrt::SwipeControl& swipeControl);
00015     ~SwipeControlInteractionTrackerOwner();
00016
00017 #pragma region IInteractionTrackerOwner
00018     void ValuesChanged(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerValuesChangedArgs& args);
00019     void RequestIgnored(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerRequestIgnoredArgs& args);
00020     void InteractingStateEntered(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerInteractingStateEnteredArgs& args);
00021     void InertiaStateEntered(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerInertiaStateEnteredArgs& args);
00022     void IdleStateEntered(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerIdleStateEnteredArgs& args);
00023     void CustomAnimationStateEntered(const winrt::InteractionTracker& sender, const winrt::InteractionTrackerCustomAnimationStateEnteredArgs& args);
00024 #pragma endregion
00025
00026 private:
00027     weak_ref<winrt::SwipeControl> m_owner{ nullptr };
00028 };
Generated on Sun Dec 1 2024 20:52:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ButtonInteractionPage Member List

This is the complete list of members for ButtonInteractionPage, including all inherited members.
_invokeCount | ButtonInteractionPage | [private]
ButtonInteractionPage() | ButtonInteractionPage | [inline]
Interaction | ButtonInteractionPage |
OnInteractionPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | ButtonInteractionPage | [inline, private]
OnInvokeModeChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) | ButtonInteractionPage | [inline, private]
OnResetInvokeCountClick(object sender, RoutedEventArgs e) | ButtonInteractionPage | [inline, private]
OnTargetElementInvoked(ButtonInteraction sender, ButtonInteractionInvokedEventArgs args) | ButtonInteractionPage | [inline, private]
UpdateRectVisualState() | ButtonInteractionPage | [inline, private]
Generated on Sun Dec 1 2024 20:53:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollingZoomAnimationStartingEventArgs Member List

This is the complete list of members for ScrollingZoomAnimationStartingEventArgs, including all inherited members.
Animation() | ScrollingZoomAnimationStartingEventArgs |
Animation(winrt::CompositionAnimation const &value) | ScrollingZoomAnimationStartingEventArgs |
CenterPoint() | ScrollingZoomAnimationStartingEventArgs |
CorrelationId() | ScrollingZoomAnimationStartingEventArgs |
EndZoomFactor() | ScrollingZoomAnimationStartingEventArgs |
GetAnimation() const | ScrollingZoomAnimationStartingEventArgs |
ScrollingZoomAnimationStartingEventArgs() | ScrollingZoomAnimationStartingEventArgs | [inline]
SetAnimation(const winrt::CompositionAnimation &animation) | ScrollingZoomAnimationStartingEventArgs |
SetCenterPoint(const winrt::float2 &centerPoint) | ScrollingZoomAnimationStartingEventArgs |
SetEndZoomFactor(const float &endZoomFactor) | ScrollingZoomAnimationStartingEventArgs |
SetStartZoomFactor(const float &startZoomFactor) | ScrollingZoomAnimationStartingEventArgs |
SetZoomFactorChangeCorrelationId(int32_t zoomFactorChangeCorrelationId) | ScrollingZoomAnimationStartingEventArgs |
StartZoomFactor() | ScrollingZoomAnimationStartingEventArgs |
~ScrollingZoomAnimationStartingEventArgs() | ScrollingZoomAnimationStartingEventArgs | [inline]
Generated on Sun Dec 1 2024 20:53:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterPage Member List

This is the complete list of members for ScrollPresenterPage, including all inherited members.
BtnSetOffsetsChangeVelocityParameters_Click(object sender, RoutedEventArgs e) | ScrollPresenterPage | [inline, private]
BtnSetZoomFactorChangeVelocityParameters_Click(object sender, RoutedEventArgs e) | ScrollPresenterPage | [inline, private]
CmbScrollPresenterOutputDebugStringLevel_SelectionChanged(object sender, SelectionChangedEventArgs e) | ScrollPresenterPage | [inline, private]
ScrollPresenterPage() | ScrollPresenterPage | [inline]
Generated on Sun Dec 1 2024 20:54:30 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/APITests/Common/OrientationBasedMeasures.cs Source File

  • Repeater
  • APITests
  • Common

OrientationBasedMeasures.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using Microsoft.Graphics.Canvas.Effects;
00005 using MUXControlsTestApp.Utilities;
00006 using Windows.Foundation;
00007 using Windows.UI.Core;
00008 using Microsoft.UI.Xaml.Controls;
00009 using DisplayInformation = Windows.Graphics.Display.DisplayInformation;
00010
00011 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests.RepeaterTests.Common
00012 {
00013     public class OrientationBasedMeasures
00014     {
00015         public ScrollOrientation ScrollOrientation { get; set; }
00016         private double m_rawPixelsPerViewPixel = 1.0;
00017         private bool m_useLayoutRounding;
00018
00019         public bool IsVertical
00020         {
00021             get { return ScrollOrientation == ScrollOrientation.Vertical; }
00022         }
00023
00024         public OrientationBasedMeasures(ScrollOrientation o, bool useLayoutRounding = true)
00025         {
00026             ScrollOrientation = o;
00027             m_useLayoutRounding = useLayoutRounding;
00028
00029             bool? hasThreadAccess = CoreWindow.GetForCurrentThread()?.Dispatcher?.HasThreadAccess;
00030             if (useLayoutRounding && hasThreadAccess.HasValue && hasThreadAccess.Value)
00031                 m_rawPixelsPerViewPixel = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
00032         }
00033
00034         public double Major(Size size)
00035         {
00036             return RoundForLayout(IsVertical ? size.Height : size.Width);
00037         }
00038
00039         public double Minor(Size size)
00040         {
00041             return RoundForLayout(IsVertical ? size.Width : size.Height);
00042         }
00043
00044         public double MajorSize(Rect rect)
00045         {
00046             return RoundForLayout(IsVertical ? rect.Height : rect.Width);
00047         }
00048
00049         public double MinorSize(Rect rect)
00050         {
00051             return RoundForLayout(IsVertical ? rect.Width : rect.Height);
00052         }
00053
00054         public double MajorStart(Rect rect)
00055         {
00056             return RoundForLayout(IsVertical ? rect.Top : rect.Left);
00057         }
00058
00059         public double MajorEnd(Rect rect)
00060         {
00061             return RoundForLayout(IsVertical ? rect.Bottom : rect.Right);
00062         }
00063
00064         public double MinorStart(Rect rect)
00065         {
00066             return RoundForLayout(IsVertical ? rect.Left : rect.Top);
00067         }
00068
00069         public void SetMajorSize(ref Rect rect, double value)
00070         {
00071             if (IsVertical)
00072             {
00073                 rect.Height = RoundForLayout(value);
00074             }
00075             else
00076             {
00077                 rect.Width = RoundForLayout(value);
00078             }
00079         }
00080
00081         public void SetMajorStart(ref Rect rect, double value)
00082         {
00083             if (IsVertical)
00084             {
00085                 rect.Y = RoundForLayout(value);
00086             }
00087             else
00088             {
00089                 rect.X = RoundForLayout(value);
00090             }
00091         }
00092
00093         public void SetMinorStart(ref Rect rect, double value)
00094         {
00095             if (IsVertical)
00096             {
00097                 rect.X = RoundForLayout(value);
00098             }
00099             else
00100             {
00101                 rect.Y = RoundForLayout(value);
00102             }
00103         }
00104
00105         public Rect MinorMajorRect(double minor, double major, double minorSize, double majorSize)
00106         {
00107             var min = RoundForLayout(minor);
00108             var maj = RoundForLayout(major);
00109             var minSize = RoundForLayout(minorSize);
00110             var majSize = RoundForLayout(majorSize);
00111             return
00112                 IsVertical ?
00113                 new Rect(min, maj, minSize, majSize) :
00114                 new Rect(maj, min, majSize, minSize);
00115         }
00116
00117         public Point MinorMajorPoint(double minor, double major)
00118         {
00119             var min = RoundForLayout(minor);
00120             var maj = RoundForLayout(major);
00121             return
00122                 IsVertical ?
00123                 new Point(min, maj) :
00124                 new Point(maj, min);
00125         }
00126
00127         public Size MinorMajorSize(double minor, double major)
00128         {
00129             var min = RoundForLayout(minor);
00130             var maj = RoundForLayout(major);
00131             return
00132                 IsVertical ?
00133                 new Size(min, maj) :
00134                 new Size(maj, min);
00135         }
00136
00137         private double RoundForLayout(double value)
00138         {
00139             if (m_useLayoutRounding)
00140                 return global::System.Math.Floor((m_rawPixelsPerViewPixel * value) + 0.5) / m_rawPixelsPerViewPixel;
00141             else
00142                 return value;
00143         }
00144     }
00145 }
Generated on Sun Dec 1 2024 20:52:07 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeView.idl Source File

  • TreeView

TreeView.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 enum TreeViewSelectionMode
00007 {
00008     None = 0,
00009     Single = 1,
00010     Multiple = 2,
00011 };
00012
00013 [MUX_PUBLIC]
00014 [webhosthidden]
00015 runtimeclass TreeViewItemInvokedEventArgs
00016 {
00017     Object InvokedItem { get; };
00018     Boolean Handled { set; get; };
00019 }
00020
00021 [MUX_PUBLIC]
00022 /*The bindable tag is needed for bindings in C++ apps if a class isn't being referenced in markup*/
00023 [bindable]
00024 [webhosthidden]
00025 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00026 unsealed runtimeclass TreeViewNode : Microsoft.UI.Xaml.DependencyObject
00027 {
00028     TreeViewNode();
00029
00030     Object Content { get; set; };
00031     TreeViewNode Parent { get; };
00032     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00033     Boolean IsExpanded { get; set; };
00034     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00035     Boolean HasChildren { get; };
00036     [MUX_DEFAULT_VALUE("-1")]
00037     Int32 Depth { get; };
00038     Boolean HasUnrealizedChildren { get; set; };
00039     Windows.Foundation.Collections.IVector<TreeViewNode> Children { get; };
00040
00041     static Microsoft.UI.Xaml.DependencyProperty ContentProperty { get; };
00042     static Microsoft.UI.Xaml.DependencyProperty DepthProperty { get; };
00043     static Microsoft.UI.Xaml.DependencyProperty IsExpandedProperty { get; };
00044     static Microsoft.UI.Xaml.DependencyProperty HasChildrenProperty { get; };
00045 }
00046
00047 [MUX_PUBLIC]
00048 [webhosthidden]
00049 runtimeclass TreeViewExpandingEventArgs
00050 {
00051     TreeViewNode Node { get; };
00052     [MUX_PUBLIC]
00053     {
00054         Object Item{ get; };
00055     }
00056 }
00057
00058 [MUX_PUBLIC]
00059 [webhosthidden]
00060 runtimeclass TreeViewCollapsedEventArgs
00061 {
00062     TreeViewNode Node { get; };
00063     [MUX_PUBLIC]
00064     {
00065         Object Item{ get; };
00066     }
00067 }
00068
00069 [MUX_PUBLIC]
00070 [webhosthidden]
00071 runtimeclass TreeViewDragItemsStartingEventArgs
00072 {
00073     Boolean Cancel{ get; set; };
00074     Windows.ApplicationModel.DataTransfer.DataPackage Data{ get; };
00075     Windows.Foundation.Collections.IVector<Object> Items{ get; };
00076 }
00077
00078 [MUX_PUBLIC]
00079 [webhosthidden]
00080 runtimeclass TreeViewDragItemsCompletedEventArgs
00081 {
00082     Windows.ApplicationModel.DataTransfer.DataPackageOperation DropResult{ get; };
00083     Windows.Foundation.Collections.IVectorView<Object> Items{ get; };
00084
00085     [MUX_PUBLIC]
00086     {
00087         Object NewParentItem{ get; };
00088     }
00089 }
00090
00091 [MUX_PUBLIC_V5]
00092 [webhosthidden]
00093 runtimeclass TreeViewSelectionChangedEventArgs
00094 {
00095     Windows.Foundation.Collections.IVector<Object> AddedItems{ get; };
00096     Windows.Foundation.Collections.IVector<Object> RemovedItems{ get; };
00097 }
00098
00099 [MUX_PUBLIC]
00100 [webhosthidden]
00101 unsealed runtimeclass TreeViewList : Microsoft.UI.Xaml.Controls.ListView
00102 {
00103     TreeViewList();
00104 }
00105
00106 [MUX_PUBLIC]
00107 [webhosthidden]
00108 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00109 unsealed runtimeclass TreeView : Microsoft.UI.Xaml.Controls.Control
00110 {
00111     TreeView();
00112
00113     Windows.Foundation.Collections.IVector<TreeViewNode> RootNodes { get; };
00114     [MUX_DEFAULT_VALUE("winrt::TreeViewSelectionMode::Single")]
00115     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00116     TreeViewSelectionMode SelectionMode { get; set; };
00117     Windows.Foundation.Collections.IVector<TreeViewNode> SelectedNodes { get; };
00118     void Expand(TreeViewNode value);
00119     void Collapse(TreeViewNode value);
00120     void SelectAll();
00121     event Windows.Foundation.TypedEventHandler<TreeView, TreeViewItemInvokedEventArgs> ItemInvoked;
00122     event Windows.Foundation.TypedEventHandler<TreeView, TreeViewExpandingEventArgs> Expanding;
00123     event Windows.Foundation.TypedEventHandler<TreeView, TreeViewCollapsedEventArgs> Collapsed;
00124     [MUX_PUBLIC_V5]
00125     {
00126         event Windows.Foundation.TypedEventHandler<TreeView, TreeViewSelectionChangedEventArgs> SelectionChanged;
00127     }
00128     static Microsoft.UI.Xaml.DependencyProperty SelectedItemProperty{ get; };
00129
00130     static Microsoft.UI.Xaml.DependencyProperty SelectionModeProperty{ get; };
00131
00132     [MUX_PUBLIC]
00133     {
00134         TreeViewNode NodeFromContainer(Microsoft.UI.Xaml.DependencyObject container);
00135         Microsoft.UI.Xaml.DependencyObject ContainerFromNode(TreeViewNode node);
00136         Object ItemFromContainer(Microsoft.UI.Xaml.DependencyObject container);
00137         Microsoft.UI.Xaml.DependencyObject ContainerFromItem(Object item);
00138
00139         [MUX_DEFAULT_VALUE("true")]
00140         Boolean CanDragItems{ get; set; };
00141         [MUX_DEFAULT_VALUE("true")]
00142         Boolean CanReorderItems{ get; set; };
00143         Microsoft.UI.Xaml.DataTemplate ItemTemplate{ get; set; };
00144         Microsoft.UI.Xaml.Controls.DataTemplateSelector ItemTemplateSelector{ get; set; };
00145         Microsoft.UI.Xaml.Style ItemContainerStyle{ get; set; };
00146         Microsoft.UI.Xaml.Controls.StyleSelector ItemContainerStyleSelector{ get; set; };
00147         Microsoft.UI.Xaml.Media.Animation.TransitionCollection ItemContainerTransitions{ get; set; };
00148         [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00149         Object ItemsSource{ get; set; };
00150         event Windows.Foundation.TypedEventHandler<TreeView, TreeViewDragItemsStartingEventArgs> DragItemsStarting;
00151         event Windows.Foundation.TypedEventHandler<TreeView, TreeViewDragItemsCompletedEventArgs> DragItemsCompleted;
00152
00153         static Microsoft.UI.Xaml.DependencyProperty CanDragItemsProperty{ get; };
00154         static Microsoft.UI.Xaml.DependencyProperty CanReorderItemsProperty{ get; };
00155         static Microsoft.UI.Xaml.DependencyProperty ItemTemplateProperty{ get; };
00156         static Microsoft.UI.Xaml.DependencyProperty ItemTemplateSelectorProperty{ get; };
00157         static Microsoft.UI.Xaml.DependencyProperty ItemContainerStyleProperty{ get; };
00158         static Microsoft.UI.Xaml.DependencyProperty ItemContainerStyleSelectorProperty{ get; };
00159         static Microsoft.UI.Xaml.DependencyProperty ItemContainerTransitionsProperty{ get; };
00160         static Microsoft.UI.Xaml.DependencyProperty ItemsSourceProperty{ get; };
00161     }
00162
00163     [MUX_PUBLIC]
00164     {
00165         TreeViewNode SelectedNode{ get; set; };
00166         [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00167         Object SelectedItem{ get; set; };
00168         Windows.Foundation.Collections.IVector<Object> SelectedItems{ get; };
00169     }
00170 }
00171
00172 [MUX_PUBLIC]
00173 [webhosthidden]
00174 unsealed runtimeclass TreeViewItemTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00175 {
00176     TreeViewItemTemplateSettings();
00177
00178     [MUX_DEFAULT_VALUE("winrt::Visibility::Collapsed")]
00179     Microsoft.UI.Xaml.Visibility ExpandedGlyphVisibility { get; };
00180     [MUX_DEFAULT_VALUE("winrt::Visibility::Collapsed")]
00181     Microsoft.UI.Xaml.Visibility CollapsedGlyphVisibility { get; };
00182     Microsoft.UI.Xaml.Thickness Indentation { get; };
00183     Int32 DragItemsCount { get; };
00184
00185     static Microsoft.UI.Xaml.DependencyProperty ExpandedGlyphVisibilityProperty { get; };
00186     static Microsoft.UI.Xaml.DependencyProperty CollapsedGlyphVisibilityProperty { get; };
00187     static Microsoft.UI.Xaml.DependencyProperty IndentationProperty { get; };
00188     static Microsoft.UI.Xaml.DependencyProperty DragItemsCountProperty { get; };
00189 }
00190
00191 [MUX_PUBLIC]
00192 [webhosthidden]
00193 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00194 unsealed runtimeclass TreeViewItem : Microsoft.UI.Xaml.Controls.ListViewItem
00195 {
00196     TreeViewItem();
00197
00198     [MUX_DEFAULT_VALUE("1.0")]
00199     Double GlyphOpacity { get; set; };
00200     Microsoft.UI.Xaml.Media.Brush GlyphBrush { get; set; };
00201     [MUX_DEFAULT_VALUE("\uE70D")]
00202     String ExpandedGlyph { get; set; };
00203     [MUX_DEFAULT_VALUE("\uE76C")]
00204     String CollapsedGlyph { get; set; };
00205     [MUX_DEFAULT_VALUE("8.0")]
00206     Double GlyphSize { get; set; };
00207     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00208     Boolean IsExpanded { get; set; };
00209     TreeViewItemTemplateSettings TreeViewItemTemplateSettings { get; };
00210
00211     static Microsoft.UI.Xaml.DependencyProperty GlyphOpacityProperty { get; };
00212     static Microsoft.UI.Xaml.DependencyProperty GlyphBrushProperty { get; };
00213     static Microsoft.UI.Xaml.DependencyProperty ExpandedGlyphProperty { get; };
00214     static Microsoft.UI.Xaml.DependencyProperty CollapsedGlyphProperty { get; };
00215     static Microsoft.UI.Xaml.DependencyProperty GlyphSizeProperty { get; };
00216     static Microsoft.UI.Xaml.DependencyProperty IsExpandedProperty { get; };
00217     static Microsoft.UI.Xaml.DependencyProperty TreeViewItemTemplateSettingsProperty { get; };
00218
00219     [MUX_PUBLIC]
00220     {
00221         [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00222         Boolean HasUnrealizedChildren{ get; set; };
00223         [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00224         Object ItemsSource{ get; set; };
00225
00226         static Microsoft.UI.Xaml.DependencyProperty HasUnrealizedChildrenProperty{ get; };
00227         static Microsoft.UI.Xaml.DependencyProperty ItemsSourceProperty{ get; };
00228     }
00229 }
00230
00231 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AutoSuggestEventRevokers Member List

This is the complete list of members for AutoSuggestEventRevokers, including all inherited members.
m_autoSuggestBoxLoadedRevoker | AutoSuggestEventRevokers
m_popupClosedRevoker | AutoSuggestEventRevokers
m_popupOpenedRevoker | AutoSuggestEventRevokers
Generated on Sun Dec 1 2024 20:52:42 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Expander Member List

This is the complete list of members for Expander, including all inherited members.
abi_enter() | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
CheckThread() | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
ClearProperties() | ExpanderProperties | [static]
Collapsed(winrt::TypedEventHandler< winrt::Expander, winrt::ExpanderCollapsedEventArgs > const &value) | ExpanderProperties |
Collapsed(winrt::event_token const &token) | ExpanderProperties |
DeleteInstanceOnUIThread(std::unique_ptr< Expander > &&self) noexcept | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline, static]
EnsureProperties() | ExpanderProperties | [static]
EnsureReferenceTrackerInterfaces() | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
ExpandDirection(winrt::ExpandDirection const &value) | ExpanderProperties |
ExpandDirection() | ExpanderProperties |
ExpandDirectionProperty() | ExpanderProperties | [inline, static]
Expander() | Expander |
ExpanderProperties() | ExpanderProperties |
Expanding(winrt::TypedEventHandler< winrt::Expander, winrt::ExpanderExpandingEventArgs > const &value) | ExpanderProperties |
Expanding(winrt::event_token const &token) | ExpanderProperties |
final_release(std::unique_ptr< Expander > &&self) | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline, static]
GetBase() | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
GetInner() | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
Header(winrt::IInspectable const &value) | ExpanderProperties |
Header() | ExpanderProperties |
HeaderProperty() | ExpanderProperties | [inline, static]
HeaderTemplate(winrt::DataTemplate const &value) | ExpanderProperties |
HeaderTemplate() | ExpanderProperties |
HeaderTemplateProperty() | ExpanderProperties | [inline, static]
HeaderTemplateSelector(winrt::DataTemplateSelector const &value) | ExpanderProperties |
HeaderTemplateSelector() | ExpanderProperties |
HeaderTemplateSelectorProperty() | ExpanderProperties | [inline, static]
IsExpanded(bool value) | ExpanderProperties |
IsExpanded() | ExpanderProperties |
IsExpandedProperty() | ExpanderProperties | [inline, static]
IsOnThread() | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
m_collapsedEventSource | ExpanderProperties |
m_expandingEventSource | ExpanderProperties |
NonDelegatingQueryInterface(winrt::guid const &riid, void **value) noexcept | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
OnApplyTemplate() | Expander |
OnContentSizeChanged(const winrt::IInspectable &, const winrt::SizeChangedEventArgs &args) | Expander | [private]
OnCreateAutomationPeer() | Expander | [virtual]
OnExpandDirectionPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | Expander |
ExpanderProperties::OnExpandDirectionPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ExpanderProperties | [static]
OnIsExpandedPropertyChanged(const winrt::DependencyPropertyChangedEventArgs &args) | Expander |
ExpanderProperties::OnIsExpandedPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | ExpanderProperties | [static]
QueryInterface(GUID const &id_abi, void **object) noexcept | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
RaiseCollapsedEvent(const winrt::Expander &container) | Expander |
RaiseExpandingEvent(const winrt::Expander &container) | Expander |
ReferenceTracker(Args &&...args) | ReferenceTracker< Expander, winrt::implementation::ExpanderT > | [inline]
s_ExpandDirectionProperty | ExpanderProperties | [static]
s_HeaderProperty | ExpanderProperties | [static]
s_HeaderTemplateProperty | ExpanderProperties | [static]
s_HeaderTemplateSelectorProperty | ExpanderProperties | [static]
s_IsExpandedProperty | ExpanderProperties | [static]
s_TemplateSettingsProperty | ExpanderProperties | [static]
TemplateSettings(winrt::ExpanderTemplateSettings const &value) | ExpanderProperties |
TemplateSettings() | ExpanderProperties |
TemplateSettingsProperty() | ExpanderProperties | [inline, static]
UpdateExpandDirection(bool useTransitions) | Expander | [private]
UpdateExpandState(bool useTransitions) | Expander | [private]
~Expander() | Expander | [inline]
Generated on Sun Dec 1 2024 20:52:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TreeViewNodeProperties Member List

This is the complete list of members for TreeViewNodeProperties, including all inherited members.
ClearProperties() | TreeViewNodeProperties | [static]
Content(winrt::IInspectable const &value) | TreeViewNodeProperties |
Content() | TreeViewNodeProperties |
ContentProperty() | TreeViewNodeProperties | [inline, static]
Depth(int value) | TreeViewNodeProperties |
Depth() | TreeViewNodeProperties |
DepthProperty() | TreeViewNodeProperties | [inline, static]
EnsureProperties() | TreeViewNodeProperties | [static]
HasChildren(bool value) | TreeViewNodeProperties |
HasChildren() | TreeViewNodeProperties |
HasChildrenProperty() | TreeViewNodeProperties | [inline, static]
IsExpanded(bool value) | TreeViewNodeProperties |
IsExpanded() | TreeViewNodeProperties |
IsExpandedProperty() | TreeViewNodeProperties | [inline, static]
OnHasChildrenPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewNodeProperties | [static]
OnIsExpandedPropertyChanged(winrt::DependencyObject const &sender, winrt::DependencyPropertyChangedEventArgs const &args) | TreeViewNodeProperties | [static]
s_ContentProperty | TreeViewNodeProperties | [static]
s_DepthProperty | TreeViewNodeProperties | [static]
s_HasChildrenProperty | TreeViewNodeProperties | [static]
s_IsExpandedProperty | TreeViewNodeProperties | [static]
TreeViewNodeProperties() | TreeViewNodeProperties |
Generated on Sun Dec 1 2024 20:53:19 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RepeatedScrollSnapPoint.properties.cpp Source File

  • Generated

RepeatedScrollSnapPoint.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RepeatedScrollSnapPoint.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls::Primitives
00010 {
00011     CppWinRTActivatableClassWithBasicFactory(RepeatedScrollSnapPoint)
00012 }
00013
00014 #include "RepeatedScrollSnapPoint.g.cpp"
00015
00016
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

TeachingTipPage Member List

This is the complete list of members for TeachingTipPage, including all inherited members.
ActionButton | TeachingTipPage |
BrushToString(Brush brush) | TeachingTipPage | [inline]
BtnClearTeachingTipEvents_Click(object sender, RoutedEventArgs e) | TeachingTipPage | [inline, private]
ContentElevationSliderChanged(object sender, RangeBaseValueChangedEventArgs args) | TeachingTipPage | [inline]
ContentScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e) | TeachingTipPage | [inline, private]
CurrentCancelClosesCheckBox | TeachingTipPage | [private]
deferral | TeachingTipPage | [private]
getCancelClosesInTeachingTip() | TeachingTipPage | [inline, private]
GetEdgeTeachingTipOffset_Clicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
getTeachingTip() | TeachingTipPage | [inline, private]
getTeachingTipRoot(UIElement cancelClosesCheckBox) | TeachingTipPage | [inline, private]
IsPageRTL | TeachingTipPage |
NotifyPropertyChanged([CallerMemberName]string propertyName=null) | TeachingTipPage | [inline, private]
OnBringTargetIntoViewButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnCloseButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnGetTargetBoundsButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnNavigatedFrom(NavigationEventArgs e) | TeachingTipPage | [inline, protected]
OnPageThemeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) | TeachingTipPage | [inline, private]
OnReturnTopForOutOfWindowPlacementCheckBoxChecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnReturnTopForOutOfWindowPlacementCheckBoxUnchecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetActionButtonContentButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetAnimationDurationsButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetAnimationParametersButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetAutomationNameButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetBleeingImagePlacementButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetCloseButtonContentButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetContentButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetHeroContentButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetIconButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetIsLightDismissEnabledButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetPlacementMarginButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetPreferredPlacementButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetScrollViewerOffsetButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetShouldConstrainToRootBoundsButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetSubtitleButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetTailVisibilityButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetTargetButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetTargetHorizontalAlignmentButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetTargetVerticalAlignmentButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetTipLocationButton(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSetTitleButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnShowAfterDelayButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnShowButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnShowButtonClickedRightEdge(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnSwitchTargetButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnTeachingTipActionButtonClicked(object sender, object args) | TeachingTipPage | [inline]
OnTeachingTipCloseButtonClicked(object sender, object args) | TeachingTipPage | [inline]
OnTeachingTipClosed(object sender, TeachingTipClosedEventArgs args) | TeachingTipPage | [inline]
OnTeachingTipClosing(TeachingTip sender, TeachingTipClosingEventArgs args) | TeachingTipPage | [inline]
OnTipFollowsTargetCheckBoxChecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnTipFollowsTargetCheckBoxUnchecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnTipShadowChecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnTipShadowUnchecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnUntargetButtonClicked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnUseTestScreenBoundsCheckBoxUnchecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnUseTestSreenBoundsCheckBoxChecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnUseTestWindowBoundsCheckBoxChecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
OnUseTestWindowBoundsCheckBoxUnchecked(object sender, RoutedEventArgs args) | TeachingTipPage | [inline]
PropertyChanged | TeachingTipPage |
RemoveOpenButton_Click(object sender, RoutedEventArgs e) | TeachingTipPage | [inline, private]
RemoveTeachingTipButton_Click(object sender, RoutedEventArgs e) | TeachingTipPage | [inline, private]
RemoveTeachingTipTextBlockContent_Unloaded(object sender, RoutedEventArgs e) | TeachingTipPage | [inline, private]
showTimer | TeachingTipPage | [private]
ShowTimerTick(object sender, object e) | TeachingTipPage | [inline, private]
TailElevationSliderChanged(object sender, RangeBaseValueChangedEventArgs args) | TeachingTipPage | [inline]
TeachingTip_SizeChanged(object sender, SizeChangedEventArgs e) | TeachingTipPage | [inline, private]
TeachingTipInResources_Closed(TeachingTip sender, TeachingTipClosedEventArgs args) | TeachingTipPage | [inline, private]
TeachingTipInResourcesOnEdge_Closed(TeachingTip sender, TeachingTipClosedEventArgs args) | TeachingTipPage | [inline, private]
TeachingTipInResourcesRoot | TeachingTipPage | [private]
TeachingTipInResourcesRoot_Loaded(object sender, RoutedEventArgs e) | TeachingTipPage | [inline, private]
TeachingTipInVisualTree_Closed(TeachingTip sender, TeachingTipClosedEventArgs args) | TeachingTipPage | [inline, private]
TeachingTipInVisualTreeRoot | TeachingTipPage | [private]
TeachingTipInVisualTreeRoot_Loaded(object sender, RoutedEventArgs e) | TeachingTipPage | [inline, private]
TeachingTipPage() | TeachingTipPage | [inline]
TeachingTipTestHooks_EffectiveHeroContentPlacementChanged(TeachingTip sender, object args) | TeachingTipPage | [inline, private]
TeachingTipTestHooks_EffectivePlacementChanged(TeachingTip sender, object args) | TeachingTipPage | [inline, private]
TeachingTipTestHooks_IdleStatusChanged(TeachingTip sender, object args) | TeachingTipPage | [inline, private]
TeachingTipTestHooks_OffsetChanged(TeachingTip sender, object args) | TeachingTipPage | [inline, private]
TeachingTipTestHooks_OpenedStatusChanged(TeachingTip sender, object args) | TeachingTipPage | [inline, private]
TeachingTipTestHooks_SubtitleVisibilityChanged(TeachingTip sender, object args) | TeachingTipPage | [inline, private]
TeachingTipTestHooks_TitleVisibilityChanged(TeachingTip sender, object args) | TeachingTipPage | [inline, private]
testScreenBounds | TeachingTipPage | [private]
testWindowBounds | TeachingTipPage | [private]
timer | TeachingTipPage | [private]
Timer_Tick(object sender, object e) | TeachingTipPage | [inline, private]
tipLocation | TeachingTipPage | [private]
Generated on Sun Dec 1 2024 20:54:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/InkToolBarPenConfigurationControl.properties.h Source File

  • Generated

InkToolBarPenConfigurationControl.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class InkToolBarPenConfigurationControlProperties
00008 {
00009 public:
00010     InkToolBarPenConfigurationControlProperties();
00011
00012     void PenButton(winrt::InkToolBarPenButton const& value);
00013     winrt::InkToolBarPenButton PenButton();
00014
00015     static winrt::DependencyProperty PenButtonProperty() { return s_PenButtonProperty; }
00016
00017     static GlobalDependencyProperty s_PenButtonProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021 };
Generated on Sun Dec 1 2024 20:51:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs.h Source File

  • Repeater

LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs.g.h"
00007
00008 class LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs :
00009     public winrt::implementation::LayoutsTestHooksLinedFlowLayoutItemLockedEventArgsT<LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs>
00010 {
00011 public:
00012     LayoutsTestHooksLinedFlowLayoutItemLockedEventArgs(
00013         int itemIndex,
00014         int lineIndex);
00015
00016     // ILayoutsTestHooksLinedFlowLayoutItemLockedEventArgs overrides
00017     int ItemIndex();
00018     int LineIndex();
00019
00020 private:
00021     int m_itemIndex;
00022     int m_lineIndex;
00023 };
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/DatePickerPage.xaml.cs Source File

  • CommonStyles
  • TestUI

DatePickerPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 namespace MUXControlsTestApp
00005 {
00006     [TopLevelTestPage(Name = "DatePicker", Icon = "DatePicker.png")]
00007     public sealed partial class DatePickerPage : TestPage
00008     {
00009         public DatePickerPage()
00010         {
00011             this.InitializeComponent();
00012         }
00013     }
00014 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ColorChangedEventWaiter Member List

This is the complete list of members for ColorChangedEventWaiter, including all inherited members.
blueOrValueChangedWaiter | ColorChangedEventWaiter | [private]
ColorChangedEventWaiter() | ColorChangedEventWaiter | [inline]
Dispose() | ColorChangedEventWaiter | [inline]
greenOrSaturationChangedWaiter | ColorChangedEventWaiter | [private]
redOrHueChangedWaiter | ColorChangedEventWaiter | [private]
TryWait(TimeSpan timeout) | ColorChangedEventWaiter | [inline]
Generated on Sun Dec 1 2024 20:53:44 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: PipsPager/PipsPager.idl Source File

  • PipsPager

PipsPager.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 enum PipsPagerButtonVisibility
00007 {
00008     Visible,
00009     VisibleOnPointerOver,
00010     Collapsed
00011 };
00012
00013 [MUX_PUBLIC_V7]
00014 [webhosthidden]
00015 enum PipsPagerWrapMode
00016 {
00017     None,
00018     Wrap
00019 };
00020
00021 [MUX_PUBLIC]
00022 [default_interface]
00023 [webhosthidden]
00024 runtimeclass PipsPagerSelectedIndexChangedEventArgs
00025 {
00026 };
00027
00028 [MUX_PUBLIC]
00029 [webhosthidden]
00030 [MUX_PROPERTY_NEEDS_DP_FIELD]
00031 runtimeclass PipsPagerTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00032 {
00033     Windows.Foundation.Collections.IVector<Int32> PipsPagerItems { get; };
00034 };
00035
00036 [MUX_PUBLIC]
00037 [webhosthidden]
00038 [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00039 [MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")]
00040 unsealed runtimeclass PipsPager : Microsoft.UI.Xaml.Controls.Control
00041 {
00042     PipsPager();
00043
00044     [MUX_DEFAULT_VALUE("-1")]
00045     Int32 NumberOfPages;
00046
00047     [MUX_DEFAULT_VALUE("0")]
00048     Int32 SelectedPageIndex;
00049
00050     [MUX_DEFAULT_VALUE("5")]
00051     Int32 MaxVisiblePips;
00052
00053     [MUX_DEFAULT_VALUE("winrt::Orientation::Horizontal")]
00054     Microsoft.UI.Xaml.Controls.Orientation Orientation;
00055
00056     [MUX_DEFAULT_VALUE("winrt::PipsPagerButtonVisibility::Collapsed")]
00057     PipsPagerButtonVisibility PreviousButtonVisibility;
00058     [MUX_DEFAULT_VALUE("winrt::PipsPagerButtonVisibility::Collapsed")]
00059     PipsPagerButtonVisibility NextButtonVisibility;
00060
00061     Microsoft.UI.Xaml.Style PreviousButtonStyle;
00062     Microsoft.UI.Xaml.Style NextButtonStyle;
00063
00064     Microsoft.UI.Xaml.Style SelectedPipStyle;
00065     Microsoft.UI.Xaml.Style NormalPipStyle;
00066
00067     event Windows.Foundation.TypedEventHandler<PipsPager, PipsPagerSelectedIndexChangedEventArgs> SelectedIndexChanged;
00068
00069     [MUX_PROPERTY_NEEDS_DP_FIELD]
00070     PipsPagerTemplateSettings TemplateSettings{ get; };
00071
00072     static Microsoft.UI.Xaml.DependencyProperty NumberOfPagesProperty{ get; };
00073     static Microsoft.UI.Xaml.DependencyProperty SelectedPageIndexProperty{ get; };
00074     static Microsoft.UI.Xaml.DependencyProperty MaxVisiblePipsProperty{ get; };
00075     static Microsoft.UI.Xaml.DependencyProperty OrientationProperty{ get; };
00076     static Microsoft.UI.Xaml.DependencyProperty PreviousButtonVisibilityProperty{ get; };
00077     static Microsoft.UI.Xaml.DependencyProperty NextButtonVisibilityProperty{ get; };
00078     static Microsoft.UI.Xaml.DependencyProperty PreviousButtonStyleProperty{ get; };
00079     static Microsoft.UI.Xaml.DependencyProperty NextButtonStyleProperty{ get; };
00080     static Microsoft.UI.Xaml.DependencyProperty SelectedPipStyleProperty{ get; };
00081     static Microsoft.UI.Xaml.DependencyProperty NormalPipStyleProperty{ get; };
00082
00083     [MUX_PUBLIC_V7]
00084     {
00085         [MUX_DEFAULT_VALUE("winrt::PipsPagerWrapMode::None")]
00086         PipsPagerWrapMode WrapMode;
00087         static Microsoft.UI.Xaml.DependencyProperty WrapModeProperty{ get; };
00088     }
00089 };
00090
00091 }
Generated on Sun Dec 1 2024 20:52:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RatingControlTests Member List

This is the complete list of members for RatingControlTests, including all inherited members.
APPROXIMATE_MARGIN | RatingControlTests | [private]
BasicInteractionTest() | RatingControlTests | [inline]
CanClearEveryValueTest() | RatingControlTests | [inline]
ClassInitialize(TestContext testContext) | RatingControlTests | [inline, static]
DontCrashWhenRecyclingTest() | RatingControlTests | [inline]
EnsureScaleMaintainedOnTap() | RatingControlTests | [inline]
GamepadTest() | RatingControlTests | [inline]
ImageInfoValidation() | RatingControlTests | [inline]
MaxRatingTest() | RatingControlTests | [inline]
RATING_ITEM_HEIGHT | RatingControlTests | [private]
RATING_ITEM_WIDTH | RatingControlTests | [private]
TestCleanup() | RatingControlTests | [inline]
UIAValuePatternTest() | RatingControlTests | [inline]
UnclearableIsUnclearableTest() | RatingControlTests | [inline]
ValidateSwitchingItemInfo() | RatingControlTests | [inline]
VerifyDependencyPropertyBinding() | RatingControlTests | [inline]
VerifyDontCrashWhenCollapsedAndValueSet() | RatingControlTests | [inline]
VerifyRatingItemFallback() | RatingControlTests | [inline]
VerifyReadOnlyIsntInteractive() | RatingControlTests | [inline]
VerifyTabKeyWorks() | RatingControlTests | [inline]
VerifyThatProgrammaticallyRemovingEngagementResetsValue() | RatingControlTests | [inline]
VerifyUIAProperties() | RatingControlTests | [inline]
VerifyValue_ValueEqualsOnAutomationElement(AutomationElement ae, String expected, String reason="") | RatingControlTests | [inline, private]
VerifyValueIsApproximately(float expected, float actual) | RatingControlTests | [inline, private]
WaitForCheckbox(string checkboxName) | RatingControlTests | [inline, private]
Generated on Sun Dec 1 2024 20:53:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

StoreMockData Member List

This is the complete list of members for StoreMockData, including all inherited members.
Create(int numCategories, int numItemsPerCategory) | StoreMockData | [inline, static]
Create(int numCategories, int numItemsPerCategory) | StoreMockData | [inline, static]
CreateCategory(int numItems, string name) | StoreMockData | [inline, static]
CreateCategory(int numItems, string name) | StoreMockData | [inline, static]
Generated on Sun Dec 1 2024 20:54:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

AnimatedIconPage Member List

This is the complete list of members for AnimatedIconPage, including all inherited members.
AnimatedIconPage() | AnimatedIconPage | [inline]
AnimatedIconPage_Loaded(object sender, RoutedEventArgs e) | AnimatedIconPage | [inline, private]
AnimatedIconTestHooks_LastAnimationSegmentChanged(AnimatedIcon sender, object args) | AnimatedIconPage | [inline, private]
ChangeFallbackGlyphButton_Click(object sender, RoutedEventArgs e) | AnimatedIconPage | [inline, private]
IsLeftToRightChecked(object sender, RoutedEventArgs args) | AnimatedIconPage | [inline]
IsLeftToRightUnchecked(object sender, RoutedEventArgs args) | AnimatedIconPage | [inline]
QueueLengthSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) | AnimatedIconPage | [inline, private]
Slider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) | AnimatedIconPage | [inline, private]
SpeedUpSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) | AnimatedIconPage | [inline, private]
Generated on Sun Dec 1 2024 20:53:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/MapControl.properties.h Source File

  • Generated

MapControl.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class MapControlProperties
00008 {
00009 public:
00010     MapControlProperties();
00011
00012     void Center(winrt::Geopoint const& value);
00013     winrt::Geopoint Center();
00014
00015     void InteractiveControlsVisible(bool value);
00016     bool InteractiveControlsVisible();
00017
00018     void Layers(winrt::IVector<winrt::MapLayer> const& value);
00019     winrt::IVector<winrt::MapLayer> Layers();
00020
00021     void MapServiceToken(winrt::hstring const& value);
00022     winrt::hstring MapServiceToken();
00023
00024     void ZoomLevel(double value);
00025     double ZoomLevel();
00026
00027     static winrt::DependencyProperty CenterProperty() { return s_CenterProperty; }
00028     static winrt::DependencyProperty InteractiveControlsVisibleProperty() { return s_InteractiveControlsVisibleProperty; }
00029     static winrt::DependencyProperty LayersProperty() { return s_LayersProperty; }
00030     static winrt::DependencyProperty MapServiceTokenProperty() { return s_MapServiceTokenProperty; }
00031     static winrt::DependencyProperty ZoomLevelProperty() { return s_ZoomLevelProperty; }
00032
00033     static GlobalDependencyProperty s_CenterProperty;
00034     static GlobalDependencyProperty s_InteractiveControlsVisibleProperty;
00035     static GlobalDependencyProperty s_LayersProperty;
00036     static GlobalDependencyProperty s_MapServiceTokenProperty;
00037     static GlobalDependencyProperty s_ZoomLevelProperty;
00038
00039     winrt::event_token MapElementClick(winrt::TypedEventHandler<winrt::MapControl, winrt::MapElementClickEventArgs> const& value);
00040     void MapElementClick(winrt::event_token const& token);
00041     winrt::event_token MapServiceErrorOccurred(winrt::TypedEventHandler<winrt::MapControl, winrt::MapControlMapServiceErrorOccurredEventArgs> const& value);
00042     void MapServiceErrorOccurred(winrt::event_token const& token);
00043
00044     event_source<winrt::TypedEventHandler<winrt::MapControl, winrt::MapElementClickEventArgs>> m_mapElementClickEventSource;
00045     event_source<winrt::TypedEventHandler<winrt::MapControl, winrt::MapControlMapServiceErrorOccurredEventArgs>> m_mapServiceErrorOccurredEventSource;
00046
00047     static void EnsureProperties();
00048     static void ClearProperties();
00049
00050     static void OnCenterPropertyChanged(
00051         winrt::DependencyObject const& sender,
00052         winrt::DependencyPropertyChangedEventArgs const& args);
00053
00054     static void OnInteractiveControlsVisiblePropertyChanged(
00055         winrt::DependencyObject const& sender,
00056         winrt::DependencyPropertyChangedEventArgs const& args);
00057
00058     static void OnLayersPropertyChanged(
00059         winrt::DependencyObject const& sender,
00060         winrt::DependencyPropertyChangedEventArgs const& args);
00061
00062     static void OnMapServiceTokenPropertyChanged(
00063         winrt::DependencyObject const& sender,
00064         winrt::DependencyPropertyChangedEventArgs const& args);
00065
00066     static void OnZoomLevelPropertyChanged(
00067         winrt::DependencyObject const& sender,
00068         winrt::DependencyPropertyChangedEventArgs const& args);
00069 };
Generated on Sun Dec 1 2024 20:51:51 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewMenuItemsSourcePage Member List

This is the complete list of members for NavigationViewMenuItemsSourcePage, including all inherited members.
_reverse_order_items | NavigationViewMenuItemsSourcePage | [private]
BtnInsertItemsFromBeginning_Click(object sender, RoutedEventArgs e) | NavigationViewMenuItemsSourcePage | [inline, private]
NavigationView_ItemInvoked(NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args) | NavigationViewMenuItemsSourcePage | [inline, private]
NavigationViewMenuItemsSourcePage() | NavigationViewMenuItemsSourcePage | [inline]
Pages | NavigationViewMenuItemsSourcePage |
Generated on Sun Dec 1 2024 20:54:20 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/ColorPickerSlider.h Source File

  • ColorPicker

ColorPickerSlider.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ColorPickerSlider.g.h"
00007 #include "ColorPickerSlider.properties.h"
00008
00009 class ColorPickerSlider :
00010     public ReferenceTracker<ColorPickerSlider, winrt::implementation::ColorPickerSliderT>,
00011     public ColorPickerSliderProperties
00012 {
00013 public:
00014     ColorPickerSlider();
00015
00016     // IUIElementOverridesHelper overrides
00017     winrt::AutomationPeer OnCreateAutomationPeer();
00018
00019     // IFrameworkElementOverrides overrides
00020     void OnApplyTemplate();
00021
00022     // IControlOverrides overrides
00023     void OnKeyDown(winrt::KeyRoutedEventArgs const& e);
00024     void OnGotFocus(winrt::RoutedEventArgs const& e);
00025     void OnLostFocus(winrt::RoutedEventArgs const& e);
00026
00027 private:
00028     void OnValueChangedEvent(winrt::IInspectable const& sender, winrt::RangeBaseValueChangedEventArgs const& args);
00029
00030     winrt::ColorPicker GetParentColorPicker();
00031     winrt::hstring GetToolTipString();
00032
00033     tracker_ref<winrt::ToolTip> m_toolTip{ this };
00034 };
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: TreeView/TreeViewExpandingEventArgs.cpp Source File

  • TreeView

TreeViewExpandingEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "TreeViewExpandingEventArgs.h"
00007
00008 winrt::TreeViewNode TreeViewExpandingEventArgs::Node()
00009 {
00010     return m_node.get();
00011 }
00012
00013 void TreeViewExpandingEventArgs::Node(const winrt::TreeViewNode& value)
00014 {
00015     m_node.set(value);
00016 }
00017
00018 winrt::IInspectable TreeViewExpandingEventArgs::Item()
00019 {
00020     return m_node.get().Content();
00021 }
Generated on Sun Dec 1 2024 20:52:21 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: NavigationView/NavigationViewSelectionChangedEventArgs.cpp Source File

  • NavigationView

NavigationViewSelectionChangedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "NavigationViewSelectionChangedEventArgs.h"
00007 #include "NavigationView.h"
00008
00009 winrt::IInspectable NavigationViewSelectionChangedEventArgs::SelectedItem()
00010 {
00011     return m_selectedItem.get();
00012 }
00013
00014 bool NavigationViewSelectionChangedEventArgs::IsSettingsSelected()
00015 {
00016     return m_isSettingsSelected;
00017 }
00018
00019 void NavigationViewSelectionChangedEventArgs::SelectedItem(winrt::IInspectable const& value)
00020 {
00021     m_selectedItem.set(value);
00022 }
00023
00024 void NavigationViewSelectionChangedEventArgs::IsSettingsSelected(bool value)
00025 {
00026     m_isSettingsSelected = value;
00027 }
00028
00029 winrt::NavigationViewItemBase NavigationViewSelectionChangedEventArgs::SelectedItemContainer()
00030 {
00031     return m_selectedItemContainer.get();
00032 }
00033
00034 void NavigationViewSelectionChangedEventArgs::SelectedItemContainer(winrt::NavigationViewItemBase const& value)
00035 {
00036     m_selectedItemContainer.set(value);
00037 }
00038
00039 winrt::NavigationTransitionInfo NavigationViewSelectionChangedEventArgs::RecommendedNavigationTransitionInfo()
00040 {
00041     return m_recommendedNavigationTransitionInfo.get();
00042 }
00043
00044 void NavigationViewSelectionChangedEventArgs::RecommendedNavigationTransitionInfo(winrt::NavigationTransitionInfo const& value)
00045 {
00046     m_recommendedNavigationTransitionInfo.set(value);
00047 }
Generated on Sun Dec 1 2024 20:52:02 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

BreadcrumbLayout Member List

This is the complete list of members for BreadcrumbLayout, including all inherited members.
ArrangeItem(const winrt::UIElement &breadcrumbItem, float &accumulatedWidths, float maxElementHeight) | BreadcrumbLayout | [private]
ArrangeItem(const winrt::NonVirtualizingLayoutContext &context, int index, float &accumulatedWidths, float maxElementHeight) | BreadcrumbLayout | [private]
ArrangeOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &finalSize) | BreadcrumbLayout |
BreadcrumbLayout() | BreadcrumbLayout |
BreadcrumbLayout(const winrt::BreadcrumbBar &breadcrumb) | BreadcrumbLayout |
EllipsisIsRendered() | BreadcrumbLayout |
FirstRenderedItemIndexAfterEllipsis() | BreadcrumbLayout |
GetBreadcrumbBarItemsHeight(winrt::NonVirtualizingLayoutContext const &context, int firstItemToRender) | BreadcrumbLayout | [private]
GetElementAt(winrt::NonVirtualizingLayoutContext const &context, uint32_t index) | BreadcrumbLayout | [private]
GetFirstBreadcrumbBarItemToArrange(winrt::NonVirtualizingLayoutContext const &context) | BreadcrumbLayout | [private]
GetItemCount(winrt::NonVirtualizingLayoutContext const &context) | BreadcrumbLayout | [private]
GetVisibleItemsCount() | BreadcrumbLayout |
HideItem(const winrt::UIElement &breadcrumbItem) | BreadcrumbLayout | [private]
HideItem(const winrt::NonVirtualizingLayoutContext &context, int index) | BreadcrumbLayout | [private]
MeasureOverride(winrt::NonVirtualizingLayoutContext const &context, winrt::Size const &availableSize) | BreadcrumbLayout |
~BreadcrumbLayout() | BreadcrumbLayout |
Generated on Sun Dec 1 2024 20:52:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: CommonStyles/TestUI/CompactPage.xaml.cs Source File

  • CommonStyles
  • TestUI

CompactPage.xaml.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System.Collections.Generic;
00005 using System.Collections.ObjectModel;
00006 using Microsoft.UI.Xaml;
00007 using Microsoft.UI.Xaml.Controls;
00008 using Microsoft.UI.Xaml.Media;
00009 using System.Linq;
00010 using Common;
00011 using MUXControlsTestApp.Utilities;
00012 using System;
00013
00014 namespace MUXControlsTestApp
00015 {
00016     [TopLevelTestPage(Name = "Compact", Icon = "CompactSizing.png")]
00017     public sealed partial class CompactPage : TestPage
00018     {
00019         public CompactPage()
00020         {
00021             this.InitializeComponent();
00022         }
00023
00024         private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
00025         {
00026             if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
00027             {
00028                 var suggestList = new List<string>();
00029                 suggestList.Add("001");
00030                 suggestList.Add("002");
00031                 suggestList.Add("003");
00032                 suggestList.Add("004");
00033                 suggestList.Add("005");
00034
00035                 sender.ItemsSource = suggestList.Select(text => sender.Text + text);
00036             }
00037         }
00038
00039         private void VerifyHeight(SimpleVerify simpleVerify, FrameworkElement item, int expectHeight, string controlName)
00040         {
00041             if (item != null)
00042             {
00043                 // Avoid Height because of CornerRadius
00044                 if (Math.Abs(item.ActualHeight - expectHeight) > 0.5)
00045                 {
00046                     simpleVerify.IsEqual(item.ActualHeight.ToString(), expectHeight, controlName + ".ActualHeight=" + expectHeight);
00047                 }
00048             }
00049             else
00050             {
00051                 simpleVerify.IsTrue(false, "Can't find " + controlName);
00052             }
00053         }
00054
00055         private void VerifyChildHeight(SimpleVerify simpleVerify, FrameworkElement item, string childXName, int expectHeight, string controlName)
00056         {
00057             FrameworkElement child = GetChild(item, childXName);
00058             VerifyHeight(simpleVerify, child, expectHeight, controlName + "." + childXName);
00059         }
00060
00061         private FrameworkElement GetChild(FrameworkElement item, string childXName)
00062         {
00063             FrameworkElement root = (item == null) ? null: (FrameworkElement)VisualTreeHelper.GetChild(item, 0);
00064             FrameworkElement child = (root == null) ? null: (FrameworkElement)root.FindName(childXName);
00065             return child;
00066         }
00067         private void RunTest_Click(object sender, RoutedEventArgs e)
00068         {
00069             SimpleVerify simpleVerify = new SimpleVerify();
00070             FrameworkElement item = ListView.FindVisualChildByType<ListViewItem>();
00071             VerifyHeight(simpleVerify, item, 32, "ListViewItem");
00072             item = TreeView.FindVisualChildByType<TreeViewItem>();
00073             VerifyHeight(simpleVerify, item, 24, "TreeViewItem");
00074
00075             VerifyHeight(simpleVerify, NavItem1, 36, "NavigationViewItem");
00076
00077             VerifyChildHeight(simpleVerify, TextBox, "BorderElement", 24, "TextBox");
00078             VerifyChildHeight(simpleVerify, PasswordBox, "BorderElement", 24, "PasswordBox");
00079
00080             // AutoSuggestBox used TextBox directly, so we check TextBox
00081             FrameworkElement child = GetChild(AutoSuggestBox, "TextBox");
00082             VerifyChildHeight(simpleVerify, child, "BorderElement", 24, "AutoSuggestBox.TextBox");
00083
00084             VerifyChildHeight(simpleVerify, RichEditBox, "BorderElement", 24, "RichEditBox");
00085             VerifyChildHeight(simpleVerify, ComboBox, "Background", 24, "TextBox");
00086
00087             VerifyChildHeight(simpleVerify, TimePicker, "FlyoutButton", 22, "TimePicker");
00088             VerifyChildHeight(simpleVerify, DatePicker, "FlyoutButton", 22, "DatePicker");
00089
00090             CompactTestResult.Text = simpleVerify.ToString();
00091         }
00092
00093         private void ToggleCompactInAppLevel_Click(object sender, RoutedEventArgs e)
00094         {
00095             var dict = Application.Current.Resources.MergedDictionaries.First() as XamlControlsResources;
00096             dict.UseCompactResources = !dict.UseCompactResources;
00097         }
00098     }
00099 }
Generated on Sun Dec 1 2024 20:51:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/SelectionModelChildrenRequestedEventArgs.cpp Source File

  • Repeater

SelectionModelChildrenRequestedEventArgs.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ItemsRepeater.common.h"
00007 #include "SelectionNode.h"
00008 #include "SelectionModelChildrenRequestedEventArgs.h"
00009
00010 SelectionModelChildrenRequestedEventArgs::SelectionModelChildrenRequestedEventArgs(const winrt::IInspectable& source, const winrt::IndexPath& sourceIndexPath, bool throwOnAccess)
00011 {
00012     Initialize(source, sourceIndexPath, throwOnAccess);
00013 }
00014
00015 #pragma region ISelectionModelChildrenRequestedEventArgs
00016
00017 winrt::IInspectable SelectionModelChildrenRequestedEventArgs::Source()
00018 {
00019     if (m_throwOnAccess)
00020     {
00021         throw winrt::hresult_error(E_FAIL, L"Source can only be accesed in the ChildrenRequested event handler.");
00022     }
00023
00024     return m_source.get();
00025 }
00026
00027 winrt::IndexPath SelectionModelChildrenRequestedEventArgs::SourceIndex()
00028 {
00029     if (m_throwOnAccess)
00030     {
00031         throw winrt::hresult_error(E_FAIL, L"SourceIndex can only be accesed in the ChildrenRequested event handler.");
00032     }
00033
00034     return m_sourceIndexPath.get();
00035 }
00036
00037 winrt::IInspectable SelectionModelChildrenRequestedEventArgs::Children()
00038 {
00039     return m_children.get();
00040 }
00041
00042 void SelectionModelChildrenRequestedEventArgs::Children(winrt::IInspectable const& value)
00043 {
00044     m_children.set(value);
00045 }
00046
00047 #pragma endregion
00048
00049 void SelectionModelChildrenRequestedEventArgs::Initialize(const winrt::IInspectable& source, const winrt::IndexPath& sourceIndexPath, bool throwOnAccess)
00050 {
00051     m_source.set(source);
00052     m_sourceIndexPath.set(sourceIndexPath);
00053     m_throwOnAccess = throwOnAccess;
00054     m_children.set(nullptr);
00055 }
Generated on Sun Dec 1 2024 20:52:09 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Interactions/ButtonInteraction/ButtonInteraction.h Source File

  • Interactions
  • ButtonInteraction

ButtonInteraction.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ButtonInteraction.g.h"
00007 #include "ButtonInteraction.properties.h"
00008
00009 class ButtonInteraction :
00010     public ReferenceTracker<ButtonInteraction, winrt::implementation::ButtonInteractionT>,
00011     public ButtonInteractionProperties
00012 {
00013 public:
00014     // IButtonInteraction
00015     winrt::ButtonInteractionInvokeMode InvokeMode();
00016     void InvokeMode(winrt::ButtonInteractionInvokeMode const& value);
00017
00018     bool IsHovering();
00019     bool IsPressing();
00020
00021     // INotifyPropertyChanged
00022     winrt::event_token PropertyChanged(winrt::PropertyChangedEventHandler const& value);
00023     void PropertyChanged(winrt::event_token const& token);
00024
00025     winrt::IVectorView<winrt::RoutedEvent> GetSupportedEventsCore();
00026
00027     void OnKeyDown(winrt::UIElement const& sender, winrt::KeyRoutedEventArgs const& args);
00028     void OnKeyUp(winrt::UIElement const& sender, winrt::KeyRoutedEventArgs const& args);
00029
00030     void OnPointerEntered(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args);
00031     void OnPointerExited(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args);
00032     void OnPointerPressed(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args);
00033     void OnPointerReleased(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args);
00034     void OnPointerCanceled(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args);
00035     void OnPointerCaptureLost(winrt::UIElement const& sender, winrt::PointerRoutedEventArgs const& args);
00036
00037 private:
00038     void RaiseInvoked(winrt::UIElement target);
00039     void UpdateIsHovering(bool isHovering);
00040     void UpdateIsPressing(bool isPressing);
00041
00042     winrt::ButtonInteractionInvokeMode m_invokeMode{ winrt::ButtonInteractionInvokeMode::Release };
00043
00044     bool m_isHovering{ false };
00045     bool m_isPressing{ false };
00046     bool m_hasPointerCapture{ false };
00047
00048     event_source<winrt::PropertyChangedEventHandler> m_propertyChangedEventSource{ this };
00049 };
Generated on Sun Dec 1 2024 20:51:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RadialGradientBrush/RadialGradientBrush.h Source File

  • RadialGradientBrush

RadialGradientBrush.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "pch.h"
00007 #include "common.h"
00008 #include "RadialGradientBrush.g.h"
00009 #include "RadialGradientBrush.properties.h"
00010
00011 class RadialGradientBrush :
00012     public ReferenceTracker<RadialGradientBrush, winrt::implementation::RadialGradientBrushT>,
00013     public RadialGradientBrushProperties
00014 {
00015
00016 public:
00017     RadialGradientBrush();
00018     ~RadialGradientBrush() {};
00019
00020     winrt::IObservableVector<winrt::GradientStop> GradientStops();
00021
00022     // IXamlCompositionBrushBase overrides
00023     void OnConnected();
00024     void OnDisconnected();
00025
00026     void OnCenterPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00027     void OnRadiusXPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00028     void OnRadiusYPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00029     void OnGradientOriginPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00030     void OnMappingModePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00031     void OnInterpolationSpacePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00032     void OnSpreadMethodPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
00033
00034 private:
00035     bool m_isConnected{};
00036     winrt::CompositionBrush m_brush{ nullptr };
00037     winrt::IObservableVector<winrt::GradientStop> m_gradientStops{ nullptr };
00038
00039     winrt::Collections::IObservableVector<winrt::GradientStop>::VectorChanged_revoker m_gradientStopsVectorChangedRevoker{};
00040     PropertyChanged_revoker m_fallbackColorChangedRevoker{};
00041
00042     void OnGradientStopsVectorChanged(winrt::Collections::IObservableVector<winrt::GradientStop> const& sender, winrt::Collections::IVectorChangedEventArgs const& e);
00043     void OnFallbackColorChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args);
00044
00045     void EnsureCompositionBrush();
00046
00047     void UpdateCompositionGradientCenter();
00048     void UpdateCompositionGradientRadius();
00049     void UpdateCompositionGradientMappingMode();
00050     void UpdateCompositionGradientOrigin();
00051     void UpdateCompositionGradientStops();
00052     void UpdateCompositionInterpolationSpace();
00053     void UpdateCompositionExtendMode();
00054
00055     void UpdateFallbackBrush();
00056 };
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ItemsRepeaterElementPreparedEventArgs.h Source File

  • Repeater

ItemsRepeaterElementPreparedEventArgs.h

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #pragma once
00005
00006 #include "ItemsRepeaterElementPreparedEventArgs.g.h"
00007
00008 class ItemsRepeaterElementPreparedEventArgs :
00009     public ReferenceTracker<ItemsRepeaterElementPreparedEventArgs, winrt::implementation::ItemsRepeaterElementPreparedEventArgsT, winrt::composable, winrt::composing>
00010 {
00011 public:
00012     ItemsRepeaterElementPreparedEventArgs(
00013         const winrt::UIElement& element,
00014         int index);
00015
00016 #pragma region IElementPreparedEventArgs
00017     winrt::UIElement Element();
00018     int32_t Index();
00019 #pragma endregion
00020
00021     void Update(const winrt::UIElement& element, int index);
00022
00023 private:
00024     tracker_ref<winrt::UIElement> m_element{ this };
00025     int m_index;
00026     winrt::hstring m_viewType;
00027 };
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NumberBoxValueChangedEventArgs Member List

This is the complete list of members for NumberBoxValueChangedEventArgs, including all inherited members.
m_newValue | NumberBoxValueChangedEventArgs | [private]
m_oldValue | NumberBoxValueChangedEventArgs | [private]
NewValue() | NumberBoxValueChangedEventArgs | [inline]
NumberBoxValueChangedEventArgs(double oldValue, double newValue) | NumberBoxValueChangedEventArgs | [inline]
OldValue() | NumberBoxValueChangedEventArgs | [inline]
Generated on Sun Dec 1 2024 20:52:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IndexPathTests Member List

This is the complete list of members for IndexPathTests, including all inherited members.
ValidateIndexPath() IndexPathTests [inline]
Generated on Sun Dec 1 2024 20:53:40 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/XamlControlsResources.properties.cpp Source File

  • Generated

XamlControlsResources.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "XamlControlsResources.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(XamlControlsResources)
00012 }
00013
00014 #include "XamlControlsResources.g.cpp"
00015
00016 GlobalDependencyProperty XamlControlsResourcesProperties::s_UseCompactResourcesProperty{ nullptr };
00017
00018 XamlControlsResourcesProperties::XamlControlsResourcesProperties()
00019 {
00020     EnsureProperties();
00021 }
00022
00023 void XamlControlsResourcesProperties::EnsureProperties()
00024 {
00025     if (!s_UseCompactResourcesProperty)
00026     {
00027         s_UseCompactResourcesProperty =
00028             InitializeDependencyProperty(
00029                 L"UseCompactResources",
00030                 winrt::name_of<bool>(),
00031                 winrt::name_of<winrt::XamlControlsResources>(),
00032                 false /* isAttached */,
00033                 ValueHelper<bool>::BoxValueIfNecessary(false),
00034                 winrt::PropertyChangedCallback(&OnUseCompactResourcesPropertyChanged));
00035     }
00036 }
00037
00038 void XamlControlsResourcesProperties::ClearProperties()
00039 {
00040     s_UseCompactResourcesProperty = nullptr;
00041 }
00042
00043 void XamlControlsResourcesProperties::OnUseCompactResourcesPropertyChanged(
00044     winrt::DependencyObject const& sender,
00045     winrt::DependencyPropertyChangedEventArgs const& args)
00046 {
00047     auto owner = sender.as<winrt::XamlControlsResources>();
00048     winrt::get_self<XamlControlsResources>(owner)->OnPropertyChanged(args);
00049 }
00050
00051 void XamlControlsResourcesProperties::UseCompactResources(bool value)
00052 {
00053     [[gsl::suppress(con)]]
00054     {
00055     static_cast<XamlControlsResources*>(this)->SetValue(s_UseCompactResourcesProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
00056     }
00057 }
00058
00059 bool XamlControlsResourcesProperties::UseCompactResources()
00060 {
00061     return ValueHelper<bool>::CastOrUnbox(static_cast<XamlControlsResources*>(this)->GetValue(s_UseCompactResourcesProperty));
00062 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ImageIcon/APITests/ImageIconTests.cs Source File

  • ImageIcon
  • APITests

ImageIconTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Common;
00006 using System.Collections.Generic;
00007 using Microsoft.UI.Xaml.Controls;
00008 using MUXControlsTestApp.Utilities;
00009 using Microsoft.UI.Xaml.Media.Imaging;
00010 using Microsoft.UI.Xaml.Media;
00011 using Microsoft.UI.Xaml.Controls;
00012
00013 using WEX.TestExecution;
00014 using WEX.TestExecution.Markup;
00015 using WEX.Logging.Interop;
00016
00017 namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests
00018 {
00019
00020     [TestClass]
00021     public class ImageIconTests : ApiTestBase
00022     {
00023         [TestMethod]
00024         public void ImageIconTest()
00025         {
00026             ImageIcon imageIcon = null;
00027             var uri = new Uri("ms-appx:///Assets/Nuclear_symbol.svg");
00028
00029             RunOnUIThread.Execute(() =>
00030             {
00031                 imageIcon = new ImageIcon();
00032
00033                 /*
00034                 #3949 is created to re-enable this part
00035                 This is an unparented ImageIcon, so looking up the default foreground and verifying
00036                 is a bit wierd. The colors are also chaning, so this is going to fail with those changes
00037                 So commenting this check out for now to make the test more resilient.
00038
00039                 var theme = Application.Current.RequestedTheme;
00040                 if (theme == ApplicationTheme.Dark)
00041                 {
00042                     Verify.AreEqual(((SolidColorBrush)imageIcon.Foreground).Color, Colors.White);
00043                 }
00044                 else
00045                 {
00046                     Verify.AreEqual(((SolidColorBrush)imageIcon.Foreground).Color, Colors.Black);
00047                 }
00048                 */
00049
00050                 Log.Comment("Validate that you can change the properties.");
00051
00052                 imageIcon.Foreground = new SolidColorBrush(Microsoft.UI.Colors.Red);
00053                 imageIcon.Source = new SvgImageSource(uri);
00054                 Content = imageIcon;
00055                 Content.UpdateLayout();
00056             });
00057             IdleSynchronizer.Wait();
00058
00059             RunOnUIThread.Execute(() =>
00060             {
00061                 Verify.IsTrue(imageIcon.Foreground is SolidColorBrush);
00062                 Verify.AreEqual(Microsoft.UI.Colors.Red, (imageIcon.Foreground as SolidColorBrush).Color);
00063                 Verify.AreEqual(uri, ((SvgImageSource)imageIcon.Source).UriSource);
00064                 if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
00065                 {
00066                     var image = ((Image)VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(imageIcon, 0), 0));
00067                     Verify.IsTrue(image.IsLoaded);
00068                 }
00069             });
00070         }
00071     }
00072 }
Generated on Sun Dec 1 2024 20:51:55 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements Member List

This is the complete list of members for ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements, including all inherited members.
btnAddMISnapPointUIObject | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
btnAddMRSnapPointUIObject | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
changeScrollPresenterOffset | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
cmbMISnapPointAlignment | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
cmbMRSnapPointAlignment | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
scrollPresenterOffset | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
scrollPresenterOffsetChangeAmount | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
scrollPresenterUIObject | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
txtMISnapPointValueUIObject | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
txtMRSnapPointEndUIObject | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
txtMRSnapPointIntervalUIObject | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
txtMRSnapPointOffsetUIObject | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
txtMRSnapPointStartUIObject | ScrollPresenterTestsWithInputHelper::ScrollSnapPointsTestPageElements
Generated on Sun Dec 1 2024 20:53:50 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ColorPicker/InteractionTests/ColorPickerTests.cs Source File

  • ColorPicker
  • InteractionTests

ColorPickerTests.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using System.Collections.Generic;
00006 using System.Threading;
00007
00008 using Windows.Foundation.Metadata;
00009 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Infra;
00010 using Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests.Common;
00011 using Common;
00012
00013 using WEX.TestExecution;
00014 using WEX.TestExecution.Markup;
00015 using WEX.Logging.Interop;
00016
00017 using Microsoft.Windows.Apps.Test.Automation;
00018 using Microsoft.Windows.Apps.Test.Foundation;
00019 using Microsoft.Windows.Apps.Test.Foundation.Controls;
00020 using Microsoft.Windows.Apps.Test.Foundation.Patterns;
00021 using Microsoft.Windows.Apps.Test.Foundation.Waiters;
00022
00023 namespace Microsoft.UI.Xaml.Tests.MUXControls.InteractionTests
00024 {
00025     // ColorSpectrum doesn't fit any of the primitives provided in MITA,
00026     // so we'll define our own MITA object for it here.
00027     public class ColorSpectrum : UIObject, IValue
00028     {
00029         public ColorSpectrum(UIObject uiObject)
00030             : base(uiObject)
00031         {
00032             this.Initialize();
00033         }
00034
00035         private void Initialize()
00036         {
00037             _valuePattern = new ValueImplementation(this);
00038         }
00039
00040         public ColorChangedEventWaiter GetColorChangedWaiter()
00041         {
00042             return new ColorChangedEventWaiter();
00043         }
00044
00045         public virtual void SetValue(string value)
00046         {
00047             _valuePattern.SetValue(value);
00048         }
00049
00050         public virtual string Value
00051         {
00052             get
00053             {
00054                 return _valuePattern.Value;
00055             }
00056         }
00057
00058         public virtual bool IsReadOnly
00059         {
00060             get
00061             {
00062                 return _valuePattern.IsReadOnly;
00063             }
00064         }
00065
00066         new public static IFactory<ColorSpectrum> Factory
00067         {
00068             get
00069             {
00070                 if (null == ColorSpectrum._factory)
00071                 {
00072                     ColorSpectrum._factory = new ColorSpectrumFactory();
00073                 }
00074                 return ColorSpectrum._factory;
00075             }
00076         }
00077
00078         private IValue _valuePattern;
00079         private static IFactory<ColorSpectrum> _factory = null;
00080
00081         private class ColorSpectrumFactory : IFactory<ColorSpectrum>
00082         {
00083             public ColorSpectrum Create(UIObject element)
00084             {
00085                 return new ColorSpectrum(element);
00086             }
00087         }
00088     }
00089
00090     // Similarly, ColorPickerSlider also doesn't fit any of the primitives
00091     // provided in MITA, so we'll define our own MITA object for it here, too.
00092     public class ColorPickerSlider : UIObject, IValue
00093     {
00094         public ColorPickerSlider(UIObject uiObject)
00095             : base(uiObject)
00096         {
00097             this.Initialize();
00098         }
00099
00100         private void Initialize()
00101         {
00102             _valuePattern = new ValueImplementation(this);
00103         }
00104
00105         public ColorChangedEventWaiter GetColorChangedWaiter()
00106         {
00107             return new ColorChangedEventWaiter();
00108         }
00109
00110         public virtual void SetValue(string value)
00111         {
00112             _valuePattern.SetValue(value);
00113         }
00114
00115         public virtual string Value
00116         {
00117             get
00118             {
00119                 return _valuePattern.Value;
00120             }
00121         }
00122
00123         public virtual bool IsReadOnly
00124         {
00125             get
00126             {
00127                 return _valuePattern.IsReadOnly;
00128             }
00129         }
00130
00131         new public static IFactory<ColorPickerSlider> Factory
00132         {
00133             get
00134             {
00135                 if (null == ColorPickerSlider._factory)
00136                 {
00137                     ColorPickerSlider._factory = new ColorPickerSliderFactory();
00138                 }
00139                 return ColorPickerSlider._factory;
00140             }
00141         }
00142
00143         private IValue _valuePattern;
00144         private static IFactory<ColorPickerSlider> _factory = null;
00145
00146         private class ColorPickerSliderFactory : IFactory<ColorPickerSlider>
00147         {
00148             public ColorPickerSlider Create(UIObject element)
00149             {
00150                 return new ColorPickerSlider(element);
00151             }
00152         }
00153     }
00154
00155     // Depending on the current state of the ColorPicker, either the RGB text boxes will be visible
00156     // or the HSV text boxes will be visible.  Waiting on either triplet works for the purposes of
00157     // waiting for the color to change, hence the odd nomenclature in this class.
00158     public class ColorChangedEventWaiter : Waiter
00159     {
00160         private ValueChangedEventWaiter redOrHueChangedWaiter;
00161         private ValueChangedEventWaiter greenOrSaturationChangedWaiter;
00162         private ValueChangedEventWaiter blueOrValueChangedWaiter;
00163
00164         public ColorChangedEventWaiter()
00165         {
00166             string redOrHueTextBoxAutomationId = null;
00167             string greenOrSaturationTextBoxAutomationId = null;
00168             string blueOrValueTextBoxAutomationId = null;
00169
00170             ColorChannels currentSelectedChannels = ColorPickerTests.GetCurrentlySelectedChannels();
00171
00172             if (currentSelectedChannels == ColorChannels.RGB)
00173             {
00174                 redOrHueTextBoxAutomationId = ColorPickerTests.RedTextBoxAutomationId;
00175                 greenOrSaturationTextBoxAutomationId = ColorPickerTests.GreenTextBoxAutomationId;
00176                 blueOrValueTextBoxAutomationId = ColorPickerTests.BlueTextBoxAutomationId;
00177             }
00178             else
00179             {
00180                 redOrHueTextBoxAutomationId = ColorPickerTests.HueTextBoxAutomationId;
00181                 greenOrSaturationTextBoxAutomationId = ColorPickerTests.SaturationTextBoxAutomationId;
00182                 blueOrValueTextBoxAutomationId = ColorPickerTests.ValueTextBoxAutomationId;
00183             }
00184
00185             redOrHueChangedWaiter = new ValueChangedEventWaiter(new Edit(FindElement.ById(redOrHueTextBoxAutomationId)));
00186             greenOrSaturationChangedWaiter = new ValueChangedEventWaiter(new Edit(FindElement.ById(greenOrSaturationTextBoxAutomationId)));
00187             blueOrValueChangedWaiter = new ValueChangedEventWaiter(new Edit(FindElement.ById(blueOrValueTextBoxAutomationId)));
00188         }
00189
00190         public override void Dispose()
00191         {
00192             redOrHueChangedWaiter.Dispose();
00193             greenOrSaturationChangedWaiter.Dispose();
00194             blueOrValueChangedWaiter.Dispose();
00195         }
00196
00197         public override bool TryWait(TimeSpan timeout)
00198         {
00199             return CompositableWaiter.TryWaitAny(timeout, redOrHueChangedWaiter, greenOrSaturationChangedWaiter, blueOrValueChangedWaiter) != null;
00200         }
00201     }
00202
00203     public enum ColorChannels
00204     {
00205         RGB,
00206         HSV,
00207     }
00208
00209     [TestClass]
00210     public class ColorPickerTests
00211     {
00212         public const string ColorSpectrumAutomationId = "ColorSpectrum";
00213         public const string ThirdDimensionAutomationId = "ThirdDimensionSlider";
00214         public const string AlphaSliderAutomationId = "AlphaSlider";
00215         public const string MoreButtonAutomationId = "MoreButton";
00216         public const string MoreButtonLabelAutomationId = "MoreButtonLabel";
00217         public const string ColorRepresentationComboBoxAutomationId = "ColorRepresentationComboBox";
00218         public const string RGBComboBoxItemAutomationId = "RGBComboBoxItem";
00219         public const string HSVComboBoxItemAutomationId = "HSVComboBoxItem";
00220         public const string RedTextBoxAutomationId = "RedTextBox";
00221         public const string RedLabelAutomationId = "RedLabel";
00222         public const string GreenTextBoxAutomationId = "GreenTextBox";
00223         public const string GreenLabelAutomationId = "GreenLabel";
00224         public const string BlueTextBoxAutomationId = "BlueTextBox";
00225         public const string BlueLabelAutomationId = "BlueLabel";
00226         public const string HueTextBoxAutomationId = "HueTextBox";
00227         public const string HueLabelAutomationId = "HueLabel";
00228         public const string SaturationTextBoxAutomationId = "SaturationTextBox";
00229         public const string SaturationLabelAutomationId = "SaturationLabel";
00230         public const string ValueTextBoxAutomationId = "ValueTextBox";
00231         public const string ValueLabelAutomationId = "ValueLabel";
00232         public const string AlphaTextBoxAutomationId = "AlphaTextBox";
00233         public const string AlphaLabelAutomationId = "AlphaLabel";
00234         public const string HexTextBoxAutomationId = "HexTextBox";
00235
00236         [Flags]
00237         public enum TestOptions
00238         {
00239             None = 0,
00240             EnableAlpha = 1,
00241             EnableMoreButton = 2,
00242             EnableNonEnglishLanguage = 4,
00243             DisableColorSpectrumLoadWait = 8
00244         }
00245
00246         public class Color
00247         {
00248             public byte A { get; set; }
00249             public byte R { get; set; }
00250             public byte G { get; set; }
00251             public byte B { get; set; }
00252
00253             public static Color FromArgb(byte a, byte r, byte g, byte b)
00254             {
00255                 return new Color() { A = a, R = r, G = g, B = b };
00256             }
00257         }
00258
00259         public sealed class ColorPickerTestSetupHelper : TestSetupHelper, IEventSink
00260         {
00261             private PropertyChangedEventSource redEventSource;
00262             private PropertyChangedEventSource greenEventSource;
00263             private PropertyChangedEventSource blueEventSource;
00264             private PropertyChangedEventSource alphaEventSource;
00265
00266             private object lockObject;
00267             private ManualResetEvent colorChangedEvent;
00268             private bool waitingForColorChanged;
00269
00270             public static ColorPickerTestSetupHelper Current
00271             {
00272                 get;
00273                 private set;
00274             }
00275
00276             public Color Color
00277             {
00278                 get;
00279                 private set;
00280             }
00281
00282             public ColorPickerTestSetupHelper(string testName, string languageOverride = "")
00283                 : base(testName, new TestSetupHelperOptions{ LanguageOverride = languageOverride})
00284             {
00285                 Current = this;
00286
00287                 redEventSource = null;
00288                 greenEventSource = null;
00289                 blueEventSource = null;
00290                 alphaEventSource = null;
00291
00292                 lockObject = new object();
00293                 colorChangedEvent = new ManualResetEvent(false);
00294                 waitingForColorChanged = false;
00295             }
00296
00297             public void StartTrackingColorChanges()
00298             {
00299                 Edit redTextBox = new Edit(FindElement.ById(RedTextBoxAutomationId));
00300                 Edit greenTextBox = new Edit(FindElement.ById(GreenTextBoxAutomationId));
00301                 Edit blueTextBox = new Edit(FindElement.ById(BlueTextBoxAutomationId));
00302                 Edit alphaTextBox = new Edit(FindElement.ById(AlphaTextBoxAutomationId));
00303
00304                 Color = Color.FromArgb(ParseAlphaTextBoxValue(alphaTextBox.Value), byte.Parse(redTextBox.Value), byte.Parse(greenTextBox.Value), byte.Parse(blueTextBox.Value));
00305
00306                 redEventSource = new PropertyChangedEventSource(redTextBox, Scope.Element, UIProperty.Get("Value.Value"));
00307                 greenEventSource = new PropertyChangedEventSource(greenTextBox, Scope.Element, UIProperty.Get("Value.Value"));
00308                 blueEventSource = new PropertyChangedEventSource(blueTextBox, Scope.Element, UIProperty.Get("Value.Value"));
00309                 alphaEventSource = new PropertyChangedEventSource(alphaTextBox, Scope.Element, UIProperty.Get("Value.Value"));
00310
00311                 redEventSource.Start(this);
00312                 greenEventSource.Start(this);
00313                 blueEventSource.Start(this);
00314                 alphaEventSource.Start(this);
00315
00316                 Log.Comment("Color-change tracking started. Initial color is RGBA = ({0}, {1}, {2}, {3}).", Color.R, Color.G, Color.B, Color.A);
00317             }
00318
00319             public void ExecuteAndWaitForColorChange(Action action)
00320             {
00321                 waitingForColorChanged = true;
00322                 colorChangedEvent.Reset();
00323                 action();
00324
00325                 Log.Comment("Waiting for color to change...");
00326                 colorChangedEvent.WaitOne();
00327                 Log.Comment("Color changed.");
00328
00329                 waitingForColorChanged = false;
00330             }
00331
00332             protected override void Dispose(bool isDisposing)
00333             {
00334                 base.Dispose(isDisposing);
00335
00336                 lock (lockObject)
00337                 {
00338                     if (redEventSource == null || greenEventSource == null || blueEventSource == null || alphaEventSource == null)
00339                     {
00340                         throw new Exception("Color change tracking was never started. Make sure to call StartTrackingColorChanges() on ColorPickerTestSetupHelper.");
00341                     }
00342
00343                     redEventSource.Stop();
00344                     redEventSource.Dispose();
00345                     redEventSource = null;
00346
00347                     greenEventSource.Stop();
00348                     greenEventSource.Dispose();
00349                     greenEventSource = null;
00350
00351                     blueEventSource.Stop();
00352                     blueEventSource.Dispose();
00353                     blueEventSource = null;
00354
00355                     alphaEventSource.Stop();
00356                     alphaEventSource.Dispose();
00357                     alphaEventSource = null;
00358
00359                     colorChangedEvent.Dispose();
00360                     colorChangedEvent = null;
00361                 }
00362
00363                 Current = null;
00364             }
00365
00366             public void SinkEvent(WaiterEventArgs eventArgs)
00367             {
00368                 lock (lockObject)
00369                 {
00370                     AutomationPropertyChangedEventArgs args = eventArgs.EventArgs as AutomationPropertyChangedEventArgs;
00371                     string channelChanged = string.Empty;
00372                     byte oldValue = 0;
00373                     byte newValue = 0;
00374
00375                     string senderAutomationId = eventArgs.Sender.AutomationId;
00376
00377                     switch (senderAutomationId)
00378                     {
00379                         case RedTextBoxAutomationId:
00380                             channelChanged = "Red";
00381                             oldValue = Color.R;
00382                             Color = Color.FromArgb(Color.A, byte.Parse(args.NewValue as string), Color.G, Color.B);
00383                             newValue = Color.R;
00384                             break;
00385                         case GreenTextBoxAutomationId:
00386                             channelChanged = "Green";
00387                             oldValue = Color.G;
00388                             Color = Color.FromArgb(Color.A, Color.R, byte.Parse(args.NewValue as string), Color.B);
00389                             newValue = Color.G;
00390                             break;
00391                         case BlueTextBoxAutomationId:
00392                             channelChanged = "Blue";
00393                             oldValue = Color.B;
00394                             Color = Color.FromArgb(Color.A, Color.R, Color.G, byte.Parse(args.NewValue as string));
00395                             newValue = Color.B;
00396                             break;
00397                         case AlphaTextBoxAutomationId:
00398                             channelChanged = "Alpha";
00399                             oldValue = Color.A;
00400                             // The alpha text box contains a percentage rather than a number between 0 and 255,
00401                             // so we need to convert it to that before giving its value to ColorHelper.FromArgb().
00402                             Color = Color.FromArgb(ParseAlphaTextBoxValue(args.NewValue), Color.R, Color.G, Color.B);
00403                             newValue = Color.A;
00404                             break;
00405                         default:
00406                             throw new Exception(string.Format("Unknown sender '{0}'.", senderAutomationId));
00407                     }
00408
00409                     Log.Comment("{0} changed from {1} to {2}. Color is now RGBA = ({3}, {4}, {5}, {6}).", channelChanged, oldValue, newValue, Color.R, Color.G, Color.B, Color.A);
00410
00411                     if (waitingForColorChanged && colorChangedEvent != null)
00412                     {
00413                         colorChangedEvent.Set();
00414                     }
00415                 }
00416             }
00417
00418             private byte ParseAlphaTextBoxValue(object value)
00419             {
00420                 return (byte)(byte.Parse((value.ToString()).TrimEnd('%')) * 255 / 100);
00421             }
00422         }
00423
00424         public static ColorChannels GetCurrentlySelectedChannels()
00425         {
00426             ColorChannels currentlySelectedChannels = ColorChannels.RGB;
00427
00428             ComboBox colorRepresentationComboBox = new ComboBox(FindElement.ById(ColorRepresentationComboBoxAutomationId));
00429             ComboBoxItem selectedComboBoxItem = colorRepresentationComboBox.Selection[0];
00430
00431             if (selectedComboBoxItem.AutomationId == RGBComboBoxItemAutomationId)
00432             {
00433                 currentlySelectedChannels = ColorChannels.RGB;
00434             }
00435             else if (selectedComboBoxItem.AutomationId == HSVComboBoxItemAutomationId)
00436             {
00437                 currentlySelectedChannels = ColorChannels.HSV;
00438             }
00439             else
00440             {
00441                 Verify.Fail("We should never have a combo box item that isn't either RGB or HSV.");
00442             }
00443
00444             return currentlySelectedChannels;
00445         }
00446
00447         [ClassInitialize]
00448         [TestProperty("RunAs", "User")]
00449         [TestProperty("Classification", "Integration")]
00450         [TestProperty("TestPass:IncludeOnlyOn", "Desktop")]
00451         public static void ClassInitialize(TestContext testContext)
00452         {
00453             TestEnvironment.Initialize(testContext);
00454         }
00455
00456         [TestCleanup]
00457         public void TestCleanup()
00458         {
00459             TestCleanupHelper.Cleanup();
00460         }
00461
00462         [TestMethod]
00463         public void CanSelectColorFromSpectrumLTR()
00464         {
00465             using (var setup = SetupColorPickerTest())
00466             {
00467                 CanSelectColorFromSpectrum(setup, false /* isRTL */);
00468             }
00469         }
00470
00471         [TestMethod]
00472         public void CanSelectColorFromSpectrumRTL()
00473         {
00474             using (var setup = SetupColorPickerTest())
00475             {
00476                 CanSelectColorFromSpectrum(setup, true /* isRTL */);
00477             }
00478         }
00479
00480         private void CanSelectColorFromSpectrum(ColorPickerTestSetupHelper setup, bool isRTL)
00481         {
00482             SetIsRTL(isRTL);
00483
00484             // We snap to the nearest HSV value and then derive the RGB value and ellipse position from that,
00485             // so we're bound to run into rounding errors along the way, which is what accounts for the slightly
00486             // different values we get in RTL where our x-axis is flipped.
00487             setup.ExecuteAndWaitForColorChange(() => TapOnColorSpectrumAndWaitForColorChange(0.5, 0.5));
00488             VerifySelectedColorIsNear(127, 255, 252);
00489             VerifySelectionEllipseIsNear(127, 127);
00490             setup.ExecuteAndWaitForColorChange(() => TapOnColorSpectrumAndWaitForColorChange(0.25, 0.25));
00491             VerifySelectedColorIsNear(163, isRTL ? 63 : 255, isRTL ? 255 : 63);
00492             VerifySelectionEllipseIsNear(isRTL ? 194 : 63, 63);
00493             setup.ExecuteAndWaitForColorChange(() => TapOnColorSpectrumAndWaitForColorChange(0.75, 0.25));
00494             VerifySelectedColorIsNear(151, isRTL ? 255 : 63, isRTL ? 63 : 255);
00495             VerifySelectionEllipseIsNear(isRTL ? 66 : 191, 63);
00496             setup.ExecuteAndWaitForColorChange(() => TapOnColorSpectrumAndWaitForColorChange(0.25, 0.75));
00497             VerifySelectedColorIsNear(224, isRTL ? 191 : 255, isRTL ? 255 : 191);
00498             VerifySelectionEllipseIsNear(isRTL ? 194 : 63, 192);
00499             setup.ExecuteAndWaitForColorChange(() => TapOnColorSpectrumAndWaitForColorChange(0.75, 0.75));
00500             VerifySelectedColorIsNear(220, isRTL ? 255 : 191, isRTL ? 191 : 255);
00501             VerifySelectionEllipseIsNear(isRTL ? 66 : 191, 192);
00502         }
00503
00504         [TestMethod]
00505         public void VerifyHsvUpdatesOnSpectrumSelection()
00506         {
00507             using (var setup = SetupColorPickerTest())
00508             {
00509                 TapOnColorSpectrumAndWaitForColorChange(0.5, 0.5);
00510                 VerifySelectedColorIsNear(127, 255, 252);
00511                 VerifySelectionEllipseIsNear(127, 127);
00512
00513                 WriteInTextBox(ValueTextBoxAutomationId, "0");
00514                 VerifySelectedColorIsNear(0, 0, 0);
00515
00516                 // Since Value is 0, the RGB value stays black and does not trigger the colorChangedEvent,
00517                 // so this helper function is used instead.
00518                 TapOnColorSpectrum(0.25, 0.25);
00519                 Wait.ForIdle();
00520
00521                 VerifySelectedColorIsNear(0, 0, 0);
00522
00523                 // Allowing +/-1 devation
00524                 const double errorMargin = 1;
00525
00526                 Verify.IsLessThanOrEqual(Math.Abs(90 - Double.Parse((new Edit(FindElement.ById(HueTextBoxAutomationId))).Value)), errorMargin);
00527                 Verify.IsLessThanOrEqual(Math.Abs(75 - Double.Parse((new Edit(FindElement.ById(SaturationTextBoxAutomationId))).Value)), errorMargin);
00528                 Verify.IsLessThanOrEqual(Math.Abs(0 - Double.Parse((new Edit(FindElement.ById(ValueTextBoxAutomationId))).Value)), errorMargin);
00529
00530                 TapOnColorSpectrum(0.75, 0.75);
00531                 Wait.ForIdle();
00532
00533                 VerifySelectedColorIsNear(0, 0, 0);
00534
00535                 Verify.IsLessThanOrEqual(270 - Double.Parse((new Edit(FindElement.ById(HueTextBoxAutomationId))).Value), errorMargin);
00536                 Verify.IsLessThanOrEqual(25 - Double.Parse((new Edit(FindElement.ById(SaturationTextBoxAutomationId))).Value), errorMargin);
00537                 Verify.IsLessThanOrEqual(0 - Double.Parse((new Edit(FindElement.ById(ValueTextBoxAutomationId))).Value), errorMargin);
00538             }
00539         }
00540
00541         [TestMethod]
00542         public void CanSelectPreviousColor()
00543         {
00544             using (var setup = SetupColorPickerTest(TestOptions.DisableColorSpectrumLoadWait))
00545             {
00546                 VerifyPreviousColorIsNull();
00547
00548                 Button previousColorRedButton = new Button(FindElement.ById("PreviousColorRedButton"));
00549                 previousColorRedButton.Invoke();
00550                 VerifyPreviousColorIsEqualTo(255, 0, 0);
00551
00552                 SetColorSpectrumColor(128, 255, 255);
00553                 Button previousColorCurrentColorButton = new Button(FindElement.ById("PreviousColorCurrentColorButton"));
00554                 previousColorCurrentColorButton.Invoke();
00555                 VerifyPreviousColorIsEqualTo(128, 255, 255);
00556             }
00557         }
00558
00559         [TestMethod]
00560         public void CanChangeColorThroughRgbTextEntry()
00561         {
00562             using (var setup = SetupColorPickerTest(TestOptions.DisableColorSpectrumLoadWait))
00563             {
00564                 WriteInTextBox(RedTextBoxAutomationId, "128");
00565                 VerifyColorIsSelected(128, 0, 0);
00566                 WriteInTextBox(GreenTextBoxAutomationId, "128");
00567                 VerifyColorIsSelected(128, 128, 0);
00568                 WriteInTextBox(BlueTextBoxAutomationId, "128");
00569                 VerifyColorIsSelected(128, 128, 128);
00570             }
00571         }
00572
00573         [TestMethod]
00574         public void CanChangeColorThroughHsvTextEntry()
00575         {
00576             using (var setup = SetupColorPickerTest(TestOptions.DisableColorSpectrumLoadWait))
00577             {
00578                 WriteInTextBox(HueTextBoxAutomationId, "120");
00579                 VerifyColorIsSelected(0, 255, 0);
00580                 WriteInTextBox(HueTextBoxAutomationId, "240");
00581                 VerifyColorIsSelected(0, 0, 255);
00582                 WriteInTextBox(SaturationTextBoxAutomationId, "50");
00583                 VerifyColorIsSelected(128, 128, 255);
00584                 WriteInTextBox(SaturationTextBoxAutomationId, "100");
00585                 WriteInTextBox(ValueTextBoxAutomationId, "50");
00586                 VerifyColorIsSelected(0, 0, 128);
00587             }
00588         }
00589
00590         [TestMethod]
00591         public void CanChangeColorThroughOpacityTextEntry()
00592         {
00593             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.DisableColorSpectrumLoadWait))
00594             {
00595                 WriteInTextBox(AlphaTextBoxAutomationId, "50%");
00596                 VerifyColorIsSelected(255, 0, 0, 128);
00597             }
00598         }
00599
00600         [TestMethod]
00601         public void CanChangeColorThroughHexTextEntry()
00602         {
00603             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.DisableColorSpectrumLoadWait))
00604             {
00605                 WriteInTextBox(HexTextBoxAutomationId, "#7F7F7F7F");
00606                 VerifyColorIsSelected(127, 127, 127, 127);
00607             }
00608         }
00609
00610         [TestMethod]
00611         public void SelectionEllipseChangesColorAccordingToSelectedColor()
00612         {
00613             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha))
00614             {
00615                 ComboBox colorSpectrumComponentsComboBox = new ComboBox(FindElement.ById("ColorSpectrumComponentsComboBox"));
00616                 colorSpectrumComponentsComboBox.SelectItemById("ColorSpectrumComponentsHueValue");
00617
00618                 VerifySelectionEllipseColorIsEqualTo(255, 255, 255);
00619                 WriteInTextBox(AlphaTextBoxAutomationId, "0%");
00620                 VerifySelectionEllipseColorIsEqualTo(255, 255, 255);
00621                 WriteInTextBox(HueTextBoxAutomationId, "120");
00622                 VerifySelectionEllipseColorIsEqualTo(0, 0, 0);
00623                 WriteInTextBox(ValueTextBoxAutomationId, "85");
00624                 VerifySelectionEllipseColorIsEqualTo(255, 255, 255);
00625                 WriteInTextBox(SaturationTextBoxAutomationId, "50");
00626                 VerifySelectionEllipseColorIsEqualTo(0, 0, 0);
00627             }
00628         }
00629
00630         [TestMethod]
00631         public void CanUseKeyboardToInteractWithColorSpectrumLTR()
00632         {
00633             CanUseKeyboardToInteractWithColorSpectrum(isRTL: false);
00634         }
00635
00636         [TestMethod]
00637         public void CanUseKeyboardToInteractColorSpectrumRTL()
00638         {
00639             CanUseKeyboardToInteractWithColorSpectrum(isRTL: true);
00640         }
00641
00642         [TestMethod]
00643         public void CanUseKeyboardToInteractWithSlidersLTR()
00644         {
00645             CanUseKeyboardToInteractWithSliders(isRTL: false);
00646             CanUseKeyboardToInteractWithSliders(isRTL: false, shouldTryUpAndDown: true);
00647         }
00648
00649         [TestMethod]
00650         public void CanUseKeyboardToInteractWithSlidersLTRHorizontalOrientation()
00651         {
00652             CanUseKeyboardToInteractWithSliders(isRTL: false, shouldOrientationBeHorizontal: true);
00653             CanUseKeyboardToInteractWithSliders(isRTL: false, shouldTryUpAndDown: true, shouldOrientationBeHorizontal: true);
00654         }
00655
00656         [TestMethod]
00657         public void CanUseKeyboardToInteractSlidersRTL()
00658         {
00659             CanUseKeyboardToInteractWithSliders(isRTL: true);
00660             CanUseKeyboardToInteractWithSliders(isRTL: false, shouldTryUpAndDown: true);
00661         }
00662
00663         [TestMethod]
00664         public void CanUseKeyboardToInteractWithSlidersRTLHorizontalOrientation()
00665         {
00666             CanUseKeyboardToInteractWithSliders(isRTL: true, shouldOrientationBeHorizontal: true);
00667             CanUseKeyboardToInteractWithSliders(isRTL: true, shouldTryUpAndDown: true, shouldOrientationBeHorizontal: true);
00668         }
00669
00670         [TestMethod]
00671         public void CanUseKeyboardToInteractWithTextBoxesForRGBLTR()
00672         {
00673             CanUseKeyboardToInteractWithTextBoxesForRGB(isRTL: false);
00674         }
00675
00676         [TestMethod]
00677         public void CanUseKeyboardToInteractWithTextBoxesForRGBRTL()
00678         {
00679             CanUseKeyboardToInteractWithTextBoxesForRGB(isRTL: true);
00680         }
00681
00682         [TestMethod]
00683         public void CanUseKeyboardToInteractWithTextBoxesForAlphaLTR()
00684         {
00685             CanUseKeyboardToInteractWithTextBoxesForAlpha(isRTL: false);
00686         }
00687
00688         [TestMethod]
00689         public void CanUseKeyboardToInteractWithTextBoxesForAlphaRTL()
00690         {
00691             CanUseKeyboardToInteractWithTextBoxesForAlpha(isRTL: true);
00692         }
00693
00694         [TestMethod]
00695         public void CanUseKeyboardToInteractWithTextBoxesForHSVLTR()
00696         {
00697             CanUseKeyboardToInteractWithTextBoxesForHSV(isRTL: false);
00698         }
00699
00700         [TestMethod]
00701         public void CanUseKeyboardToInteractWithTextBoxesForHSVRTL()
00702         {
00703             CanUseKeyboardToInteractWithTextBoxesForHSV(isRTL: true);
00704         }
00705
00706         [TestMethod]
00707         public void CanUseKeyboardToInteractWithTextBoxesForHexLTR()
00708         {
00709             CanUseKeyboardToInteractWithTextBoxesForHex(isRTL: false);
00710         }
00711
00712         [TestMethod]
00713         public void CanUseKeyboardToInteractWithTextBoxesForHexRTL()
00714         {
00715             CanUseKeyboardToInteractWithTextBoxesForHex(isRTL: true);
00716         }
00717
00718         public void CanUseKeyboardToInteractWithColorSpectrum(bool isRTL)
00719         {
00720             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha))
00721             {
00722                 SetIsRTL(isRTL);
00723
00724                 Log.Comment("Give initial keyboard focus to the color spectrum.");
00725                 FindElement.ById(ColorSpectrumAutomationId).SetFocus();
00726                 Wait.ForIdle();
00727
00728                 VerifyElementIsFocused(ColorSpectrumAutomationId);
00729                 VerifySelectionEllipsePosition(0, 0);
00730
00731                 Log.Comment("Keyboard to the right and left first.  We expect this to change the hue by 1 each time (+/- 4 to one RGB channel), applying wrapping.");
00732                 PressKeyAndWaitForColorChange(isRTL ? Key.Left : Key.Right);
00733                 VerifyColorIsSelected(255, 4, 0);
00734                 VerifyColorNameIsSelected("Red");
00735                 VerifySelectionEllipsePosition(1, 0);
00736                 PressKeyAndWaitForColorChange(isRTL ? Key.Right : Key.Left);
00737                 VerifyColorIsSelected(255, 0, 0);
00738                 VerifyColorNameIsSelected("Red");
00739                 VerifySelectionEllipsePosition(0, 0);
00740                 PressKeyAndWaitForColorChange(isRTL ? Key.Right : Key.Left);
00741                 VerifyColorIsSelected(255, 0, 4);
00742                 VerifyColorNameIsSelected("Red");
00743                 VerifySelectionEllipsePosition(256, 0);
00744                 PressKeyAndWaitForColorChange(isRTL ? Key.Left : Key.Right);
00745                 VerifyColorIsSelected(255, 0, 0);
00746                 VerifyColorNameIsSelected("Red");
00747                 VerifySelectionEllipsePosition(0, 0);
00748
00749                 Log.Comment("Now hold control and keyboard to the right and left again.  We expect this to jump to the next named color each time, applying wrapping.");
00750                 PressKeyAndWaitForColorChange(isRTL ? Key.Left : Key.Right, ModifierKey.Control);
00751                 VerifyColorIsSelected(255, 119, 0);
00752                 VerifyColorNameIsSelected("Orange");
00753                 VerifySelectionEllipsePosition(20, 0);
00754                 PressKeyAndWaitForColorChange(isRTL ? Key.Right : Key.Left, ModifierKey.Control);
00755                 VerifyColorIsSelected(255, 0, 13);
00756                 VerifyColorNameIsSelected("Red");
00757                 VerifySelectionEllipsePosition(255, 0);
00758                 PressKeyAndWaitForColorChange(isRTL ? Key.Right : Key.Left, ModifierKey.Control);
00759                 VerifyColorIsSelected(255, 0, 170);
00760                 VerifyColorNameIsSelected("Pink");
00761                 VerifySelectionEllipsePosition(228, 0);
00762                 PressKeyAndWaitForColorChange(isRTL ? Key.Left : Key.Right, ModifierKey.Control);
00763                 VerifyColorIsSelected(255, 0, 13);
00764                 VerifyColorNameIsSelected("Red");
00765                 VerifySelectionEllipsePosition(255, 0);
00766
00767                 Log.Comment("Next, keyboard up and down.  We expect this to change the saturation by 1 each time (+/- 2.5 to both non-max RGB channels), applying wrapping.");
00768                 PressKeyAndWaitForColorChange(Key.Down);
00769                 VerifyColorIsSelected(255, 3, 15);
00770                 VerifyColorNameIsSelected("Red");
00771                 VerifySelectionEllipsePosition(255, 3);
00772                 PressKeyAndWaitForColorChange(Key.Up);
00773                 VerifyColorIsSelected(255, 0, 13);
00774                 VerifyColorNameIsSelected("Red");
00775                 VerifySelectionEllipsePosition(255, 0);
00776                 PressKeyAndWaitForColorChange(Key.Up);
00777                 VerifyColorIsSelected(255, 255, 255);
00778                 VerifyColorNameIsSelected("White");
00779                 VerifySelectionEllipsePosition(255, 256);
00780                 PressKeyAndWaitForColorChange(Key.Down);
00781                 VerifyColorIsSelected(255, 0, 13);
00782                 VerifyColorNameIsSelected("Red");
00783                 VerifySelectionEllipsePosition(255, 0);
00784
00785                 Log.Comment("Now hold control keyboard up and down again.  We expect this to jump to the next named color each time, applying wrapping.");
00786                 PressKeyAndWaitForColorChange(Key.Down, ModifierKey.Control);
00787                 VerifyColorIsSelected(255, 153, 158);
00788                 VerifyColorNameIsSelected("Rose");
00789                 VerifySelectionEllipsePosition(255, 154);
00790                 PressKeyAndWaitForColorChange(Key.Up, ModifierKey.Control);
00791                 VerifyColorIsSelected(255, 38, 49);
00792                 VerifyColorNameIsSelected("Red");
00793                 VerifySelectionEllipsePosition(255, 38);
00794                 PressKeyAndWaitForColorChange(Key.Up, ModifierKey.Control);
00795                 VerifyColorIsSelected(255, 242, 243);
00796                 VerifyColorNameIsSelected("White");
00797                 VerifySelectionEllipsePosition(255, 243);
00798                 PressKeyAndWaitForColorChange(Key.Down, ModifierKey.Control);
00799                 VerifyColorIsSelected(255, 41, 52);
00800                 VerifyColorNameIsSelected("Red");
00801                 VerifySelectionEllipsePosition(255, 41);
00802                 PressKeyAndWaitForColorChange(Key.Down, ModifierKey.Control);
00803                 VerifyColorIsSelected(255, 153, 158);
00804                 VerifyColorNameIsSelected("Rose");
00805                 VerifySelectionEllipsePosition(255, 154);
00806                 PressKeyAndWaitForColorChange(Key.Up, ModifierKey.Control);
00807                 VerifyColorIsSelected(255, 38, 49);
00808                 VerifyColorNameIsSelected("Red");
00809                 VerifySelectionEllipsePosition(255, 38);
00810             }
00811         }
00812
00813         public void CanUseKeyboardToInteractWithSliders(bool isRTL, bool shouldTryUpAndDown = false, bool shouldOrientationBeHorizontal = false)
00814         {
00815             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.DisableColorSpectrumLoadWait))
00816             {
00817                 SetIsRTL(isRTL);
00818                 SetIsHorizontalOrientation(shouldOrientationBeHorizontal);
00819                 Key increaseKey = shouldTryUpAndDown ? Key.Up : isRTL ? Key.Left : Key.Right;
00820                 Key decreaseKey = shouldTryUpAndDown ? Key.Down : isRTL ? Key.Right : Key.Left;
00821
00822                 Log.Comment("Initialize the color to what it was at the end of CanUseKeyboardToInteractWithColorSpectrum.");
00823                 SetColorSpectrumColor(255, 38, 49);
00824
00825                 Log.Comment("Give initial keyboard focus to the color spectrum.");
00826                 FindElement.ById(ColorSpectrumAutomationId).SetFocus();
00827                 Wait.ForIdle();
00828
00829                 Log.Comment("Give keyboard focus to the value slider using tab.");
00830                 KeyboardHelper.PressKey(Key.Tab);
00831                 VerifyElementIsFocused(ThirdDimensionAutomationId);
00832
00833                 Log.Comment("Keyboard to the right and left first.  We expect this to change the value by 1 each time (+/- 2.5 to the max RGB channel), but not wrap.");
00834                 KeyboardHelper.PressKey(decreaseKey);
00835                 VerifyColorIsSelected(252, 38, 49);
00836                 VerifyColorNameIsSelected("Red");
00837                 KeyboardHelper.PressKey(increaseKey);
00838                 VerifyColorIsSelected(255, 38, 49);
00839                 VerifyColorNameIsSelected("Red");
00840                 KeyboardHelper.PressKey(increaseKey);
00841                 VerifyColorIsSelected(255, 38, 49);
00842                 VerifyColorNameIsSelected("Red");
00843
00844                 Log.Comment("Now hold control and keyboard to the right and left again.  We expect this to jump to the next named color each time, but not wrap.");
00845                 KeyboardHelper.PressKey(decreaseKey, ModifierKey.Control);
00846                 VerifyColorIsSelected(102, 15, 20);
00847                 VerifyColorNameIsSelected("Dark red");
00848                 KeyboardHelper.PressKey(decreaseKey, ModifierKey.Control);
00849                 VerifyColorIsSelected(15, 2, 3);
00850                 VerifyColorNameIsSelected("Black");
00851                 KeyboardHelper.PressKey(decreaseKey, ModifierKey.Control);
00852                 VerifyColorIsSelected(0, 0, 0);
00853                 VerifyColorNameIsSelected("Black");
00854                 KeyboardHelper.PressKey(increaseKey, ModifierKey.Control);
00855                 VerifyColorIsSelected(105, 16, 20);
00856                 VerifyColorNameIsSelected("Dark red");
00857                 KeyboardHelper.PressKey(increaseKey, ModifierKey.Control);
00858                 VerifyColorIsSelected(214, 32, 41);
00859                 VerifyColorNameIsSelected("Red");
00860                 KeyboardHelper.PressKey(increaseKey, ModifierKey.Control);
00861                 VerifyColorIsSelected(255, 38, 49);
00862                 VerifyColorNameIsSelected("Red");
00863
00864                 Log.Comment("Give keyboard focus to the alpha slider using tab.");
00865                 KeyboardHelper.PressKey(Key.Tab);
00866                 VerifyElementIsFocused(AlphaSliderAutomationId);
00867
00868                 Log.Comment("Keyboard to the right and left first.  We expect this to change the alpha by 2.5 each time, but not wrap.");
00869                 KeyboardHelper.PressKey(decreaseKey);
00870                 VerifyColorIsSelected(255, 38, 49, 252);
00871                 KeyboardHelper.PressKey(increaseKey);
00872                 VerifyColorIsSelected(255, 38, 49, 255);
00873                 KeyboardHelper.PressKey(increaseKey);
00874                 VerifyColorIsSelected(255, 38, 49, 255);
00875
00876                 Log.Comment("Now hold control and keyboard to the right and left again.  We expect this to change the alpha by 25 each time, but not wrap.  We also expect us to snap to multiples of 10 if we're between them.");
00877                 KeyboardHelper.PressKey(decreaseKey, ModifierKey.Control);
00878                 VerifyColorIsSelected(255, 38, 49, 230);
00879                 KeyboardHelper.PressKey(increaseKey);
00880                 VerifyColorIsSelected(255, 38, 49, 232);
00881                 KeyboardHelper.PressKey(decreaseKey, ModifierKey.Control);
00882                 VerifyColorIsSelected(255, 38, 49, 230);
00883                 KeyboardHelper.PressKey(increaseKey, ModifierKey.Control);
00884                 VerifyColorIsSelected(255, 38, 49, 255);
00885             }
00886         }
00887
00888         public void CanUseKeyboardToInteractWithTextBoxesForRGB(bool isRTL)
00889         {
00890             using (var setup = SetupColorPickerTest(TestOptions.DisableColorSpectrumLoadWait))
00891             {
00892                 SetIsRTL(isRTL);
00893
00894                 Log.Comment("Initialize the color to a known value.");
00895                 SetColorSpectrumColor(255, 0, 0);
00896
00897                 Log.Comment("Give initial keyboard focus to red text box.");
00898                 FindElement.ById(RedTextBoxAutomationId).SetFocus();
00899                 Wait.ForIdle();
00900
00901                 Log.Comment("Select the current text, and then type in a new number.");
00902                 Edit redTextBox = new Edit(FindElement.ById(RedTextBoxAutomationId));
00903                 redTextBox.DocumentRange.Select();
00904                 KeyboardHelper.EnterText(redTextBox, "128");
00905                 VerifyColorIsSelected(128, 0, 0);
00906
00907                 Log.Comment("Give keyboard focus to the green text box using tab.");
00908                 KeyboardHelper.PressKey(Key.Tab);
00909                 VerifyElementIsFocused(GreenTextBoxAutomationId);
00910
00911                 Log.Comment("Select the current text, and then type in a new number.");
00912                 Edit greenTextBox = new Edit(FindElement.ById(GreenTextBoxAutomationId));
00913                 greenTextBox.DocumentRange.Select();
00914                 KeyboardHelper.EnterText(greenTextBox, "128");
00915                 VerifyColorIsSelected(128, 128, 0);
00916
00917                 Log.Comment("Give keyboard focus to the blue text box using tab.");
00918                 KeyboardHelper.PressKey(Key.Tab);
00919                 VerifyElementIsFocused(BlueTextBoxAutomationId);
00920
00921                 Log.Comment("Select the current text, and then type in a new number.");
00922                 Edit blueTextBox = new Edit(FindElement.ById(BlueTextBoxAutomationId));
00923                 blueTextBox.DocumentRange.Select();
00924                 KeyboardHelper.EnterText(blueTextBox, "128");
00925                 VerifyColorIsSelected(128, 128, 128);
00926             }
00927         }
00928
00929         public void CanUseKeyboardToInteractWithTextBoxesForAlpha(bool isRTL)
00930         {
00931             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.DisableColorSpectrumLoadWait))
00932             {
00933                 SetIsRTL(isRTL);
00934
00935                 Log.Comment("Initialize the color to a known value.");
00936                 SetColorSpectrumColor(255, 0, 0);
00937
00938                 Log.Comment("Give initial keyboard focus to alpha text box.");
00939                 FindElement.ById(AlphaTextBoxAutomationId).SetFocus();
00940                 Wait.ForIdle();
00941
00942                 Log.Comment("Select the current text, and then type in a new number.");
00943                 Edit alphaTextBox = new Edit(FindElement.ById(AlphaTextBoxAutomationId));
00944                 alphaTextBox.DocumentRange.Select();
00945                 KeyboardHelper.EnterText(alphaTextBox, "50%");
00946                 VerifyColorIsSelected(255, 0, 0, 128);
00947             }
00948         }
00949
00950         public void CanUseKeyboardToInteractWithTextBoxesForHSV(bool isRTL)
00951         {
00952             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.DisableColorSpectrumLoadWait))
00953             {
00954                 SetIsRTL(isRTL);
00955
00956                 Log.Comment("Give initial keyboard focus to the color representation combobox.");
00957                 FindElement.ById(ColorRepresentationComboBoxAutomationId).SetFocus();
00958
00959                 Log.Comment("Switch to HSV by pressing down.");
00960                 KeyboardHelper.PressKey(Key.Down);
00961
00962                 Log.Comment("Give keyboard focus to the hue text box using tab.");
00963                 KeyboardHelper.PressKey(Key.Tab);
00964                 VerifyElementIsFocused(HueTextBoxAutomationId);
00965
00966                 Log.Comment("Select the current text, and then type in a new number.");
00967                 Edit hueTextBox = new Edit(FindElement.ById(HueTextBoxAutomationId));
00968                 hueTextBox.DocumentRange.Select();
00969                 KeyboardHelper.EnterText(hueTextBox, "120");
00970                 VerifyColorIsSelected(0, 255, 0);
00971
00972                 Log.Comment("Give keyboard focus to the saturation text box using tab.");
00973                 KeyboardHelper.PressKey(Key.Tab);
00974                 VerifyElementIsFocused(SaturationTextBoxAutomationId);
00975
00976                 Log.Comment("Select the current text, and then type in a new number.");
00977                 Edit saturationTextBox = new Edit(FindElement.ById(SaturationTextBoxAutomationId));
00978                 saturationTextBox.DocumentRange.Select();
00979                 KeyboardHelper.EnterText(saturationTextBox, "50");
00980                 VerifyColorIsSelected(128, 255, 128);
00981
00982                 Log.Comment("Give keyboard focus to the value text box using tab.");
00983                 KeyboardHelper.PressKey(Key.Tab);
00984                 VerifyElementIsFocused(ValueTextBoxAutomationId);
00985
00986                 Log.Comment("Select the current text, and then type in a new number.");
00987                 Edit valueTextBox = new Edit(FindElement.ById(ValueTextBoxAutomationId));
00988                 valueTextBox.DocumentRange.Select();
00989                 KeyboardHelper.EnterText(valueTextBox, "50");
00990                 VerifyColorIsSelected(64, 128, 64);
00991             }
00992         }
00993
00994         public void CanUseKeyboardToInteractWithTextBoxesForHex(bool isRTL)
00995         {
00996             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.DisableColorSpectrumLoadWait))
00997             {
00998                 SetIsRTL(isRTL);
00999
01000                 Log.Comment("Give keyboard focus to the hex text box.");
01001                 FindElement.ById(HexTextBoxAutomationId).SetFocus();
01002                 Wait.ForIdle();
01003
01004                 Log.Comment("Select the current text, and then type in a new number.");
01005                 Edit hexTextBox = new Edit(FindElement.ById(HexTextBoxAutomationId));
01006                 hexTextBox.DocumentRange.Select();
01007                 KeyboardHelper.EnterText(hexTextBox, "#FFFF0000");
01008                 VerifyColorIsSelected(255, 0, 0);
01009             }
01010         }
01011
01012         [TestMethod]
01013         public void VerifySpectrumTakesFocusOnPointerPress()
01014         {
01015             using (var setup = SetupColorPickerTest())
01016             {
01017                 TapOnColorSpectrumAndWaitForColorChange(0.5, 0.5);
01018                 VerifyElementIsFocused(ColorSpectrumAutomationId);
01019             }
01020         }
01021
01022         [TestMethod]
01023         public void VerifyMoreButtonShowsAndHidesTextInputFields()
01024         {
01025             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.EnableMoreButton | TestOptions.DisableColorSpectrumLoadWait))
01026             {
01027                 ToggleButton moreButton = new ToggleButton(FindElement.ById(MoreButtonAutomationId));
01028
01029                 Verify.IsNotNull(TryFindElement.ById(ColorSpectrumAutomationId));
01030                 Verify.IsNotNull(TryFindElement.ById(ThirdDimensionAutomationId));
01031                 Verify.IsNotNull(TryFindElement.ById(AlphaSliderAutomationId));
01032                 Verify.IsNull(TryFindElement.ById(ColorRepresentationComboBoxAutomationId));
01033                 Verify.IsNull(TryFindElement.ById(RedTextBoxAutomationId));
01034                 Verify.IsNull(TryFindElement.ById(GreenTextBoxAutomationId));
01035                 Verify.IsNull(TryFindElement.ById(BlueTextBoxAutomationId));
01036                 Verify.IsNull(TryFindElement.ById(AlphaTextBoxAutomationId));
01037                 Verify.IsNull(TryFindElement.ById(HexTextBoxAutomationId));
01038
01039                 moreButton.Toggle();
01040                 Wait.ForIdle();
01041
01042                 Verify.IsNotNull(TryFindElement.ById(ColorSpectrumAutomationId));
01043                 Verify.IsNotNull(TryFindElement.ById(ThirdDimensionAutomationId));
01044                 Verify.IsNotNull(TryFindElement.ById(AlphaSliderAutomationId));
01045                 Verify.IsNotNull(TryFindElement.ById(ColorRepresentationComboBoxAutomationId));
01046                 Verify.IsNotNull(TryFindElement.ById(RedTextBoxAutomationId));
01047                 Verify.IsNotNull(TryFindElement.ById(GreenTextBoxAutomationId));
01048                 Verify.IsNotNull(TryFindElement.ById(BlueTextBoxAutomationId));
01049                 Verify.IsNotNull(TryFindElement.ById(AlphaTextBoxAutomationId));
01050                 Verify.IsNotNull(TryFindElement.ById(HexTextBoxAutomationId));
01051             }
01052         }
01053
01054         [TestMethod]
01055         public void VerifyInvalidTextEntryIsReverted()
01056         {
01057             using (var setup = SetupColorPickerTest(TestOptions.DisableColorSpectrumLoadWait))
01058             {
01059                 SetMinSaturation(50);
01060                 SetMinValue(50);
01061
01062                 Verify.AreEqual("255", (new Edit(FindElement.ById(RedTextBoxAutomationId))).Value);
01063
01064                 Log.Comment("First, write a completely invalid string, and make sure that it's reverted after focus is lost.");
01065                 WriteInTextBox(RedTextBoxAutomationId, "foo");
01066                 KeyboardHelper.PressKey(Key.Tab);
01067
01068                 Verify.AreEqual("255", (new Edit(FindElement.ById(RedTextBoxAutomationId))).Value);
01069
01070                 Log.Comment("Next, write a string that represents a valid color, but one that is out of range, and then tab away.  We should snap to the closest color in range in this case.");
01071                 WriteInTextBox(RedTextBoxAutomationId, "0");
01072                 KeyboardHelper.PressKey(Key.Tab);
01073
01074                 Verify.AreEqual("128", (new Edit(FindElement.ById(RedTextBoxAutomationId))).Value);
01075                 Verify.AreEqual("64", (new Edit(FindElement.ById(GreenTextBoxAutomationId))).Value);
01076                 Verify.AreEqual("64", (new Edit(FindElement.ById(BlueTextBoxAutomationId))).Value);
01077
01078                 Log.Comment("Now we'll do the same with the HSV text boxes.");
01079                 WriteInTextBox(HueTextBoxAutomationId, "foo");
01080                 KeyboardHelper.PressKey(Key.Tab);
01081
01082                 Verify.AreEqual("0", (new Edit(FindElement.ById(HueTextBoxAutomationId))).Value);
01083
01084                 WriteInTextBox(SaturationTextBoxAutomationId, "0");
01085                 KeyboardHelper.PressKey(Key.Tab);
01086
01087                 Verify.AreEqual("50", (new Edit(FindElement.ById(SaturationTextBoxAutomationId))).Value);
01088
01089                 WriteInTextBox(ValueTextBoxAutomationId, "0");
01090                 KeyboardHelper.PressKey(Key.Tab);
01091
01092                 Verify.AreEqual("50", (new Edit(FindElement.ById(ValueTextBoxAutomationId))).Value);
01093
01094                 Log.Comment("And similarly for the hex text box.");
01095
01096                 WriteInTextBox(HexTextBoxAutomationId, "#foo");
01097                 KeyboardHelper.PressKey(Key.Tab);
01098
01099                 Verify.AreEqual("#804040", (new Edit(FindElement.ById(HexTextBoxAutomationId))).Value);
01100
01101                 WriteInTextBox(HexTextBoxAutomationId, "#000000");
01102                 KeyboardHelper.PressKey(Key.Tab);
01103
01104                 Verify.AreEqual("#804040", (new Edit(FindElement.ById(HexTextBoxAutomationId))).Value);
01105             }
01106         }
01107
01108         [TestMethod]
01109         public void VerifyHexStringAndColorAreInSync()
01110         {
01111             using (var setup = SetupColorPickerTest(TestOptions.DisableColorSpectrumLoadWait))
01112             {
01113                 SetColorSpectrumColor(128, 255, 255);
01114                 Verify.AreEqual("#80FFFF", (new Edit(FindElement.ById(HexTextBoxAutomationId))).Value);
01115             }
01116         }
01117
01118         [TestMethod]
01119         public void VerifyEllipsePositionIsClampedToSpectrumBounds()
01120         {
01121             using (var setup = SetupColorPickerTest())
01122             {
01123                 SetMinSaturation(50);
01124                 InputHelper.Tap(FindElement.ById("ColorWhiteButton"));
01125
01126                 VerifySelectionEllipsePosition(0, 256);
01127             }
01128         }
01129
01130         [TestMethod]
01131         public void VerifyCanChangeColorWithTouchWithoutPanning()
01132         {
01133             using (var setup = SetupColorPickerTest())
01134             {
01135                 ScrollImplementation scrollViewer = new ScrollImplementation(FindElement.ById("ColorPickerScrollViewer"));
01136                 double initialVerticalScroll = scrollViewer.VerticalScrollPercent;
01137
01138                 ColorSpectrum colorSpectrum = new ColorSpectrum(FindElement.ById(ColorSpectrumAutomationId));
01139                 InputHelper.DragDistance(colorSpectrum, 50, Direction.North);
01140
01141                 Verify.AreEqual(initialVerticalScroll, scrollViewer.VerticalScrollPercent);
01142             }
01143         }
01144
01145         [TestMethod]
01146         public void VerifyMoreButtonRespondsToThemeChanges()
01147         {
01148             using (var setup = SetupColorPickerTest(TestOptions.EnableMoreButton | TestOptions.DisableColorSpectrumLoadWait))
01149             {
01150                 Button themeLightButton = new Button(FindElement.ById("ThemeLightButton"));
01151                 Button themeDarkButton = new Button(FindElement.ById("ThemeDarkButton"));
01152
01153                 TextBlock moreButtonForegroundTextBlock = new TextBlock(FindElement.ById("MoreButtonForegroundTextBlock"));
01154                 TextBlock moreButtonBackgroundTextBlock = new TextBlock(FindElement.ById("MoreButtonBackgroundTextBlock"));
01155                 TextBlock moreButtonBorderBrushTextBlock = new TextBlock(FindElement.ById("MoreButtonBorderBrushTextBlock"));
01156
01157                 themeLightButton.Invoke();
01158                 Wait.ForIdle();
01159
01160                 Verify.AreEqual<string>("#FF000000", moreButtonForegroundTextBlock.DocumentText);
01161                 Verify.AreEqual<string>("#00FFFFFF", moreButtonBackgroundTextBlock.DocumentText);
01162                 Verify.AreEqual<string>("#00FFFFFF", moreButtonBorderBrushTextBlock.DocumentText);
01163
01164                 themeDarkButton.Invoke();
01165                 Wait.ForIdle();
01166
01167                 Verify.AreEqual<string>("#FFFFFFFF", moreButtonForegroundTextBlock.DocumentText);
01168                 Verify.AreEqual<string>("#00FFFFFF", moreButtonBackgroundTextBlock.DocumentText);
01169                 Verify.AreEqual<string>("#00FFFFFF", moreButtonBorderBrushTextBlock.DocumentText);
01170             }
01171         }
01172
01173         [TestMethod]
01174         public void VerifyAutomationNamesAreCorrect()
01175         {
01176             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.DisableColorSpectrumLoadWait))
01177             {
01178                 Verify.AreEqual("Color picker", FindElement.ById(ColorSpectrumAutomationId).Name);
01179                 Verify.AreEqual("Value (Brightness)", FindElement.ById(ThirdDimensionAutomationId).Name);
01180                 Verify.AreEqual("Opacity", FindElement.ById(AlphaSliderAutomationId).Name);
01181                 Verify.AreEqual("Color model", FindElement.ById(ColorRepresentationComboBoxAutomationId).Name);
01182                 Verify.AreEqual("Red", FindElement.ById(RedTextBoxAutomationId).Name);
01183                 Verify.AreEqual("Green", FindElement.ById(GreenTextBoxAutomationId).Name);
01184                 Verify.AreEqual("Blue", FindElement.ById(BlueTextBoxAutomationId).Name);
01185                 Verify.AreEqual("RGB hex", FindElement.ById(HexTextBoxAutomationId).Name);
01186                 SelectTextBoxes(ColorChannels.HSV);
01187                 Verify.AreEqual("Hue", FindElement.ById(HueTextBoxAutomationId).Name);
01188                 Verify.AreEqual("Saturation", FindElement.ById(SaturationTextBoxAutomationId).Name);
01189                 Verify.AreEqual("Value (Brightness)", FindElement.ById(ValueTextBoxAutomationId).Name);
01190                 Verify.AreEqual("HSV hex", FindElement.ById(HexTextBoxAutomationId).Name);
01191             }
01192         }
01193
01194         // Color change for ColorPicker trigs CColorSpectrum::RaiseColorChanged
01195         // Verify it's not crashed when ColorSpectrum is invisiable
01196         [TestMethod]
01197         public void ValidateNoCrashWhenWhenColorSpectrumInvisibleAndColorChanged()
01198         {
01199             using (var setup = SetupColorPickerTest())
01200             {
01201                 Log.Comment("Hide ColorSpectrum");
01202                 CheckBox isColorSpectrumVisible = new CheckBox(FindElement.ById("ColorSpectrumVisibleCheckBox"));
01203                 isColorSpectrumVisible.Toggle();
01204                 Wait.ForIdle();
01205
01206                 Log.Comment("Change Color");
01207                 InputHelper.Tap(FindElement.ById("ColorWhiteButton"));
01208             }
01209         }
01210
01211         [TestMethod]
01212         public void VerifyColorSpectrumAutomationValuesAreCorrect()
01213         {
01214             using (var setup = SetupColorPickerTest())
01215             {
01216                 ColorSpectrum colorSpectrum = new ColorSpectrum(FindElement.ById(ColorSpectrumAutomationId));
01217                 colorSpectrum.SetFocus();
01218
01219                 Verify.AreEqual("2D slider", colorSpectrum.LocalizedControlType);
01220                 Verify.AreEqual("2D navigation with arrow keys", colorSpectrum.HelpText);
01221
01222                 Verify.AreEqual("Red, Hue 0, Saturation 100, Value 100", colorSpectrum.Value);
01223                 KeyboardHelper.PressKey(Key.Right);
01224                 Verify.AreEqual("Red, Hue 1, Saturation 100, Value 100", colorSpectrum.Value);
01225                 KeyboardHelper.PressKey(Key.Right, ModifierKey.Control);
01226                 Verify.AreEqual("Orange, Hue 28, Saturation 100, Value 100", colorSpectrum.Value);
01227             }
01228         }
01229
01230         [TestMethod]
01231         public void VerifyThirdDimensionSliderAutomationValuesAreCorrect()
01232         {
01233             using (var setup = SetupColorPickerTest(TestOptions.DisableColorSpectrumLoadWait))
01234             {
01235                 ColorPickerSlider thirdDimensionSlider = new ColorPickerSlider(FindElement.ById(ThirdDimensionAutomationId));
01236                 thirdDimensionSlider.SetFocus();
01237
01238                 Verify.AreEqual("100, Red", thirdDimensionSlider.Value);
01239                 KeyboardHelper.PressKey(Key.Left);
01240                 Verify.AreEqual("99, Red", thirdDimensionSlider.Value);
01241                 KeyboardHelper.PressKey(Key.Left, ModifierKey.Control);
01242                 Verify.AreEqual("46, Dark red", thirdDimensionSlider.Value);
01243             }
01244         }
01245
01246         // In the OS repo, we run tests against rs_onecore_dep_uxp_dev, and localization resources are not created for OS builds from that repo.
01247         // As a result, we can't test localization there.  The functionality that this is testing is just whether ColorPicker is properly
01248         // loading resources instead of having any hard-coded strings, so running this test only in the MUXControls repo should be OK -
01249         // we don't have any OS repo-specific code in what this is testing, so nothing should change between the two repos.
01250         //[TestMethod] Bug 24048408: DCPP: Multiple MUXC interaction tests fail in CatGates due to taking too long to execute
01251         public void VerifyStringsAreLocalizedCorrectly()
01252         {
01253             // First gather all of the text from the English version of the test page.
01254             List<string> englishStrings = new List<string>();
01255
01256             Log.Comment("Collecting en-US strings...");
01257
01258             using (var setup = SetupColorPickerTest(
01259                 TestOptions.EnableAlpha |
01260                 TestOptions.EnableMoreButton |
01261                 TestOptions.DisableColorSpectrumLoadWait))
01262             {
01263                 GetLocalizedText(englishStrings);
01264             }
01265
01266             // Now switch to Japanese and gather all of the new text from the test page.
01267             List<string> otherLanguageStrings = new List<string>();
01268
01269             Log.Comment("Collecting ja-JP strings...");
01270
01271             using (var setup = SetupColorPickerTest(
01272                 TestOptions.EnableAlpha |
01273                 TestOptions.EnableMoreButton |
01274                 TestOptions.EnableNonEnglishLanguage |
01275                 TestOptions.DisableColorSpectrumLoadWait))
01276             {
01277                 GetLocalizedText(otherLanguageStrings);
01278             }
01279
01280             LocalizationHelper.CompareStringSets(englishStrings, otherLanguageStrings);
01281         }
01282
01283         [TestMethod]
01284         public void VerifyTabFocusOrder()
01285         {
01286             using (var setup = SetupColorPickerTest(TestOptions.EnableAlpha | TestOptions.DisableColorSpectrumLoadWait))
01287             {
01288                 Log.Comment("Give initial keyboard focus to the color spectrum.");
01289                 FindElement.ById(ColorSpectrumAutomationId).SetFocus();
01290                 Wait.ForIdle();
01291
01292                 Log.Comment("Give keyboard focus to the value slider using tab.");
01293                 KeyboardHelper.PressKey(Key.Tab);
01294                 VerifyElementIsFocused(ThirdDimensionAutomationId);
01295
01296                 Log.Comment("Give keyboard focus to the alpha slider using tab.");
01297                 KeyboardHelper.PressKey(Key.Tab);
01298                 VerifyElementIsFocused(AlphaSliderAutomationId);
01299
01300                 Log.Comment("Give keyboard focus to the Color Representation ComboBox using tab.");
01301                 KeyboardHelper.PressKey(Key.Tab);
01302                 VerifyElementIsFocused(ColorRepresentationComboBoxAutomationId);
01303
01304                 Log.Comment("Give keyboard focus to the red text box using tab.");
01305                 KeyboardHelper.PressKey(Key.Tab);
01306                 VerifyElementIsFocused(RedTextBoxAutomationId);
01307
01308                 Log.Comment("Give keyboard focus to the green text box using tab.");
01309                 KeyboardHelper.PressKey(Key.Tab);
01310                 VerifyElementIsFocused(GreenTextBoxAutomationId);
01311
01312                 Log.Comment("Give keyboard focus to the blue text box using tab.");
01313                 KeyboardHelper.PressKey(Key.Tab);
01314                 VerifyElementIsFocused(BlueTextBoxAutomationId);
01315
01316                 Log.Comment("Give keyboard focus to the alpha text box using tab.");
01317                 KeyboardHelper.PressKey(Key.Tab);
01318                 VerifyElementIsFocused(AlphaTextBoxAutomationId);
01319
01320                 Log.Comment("Give keyboard focus to the hex text box using tab.");
01321                 KeyboardHelper.PressKey(Key.Tab);
01322                 VerifyElementIsFocused(HexTextBoxAutomationId);
01323
01324                 SetIsHorizontalOrientation(true);
01325
01326                 Log.Comment("Give initial keyboard focus to the color spectrum.");
01327                 FindElement.ById(ColorSpectrumAutomationId).SetFocus();
01328                 Wait.ForIdle();
01329
01330                 Log.Comment("Give keyboard focus to the value slider using tab.");
01331                 KeyboardHelper.PressKey(Key.Tab);
01332                 VerifyElementIsFocused(ThirdDimensionAutomationId);
01333
01334                 Log.Comment("Give keyboard focus to the alpha slider using tab.");
01335                 KeyboardHelper.PressKey(Key.Tab);
01336                 VerifyElementIsFocused(AlphaSliderAutomationId);
01337
01338                 Log.Comment("Give keyboard focus to the hex text box using tab.");
01339                 KeyboardHelper.PressKey(Key.Tab);
01340                 VerifyElementIsFocused(HexTextBoxAutomationId);
01341
01342                 Log.Comment("Give keyboard focus to the Color Representation ComboBox using tab.");
01343                 KeyboardHelper.PressKey(Key.Tab);
01344                 VerifyElementIsFocused(ColorRepresentationComboBoxAutomationId);
01345
01346                 Log.Comment("Give keyboard focus to the red text box using tab.");
01347                 KeyboardHelper.PressKey(Key.Tab);
01348                 VerifyElementIsFocused(RedTextBoxAutomationId);
01349
01350                 Log.Comment("Give keyboard focus to the green text box using tab.");
01351                 KeyboardHelper.PressKey(Key.Tab);
01352                 VerifyElementIsFocused(GreenTextBoxAutomationId);
01353
01354                 Log.Comment("Give keyboard focus to the blue text box using tab.");
01355                 KeyboardHelper.PressKey(Key.Tab);
01356                 VerifyElementIsFocused(BlueTextBoxAutomationId);
01357
01358                 Log.Comment("Give keyboard focus to the alpha text box using tab.");
01359                 KeyboardHelper.PressKey(Key.Tab);
01360                 VerifyElementIsFocused(AlphaTextBoxAutomationId);
01361             }
01362         }
01363
01364         private void GetLocalizedText(IList<string> stringList)
01365         {
01366             ColorSpectrum colorSpectrum = new ColorSpectrum(FindElement.ById(ColorSpectrumAutomationId));
01367             stringList.Add(colorSpectrum.Value);
01368             stringList.Add(colorSpectrum.LocalizedControlType);
01369             stringList.Add(colorSpectrum.HelpText);
01370
01371             ColorPickerSlider thirdDimensionSlider = new ColorPickerSlider(FindElement.ById(ThirdDimensionAutomationId));
01372             stringList.Add(thirdDimensionSlider.Name);
01373             stringList.Add(thirdDimensionSlider.Value);
01374
01375             ColorPickerSlider alphaSlider = new ColorPickerSlider(FindElement.ById(AlphaSliderAutomationId));
01376             stringList.Add(alphaSlider.Name);
01377
01378             ToggleButton moreButton = new ToggleButton(FindElement.ById(MoreButtonAutomationId));
01379             stringList.Add(moreButton.Name);
01380             stringList.Add(FindElement.ById(MoreButtonLabelAutomationId).Name);
01381
01382             moreButton.Toggle();
01383             Wait.ForIdle();
01384
01385             stringList.Add(moreButton.Name);
01386             stringList.Add(FindElement.ById(MoreButtonLabelAutomationId).Name);
01387
01388             ComboBox colorRepresentationComboBox = new ComboBox(FindElement.ById(ColorRepresentationComboBoxAutomationId));
01389             stringList.Add(colorRepresentationComboBox.Name);
01390
01391             stringList.Add(FindElement.ById(RedLabelAutomationId).Name);
01392             stringList.Add(FindElement.ById(GreenLabelAutomationId).Name);
01393             stringList.Add(FindElement.ById(BlueLabelAutomationId).Name);
01394
01395             SelectTextBoxes(ColorChannels.HSV);
01396
01397             stringList.Add(FindElement.ById(HueLabelAutomationId).Name);
01398             stringList.Add(FindElement.ById(SaturationLabelAutomationId).Name);
01399             stringList.Add(FindElement.ById(ValueLabelAutomationId).Name);
01400
01401             stringList.Add(FindElement.ById(AlphaLabelAutomationId).Name);
01402         }
01403
01404         private ColorPickerTestSetupHelper SetupColorPickerTest(TestOptions options = TestOptions.None)
01405         {
01406             var setup = new ColorPickerTestSetupHelper(
01407                 "ColorPicker Tests",
01408                 languageOverride : (options & TestOptions.EnableNonEnglishLanguage) == TestOptions.EnableNonEnglishLanguage ? "ja-JP" : "");
01409
01410             // On CHK builds, waiting for the color spectrum to load can take a while, which contributes
01411             // several seconds towards CatGates' 30-second timeout. As a result, we should only wait
01412             // for it to load in tests where we're actually going to be interacting with it.
01413             if ((options & TestOptions.DisableColorSpectrumLoadWait) != TestOptions.DisableColorSpectrumLoadWait)
01414             {
01415                 // This is a bit of a hack - the ColorSpectrum can't be interacted with until it loads asynchronously,
01416                 // so we need to wait until that has occurred.  There's no publicly accessible event saying that it's loaded,
01417                 // so to get around that, we toggle the value of a check box in the test app to indicate that loading has completed.
01418                 Log.Comment("Wait until the color spectrum image has loaded.");
01419                 CheckBox cb = new CheckBox(FindElement.ById("ColorSpectrumLoadedCheckBox"));
01420
01421                 using (var waiter = cb.GetToggledWaiter())
01422                 {
01423                     if (cb.ToggleState != ToggleState.On)
01424                     {
01425                         waiter.Wait();
01426                     }
01427                 }
01428
01429                 Log.Comment("Color spectrum image loaded.");
01430             }
01431
01432             SetIsAlphaEnabled((options & TestOptions.EnableAlpha) == TestOptions.EnableAlpha);
01433             SetIsMoreButtonEnabled((options & TestOptions.EnableMoreButton) == TestOptions.EnableMoreButton);
01434
01435             setup.StartTrackingColorChanges();
01436
01437             Wait.ForIdle();
01438
01439             return setup;
01440         }
01441
01442         private void SetColorSpectrumColor(int red, int green, int blue, int alpha = 255)
01443         {
01444             ColorSpectrum colorSpectrum = new ColorSpectrum(FindElement.ById(ColorSpectrumAutomationId));
01445
01446             string colorString = "#";
01447
01448             // "X2" means "output as hex and pad with zeroes if needed to make the string two characters long".
01449             colorString += alpha.ToString("X2");
01450             colorString += red.ToString("X2");
01451             colorString += green.ToString("X2");
01452             colorString += blue.ToString("X2");
01453
01454             using (var waiter = colorSpectrum.GetColorChangedWaiter())
01455             {
01456                 Log.Comment("Setting ColorSpectrum color to {0}.", colorString);
01457                 colorSpectrum.SetValue(colorString);
01458             }
01459
01460             Wait.ForIdle();
01461         }
01462
01463         private void TapOnColorSpectrum(double xPercent, double yPercent)
01464         {
01465             ColorSpectrum colorSpectrum = new ColorSpectrum(FindElement.ById(ColorSpectrumAutomationId));
01466
01467             int colorSpectrumWidth = colorSpectrum.BoundingRectangle.Width;
01468             int colorSpectrumHeight = colorSpectrum.BoundingRectangle.Height;
01469
01470             double xPosition = xPercent * (colorSpectrumWidth - 1);
01471             double yPosition = yPercent * (colorSpectrumHeight - 1);
01472
01473             InputHelper.Tap(colorSpectrum, xPosition, yPosition);
01474         }
01475
01476         private void TapOnColorSpectrumAndWaitForColorChange(double xPercent, double yPercent)
01477         {
01478             ColorSpectrum colorSpectrum = new ColorSpectrum(FindElement.ById(ColorSpectrumAutomationId));
01479
01480             int colorSpectrumWidth = colorSpectrum.BoundingRectangle.Width;
01481             int colorSpectrumHeight = colorSpectrum.BoundingRectangle.Height;
01482
01483             double xPosition = xPercent * (colorSpectrumWidth - 1);
01484             double yPosition = yPercent * (colorSpectrumHeight - 1);
01485
01486             ColorPickerTestSetupHelper.Current.ExecuteAndWaitForColorChange(
01487                 () => InputHelper.Tap(colorSpectrum, xPosition, yPosition)
01488             );
01489         }
01490
01491         private void PressKeyAndWaitForColorChange(Key key, ModifierKey modifierKey = ModifierKey.None, uint numPresses = 1)
01492         {
01493             ColorPickerTestSetupHelper.Current.ExecuteAndWaitForColorChange(() => KeyboardHelper.PressKey(key, modifierKey, numPresses));
01494         }
01495
01496         private void WriteInTextBox(string textBoxName, string s)
01497         {
01498             Log.Comment("Retrieve text box with name '{0}'.", textBoxName);
01499
01500             if (textBoxName == RedTextBoxAutomationId ||
01501                 textBoxName == GreenTextBoxAutomationId ||
01502                 textBoxName == BlueTextBoxAutomationId)
01503             {
01504                 SelectTextBoxes(ColorChannels.RGB);
01505             }
01506             else if (textBoxName == HueTextBoxAutomationId ||
01507                 textBoxName == SaturationTextBoxAutomationId ||
01508                 textBoxName == ValueTextBoxAutomationId)
01509             {
01510                 SelectTextBoxes(ColorChannels.HSV);
01511             }
01512             else if (textBoxName == AlphaTextBoxAutomationId)
01513             {
01514                 SetIsAlphaEnabled(true);
01515             }
01516
01517             KeyboardHelper.EnterText(new Edit(FindElement.ById(textBoxName)), s);
01518         }
01519
01520         private void SelectTextBoxes(ColorChannels channels)
01521         {
01522             ColorChannels currentlySelectedChannels = GetCurrentlySelectedChannels();
01523             ComboBox colorRepresentationComboBox = new ComboBox(FindElement.ById(ColorRepresentationComboBoxAutomationId));
01524
01525             Log.Comment("{0} text boxes requested, {1} text boxes currently selected.", channels == ColorChannels.RGB ? "RGB" : "HSV", currentlySelectedChannels == ColorChannels.RGB ? "RGB" : "HSV");
01526
01527             if (currentlySelectedChannels != channels)
01528             {
01529                 currentlySelectedChannels = channels;
01530
01531                 Log.Comment("Change the combo box to select {0} text boxes.", channels == ColorChannels.RGB ? "RGB" : "HSV");
01532                 colorRepresentationComboBox.SelectItemById(channels == ColorChannels.RGB ? RGBComboBoxItemAutomationId : HSVComboBoxItemAutomationId);
01533             }
01534             else
01535             {
01536                 Log.Comment("No need to change the combo box - we already have the right text box set selected.");
01537             }
01538         }
01539
01540         private void SetIsAlphaEnabled(bool isAlphaEnabled)
01541         {
01542             CheckBox isAlphaEnabledCheckBox = new CheckBox(FindElement.ById("AlphaEnabledCheckBox"));
01543
01544             if (isAlphaEnabled && isAlphaEnabledCheckBox.ToggleState != ToggleState.On ||
01545                 !isAlphaEnabled && isAlphaEnabledCheckBox.ToggleState != ToggleState.Off)
01546             {
01547                 isAlphaEnabledCheckBox.Toggle();
01548                 Wait.ForIdle();
01549             }
01550         }
01551
01552         private void SetIsMoreButtonEnabled(bool isMoreButtonEnabled)
01553         {
01554             CheckBox isMoreButtonVisibleCheckBox = new CheckBox(FindElement.ById("MoreButtonVisibleCheckBox"));
01555
01556             if (isMoreButtonEnabled && isMoreButtonVisibleCheckBox.ToggleState != ToggleState.On ||
01557                 !isMoreButtonEnabled && isMoreButtonVisibleCheckBox.ToggleState != ToggleState.Off)
01558             {
01559                 isMoreButtonVisibleCheckBox.Toggle();
01560                 Wait.ForIdle();
01561             }
01562         }
01563
01564         private bool GetIsRTL()
01565         {
01566             CheckBox isRTLCheckBox = new CheckBox(FindElement.ById("IsRtlCheckBox"));
01567             return isRTLCheckBox.ToggleState == ToggleState.On;
01568         }
01569
01570         private void SetIsRTL(bool isRTL)
01571         {
01572             CheckBox isRTLCheckBox = new CheckBox(FindElement.ById("IsRtlCheckBox"));
01573
01574             if (isRTL && isRTLCheckBox.ToggleState != ToggleState.On ||
01575                 !isRTL && isRTLCheckBox.ToggleState != ToggleState.Off)
01576             {
01577                 isRTLCheckBox.Toggle();
01578                 Wait.ForIdle();
01579             }
01580         }
01581
01582         private void SetIsHorizontalOrientation(bool shouldBeHorizontal)
01583         {
01584             ComboBox isRTLCheckBox = new ComboBox(FindElement.ById("OrientationComboBox"));
01585             isRTLCheckBox.SelectItemById(shouldBeHorizontal ? "OrientationHorizontal" : "OrientationVertical");
01586             Wait.ForIdle();
01587         }
01588
01589         private void SetMinSaturation(double minSaturation)
01590         {
01591             Log.Comment("Setting MinSaturation to {0}.", minSaturation);
01592             RangeValueSlider minSaturationSlider = new RangeValueSlider(FindElement.ById("MinimumSaturationSlider"));
01593             SetSaturation(minSaturationSlider, minSaturation);
01594         }
01595
01596         private void SetMaxSaturation(double maxSaturation)
01597         {
01598             Log.Comment("Setting MaxSaturation to {0}.", maxSaturation);
01599             RangeValueSlider maxSaturationSlider = new RangeValueSlider(FindElement.ById("MaximumSaturationSlider"));
01600             SetSaturation(maxSaturationSlider, maxSaturation);
01601         }
01602
01603         private void SetSaturation(RangeValueSlider saturationSlider, double saturation)
01604         {
01605             if (saturationSlider.Value != saturation)
01606             {
01607                 CheckBox cb = new CheckBox(FindElement.ById("ColorSpectrumLoadedCheckBox"));
01608
01609                 using (var waiter = cb.GetToggledWaiter())
01610                 {
01611                     if (cb.ToggleState != ToggleState.Off)
01612                     {
01613                         cb.Toggle();
01614                         Wait.ForIdle();
01615                     }
01616
01617                     saturationSlider.SetValue(saturation);
01618                     Log.Comment("Waiting for the color spectrum image to be reloaded...");
01619                     waiter.Wait();
01620                 }
01621
01622                 Log.Comment("Color spectrum image loaded.");
01623             }
01624         }
01625
01626         private void SetMinValue(double minValue)
01627         {
01628             Log.Comment("Setting MinValue to {0}.", minValue);
01629             RangeValueSlider minValueSlider = new RangeValueSlider(FindElement.ById("MinimumValueSlider"));
01630             SetValue(minValueSlider, minValue);
01631         }
01632
01633         private void SetMaxValue(double maxValue)
01634         {
01635             Log.Comment("Setting MaxValue to {0}.", maxValue);
01636             RangeValueSlider maxValueSlider = new RangeValueSlider(FindElement.ById("MaximumValueSlider"));
01637             SetValue(maxValueSlider, maxValue);
01638         }
01639
01640         private void SetValue(RangeValueSlider valueSlider, double value)
01641         {
01642             RangeValueSlider minValueSlider = new RangeValueSlider(FindElement.ById("MinimumValueSlider"));
01643
01644             if (minValueSlider.Value != value)
01645             {
01646                 minValueSlider.SetValue(value);
01647                 // The value is tracked by the slider, meaning that we don't have to wait for
01648                 // the color spectrum image to be reloaded in this circumstance.
01649             }
01650         }
01651
01652         private void VerifyColorIsSelected(int expectedRed, int expectedGreen, int expectedBlue, int expectedAlpha = 255)
01653         {
01654             VerifyColorIsSelectedCore(expectedRed, expectedGreen, expectedBlue, expectedAlpha, 1 /* allowedMargin */);
01655         }
01656
01657         private void VerifySelectedColorIsNear(int expectedRed, int expectedGreen, int expectedBlue, int expectedAlpha = 255)
01658         {
01659             VerifyColorIsSelectedCore(expectedRed, expectedGreen, expectedBlue, expectedAlpha, 10 /* allowedMargin */);
01660         }
01661
01662         private void VerifyColorIsSelectedCore(int expectedRed, int expectedGreen, int expectedBlue, int expectedAlpha, int allowedMargin)
01663         {
01664             Color currentColor = ColorPickerTestSetupHelper.Current.Color;
01665
01666             int actualRed = currentColor.R;
01667             int actualGreen = currentColor.G;
01668             int actualBlue = currentColor.B;
01669             int actualAlpha = currentColor.A;
01670
01671             Log.Comment("Expecting the ColorPicker's selected color to be {8}RGBA = ({0}, {1}, {2}, {3}). Actual color is RGBA = ({4}, {5}, {6}, {7}).",
01672                 expectedRed, expectedGreen, expectedBlue, expectedAlpha,
01673                 actualRed, actualGreen, actualBlue, actualAlpha,
01674                 allowedMargin > 0 ? string.Format("within {0} unit{1} of ", allowedMargin, allowedMargin != 1 ? "s" : "") : "");
01675
01676             Verify.IsLessThanOrEqual(expectedRed - allowedMargin, actualRed);
01677             Verify.IsGreaterThanOrEqual(expectedRed + allowedMargin, actualRed);
01678             Verify.IsLessThanOrEqual(expectedGreen - allowedMargin, actualGreen);
01679             Verify.IsGreaterThanOrEqual(expectedGreen + allowedMargin, actualGreen);
01680             Verify.IsLessThanOrEqual(expectedBlue - allowedMargin, actualBlue);
01681             Verify.IsGreaterThanOrEqual(expectedBlue + allowedMargin, actualBlue);
01682             Verify.IsLessThanOrEqual(expectedAlpha - allowedMargin, actualAlpha);
01683             Verify.IsGreaterThanOrEqual(expectedAlpha + allowedMargin, actualAlpha);
01684         }
01685
01686         private void VerifyColorNameIsSelected(string expectedName)
01687         {
01688             TextBlock selectedColorNameTextBlock = new TextBlock(FindElement.ById("SelectedColorNameTextBlock"));
01689
01690             string actualName = selectedColorNameTextBlock.DocumentText;
01691
01692             Log.Comment("Expecting the ColorPicker's selected color name to be '{0}'. Actual color name is '{1}'.",
01693                 expectedName, actualName);
01694
01695             Verify.AreEqual(expectedName, actualName);
01696         }
01697
01698         private void VerifyPreviousColorIsEqualTo(int expectedRed, int expectedGreen, int expectedBlue, int expectedAlpha = 255)
01699         {
01700             TextBlock previousRedTextBlock = new TextBlock(FindElement.ById("PreviousRedTextBlock"));
01701             TextBlock previousGreenTextBlock = new TextBlock(FindElement.ById("PreviousGreenTextBlock"));
01702             TextBlock previousBlueTextBlock = new TextBlock(FindElement.ById("PreviousBlueTextBlock"));
01703             TextBlock previousAlphaTextBlock = new TextBlock(FindElement.ById("PreviousAlphaTextBlock"));
01704
01705             int actualRed = int.Parse(previousRedTextBlock.DocumentText);
01706             int actualGreen = int.Parse(previousGreenTextBlock.DocumentText);
01707             int actualBlue = int.Parse(previousBlueTextBlock.DocumentText);
01708             int actualAlpha = int.Parse(previousAlphaTextBlock.DocumentText);
01709
01710             Log.Comment("Expecting the ColorPicker's previous color to be RGBA = ({0}, {1}, {2}, {3}). Actual color is RGBA = ({4}, {5}, {6}, {7}).",
01711                 expectedRed, expectedGreen, expectedBlue, expectedAlpha,
01712                 actualRed, actualGreen, actualBlue, actualAlpha);
01713
01714             Verify.AreEqual<int>(expectedRed, actualRed);
01715             Verify.AreEqual<int>(expectedGreen, actualGreen);
01716             Verify.AreEqual<int>(expectedBlue, actualBlue);
01717             Verify.AreEqual<int>(expectedAlpha, actualAlpha);
01718         }
01719
01720         private void VerifyPreviousColorIsNull()
01721         {
01722             TextBlock previousRedTextBlock = new TextBlock(FindElement.ById("PreviousRedTextBlock"));
01723             TextBlock previousGreenTextBlock = new TextBlock(FindElement.ById("PreviousGreenTextBlock"));
01724             TextBlock previousBlueTextBlock = new TextBlock(FindElement.ById("PreviousBlueTextBlock"));
01725             TextBlock previousAlphaTextBlock = new TextBlock(FindElement.ById("PreviousAlphaTextBlock"));
01726
01727             Verify.AreEqual<string>("", previousRedTextBlock.DocumentText);
01728             Verify.AreEqual<string>("", previousGreenTextBlock.DocumentText);
01729             Verify.AreEqual<string>("", previousBlueTextBlock.DocumentText);
01730             Verify.AreEqual<string>("", previousAlphaTextBlock.DocumentText);
01731         }
01732
01733         private void VerifySelectionEllipsePosition(double expectedX, double expectedY)
01734         {
01735             VerifySelectionEllipsePositionCore(expectedX, expectedY, 0 /* allowedMargin */);
01736         }
01737
01738         private void VerifySelectionEllipseIsNear(double expectedX, double expectedY)
01739         {
01740             VerifySelectionEllipsePositionCore(expectedX, expectedY, 10 /* allowedMargin */);
01741         }
01742
01743         private void VerifySelectionEllipsePositionCore(double expectedX, double expectedY, double allowedMargin)
01744         {
01745             TextBlock ellipseXTextBlock = new TextBlock(FindElement.ById("EllipseXTextBlock"));
01746             TextBlock ellipseYTextBlock = new TextBlock(FindElement.ById("EllipseYTextBlock"));
01747
01748             double actualX = double.Parse(ellipseXTextBlock.DocumentText);
01749             double actualY = double.Parse(ellipseYTextBlock.DocumentText);
01750
01751             Log.Comment("Expecting the selection ellipse's position to be {4}({0}, {1}). Actual position is ({2}, {3}).",
01752                 expectedX, expectedY,
01753                 actualX, actualY,
01754                 allowedMargin > 0 ? string.Format("within {0} units of ", allowedMargin) : "");
01755
01756             Verify.IsLessThanOrEqual(expectedX - allowedMargin, actualX);
01757             Verify.IsGreaterThanOrEqual(expectedX + allowedMargin, actualX);
01758             Verify.IsLessThanOrEqual(expectedY - allowedMargin, actualY);
01759             Verify.IsGreaterThanOrEqual(expectedY + allowedMargin, actualY);
01760         }
01761
01762         private void VerifySelectionEllipseColorIsEqualTo(int expectedRed, int expectedGreen, int expectedBlue, int expectedAlpha = 255)
01763         {
01764             TextBlock ellipseRedTextBlock = new TextBlock(FindElement.ById("EllipseRedTextBlock"));
01765             TextBlock ellipseGreenTextBlock = new TextBlock(FindElement.ById("EllipseGreenTextBlock"));
01766             TextBlock ellipseBlueTextBlock = new TextBlock(FindElement.ById("EllipseBlueTextBlock"));
01767             TextBlock ellipseAlphaTextBlock = new TextBlock(FindElement.ById("EllipseAlphaTextBlock"));
01768
01769             int actualRed = int.Parse(ellipseRedTextBlock.DocumentText);
01770             int actualGreen = int.Parse(ellipseGreenTextBlock.DocumentText);
01771             int actualBlue = int.Parse(ellipseBlueTextBlock.DocumentText);
01772             int actualAlpha = int.Parse(ellipseAlphaTextBlock.DocumentText);
01773
01774             Log.Comment("Expecting the selection ellipse's color to be RGBA = ({0}, {1}, {2}, {3}). Actual color is RGBA = ({4}, {5}, {6}, {7}).",
01775                 expectedRed, expectedGreen, expectedBlue, expectedAlpha,
01776                 actualRed, actualGreen, actualBlue, actualAlpha);
01777
01778             Verify.AreEqual<int>(expectedRed, actualRed);
01779             Verify.AreEqual<int>(expectedGreen, actualGreen);
01780             Verify.AreEqual<int>(expectedBlue, actualBlue);
01781             Verify.AreEqual<int>(expectedAlpha, actualAlpha);
01782         }
01783
01784         private void VerifyElementIsFocused(string expectedFocusedElement)
01785         {
01786             TextBlock currentlyFocusedElementTextBlock = new TextBlock(FindElement.ById("CurrentlyFocusedElementTextBlock"));
01787
01788             Log.Comment("Expecting the focused element to be '{0}'. Actual focused element is '{1}'.", expectedFocusedElement, currentlyFocusedElementTextBlock.DocumentText);
01789             Verify.AreEqual(expectedFocusedElement, currentlyFocusedElementTextBlock.DocumentText);
01790         }
01791     }
01792 }
Generated on Sun Dec 1 2024 20:51:45 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/AutoSuggestBoxHelper.properties.h Source File

  • Generated

AutoSuggestBoxHelper.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class AutoSuggestBoxHelperProperties
00008 {
00009 public:
00010     AutoSuggestBoxHelperProperties();
00011
00012     static void SetKeepInteriorCornersSquare(winrt::AutoSuggestBox const& target, bool value);
00013     static bool GetKeepInteriorCornersSquare(winrt::AutoSuggestBox const& target);
00014
00015     static winrt::DependencyProperty KeepInteriorCornersSquareProperty() { return s_KeepInteriorCornersSquareProperty; }
00016
00017     static GlobalDependencyProperty s_KeepInteriorCornersSquareProperty;
00018
00019     static void EnsureProperties();
00020     static void ClearProperties();
00021 };
Generated on Sun Dec 1 2024 20:51:49 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/ElementFactoryGetArgsDownlevel.cpp Source File

  • Repeater

ElementFactoryGetArgsDownlevel.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "ElementFactoryGetArgsDownLevel.h"
00007
00008 #pragma region IElementFactoryGetArgs
00009
00010 winrt::IInspectable ElementFactoryGetArgsDownlevel::Data()
00011 {
00012     return m_data.get();
00013 }
00014
00015 void ElementFactoryGetArgsDownlevel::Data(winrt::IInspectable const& value)
00016 {
00017     m_data.set(value);
00018 }
00019
00020 winrt::UIElement ElementFactoryGetArgsDownlevel::Parent()
00021 {
00022     return m_parent.get();
00023 }
00024
00025 void ElementFactoryGetArgsDownlevel::Parent(winrt::UIElement const& value)
00026 {
00027     m_parent.set(value);
00028 }
00029
00030 #pragma endregion
00031
00032 int ElementFactoryGetArgsDownlevel::Index()
00033 {
00034     return m_index;
00035 }
00036
00037 void ElementFactoryGetArgsDownlevel::Index(int value)
00038 {
00039     m_index = value;
00040 }
Generated on Sun Dec 1 2024 20:52:08 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MapControlMapServiceErrorOccurredEventArgs Member List

This is the complete list of members for MapControlMapServiceErrorOccurredEventArgs, including all inherited members.
DiagnosticMessage() | MapControlMapServiceErrorOccurredEventArgs | [inline]
m_diagnosticMessage | MapControlMapServiceErrorOccurredEventArgs | [private]
MapControlMapServiceErrorOccurredEventArgs(winrt::hstring diagnosticMessage) | MapControlMapServiceErrorOccurredEventArgs | [inline]
Generated on Sun Dec 1 2024 20:52:56 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Materials/DesktopAcrylicBackdrop/DesktopAcrylicBackdrop.cpp Source File

  • Materials
  • DesktopAcrylicBackdrop

DesktopAcrylicBackdrop.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include "DesktopAcrylicBackdrop.h"
00007
00008 #include "DesktopAcrylicBackdrop.properties.cpp"
00009
00010 void DesktopAcrylicBackdrop::OnTargetConnected(ICompositionSupportsSystemBackdrop target, winrt::Microsoft::UI::Xaml::XamlRoot xamlRoot)
00011 {
00012     __super::OnTargetConnected(target, xamlRoot);
00013
00014     auto newController = DesktopAcrylicController();
00015     auto systemBackdrop = this->try_as<winrt::Microsoft::UI::Xaml::Media::SystemBackdrop>();
00016     auto configuration = systemBackdrop.GetDefaultSystemBackdropConfiguration(target, xamlRoot);
00017     m_controllers.push_back(std::make_unique<ControllerEntry>(target, newController, configuration));
00018 }
00019
00020 void DesktopAcrylicBackdrop::OnTargetDisconnected(ICompositionSupportsSystemBackdrop target)
00021 {
00022     __super::OnTargetDisconnected(target);
00023
00024     auto entryIterator = std::find_if(
00025         m_controllers.begin(),
00026         m_controllers.end(),
00027         [target](const std::unique_ptr<ControllerEntry>& entry){ return entry->m_target == target; });
00028     // Workaround for Bug 44926194: SystemBackdrop's BaseController can fail to ensure system DQ before framework gets shutdown notification
00029     // OnTargetConnected could fail in IXP's BaseController when ensuring a system DispatcherQueue. If that happens
00030     // we'll skip adding to the list of controllers, which means we won't find anything when trying to remove it later.
00031     // When the bug is fixed, take out this if condition and always assert and erase.
00032     // We hit the failure when the app has started DQ shutdown, but Xaml hasn't received any notification yet.
00033     if (entryIterator != m_controllers.end())
00034     {
00035         MUX_ASSERT(entryIterator != m_controllers.end());
00036         m_controllers.erase(entryIterator);
00037     }
00038 }
00039
00040 DesktopAcrylicBackdrop::ControllerEntry::ControllerEntry(ICompositionSupportsSystemBackdrop target, DesktopAcrylicController controller, SystemBackdropConfiguration configuration)
00041     : m_target(target)
00042     , m_controller(controller)
00043 {
00044     controller.AddSystemBackdropTarget(target);
00045     controller.SetSystemBackdropConfiguration(configuration);
00046 }
00047
00048 DesktopAcrylicBackdrop::ControllerEntry::~ControllerEntry()
00049 {
00050     m_controller.RemoveSystemBackdropTarget(m_target);
00051     m_controller.Close();
00052     m_controller = nullptr;
00053 }
Generated on Sun Dec 1 2024 20:51:59 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/RadioButtons.properties.cpp Source File

  • Generated

RadioButtons.properties.cpp

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #include "pch.h"
00006 #include "common.h"
00007 #include "RadioButtons.h"
00008
00009 namespace winrt::Microsoft::UI::Xaml::Controls
00010 {
00011     CppWinRTActivatableClassWithDPFactory(RadioButtons)
00012 }
00013
00014 #include "RadioButtons.g.cpp"
00015
00016 GlobalDependencyProperty RadioButtonsProperties::s_HeaderProperty{ nullptr };
00017 GlobalDependencyProperty RadioButtonsProperties::s_HeaderTemplateProperty{ nullptr };
00018 GlobalDependencyProperty RadioButtonsProperties::s_ItemsProperty{ nullptr };
00019 GlobalDependencyProperty RadioButtonsProperties::s_ItemsSourceProperty{ nullptr };
00020 GlobalDependencyProperty RadioButtonsProperties::s_ItemTemplateProperty{ nullptr };
00021 GlobalDependencyProperty RadioButtonsProperties::s_MaxColumnsProperty{ nullptr };
00022 GlobalDependencyProperty RadioButtonsProperties::s_SelectedIndexProperty{ nullptr };
00023 GlobalDependencyProperty RadioButtonsProperties::s_SelectedItemProperty{ nullptr };
00024
00025 RadioButtonsProperties::RadioButtonsProperties()
00026     : m_selectionChangedEventSource{static_cast<RadioButtons*>(this)}
00027 {
00028     EnsureProperties();
00029 }
00030
00031 void RadioButtonsProperties::EnsureProperties()
00032 {
00033     if (!s_HeaderProperty)
00034     {
00035         s_HeaderProperty =
00036             InitializeDependencyProperty(
00037                 L"Header",
00038                 winrt::name_of<winrt::IInspectable>(),
00039                 winrt::name_of<winrt::RadioButtons>(),
00040                 false /* isAttached */,
00041                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00042                 winrt::PropertyChangedCallback(&OnHeaderPropertyChanged));
00043     }
00044     if (!s_HeaderTemplateProperty)
00045     {
00046         s_HeaderTemplateProperty =
00047             InitializeDependencyProperty(
00048                 L"HeaderTemplate",
00049                 winrt::name_of<winrt::DataTemplate>(),
00050                 winrt::name_of<winrt::RadioButtons>(),
00051                 false /* isAttached */,
00052                 ValueHelper<winrt::DataTemplate>::BoxedDefaultValue(),
00053                 winrt::PropertyChangedCallback(&OnHeaderTemplatePropertyChanged));
00054     }
00055     if (!s_ItemsProperty)
00056     {
00057         s_ItemsProperty =
00058             InitializeDependencyProperty(
00059                 L"Items",
00060                 winrt::name_of<winrt::IVector<winrt::IInspectable>>(),
00061                 winrt::name_of<winrt::RadioButtons>(),
00062                 false /* isAttached */,
00063                 ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxedDefaultValue(),
00064                 winrt::PropertyChangedCallback(&OnItemsPropertyChanged));
00065     }
00066     if (!s_ItemsSourceProperty)
00067     {
00068         s_ItemsSourceProperty =
00069             InitializeDependencyProperty(
00070                 L"ItemsSource",
00071                 winrt::name_of<winrt::IInspectable>(),
00072                 winrt::name_of<winrt::RadioButtons>(),
00073                 false /* isAttached */,
00074                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00075                 winrt::PropertyChangedCallback(&OnItemsSourcePropertyChanged));
00076     }
00077     if (!s_ItemTemplateProperty)
00078     {
00079         s_ItemTemplateProperty =
00080             InitializeDependencyProperty(
00081                 L"ItemTemplate",
00082                 winrt::name_of<winrt::IInspectable>(),
00083                 winrt::name_of<winrt::RadioButtons>(),
00084                 false /* isAttached */,
00085                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00086                 winrt::PropertyChangedCallback(&OnItemTemplatePropertyChanged));
00087     }
00088     if (!s_MaxColumnsProperty)
00089     {
00090         s_MaxColumnsProperty =
00091             InitializeDependencyProperty(
00092                 L"MaxColumns",
00093                 winrt::name_of<int>(),
00094                 winrt::name_of<winrt::RadioButtons>(),
00095                 false /* isAttached */,
00096                 ValueHelper<int>::BoxValueIfNecessary(1),
00097                 winrt::PropertyChangedCallback(&OnMaxColumnsPropertyChanged));
00098     }
00099     if (!s_SelectedIndexProperty)
00100     {
00101         s_SelectedIndexProperty =
00102             InitializeDependencyProperty(
00103                 L"SelectedIndex",
00104                 winrt::name_of<int>(),
00105                 winrt::name_of<winrt::RadioButtons>(),
00106                 false /* isAttached */,
00107                 ValueHelper<int>::BoxValueIfNecessary(-1),
00108                 winrt::PropertyChangedCallback(&OnSelectedIndexPropertyChanged));
00109     }
00110     if (!s_SelectedItemProperty)
00111     {
00112         s_SelectedItemProperty =
00113             InitializeDependencyProperty(
00114                 L"SelectedItem",
00115                 winrt::name_of<winrt::IInspectable>(),
00116                 winrt::name_of<winrt::RadioButtons>(),
00117                 false /* isAttached */,
00118                 ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
00119                 winrt::PropertyChangedCallback(&OnSelectedItemPropertyChanged));
00120     }
00121 }
00122
00123 void RadioButtonsProperties::ClearProperties()
00124 {
00125     s_HeaderProperty = nullptr;
00126     s_HeaderTemplateProperty = nullptr;
00127     s_ItemsProperty = nullptr;
00128     s_ItemsSourceProperty = nullptr;
00129     s_ItemTemplateProperty = nullptr;
00130     s_MaxColumnsProperty = nullptr;
00131     s_SelectedIndexProperty = nullptr;
00132     s_SelectedItemProperty = nullptr;
00133 }
00134
00135 void RadioButtonsProperties::OnHeaderPropertyChanged(
00136     winrt::DependencyObject const& sender,
00137     winrt::DependencyPropertyChangedEventArgs const& args)
00138 {
00139     auto owner = sender.as<winrt::RadioButtons>();
00140     winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
00141 }
00142
00143 void RadioButtonsProperties::OnHeaderTemplatePropertyChanged(
00144     winrt::DependencyObject const& sender,
00145     winrt::DependencyPropertyChangedEventArgs const& args)
00146 {
00147     auto owner = sender.as<winrt::RadioButtons>();
00148     winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
00149 }
00150
00151 void RadioButtonsProperties::OnItemsPropertyChanged(
00152     winrt::DependencyObject const& sender,
00153     winrt::DependencyPropertyChangedEventArgs const& args)
00154 {
00155     auto owner = sender.as<winrt::RadioButtons>();
00156     winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
00157 }
00158
00159 void RadioButtonsProperties::OnItemsSourcePropertyChanged(
00160     winrt::DependencyObject const& sender,
00161     winrt::DependencyPropertyChangedEventArgs const& args)
00162 {
00163     auto owner = sender.as<winrt::RadioButtons>();
00164     winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
00165 }
00166
00167 void RadioButtonsProperties::OnItemTemplatePropertyChanged(
00168     winrt::DependencyObject const& sender,
00169     winrt::DependencyPropertyChangedEventArgs const& args)
00170 {
00171     auto owner = sender.as<winrt::RadioButtons>();
00172     winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
00173 }
00174
00175 void RadioButtonsProperties::OnMaxColumnsPropertyChanged(
00176     winrt::DependencyObject const& sender,
00177     winrt::DependencyPropertyChangedEventArgs const& args)
00178 {
00179     auto owner = sender.as<winrt::RadioButtons>();
00180     winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
00181 }
00182
00183 void RadioButtonsProperties::OnSelectedIndexPropertyChanged(
00184     winrt::DependencyObject const& sender,
00185     winrt::DependencyPropertyChangedEventArgs const& args)
00186 {
00187     auto owner = sender.as<winrt::RadioButtons>();
00188     winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
00189 }
00190
00191 void RadioButtonsProperties::OnSelectedItemPropertyChanged(
00192     winrt::DependencyObject const& sender,
00193     winrt::DependencyPropertyChangedEventArgs const& args)
00194 {
00195     auto owner = sender.as<winrt::RadioButtons>();
00196     winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
00197 }
00198
00199 void RadioButtonsProperties::Header(winrt::IInspectable const& value)
00200 {
00201     [[gsl::suppress(con)]]
00202     {
00203     static_cast<RadioButtons*>(this)->SetValue(s_HeaderProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00204     }
00205 }
00206
00207 winrt::IInspectable RadioButtonsProperties::Header()
00208 {
00209     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_HeaderProperty));
00210 }
00211
00212 void RadioButtonsProperties::HeaderTemplate(winrt::DataTemplate const& value)
00213 {
00214     [[gsl::suppress(con)]]
00215     {
00216     static_cast<RadioButtons*>(this)->SetValue(s_HeaderTemplateProperty, ValueHelper<winrt::DataTemplate>::BoxValueIfNecessary(value));
00217     }
00218 }
00219
00220 winrt::DataTemplate RadioButtonsProperties::HeaderTemplate()
00221 {
00222     return ValueHelper<winrt::DataTemplate>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_HeaderTemplateProperty));
00223 }
00224
00225 void RadioButtonsProperties::Items(winrt::IVector<winrt::IInspectable> const& value)
00226 {
00227     [[gsl::suppress(con)]]
00228     {
00229     static_cast<RadioButtons*>(this)->SetValue(s_ItemsProperty, ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxValueIfNecessary(value));
00230     }
00231 }
00232
00233 winrt::IVector<winrt::IInspectable> RadioButtonsProperties::Items()
00234 {
00235     return ValueHelper<winrt::IVector<winrt::IInspectable>>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_ItemsProperty));
00236 }
00237
00238 void RadioButtonsProperties::ItemsSource(winrt::IInspectable const& value)
00239 {
00240     [[gsl::suppress(con)]]
00241     {
00242     static_cast<RadioButtons*>(this)->SetValue(s_ItemsSourceProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00243     }
00244 }
00245
00246 winrt::IInspectable RadioButtonsProperties::ItemsSource()
00247 {
00248     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_ItemsSourceProperty));
00249 }
00250
00251 void RadioButtonsProperties::ItemTemplate(winrt::IInspectable const& value)
00252 {
00253     [[gsl::suppress(con)]]
00254     {
00255     static_cast<RadioButtons*>(this)->SetValue(s_ItemTemplateProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00256     }
00257 }
00258
00259 winrt::IInspectable RadioButtonsProperties::ItemTemplate()
00260 {
00261     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_ItemTemplateProperty));
00262 }
00263
00264 void RadioButtonsProperties::MaxColumns(int value)
00265 {
00266     [[gsl::suppress(con)]]
00267     {
00268     static_cast<RadioButtons*>(this)->SetValue(s_MaxColumnsProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00269     }
00270 }
00271
00272 int RadioButtonsProperties::MaxColumns()
00273 {
00274     return ValueHelper<int>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_MaxColumnsProperty));
00275 }
00276
00277 void RadioButtonsProperties::SelectedIndex(int value)
00278 {
00279     [[gsl::suppress(con)]]
00280     {
00281     static_cast<RadioButtons*>(this)->SetValue(s_SelectedIndexProperty, ValueHelper<int>::BoxValueIfNecessary(value));
00282     }
00283 }
00284
00285 int RadioButtonsProperties::SelectedIndex()
00286 {
00287     return ValueHelper<int>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_SelectedIndexProperty));
00288 }
00289
00290 void RadioButtonsProperties::SelectedItem(winrt::IInspectable const& value)
00291 {
00292     [[gsl::suppress(con)]]
00293     {
00294     static_cast<RadioButtons*>(this)->SetValue(s_SelectedItemProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
00295     }
00296 }
00297
00298 winrt::IInspectable RadioButtonsProperties::SelectedItem()
00299 {
00300     return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_SelectedItemProperty));
00301 }
00302
00303 winrt::event_token RadioButtonsProperties::SelectionChanged(winrt::SelectionChangedEventHandler const& value)
00304 {
00305     return m_selectionChangedEventSource.add(value);
00306 }
00307
00308 void RadioButtonsProperties::SelectionChanged(winrt::event_token const& token)
00309 {
00310     m_selectionChangedEventSource.remove(token);
00311 }
Generated on Sun Dec 1 2024 20:51:52 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: ProgressRing/ProgressRing.idl Source File

  • ProgressRing

ProgressRing.idl

Go to the documentation of this file.
00001 ﻿namespace MU_XC_NAMESPACE
00002 {
00003
00004 [MUX_PUBLIC]
00005 [webhosthidden]
00006 [MUX_PROPERTY_NEEDS_DP_FIELD]
00007 runtimeclass ProgressRingTemplateSettings : Microsoft.UI.Xaml.DependencyObject
00008 {
00009     // TemplateSetting properties from WUXC for backwards compatibility.
00010     Double EllipseDiameter{ get; };
00011     Microsoft.UI.Xaml.Thickness EllipseOffset{ get; };
00012     Double MaxSideLength{ get; };
00013 }
00014
00015 [MUX_PUBLIC]
00016 [webhosthidden]
00017 unsealed runtimeclass ProgressRing : Microsoft.UI.Xaml.Controls.Control
00018 {
00019     ProgressRing();
00020
00021     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00022     [MUX_DEFAULT_VALUE("true")]
00023     Boolean IsActive{ get; set; };
00024
00025     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00026     [MUX_DEFAULT_VALUE("true")]
00027     Boolean IsIndeterminate{ get; set; };
00028
00029     [MUX_PREVIEW]
00030     {
00031         [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00032         IAnimatedVisualSource DeterminateSource{ get; set; };
00033
00034         [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00035         IAnimatedVisualSource IndeterminateSource{ get; set; };
00036     }
00037
00038     [MUX_PROPERTY_NEEDS_DP_FIELD]
00039     ProgressRingTemplateSettings TemplateSettings{ get; };
00040
00041     static Microsoft.UI.Xaml.DependencyProperty IsActiveProperty{ get; };
00042     static Microsoft.UI.Xaml.DependencyProperty IsIndeterminateProperty{ get; };
00043
00044     [MUX_PREVIEW]
00045     {
00046         static Microsoft.UI.Xaml.DependencyProperty DeterminateSourceProperty{ get; };
00047         static Microsoft.UI.Xaml.DependencyProperty IndeterminateSourceProperty{ get; };
00048     }
00049
00050     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00051     [MUX_DEFAULT_VALUE("0.0")]
00052     Double Value;
00053
00054     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00055     [MUX_DEFAULT_VALUE("0.0")]
00056     Double Minimum;
00057
00058     [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
00059     [MUX_DEFAULT_VALUE("100.0")]
00060     Double Maximum;
00061
00062     static Microsoft.UI.Xaml.DependencyProperty ValueProperty{ get; };
00063     static Microsoft.UI.Xaml.DependencyProperty MinimumProperty{ get; };
00064     static Microsoft.UI.Xaml.DependencyProperty MaximumProperty{ get; };
00065 }
00066
00067 }
00068
00069 namespace MU_XAP_NAMESPACE
00070 {
00071
00072 [MUX_PUBLIC]
00073 [webhosthidden]
00074 unsealed runtimeclass ProgressRingAutomationPeer : Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer, Microsoft.UI.Xaml.Automation.Provider.IRangeValueProvider
00075 {
00076     ProgressRingAutomationPeer(MU_XC_NAMESPACE.ProgressRing owner);
00077 }
00078
00079 }
Generated on Sun Dec 1 2024 20:52:05 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

RecyclePool::ElementInfo Member List

This is the complete list of members for RecyclePool::ElementInfo, including all inherited members.
Element() const | RecyclePool::ElementInfo | [inline]
ElementInfo(const ITrackerHandleManager *refManager, const winrt::UIElement &element, const winrt::Panel &owner) | RecyclePool::ElementInfo | [inline]
m_element | RecyclePool::ElementInfo | [private]
m_owner | RecyclePool::ElementInfo | [private]
Owner() const | RecyclePool::ElementInfo | [inline]
Generated on Sun Dec 1 2024 20:53:04 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

GroupedItemsControlItem Member List

This is the complete list of members for GroupedItemsControlItem, including all inherited members.
GroupedItemsControlItem() | GroupedItemsControlItem | [inline]
GroupedItemsControlItem(string id) | GroupedItemsControlItem | [inline]
Id | GroupedItemsControlItem |
Generated on Sun Dec 1 2024 20:54:03 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ScaleAnimatedVerticalListDemo Member List

This is the complete list of members for ScaleAnimatedVerticalListDemo, including all inherited members.
OnElementPrepared(Microsoft.UI.Xaml.Controls.ItemsRepeater sender, Microsoft.UI.Xaml.Controls.ItemsRepeaterElementPreparedEventArgs args) | ScaleAnimatedVerticalListDemo | [inline, private]
OnItemClicked(object sender, RoutedEventArgs e) | ScaleAnimatedVerticalListDemo | [inline, private]
OnItemGotFocus(object sender, RoutedEventArgs e) | ScaleAnimatedVerticalListDemo | [inline, private]
ScaleAnimatedVerticalListDemo() | ScaleAnimatedVerticalListDemo | [inline]
ScrollToCenterOfViewport(object sender) | ScaleAnimatedVerticalListDemo | [inline, private, static]
Generated on Sun Dec 1 2024 20:54:48 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

FloatUtil Member List

This is the complete list of members for FloatUtil, including all inherited members.
NaN FloatUtil [static]
Generated on Sun Dec 1 2024 20:52:46 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Generated/SelectionModel.properties.h Source File

  • Generated

SelectionModel.properties.h

Go to the documentation of this file.
00001 // Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 // DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
00005 #pragma once
00006
00007 class SelectionModelProperties
00008 {
00009 public:
00010     SelectionModelProperties();
00011
00012
00013
00014     winrt::event_token ChildrenRequested(winrt::TypedEventHandler<winrt::SelectionModel, winrt::SelectionModelChildrenRequestedEventArgs> const& value);
00015     void ChildrenRequested(winrt::event_token const& token);
00016     winrt::event_token PropertyChanged(winrt::PropertyChangedEventHandler const& value);
00017     void PropertyChanged(winrt::event_token const& token);
00018     winrt::event_token SelectionChanged(winrt::TypedEventHandler<winrt::SelectionModel, winrt::SelectionModelSelectionChangedEventArgs> const& value);
00019     void SelectionChanged(winrt::event_token const& token);
00020
00021     event_source<winrt::TypedEventHandler<winrt::SelectionModel, winrt::SelectionModelChildrenRequestedEventArgs>> m_childrenRequestedEventSource;
00022     event_source<winrt::PropertyChangedEventHandler> m_propertyChangedEventSource;
00023     event_source<winrt::TypedEventHandler<winrt::SelectionModel, winrt::SelectionModelSelectionChangedEventArgs>> m_selectionChangedEventSource;
00024
00025     static void EnsureProperties();
00026     static void ClearProperties();
00027 };
Generated on Sun Dec 1 2024 20:51:53 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

NavigationViewItemPresenterTemplateSettings Member List

This is the complete list of members for NavigationViewItemPresenterTemplateSettings, including all inherited members.
ClearProperties() | NavigationViewItemPresenterTemplateSettingsProperties | [static]
EnsureProperties() | NavigationViewItemPresenterTemplateSettingsProperties | [static]
IconWidth(double value) | NavigationViewItemPresenterTemplateSettingsProperties |
IconWidth() | NavigationViewItemPresenterTemplateSettingsProperties |
IconWidthProperty() | NavigationViewItemPresenterTemplateSettingsProperties | [inline, static]
NavigationViewItemPresenterTemplateSettingsProperties() | NavigationViewItemPresenterTemplateSettingsProperties |
s_IconWidthProperty | NavigationViewItemPresenterTemplateSettingsProperties | [static]
s_SmallerIconWidthProperty | NavigationViewItemPresenterTemplateSettingsProperties | [static]
SmallerIconWidth(double value) | NavigationViewItemPresenterTemplateSettingsProperties |
SmallerIconWidth() | NavigationViewItemPresenterTemplateSettingsProperties |
SmallerIconWidthProperty() | NavigationViewItemPresenterTemplateSettingsProperties | [inline, static]
Generated on Sun Dec 1 2024 20:52:58 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

MockItemsSource::GetAtCallInfo Member List

This is the complete list of members for MockItemsSource::GetAtCallInfo, including all inherited members.
GetAtCallInfo(int index) | MockItemsSource::GetAtCallInfo | [inline]
Index | MockItemsSource::GetAtCallInfo |
Generated on Sun Dec 1 2024 20:53:43 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Repeater/TestUI/Samples/SelectionSample/Common/BoolToVisibilityConverter.cs Source File

  • Repeater
  • TestUI
  • Samples
  • SelectionSample
  • Common

BoolToVisibilityConverter.cs

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 using System;
00005 using Microsoft.UI.Xaml;
00006 using Microsoft.UI.Xaml.Data;
00007
00008 namespace MUXControlsTestApp.Samples.Selection
00009 {
00010     public class BoolToVisibilityConverter : IValueConverter
00011     {
00012         public object Convert(object value, Type targetType, object parameter, string language)
00013         {
00014             if ((bool)value)
00015             {
00016                 {
00017                     return Visibility.Visible;
00018                 }
00019             }
00020
00021             return Visibility.Collapsed;
00022         }
00023
00024         public object ConvertBack(object value, Type targetType, object parameter, string language)
00025         {
00026             throw new NotImplementedException();
00027         }
00028     }
00029 }
Generated on Sun Dec 1 2024 20:52:11 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Flex::FlexState Member List

This is the complete list of members for Flex::FlexState, including all inherited members.
LastExtent | Flex::FlexState
Lines | Flex::FlexState
Generated on Sun Dec 1 2024 20:53:31 for WinUi3-Templates by doxygen 1.7.1


WinUi3-Templates: RatingControl/RatingItemImageInfo.cpp Source File

  • RatingControl

RatingItemImageInfo.cpp

Go to the documentation of this file.
00001 ﻿// Copyright (c) Microsoft Corporation. All rights reserved.
00002 // Licensed under the MIT License. See LICENSE in the project root for license information.
00003
00004 #include "pch.h"
00005 #include "common.h"
00006 #include <RatingItemImageInfo.h>
Generated on Sun Dec 1 2024 20:52:06 for WinUi3-Templates by doxygen 1.7.1