Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to make the WPFPropertyGrid Readonly.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to make the WPFPropertyGrid Readonly.

    HI there,

    I have read this post regarding use of the WPFPropertyGrid in NT and have managed to get this sample working in NT8:


    I have a question regarding how to make it read-only. I can see from a chart in the Indicators dialogue when you select an Indicator in the "Available" section it shows the properties of that indicator in the WPFPropertyGrid as read-only. This is exactly what I want to do.

    I have tried to use the PropertyGrid.ShowReadOnlyProperties property setting it to true, but it does not seem to make any difference.

    Can you provide a code sample as to how you are making the WPFPropertyGrid read-only.

    Thank for your time,

    Mark.

    #2
    Hello,

    Thank you for the post.

    If you are trying to disable the whole property grid at once, I am unsure of a specific way to disable all properties at once I will need to research this further. If I can locate any method to do this I will update this post.

    One example I can think of that would work for this purpose would be to use the property descriptor collection and a type converter. We have a good sample at the following link that demonstrates a few different concepts in the property grid including read only. https://ninjatrader.com/support/foru...ad.php?t=97919

    In this situation, a type converter is used along with the property descriptors collection to control the various properties like read-only. You could do something similar to this or create a type converter that controls all properties instead of being specific. I am unsure of what would be required to toggle that though, you would likely need to create a second object that does not have the type converter and select that if it should be enabled at some point.

    I look forward to being of further assistance.

    Comment


      #3
      wpfpropoertygrid

      Isn't it just a simple call in initialize.. like

      wpfgrid.SelectedObject = myobject;

      foreach (PropertyItem p in wpfgrid.Properties) {

      p.IsReadOnly=true;

      }


      Good luck

      Andreas

      Discover top crypto trading apps like Binance for secure, low-fee trading. Access crypto, forex, and more with real-time tools. Avoid scams, start small, and grow profits.

      Comment


        #4
        Thanks for the response. Much appreciated.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        155 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        90 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        137 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        130 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X