Print Page | Close Window

ListView Markup Help

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=17127
Printed Date: 05 October 2024 at 6:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ListView Markup Help
Posted By: Exo31
Subject: ListView Markup Help
Date Posted: 18 August 2010 at 10:04am
Hi,

I am working on using the markup function on some data held in a list view.
I have the following code:

    lstTx.AddItem "<Border BorderThickness='2' BorderBrush='Green' Margin='0, 2, 0, 2' Padding='3'><StackPanel Orientation='Horizontal'>" & _
    "<Image Source='201'/>" & _
    "<Grid><Grid.ColumnDefinitions><ColumnDefinition Width='Auto'/><ColumnDefinition Width='*'/></Grid.ColumnDefinitions>" & _
    "<Grid.RowDefinitions><RowDefinition/><RowDefinition/></Grid.RowDefinitions>" & _
    "<TextBlock TextAlignment='Right' FontWeight='Bold' Foreground='Navy' Text='Device:'/>" & _
    "<TextBlock TextAlignment='Right' Grid.Row='1' FontWeight='Bold' Foreground='Navy' Text=' IP Address:'/>" & _
    "<TextBlock Margin='6, 0, 0, 0' Grid.Column='1' Text='UnitName'/>" & _
    "<TextBlock Margin='6, 0, 0, 0'  Grid.Column='1' Grid.Row='1'  Text='IPAddress'/>" & _
    "</Grid></StackPanel></Border>"

The items in red are showing up in my list view just as text however I need to display text that comes from a string. I am extracting a value from a database and storing that in a string.

How can I display the text from a string using markup in list view?

Please help.

Thx


-------------
Product: Xtreme SuitePro (ActiveX) version 13.1.0
Platform: Windows XP SP 2
Language: Visual Basic 6 SP6



Replies:
Posted By: SuperMario
Date Posted: 20 August 2010 at 12:49pm
Something like this assuming UnitName is the vaiable...
"<TextBlock Margin='6, 0, 0, 0' Grid.Column='1' Text='" & UnitName &"'/>" & _


Posted By: Exo31
Date Posted: 20 August 2010 at 12:56pm
Thanks that is exactly what I was looking for! Much appreciated.

-------------
Product: Xtreme SuitePro (ActiveX) version 13.1.0
Platform: Windows XP SP 2
Language: Visual Basic 6 SP6


Posted By: jpbro
Date Posted: 20 August 2010 at 2:17pm
Also, you will want to encode characters that will break your markup rendering when trying to display text values from variable:

http://forum.codejock.com/forum_posts.asp?TID=10865 - http://forum.codejock.com/forum_posts.asp?TID=10865


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Exo31
Date Posted: 23 August 2010 at 4:16am
Thanks jpbro I will implement the encode as you suggested.

-------------
Product: Xtreme SuitePro (ActiveX) version 13.1.0
Platform: Windows XP SP 2
Language: Visual Basic 6 SP6



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net