There is nothing in the docs about this after four hours of searching. I can only conclude there isn't support for this functionality but find that difficult to believe.
Thanks,.
Before I attempt to go down this road, can the RadListControl (or any other Telerik control) do the following:
We need text on the left and 2 images on the right both of which can be clicked to fire separate events.
Thanks
Carl
Hi,
I have used RadListControl.ScrollToItem to bring a searched for item into view,thi sbrings it into view but either at top or bottom of the list. Is it possible to somehow center the selected item in the middle of the view so that I can obtain context based on surrounding items ?
Many thanks
Toby
I am required to call an API endpoint, which is return a list of strings. This I have working.
Each item within that list is a daily announcement which is a block of text, that needs to be displaying within a scrolling parent frame. Please refer to the attached .PNG file with a screenshot of the mockup I got from our project managers.
I am not sure which is the best way to do this, as I'm relatively new to Telerik Winform UI. I am looking at either a:
DataGridView
ListControl
List of labels within a panel.
Just trying to find the most effective and simple way to do this. Any suggestions?
Hi.
I have a listbox on a form. The user enters a value in a text box, clicks a button, the value is added to the list. All that works. The button click also sets the selected item to be the just entered value and calls scrolltoitem to reposition the listbox. The list box doesn't reposition.
Here is the code from the button click function:
private void radButton1_Click(object sender, EventArgs e)
{
var item = radTextBox1.Text;
if (string.IsNullOrWhiteSpace(item))
return;
// let's make sure this folder doesn't already exist in the list.
if (radListControl1.Items.Contains(item))
return;
var newItem = new RadListDataItem(item, item);
radListControl1.Items.Add(newItem);
radListControl1.SelectedItem = newItem;
radListControl1.ScrollToItem(newItem);
}
I have also attached a working example.
Why doesn't this work as expected?
Thanks
-marc
001.
internal
class
NotificationA : INotification {
002.
public
string
Name {
get
;
set
; }
003.
public
string
Type => nameof(NotificationA);
004.
}
005.
006.
internal
class
NotificationB : INotification {
007.
public
int
Degree {
get
;
set
; }
008.
public
string
Type => nameof(NotificationB);
009.
}
010.
011.
internal
class
NotificationAListItem : RadListVisualItem {
012.
private
LightVisualElement notificationTitleElement;
013.
private
StackLayoutPanel stackLayout;
014.
015.
protected
override
void
CreateChildElements()
016.
{
017.
base
.CreateChildElements();
018.
019.
stackLayout =
new
StackLayoutPanel();
020.
stackLayout.Orientation = System.Windows.Forms.Orientation.Vertical;
021.
022.
notificationTitleElement =
new
LightVisualElement();
023.
notificationTitleElement.TextAlignment = ContentAlignment.MiddleLeft;
024.
notificationTitleElement.Margin =
new
Padding(10);
025.
notificationTitleElement.ForeColor = Color.Black;
026.
stackLayout.Children.Add(notificationTitleElement);
027.
028.
this
.Children.Add(stackLayout);
029.
}
030.
031.
public
override
void
Synchronize()
032.
{
033.
base
.Synchronize();
034.
Text =
string
.Empty;
035.
if
(Data.DataBoundItem
is
not NotificationA n)
return
;
036.
notificationTitleElement.Text = Convert.ToString(n.Name);
037.
}
038.
}
039.
040.
internal
class
NotificationBListItem : RadListVisualItem
041.
{
042.
private
LightVisualElement notificationTitleElement;
043.
private
StackLayoutPanel stackLayout;
044.
045.
protected
override
void
CreateChildElements()
046.
{
047.
base
.CreateChildElements();
048.
049.
stackLayout =
new
StackLayoutPanel();
050.
stackLayout.Orientation = Orientation.Vertical;
051.
052.
053.
notificationTitleElement =
new
LightVisualElement();
054.
notificationTitleElement.TextAlignment = ContentAlignment.MiddleLeft;
055.
notificationTitleElement.Margin =
new
Padding(10);
056.
notificationTitleElement.ForeColor = Color.Black;
057.
stackLayout.Children.Add(notificationTitleElement);
058.
059.
Children.Add(stackLayout);
060.
061.
Padding =
new
Padding(5);
062.
Shape =
new
RoundRectShape(3);
063.
BorderColor = Color.FromArgb(255, 110, 153, 210);
064.
BorderGradientStyle = GradientStyles.Solid;
065.
DrawBorder =
true
;
066.
DrawFill =
true
;
067.
BackColor = Color.FromArgb(255, 230, 238, 254);
068.
GradientStyle = GradientStyles.Solid;
069.
}
070.
071.
public
override
void
Synchronize()
072.
{
073.
base
.Synchronize();
074.
Text =
string
.Empty;
075.
if
(Data.DataBoundItem
is
not NotificationB n)
return
;
076.
notificationTitleElement.Text = Convert.ToString(n.Degree);
077.
}
078.
}
079.
080.
public
partial
class
TestForm : RadForm {
081.
public
TestForm() {
082.
InitializeComponent();
083.
InitializeViewAppearance();
084.
}
085.
086.
private
void
InitializeViewAppearance() {
087.
var notifications =
new
List<INotification> {
088.
new
NotificationA {Name =
"Foo"
},
089.
new
NotificationA {Name =
"Bar"
},
090.
new
NotificationB { Degree = 180 }
091.
};
092.
for
(var i = 0; i < 100000; i++) {
093.
notifications.Add(
new
NotificationA { Name = $
"test item {i}"
});
094.
}
095.
lcNotifications.CreatingVisualListItem += OnNotificationItemCreating;
096.
lcNotifications.DataSource = notifications;
097.
}
098.
099.
private
void
OnNotificationItemCreating(
object
sender, CreatingVisualListItemEventArgs args)
100.
{
101.
args.VisualItem = args.DataItem.DataBoundItem
switch
{
102.
NotificationA _ =>
new
NotificationAListItem(),
103.
NotificationB _ =>
new
NotificationBListItem(),
104.
_ => args.VisualItem
105.
};
106.
}
107.
}
I have a listbox and want to set some of the items as bold based on various criteria.
Example 1:
Listbox contains a list of all employees and I want to bold the employees who are listed as "working" in another table.
Example 2:
Listbox contains a list of ALL Products and I want to bold the ones that are that are in are on sale (as identified in another table).
I've looked at the examples of changing format based on selection or hover, but I can't figure out how to translate that into the above use cases.