Telerik Forums
UI for WinForms Forum
2 answers
189 views

Hi.

 

I want to know if there is a way to NOT execute the code in "SelectedIndexChanged" when the form loads the first time

 

Regards

Kobus

 

Dinko | Tech Support Engineer
Telerik team
 answered on 23 May 2022
3 answers
338 views

is it posssible to add a button to the header of a radcollapsiblepanel from the designer code ,if so can a anyone please guide me. 

 

mansouri
Top achievements
Rank 1
Iron
 updated answer on 23 May 2022
2 answers
1.9K+ views

Hi,

I've followed the instructions for creating a custom visual Item, but I need some direction on how to make that example more useful and attractive.

What I need is the item image shown (a thumbnail image, it's an image gallery listview), and under that I need two buttons with transparent png images, side by side.  32x32 icons (and the listview item itself is big, like 180x180.) Under the icons I need the Text of the bound item with 18pt font.

I've tried adding panels with the buttons, adding a lable element with custom font size... it's not really coming along very nicely and I feel like I'm just stumbling along and one day might get it all looking good haha

I added event handlers for the buttons inside my custom item class, is that the righ way to do it?

delBtnElem.Click += delBtnElem_Click;

But now the top-level click event on the item is not firing. Is my panel overlaying it all? I set an huge top margin to try to align the buttons under the Icon View image.

 

So maybe you can help me figure out the best way to lay it out?

 

Thank You!

-David

 

 

Here is the code in my Custom Item class (GalleryItemView):  

public class GalleryItemView : IconListViewVisualItem
    { ...

 

 

protected override void CreateChildElements() { base.CreateChildElements(); stack.Orientation = Orientation.Vertical; btnPanel.Margin = new Padding(0, 80, 0, 0); printBtnElem.Image = Image.FromFile(@"..\..\Resources\print-icon.png"); printBtnElem.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; printBtnElem.Click += printBtnElem_Click; delBtnElem.Image = Image.FromFile(@"..\..\Resources\delete-icon.png"); delBtnElem.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; delBtnElem.Click += delBtnElem_Click; titleElem.Margin = new Padding(8); titleElem.CustomFontSize = 18F; btnPanel.Children.Add(printBtnElem); btnPanel.Children.Add(delBtnElem); stack.Children.Add(btnPanel); stack.Children.Add(titleElem); this.Children.Add(stack); }


 

 

 

Here is some code form my Form:



 private void radListViewGallery_VisualItemCreating(object sender, ListViewVisualItemCreatingEventArgs e)
        {
            if (this.radListViewGallery.ViewType == ListViewType.IconsView)
            {
                e.VisualItem = new GalleryItemView();
            }
        }

void radListViewGallery_VisualItemFormatting(object sender, Telerik.WinControls.UI.ListViewVisualItemEventArgs e)
        {
            e.VisualItem.DrawText = false;
            e.VisualItem.ImageLayout = ImageLayout.Zoom;
            e.VisualItem.ImageAlignment = ContentAlignment.MiddleCenter;
        }

        void radListViewGallery_ItemDataBound(object sender, Telerik.WinControls.UI.ListViewItemEventArgs e)
        {
            var databoundItem = e.Item.DataBoundItem as MyImageObject;
            e.Item.Image = databoundItem.Image;
            e.Item.Text = databoundItem.FilePath;
        }

 

more details about the ListView

 class MyImageObject
        {
            public Image Image { get; set; }
            public string FilePath { get; set; }
            public MyImageObject(Image img, string filePath)
            {
                this.Image = img;
                this.FilePath = filePath;
            }
        }

 private void RefreshFileList(string _filePath, FileFilterType _filterType)
        {
            List<String> fileList = new List<String>();
            if (_filterType == FileFilterType.All)
            {
                var extensionFilter = new String[] { "*.png", "*.bmp", "*.jpg", "*.mp4" };
                foreach (String extension in extensionFilter)
                {
                    String[] files = Directory.GetFiles(_filePath, extension, SearchOption.TopDirectoryOnly);
                    foreach (String file in files)
                        fileList.Add(file);
                }
            }

            if (_filterType == FileFilterType.Video) fileList = Directory.GetFiles(_filePath, "*.mp4", SearchOption.TopDirectoryOnly).ToList();

            if (_filterType == FileFilterType.Images)
            {
                var extensionFilter = new String[] { "*.png", "*.bmp", "*.jpg" };
                foreach (String extension in extensionFilter)
                {
                    String[] files = Directory.GetFiles(_filePath, extension, SearchOption.TopDirectoryOnly);
                    foreach (String file in files)
                        fileList.Add(file);
                }
            }

            imageList.Clear();
            foreach (var mediaFileName in fileList.OrderByDescending(f => f))
            {
                var fileNameLowCase = mediaFileName.ToLower();
                if (fileNameLowCase.Contains(".png") || fileNameLowCase.Contains(".bmp") || fileNameLowCase.Contains(".jpg"))
                {
                    var tempImage = Image.FromFile(fileNameLowCase);
                    Bitmap pic = new Bitmap(96, 64);
                    using (Graphics g = Graphics.FromImage(pic))
                    {
                        g.DrawImage(tempImage, new Rectangle(0, 0, pic.Width, pic.Height));
                    }
                    imageList.Add(new MyImageObject(pic, fileNameLowCase));
                    tempImage.Dispose();
                }
                if (fileNameLowCase.Contains(".mp4"))
                {
                    var thumb = getThumbnail(fileNameLowCase);
                    if (thumb == null)
                    {
                        Bitmap pic = new Bitmap(96, 64);
                        using (Graphics g = Graphics.FromImage(pic))
                        {
                            g.DrawImage(ICUSBCamera.Properties.Resources.play_button, new Rectangle(0, 0, pic.Width, pic.Height));
                        }
                        imageList.Add(new MyImageObject(pic, fileNameLowCase));
                    } else imageList.Add(new MyImageObject(thumb, fileNameLowCase));


                }
            }
            radListViewGallery.DataSource = imageList;
        }


 

 

 

David
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 20 May 2022
1 answer
165 views

I have tried to do this in a few places... but perhaps this is not supported

I'd like to be able to apply HTML formatting to the LegendItem Title so that when the  (Datapoint.LegendTitle) in the LabelFormatting routine causes the title to have html applied.

    Private Sub LegendElement_VisualItemCreating(sender As Object, e As LegendItemElementCreatingEventArgs)
        e.ItemElement = New CustomLegendItemElement(e.LegendItem)
        e.LegendItem.Title = "<html><span><font=Arial><Color=White><size=18>" & e.LegendItem.Title & "</span></html>"
        e.ItemElement.Font = FontSegio14
    End Sub
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 May 2022
1 answer
136 views

Hello.

I build a Combo from a table

                DataTable dt = lb.clsDB_user_store_gen.get_dt_for_all_user_store();
                cboReporter.DataSource = dt;
                cboReporter.ValueMember = "uid";
                cboReporter.DisplayMember = "displayName";

I put the form in ADD MODE, and wand to say in the first record "Select a Reporter" 

It works the first time. When I update the record and clear the form, I call the code below. this then add the text again. (sorry wanted to add small video, but mp4 not supported)

                // cboReporter
                cboReporter.SelectedText = "";
                cboReporter.SelectedText = "Select a Reporter";
                // cboAssignee
                cboAssignee.SelectedText = "";
                cboAssignee.SelectedText = "Select a Assignee";

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 May 2022
1 answer
186 views

Hello, do you have any quick simple examples of adding a RadDropDownButtonElement to a Listview? I have implemented some of the other controls like a RadDropDownListElement and RadCheckBoxElement but those seem to have synchronize events and this does not? Do you have any examples of this control? 

 

Thank you!

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 May 2022
1 answer
129 views

HI

I want to show blank row at top of multicolumncombobox. My code is in vb.net

   Dim dr = dbManager.GetDataReader("SP_NewLotNo_Select", CommandType.StoredProcedure, parameters.ToArray(), connection)
        Dim dt As DataTable = New DataTable()

        dt.Load(dr)

        Try
            'Insert the Default Item to DataTable.
            Dim row As DataRow = dt.NewRow()
            row(0) = 0
            row(1) = "---Select---"
            dt.Rows.InsertAt(row, 0)

            'Assign DataTable as DataSource.
            cmbLotNo.DataSource = dt
            cmbLotNo.DisplayMember = "LotNumber"
            cmbLotNo.ValueMember = "NewLotId"

            cmbLotNo.Refresh()

            cmbLotNo.SelectedIndex = -1

            cmbLotNo.AutoCompleteMode = AutoCompleteMode.SuggestAppend
            cmbLotNo.AutoSizeDropDownToBestFit = False
            cmbLotNo.BestFitColumns(True, False)
            cmbLotNo.Columns(0).IsVisible = False
            cmbLotNo.Columns(3).TextAlignment = ContentAlignment.MiddleRight
            Me.cmbLotNo.AutoSizeDropDownToBestFit = True

            Me.cmbLotNo.AutoFilter = True
            Me.cmbLotNo.DisplayMember = "LotNumber"
            Dim filter As New FilterDescriptor()
            filter.PropertyName = Me.cmbLotNo.DisplayMember
            filter.Operator = FilterOperator.Contains
            Me.cmbLotNo.EditorControl.MasterTemplate.FilterDescriptors.Add(filter)
        Catch ex As Exception
            MessageBox.Show("Error:- " & ex.Message)
        Finally
            dr.Close()
            dbManager.CloseConnection(connection)
        End Try

its working but not perfectly as i want attaching image for output.

 

Thanks

 

Nandan

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 May 2022
2 answers
383 views

I'd like to start off by saying that your code editor performs better than any of your major competitors with very large files which is great for my purpose. Really very impressed with how well it works!

That said I have a couple of issues that are really affecting my user experience with using it.

The first is there does not appear to be a word wrap option. Not sure if I am blind, but if so could you please point out how to use it?

The second is the number of lines scrolled when using the mouse wheel is far too many. Is there an option to configure this? Typically in most editors 3 is a good default. Unfortunately with this the number is 15+.

One more to top it off is the Line number margin. How do I increase the size? The number is getting cut off noticeably with anything 20,000 and above. I attached a screenshot to show what I mean for that. I might be blind again but I cannot see how to configure this in the documentation.

Hristo
Telerik team
 answered on 20 May 2022
1 answer
635 views

Morning,

I have a project in VS2022 targeting .NET 6.0 and using the UI.for.WinForms.AllControls.Net60 NuGet package. On installation of the package all controls appear in the Toolbox as expected. Upon restarting Visual Studio, all of the controls have disappeared. Attempting to re-add them manually from Choose Toolbox Items and browsing to the package DLLs results in errors as below for each DLL.

Do you have any suggestions as to why the controls won't persist in VS?

We've tried uninstalling and re-installing VS so as to start with a fresh install but the same issue occurs.

Many thanks,

John.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 May 2022
2 answers
359 views

Dear all,

probably a very simple question

I am using a SplitContainer with four vertical panels. The default behavior is that the handles (little arrows) are always visible even when the panel is "minimized" with only one center little arrow shown as handle.. (see attached image).

If I use panel.collapsed = true, the panel is masked but the handle is not shown anymore and the user cannot act on it .

How can I do to programmatically mimic the standard interactive behavior and manipulate the three arrows ?

Many thanks

Patrick

Patgat
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 20 May 2022
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)
Form
Chart (obsolete as of Q1 2013)
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
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
NavigationView
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?