Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resize GridView and DataGrid columns #62

Closed
meroving opened this issue May 17, 2013 · 5 comments
Closed

Can't resize GridView and DataGrid columns #62

meroving opened this issue May 17, 2013 · 5 comments
Assignees

Comments

@meroving
Copy link

First item of list become dragged when column separator is dragged by mouse in grid header. Width of column isn't changing.

@meroving
Copy link
Author

Resolves with

|| HitTest4Type<GridViewColumnHeader>(sender, e)

check at PreviewMouseDown

DataGridColumnHeader can be tested only for .NET4 version

@osicka
Copy link

osicka commented Jul 10, 2013

This does not work in a GridView when you drag the column header to reorder its position in the grid. It still drags the first data row.

The GridViewColumnHeader changes Visibility and the test in HitTest4Type fails.

I have worked around this by changing HitTest4Type to include a testVisibility parameter.

    private static bool HitTest4Type<T>(object sender, MouseButtonEventArgs e, bool testVisibility = true) where T : UIElement
    {
        var hit = VisualTreeHelper.HitTest((Visual)sender, e.GetPosition((IInputElement)sender));
        if (hit == null)
        {
            return false;
        }
        else
        {
            var element = hit.VisualHit.GetVisualAncestor<T>();
            return element != null && (testVisibility == false || element.Visibility == Visibility.Visible);
        }
    }

@osicka
Copy link

osicka commented Jul 10, 2013

The following also fixes the above issue I spoke about, though it does put a specific test into a generic function.

return element != null && ((element is GridViewColumnHeader && (element as GridViewColumnHeader).Role == GridViewColumnHeaderRole.Floating) || element.Visibility == Visibility.Visible);

@ghost ghost assigned punker76 Aug 6, 2013
punker76 added a commit that referenced this issue Aug 6, 2013
@punker76
Copy link
Owner

punker76 commented Aug 6, 2013

will be fixed with 0.1.3.9

@punker76 punker76 closed this as completed Aug 6, 2013
@timeichfeld-msa
Copy link

Hello,
This still does not seem to work, I cannot resize headers in a GridControl.
If I set dd:DragDrop.IsDragSource="False" in the Grid, I get resize of columns back, but can't drag/drop.
Is there a solution, or a flag I need to set or a special way to define the DD on the grid?

Please advise.

Thanks much! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants