Telerik Forums
UI for WinForms Forum
1 answer
132 views
I followed demo on: http://www.telerik.com/help/winforms/scheduler-appointments-and-dialogs-adding-a-custom-field-to-the-editappointment-dialog.html

Attached is the code behind. Somehow, when I ran the email filed not populated/show up.

Kindly advise what I did wrong.

Thank you very much.

 

 

 

 

 

 

Dave Mortgatta
Top achievements
Rank 1
 answered on 26 Apr 2012
3 answers
485 views

Hi there,

I am currently developing an MDI application exploiting your Raddock Control.

As I am using forms as tabbed windows, I would like my application not to create a new tab (a second one), if the form is already open.

Currently I am using the following workaround and nonetheless I don’t like very much this way J


private void AddTabbedForm(BaseForm form)
{
    if (this.radDock1.DockWindows.DocumentWindows.Where(w => w.Text == form.Text).Count() > 0)
    {
        this.radDock1.ActivateWindow(this.radDock1.DockWindows.DocumentWindows.Where(w => w.Text == form.Text).First());
        return;
    }
      form.MdiParent = this;
    form.Show();
}
 


Any hint to have it implemented in a more elegant way?


Thank you very much
Davide
Richard Slade
Top achievements
Rank 2
 answered on 26 Apr 2012
1 answer
180 views

A few threads have been posted over the years to ask about natural sorting, which is clicking a column header to go Ascending, Descending, then back to the default unsorted mode on the third click. I looked around for a tri-state or three-state toggle and didn't find any info.  Very helpful but incomplete info is found here and here, so I thought I'd provide C# code to help anyone else looking to do this. Some threads refer to MasterGridViewTemplate.AllowNaturalSort but that property no longer exists. My code is adapted from the second forum posting referenced. It looks like the library has changed since Sean wrote his code.

Telerik.WinControls.Data.SortDescriptor.Direction is of type System.ComponentModel.ListDirection, and that enum only has two values. So the Boolean _sorted is used - if the grid is sorted in ascending or descending order, then use the sort order, but  if we click past descending order, set _sorted to false (natural sort!) and clear the SortDescriptors.

Of course clearing SortDescriptors means this only works with single column sorting. Maybe someone will follow-up here with a solution that works with multiple columns.

HTH

using System.ComponentModel;
bool _sorted = false;
ListSortDirection _previousGridColumnSortDirection;
private void radGridView1_SortChanging(object sender, GridViewCollectionChangingEventArgs e)
{
    try
    {
        Telerik.WinControls.Data.SortDescriptor sortField;
        // Only proceed if we are changing an existing sorting (not starting a new one) 
  
        // Make sure we have an item
        if (e.NewItems != null && e.NewItems.Count > 0)
        {
            sortField = (Telerik.WinControls.Data.SortDescriptor)e.NewItems[0];
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanging)
            {
                // If the current SortOrder is Ascending, and the previous SortOrder
                // was Descending, then clear the sorting.
                if (_sorted)
                {
                    if (sortField.Direction == ListSortDirection.Ascending &&
                        _previousGridColumnSortDirection == ListSortDirection.Descending)
                    {
                        _sorted = false;
                        radGridView1.MasterGridViewTemplate.SortDescriptors.Clear();
                    }
                    //Save the SortOrder for the next iteration
                    _previousGridColumnSortDirection = sortField.Direction;
                }
                else
                {
                    _sorted = true;
                    _previousGridColumnSortDirection = sortField.Direction;
                }
            }
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)
            {
                _sorted = true;
                _previousGridColumnSortDirection = sortField.Direction;
            }
        }
  
    }
    catch
    {
    }
}
Julian Benkov
Telerik team
 answered on 26 Apr 2012
1 answer
89 views

Hello,

I have Winform RadGridView with grouped columns header. I will wrap the long text.

radGridView1.AutoSizeRows = true;
radGridView1.Columns["column1"].WrapText = true;
radGridView1.Columns["column1"].Multiline = true;

Error after view definition, See picture in attach.
Without grouped columns header works well.
Any suggestions?

Regards,
Elek

Svett
Telerik team
 answered on 26 Apr 2012
5 answers
974 views
Please see the picture in attachment.

Can I add "Add Node" button in every node?
Rather than, user choose >> right click >> click New >> key in.

Is possible?
Thank You.
Stefan
Telerik team
 answered on 26 Apr 2012
3 answers
249 views
Hey Guys

I have a problem where i wish to add logic into the CreateChildElements method which, based on the value of a given cell in the row will display different controls.

When CreateChildElements is called, the GridViewColumn and GridRowElement (which have been set in the contructor) are Null, as if they are not in the same context.

This is what i currently have (Please notice the CreateChildElements Method)
#region GridDataCellElement
 public class GridDataCustomCellElement : GridDataCellElement
 {
     #region Locals
     private RadImageButtonElement radButtonElementViewOrder;
     private RadImageButtonElement radButtonElementNewOrder;
     public GridViewColumn thisColumn;
     public GridRowElement thisRow;
     #endregion
 
     #region Constructors
      
     public GridDataCustomCellElement(GridViewColumn col, GridRowElement row) : base(col, row) { thisColumn = col; thisRow = row;}
     #endregion
 
     #region Events
 
     void radButtonElementNewOrder_Click(object sender, EventArgs e)
     {
 
         Main newOrder = new Main(GetFolderPath(thisRow.GridControl.CurrentRow.Cells[2].Value.ToString()) + "\\" + thisRow.GridControl.CurrentRow.Cells[0].Value.ToString());
         newOrder.MyParentForm = (SalesOrderingClient.Home)thisRow.GridControl.FindForm();
         newOrder.IsCopyOrder = true;
         newOrder.ShowDialog();
     }
 
     void radButtonElementViewOrder_Click(object sender, EventArgs e)
     {
         // Build order object
         SalesOrderingObjects.Order objOrder = SalesOrderingObjects.Order.LoadOrder(GetFolderPath(thisRow.GridControl.CurrentRow.Cells[2].Value.ToString()) + "\\" + thisRow.GridControl.CurrentRow.Cells[0].Value.ToString());
 
         // Build session object
         Session s = new Session(objOrder);
 
         // Display Order
         Order o = new Order(s);
         o.ShowDialog();
     }
 
     #endregion
 
     #region Overrides
      
     /// <summary>
     /// Create new controls and add them to cell
     /// </summary>
     protected override void CreateChildElements()
     {
         // Set up controls and add them to this cell
 
         Home h = new Home();
          
 
         radButtonElementViewOrder = new RadImageButtonElement();
         radButtonElementViewOrder.ButtonFillElement.BackColor = Color.Transparent;
         radButtonElementViewOrder.ButtonFillElement.BackColor2 = Color.Transparent;
         radButtonElementViewOrder.ImageAlignment = ContentAlignment.MiddleRight;
         radButtonElementViewOrder.BorderElement.Width = 0;
         radButtonElementViewOrder.Image = h.IconImageLIst.Images[1];
         radButtonElementViewOrder.ToolTipText = "View Order";
          
         this.Children.Add(radButtonElementViewOrder);
 
         radButtonElementNewOrder = new RadImageButtonElement();
         radButtonElementNewOrder.ButtonFillElement.BackColor = Color.Transparent;
         radButtonElementNewOrder.ButtonFillElement.BackColor2 = Color.Transparent;
         radButtonElementNewOrder.ImageAlignment = ContentAlignment.MiddleRight;
         radButtonElementNewOrder.BorderElement.Width = 0;
         radButtonElementNewOrder.Image = h.IconImageLIst.Images[0];
         radButtonElementNewOrder.ToolTipText = "Copy Order";
         this.Children.Add(radButtonElementNewOrder);
 
         radButtonElementNewOrder.Click += new EventHandler(radButtonElementNewOrder_Click);
         radButtonElementViewOrder.Click += new EventHandler(radButtonElementViewOrder_Click);
     }
 
 
 
 
 
     /// <summary>
     /// Set size and position of controls in the cell
     /// </summary>
     /// <param name="finalSize"></param>
     /// <returns></returns>
     protected override SizeF ArrangeOverride(SizeF finalSize)
     {
         // If there are more than 1 controls in this cell
         //if (this.Children.Count == 3)
         //{
             // Setup dimensions and position and modifiy controls
         RectangleF btn1 = new RectangleF(20, 12, 36, 36);
         RectangleF btn2 = new RectangleF(58, 12, 36, 36);
 
          
         this.Children[0].Arrange(btn1);
         this.Children[1].Arrange(btn2);
         //}
 
         return finalSize;
     }
 
     /// <summary>
     /// Set the cells theme, if not done, cell does not inherit theme as it is custom
     /// </summary>
     protected override Type ThemeEffectiveType
     {
         get
         {
             return typeof(GridDataCellElement);
         }
     }
 
     public override bool IsCompatible(GridViewColumn data, object context)
     {
         return data is RadLabelColumn && context is GridDataRowElement;
     }
 
     #endregion
 
     #region Private Methods
 
     /// <summary>
     /// Get folder path based on XML status
     /// </summary>
     /// <param name="status"></param>
     /// <returns></returns>
     string GetFolderPath(string status)
     {
         string folder = string.Empty;
         switch (status)
         {
             case "Saved":
                 folder = Common.SavedOrdersFolder;
                 break;
             case "InProgress":
                 folder = Common.InProgressOrdersFolder;
                 break;
             case "Sent":
                 folder = Common.SentOrdersFolder;
                 break;
             case "Requested":
                 folder = Common.RequestedOrdersFolder;
                 break;
             default:
                 folder = Common.UserDataBaseFolder;
                 break;
         }
         return folder;
     }
 
     #endregion
 
 }
 #endregion

This is what i would like to do:
protected override void CreateChildElements()
{
    // Set up controls and add them to this cell
 
    Home h = new Home();
     
    switch(SOMETHING GOES HERE)
    {
        case ?:
        radButtonElementViewOrder = new RadImageButtonElement();
        radButtonElementViewOrder.ButtonFillElement.BackColor = Color.Transparent;
        radButtonElementViewOrder.ButtonFillElement.BackColor2 = Color.Transparent;
        radButtonElementViewOrder.ImageAlignment = ContentAlignment.MiddleRight;
        radButtonElementViewOrder.BorderElement.Width = 0;
        radButtonElementViewOrder.Image = h.IconImageLIst.Images[1];
        radButtonElementViewOrder.ToolTipText = "View Order";
        this.Children.Add(radButtonElementViewOrder);
 
        radButtonElementNewOrder = new RadImageButtonElement();
        radButtonElementNewOrder.ButtonFillElement.BackColor = Color.Transparent;
        radButtonElementNewOrder.ButtonFillElement.BackColor2 = Color.Transparent;
        radButtonElementNewOrder.ImageAlignment = ContentAlignment.MiddleRight;
        radButtonElementNewOrder.BorderElement.Width = 0;
        radButtonElementNewOrder.Image = h.IconImageLIst.Images[0];
        radButtonElementNewOrder.ToolTipText = "Copy Order";
        this.Children.Add(radButtonElementNewOrder);
 
        radButtonElementNewOrder.Click += new EventHandler(radButtonElementNewOrder_Click);
        radButtonElementViewOrder.Click += new EventHandler(radButtonElementViewOrder_Click);
        break;
        case ?:
            // ADD SOME DIFFERENT CONTROLS
        break;
    }
 
 
}

Please tell me if this is possible, or if there is an alternative way of doing this?

Many Thanks
Tim





Ivan Petrov
Telerik team
 answered on 26 Apr 2012
5 answers
353 views
Hi. I'm working with RadPropertyGrid for WinForms. 
I have some problem with PropertyValueChanged Event
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            radPropertyGrid1.PropertyValueChanged += new PropertyGridItemValueChangedEventHandler(radPropertyGrid1_PropertyValueChanged);
            string A = "";
            int B = 0;
            bool C = false;
            RadPropertyStore store = new RadPropertyStore();
            PropertyStoreItem itemA = new PropertyStoreItem(typeof(string), "A", A);
            PropertyStoreItem itemB = new PropertyStoreItem(typeof(int), "B", B);
            PropertyStoreItem itemC = new PropertyStoreItem(typeof(bool), "C", C);
            store.Add(itemA);
            store.Add(itemB);
            store.Add(itemC);
            radPropertyGrid1.SelectedObject = store;
        }
  
        void radPropertyGrid1_PropertyValueChanged(object sender, 
                                     PropertyGridItemValueChangedEventArgs e)
        {
            try
            {
                throw new NotImplementedException();
            }
            catch(Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
    }
So, how can you see, In my project I need show MessageBox with some Exception. When I changed bool value (itemC) in propertyGrid, MessegeBox is shown once and it's ok, but when I changed string or int value PropertyValueChanged event began twice (second event began in line "MessageBox.Show(exc.Message); ")
Maybe you can explain me what I do wrong. Thanks
Ivan Petrov
Telerik team
 answered on 26 Apr 2012
5 answers
181 views
Hi,

i need to draw two stacked bar series for a single date. my exact requirement is like:

i have dates on X-axis and on Y-axis i have double values.

totally i have 5 serieses:

series1,series2,series3,series4,series5

i need to draw a stacked bar for series1,2,3 and one more stacked bar series for series 4,5 on stacked bar chart.

it looks some thing like below:
 |           ---
 |          |S 3 |                 
 |          ---  ---
 |          | S2 || S5 |
 |          ---  ---
 |          |S1 || S 4|
 |------------------------------------------------------------------------------
              june5              june6

i am not able to paste any image that's why i have given rough sketch.hope u understand the requirement.

is this possible? if so please provide me some sample code.

Help is highly appreciated.

Regards,
kiran



Peshito
Telerik team
 answered on 26 Apr 2012
7 answers
167 views
Hello
When I click on the cell of the GRID I got the following error from MDA

A call to PInvoke function 'Telerik.WinControls.GridView!Telerik.WinControls.UI.RadGridViewAccessibleObject::NotifyWinEvent' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

I am using the latest Q1 2012 SP1, in NET4.0

Any ideas... I am completly blind in this one.

( I have already turn to x86 to compile)

Andrey
Telerik team
 answered on 25 Apr 2012
6 answers
176 views

Hi... im creating a RadListBox at runtime with a win app and it creates with the correct items but... I cant select any of them!!! =S... thats really weird and I've been trying many options... can you help me with that issue?

here's my code.

RadListBox

lista = new RadListBox();

for

(int j = 0; j < listaCuartoSel.Count; j++)

{

RadListBoxItem item = new RadListBoxItem();

item.Text = listaCuartoSel[j].Nombre;

string pathImagen = "ImagePath";

Image imagenCuarto = Image.FromFile(pathImagen);

item.Image = imagenCuarto;

item.Alignment =

ContentAlignment.TopLeft;

item.ImageAlignment =

ContentAlignment.MiddleRight;

item.TextImageRelation =

TextImageRelation.ImageBeforeText;

lista.Items.Add(item);

}

lista.Enabled =

true;

lista.Virtualized =

true;

lista.IsAccessible =

true;

lista.SelectedIndex = 0;

lista.Width = 300;

this

.Controls.Add(lista);

Nikolay
Telerik team
 answered on 25 Apr 2012
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
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
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
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?