Пример #1
0
        public static void InitializeDeviceState(InputDevice inputDevice)
        {
            if (inputDevice == null || deviceStateDictionary.ContainsKey(inputDevice))
            {
                return;
            }

            Window window = inputDevice.ActiveSource.RootVisual as Window;

            if (window == null)
            {
                return;
            }

            Point position = inputDevice.GetPosition(window);

            DependencyObject directlyOver = inputDevice.GetDirectlyOver() as DependencyObject;

            deviceStateDictionary.Add(inputDevice, new DragState(position, directlyOver));
        }