This is a migrated thread and some comments may be shown as answers.

Image column

7 Answers 197 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Joaquín
Top achievements
Rank 2
Joaquín asked on 30 Dec 2012, 01:07 AM
Is there a way to create a ListView in which one of the columns is an image column (this is, a column in which to show an image)?. I would like also to be able to turn the visibility of the images on and off. Thank you!

Joaquín

7 Answers, 1 is accepted

Sort by
0
Accepted
Anton
Telerik team
answered on 03 Jan 2013, 08:24 AM
Hello Joaquín,

Thank you for writing.

Although it can be achieved, such a functionality is not supported out of the box from RadListView. I would suggest you to use RadGridView instead of RadListView, where this functionality is implemented and will be much easier to achieve such behavior - simply use a GridViewImageColumn and CellFormatting event of the grid. Let me know if this approach is not suitable for you.

Attached is a sample project.

Should you have any other questions, I will be glad to assist you.

Kind regards,
Anton
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Joaquín
Top achievements
Rank 2
answered on 03 Jan 2013, 11:56 AM
Hi Anton,

Thank you for your reply. I'm used to the ASP.NET version of the ListView control and thought I could create an item template in WinForms as I do in ASP.NET. I will try using RadGrid in WinForms as you suggest.

Joaquín
0
Anton
Telerik team
answered on 07 Jan 2013, 11:11 AM
Hi Joaquín,

Thank you for writing back.

Unfortunately, in WinForms there is no direct equivalent of the templates in ASP.Net. However the desired behavior can be achieved with the RadGridView.

Should you have any other questions, I will be glad to assist you.

Greetings,
Anton
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Patrick
Top achievements
Rank 1
Veteran
answered on 05 Aug 2013, 09:24 PM
Hello,
I attempted to use the demo project included in your reply.  I'm using VS 2012 and 2013 Q2 of the Telerik RadControls (2013.2.724.40).

When I attempt to view Form1 in the designer, it does not display but instead it shows a "To prevent possible data loss before loading the designer, the following errors must be resolved" page with two errors. the first is:

"Object reference not set to an instance of an object" with a call stack of:
at Telerik.WinControls.UI.Design.RadGridViewDesigner.Initialize(IComponent component)
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at Telerik.WinControls.UI.Design.RadControlCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement)
at Telerik.WinControls.UI.Design.RadControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)

The second error:
"The variable 'radGridView1' is either undeclared or was never assigned."
I think this appears to happen because of the first since it clearly is declared in the designer cs:
private Telerik.WinControls.UI.RadGridView radGridView1;
and instantiated:
this.radGridView1 = new Telerik.WinControls.UI.RadGridView();

I appreciate any guidance in resolving this.
Patrick
0
Anton
Telerik team
answered on 08 Aug 2013, 09:07 AM
Hi Patrick,

Thank you for writing.

In order to resolve the issue, please follow these steps:

1. Ensure that the demo project has all required references
  • Telerik.WinControls.dll
  • Telerik.WinControls.GridView.dll
  • Telerik.WinControls.UI.dll
  • Telerik.WinControls.UI.Design.dll
  • TelerikCommon.dll
2. Execute Clean and Rebuild commands.
3. If the steps above do not help, you should restart the Visual Studio.

I hope this helps.

Regards,
Anton
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Patrick
Top achievements
Rank 1
Veteran
answered on 09 Aug 2013, 04:23 AM
Thank you for the reply.  I had confirmed the references before. The odd thing was  it compiled and ran w/out error; I simply could not open the form in design view.  Cleaning, rebuilding the project and restarting VS resolved the problem.  Thank you.

Patrick
0
Anton
Telerik team
answered on 09 Aug 2013, 02:16 PM
Hello Patrick,

Thank you for writing back.

I am glad to hear that the issue is already resolved. Let me know if you have any additional questions.

Regards,
Anton
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ListView
Asked by
Joaquín
Top achievements
Rank 2
Answers by
Anton
Telerik team
Joaquín
Top achievements
Rank 2
Patrick
Top achievements
Rank 1
Veteran
Share this question
or