Beispiel #1
0
        public double GetEstimatedHeight(double width)
        {
            if (width > 0 && width != double.NaN)
            {
                (Application.Current as App).ChatMessageWidth = width;
            }

            if (Message.Height <= 0)
            {
                MeasureHeight(Message.Style);
            }

            if (Message.Height > 0)
            {
                return(Message.Height);
            }

            // Do not recalc height if text and width are unchanged
            if (estimatedHeight < 0 || estimatedWidth != width)
            {
                estimatedWidth  = width;
                estimatedHeight = TextMeasurer.GetEstimatedHeight(Message.Text, width);
            }
            return(estimatedHeight);
        }