Instantiating the ListView is easy

<Control Id="ListView1" Property="ListViewProperty" Type="ListView"
X="SomeX" Y="WhyNot?" Width="wide" Height="short" Sorted="yes">
  <ListView Property="ListViewProperty">
    <!-- If we will be populating this dynamically nothing to put here..
-->
  </ListView>
</Control>

<EnsureTable Id="ListView" />

We use the EnsureTable since otherwise it might not be included in the MSI
if it doesn't contain anything... but we need it to exist so that we can
update it dynamically later.
Might not actually be needed (since it's referenced with the Control), but
it doesn't hurt to include it.


Then the custom action would be something like... (in C# because it's my
current favourite language)
... do stuff to get the thingsYouWant
Microsoft.Deployment.WindowsInstaller.View lView =
session.Database.OpenView("SELECT * FROM ListView");
lView.Execute();
int iOrder = 1;
foreach(Thing thing in thingsYouWant)
{
  try
  {
    Record lRecord = session.Database.CreateRecord(5);
    lRecord.SetString(1, "ListViewProperty");
    lRecord.SetInteger(2, iOrder);
    lRecord.SetString(3, thing.HashCode()); // we use the hashcode, because
then we can easily find what they selected... use something else if it's
more appropriate
    lRecord.SetString(4, thing. ToString()); // or thing.Name + " - " +
thing.No + " - " + thing.pincode
    // lRecord.SetXXX(5) we leave this as null, unless we have put some
icons into the binary table.. then we would populate this with the binary
table identifier
    iOrder++;

    lView.Modify(ViewModifyMode.InsertTemporary, lRecord);
  }
  catch
  {
    continue;
  }
}

This is how to add items to the ListView controls dynamically.
Hopefully it's helpful for someone...


-----Original Message-----
Date: Tue, 24 Dec 2013 16:59:31 +0530
From: ak m <wixak...@gmail.com>
Subject: Re: [WiX-users] ListView Creation

Thank you for the information..

Could you please provide any example on how to create the columns on Wix UI
and add values at run time?

I need to have 3 columns with Name, No, pincode,

Thanks in Advance...


On Tue, Dec 24, 2013 at 4:47 PM, Bevan Weiss <kaize...@hotmail.com> wrote:

> Attachments get stripped from this list, you will need to provide a 
> URL or some other such link to a hosted image.
>
> A ListView only really has two particular pieces of useful information 
> for each 'row', that being a Value, and an item of Display.
> If you want more columns then perhaps you need to rethink the way 
> you're going about the data.
>
> You could create your own custom table in the MSI and have a unique ID 
> as one of the fields.
> This unique ID is then the 'Value' from the ListView to allow the 
> selection of an entire row of data from your custom table.
>
> If you want to display all the columns to the user, then what you 
> probably want to do is concatenate the various fields together and 
> call this the 'item of Display'.
>
>
> Both options can be done using WiX, the first will likely require a 
> custom action however, to retrieve the data from the custom table.
> If the second is using some dynamic data source then it will probably 
> also require a custom action.  If the data will always be static, then 
> it is just dependent on what you type into the XML for the ListView 
> table.
>
>
> Regards,
> Bevan

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to