예제 #1
0
        private void DataGrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row = WpfUtil.GetGridRow(e.OriginalSource);

            if (row == null)
            {
                e.Handled = true;
                return;
            }

            DataGrid grid = (DataGrid)sender;

            if (grid.SelectedItem != null)
            {
                return;
            }

            Point         pt     = e.GetPosition((UIElement)sender);
            HitTestResult result = VisualTreeHelper.HitTest(grid, pt);

            if (result != null)
            {
                row = WpfUtil.GetGridRow(result.VisualHit);
                if (row != null)
                {
                    row.IsSelected = true;
                }
            }
        }
예제 #2
0
        private void DataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row = WpfUtil.GetGridRow(e.OriginalSource);

            if (row == null)
            {
                DataGrid grid = (DataGrid)sender;
                grid.UnselectAll();
                e.Handled = true;
            }
        }
예제 #3
0
        private void ClientListView_Enabled_CheckedChanged(object sender, RoutedEventArgs e)
        {
            DataGridRow row = WpfUtil.GetGridRow(e.OriginalSource);

            if (row != null)
            {
                DemonSaw.Entity.Entity entity = (DemonSaw.Entity.Entity)row.Item;

                if (entity != null)
                {
                    CheckBox        control = (CheckBox)sender;
                    bool            enabled = (bool)control.IsChecked;
                    ClientComponent client  = entity.Get <ClientComponent>();

                    if (client.Enabled != enabled)
                    {
                        ClientController.Toggle(entity);
                    }
                }
            }
        }