Tnx for response. That part you are talking about is working fine.
My problem is that I want to set another extended properties when setting one property.
Let me try to explain (bare with me :) )
I want to have one extended property on Form and when i set that property on true
i want to propagate that on another extended property on child controls on that Form.
I'll try to use your example (bare with me 2) :
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
[ProvideProperty("SaveUserSettings", typeof(Component))]
[ProvideProperty("SaveGroupSettings",typeof(Form))]
public class UserSettingsExtender : Component, IExtenderProvider {
private Dictionary<Component, bool> _components = new Dictionary<Component, bool>();
private Dictionary<Component, bool> _groups = new Dicitonary<Component, bool>();
public bool CanExtend(object extendee) {
return extendee is Component;
}
public bool GetSaveUserSettings(Component extendee) {
if (!_components.ContainsKey(extendee)) _components.Add(extendee, false);
return _components[extendee];
}
public void SetSaveUserSettings(Component extendee, bool value) {
if (!_components.ContainsKey(extendee)) _components.Add(extendee, false);
_components[extendee] = value;
public bool GetSaveGroupSettings(Component extendee) {
if (!_groups.ContainsKey(extendee)) _groups.Add(extendee, false);
return _groups[extendee];
}
public void SetSaveGroupSettings(Component extendee, bool value) {
if (!_groups.ContainsKey(extendee)) _groups.Add(extendee, false);
_groups[extendee] = value;
///THIS PART!
if(extendee is Form)
{
foreach(Control c in Forms.Control)
{
if (_components.ContainsKey(c))
{
_components[c] = value ;
}
else
{
_components.Add(c, value );
}
}
}
}
}
In SetSaveGroupSettings i want to put control i _components dictionary in order to set
SaveUserSettings property but it doesn't work. Hm maybe i should call SetSaveUserSettings instead
putting controls in collection...I'll try that and see what happens.