コード例 #1
0
        private static void OnParagraphInlineChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Paragraph   paragraph = d as Paragraph;
            IEnumerable inlines   = ParagraphInlineBehavior.GetParagraphInlineSource(paragraph);

            var changed = inlines as INotifyCollectionChanged;

            if (inlines != null && changed != null)
            {
                var wrapper = new ObservableCollectionWrapper(paragraph, changed);
                wrapper.Wrap();
            }
        }
コード例 #2
0
        public ObservableCollectionWrapper(Paragraph paragraph, INotifyCollectionChanged collectionChanged)
        {
            _paragraph         = paragraph ?? throw new ArgumentNullException(nameof(paragraph));
            _collectionChanged = collectionChanged ?? throw new ArgumentNullException(nameof(collectionChanged));

            _collection = collectionChanged as IEnumerable;

            if (_collection == null)
            {
                throw new ArgumentNullException(nameof(collectionChanged));
            }
            _templateName = ParagraphInlineBehavior.GetTemplateResourceName(_paragraph);
        }