Current filter:
                                You should refresh the page.
                                  • Hello,

                                    I have a problem with ButtonInfo CommandParameter in ButtonEditSettings.
                                    I prepared sample project for you, you can see at attachment.

                                    When I text PersonName value and click ButtonInfo, I can see "null parameter" value.
                                    After that when I focus PersonSurname definition, and then focus PersonName again.
                                    Just click ButtonInfo without any text in PersonName , then I can see what I text in messagebox.

                                    I guess property not update immediately.

                                    Can you help me about that?

                                    Thanks,

                                    Ugur

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,
                                Thank you for the sample project. It was very helpful.
                                When you set the EditSettings property, it serves as a factory for an actual editor. The editor's creation mechanism does not preserve the editor's bindings, it is created with the current properties' values instead. So, when you update your view model's properties, the actual editor does not receive these updates.
                                In this scenario, I suggest you use the CellTemplate property:

                                [XAML]
                                <dxprg:PropertyDefinition.CellTemplate> <DataTemplate> <dxe:ButtonEdit x:Name="PART_Editor" AllowDefaultButton="False"> <dxe:ButtonEdit.Buttons> <dxe:ButtonInfo Command="{Binding Definition.DataContext.MyTestCommand}" CommandParameter="{Binding Definition.DataContext.Person.PersonName}" /> </dxe:ButtonEdit.Buttons> </dxe:ButtonEdit> </DataTemplate> </dxprg:PropertyDefinition.CellTemplate>

                                I also recommend you review the How to build binding paths Knowledge Base article.
                                Let me know if this solution is helpful.

                                • LCWAIKIKI 11.29.2018
                                  Hello,

                                  I'm glad to hear sample project was helpful for you.
                                  I prepared property grid and definitions from xaml in sample project but I create definitions from code behind in my real project.

                                  How can I implement you solution from code behind?
                                  Can you send me an example project?

                                  Thanks,

                                  Ugur
                                • Alexander Rus (DevExpress Support) 11.29.2018
                                  Hi Ugur,
                                  You can use several approaches to define CellTemplate in code:
                                  1. Use XamlReader and create DataTemplate from a string.
                                  2. Use FrameworkElementFactory. See How do I build a DataTemplate in c# code? 
                                  3. Add the required template to the window resources and then access this template by its key:
                                  [XAML]
                                  <DataTemplate x:Key="myTemplate"> ... </DataTemplate>
                                  [C#]
                                  propertyDefinition.CellTemplate = (DataTemplate)this.Resources["myTemplate"];


                                  Thanks,
                                  Alexander

                                • LCWAIKIKI 12.07.2018
                                  Hello,

                                  Is there another option using ButtonEditSettings?

                                  Thanks,

                                  Ugur
                                • Kirill (DevExpress Support) 12.07.2018

                                  Hello Ugur,

                                  As the EditSettings objects are used to generate a corresponding editor only and don't preserve bindings, it's not possible to accomplish this task using ButtonEditSettings.


                                  Thanks,
                                  Kirill