Completed
Last Updated: 15 Mar 2016 06:47 by ADMIN
ADMIN
Ralitsa
Created on: 01 Mar 2016 06:56
Category: ListView, CardView and CheckedListBox
Type: Bug Report
1
FIX. RadListView - the checkboxes can not be hidden for particular items
To reproduce: 
1. Add RadListView with few items 
2. Set the ShowCheckBoxes property to true and the Dock property to Fill
3. Subscribe to the VisualItemFormatting event and use the following code: 
void radListView1_VisualItemFormatting(object sender, ListViewVisualItemEventArgs e)
{
    IconListViewVisualItem item = e.VisualItem as IconListViewVisualItem;
    if (item != null)
    {
        ListViewItemCheckbox checkBox = item.ToggleElement as ListViewItemCheckbox;
        if (item.Text.Contains("coffee") || item.Text.Contains("Americano"))
        {
            checkBox.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
        }
    }
}
4. Run the form.The checkboxes are hidden until resizing the form. 


Workaround: 
Set the MaxSize of checkboxes: 
void radListView1_VisualItemFormatting(object sender, ListViewVisualItemEventArgs e)
{
    IconListViewVisualItem item = e.VisualItem as IconListViewVisualItem;
    if (item != null)
    {
        ListViewItemCheckbox checkBox = item.ToggleElement as ListViewItemCheckbox;
        if (item.Text.Contains("coffee") || item.Text.Contains("Americano"))
        {
            checkBox.MaxSize = checkBox.MaxSize = new Size(1,1);
        }
    }
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments