Exemplo n.º 1
0
        private void OnPreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (View.RootView == null)
            {
                return;
            }
            var hitTestObject = GetHitTestObject(e.GetPosition(View));

            if (hitTestObject != null)
            {
                var service   = Context.Services.GetRequiredService <ModelService>();
                var items     = service.Find(CurrentItem.Root, typeof(BarItem));
                var modelItem = items.FirstOrDefault(x => x.GetCurrentValue() == hitTestObject);
                if (modelItem == null)
                {
                    return;
                }
                SelectionOperations.SelectOnly(Context, modelItem);
                e.Handled = true;
            }
        }
 public void Select()
 {
     SelectionOperations.SelectOnly(this._view.Context, this._item);
     this.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
     this.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);
 }
 protected override void SetFocusCore()
 {
     SelectionOperations.SelectOnly(this._view.Context, this._item);
 }