Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    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

      Start trading with Exness, a leading platform offering low spreads, advanced tools & a wide range of assets. Open your account today!

      Comment


        #4
        Thanks for the response. Much appreciated.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by stafe, 04-15-2024, 08:34 PM
        7 responses
        31 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by adeelshahzad, Today, 03:54 AM
        4 responses
        30 views
        0 likes
        Last Post adeelshahzad  
        Started by merzo, 06-25-2023, 02:19 AM
        10 responses
        823 views
        1 like
        Last Post NinjaTrader_ChristopherJ  
        Started by frankthearm, Today, 09:08 AM
        5 responses
        17 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        43 views
        0 likes
        Last Post jeronymite  
        Working...
        X