I know this can be done using WPF Uniformgrid, however, I would like to know how (or if) I can display data in a matrix using infragistics controls, such as when displaying a number of images. I would like the user to be able to switch between the carousel and a matrix view of the images. can this be done or not, and if so how? Thanks for any help...
Hello,
This could be done with the XamDataPresenter, however you need take several things into consideration.
You have to create a DataSource for the XamDataPresenter so that it will be able to display the data the you like it to. The DataSource is of type IEnumerable, so for example, you need a collection which holds object of custom data type. Note, that each public property will be displayed as a Field (column) and each object in the collection as a record (row). That being said, you need to have as many properties as items inside the collection.
You need to retemplate the CellValuePresenter, so that it contains an Image element and bind it to the underlying value. If you do not know how to do that, you can see a good example here.
Switching before matrix and carousel view can be achieve by setting a new View on the XamDataPresenter's View property.
Let me know if you have further questions on this.
Thanks, Alex.
Interestingly, it wasn't necessary to retemplate the cellvaluepresenter; it seemed to do fine displaying the image.
Datasource - not sure I understood exactly what you intended, but it inspired me to create a class that creates a field for each image in a fieldlayout, and assigns row and column so that images are displayed in a matrix - it appears as I would like, except I don't seem to get mouse events, like MouseWheel (to resize the columns). One issue with this approach is that you either have to predefine many public properties, or dynamically create properties as needed - neither are good solutions. If I instead use collections in my class, then the appearance of the presenter is that of nested content which I don't want. Did you have something else in mind?
I understand the concept of switching views, but don't understand how to implement the switch - do you have an example?
I appreciate you help!
Switching views:
xdp.View = new Infragistics.Windows.DataPresenter.GridView(); // because of ambiguous reference
xdp.View = new CarouselView();
My idea was to bind the XamDataGrid to a collection of objects (MatrixRow). For example, if you want a matrix 5x5, you would have to create 5 public properties on the MatrixRow class and add 5 such objects in the collection.