Hello.
I've been researching and made a code that could solve my problem of automatic visibility of the scroll bar in Telerik listView, Telerik ListControl and Windows listView
using
System;
namespace
TelerikWinFormsApp2
{
public
partial
class
RadForm1 : Telerik.WinControls.UI.RadForm
{
public
RadForm1()
{
InitializeComponent();
for
(
int
i = 0; i < 50; i++)
{
radListView1.Items.Add(
"aa"
);
radListControl1.Items.Add(
"aa"
);
listView1.Items.Add(
"aa"
);
}
//Windows listView Mouse Events
listView1.MouseEnter +=
new
EventHandler(listView1_MouseEnter);
listView1.MouseLeave +=
new
EventHandler(listView1_MouseLeave);
//Telerik listView Mouse Events
radListView1.MouseEnter +=
new
EventHandler(radListView1_MouseEnter);
radListView1.MouseLeave +=
new
EventHandler(radListView1_MouseLeave);
//Telerik listControl Mouse Events
radListControl1.MouseEnter +=
new
EventHandler(radListControl1_MouseEnter);
radListControl1.MouseLeave +=
new
EventHandler(radListControl1_MouseLeave);
}
private
void
RadForm1_Load(
object
sender, EventArgs e)
{
//Windows ListView
listView1.Scrollable =
false
;
//Telerik ListView
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.FirstButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.SecondButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.ThumbElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.FillElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.Children[1].Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.BorderElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
//Telerik ListControl
this
.radListControl1.ListElement.Scroller.Scrollbar.FirstButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.SecondButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.ThumbElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.FillElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.Children[1].Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.BorderElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
}
private
void
radListView1_MouseEnter(
object
sender, EventArgs e)
{
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.FirstButton.Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.SecondButton.Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.ThumbElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.FillElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.Children[1].Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.BorderElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;
}
private
void
radListView1_MouseLeave(
object
sender, EventArgs e)
{
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.FirstButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.SecondButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.ThumbElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.FillElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.Children[1].Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListView1.ListViewElement.ViewElement.Scroller.Scrollbar.BorderElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
}
private
void
radListControl1_MouseEnter(
object
sender, EventArgs e)
{
this
.radListControl1.ListElement.Scroller.Scrollbar.FirstButton.Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListControl1.ListElement.Scroller.Scrollbar.SecondButton.Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListControl1.ListElement.Scroller.Scrollbar.ThumbElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListControl1.ListElement.Scroller.Scrollbar.FillElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListControl1.ListElement.Scroller.Scrollbar.Children[1].Visibility = Telerik.WinControls.ElementVisibility.Visible;
this
.radListControl1.ListElement.Scroller.Scrollbar.BorderElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;
}
private
void
radListControl1_MouseLeave(
object
sender, EventArgs e)
{
this
.radListControl1.ListElement.Scroller.Scrollbar.FirstButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.SecondButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.ThumbElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.FillElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.Children[1].Visibility = Telerik.WinControls.ElementVisibility.Hidden;
this
.radListControl1.ListElement.Scroller.Scrollbar.BorderElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
}
private
void
listView1_MouseEnter(
object
sender, EventArgs e)
{
listView1.Scrollable =
true
;
}
private
void
listView1_MouseLeave(
object
sender, EventArgs e)
{
listView1.Scrollable =
false
;
}
}
}
I hope it helps.
Regards
Felipe.
​