robncsu81
robncsu81

Reputation: 31

Only show properties with a certain Category attribute using Extended WPFToolkit PropertyGrid

I am developing a C# wpf app using the Extended WPFToolkit PropertyGrid to show property data for one of my classes. This class has certain properties I do not want the user to see. Normally I could set the Browsable attribute to set what the control can see and not see; however this class is used in other projects and I can't modify it.

Order.class:

public class Order
{

     ...

     [Category("Customer Facing")]
     public int SerialNumber {get;set;}

     [Category("Customer Facing")]
     public DateTime DateOrdered {get;set;}

     [Category("Customer Facing")]
     public string CustomerName {get;set;}

     [Category("Customer Facing")]
     public decimal Price{get;set;}

     [Category("Customer Facing")]
     public string Address{get;set;}

     [Category("Customer Hidden")]
     public string Route{get;set;}

     [Category("Customer Hidden")]
     public int Mileage{get;set;}
}

ContainerPanel.xaml

 <extk:PropertyGrid x:Name="exktPropertyGrid"
                           IsEnabled="{Binding ComponentPanelEnabled, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                           HorizontalAlignment="Left"                           
                            SelectedObject="{Binding SelectedOrder,
                                                       UpdateSourceTrigger=PropertyChanged,
                                                       Mode=TwoWay}">                          

        </extk:PropertyGrid>

Is there a setting I can change in the PropertyGrid control that would let me only show properties under the Category("Customer Facing")?

Upvotes: 3

Views: 108

Answers (0)

Related Questions