Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
530
ContainsKey for Appearances Collection
posted

I am trying to keep the number of appearances down for performance reasons.

I am doing this with a function that creates the key which is a string with the hex value of color. 

 I tried then using that key to search for the existance of the appearance using Contains.  Which is failing, so I tried creating a class that extends IKeyedSubObject:

public class FxAppearanceFinder : IKeyedSubObject {

#region IKeyedSubObject Members

private string _Key;

public FxAppearanceFinder(string key) {

_Key = key;

}

 

public string Key {

get { return _Key; }

set { _Key = value; }

}

public void OnAddedToCollection(KeyedSubObjectsCollectionBase primaryCollection) {throw new NotImplementedException();

}

public void OnRemovedFromCollection(KeyedSubObjectsCollectionBase primaryCollection) {

throw new NotImplementedException();

}

#endregion

}

I pass this the key to the ctor of the class.

        string s = CalcApptAppearKey(appt);

        FxAppearanceFinder find = new FxAppearanceFinder(s);

      Infragistics.Win.Appearance appear = null;      

      if (_CalInfo.Appearances.Contains(find)) {

           appear = _CalInfo.Appearances[s];

            return appear;

         }

This does not return the Appearance. 

Can you help me with this?

Thanks,

Bob