Bug 7466 - GridView Number of columns
Summary: GridView Number of columns
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2012-09-26 07:03 UTC by Alex Szasz
Modified: 2013-05-14 19:40 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Alex Szasz 2012-09-26 07:03:02 UTC
I can't find a way to get the number of columns in a GridView. 
I found the set method, but not the get one.

In the Android help (http://developer.android.com/reference/android/widget/GridView.html#getNumColumns()) this method seems to be available.

Is there a way to do this?
Comment 1 Peter Collins 2013-05-14 17:12:20 UTC
@JonP: I can't seem to find a few GridView properties that we have documented [0]. I'm only seeing Adapter and StretchMode, although the potentially missing properties do have setters (IE SetNumColumns, SetGravity). Is there a trick to accessing GridView properties such as NumColumns or VerticalSpacing?

[0] http://androidapi.xamarin.com/?link=P%3aAndroid.Widget.GridView.NumColumns
Comment 2 Jonathan Pryor 2013-05-14 19:25:32 UTC
@PeterC: At the bottom of the documentation is a Requirements section. At the bottom of the Requirements section is a Since entry:

> Since: API Level 11

This is the _minimum_ API level that your $(TargetFrameworkVersion) needs to be set to in order to access the member. API Level 11 is Android v3.0 (or later).

I suspect that your project is targeting the default of Android v2.2 (API level 8).
Comment 3 Peter Collins 2013-05-14 19:40:04 UTC
Ugh. I made sure to bump both the target and min API levels before updating this bug, but the assembly browser / intellisense didn't update until reloading the solution I was testing.