Click here to Skip to main content
15,897,032 members
Articles / Desktop Programming / WPF

SharpVectors - SVG# Reloaded: An Introduction

Rate me:
Please Sign up or sign in to vote.
4.98/5 (33 votes)
17 Nov 2010BSD10 min read 206.1K   21.7K   101  
A C# library for converting SVG to WPF and viewing SVG files in WPF Applications
using System;
using System.Xml;

using SharpVectors.Dom.Events;

namespace SharpVectors.Dom
{
	/// <summary>
	/// Summary description for CDataSection.
	/// </summary>
	public class CDataSection : XmlCDataSection, ICDataSection, INode, IEventTargetSupport
	{
		#region Private Fields
		
		private EventTarget eventTarget;
		
		#endregion
		
		#region Constructors
		
		public CDataSection(
			string data,
			Document document)
			: base(data, document)
		{
			eventTarget = new EventTarget(this);
		}
		
		#endregion
		
		#region IEventTarget interface
		
		#region Methods
		
		#region DOM Level 2
		
		void IEventTarget.AddEventListener(
			string type,
			EventListener listener,
			bool useCapture)
		{
			eventTarget.AddEventListener(type, listener, useCapture);
		}
		
		void IEventTarget.RemoveEventListener(
			string type,
			EventListener listener,
			bool useCapture)
		{
			eventTarget.RemoveEventListener(type, listener, useCapture);
		}
		
		bool IEventTarget.DispatchEvent(
			IEvent @event)
		{
			return eventTarget.DispatchEvent(@event);
		}
		
		#endregion
		
		#region DOM Level 3 Experimental
		
		void IEventTarget.AddEventListenerNs(
			string namespaceUri,
			string type,
			EventListener listener,
			bool useCapture,
			object eventGroup)
		{
			eventTarget.AddEventListenerNs(namespaceUri, type, listener, useCapture, eventGroup);
		}
		
		void IEventTarget.RemoveEventListenerNs(
			string namespaceUri,
			string type,
			EventListener listener,
			bool useCapture)
		{
			eventTarget.RemoveEventListenerNs(namespaceUri, type, listener, useCapture);
		}
		
		bool IEventTarget.WillTriggerNs(
			string namespaceUri,
			string type)
		{
			return eventTarget.WillTriggerNs(namespaceUri, type);
		}
		
		bool IEventTarget.HasEventListenerNs(
			string namespaceUri,
			string type)
		{
			return eventTarget.HasEventListenerNs(namespaceUri, type);
		}
		
		#endregion
		
		#endregion
		
		#endregion
		
		#region XmlNode interface
		
		public override string Value
		{
			get
			{
				return base.Value;
			}
			set
			{
				base.Value = value;
				
				// Mutation events: Notify document.
				Document document = this.OwnerDocument as Document;
				
				if (document != null)
				{
					document.ReplacedText(this);
				}
			}
		}
		
		#endregion
		
		#region NON-DOM
		
		void IEventTargetSupport.FireEvent(
			IEvent @event)
		{
			eventTarget.FireEvent(@event);
		}
		
		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Engineer
Japan Japan
Systems Engineer

Comments and Discussions