Telerik Forums
UI for WinForms Forum
1 answer
32 views
           

Hello,

 

How do i make the item appear only once in the popup when the theme is Desert?

 

1 - Without Theme

 

2 - Desert Theme

 

Code:

 

      List<TecnicoServicoInfo> listaTecnicos = new List<TecnicoServicoInfo>();

            TecnicoServicoInfo tec = new TecnicoServicoInfo();
            tec.CdFuncionario = -1;
            tec.DsFuncionario = " ";
            TecnicoServicoInfo tec1 = new TecnicoServicoInfo();
            tec1.CdFuncionario = 80;
            tec1.DsFuncionario = "robsu";
            TecnicoServicoInfo tec2 = new TecnicoServicoInfo();
            tec2.CdFuncionario = 1558;
            tec2.DsFuncionario = "joelssu";
            TecnicoServicoInfo tec4 = new TecnicoServicoInfo();
            tec4.CdFuncionario = 333;
            tec4.DsFuncionario = "TESTE UM NOME MAIOR QUE TODOS OS OUTROS PARA VER O TEMA";
            listaTecnicos.Add(tec);
            listaTecnicos.Add(tec2);
            listaTecnicos.Add(tec1);
            listaTecnicos.Add(tec4);
            listaTecnicos = listaTecnicos.OrderBy(x => x.DsFuncionario).ToList();

            ddlTecnico.DropDownStyle = RadDropDownStyle.DropDown;
            ddlTecnico.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            ddlTecnico.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;
            ddlTecnico.Items.Clear();

            ddlTecnico.DescriptionTextMember = "DsFuncionario";
            ddlTecnico.ValueMember = "CdFuncionario";
            ddlTecnico.DisplayMember = "DsFuncionario";

            ddlTecnico.DataSource = listaTecnicos;


            ddlproxima.DropDownStyle = RadDropDownStyle.DropDown;
            ddlproxima.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            ddlproxima.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;
            ddlproxima.Items.Clear();

            ddlproxima.DescriptionTextMember = "DsFuncionario";
            ddlproxima.ValueMember = "CdFuncionario";
            ddlproxima.DisplayMember = "DsFuncionario";


            ddlproxima.DataSource = listaTecnicos;

            ddlproxima.AutoSizeItems = false;
            ddlproxima.AutoSize = false;

 

Telerik version: 23.2.718

 

Thank You!

Willian
Top achievements
Rank 1
Iron
 answered on 03 Dec 2024
2 answers
48 views
I had a question about the Dropdown element, I saw how to search for it, but I couldn't find it for dynamic
    public SearchWarehouseNP()
    {
        InitializeComponent();
        dropdownSettlement.DropDownStyle = RadDropDownStyle.DropDown;
        dropdownSettlement.AutoCompleteMode = AutoCompleteMode.Suggest;

        dropdownSettlement.DropDownListElement.AutoCompleteSuggest = new CustomAutoCompleteSuggestHelperUpdate(
            dropdownSettlement.DropDownListElement,
            async query =>
            {
                if (string.IsNullOrWhiteSpace(query) || query.Length < 3)
                    return Enumerable.Empty<DescriptionTextListDataItem>();

                var response = await _searchSettlementService.GetCityData(query);
                if (response.success && response.data.Any())
                {
                    return response.data.First().Addresses.Select(a => new DescriptionTextListDataItem
                    {
                        Text = $"{a.MainDescription} ({a.Area})",
                        Value = a.MainDescription,
                        DescriptionText = a.Area
                    });
                }

                return Enumerable.Empty<DescriptionTextListDataItem>();
            }
        );

        dropdownSettlement.SelectedIndexChanged += (s, e) =>
        {
            if (dropdownSettlement.SelectedItem is DescriptionTextListDataItem selectedItem)
            {
                Console.WriteLine($"Выбрано: {selectedItem.Text} ({selectedItem.Value})");
            }
        };
    }
}
The problem is that the data is not stored in Items
Console.WriteLine empty

using Telerik.WinControls.UI;

namespace NovaPostOrderManager.Helpers;

public class CustomAutoCompleteSuggestHelperUpdate : AutoCompleteSuggestHelper
{
    private readonly Func<string, Task<IEnumerable<DescriptionTextListDataItem>>> _fetchDataAsync;
    private CancellationTokenSource _cts = new();

    public CustomAutoCompleteSuggestHelperUpdate(RadDropDownListElement owner, Func<string, Task<IEnumerable<DescriptionTextListDataItem>>> fetchDataAsync)
        : base(owner)
    {
        _fetchDataAsync = fetchDataAsync;
    }

    protected override async void SyncItemsCore()
    {
        // Текущий текст из поля ввода
        string currentInput = Filter;

        // Проверяем, нужно ли загружать данные
        if (string.IsNullOrWhiteSpace(currentInput) || currentInput.Length < 3)
        {
            DropDownList.ListElement.Items.Clear();
            DropDownList.ClosePopup();
            return;
        }

        // Отменяем предыдущий запрос
        _cts.Cancel();
        _cts = new CancellationTokenSource();

        try
        {
            // Задержка перед началом запроса
            await Task.Delay(300, _cts.Token);

            // Загружаем данные
            var items = await _fetchDataAsync(currentInput);

            _cts.Token.ThrowIfCancellationRequested();

            DropDownList.ListElement.BeginUpdate();
            DropDownList.ListElement.Items.Clear();

            // Добавляем элементы в выпадающий список
            foreach (var item in items)
            {
                DropDownList.ListElement.Items.Add(item);
            }

            DropDownList.ListElement.EndUpdate();

            if (DropDownList.ListElement.Items.Count > 0)
            {
                DropDownList.ShowPopup(); // Показываем список, если есть элементы
            }
            else
            {
                DropDownList.ClosePopup();
            }
        }
        catch (TaskCanceledException)
        {
            // Запрос был отменён — игнорируем
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Ошибка загрузки данных: {ex.Message}");
        }
    }

    protected override bool DefaultFilter(RadListDataItem item)
    {
        if (item is not DescriptionTextListDataItem descriptionItem)
            return base.DefaultFilter(item);

        return descriptionItem.Text.Contains(Filter, StringComparison.CurrentCultureIgnoreCase) ||
               descriptionItem.DescriptionText.Contains(Filter, StringComparison.CurrentCultureIgnoreCase);
    }
}

hans
Top achievements
Rank 1
Iron
 answered on 29 Nov 2024
1 answer
43 views
The problem is that the data is not stored in Items


using Telerik.WinControls.UI;

namespace NovaPostOrderManager.Helpers;

public class CustomAutoCompleteSuggestHelperUpdate : AutoCompleteSuggestHelper
{
    private readonly Func<string, Task<IEnumerable<DescriptionTextListDataItem>>> _fetchDataAsync;
    private CancellationTokenSource _cts = new();

    public CustomAutoCompleteSuggestHelperUpdate(RadDropDownListElement owner, Func<string, Task<IEnumerable<DescriptionTextListDataItem>>> fetchDataAsync)
        : base(owner)
    {
        _fetchDataAsync = fetchDataAsync;
    }

    protected override async void SyncItemsCore()
    {
        // Текущий текст из поля ввода
        string currentInput = Filter;

        // Проверяем, нужно ли загружать данные
        if (string.IsNullOrWhiteSpace(currentInput) || currentInput.Length < 3)
        {
            DropDownList.ListElement.Items.Clear();
            DropDownList.ClosePopup();
            return;
        }

        // Отменяем предыдущий запрос
        _cts.Cancel();
        _cts = new CancellationTokenSource();

        try
        {
            // Задержка перед началом запроса
            await Task.Delay(300, _cts.Token);

            // Загружаем данные
            var items = await _fetchDataAsync(currentInput);

            _cts.Token.ThrowIfCancellationRequested();

            DropDownList.ListElement.BeginUpdate();
            DropDownList.ListElement.Items.Clear();

            // Добавляем элементы в выпадающий список
            foreach (var item in items)
            {
                DropDownList.ListElement.Items.Add(item);
            }

            DropDownList.ListElement.EndUpdate();

            if (DropDownList.ListElement.Items.Count > 0)
            {
                DropDownList.ShowPopup(); // Показываем список, если есть элементы
            }
            else
            {
                DropDownList.ClosePopup();
            }
        }
        catch (TaskCanceledException)
        {
            // Запрос был отменён — игнорируем
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Ошибка загрузки данных: {ex.Message}");
        }
    }

    protected override bool DefaultFilter(RadListDataItem item)
    {
        if (item is not DescriptionTextListDataItem descriptionItem)
            return base.DefaultFilter(item);

        return descriptionItem.Text.Contains(Filter, StringComparison.CurrentCultureIgnoreCase) ||
               descriptionItem.DescriptionText.Contains(Filter, StringComparison.CurrentCultureIgnoreCase);
    }
}

hans
Top achievements
Rank 1
Iron
 updated question on 29 Nov 2024
1 answer
30 views

Hello Support Team.

I have an application with a PropertyGrid in C# with WinForms. Is it possible to have a CheckedListBox to allow multiple selections in the PropertyGrid?

Thank you in advance.

Nadya | Tech Support Engineer
Telerik team
 answered on 28 Nov 2024
1 answer
53 views

Hello, support team.

I have an application with a PropertyGrid in C# with WinForms. In this PropertyGrid I need to display a drop-down list with a predefined value list, but I need to allow also the user be able to edit a not listed value.

Thank you in advance

Nadya | Tech Support Engineer
Telerik team
 answered on 28 Nov 2024
1 answer
48 views
I've tried to remove the black border around legenditems in RadMap to no avail. I've also tried to change the border colour to white and that has not worked.  I was able to change the element spacing using  .ElementSpacing = 0 but have not been able to remove the item borders. I've pasted the code below, how can I remove the black border around legend items? I'm using .Net Framework 4.8 Winforms.

 

Thanks

 

For Each dColor As Double In {0, 0.25, 0.5, 0.75, 1}.Reverse()
        Dim oLegendItem As New MapLegendItemElement("", Color.White)

        oLegendItem.EnableBorderHighlight = False
        oLegendItem.BorderWidth = 0 ' Remove black outline?
        oLegendItem.Margin = New Padding(0)
        oLegendItem.Padding = New Padding(0)
        oLegendItem.MinSize = New Size(20, 10)
        oLegendItem.HorizontalLineWidth = 0
        oLegendItem.BorderBottomColor = Color.White
        oLegendItem.BorderTopColor = Color.White
        oLegendItem.BorderTopWidth = 0
        oLegendItem.BorderBottomWidth = 0
        oLegendItem.DrawBorder = False

        oLegendItem.BackColor = Color.White
        oLegendItem.BackColor2 = Color.White
        oLegendItem.BackColor3 = Color.White
        oLegendItem.BackColor4 = Color.White
        oLegendItem.BorderBottomShadowColor = Color.White
        oLegendItem.BorderColor = Color.White
        oLegendItem.BorderColor2 = Color.White
        oLegendItem.BorderColor3 = Color.White
        oLegendItem.BorderColor4 = Color.White
        oLegendItem.BorderInnerColor = Color.White
        oLegendItem.BorderInnerColor2 = Color.White
        oLegendItem.BorderInnerColor3 = Color.White
        oLegendItem.BorderInnerColor4 = Color.White
        oLegendItem.ShadowColor = Color.White
        oLegendItem.BorderInnerColor4 = Color.White

        oLegendItem.BorderThickness = New Padding(10)
        oLegendItem.BorderHighlightThickness = 0
        oLegendItem.DrawFill = False

        .ItemStackElement.Children.Add(oLegendItem)
    Next


    With .ItemStackElement
        .BackColor = Color.White
        .BackColor2 = Color.White
        .BackColor3 = Color.White
        .BackColor4 = Color.White
        .BorderBottomShadowColor = Color.White
        .BorderColor = Color.White
        .BorderColor2 = Color.White
        .BorderColor3 = Color.White
        .BorderColor4 = Color.White
        .BorderInnerColor = Color.White
        .BorderInnerColor2 = Color.White
        .BorderInnerColor3 = Color.White
        .BorderInnerColor4 = Color.White
        .ShadowColor = Color.White
        .BorderInnerColor4 = Color.White


        .ElementSpacing = 0  ' Remove spacing
        .EnableElementShadow = False

        .DrawBorder = False
        .EnableFocusBorder = False
        .BorderColor = Color.White
        .BorderBottomColor = Color.White
        .BorderWidth = 0
        .EnableBorderHighlight = False
        .DrawBorder = False
        .BorderBottomWidth = 0
        .BorderBottomWidth = 0
        .BorderThickness = New Padding(0)
        .BorderHighlightThickness = 0
    End With
End With

Nadya | Tech Support Engineer
Telerik team
 answered on 26 Nov 2024
1 answer
54 views

Hi,

in VirtualGrid, is there a way to set the default filter descriptor (different from "contains")?

Something like you suggest for the Grid control (https://www.telerik.com/forums/how-to-set-default-of-filterdescriptor-operator).

Thank you,

 

Emanuele

Nadya | Tech Support Engineer
Telerik team
 answered on 19 Nov 2024
1 answer
60 views

Was this removed in the most recent Winforms update?

 

I can't find it in the documentation nor the tool box in Visual Studio

Dinko | Tech Support Engineer
Telerik team
 answered on 19 Nov 2024
3 answers
70 views
Hello, How to add other control elements to radcheckedListBox,such as radDropDownList or radTextBox or radLabel, etc., and how do I add them at a specified position?
Nadya | Tech Support Engineer
Telerik team
 answered on 19 Nov 2024
1 answer
65 views

I have a self-referencing Hierarchy working fine in .NET Framework 4.8,
now I upgraded to .NET 8 with

UI.for.WinForms.AllControls.Net60   2022.2.808-hotfix


public partial class Form1 : Form
{
    private Person[] _people = {
        new Person() { ID=1, Parent =0, Name = "Hans"},
        new Person() { ID=2, Parent =1, Name = "Fred"},
        new Person() { ID=3, Parent =1, Name = "Mary"},
        new Person() { ID=4, Parent =0, Name = "John"}
    };


    public Form1()
    {
        InitializeComponent();

        radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, nameof(Person.ID), nameof(Person.Parent));
        radGridView1.DataSource = _people;
    }
}


public class Person
{
    public int ID { get; set; }
    public int Parent { get; set; }
    public string Name { get; set; }
}

Now, there are errors produced like "enumeration already finished".
Without this AddSelfReference, everything is fine. (just without the collapsable sections)
Setting DataSource first, doesn't make a difference either.

Something must have changed from the 4.8 to your 6.0 version.

Nadya | Tech Support Engineer
Telerik team
 answered on 18 Nov 2024
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
DateTimePicker
CollapsiblePanel
Conversational UI, Chat
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
NavigationView
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?