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

Need my ListView to show row title

3 Answers 479 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Sherlock
Top achievements
Rank 1
Sherlock asked on 16 Nov 2013, 09:14 PM
Hi
I have a list view like this:


                                 Column 0                              Column 1                                Column 2
ListViewItem1                 1                                           2                                               3
ListViewItem2                 4                                           5                                               6



When I make my list, the "ListViewItem1" and "ListViewItem2" is not visible.

My questions are:
1. How shall I make "ListViewItem1" and "ListViewItem2" to be visible in my grid list?
2. How shall I change "ListViewItem1" and "ListViewItem2" to "Row1" and "Row2" ?
3. How shall I change "Column 0" and "Column 1" and "Column 2" to "Col1" and "Col2" and "Col3" ?
4. How can I do, which each cells can be selectable? As I tried, just each row can be selectable. I need each cells can be selectable like GridView.

For better explanation, I need bellow list to be appear in run :

                                    Col1                                     Col2                                          Col3
Row1                             1                                           2                                               3
Row2                             4                                           5                                               6




5. How shall I change the color header, font header and backcolor header?
6. How can I change the color of fonts of whole list? I mean Items and also its row header?
7. How can I read and write item from Row2,Col3 ?
8. How shall I change scroll bar thickness?
9. If I apply any themes (like Aqua) then whether ShowGridLines is True or False, gridlines are disappear. How shall I make it appear when I use a theme?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Nov 2013, 06:49 PM
Hello Sherlock,

Thank you for contacting Telerik Support.

In order to customize the RadListView as you have described you may use the following code example:
Font font = new System.Drawing.Font("Arial",10f, FontStyle.Bold);
 
public Form1()
{
    InitializeComponent();
    new RadControlSpyForm().Show();
 
    radListView1.Columns.Add("RowCol", "");
    radListView1.Columns.Add("Col1");
    radListView1.Columns.Add("Col2");
    radListView1.Columns.Add("Col3");
 
    radListView1.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView;
 
    for (int i = 0; i < 10; i++)
    {
        ListViewDataItem item = new ListViewDataItem();
        radListView1.Items.Add(item);
        item["RowCol"] = "Row " + (i + 1);
        item[1] = i;
        item[2] = "Name" + i;
        item[3] = "Description" + i;
    }
 
    radListView1.Items[1][3] = "Sample";
    radListView1.Font = font;
    radListView1.VerticalScroll.Enabled = true;
    radListView1.VisualItemFormatting += radListView1_VisualItemFormatting;
}

#4 You are allowed to customize the theme on a way to remain only cell selection border, without indicating the whole row using Visual Style Builder.

#5 You are able to customize the theme again in Visual Style Builder to change the default DetailListViewHeaderCellElement back color, font, fore color.

#8 You can modify the RadScrollBarElement changing its MinSize property.

#9 Some themes do not show grid lines, because they style differently the separate data cell (different cell border, etc.). Office2010Black, Office2010Blue, Office2010Silver do display data cell borders. If your requirement is to display the borders, it is also necessary to modify the theme. 

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
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
Sherlock
Top achievements
Rank 1
answered on 22 Nov 2013, 12:31 PM
Hi again.
I used below code, but only vertical scrollbar take effect and changes the thickness!
         Me.RadListView1.ListViewElement.ViewElement.HScrollBar.MinSize = New Size(1, 1)
         Me.RadListView1.ListViewElement.ViewElement.VScrollBar.MinSize = New Size(1, 1)

Also as I understand, below code should takes effect on both vertical and horizontal scrollbar, but only vertical takes effect:
         Me.RadListView1.ListViewElement.ViewElement.Scroller.Scrollbar.MinSize = New Size(1, 1)



I should add that, each code I use to change anything on scrollbar, only vertical takes effect, and nothing happens to horizontal.
For example to hide left button:
        Me.RadListView1.ListViewElement.ViewElement.Scroller.Scrollbar.FirstButton.Visibility = ElementVisibility.Collapsed

Also I used below code, but nothing happens on left button of horizontal scrollbar:
        Me.RadListView1.ListViewElement.ViewElement.HScrollBar.FirstButton.Visibility = ElementVisibility.Collapsed

But it is amazing that vertical scrollbar takes effect with below code:
        Me.RadListView1.ListViewElement.ViewElement.VScrollBar.FirstButton.Visibility = ElementVisibility.Collapsed


What is my fault with Horizontal scroll bar ??????????????????
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Nov 2013, 11:48 AM
Hello Sherlock,

Thank you for writing back.

RadListView in DetailsView mode has a little bit different elements structure compared to the rest of the View modes. In order to modify the horizontal scroll bar, you may use the following code example:
radListView1.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView;
 
//horizontal scrollbar
RadScrollBarElement hScroll = radListView1.ListViewElement.ViewElement.Children[4] as RadScrollBarElement;
if (hScroll != null)
{
    hScroll.MinSize = new Size(1, 1);
    hScroll.FirstButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
}

Please do not hesitate to contact us if you have any additional questions.

Regards,
Desislava
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
Sherlock
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Sherlock
Top achievements
Rank 1
Share this question
or