Does anyone have experience with binding Infragistics controls using MvvmCross? I think a simple example to start out with might be the SingleRow example below. Any suggestions on binding the datasource or other properties using MvvmCross?
[Register("SingleRowView")] public class SingleRowView : MvxView { public IGGridView GridView; private IGGridViewImageColumnDefinition _col; public IGGridViewSingleRowSingleFieldDataSourceHelper Ds; public SingleRowView() { Initialize(); } public SingleRowView(RectangleF bounds) : base(bounds) { Initialize(); } void Initialize() { BackgroundColor = UIColor.Black; GridView = new IGGridView(new RectangleF(0f,0f, Frame.Size.Width, 100f), IGGridViewStyle.IGGridViewStyleDefault) { AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth, SelectionType = IGGridViewSelectionType.IGGridViewSelectionTypeCell, HeaderHeight = 0f, EmptyRows = false, RowSeparatorHeight = 0, AllowHorizontalBounce = true, AlwaysBounceVertical = false, RowHeight = 100f, ColumnWidth = new IGColumnWidth(), Theme = new IGGridViewLightTheme() }; _col = new IGGridViewImageColumnDefinition(@"Image", IGGridViewImageColumnDefinitionPropertyType .IGGridViewImageColumnDefinitionPropertyTypeImage); Ds = new IGGridViewSingleRowSingleFieldDataSourceHelper(_col); GridView.DataSource = Ds; } }
Thanks for the Quick reply! That seemed to fix it. Now, if I add more items (10) than fit on the screen, the items just get re-sized to fit, instead of creating a horizontal scroll. I imagine it has something to do with how I am initializing the ColumnWidth. In objective C the IGColumnWidth is initialized with a width. I can't seem to figure out how to do this in Monotouch.
Hi Blake,
It worked for me, however, i did have to modify the code so that the GridView you create was added to the SingleRowView as a subView.
I'm attaching the sample i used.
Note, it did take about a second or 2 for the images to load, however, thats b/c the url's appear to take some time.
-SteveZ
I sure appreciate the feed and the offer. I seem to be having a bit of trouble getting my basic example that doesn't use MvvmCross working. I have modified the code slightly. Any help is much appreciated! When I add the UIView to a ViewController or as a subview to another view, I see the single row table is created, but I don't see the two images that I added. As always, thanks for the help!
[Register("SingleRowView")] public class SingleRowView : UIView { public IGGridView GridView; private IGGridViewImageColumnDefinition _col; public IGGridViewSingleRowSingleFieldDataSourceHelper Ds; public SingleRowView() { Initialize(); } public SingleRowView(RectangleF bounds) : base(bounds) { Initialize(); } void Initialize() { BackgroundColor = UIColor.Black; GridView = new IGGridView(new RectangleF(0f, 0f, Frame.Size.Width, 100f), IGGridViewStyle.IGGridViewStyleDefault) { AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth, SelectionType = IGGridViewSelectionType.IGGridViewSelectionTypeCell, HeaderHeight = 0f, EmptyRows = false, RowSeparatorHeight = 0, AllowHorizontalBounce = true, AlwaysBounceVertical = false, RowHeight = 100f, ColumnWidth = new IGColumnWidth(), Theme = new IGGridViewLightTheme() }; _col = new IGGridViewImageColumnDefinition(@"Image", IGGridViewImageColumnDefinitionPropertyType .IGGridViewImageColumnDefinitionPropertyTypeStringUrl); Ds = new IGGridViewSingleRowSingleFieldDataSourceHelper(_col); var animls = new List<SingleRowData> { new SingleRowData("http://placepuppy.it/200/225"), new SingleRowData("http://placepuppy.it/200/230") }; Ds.Data = animls.ToArray(); GridView.WeakDataSource = Ds; } } [Register("SingleRowData")] public class SingleRowData : NSObject { public SingleRowData(string image) { Image = image; } [Export("Image")] public string Image { get; set; } }
Please, feel free to contact us for any additional information about our products that you might require.
Regards,
Dimitar Atanasov
Senior Software Engineer
Infragistics
Unfortunately, we haven't tried using our stuff with MVVM Cross as of yet. If we do get a chance, we'll definitely share our findings.
However, in the mean time, if you find any issues or anything that's missing from us that is preventing you from using our stuff with this project, please let us know and we'll look in to it right away.