Posted 14 years ago
by Eli Obadia
I'm working with SelectedObject and need to show/hide some properties according to the value of another property. For example if a property is marital state, when the value is married I need to show another property that has wife name, and when the marital status change to single I need to hide the property wife name.
I'm trying to use the following code for the samples From the Custom Filters:And add in the .xmal:
But I have 2 questions:
1) In this sample the filtering code is activated by “binding” but I will need to make a “call” to do the filtering from my code -so when the user change the value of the property Marital_Status I cann show/hide the wife_name property- how can I do that ?
2) Here the sample is filtering an entire category, how can I filter one specific property inside a category?
I'm trying to use the following code for the samples From the Custom Filters:
public class CustomFilter : DataFilter {
/////////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC PROCEDURES
/////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Determines if the specified <see cref="IDataAccessor"/> should be filtered.
/// </summary>
/// <param name="dataAccessor">The data accessor.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="IDataAccessor"/> should be filtered; otherwise <c>false</c>.
/// </returns>
public override bool Filter(IDataAccessor dataAccessor) {
if (this.IsEnabled) {
ICategoryDataAccessor categoryDataAccessor = dataAccessor as ICategoryDataAccessor;
if (null != categoryDataAccessor && "Misc" == categoryDataAccessor.DisplayName)
return true;
}
return false;
}
}
<propgrid:PropertyGrid.DataFilter>
<sample:CustomFilter x:Name="customFilter" />
</propgrid:PropertyGrid.DataFilter>
1) In this sample the filtering code is activated by “binding” but I will need to make a “call” to do the filtering from my code -so when the user change the value of the property Marital_Status I cann show/hide the wife_name property- how can I do that ?
2) Here the sample is filtering an entire category, how can I filter one specific property inside a category?