// reset CIC event if the container is being cleared. internal override void ClearContainerForItem( DependencyObject pContainer, object pItem) { CalendarViewDayItem spContainer = (CalendarViewDayItem)(pContainer); // There is much perf involved with doing a clear, and usually it is going to be // a waste of time since we are going to immediately follow up with a prepare. // Perf traces have found this to be about 8 to 12% during a full virtualization pass (!!) // Although with other optimizations we would expect that to go down, it is unlikely to go // down to 0. Therefore we are deferring the impl work here to later. // We have decided to do this only for the new panels. // also, do not defer items that are uielement. They need to be cleared straight away so that // they can be messed with again. m_toBeClearedContainers.Add(spContainer); // note that if we are being cleared, we are not going to be in the // visible index, or the caches. And thus we will never be called in the // prepare queuing part. if (!m_isRegisteredForCallbacks) { BuildTreeService spBuildTree; spBuildTree = DXamlCore.GetCurrent().GetBuildTreeService(); spBuildTree.RegisterWork(this); } global::System.Diagnostics.Debug.Assert(m_isRegisteredForCallbacks); }
private void PrepareState() { //CalendarDatePickerGenerated.PrepareState(); // Set a default string as the PlaceholderText property value. string strDefaultPlaceholderText; strDefaultPlaceholderText = DXamlCore.GetCurrent().GetLocalizedResourceString(TEXT_CALENDARDATEPICKER_DEFAULT_PLACEHOLDER_TEXT); PlaceholderText = strDefaultPlaceholderText; return; }
protected override string GetLocalizedControlTypeCore() { return(DXamlCore.GetCurrentNoCreate().GetLocalizedResourceString("UIA_AP_APPBAR_BUTTON")); }
private static bool TryMoveFocusStatic( FocusNavigationDirection focusNavigationDirection, FindNextElementOptions?pFocusNavigationOverride, ref IAsyncOperation <FocusMovementResult>?asyncOperation, bool useAsync) { DependencyObject?searchRootAsDO = null; Rect hintRect; Rect exclusionRect; XYFocusNavigationStrategyOverride navigationStrategyOverride; XYFocusOptions xyFocusOptions = new XYFocusOptions(); var pIsFocusMoved = false; FindNextElementOptions?options = pFocusNavigationOverride; bool ignoreOcclusivity; FocusAsyncOperation?spFocusAsyncOperation = null; DXamlCore pCore = DXamlCore.Current; if (pCore == null) { throw new InvalidOperationException("XamlCore is not set."); } FocusManager?focusManager = null; ContentRoot? contentRoot = null; var contentRootCoordinator = pCore.GetHandle().ContentRootCoordinator; if (options != null) { var searchRoot = options.SearchRoot; exclusionRect = options.ExclusionRect; hintRect = options.HintRect; navigationStrategyOverride = options.XYFocusNavigationStrategyOverride; ignoreOcclusivity = options.IgnoreOcclusivity; searchRootAsDO = searchRoot as DependencyObject; if (searchRootAsDO != null) { contentRoot = VisualTree.GetContentRootForElement(searchRootAsDO); focusManager = contentRoot?.FocusManager; if (focusManager == null) { throw new InvalidOperationException("Search root is not part of the visual tree."); } } else if (pCore.GetHandle().InitializationType == InitializationType.IslandsOnly) { // SearchRoot must exist for islands/ desktop throw new ArgumentException("The search root must not be null."); } else { contentRoot = contentRootCoordinator?.CoreWindowContentRoot; } // If we are being passed in the public root visual of a XamlRoot as the SearchRoot, then override the SearchRoot to be the RootVisual. // This will enable searching through both the public root visual and the popup root. We will also allow Next/Prev. bool shouldOverrideSearchRoot = contentRoot != null && GetAppVisibleXamlRootContent(contentRoot) == searchRootAsDO; if (shouldOverrideSearchRoot) { searchRootAsDO = contentRoot !.VisualTree.RootElement; } else { if (focusNavigationDirection != FocusNavigationDirection.Up && focusNavigationDirection != FocusNavigationDirection.Down && focusNavigationDirection != FocusNavigationDirection.Left && focusNavigationDirection != FocusNavigationDirection.Right) { throw new ArgumentOutOfRangeException( "Focus navigation directions Next, Previous, and None " + "are not supported when using FindNextElementOptions"); } } xyFocusOptions.NavigationStrategyOverride = navigationStrategyOverride; xyFocusOptions.IgnoreOcclusivity = ignoreOcclusivity; Rect exclusionRectNative = exclusionRect; Rect hintRectNative = hintRect; if (searchRootAsDO != null) { xyFocusOptions.SearchRoot = searchRootAsDO; } if (!exclusionRectNative.IsUniform) { xyFocusOptions.ExclusionRect = exclusionRectNative; } if (!hintRectNative.IsUniform) { xyFocusOptions.FocusHintRectangle = hintRectNative; } if (contentRoot != null) { var scale = RootScale.GetRasterizationScaleForContentRoot(contentRoot); ConvertOptionsRectsToPhysical(scale, xyFocusOptions); } } if (focusManager == null) { // Return error if call is without focus navigation option in islands/ desktop if (pCore.GetHandle().InitializationType == InitializationType.IslandsOnly) { throw new InvalidOperationException("Focus navigation options must be set for desktop apps."); } // For compat reasons, these FocusManager static APIs need to always use the CoreWindow as the // ContentRoot, so explicitly return the CoreWindow content root. if (contentRoot == null) { contentRoot = contentRootCoordinator?.CoreWindowContentRoot; } if (contentRoot == null) { return(pIsFocusMoved); } focusManager = contentRoot.FocusManager; } FocusMovement movement = new FocusMovement(xyFocusOptions, focusNavigationDirection, null); if (useAsync) { spFocusAsyncOperation = new FocusAsyncOperation(movement.CorrelationId); asyncOperation = spFocusAsyncOperation.CreateAsyncOperation(); // Async operation is not guaranteed to be released synchronously. // Therefore, we let UpdateFocus to handle the responsibility of releasing it. // TODO Uno specific: Do not use async operations, only simulated // movement.ShouldCompleteAsyncOperation = focusManager.TrySetAsyncOperation(spFocusAsyncOperation); if (movement.ShouldCompleteAsyncOperation) { //spFocusAsyncOperation.StartOperation(); } } FocusMovementResult result = focusManager.FindAndSetNextFocus(movement); // TODO Uno specific: Simulate async completion. spFocusAsyncOperation?.CoreSetResults(result); spFocusAsyncOperation?.CoreFireCompletion(); // We ignore result.GetHResult() here because this is a "Try" function pIsFocusMoved = result.WasMoved; // Async operation is not guaranteed to be released synchronously. // Therefore, we let UpdateFocus to handle the responsibility of releasing it. //spFocusAsyncOperation.Detach(); return(pIsFocusMoved); }
protected override string GetLocalizedControlTypeCore() { return(DXamlCore.GetCurrentNoCreate().GetLocalizedResourceString(UIA_AP_CALENDARDATEPICKER)); }