Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5653,7 +5653,7 @@ private void DataGrid_GotFocus(object sender, RoutedEventArgs e)
ShowScrollBars();

// If the DataGrid itself got focus, we actually want the automation focus to be on the current element
if (e.OriginalSource == this && AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged))
if (e.OriginalSource as Control == this && AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged))
{
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null)
Expand Down Expand Up @@ -5684,7 +5684,7 @@ private void DataGrid_KeyDown(object sender, KeyRoutedEventArgs e)

private void DataGrid_KeyUp(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Tab && e.OriginalSource == this)
if (e.Key == VirtualKey.Tab && e.OriginalSource as Control == this)
{
if (this.CurrentColumnIndex == -1)
{
Expand Down Expand Up @@ -6239,7 +6239,7 @@ private void FlushCurrentCellChanged()

// If the DataGrid itself has focus, we want to move automation focus to the new current element
object focusedObject = FocusManager.GetFocusedElement();
if (focusedObject == this && AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged))
if (focusedObject as Control == this && AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged))
{
peer.RaiseAutomationFocusChangedEvent(this.CurrentSlot, this.CurrentColumnIndex);
}
Expand Down Expand Up @@ -6716,7 +6716,7 @@ private void PreparingCellForEditPrivate(FrameworkElement editingElement)
{
if (_editingColumnIndex == -1 ||
this.CurrentColumnIndex == -1 ||
this.EditingRow.Cells[this.CurrentColumnIndex].Content != editingElement)
this.EditingRow.Cells[this.CurrentColumnIndex].Content as FrameworkElement != editingElement)
{
// The current cell has changed since the call to BeginCellEdit, so the fact
// that this element has loaded is no longer relevant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ private void DataGridCell_PointerTapped(object sender, TappedRoutedEventArgs e)
if (this.OwningRow != null)
{
Debug.Assert(sender is DataGridCell, "Expected sender is DataGridCell.");
Debug.Assert(sender == this, "Expected sender is this.");
Debug.Assert(sender as ContentControl == this, "Expected sender is this.");
e.Handled = this.OwningGrid.UpdateStateOnTapped(e, this.ColumnIndex, this.OwningRow.Slot, !e.Handled /*allowEdit*/);
this.OwningGrid.UpdatedStateOnTapped = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1065,10 +1065,7 @@ private void SetOriginalCursor()
{
Debug.Assert(interactionInfo.OriginalCursor != null, "Expected non-null interactionInfo.OriginalCursor.");

if (Window.Current != null)
{
Window.Current.CoreWindow.PointerCursor = interactionInfo.OriginalCursor;
}
CoreWindow.GetForCurrentThread().PointerCursor = interactionInfo.OriginalCursor;

interactionInfo.ResizePointerId = 0;
}
Expand Down Expand Up @@ -1103,14 +1100,12 @@ private void SetResizeCursor(Pointer pointer, Point pointerPosition)

if (this.OwningGrid.IsEnabled && (nearCurrentResizableColumnRightEdge || nearPreviousResizableColumnLeftEdge))
{
if (Window.Current != null)
CoreCursor currentCursor = CoreWindow.GetForCurrentThread().PointerCursor;
if (currentCursor != null && currentCursor.Type != CoreCursorType.SizeWestEast)
{
if (Window.Current.CoreWindow.PointerCursor != null && Window.Current.CoreWindow.PointerCursor.Type != CoreCursorType.SizeWestEast)
{
interactionInfo.OriginalCursor = Window.Current.CoreWindow.PointerCursor;
interactionInfo.ResizePointerId = pointer.PointerId;
Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.SizeWestEast, 0);
}
interactionInfo.OriginalCursor = currentCursor;
interactionInfo.ResizePointerId = pointer.PointerId;
CoreWindow.GetForCurrentThread().PointerCursor = new CoreCursor(CoreCursorType.SizeWestEast, 0);
}
}
else if (interactionInfo.ResizePointerId == pointer.PointerId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ private void DataGridRowHeader_Tapped(object sender, TappedRoutedEventArgs e)
if (this.OwningRow != null)
{
Debug.Assert(sender is DataGridRowHeader, "Expected sender is DataGridRowHeader.");
Debug.Assert(sender == this, "Expected sender is this.");
Debug.Assert(sender as ContentControl == this, "Expected sender is this.");

e.Handled = this.OwningGrid.UpdateStateOnTapped(e, -1, this.Slot, false /*allowEdit*/);
this.OwningGrid.UpdatedStateOnTapped = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ internal static class KeyboardHelper
{
public static void GetMetaKeyState(out bool ctrl, out bool shift)
{
ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
shift = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
ctrl = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
shift = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
}

public static void GetMetaKeyState(out bool ctrl, out bool shift, out bool alt)
{
GetMetaKeyState(out ctrl, out shift);
alt = Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down);
alt = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down);
}
}
}