Telerik Forums
UI for WinForms Forum
2 answers
123 views
Hi Telerik Team,

We are using the Conditional formatting dialog of RadGridView.
Our application is in German, I have localized the dialog. In the dialog, there are three strings, which can not be localizes with the LocalizationProvider. I marked them in the attached image. Is it possible, to change these strings? The most important one is the text "Sort columns alphabetically".

Thank you for help,
Li
Li
Top achievements
Rank 1
 answered on 11 Jan 2013
2 answers
243 views
i have a raddock with 2 areas, the top is a doc manager and the bottom is a tool window.
i have the tool window buttons set to only autohide.  when the user auto hides though, i want it to stay open to a certain size.  (say 300 px tall) instead of collapsing.  this would let them still see and edit stuff on the tool window.  when they open and pin it, it should be bigger (say 700 px etc).  so it's not really collapsing, just being made smaller.  is there a way to do this with the tool window or something similar?

thanks!
John
Top achievements
Rank 1
 answered on 10 Jan 2013
3 answers
687 views
Hello Team,
I have a requirement in the gridview, in such a way that it should allow me to add additional menu items to the exiting context menu of column header, my gridview contains  columns like Depth, Densities with corresponding Unit of measurements meters (m) and Specific gravity (sg), i should allow user to convert the Unit of measurement of Depth column to feet from meters,
For this i want to add some menu items to the existing context menu of column header, and then multiply entire column with scaling factor 3.8 so that it converts from meters to feet.

Can you help me out how to add context menu items to the existing ???
Plamen
Telerik team
 answered on 10 Jan 2013
1 answer
264 views
Hello Team,
i have a grid with 6 different columns each should be saved in different database tables. my grid is having more than 30,000 records
is there any way to take gridview column data into temperory table and from there to insert into database tables
and  row level data saving is fine since it is single line update into database, where as  updating entire grid with 30,000 records, taking time to save

please suggest me
Plamen
Telerik team
 answered on 10 Jan 2013
7 answers
256 views
Hi,

I have a hierarchical grid with custom multi select behavior.
I recently upgraded to Q3 2012. Now I get an exception when I try to select multiple rows that have childrows with the mouse.
This is the exception:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
   at Telerik.WinControls.UI.GridRowBehavior.DoMultiFullRowSelect(Boolean shift, Boolean control)
   at Telerik.WinControls.UI.GridRowBehavior.DoMouseSelection(GridCellElement currentCell, Point currentLocation)
   at Telerik.WinControls.UI.GridRowBehavior.ProcessMouseSelection(Point mousePosition, GridCellElement currentCell)
   at Telerik.WinControls.UI.GridRowBehavior.OnMouseMove(MouseEventArgs e)
   at Telerik.WinControls.UI.BaseGridBehavior.OnMouseMove(MouseEventArgs e)
   at Telerik.WinControls.UI.RadGridView.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
----------------------------------------

I made a test application that reproduces the problem.
The application contains 2 files:
  • Form1.cs
  • CustomRowInfos.cs

Form1.cs:

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Telerik.WinControls.UI;
 
namespace GridWithIndexedHierarchySpike
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            dummyGridView.Dock = DockStyle.Fill;
            dummyGridView.Parent = this;
            dummyGridView.BringToFront();
            dummyGridView.MultiSelect = true;
            dummyGridView.UseScrollbarsInHierarchy = true;
        }
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
 
            GridViewTemplate childTemplate = CreateChildTemplate();
            dummyGridView.Templates.Add(childTemplate);
            childTemplate.HierarchyDataProvider = new GridViewEventDataProvider(childTemplate);
 
            //grid events
            dummyGridView.RowSourceNeeded += gridView_RowSourceNeeded;
            dummyGridView.CreateRowInfo += CreateGridViewHierarchyRowInfoWithCustomSelectBehavior;
            dummyGridView.Templates[0].CreateRowInfo += CreateGridViewDataRowInfoWhitCustomSelectBehavior;
 
            //databind
            dummyGridView.DataSource = CreateDummyData(5);
        }
  
        void gridView_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
        {
            List<SomeData> data = CreateDummyData(2);
            foreach (SomeData someData in data)
            {
                GridViewRowInfo row = e.Template.Rows.NewRow();
                row.Cells[0].Value = someData.Name;
                row.Cells[1].Value = someData.SomeDataId;
                row.Cells[2].Value = someData.ParentDataId;
  
                e.SourceCollection.Add(row);
            }
        }
 
        private static void CreateGridViewHierarchyRowInfoWithCustomSelectBehavior(object sender, GridViewCreateRowInfoEventArgs e)
        {
            if (e.RowInfo is GridViewHierarchyRowInfo)
            {
                e.RowInfo = new MultiSelectGridViewHierarchyRowInfo(e.ViewInfo);
            }
        }
 
        private static void CreateGridViewDataRowInfoWhitCustomSelectBehavior(object sender, GridViewCreateRowInfoEventArgs e)
        {
            if (e.RowInfo is GridViewDataRowInfo)
            {
                e.RowInfo = new MultiSelectGridViewDataRowInfo(e.ViewInfo);
            }
        }
 
        private GridViewTemplate CreateChildTemplate()
        {
            var template = new GridViewTemplate {AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill};
            var namecolumn = new GridViewTextBoxColumn("Name");
            var idColumn = new GridViewTextBoxColumn("ID");
            var parentColumn = new GridViewTextBoxColumn("Parent");
            template.Columns.AddRange(namecolumn, idColumn, parentColumn);
            return template;
        }
  
        private static List<SomeData> CreateDummyData(int nbrRows)
        {
            var data = new List<SomeData>();
            var someData = new SomeData { Name = Guid.NewGuid().ToString(), ParentDataId = null, SomeDataId = 0 };
  
            data.Add(someData);
            for (int i = 1; i <= nbrRows - 1; i++)
            {
                var someChildData = new SomeData()
                {
                    Name = Guid.NewGuid().ToString(),
                    ParentDataId = someData.SomeDataId,
                    SomeDataId = i
                };
                data.Add(someChildData);
            }
  
            return data;
        }
 
        public class SomeData
        {
            public int SomeDataId { get; set; }
            public int? ParentDataId { get; set; }
            public string Name { get; set; }
        }
    }
}

CustomRowInfos.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.WinControls.UI;
 
namespace GridWithIndexedHierarchySpike
{
    /// <summary>
    /// Hierarchy row with custom select behavior.
    /// When the row is (de)selected, all child rows are (de)selected
    /// </summary>
    public class MultiSelectGridViewHierarchyRowInfo : GridViewHierarchyRowInfo
    {
        public static bool ParentSilentUpdate;
        public static bool OverrideChildSelection;
 
        public MultiSelectGridViewHierarchyRowInfo(GridViewInfo owner)
            : base(owner)
        {
            ParentSilentUpdate = false;
        }
 
        protected override bool SetBooleanProperty(string propertyName, int propertyKey, bool value)
        {
            bool result = base.SetBooleanProperty(propertyName, propertyKey, value);
 
            if (result && propertyName == "IsSelected")
            {
                if (!MultiSelectGridViewDataRowInfo.ChildSilentUpdate)
                {
                    //parent row is selected/deselected;
                    SelectChildRows(value);
                }
            }
 
            return result;
        }
 
 
        private void SelectChildRows(bool isSelected)
        {
            if (OverrideChildSelection) return;
 
            ParentSilentUpdate = true;
            foreach (MultiSelectGridViewDataRowInfo row in this.ChildRows)
            {
                row.IsSelected = isSelected;
            }
            ParentSilentUpdate = false;
        }
    }
 
    /// <summary>
    /// Data row with custom select behavior.
    /// If the row is a child row of a parent row then
    /// the parent row is selected when the child rows (or one of its siblings) is selected,
    /// otherwise the parent row is deselected.
    /// </summary>
    public class MultiSelectGridViewDataRowInfo : GridViewDataRowInfo
    {
        public static bool ChildSilentUpdate;
        public MultiSelectGridViewDataRowInfo(GridViewInfo viewInfo)
            : base(viewInfo)
        {
            ChildSilentUpdate = false;
        }
 
        public object OriginalBoundItem { get; set; }
 
        protected override bool SetBooleanProperty(string propertyName, int propertyKey, bool value)
        {
           
            bool result = base.SetBooleanProperty(propertyName, propertyKey, value);
 
            if (result && propertyName == "IsSelected")
            {
                if (!MultiSelectGridViewHierarchyRowInfo.ParentSilentUpdate)
                {
                    //child row is selected
                    SelectParentRow(value);
                }
            }
 
            return result;        
        }
 
        private void SelectParentRow(bool isSelected)
        {
            var parent = Parent as MultiSelectGridViewHierarchyRowInfo;
            if (parent == null) return;
 
            ChildSilentUpdate = true;
            if (isSelected)
            {
                parent.IsSelected = true;
            }
            else
            {
                //check if there are other rows
                bool selected = GetParentRowSelection(parent);
                parent.IsSelected = selected;
            }
            ChildSilentUpdate = false;
        }
 
        private bool GetParentRowSelection(MultiSelectGridViewHierarchyRowInfo parent)
        {
            //if there is one selected child row, return true
            return parent.ChildRows.Cast<MultiSelectGridViewDataRowInfo>().Any(row => row != this && row.IsSelected);
        }
    }
}

Jack
Telerik team
 answered on 10 Jan 2013
3 answers
191 views
Hi all,
Ive read on the forums that if I dont want the first row in my gridview to be selected whenever I bind to a datasource, i could set the "CurrentRow" to nothing.

I use version: 2012.3.1211.20

When I try this however, I get an "Index was out of range. Must be non-negative and less than the size of the collection"

I have binded my grid to a list of my custom object.
Then ive tried the following:

gridview1.CurrentRow = nothing
and
gridview1.ClearSelection()

Both commands result in the "Index out of range"

Anybody else experienced the same problem?

Thanks.




Plamen
Telerik team
 answered on 10 Jan 2013
1 answer
125 views
I have a combobox which is bound to a list of DictionaryEntries. And I would like that when the form is shown no item is selected (SelectedItem = null).

Test program
public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
      Bind(GetList());
      Print("Before show");
    }
 
    public void Bind(
      List<DictionaryEntry> p_List)
    {
      radDropDownList1.ValueMember = "Key";
      radDropDownList1.DisplayMember = "Value";
      radDropDownList1.DataSource = p_List;
      radDropDownList1.SelectedIndex = -1;
      radDropDownList1.SelectedItem = null;
      radDropDownList1.SelectedValue = null;
    }
 
    private List<DictionaryEntry> GetList()
    {
      return new List<DictionaryEntry>
               {
                 new DictionaryEntry(0, "Entry 0"),
                 new DictionaryEntry(1, "Entry 1")
               };
    }
 
    private void button1_Click(object sender, EventArgs e)
    {
      Bind(GetList());
      Print("rebind");
    }
 
    private void Print(string p_Message)
    {
      richTextBox1.AppendText(String.Format("{2}\nSelectedIndex = {0}\nSelectedValue = {1}\n\n",
                                        radDropDownList1.SelectedIndex, radDropDownList1.SelectedValue, p_Message));
    }
     
    private void Form1_Shown(object sender, EventArgs e)
    {
      Print("OnShow");
    }
 
    private void button2_Click(object sender, EventArgs e)
    {
      Print("Print state");
    }
  }

The problem is that when the form is shown DropDownList automatically selects first element in the list (SelectedIndex, SelectedItem,.. are updated but Text is not).
If I rebind after the form is shown DropDownList works correctly.

Can I bind a list in a way that Form.Show will not select the first element in the list (SelectedItem = null)?
Peter
Telerik team
 answered on 10 Jan 2013
4 answers
192 views
Would it be possible to get a code sample in C# of adding an exception with visible set to false to a recurring appointment?  I can't seem to get it to work in my project and I can't find any clear cut examples anywhere.

Thanks,
Matt
Ivan Todorov
Telerik team
 answered on 10 Jan 2013
1 answer
718 views
I have a custom theme (.tssp file) that is an exact copy of the built-in Windows7 theme.  I have a RadForm with a StatusStrip.  The StatusStrip contains a ToolStripStatusLabel.  I need to change the default BackColor of the ToolStripStatusLabel in VisualStyleBuilder but I cannot figure out how to do it.

Please help!

Thanks
Anton
Telerik team
 answered on 10 Jan 2013
1 answer
134 views
I am using IncrementParagraphLeftIndent() to increase the left margin. When I export using the html provider I can see the margin has been set in the Style for that run.

<style type="text/css">
.p_6F87C71A { margin: 0px 0px 0px 28px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px; } 
.s_6BF1D20F { font-family: 'Calibri';font-style: normal;font-size: 16px;color: #000000; } 
</style><p class="p_6F87C71A"><span class="s_6BF1D20F">This text should be indented</span></p>

However, when I import using the html provider the margin setting is lost. When I export again I can see the margin is set to 0.

<style type="text/css">
.p_384D933F { margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px; } 
.s_6BF1D20F { font-family: 'Calibri';font-style: normal;font-size: 16px;color: #000000; } 
</style><p class="p_384D933F"><span class="s_6BF1D20F">This text should be indented</span></p>

Here's the code I'm using for Import/Export:


        private static HtmlFormatProvider _htmlFormatProvider;
 
        private static void InitHtmlFormatProvider()
        {
            _htmlFormatProvider = new HtmlFormatProvider();
            var htmlExportSettings = new HtmlExportSettings();
            htmlExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;
            _htmlFormatProvider.ExportSettings = htmlExportSettings;
        }
 
        private void commandBarButtonLoad_Click(object sender, EventArgs e)
        {
            string text = File.ReadAllText(@"c:\temp\RichText.txt");
            RadDocument document = _htmlFormatProvider.Import(text);
            radRichTextBox1.Document = document;
        }
 
 
        private void commandBarButtonSave_Click(object sender, EventArgs e)
        {
            string html = _htmlFormatProvider.Export(radRichTextBox1.Document);
            File.WriteAllText(@"c:\temp\RichText.txt", html);            
        }
     

Plamen
Telerik team
 answered on 10 Jan 2013
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
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?