-
Notifications
You must be signed in to change notification settings - Fork 146
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
NullReferenceException when clicking the 'empty space' in the GridView column headers #21
Comments
Got it reproduced now, thanks for reporting. |
May I ask what your use case for this setup is? Using a ListView but not specifying any columns sounds to me like a ListBox is what you really want. |
I was reporting the bug based on the demo. In my project, I was specifying columns in a ListView
It seems to be a problem only when HorizontalOptions is set to stretch - which I suppose WPF doesn't like |
I am not quite sure what you mean. I do not get any exception in the demo when clicking on a GridViewHeader so it would be helpful if you could explain it a bit further. In which exact scenario do you get an exception? Is the code you posted causing errors or is this working code? And what do you mean with "when HorizontalOptions is set to stretch"? Do you mean In order to fix it, I need to reproduce it. I indeed got errors when there are no columns defined. And that is what i have fixed. If you still get errors because you mean a different scenario please tell me what I have to do in order to get the errors as well. |
Sorry, I thought it'd be easy to reproduce :) If the columns don't fill all the available space, a "clickable phantom header" is visible (see screenshot and xaml) - clicking it produces a crash.
It appears that the phantom header is extends from "Name" to the edge of the container. The best way to hide it is by adjusting the column width to fill space, or adjusting the listview width to fit the columns. |
Thank you for taking the time to add some details. Stretching the columns to eliminate the empty space is not possible with simple XAML as far as I know. Maybe I could build another extension for that in a future version if you would like to see this. |
Quick and dirty fix is to add a null check, but it seems to make sense if that header wasn't there, or wasn't selectable.
The text was updated successfully, but these errors were encountered: