Search Results

Search found 55 results on 3 pages for 'propertygrid'.

Page 1/3 | 1 2 3  | Next Page >

  • Propertygrid changes not picked up when using menu shortcut for saving

    - by Ebbe
    I am trying to implement a simple windows forms application, where the user can edit instances of a simple Person class. The application makes use of the standard propertygrid, assigning instances of the Person class to the SelectedObject property of the propertygrid. When the user clicks the menu item Save, the application gets the selected item from the propertygrid and saves it. This works fine. However, if a shortcut such as ctrl+S, assigned to the menu item, is used for saving the SelectedObject of the propertygrid, then the changes are not picked up. It appears to be related to the fact that the properties of the Person object are not updated unless the field in the propertygrid looses focus, and the ctrl+S shortcut doesn’t take away focus from fields in the propertygrid. Other developers, such as Mark Gilbert, have solved this issue by forcing away focus from the propertygrid, but this seems to be a bit of a hack, especially since it would be nice to keep the focus at the field. The Visual Studio developers apparently got it right, but I haven’t figured out how.

    Read the article

  • C# Winforms: PropertyGrid not updated when item added to Collection

    - by MysticEarth
    I've got a custom class which can be edited through the PropertyGrid. In that class I've got a custom Collection (with custom PropertyDescriptor and TypeConverter). Items can be added to or removed from the Collection with the default Collection Editor. This all works fine. But - after closing the Collection Editor, the PropertyGrid is not updated. When I manual make a call to Refresh() on the PropertyGrid, the changes are reflected in the PropertyGrid. How can I get the PropertyGrid to automatically refresh when the Collection Editor has been closed? I sought for a solution earlier where I should subclass CollectionEditor (which I can't seem to find). Please help.

    Read the article

  • PropertyGrid control issue in Windows7

    - by Mahesh
    I have an issue with the Windows Forms PropertyGrid control. I have customized the PropertyGrid control and override only OnPaint function. protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); } In my application I have few more controls (treeview, custom control and few form controls). When I mouseclick on the PropertyGrid control, the paint function in all the controls in the screen are being called continuously and the treeview starts flickering. This happens only in mouseclick event.

    Read the article

  • WPF PropertyGrid - adding support for collections

    - by akjoshi
    Hi, I am working on wpf propertygrid(PG) control and I want the PG to support collection type(IList, ObservableCollection etc.) properties. I am bit confused on how to keep track of selected item(of that collection) and pass that to client. Any ideas? If the solution makes use of the Open Source WPF PropertyGrid (http://www.codeplex.com/wpg) I will implement the changes /additions back into the control.

    Read the article

  • .Net Custom Configuration Section and Saving Changes within PropertyGrid

    - by Paul
    If I load the My.Settings object (app.config) into a PropertyGrid, I am able to edit the property inside the propertygrid and the change is automatically saved. PropertyGrid1.SelectedObject = My.Settings I want to do the same with a Custom Configuration Section. Following this code example (from here http://www.codeproject.com/KB/vb/SerializePropertyGrid.aspx), he is doing explicit serialization to disk when a "Save" button is pushed. Public Class Form1 'Load AppSettings Dim _appSettings As New AppSettings() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click _appSettings = AppSettings.Load() ' Actually change the form size Me.Size = _appSettings.WindowSize PropertyGrid1.SelectedObject = _appSettings End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click _appSettings.Save() End Sub End Class In my code, my custom section Inherits from ConfigurationSection (see below) Question: Is there something built into ConfigurationSection class that does the autosave? If not, what is the best way to handle this, should it be in the PropertyGrid.PropertyValueChagned? (how does the My.Settings handle this internally?) Here is the example Custom Class that I am trying to get to auto-save and how I load into property grid. Dim config As System.Configuration.Configuration = _ ConfigurationManager.OpenExeConfiguration( _ ConfigurationUserLevel.None) PropertyGrid2.SelectedObject = config.GetSection("CustomSection") Public NotInheritable Class CustomSection Inherits ConfigurationSection ' The collection (property bag) that contains ' the section properties. Private Shared _Properties As ConfigurationPropertyCollection ' The FileName property. Private Shared _FileName As New ConfigurationProperty("fileName", GetType(String), "def.txt", ConfigurationPropertyOptions.IsRequired) ' The MasUsers property. Private Shared _MaxUsers _ As New ConfigurationProperty("maxUsers", _ GetType(Int32), 1000, _ ConfigurationPropertyOptions.None) ' The MaxIdleTime property. Private Shared _MaxIdleTime _ As New ConfigurationProperty("maxIdleTime", _ GetType(TimeSpan), TimeSpan.FromMinutes(5), _ ConfigurationPropertyOptions.IsRequired) ' CustomSection constructor. Public Sub New() _Properties = New ConfigurationPropertyCollection() _Properties.Add(_FileName) _Properties.Add(_MaxUsers) _Properties.Add(_MaxIdleTime) End Sub 'New ' This is a key customization. ' It returns the initialized property bag. Protected Overrides ReadOnly Property Properties() _ As ConfigurationPropertyCollection Get Return _Properties End Get End Property <StringValidator( _ InvalidCharacters:=" ~!@#$%^&*()[]{}/;'""|\", _ MinLength:=1, MaxLength:=60)> _ <EditorAttribute(GetType(System.Windows.Forms.Design.FileNameEditor), GetType(System.Drawing.Design.UITypeEditor))> _ Public Property FileName() As String Get Return CStr(Me("fileName")) End Get Set(ByVal value As String) Me("fileName") = value End Set End Property <LongValidator(MinValue:=1, _ MaxValue:=1000000, ExcludeRange:=False)> _ Public Property MaxUsers() As Int32 Get Return Fix(Me("maxUsers")) End Get Set(ByVal value As Int32) Me("maxUsers") = value End Set End Property <TimeSpanValidator(MinValueString:="0:0:30", _ MaxValueString:="5:00:0", ExcludeRange:=False)> _ Public Property MaxIdleTime() As TimeSpan Get Return CType(Me("maxIdleTime"), TimeSpan) End Get Set(ByVal value As TimeSpan) Me("maxIdleTime") = value End Set End Property End Class 'CustomSection

    Read the article

  • Which types use a FileNameEditor in a PropertyGrid?

    - by Wolfgang
    I need to change the editor for a property attached to a .net PropertyGrid, but I cannot set the Editor attribute of that property, because the property was generated by a tool, including all attributes. The desired editor is System.Windows.Forms.Design.FileNameEditor I can find many tutorials on the web to assign this editor to string properties by setting the editor attribute, but I cannot set the editor attribute in this case. However, I can advise the code generation tool to behave such that the string property which I want to be edited with the FileNameEditor becomes converted to another property with different type. In order to do so, I would need to know which type is edited by the FileNameEditor as default. I didn't find any list on the web which would tell me for a given editor which types employ this editor automatically when displayed in a PropertyGrid.

    Read the article

  • C# PropertyGrid drag drop

    - by gametheoryonline
    I'm trying to implement drag/drop support to a propertygrid in C# using VS2005 (.NET 2.0). The propertygrid can handle the dragenter etc. events, but there doesn't seem to be a way to get the griditem under the pointer during a drag event. The best I've been able to get so far is to use the selectedgriditem property to retrieve a custom propertydescriptor and set the value, but this requires a grid item to already be selected before starting the drag/drop operation. Has anyone had any luck with implementing this? Thanks :-)

    Read the article

  • Implementing sub fields in a PropertyGrid

    - by evolve
    Alright so my terminology when it comes to C# isn't great, so I'll attempt to explain this with a small example. If you create a class which you are using within a PropertyGrid and you have the following values: class Test { public Point example { get; set; } } This will produce a PropertyGrid which has an expandable object "example" which has fields X and Y in order to create a "Point". I'm attempting to create an object "name" which has fields "firstname" and "lastname", so I have: class Test { public Name example { get; set; } } public struct Name { public string firstname { get; set; } public string lastname { get; set; } } This however isn't working as intended. I think I need to override some method(s) in order to get this working, however since I don't really have the terminology down for PropertyGrids it is difficult for me to find a solution. Any help would be great.

    Read the article

  • How to modify PropertyGrid at runtime (add/remove property and dynamic types/enums)

    - by salle55
    How do you modify a propertygrid at runtime in every way? I want to be able to add and remove properties and add "dynamic types", what I mean with that is a type that result in a runtime generated dropdown in the propertygrid using a TypeConverter. I have actually been able to do both those things (add/remove properties and add dynamic type) but only separately not at the same time. To implement the support to add and remove properties at runtime I used this codeproject article and modified the code a bit to support different types (not just strings). private System.Windows.Forms.PropertyGrid propertyGrid1; private CustomClass myProperties = new CustomClass(); public Form1() { InitializeComponent(); myProperties.Add(new CustomProperty("Name", "Sven", typeof(string), false, true)); myProperties.Add(new CustomProperty("MyBool", "True", typeof(bool), false, true)); myProperties.Add(new CustomProperty("CaptionPosition", "Top", typeof(CaptionPosition), false, true)); myProperties.Add(new CustomProperty("Custom", "", typeof(StatesList), false, true)); //<-- doesn't work } /// <summary> /// CustomClass (Which is binding to property grid) /// </summary> public class CustomClass: CollectionBase,ICustomTypeDescriptor { /// <summary> /// Add CustomProperty to Collectionbase List /// </summary> /// <param name="Value"></param> public void Add(CustomProperty Value) { base.List.Add(Value); } /// <summary> /// Remove item from List /// </summary> /// <param name="Name"></param> public void Remove(string Name) { foreach(CustomProperty prop in base.List) { if(prop.Name == Name) { base.List.Remove(prop); return; } } } etc... public enum CaptionPosition { Top, Left } My complete solution can be downloaded here. It works fine when I add strings, bools or enums, but when I try to add a "dynamic type" like StatesList it doesn't work. Does anyone know why and can help me to solve it? public class StatesList : System.ComponentModel.StringConverter { private string[] _States = { "Alabama", "Alaska", "Arizona", "Arkansas" }; public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { return new StandardValuesCollection(_States); } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return true; } } The method of using a TypeConverter works fine when you don't try to add the property at runtime, for example this code works without any problem, but I want to be able to do both. Please take a look at my project. Thanks!

    Read the article

  • PropertyGrid - is it customizable?

    - by serhio
    I have a project in that we have to represent some graphic objects on a usercontrol in WYSIWYG. Also is required to edit each objects properties(Color, Location, etc). I hesitate between using PropertyGrid ('direct' properties edit) and custom forms on DoubleClick ('indirect' edit). The PropertyGrid is very well but should correspond a some criteria: Only selected properties are Displayed (by e.g. if I have TextRectangle want display only Text and Location); Property names should be customizable and internationalizable (by e.g. TextRectangle Text property should be named "Company Name" or "???????? ???????????"). Now about is it possible I think the answer could be Yes, but is it reasonable to use it if we have not a lot of time. What could be quicker implemented, custom forms or Property panel?

    Read the article

  • Custom Control Not Playing Nice With PropertyGrid

    - by lumberjack4
    I have a class that is implementing a custom ToolStripItem. Everything seems to work great until I try to add the item to a ContextMenuStrip at design time. If I try to add my custom control straight from the ContextMenuStrip the PropertyGrid freezes up and will not let me modify my Checked or Text properties. But if I go into the ContextMenuStrip PropertyGrid and add my custom control through the Items(...) property, I can modify the custom control just fine within that dialog. I'm not sure if I'm missing an attribute somewhere of if its a problem with the underlying code. Here is a copy of the CustomToolStripItem class. As you can see, its a very simple class. [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ContextMenuStrip)] public class CustomToolStripItem : ToolStripControlHost { #region Public Properties [Description("Gets or sets a value indicating whether the object is in the checked state")] [ReadOnly(false)] public bool Checked { get { return checkBox.Checked; } set { checkBox.Checked = value; } } [Description("Gets or sets the object's text")] [ReadOnly(false)] public override string Text { get { return checkBox.Text; } set { checkBox.Text = value; } } #endregion Public Properties #region Public Events public event EventHandler CheckedChanged; #endregion Public Events #region Constructors public CustomToolStripItem() : base(new FlowLayoutPanel()) { // Setup the FlowLayoutPanel. controlPanel = (FlowLayoutPanel)base.Control; controlPanel.BackColor = Color.Transparent; // Add the child controls. checkBox.AutoSize = true; controlPanel.Controls.Add(checkBox); ContextMenuStrip strip = new ContextMenuStrip(); } #endregion Constructors #region Protected Methods protected override void OnSubscribeControlEvents(Control control) { base.OnSubscribeControlEvents(control); checkBox.CheckedChanged += new EventHandler(CheckChanged); } protected override void OnUnsubscribeControlEvents(Control control) { base.OnUnsubscribeControlEvents(control); checkBox.CheckedChanged -= new EventHandler(CheckChanged); } #endregion Protected Methods #region Private Methods private void CheckChanged(object sender, EventArgs e) { // Throw the CustomToolStripItem's CheckedChanged event EventHandler handler = CheckedChanged; if (handler != null) { handler(sender, e); } } #endregion Private Methods #region Private Fields private FlowLayoutPanel controlPanel; private CheckBox checkBox = new CheckBox(); #endregion Private Fields }

    Read the article

  • Can we change the text/background color of an individual property in PropertyGrid

    - by Charvak
    I have a .NET PropertyGrid control which displays properties of some class. I want to change the color or font or background color(it doesn't matter just that they look different from the other displayed properties) of some property. I can do with writing custom editor but I was wondering If an easier method exists? If I use custom editor then how do i change the editor of built-in types like bool, int etc. Thanks

    Read the article

  • PropertyGrid: Merging multiple dynamic properties when editing multiple objects

    - by Andrei Stanescu
    Hi, Let's say I have a class A and a class B. I would like to edit using .NET PropertyGrid multiple instances of A and B simultaneously. The desired behavior would be to have the intersection of properties displayed. If A and B have static (written in the source code) properties everything works fine. Selecting A and B instances will only display the intersection of properties. However, if A and B also have dynamic properties (returned as a PropertyDescriptorCollection through the GetProperties() method) the behavior is wrong. When selecting multiple objects I will only see those static properties and none of the dynamic ones. When I select only one instance I can see all properties (static and dynamic). Anybody any ideas? I couldn't find anything on the internet.

    Read the article

  • Filter elements in PropertyGrid

    - by serhio
    In System.Windows.Forms there are a PropertyGrid that displays properties of an attached object. Let's say MyTextBox : TextBox. Now, I would like to display on it some MyTextBox properties, say only Size, Location and my custom property Date. More that than, I would like to be able to change the real property names, say "Dimension", "Location" and "Starting Date". I saw two projects on this subject : first and second, but first does not work well(for browsable properties), and the second seems to add an event for each property changes, this is not acceptable.

    Read the article

  • .NET Propertygrid refresh trouble

    - by osss
    Property grid do not show new value of selected object. For example: o.val = "1"; pg.SelectedObject = o; o.val = "2"; pg.Refresh(); The property in property grid still "1"; It is changing only if click on this property.. or like that: o.val = "1"; pg.SelectedObject = o; o.val = "2"; pg.SelectedObject = o; but in this case focus will be changed to propertygrid.

    Read the article

  • PropertyGrid + interface

    - by nilphilus
    public interface ITest { void Somethink(); } public class Test1 : ITest { public void Somethink() { /* do stuff */ } public int Test1Property { get; set; } } public class Test2 : ITest { public void Somethink() { /* do stuff */ } public float Test2Property { get; set; } } //Main class public class MainClass { [TypeConverter(ExpandableObjectConverter)] public ITest test { get; set; } } Ok, i have sth like this. Instance of MainClass is selected by PropertyGrid. How to make a DropDownList of objects of classes which implement ITest (here Test1 and Test2)

    Read the article

  • How to allow user to set expressions detrmining property value in PropertyGrid

    - by savras
    I noticed that programs like Report Builder allow user to set property value or an expression determining property value. I want to the add same functionality to my application. So is there any simple way to do so or do i have to redefine all type converters so that they allow to set expression in addition to their original functionality. http://img204.imageshack.us/img204/7934/48707358.jpg

    Read the article

  • How to display static (shared) object's properties in a PropertyGrid?

    - by Paul Sasik
    I would like to display static (shared) objects at runtime in a PropertyGrid but if I try to set the selected object property of the grid like this: _propertyGrid.SelectedObject = System.Windows.Forms.Application I get a compilation error: 'Application' is a type and cannot be used as an expression. Is there a way to display a static (shared) object or the object's properties in the PropertyGrid?

    Read the article

  • How to display static (shared) object's properties via a Forms PropertyGrid?

    - by Paul Sasik
    I would like to display static (shared) objects at runtime in a PropertyGrid but if I try to set the selected object property of the grid like this: _propertyGrid.SelectedObject = System.Windows.Forms.Application I get this compilation error: 'Application' is a type and cannot be used as an expression. Is there a way to display a static (shared) object or the object's properties in the PropertyGrid?

    Read the article

  • EXT-js PropertyGrid best practices to achieve an update ?

    - by Tom
    Hello, I am using EXT-js for a project, usually everything is pretty straight forward with EXT-js, but with the propertyGrid, I am not sure. I'd like some advice about this piece of code. First the store to populate the property grid, on the load event: var configStore = new Ext.data.JsonStore({ // store config autoLoad:true, url: url.remote, baseParams : {xaction : 'read'}, storeId: 'configStore', // reader config idProperty: 'id_config', root: 'config', totalProperty: 'totalcount', fields: [{ name: 'id_config' }, { name: 'email_admin' } , { name: 'default_from_addr' } , { name: 'default_from_name' } , { name: 'default_smtp' } ],listeners: { load: { fn: function(store, records, options){ // get the property grid component var propGrid = Ext.getCmp('propGrid'); // make sure the property grid exists if (propGrid) { // populate the property grid with store data propGrid.setSource(store.getAt(0).data); } } } } }); here is the propertyGrid: var propsGrid = new Ext.grid.PropertyGrid({ renderTo: 'prop-grid', id: 'propGrid', width: 462, autoHeight: true, propertyNames: { tested: 'QA', borderWidth: 'Border Width' }, viewConfig : { forceFit: true, scrollOffset: 2 // the grid will never have scrollbars } }); So far so good, but with the next button, I'll trigger an old school update, and my question : Is that the proper way to update this component ? Or is it better to user an editor ? or something else... for regular grid I use the store methods to do the update, delete,etc... The examples are really scarce on this one! Even in books about ext-js! new Ext.Button({ renderTo: 'button-container', text: 'Update', handler: function(){ var grid = Ext.getCmp("propGrid"); var source = grid.getSource(); var jsonDataStr = null; jsonDataStr = Ext.encode(source); var requestCg = { url : url.update, method : 'post', params : { config : jsonDataStr , xaction : 'update' }, timeout : 120000, callback : function(options, success, response) { alert(success + "\t" + response); } }; Ext.Ajax.request(requestCg); } }); and thanks for reading.

    Read the article

  • PropertyGrid PaintValue problem: How to remove (and paint outside) the standard rectangle?

    - by Pedery
    This might be a straightforward question, even though I haven't found an easy solution to it: I've implemented my custom UITypeEditor with the sole purpose of adding a PaintValue to bools. For the sake of the discussion, let's assume that PaintValue will either paint a checked or unchecked radiobutton. Question 1: Now, here's the problem: It seems like PaintValue automatically inserts a 20x13px rectangle after all paint code has completed. Naturally, a radiobutton inside a black rectangle is ugly. Can I easily instruct or override this rectagle not to be painted? Question 2: In this respect, is it possible to paint on top of the propertygrid's native look - meaning could I paint something in order to obscure (part of) the black line separating two grid cells vertically? The purpose of doing this would be to indicate that two values were linked, like constrained width/height to an aspect ratio.

    Read the article

1 2 3  | Next Page >