Telerik Forums
UI for WinForms Forum
10 answers
704 views
Is it possible to select an item in a ListView using the mouse right button?

Thanks,

Javier Gonzalez de Aragon
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 18 Jan 2016
1 answer
227 views

I want to set the current cell after performing a ResetBindings to allow seemless keyboard entry.  In my example code below I would like to be able to edit the Name column after tabbing out of the Age column.  The row appears highlighted but I must navigate to a different row before I can continue editing

 

public class MyData : IComparable
       {
       public int Age { get; set; }
       public string Name { get; set; }
 
       public MyData ()
           {
           }
 
       public MyData (string name, int age)
           {
           Name = name;
           Age = age;
           }
 
       public int CompareTo (object obj)
           {
           var other = obj as MyData;
 
           if (other == null)
               return 0;
 
           if (this.Age > other.Age)
               return 1;
 
 
           if (this.Age < other.Age)
               return -1;
 
           return 0;
           }
       }

private List<MyData> m_dataSource;
private BindingSource myDataBindingSource = new BindingSource();
 
public Form1()
    {
    InitializeComponent();
    this.radGridView1.MasterTemplate.DataSource = myDataBindingSource;
    m_dataSource = PopulateData ();
    this.myDataBindingSource.DataSource = m_dataSource;
    radGridView1.CellEndEdit += radGridView1_CellEndEdit;
    }
 
void radGridView1_CellEndEdit(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
    {
    var data = this.radGridView1.CurrentRow.DataBoundItem as MyData;
    m_dataSource.Sort();
    myDataBindingSource.ResetBindings(false);
 
    if (data != null)
        {
        foreach (var row in this.radGridView1.Rows)
            {
            if (row.DataBoundItem == data)
                {
                row.IsCurrent = true;
                }
            else
                {
                row.IsCurrent = false;
                }
            }
        }
    }
 
private List<MyData> PopulateData ()
    {
    List<MyData> dataList = new List<MyData> ();
 
    dataList.Add (new MyData ("A", 1));
    dataList.Add (new MyData ("B", 7));
    dataList.Add (new MyData ("C", 3));
    dataList.Add (new MyData ("D", 5));
    dataList.Add (new MyData ("E", 15));
 
    return dataList;

 

    }

Dimitar
Telerik team
 answered on 18 Jan 2016
3 answers
113 views

I save RadGridView layout in SQL using the following code:

string name = Microsoft.VisualBasic.Interaction.InputBox("Please insert the layout name:", " ");
using (MemoryStream ms = new MemoryStream())
{
    var lay = new Rahat.Layout();
    lay.User_Id = 123;
    lay.Title = name;
    #region lay.Layout
    grid.SaveLayout(ms);
    var sw = new StreamWriter(ms);
    sw.Flush();
    ms.Position = 0;
    var sr = new StreamReader(ms);
    var myStr = sr.ReadToEnd();
    lay.Layout = myStr;
    #endregion
    _dbRahat.Layouts.InsertOnSubmit(lay);
    _dbRahat.SubmitChanges();
}

and load the layout using the following code:

var lay = _dbRahat.Layouts.First(l => l.Id.ToString() == cmbPreset.SelectedValue.ToString());
 
byte[] byteArray = Encoding.UTF8.GetBytes(lay.Layout);
var stream = new MemoryStream(byteArray);
grid.LoadLayout(stream);
 
FillGrid();

The problem is that the grid colors (header cell colors, data cell colors) are not saved and loaded with SaveLayout() and LoadLayout() methods. How can I solve this problem?

Thank you

Dimitar
Telerik team
 answered on 18 Jan 2016
5 answers
469 views

I am currently running Telerik WinControls 2009 Q2, I have a ribbon on an MDI form inheriting from the ShapeForm form class.

I would click run, it comes up without a hitch, sometimes it will be fine, most times however if I move the mouse, hover over a button, do nothing, it will throw a TargetInvocationException.  This exception is pasted below.  This application worked flawlessly till I added the RibbonControl to update the GUI.

Any suggestions on fixing this issue would be greatly appreciated.  I am at a loss as to what might be going on but the common denominator seems to be the ribbon   The inner exception is a null reference exception in Telerik.WinControls but I am at a loss what this might be.

 

 

Exception:

System.Reflection.TargetInvocationException was unhandled

  Message="Exception has been thrown by the target of an invocation."

  Source="mscorlib"

  StackTrace:

       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

       at System.Delegate.DynamicInvokeImpl(Object[] args)

       at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)

       at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)

       at System.Threading.ExecutionContext.runTryCode(Object userData)

       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)

       at System.Windows.Forms.Control.InvokeMarshaledCallbacks()

       at System.Windows.Forms.Control.WndProc(Message& m)

       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

       at Telerik.WinControls.RadControl.WndProc(Message& m)

       at Telerik.WinControls.UI.RadRibbonBar.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)

       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

       at System.Windows.Forms.Application.Run(ApplicationContext context)

       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()

       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)

       at SoftwareConfigurator.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81

  InnerException: System.NullReferenceException

       Message="Object reference not set to an instance of an object."

       Source="Telerik.WinControls"

       StackTrace:

            at Telerik.WinControls.Layouts.ContextLayoutManager.LayoutQueue.GetTopMost()

            at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()

            at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayoutCallback(ILayoutManager manager)

       InnerException:

Dimitar
Telerik team
 answered on 15 Jan 2016
3 answers
102 views

I upgraded from 2014 controls to 2015 and the suggestappend mode of the multi-column combo box (both in grid and as stand along control) no longer works as expected or as it used to.  When I begin typing in the field, it correctly performs the append part and attempts to complete the entry based on the items in the list.  It also correctly pops the drop list.

However, when I hit 'tab' without typing all of the characters, it does not change the value to the suggested.  Also it does not automatically select the desired row in the drop down like it did in 2014.  Am I missing something?  I created a small project that demonstrates if it would be helpful for me to send that.

 

Example:  See the screenshot.  The class column is a multicombo.  I key in the 'N' and it correctly completes it with 'NESTLE'. But the window that popped does not highlight the first 'N' option as it used to and when I next hit tab key, it does not set the value of the multicombo cell to 'NESTLE' but leaves it as the prior value until I type in the entire word.

Hristo
Telerik team
 answered on 15 Jan 2016
1 answer
135 views

Hi,

My scenario is that I have a form to capture the profile of a Person, in that form I am using an AutoCompleteBox to enter the Country. I do have a Country Catalog, so the AutoCompleteBox in profile shows existing elements.

I would like to allow the user to create countries on the fly when capturing a profile. I mean: if the user types a value that does not exist on the catalog, then when clicking the button to store the profile I want to take the not-match string in AutoCompleteBox and use it first to create a Country and then store that new CountryID when saving the whole profile. And of course, the next time the user require that Country it will be available as an existing element from the catalog of countries.

But I see that not-match strings are lost once AutoCompleteBox loses focus.

Is it possible to allow AutoCompleteBox keep that not-match string so I can use it when saving the profile as I explained above?

Thanks in advance for your support,

Regards

Oscar

Hristo
Telerik team
 answered on 15 Jan 2016
1 answer
116 views

Hi, I use the RadChartView to generate PNG images on webserver side. The problem is that in Windows XP text on charts is not smooth, but in Windows 7 it works fine. How could I achieve the desired behavior in Windows XP. Screenshots are attached.

Dimitar
Telerik team
 answered on 14 Jan 2016
5 answers
298 views
Hello,
how can I completely disable the outer border (see attachement) of the RadForm Element in Visual Style Builder?
I tried to set the BorderThickness to 0;0;0;0 of FormOuterBorder, FormInnerBorder and RadFormElement without success. I also tried to set Visibility to Collapsed, but it doesn't work.
Thanks,
Oliver
Dimitar
Telerik team
 answered on 14 Jan 2016
4 answers
88 views

How can i do change a media in Windows Media Player component in .net without skipping, blacked form and jumping
I want change a media just like seeking(without skipping or black or jumping)

 

If telerik have a media player component show me, Please help me this is very critical for me!!

i need a media player component powerful than Windows Media Player, my program need transparency and change media fast and without blacking screen.

you think, i want create a game with a few avi movie in vb.net and i must control movie and fast change media......

what's you best idea in vb.net ????

Very very thanks!

Hristo
Telerik team
 answered on 14 Jan 2016
5 answers
367 views
Hi, guys

i am having issue with ListView items.
Too large text in the item does not fit into width, please see 001.png.

it can be solved by setting TextWrap = true for SimpleListViewVisualItem inherited class 

protected override void SynchronizeProperties()
      {
          base.SynchronizeProperties();
 
          Cars car = (Cars)Data.Value;
 
          this.Text = "<html><br><br><br><br><br><span style=\"color:#141718;font-size:14.5pt;\">" + car.Model + "</span>";
 
          this.element1.Text = "<html><span style=\"color:#010102;font-size:10.5pt;font-family:Segoe UI Semibold;\">" +
               "ABS:" + (car.ABS ? "<span style=\"color:#13224D;font-family:Segoe UI;\">YES" : "<span style=\"color:#D71B0E;\">NO") + "</span>" +
               "<br>ESR:" + (car.ESR ? "<span style=\"color:#13224D;font-family:Segoe UI;\">YES" : "<span style=\"color:#D71B0E;\">NO") + "</span>" + "</span>";
 
 
          this.TextAlignment = ContentAlignment.TopLeft;
          this.ImageAlignment = ContentAlignment.TopLeft;
 
          //this fixes issue from 001.png
         this.TextWrap = true;
 
      }


but, i will get the result shown on 002.png, where we have too big item height and second item does not seems to be shown correctly ("Q7" word is not shown).

I have figured out, if the string length does fit into ListViewItem width, it might miss last word of item text.
If  I disable images for ListViewItem, then i can see last word  of item text. see image 003.png


  private void listView_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            //comment this to fix last word showing
            e.Item.Image = (Image)Resources.ResourceManager.GetObject(((Cars)e.Item.Value).ImageFileName);
        }


anyway, i cannot fix first item height.

i have checked this one
http://www.telerik.com/community/forums/winforms/listview/item-height-issue.aspx
but it does not help too much.

i am using Telerik WinForms version: 2013.2.724.40

the source code project is available for download here:
http://yadi.sk/d/6Ro68KCoGfNEm

Look forward for your ideas!
Thank you! 

Hristo
Telerik team
 answered on 14 Jan 2016
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
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
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
SplashScreen
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?