From 5f8e8a88bff74d2b369303051fa5bcc71f5c584a Mon Sep 17 00:00:00 2001 From: KB Bot Date: Tue, 17 Dec 2024 11:55:58 +0000 Subject: [PATCH] Added new kb article listview-hide-horizontal-scrollbar --- .../listview-hide-horizontal-scrollbar.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 knowledge-base/listview-hide-horizontal-scrollbar.md diff --git a/knowledge-base/listview-hide-horizontal-scrollbar.md b/knowledge-base/listview-hide-horizontal-scrollbar.md new file mode 100644 index 0000000000..3b317b811d --- /dev/null +++ b/knowledge-base/listview-hide-horizontal-scrollbar.md @@ -0,0 +1,80 @@ +--- +title: Hiding the Horizontal Scrollbar in ListView for Blazor +description: This article describes how to hide the horizontal scrollbar in TelerikListView for Blazor by using custom CSS. +type: how-to +page_title: How to Hide Horizontal Scrollbar in TelerikListView for Blazor +slug: listview-kb-hide-horizontal-scrollbar +tags: scrollbar, listview, blazor +res_type: kb +ticketid: 1673222 +--- + +## Environment + + + + + + + + +
ProductListView for Blazor
+ +## Description + +In certain scenarios, it may be necessary to hide the horizontal scrollbar of the ListView component to improve the UI experience, especially when the ListView content is fully visible and does not require scrolling. + +This knowledge base article also answers the following questions: + +- How can I remove the horizontal scrollbar from a ListView component? +- What CSS can hide the horizontal overflow in TelerikListView for Blazor? +- Is there a way to ensure elements within ListView do not cause a horizontal scrollbar? + +## Solution + +To hide the horizontal scrollbar in a TelerikListView, apply custom CSS to set the overflow property of the ListView content wrapper to hidden. This approach ensures that the horizontal scrollbar is hidden, regardless of the content width. Implement the CSS rule as shown below: + +> To maintain full visibility of the ListView elements without needing a scrollbar, ensure that the elements' width within the ListView does not exceed the ListView's width. You might need to adjust the width of the ListView or its elements accordingly: + +````RAZOR + + +

Employee List

+
+ +
+ + + +@code { + private List ListViewData { get; set; } = Enumerable.Range(1, 25).Select(x => new SampleData + { + Id = x, + Name = $"Name {x}", + Team = $"Team {x % 3}" + }).ToList(); + + public class SampleData + { + public int Id { get; set; } + public string Name { get; set; } + public string Team { get; set; } + } +} +```` + +## See Also + +- [ListView Overview]({%slug listview-overview%})