Exemple #1
0
        /// <summary>
        ///     Copies data into a cloned instance.
        /// </summary>
        /// <param name="original">
        ///     The original instance to copy data from.
        /// </param>
        /// <param name="useCurrentValue">
        ///     Whether or not to copy the current value of expressions, or the
        ///     expressions themselves.
        /// </param>
        /// <param name="willBeFrozen">
        ///     Indicates whether or not the clone will be frozen.  If the
        ///     clone will be immediately frozen, there is no need to clone
        ///     data that is already frozen, you can just share the instance.
        /// </param>
        /// <remarks>
        ///     Override this method if you have additional non-DP state that
        ///     should be transfered to clones.
        /// </remarks>
        protected override void CopyCore(CustomBitmap original, bool useCurrentValue, bool willBeFrozen)
        {
            ChainedBitmap originalChainedBitmap = (ChainedBitmap)original;

            if (originalChainedBitmap._formatConverter != null)
            {
                if (useCurrentValue)
                {
                    if (willBeFrozen)
                    {
                        _formatConverter = (FormatConvertedBitmap)originalChainedBitmap._formatConverter.GetCurrentValueAsFrozen();
                    }
                    else
                    {
                        _formatConverter = (FormatConvertedBitmap)originalChainedBitmap._formatConverter.CloneCurrentValue();
                    }
                }
                else
                {
                    if (willBeFrozen)
                    {
                        _formatConverter = (FormatConvertedBitmap)originalChainedBitmap._formatConverter.GetAsFrozen();
                    }
                    else
                    {
                        _formatConverter = (FormatConvertedBitmap)originalChainedBitmap._formatConverter.Clone();
                    }
                }
            }
        }
Exemple #2
0
        private static void OnSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ChainedBitmap chainedBitmap = (ChainedBitmap)d;

            chainedBitmap.OnSourcePropertyChanged(e);
        }