jeudi 10 juin 2021

Overriding an internal method (reflection, emitting)

I write right away - this is not at all an urgent need, but more a desire to learn new things.

I want to create the following class:

    public class MultiDataOrTrigger : DataTrigger
    {
        public MultiDataOrTrigger()
        {

        }

        // evaluate the current state of the trigger
        internal override bool GetCurrentState(DependencyObject container, UncommonField<HybridDictionary[]> dataField)
        {
            bool retVal = false;

            for (int i = 0; !retVal && i < TriggerConditions.Length; i++)
            {
                retVal = TriggerConditions[i].ConvertAndMatch(StyleHelper.GetDataTriggerValue(dataField, container, TriggerConditions[i].Binding));
            }

            return retVal;
        }
    }

How to call internal methods, create instances of internal types - I more or less figured it out. For this, the use of reflection is enough for me.

But I still can't figure it out myself with overriding the virtual internal method specified in another assembly.

Is there anyone who understands this a little and can help?





Aucun commentaire:

Enregistrer un commentaire