Ticket T321536
Visible to All Users

PropertyGrid with ComboBoxSettings

created 9 years ago

Hi,
I have a PropertyGrid.
This PropertyGrid displays the a nested class called "Layer". From this Class I would only display the Value of the "Name" property and I don't want the user can type text in the value field.
Now I want to change this to a ComboBox which is bound to a property AllLayers, to let the user select another Layer.

Guess what - I didn't get it working.

XAML
<dxprg:PropertyDefinition Path="*.ContextLayer" ContentTemplate="{StaticResource LayerNameTemplate}" AllowInstanceInitializer="False"> <dxprg:PropertyDefinition.EditSettings> <dxe:ComboBoxEditSettings ItemsSource="{Binding AllLayers}" /> </dxprg:PropertyDefinition.EditSettings> </dxprg:PropertyDefinition>
XAML
<DataTemplate x:Key="LayerNameTemplate" DataType="{x:Type classes:Layer}"> <dxprg:CellEditorPresenter Path="Name"/> </DataTemplate>
C#
public List<Layer> AllLayers { get { return GetProperty(() => AllLayers); } set { SetProperty(() => AllLayers, value); } }
Show previous comments (1)
Alexander Russkov (DevExpress) 9 years ago

    Hi Andreas,
    Would you please clarify what menu item you mean?

    Thanks,
    Alexander

    AP AP
    Andreas Patock 2 9 years ago

      I made a little video

      Andrey Marten (DevExpress Support) 9 years ago

        Hello Andreas,

        Your approach with ComboBoxEditSettings in the previous comment is correct and should work. It would be great if you post your comment as an answer to allow other customers to find it more easily.
        I've created a separate ticket for the issue with setting the AllowInstanceInitializer property to False on your behalf: A property of a complex type cannot be edited if the AllowInstanceInitializer property of the corresponding PropertyDefinition is set to False. Let's continue our discussion there.

        Thanks,
        Andrey

        Answers

        created 9 years ago (modified 9 years ago)

        I made some progress…

        XAML
        <dxprg:PropertyDefinition Path="*.ContextLayer"> <dxprg:PropertyDefinition.EditSettings> <dxe:ComboBoxEditSettings ItemsSource="{Binding AllLayers}" DisplayMember="Name" IsTextEditable="False" /> </dxprg:PropertyDefinition.EditSettings> </dxprg:PropertyDefinition>

        This I have all my values in the ComboBox, disallow the user to edit and display only the "Name" of the nested property.

        But see the post of Andrey Marten for other problems.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.