Telerik Forums
UI for WinForms Forum
3 answers
131 views

Hello,

I created a CustomSummaryItem and it work correctly when I add it to summary row with code, but if I save GridView layout and load it the custom summary wont function 

 

this is my CustomSummaryItem: 

public class CustomSummaryItem : GridViewSummaryItem
    {
        public CustomSummaryItem(string name,string sourceColumn)
            : base(name, "{0}",GridAggregateFunction.Sum)
        {
            SourceColumn = sourceColumn;
        }
        public string SourceColumn { get; set; }
        public override object Evaluate(IHierarchicalRow row)
        {
           
            var sum = row.ChildRows.Sum(childRow => (childRow.Cells[this.SourceColumn]?.Value).ToDouble());
            var time = TimeSpan.FromMilliseconds(sum).ToString();
            return time;
        }
    }

 

mehdi
Top achievements
Rank 1
 answered on 02 Dec 2017
1 answer
67 views

I would like the ability to either shrink the to fit the number of rows it has (thereby showing the background color below it) or to control the color of the dead space separately from the background color or alternating row color.

Could I change the background color of the  itself and then set each row's  individually perhaps to achieve this?

 

Dimitar
Telerik team
 answered on 01 Dec 2017
1 answer
506 views

I just can't seem to get my PDF to load. I amcreating a RadFixedDocument.

If I export it to a file, and load it to the viewer, it works just fine:

using (var stream = File.OpenWrite(resultFile))
 {
    PdfFormatProvider provider = new PdfFormatProvider();
    provider.Export(pdf, stream);
 }
 pdfXactReport.LoadDocument(resultFile);

 

Seems like this should work, what am I missing??

using (var saveToMS = new MemoryStream())
{
    PdfFormatProvider provider = new PdfFormatProvider();
    provider.Export(pdf, saveToMS);
    pdfXactReport.LoadDocument(saveToMS);
}
Dimitar
Telerik team
 answered on 01 Dec 2017
2 answers
928 views

Hello,

After having Designer issues (i hacked the designer)  i removed my UserControl who was the problem; i created a new one wich is the exact (mostly) same UserControl.  But when i  want to create a new RadGridView i'm getting this error:

Unable to create component 'RadGridView'. 

'System.Runtime.InteropServices.COMException (0x8004D45); A reference of 'Telerik.WinControls.GridView already existe in the project.

at VSLangProj.References.Add(String bstrPath)

at Microsoft.VisualStudio.Design.VSTypeResolutionService.PerformReferenceUpdate(List'1 newReferences)

at Microsoft.VisualStudio.Design.VSTypeResolutionService.SystemComponentModel.Design.ITypeResolutionService.ReferenceAssembly

 

 

I am using Visual Studio 2013. All my references are present. I tried to create a new Project Telerik ; i'm able to use a RadgridView in the new one.

 

Analyze
Top achievements
Rank 1
 answered on 01 Dec 2017
0 answers
88 views
<p>private BindingSource _bindingSource;<br>
        DataTable gridViewDataTable = new DataTable();<br>
<br>
        public SocPersonal()<br>
        {<br>
                      InitializeComponent();<br>            BaseGridBehavior gridBehavior = this.radGridView2.GridBehavior as BaseGridBehavior;<br>            gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));<br>            gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomRowGridBehavior());<br><br>            RadDragDropService dragDropService = radGridView2.GridViewElement.GetService<RadDragDropService>();<br>            dragDropService.PreviewDragStart += svc_PreviewDragStart;<br>            dragDropService.PreviewDragOver += svc_PreviewDragOver;<br>            dragDropService.PreviewDragDrop += svc_PreviewDragDrop;<br>            gridViewDataTable.Columns.Add("key_socRabotnik", typeof(string));<br>            gridViewDataTable.Columns.Add("[ФИО]", typeof(string));<br><br>            radListView1.ListViewElement.DragDropService.PreviewDragOver += PreviewDragOver;<br>            radListView1.ListViewElement.DragDropService.PreviewDragDrop += PreviewDragDrop;<br><br>            MyRussionRadGridLocalizationProvider.CurrentProvider = new MyRussionRadGridLocalizationProvider();<br>            radGridView1.TableElement.Text = MyRussionRadGridLocalizationProvider.TableElementText;<br>            CheckForIllegalCrossThreadCalls = false;    <br>
            HandleCreated += Form_HandleCreated;<br>
        }<br>
<br>
        #region Drop<br>
        private void svc_PreviewDragStart(object sender, PreviewDragStartEventArgs e)<br>
        {<br>
            e.CanStart = true;<br>
        }<br>
<br>
        private void svc_PreviewDragOver(object sender, RadDragOverEventArgs e)<br>
        {<br>
            if (e.DragInstance is GridDataRowElement)<br>
            {<br>
                e.CanDrop = e.HitTarget is DetailListViewDataCellElement ||<br>
                            e.HitTarget is DetailListViewElement;<br>
            }<br>
        }<br>
<br>
        private void svc_PreviewDragDrop(object sender, RadDropEventArgs e)<br>
        {<br>
            DetailListViewDataCellElement targetCell = e.HitTarget as DetailListViewDataCellElement;<br>
            DetailListViewElement targetElement = e.HitTarget as DetailListViewElement;<br>
            GridDataRowElement draggedRow = e.DragInstance as GridDataRowElement;<br>
<br>
            if (draggedRow == null)<br>
            {<br>
                return;<br>
            }<br>
            ListViewDataItem item = new ListViewDataItem();<br>
            DataRow draggedDataBoundItem = ((DataRowView)draggedRow.RowInfo.DataBoundItem).Row;<br>
            if (targetElement != null)<br>
            {<br>
                ((RadListViewElement)targetElement.Parent).Items.Add(item);<br>
            }<br>
            if (targetCell != null)<br>
            {<br>
                BaseListViewVisualItem targetVisualItem = targetCell.RowElement;<br>
<br>
                int insertIndex = targetCell.Row.ListView.Items.IndexOf(targetVisualItem.Data);<br>
                if (insertIndex > -1)<br>
                {<br>
                    targetCell.Row.ListView.Items.Insert(insertIndex, item);<br>
                }<br>
            }<br>
            item["key_socRabotnik"] = draggedDataBoundItem["key_socRabotnik"];<br>
            item["[ФИО]"] = draggedDataBoundItem["[ФИО]"];<br>
<br>
            gridViewDataTable.Rows.Remove(draggedDataBoundItem);<br>
        }<br>
<br>
        private void PreviewDragOver(object sender, RadDragOverEventArgs e)<br>
        {<br>
            e.CanDrop = e.HitTarget is GridTableElement ||<br>
                e.HitTarget is GridDataRowElement;<br>
        }<br>
<br>
        private void PreviewDragDrop(object sender, RadDropEventArgs e)<br>
        {<br>
            BaseListViewVisualItem draggedItem = e.DragInstance as BaseListViewVisualItem;<br>
            GridDataRowElement rowElement = e.HitTarget as GridDataRowElement;<br>
            GridTableElement tableElement = e.HitTarget as GridTableElement;<br>
<br>
            if (rowElement == null && tableElement == null)<br>
            {<br>
                return;<br>
            }<br>
            e.Handled = true;<br>
            DataRow newRow = gridViewDataTable.NewRow();<br>
            newRow["key_socRabotnik"] = draggedItem.Data["key_socRabotnik"];<br>
            newRow["[ФИО]"] = draggedItem.Data["[ФИО]"];<br>
            if (tableElement != null)<br>
            {<br>
                gridViewDataTable.Rows.Add(newRow);<br>
            }<br>
            <br>
            if (rowElement != null)<br>
            {<br>
                GridViewRowInfo targetRow = rowElement.RowInfo;<br>
<br>
                int insertIndex = this.radGridView2.Rows.IndexOf(targetRow);<br>
                if (insertIndex > -1)<br>
                {<br>
                    gridViewDataTable.Rows.InsertAt(newRow, insertIndex);<br>
                }<br>
            }<br>
            <br>
<br>
            this.radListView1.Items.Remove(draggedItem.Data);<br>
        }</p> <p><br></p> <p>private void fillTheDataGrid()<br>
        {<br>
            var commandServer = new CommandServer();<br>
            try<br>
            {<br>
                radGridView2.Invoke(new MethodInvoker(delegate ()<br>
                {<br>
                    _bindingSource = new BindingSource { DataSource = commandServer.GetDataGridSet(@"select key_socRabotnik, fio as [ФИО]<br>
                        from socRabotnik<br>
                        where statusDel = 0<br>
                        order by fio").Tables[0] };<br>
                    radGridView2.DataSource = _bindingSource;<br>
<br>
                    if (radGridView2.Columns.Count > 0)<br>
                    {<br>
                        radGridView2.Columns[0].IsVisible = false;<br>
                        radGridView2.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;<br>
                    }<br>
                    <br>
                    _bindingSource = new BindingSource { DataSource = commandServer.GetDataGridSet(@"select key_socRabotnik, fio as [ФИО]<br>
                        from socRabotnik left join spec_soc on key_socRabotnik = fk_socRabotnik<br>
                        where fk_socRabotnik is null").Tables[0] };<br>
                    radListView1.DataSource = _bindingSource;<br>
                    radListView1.DisplayMember = "[ФИО]";<br>
                    radListView1.ValueMember = "[ФИО]";<br>
                    radListView1.Columns[0].Visible = false;<br>
                }));<br>
            }<br>
            catch (Exception ex)<br>
            {<br>
                CommandClient commandClient = new CommandClient();<br>
                commandClient.WriteFileError(ex, null);<br>
            }<br>
        }</p>


ListView to GridView: It is dragged, deleted, but not in the grid.
GridView to ListView: error image
Вадим
Top achievements
Rank 1
Iron
Iron
 asked on 30 Nov 2017
1 answer
149 views
Dear, I need to load 03 listview simultaneously and these same handle many records in the iconview, what would be the best way to load and streamline this task by saving the path of the image and then assigning it by using the itemdatabound property or saving the image in arraybyte and then assigning it in the customvisualitem creation.

Thank you for your attention.

regards
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Nov 2017
0 answers
85 views

Hi,

I found the was to left-align the name of the column using the following code :

        private void radGrid_ColumnChooserItemElementCreating(object sender, ColumnChooserItemElementCreatingEventArgs e)
        {
            e.ItemElement.TextAlignment = ContentAlignment.MiddleLeft;
        }

 

But I did found how to set the height of the elements in the list of columns (see screenshot attached).

Is there any way to do it ?

 

Thank you.

 

 

Grégory
Top achievements
Rank 1
 asked on 29 Nov 2017
1 answer
661 views

Hi. I am trying to remove rows and I get "formatException".

I've try to remove the rows like that:

grid.GridElement.BeginUpdate();

foreach (GridViewDataRowInfo row in grid.Rows)
{
      if (row.Cells[1].Value.ToString() == "False")
      {
            grid.Rows.Remove(row);
      }
}

grid.GridElement.EndUpdate();

AND like that:

grid.GridElement.BeginUpdate();

IEnumerable<GridViewDataRowInfo> uncheckedRows = grid.Rows.Where<GridViewDataRowInfo>(row => row.Cells[1].Value.ToString() == "False");

foreach (GridViewDataRowInfo uncheckedRow in uncheckedRows)
       grid.Rows.Remove(uncheckedRow);

grid.GridElement.EndUpdate();

BOTH WAYS DON'T  WORK... 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 28 Nov 2017
5 answers
356 views

Hi,

 

Any reason for the ListElement of RadDropDownList showing the ToolTip when we have the RadDropDownList.ShowItemToolTips = False?

 

Another thing how we can access to the RadDropDownList control from the ListElement control? Imagine we catch the MouseHover event from ListElement and want to access to the parent control (the RadDropDownList control)?

 

Thank You

Dimitar
Telerik team
 answered on 28 Nov 2017
2 answers
199 views

Hello Telerik Team,

I'm using DateTimePicker as follow,

radDateTimePicker1.DateTimePickerElement.ShowTimePicker = true;
radDateTimePicker1.Format = DateTimePickerFormat.Custom;
radDateTimePicker1.DateTimePickerElement.CalendarSize = new Size(330, 250);
radDateTimePicker1.ReadOnly = true;

 

Time value in EditBox cannot edit. ReadOnly property working ok.

But Time value can be changed from dropdown's picker.

How can I fix this issue.

Zan
Top achievements
Rank 1
 answered on 28 Nov 2017
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
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Styling
Barcode
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
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
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?