Change the binding type to the DataObject of the property grid during runtime.

Grids for WPF Forum

Posted 21 days ago by Farouk Bouali
Version: 19.1.0686
Avatar

Dear Actipro support, 

I want to change the binding type to the Dataobject durring runtime, 

currently the propertyGrid is working with one type 

<grids:PropertyGrid 
IsSummaryVisible="False"
BorderThickness="0"
IsCategorized ="True"
ArePropertiesAutoExpanded="True"
SortComparer="{x:Null}"
CollectionPropertyDisplayMode="Expandable"
DataContext="{Binding PropertyGridVm}"
DataObject="{Binding PGDataObjectVm}"
IsReadOnly="True"/>

for PGDataObjectVm it is customized type 

class PGDataObjectVm
{

list<string> List1 {get; set;}
string String1{get; set;}
string String2{get; set;}
string String3{get; set;}

}

I want to create another type PGDataObjectVm2

class PGDataObjectVm2
{

string String4{get; set;}
string String5{get; set;}
string String6{get; set;}

}

I want to change the binding between type PGDataObjectVm and PGDataObjectVm2 during runtime, for a diffrent display in the propertyGrid

how can I accomplish that?

Looking forward to your reply.

Comments (1)

Answer - Posted 21 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You probably want to have an object-based property on your PropertyGrid VM and bind PropertyGrid.SelectedObject to that property.  Then set either an instance of PGDataObjectVM or PGDataObjectVM2 to that property and the PropertyGrid should update.


Actipro Software Support

The latest build of this product (v2020.1.0) was released 17 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.