Comments (8)
Ok... I figured out a way to do it but it requires modifying the framework.
I've subclassed PropertyEditor as well as PropertyGridView in order to override the Items getter and do my own filtering. This also required changing the Items getter to virtual and making m_categories, m_activeProperties, and m_propertySorting protected so I could access them from my overridden getter.
Is this the easiest way? Or am I missing a more obvious approach?
Thanks. -Len
from atf.
Hi Len,
By default ATF's PropertyEditor uses SelectionPropertyEditingContext for displaying and editing the properties of the selected object, if there is no client-defined IPropertyEditingContext. See PropertyEditor.GetContext() method. Note SelectionPropertyEditingContext.GetPropertyDescriptors() returns all the visible properties of the selected objects.
Perhaps one approach is to set up your own IPropertyEditingContext, which can be derived or modified from SelectionPropertyEditingContext. Then you can rewrite GetPropertyDescriptors() to expose properties according to your filtering rules.
Does that sounds workable?
Shen
from atf.
Personally I prefer one property editor. If there are multiple property editors, will it be always clear which property editor to look/edit for a specific property?
from atf.
In my case I have a LOT of properties which, when on a single panel, are quite an eyeful.
I've been looking into SelectionPropertyEditingContext and how to wire a custom subclass into my project. Where is the appropriate place to change from the default context to my SelectionPropertyEditingContext subclass? In Initialize of my PropertyEditor subclass?
Thanks.
from atf.
Inside PropertyEditor.GetContext() method, it calls GetMostRecentContext() to check a client-defined IPropertyEditingContext:
IPropertyEditingContext context = ContextRegistry.GetMostRecentContext();
So if you can set ActiveContext once before the property editor is actually used, like this line
m_contextRegistry.ActiveContext = MyPropertyEditingContext
GetMostRecentContext() call should be able to grab MyPropertyEditingContext.
If you have MyPropertyEditingContext1 & MyPropertyEditingContext2, GetMostRecentContext() will grab the most recent activated one.
from atf.
It seems like you'll need to have m_defaultContext exposed as protected and not readonly to do what you're looking for. @Ron2 in the past has been great about exposing things for us, perhaps he can weigh in.
from atf.
I AM able to do what I want by setting PropertyEditor.m_defaultContext to be protected (read/write) with no other changes to ATF.
I'm using a custom SelectionPropertyEditingContext subclass and it's working well.
from atf.
Thanks, @vorptronica, for the good suggestion.
I see how it would be useful to customize how the property descriptors are retrieved for the current selection set. I checked in the following addition to PropertyEditor and to the spreadsheet-style GridPropertyEditor:
/// <summary>
/// Gets or sets the default SelectionPropertyEditingContext object. This object
/// is used if there is no IPropertyEditingContext available from the IContextRegistry.
/// Set this to control custom property filtering behavior for the current
/// ISelectionContext, by overriding the SelectionPropertyEditingContext's
/// GetPropertyDescriptors(). Can't be null.</summary>
public SelectionPropertyEditingContext DefaultPropertyEditingContext
{
get { return m_defaultContext; }
set { m_defaultContext = value; }
}
from atf.
Related Issues (20)
- Saving projects with multiple files HOT 3
- Save button does not update in DomTreeEditor HOT 2
- Use other DLL in MEF, throw exception when load the assemblies. HOT 2
- Syntax Editor license question HOT 2
- Analysis of ATF source code by PVS-Studio static code analyzer HOT 2
- GlobalHistoryContext with multiple EditingContext on same DomNode HOT 7
- PropertyGrid does not update when using keyboard to select ListView item HOT 2
- Show/Hide properties on the PropertyGrid HOT 5
- <xs:all> nodes ignored by DomGen.exe HOT 2
- element minOccurs and maxOccurs are ignored by HOT 2
- Panel visiblity status is not reflected in the "Window" menu HOT 4
- Issue with Validatior/TransactionContext system HOT 1
- Redirect PropertyGrid data HOT 3
- Add "GeneratedCode" attribute to Schema class generated by DomGen
- Consider adding a strong name to DLLs. HOT 2
- DomNodeAdapter to TreeControl.Node
- Update SharpDX HOT 1
- isReadOnly parameter cannot by dynamic with defined editor HOT 3
- UnregisterMenu & Readding Menus HOT 2
- VirtualizingWrapPanel Error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atf.