<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[WPF Graphics Forum - All Forums]]></title>
		<link>http://forum.wpf-graphics.com/</link>
		<description><![CDATA[WPF Graphics Forum - http://forum.wpf-graphics.com]]></description>
		<pubDate>Fri, 18 May 2012 04:57:55 +0200</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[MultiMaterialBoxVisual3D can use the Tooltip property?]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=290</link>
			<pubDate>Sun, 06 May 2012 15:18:13 +0200</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=290</guid>
			<description><![CDATA[I have a small problem, MultiMaterialBoxVisual3D can use the Tooltip property? if  can use， how to get tooltip value with C# code thanks！！！！<br />
<br />
this is my code：<br />
<br />
&lt;Viewport3D Name="MainViewport"&gt;<br />
&lt;visuals:MultiMaterialBoxVisual3D x:Name="FirstBox" CenterPosition="110 0 0" Size="50 20 80"<br />
BackMaterial="Yellow" RightMaterial="LightBlue" BottomMaterial="LightBlue"<br />
FallbackMaterial="Green" ToolTipService.ToolTip="hello" ToolTipService.IsEnabled="True"/&gt;<br />
&lt;/Viewport3D]]></description>
			<content:encoded><![CDATA[I have a small problem, MultiMaterialBoxVisual3D can use the Tooltip property? if  can use， how to get tooltip value with C# code thanks！！！！<br />
<br />
this is my code：<br />
<br />
&lt;Viewport3D Name="MainViewport"&gt;<br />
&lt;visuals:MultiMaterialBoxVisual3D x:Name="FirstBox" CenterPosition="110 0 0" Size="50 20 80"<br />
BackMaterial="Yellow" RightMaterial="LightBlue" BottomMaterial="LightBlue"<br />
FallbackMaterial="Green" ToolTipService.ToolTip="hello" ToolTipService.IsEnabled="True"/&gt;<br />
&lt;/Viewport3D]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[dynamically add the more MultiMaterialBoxVisual3D  and  Achieve mouse event]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=286</link>
			<pubDate>Wed, 02 May 2012 10:22:14 +0200</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=286</guid>
			<description><![CDATA[I dynamically add the more MultiMaterialBoxVisual3D how to achieve a mouse click event, how I points which MultiMaterialBoxVisual3D current click<br />
<br />
<br />
<br />
<br />
my code is :<br />
<br />
   for ( int k = 1;  k &lt;= FIBER_disk_number; ++k)<br />
                    {<br />
                        Ab3d.Utilities.VisualEventSource3D visualEventSource;<br />
                        _eventManager = new Ab3d.Utilities.EventManager3D(MainViewport);<br />
                        my3d_collection = (Visual3DCollection)MainViewport.Children;<br />
                        <br />
                   <br />
                            L += 15;<br />
                            MultiMaterialBoxVisual3D My_3D_materialbox_box = new MultiMaterialBoxVisual3D();<br />
                            Material new_left_material, new_front_material;<br />
                            new_left_material = new DiffuseMaterial(Brushes.LightBlue);<br />
<br />
                            ImageBrush berriesBrush = new ImageBrush();<br />
<br />
                            berriesBrush.ImageSource = new BitmapImage(<br />
                             new Uri("pack://application:,,,/Dnf_Data_lib;Component/My3D_station/ddf_slot.png", UriKind.Absolute)<br />
                         );<br />
                            new_front_material = new DiffuseMaterial(berriesBrush);<br />
<br />
                            My_3D_materialbox_box.FrontMaterial = new_front_material;<br />
                            My_3D_materialbox_box.TopMaterial = new_left_material;<br />
                            My_3D_materialbox_box.RightMaterial = new_left_material;<br />
                            My_3D_materialbox_box.BottomMaterial = new_left_material;<br />
                            My_3D_materialbox_box.LeftMaterial = new_left_material;<br />
                            My_3D_materialbox_box.BackMaterial = new_left_material;<br />
                            My_3D_materialbox_box.CenterPosition = new Point3D(0, -L, 0);<br />
                            My_3D_materialbox_box.Size = new Size3D(200, 15, 50);<br />
                            My_3D_materialbox_box.IsTwoSidedMaterial = true;<br />
                     <br />
                           visualEventSource = new Ab3d.Utilities.VisualEventSource3D();<br />
                            visualEventSource.TargetVisual3D = My_3D_materialbox_box;<br />
                            visualEventSource.MouseClick += new Ab3d.Common.EventManager3D.MouseButton3DEventHandler(visualEventSource3D_MouseClick);<br />
(myPushpin_MouseDoubleClick);<br />
                            _eventManager.RegisterEventSource3D(visualEventSource);<br />
                        my3d_collection.Add(My_3D_materialbox_box);]]></description>
			<content:encoded><![CDATA[I dynamically add the more MultiMaterialBoxVisual3D how to achieve a mouse click event, how I points which MultiMaterialBoxVisual3D current click<br />
<br />
<br />
<br />
<br />
my code is :<br />
<br />
   for ( int k = 1;  k &lt;= FIBER_disk_number; ++k)<br />
                    {<br />
                        Ab3d.Utilities.VisualEventSource3D visualEventSource;<br />
                        _eventManager = new Ab3d.Utilities.EventManager3D(MainViewport);<br />
                        my3d_collection = (Visual3DCollection)MainViewport.Children;<br />
                        <br />
                   <br />
                            L += 15;<br />
                            MultiMaterialBoxVisual3D My_3D_materialbox_box = new MultiMaterialBoxVisual3D();<br />
                            Material new_left_material, new_front_material;<br />
                            new_left_material = new DiffuseMaterial(Brushes.LightBlue);<br />
<br />
                            ImageBrush berriesBrush = new ImageBrush();<br />
<br />
                            berriesBrush.ImageSource = new BitmapImage(<br />
                             new Uri("pack://application:,,,/Dnf_Data_lib;Component/My3D_station/ddf_slot.png", UriKind.Absolute)<br />
                         );<br />
                            new_front_material = new DiffuseMaterial(berriesBrush);<br />
<br />
                            My_3D_materialbox_box.FrontMaterial = new_front_material;<br />
                            My_3D_materialbox_box.TopMaterial = new_left_material;<br />
                            My_3D_materialbox_box.RightMaterial = new_left_material;<br />
                            My_3D_materialbox_box.BottomMaterial = new_left_material;<br />
                            My_3D_materialbox_box.LeftMaterial = new_left_material;<br />
                            My_3D_materialbox_box.BackMaterial = new_left_material;<br />
                            My_3D_materialbox_box.CenterPosition = new Point3D(0, -L, 0);<br />
                            My_3D_materialbox_box.Size = new Size3D(200, 15, 50);<br />
                            My_3D_materialbox_box.IsTwoSidedMaterial = true;<br />
                     <br />
                           visualEventSource = new Ab3d.Utilities.VisualEventSource3D();<br />
                            visualEventSource.TargetVisual3D = My_3D_materialbox_box;<br />
                            visualEventSource.MouseClick += new Ab3d.Common.EventManager3D.MouseButton3DEventHandler(visualEventSource3D_MouseClick);<br />
(myPushpin_MouseDoubleClick);<br />
                            _eventManager.RegisterEventSource3D(visualEventSource);<br />
                        my3d_collection.Add(My_3D_materialbox_box);]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How to measure size of content once scaled to fit the zoombox?]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=261</link>
			<pubDate>Fri, 09 Mar 2012 18:38:03 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=261</guid>
			<description><![CDATA[I have been looking through the properties and methods you have available, but I am not sure there is one that gives me a way to measure my content once its scaled to fit. I was trying ActualContentBounds but its results are a little confusing. For example I have content that is 5423x2822 unscaled. ActualContentBounds is returning 1625x1149 which is not proportional to the starting size. If there is no way to get the scaled size, is there a way to get the to scale factor used to size the content down to fit the zoom panel? I could at least use that to calculate it.]]></description>
			<content:encoded><![CDATA[I have been looking through the properties and methods you have available, but I am not sure there is one that gives me a way to measure my content once its scaled to fit. I was trying ActualContentBounds but its results are a little confusing. For example I have content that is 5423x2822 unscaled. ActualContentBounds is returning 1625x1149 which is not proportional to the starting size. If there is no way to get the scaled size, is there a way to get the to scale factor used to size the content down to fit the zoom panel? I could at least use that to calculate it.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Zoom to left upper corner instead of center]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=246</link>
			<pubDate>Fri, 24 Feb 2012 07:18:17 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=246</guid>
			<description><![CDATA[Hi Andrej,<br />
<br />
just starting out with ZoomPanel, sorry for the newbie-ness ...<br />
<br />
When zooming in with the mouse wheel the zoom is centered, i.e. the panel content (unsurprisingly) gets bigger and at the same time moves in the direction of the upper left corner, until it may no longer be visible.<br />
<br />
I'd rather have the upper left corner as the "anchor point" when zooming, rather than the center position. How would I do this? I have been playing with SetZoom but somehow I am not getting this right. <br />
<br />
Thanks for your help<br />
bluewater]]></description>
			<content:encoded><![CDATA[Hi Andrej,<br />
<br />
just starting out with ZoomPanel, sorry for the newbie-ness ...<br />
<br />
When zooming in with the mouse wheel the zoom is centered, i.e. the panel content (unsurprisingly) gets bigger and at the same time moves in the direction of the upper left corner, until it may no longer be visible.<br />
<br />
I'd rather have the upper left corner as the "anchor point" when zooming, rather than the center position. How would I do this? I have been playing with SetZoom but somehow I am not getting this right. <br />
<br />
Thanks for your help<br />
bluewater]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Line Thickness]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=245</link>
			<pubDate>Thu, 23 Feb 2012 13:46:27 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=245</guid>
			<description><![CDATA[There seems to be a difference of scale when setting line thicknesses?<br />
<br />
I'm creating a polyline and a line3d (see attached):<br />
<br />
Line3DFactory.CreatePolyLine3D (yellow)<br />
Line3DFactory.CreateLine3D (red)<br />
<br />
but to get the line thicknesses to look the same, the poly line has 0.4 and the line3d 12 set as thicknesses. <br />
<br />
<br />
<br />
Why is this?]]></description>
			<content:encoded><![CDATA[There seems to be a difference of scale when setting line thicknesses?<br />
<br />
I'm creating a polyline and a line3d (see attached):<br />
<br />
Line3DFactory.CreatePolyLine3D (yellow)<br />
Line3DFactory.CreateLine3D (red)<br />
<br />
but to get the line thicknesses to look the same, the poly line has 0.4 and the line3d 12 set as thicknesses. <br />
<br />
<br />
<br />
Why is this?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Whats the proper way to reload a svgviewbox control?]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=243</link>
			<pubDate>Mon, 20 Feb 2012 22:14:57 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=243</guid>
			<description><![CDATA[I have a scenario where I am wrapping a zoompanel around a svgviewbox that I need to load/reload many times. Currently I am simply setting the Source property to a new svg file, but after a couple times, I start getting out of memory errors. Is this the correct way to change the source, or is it not designed to do this?]]></description>
			<content:encoded><![CDATA[I have a scenario where I am wrapping a zoompanel around a svgviewbox that I need to load/reload many times. Currently I am simply setting the Source property to a new svg file, but after a couple times, I start getting out of memory errors. Is this the correct way to change the source, or is it not designed to do this?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[ReaderWmf leaks temporary files]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=242</link>
			<pubDate>Tue, 14 Feb 2012 16:32:44 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=242</guid>
			<description><![CDATA[I have the following code:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>using (ReaderWmf reader = new ReaderWmf())<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;Image image = reader.ReadGeometry(metaFile, geometrySettings);<br />
&nbsp;&nbsp;&nbsp;&nbsp;// ...<br />
}</code></div></div>
<br />
Every time this section is executed, a EMF file is created in %LOCALAPPDATA%.<br />
There is a first chance exception on the closing brace (i.e. the Dispose call) "The process cannot access the file 'C:\Users\kg\AppData\Local\9333da9f-ef9d-4fd1-ab8a-66d8b0647bc0.emf' because it is being used by another process." Here is the call stack:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>&nbsp;&nbsp;&nbsp;&nbsp;mscorlib.dll!System.IO.__Error.WinIOError(int errorCode = 0x80070020, string maybeFullPath = "C:&#92;&#92;Users&#92;&#92;kg&#92;&#92;AppData&#92;&#92;Local&#92;&#92;9333da9f-ef9d-4fd1-ab8a-66d8b0647bc0.emf") + 0x321 Bytes&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;mscorlib.dll!System.IO.File.Delete(string path) + 0x99 Bytes&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ab2d.ReaderWmf.dll!Ab2d.ReaderWmf.ر() + 0x6c Bytes&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ab2d.ReaderWmf.dll!Ab2d.ReaderWmf.Dispose(bool disposing = true) + 0x2b Bytes&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ab2d.ReaderWmf.dll!Ab2d.ReaderWmf.Dispose() + 0x22 Bytes</code></div></div>
<br />
Using Sysinternals ProcessExplorer I found that there is no other process having an open handle to the file (only my program itself).<br />
<br />
Klaus<br />
<br />
Edit: Maybe this is the same problem as in the post "Problem with ReaderWmf Class in Web Service (WCF)". The metaFile variable in my code snippet is indeed a Stream.]]></description>
			<content:encoded><![CDATA[I have the following code:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>using (ReaderWmf reader = new ReaderWmf())<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;Image image = reader.ReadGeometry(metaFile, geometrySettings);<br />
&nbsp;&nbsp;&nbsp;&nbsp;// ...<br />
}</code></div></div>
<br />
Every time this section is executed, a EMF file is created in %LOCALAPPDATA%.<br />
There is a first chance exception on the closing brace (i.e. the Dispose call) "The process cannot access the file 'C:\Users\kg\AppData\Local\9333da9f-ef9d-4fd1-ab8a-66d8b0647bc0.emf' because it is being used by another process." Here is the call stack:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>&nbsp;&nbsp;&nbsp;&nbsp;mscorlib.dll!System.IO.__Error.WinIOError(int errorCode = 0x80070020, string maybeFullPath = "C:&#92;&#92;Users&#92;&#92;kg&#92;&#92;AppData&#92;&#92;Local&#92;&#92;9333da9f-ef9d-4fd1-ab8a-66d8b0647bc0.emf") + 0x321 Bytes&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;mscorlib.dll!System.IO.File.Delete(string path) + 0x99 Bytes&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ab2d.ReaderWmf.dll!Ab2d.ReaderWmf.ر() + 0x6c Bytes&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ab2d.ReaderWmf.dll!Ab2d.ReaderWmf.Dispose(bool disposing = true) + 0x2b Bytes&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ab2d.ReaderWmf.dll!Ab2d.ReaderWmf.Dispose() + 0x22 Bytes</code></div></div>
<br />
Using Sysinternals ProcessExplorer I found that there is no other process having an open handle to the file (only my program itself).<br />
<br />
Klaus<br />
<br />
Edit: Maybe this is the same problem as in the post "Problem with ReaderWmf Class in Web Service (WCF)". The metaFile variable in my code snippet is indeed a Stream.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Touch events]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=238</link>
			<pubDate>Sat, 04 Feb 2012 07:57:49 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=238</guid>
			<description><![CDATA[Does your library also supports touch events instead of mouseevents?]]></description>
			<content:encoded><![CDATA[Does your library also supports touch events instead of mouseevents?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[3ds File and uiElements?]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=231</link>
			<pubDate>Tue, 24 Jan 2012 16:36:05 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=231</guid>
			<description><![CDATA[Hi,<br />
<br />
I have a Viewport3D with a couple of ConeUIElement3D's in it, and I can drag the view around quite happily.<br />
<br />
I'd like to load a .3ds model into this Viewport to display alongside my elements and still be able to drag the view around - clicking on the cones or on the 3ds model - is this even possible?<br />
<br />
thanks in advance<br />
Brian]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
I have a Viewport3D with a couple of ConeUIElement3D's in it, and I can drag the view around quite happily.<br />
<br />
I'd like to load a .3ds model into this Viewport to display alongside my elements and still be able to drag the view around - clicking on the cones or on the 3ds model - is this even possible?<br />
<br />
thanks in advance<br />
Brian]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[ConeUIElement3D Point Set]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=230</link>
			<pubDate>Tue, 24 Jan 2012 16:32:21 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=230</guid>
			<description><![CDATA[Hi,<br />
<br />
Does anyone know if there is a set of Points I can have access to if I have a ConeUIElement3D with say, 10 Segments? I have the BottomCenterPosition and radius etc but wondered if there's a way to get, for instance, the corner points of each segment etc, a lower-level description of the cone?<br />
<br />
thanks in advance<br />
Brian]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
Does anyone know if there is a set of Points I can have access to if I have a ConeUIElement3D with say, 10 Segments? I have the BottomCenterPosition and radius etc but wondered if there's a way to get, for instance, the corner points of each segment etc, a lower-level description of the cone?<br />
<br />
thanks in advance<br />
Brian]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Trial Version always says using "Unlicensed version" then quits.]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=224</link>
			<pubDate>Fri, 06 Jan 2012 08:19:09 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=224</guid>
			<description><![CDATA[I would really love to evaluate your product but none of the pre-compiled sample apps or apps that I compiled by myself in VS2010 will run.<br />
<br />
They display the unlicensed version message and then I get an exception:<br />
<blockquote><cite>Quote:</cite>System.Windows.Markup.XamlParseException was unhandled<br />
  Message=Cannot create instance of 'IntroductionPage' defined in assembly 'Reader3dsSamples, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation.  Error in markup file 'Reader3dsSamples;component/Other/IntroductionPage.xaml' Line 1 Position 7.<br />
  Source=PresentationFramework<br />
  LineNumber=1<br />
  LinePosition=7<br />
  StackTrace:<br />
       at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)<br />
       at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)<br />
       at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)<br />
       at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)<br />
       at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object&amp; element, ReaderFlags&amp; flags, Type&amp; delayCreatedType, Int16&amp; delayCreatedTypeId)<br />
       at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)<br />
       at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)<br />
       at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)<br />
       at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)<br />
       at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()<br />
       at System.Windows.Markup.TreeBuilder.Parse()<br />
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)<br />
       at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)<br />
       at MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverter(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader&amp; asyncObjectConverter)<br />
       at MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader&amp; asyncObjectConverter)<br />
       at System.Windows.Navigation.NavigationService.GetObjectFromResponse(WebRequest request, WebResponse response, Uri destinationUri, Object navState)<br />
       at System.Windows.Navigation.NavigationService.DoNavigate(Uri source, NavigationMode f, Object navState)<br />
       at System.Windows.Navigation.NavigateQueueItem.Dispatch(Object obj)<br />
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)<br />
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br />
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br />
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()<br />
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)<br />
       at System.Threading.ExecutionContext.runTryCode(Object userData)<br />
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)<br />
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
       at System.Windows.Threading.DispatcherOperation.Invoke()<br />
       at System.Windows.Threading.Dispatcher.ProcessQueue()<br />
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)<br />
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)<br />
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)<br />
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)<br />
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br />
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br />
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)<br />
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)<br />
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)<br />
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg)<br />
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)<br />
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)<br />
       at System.Windows.Threading.Dispatcher.Run()<br />
       at System.Windows.Application.RunDispatcher(Object ignore)<br />
       at System.Windows.Application.RunInternal(Window window)<br />
       at System.Windows.Application.Run(Window window)<br />
       at System.Windows.Application.Run()<br />
       at Reader3dsSamples.App.Main() in C:\Users\Public\Documents\AB4D\Ab3d.Reader3ds\Reader3dsSamples\obj\Debug\App.g.cs:line 0<br />
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[&#93; args)<br />
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[&#93; args)<br />
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br />
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br />
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
       at System.Threading.ThreadHelper.ThreadStart()<br />
  InnerException: System.Reflection.TargetInvocationException<br />
       Message=Exception has been thrown by the target of an invocation.<br />
       Source=mscorlib<br />
       StackTrace:<br />
            at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandle&amp; ctor, Boolean&amp; bNeedSecurityCheck)<br />
            at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)<br />
            at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)<br />
            at System.Activator.CreateInstance(Type type, Boolean nonPublic)<br />
            at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)<br />
       InnerException: System.NullReferenceException<br />
            Message=Object reference not set to an instance of an object.<br />
            Source=Reader3dsSamples<br />
            StackTrace:<br />
                 at Reader3dsSamples.Other.IntroductionPage..ctor() in C:\Users\Public\Documents\AB4D\Ab3d.Reader3ds\Reader3dsSamples\Other\IntroductionPage.xaml.cs:line 18<br />
            InnerException: </blockquote>
<br />
<br />
The application then terminates, I can't even get a glimpse of what your products do.<br />
<br />
Please let me know what's going on?<br />
<br />
I'm using VS2010 on Windows 7 with UAC turned off running in Administrator mode on a home computer.<br />
<br />
Looks like you guys are very pedantic about license security to the point where legitimate users can't even use it!<br />
<br />
-Angelo<hr />
Just tried this on another box running Win 7 but with VS2010 Express and everything in the trial version worked.<br />
<br />
Does your software support VS2010 Ultimate? There arent really that many other differences between the computers.]]></description>
			<content:encoded><![CDATA[I would really love to evaluate your product but none of the pre-compiled sample apps or apps that I compiled by myself in VS2010 will run.<br />
<br />
They display the unlicensed version message and then I get an exception:<br />
<blockquote><cite>Quote:</cite>System.Windows.Markup.XamlParseException was unhandled<br />
  Message=Cannot create instance of 'IntroductionPage' defined in assembly 'Reader3dsSamples, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation.  Error in markup file 'Reader3dsSamples;component/Other/IntroductionPage.xaml' Line 1 Position 7.<br />
  Source=PresentationFramework<br />
  LineNumber=1<br />
  LinePosition=7<br />
  StackTrace:<br />
       at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)<br />
       at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)<br />
       at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)<br />
       at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)<br />
       at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object&amp; element, ReaderFlags&amp; flags, Type&amp; delayCreatedType, Int16&amp; delayCreatedTypeId)<br />
       at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)<br />
       at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)<br />
       at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)<br />
       at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)<br />
       at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()<br />
       at System.Windows.Markup.TreeBuilder.Parse()<br />
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)<br />
       at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)<br />
       at MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverter(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader&amp; asyncObjectConverter)<br />
       at MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader&amp; asyncObjectConverter)<br />
       at System.Windows.Navigation.NavigationService.GetObjectFromResponse(WebRequest request, WebResponse response, Uri destinationUri, Object navState)<br />
       at System.Windows.Navigation.NavigationService.DoNavigate(Uri source, NavigationMode f, Object navState)<br />
       at System.Windows.Navigation.NavigateQueueItem.Dispatch(Object obj)<br />
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)<br />
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br />
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br />
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()<br />
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)<br />
       at System.Threading.ExecutionContext.runTryCode(Object userData)<br />
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)<br />
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
       at System.Windows.Threading.DispatcherOperation.Invoke()<br />
       at System.Windows.Threading.Dispatcher.ProcessQueue()<br />
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)<br />
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)<br />
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)<br />
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)<br />
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br />
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br />
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)<br />
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)<br />
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)<br />
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg)<br />
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)<br />
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)<br />
       at System.Windows.Threading.Dispatcher.Run()<br />
       at System.Windows.Application.RunDispatcher(Object ignore)<br />
       at System.Windows.Application.RunInternal(Window window)<br />
       at System.Windows.Application.Run(Window window)<br />
       at System.Windows.Application.Run()<br />
       at Reader3dsSamples.App.Main() in C:\Users\Public\Documents\AB4D\Ab3d.Reader3ds\Reader3dsSamples\obj\Debug\App.g.cs:line 0<br />
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)<br />
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)<br />
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br />
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br />
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
       at System.Threading.ThreadHelper.ThreadStart()<br />
  InnerException: System.Reflection.TargetInvocationException<br />
       Message=Exception has been thrown by the target of an invocation.<br />
       Source=mscorlib<br />
       StackTrace:<br />
            at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandle&amp; ctor, Boolean&amp; bNeedSecurityCheck)<br />
            at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)<br />
            at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)<br />
            at System.Activator.CreateInstance(Type type, Boolean nonPublic)<br />
            at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)<br />
       InnerException: System.NullReferenceException<br />
            Message=Object reference not set to an instance of an object.<br />
            Source=Reader3dsSamples<br />
            StackTrace:<br />
                 at Reader3dsSamples.Other.IntroductionPage..ctor() in C:\Users\Public\Documents\AB4D\Ab3d.Reader3ds\Reader3dsSamples\Other\IntroductionPage.xaml.cs:line 18<br />
            InnerException: </blockquote>
<br />
<br />
The application then terminates, I can't even get a glimpse of what your products do.<br />
<br />
Please let me know what's going on?<br />
<br />
I'm using VS2010 on Windows 7 with UAC turned off running in Administrator mode on a home computer.<br />
<br />
Looks like you guys are very pedantic about license security to the point where legitimate users can't even use it!<br />
<br />
-Angelo<hr />
Just tried this on another box running Win 7 but with VS2010 Express and everything in the trial version worked.<br />
<br />
Does your software support VS2010 Ultimate? There arent really that many other differences between the computers.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Usage]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=216</link>
			<pubDate>Mon, 12 Dec 2011 16:41:24 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=216</guid>
			<description><![CDATA[Hello,<br />
Can I use the trail version of Viewer3ds for commercial purposes?]]></description>
			<content:encoded><![CDATA[Hello,<br />
Can I use the trail version of Viewer3ds for commercial purposes?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[WPF controls stop working when .3ds is loaded]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=212</link>
			<pubDate>Mon, 05 Dec 2011 13:02:07 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=212</guid>
			<description><![CDATA[Good morning. I'm trying to integrate .3ds models into my application to make the 3D development faster, since converting to XAML (our actual approach) has a lot of issues. The model loading works fine, but every control on the screen - buttons, sliders, comboboxes etc - stops working immediately. Is this supposed to happen, should I be loading the model in a different window or page? <br />
I'm using Ab3d.Reader3ds.ReadFile to load the model into a viewport3D. The samples have a differente way of building menus, but I'm in a trial-an-error effort for several days and I don't have much time left for radically differente methods, any advice would be very helpful.<br />
<br />
Thanks in advance.]]></description>
			<content:encoded><![CDATA[Good morning. I'm trying to integrate .3ds models into my application to make the 3D development faster, since converting to XAML (our actual approach) has a lot of issues. The model loading works fine, but every control on the screen - buttons, sliders, comboboxes etc - stops working immediately. Is this supposed to happen, should I be loading the model in a different window or page? <br />
I'm using Ab3d.Reader3ds.ReadFile to load the model into a viewport3D. The samples have a differente way of building menus, but I'm in a trial-an-error effort for several days and I don't have much time left for radically differente methods, any advice would be very helpful.<br />
<br />
Thanks in advance.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Lights sources and animation]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=205</link>
			<pubDate>Tue, 22 Nov 2011 23:07:52 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=205</guid>
			<description><![CDATA[Hello,<br />
<br />
I'm using Reader3ds with PowerTools for 3D scene visualization and animation and I have found one issue with lights.<br />
<br />
My 3D scene contains 5 light sources with color #FF666666. This scene looks fine, lighting is soft and beautiful, but when I run the animation, all lights change color to #FFFFFFFF that breaks scene lighting.<br />
Same behavior in the Viewer3ds.<br />
<br />
Sample image attached.<br />
<br />
Are there any workaround for this issue?<br />
<br />
Thanks,<br />
Vladimir]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
I'm using Reader3ds with PowerTools for 3D scene visualization and animation and I have found one issue with lights.<br />
<br />
My 3D scene contains 5 light sources with color #FF666666. This scene looks fine, lighting is soft and beautiful, but when I run the animation, all lights change color to #FFFFFFFF that breaks scene lighting.<br />
Same behavior in the Viewer3ds.<br />
<br />
Sample image attached.<br />
<br />
Are there any workaround for this issue?<br />
<br />
Thanks,<br />
Vladimir]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How do you reset the viewbox to fit content when a rotation is applied?]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=202</link>
			<pubDate>Wed, 16 Nov 2011 21:00:34 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=202</guid>
			<description><![CDATA[When I apply a rotation to the zoompanel, is there a way to reset the viewbox so that its base size is the size of the content once its rotated?<br />
<br />
For example I have content which is rectangular and I rotate it 90 degrees clockwise so its in a landscape (wider than tall) orientation. When it zooms all the way out its fits to the size of the content unrotated when its portrait (taller than wide) orientation. Is there a way to tell it what the correct size is?<br />
<br />
As a workaround I simply figured out the minimum zoom scale and start it off at that size but I am sure there has to be a more elegant way.]]></description>
			<content:encoded><![CDATA[When I apply a rotation to the zoompanel, is there a way to reset the viewbox so that its base size is the size of the content once its rotated?<br />
<br />
For example I have content which is rectangular and I rotate it 90 degrees clockwise so its in a landscape (wider than tall) orientation. When it zooms all the way out its fits to the size of the content unrotated when its portrait (taller than wide) orientation. Is there a way to tell it what the correct size is?<br />
<br />
As a workaround I simply figured out the minimum zoom scale and start it off at that size but I am sure there has to be a more elegant way.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[SetZoom does not work when already zoomed in or panned]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=201</link>
			<pubDate>Mon, 14 Nov 2011 22:01:58 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=201</guid>
			<description><![CDATA[I am using code from the example you created for panning and zooming to a specific object which works fine when you are zoomed all the way out. Once you are zoomed in or panned at all, the method does not do anything. I tested to make sure it wasn't the values I was giving it, which were the same whether it was zoomed in or not. I haven't been able to test using the example you posted because I get errors when trying to run it.]]></description>
			<content:encoded><![CDATA[I am using code from the example you created for panning and zooming to a specific object which works fine when you are zoomed all the way out. Once you are zoomed in or panned at all, the method does not do anything. I tested to make sure it wasn't the values I was giving it, which were the same whether it was zoomed in or not. I haven't been able to test using the example you posted because I get errors when trying to run it.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Zoom and pan to specific object]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=200</link>
			<pubDate>Tue, 08 Nov 2011 12:57:27 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=200</guid>
			<description><![CDATA[In the thread "How to reset without losing rotation?" (<a href="http://forum.wpf-graphics.com/showthread.php?tid=196)" target="_blank">http://forum.wpf-graphics.com/showthread.php?tid=196)</a> user asked a question on how to zoom and pan to a specific object.<br />
<br />
Because this could be very interesting for others I have created a separate thread so the solution will be better visible.<br />
<br />
The following code is used to create random objects inside ZoomPanel and then the user can select the objects from the ListBox and the ZoomPanel will zoom and pan to the object.<br />
<br />
<br />
ZoomToObjectSample.xaml:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>&lt;Page x:Class="Ab2d.ZoomControlSample.ZoomPanel.ZoomToObjectSample"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:d="http://schemas.microsoft.com/expression/blend/2008" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:ab2d="clr-namespace:Ab2d.Controls;assembly=Ab2d.Controls.ZoomPanel"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mc:Ignorable="d" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d:DesignHeight="500" d:DesignWidth="800"<br />
&nbsp;&nbsp;&nbsp;&nbsp;Title="ZoomToControlSample"&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;Grid&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Grid.ColumnDefinitions&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ColumnDefinition Width="*"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ColumnDefinition Width="180"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Grid.ColumnDefinitions&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ab2d:ZoomPanel Name="ZoomPanel1" Grid.Column="0" Background="White"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IsAnimated="True" ZoomMode="None"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AnimationDuration="{Binding ElementName=DurationTextBox, Path=Text}"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ViewboxLimits="0 0 1 1" IsViewboxLimited="True"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Canvas Name="ContentCanvas"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ab2d:ZoomPanel&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Border Grid.Column="1" BorderBrush="Black" BorderThickness="1"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;StackPanel Orientation="Vertical" Margin="10"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBlock FontSize="12" FontWeight="Bold" Text="Selected object:"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ListBox Name="ObjectsListBox" Width="150" Margin="0 5 0 0" HorizontalAlignment="Left" SelectionChanged="ObjectsListBox_SelectionChanged"/&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBlock Margin="0 15 0 0" Text="Zoom Margin:"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBox Name="MarginComboBox" SelectedIndex="0" Width="80" HorizontalAlignment="Left" SelectionChanged="MarginComboBox_SelectionChanged"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBoxItem&gt;1.0&lt;/ComboBoxItem&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBoxItem&gt;1.2&lt;/ComboBoxItem&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBoxItem&gt;1.5&lt;/ComboBoxItem&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBoxItem&gt;2.0&lt;/ComboBoxItem&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ComboBox&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBlock Margin="0 2 0 0" TextWrapping="Wrap" Foreground="DimGray" Text="Margin defines how much space will visible around selected object."/&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBlock Margin="0 15 0 0" Text="Animation Duration (h:m:s):"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBox Name="DurationTextBox" Width="60" HorizontalAlignment="Left" Height="20"&gt;0:0:0.5&lt;/TextBox&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/StackPanel&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Border&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Grid&gt;<br />
&lt;/Page&gt;</code></div></div>
<br />
ZoomToObjectSample.xaml.cs:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Windows;<br />
using System.Windows.Controls;<br />
using System.Windows.Data;<br />
using System.Windows.Documents;<br />
using System.Windows.Input;<br />
using System.Windows.Media;<br />
using System.Windows.Media.Imaging;<br />
using System.Windows.Navigation;<br />
using System.Windows.Shapes;<br />
<br />
namespace Ab2d.ZoomControlSample.ZoomPanel<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;summary&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;/// Interaction logic for ZoomToObjectSample.xaml<br />
&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;/summary&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public partial class ZoomToObjectSample : Page<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private FrameworkElement _selectedObject;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public ZoomToObjectSample()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitializeComponent();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.Loaded += new RoutedEventHandler(ZoomToObjectSample_Loaded);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void ZoomToObjectSample_Loaded(object sender, RoutedEventArgs e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FillObjects();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private void ObjectsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!this.IsLoaded)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (ObjectsListBox.SelectedIndex == 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Show all objects<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZoomPanel1.Reset();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_selectedObject = null;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FrameworkElement targetObject = ((ListBoxItem)ObjectsListBox.SelectedItem).Tag as FrameworkElement;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZoomToObject(targetObject);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private void MarginComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (_selectedObject == null)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZoomToObject(_selectedObject);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private void ZoomToObject(FrameworkElement targetObject)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// First get the position of the selected object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// For our simple sample we can also use Canvas.GetLeft and Canvas.GetTop<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// But for more complex scenarios where the object is inside many parents with transformations we need to use TransformToAncestor<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GeneralTransform transform = targetObject.TransformToAncestor(ContentCanvas);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Point objectsPosition = transform.Transform(new Point(0, 0));<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get the size of object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Size objectsSize = new Size(targetObject.ActualWidth, targetObject.ActualHeight);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// We will zoom to the center of the object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Point centerPosition = new Point(objectsPosition.X + objectsSize.Width / 2, objectsPosition.Y + objectsSize.Height / 2);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Now get the required zoom level (1 = no zoom, 2 = 200% zoom, etc.)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double zoomX, zoomY;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double zoomFactor;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// get zoom factor for width and height of the object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomX = ContentCanvas.ActualWidth / objectsSize.Width;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomY = ContentCanvas.ActualHeight / objectsSize.Height;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get min value (so the whole object is shown) and adjust it for the selected margin<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomFactor = Math.Min(zoomX, zoomY);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomFactor /= GetSelectedMargin();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Set the new zoom position and zoom factor<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZoomPanel1.SetZoom(centerPosition, Controls.ZoomPanel.CenterPositionUnitsType.Absolute, zoomFactor);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_selectedObject = targetObject;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private double GetSelectedMargin()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double margin;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// NOTE: This is not very generic but works for this simple sample<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch (MarginComboBox.SelectedIndex)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 0:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;margin = 1.0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;margin = 1.2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shape newShape;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string shapeName;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ListBoxItem item;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Random rnd = new Random();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContentCanvas.Children.Clear();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectsListBox.Items.Clear();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Add special object to show all objects (zoom out)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item = new ListBoxItem();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.Content = "Show all objects";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.IsSelected = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectsListBox.Items.Add(item);<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Color[&#93; colors = new Color[&#93; { Colors.Red, Colors.Blue, Colors.Green, Colors.Orange };<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string[&#93; colorNames = new string[&#93; { "Red", "Blue", "Green", "Orange" };<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int c = 0; c &lt; colors.Length; c++ )<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Color color = colors[c&#93;;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; 3; i++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double x, y;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double width, height;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get random position and size<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width = 50 + rnd.NextDouble() * 100;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height = 20 + rnd.NextDouble() * 50;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Use ZoomPanel1's actual size because Canvas size is set at the end of this method<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x = 20 + rnd.NextDouble() * (ZoomPanel1.ActualWidth - 40 - width);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y = 20 + rnd.NextDouble() * (ZoomPanel1.ActualHeight - 40 - height);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.Width = width;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.Height = height;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.Opacity = 0.8;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.Fill = new SolidColorBrush(color);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.Stroke = Brushes.Black;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.StrokeThickness = 1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Canvas.SetLeft(newShape, x);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Canvas.SetTop(newShape, y);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContentCanvas.Children.Add(newShape);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item = new ListBoxItem();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.Tag = newShape;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.Content = string.Format("{0} {1}", colorNames[c&#93;, shapeName);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectsListBox.Items.Add(item);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Without setting the size of the Canvas its content would not be visible<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Use ZoomPanel1's actual size because it is already set in Loaded event<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContentCanvas.Width = ZoomPanel1.ActualWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContentCanvas.Height = ZoomPanel1.ActualHeight;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectsListBox.Focus();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div>
<br />
The sample will be also part of the samples that will come with the next version of ZoomPanel.]]></description>
			<content:encoded><![CDATA[In the thread "How to reset without losing rotation?" (<a href="http://forum.wpf-graphics.com/showthread.php?tid=196)" target="_blank">http://forum.wpf-graphics.com/showthread.php?tid=196)</a> user asked a question on how to zoom and pan to a specific object.<br />
<br />
Because this could be very interesting for others I have created a separate thread so the solution will be better visible.<br />
<br />
The following code is used to create random objects inside ZoomPanel and then the user can select the objects from the ListBox and the ZoomPanel will zoom and pan to the object.<br />
<br />
<br />
ZoomToObjectSample.xaml:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>&lt;Page x:Class="Ab2d.ZoomControlSample.ZoomPanel.ZoomToObjectSample"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:d="http://schemas.microsoft.com/expression/blend/2008" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:ab2d="clr-namespace:Ab2d.Controls;assembly=Ab2d.Controls.ZoomPanel"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mc:Ignorable="d" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d:DesignHeight="500" d:DesignWidth="800"<br />
&nbsp;&nbsp;&nbsp;&nbsp;Title="ZoomToControlSample"&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;Grid&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Grid.ColumnDefinitions&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ColumnDefinition Width="*"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ColumnDefinition Width="180"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Grid.ColumnDefinitions&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ab2d:ZoomPanel Name="ZoomPanel1" Grid.Column="0" Background="White"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IsAnimated="True" ZoomMode="None"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AnimationDuration="{Binding ElementName=DurationTextBox, Path=Text}"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ViewboxLimits="0 0 1 1" IsViewboxLimited="True"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Canvas Name="ContentCanvas"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ab2d:ZoomPanel&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Border Grid.Column="1" BorderBrush="Black" BorderThickness="1"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;StackPanel Orientation="Vertical" Margin="10"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBlock FontSize="12" FontWeight="Bold" Text="Selected object:"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ListBox Name="ObjectsListBox" Width="150" Margin="0 5 0 0" HorizontalAlignment="Left" SelectionChanged="ObjectsListBox_SelectionChanged"/&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBlock Margin="0 15 0 0" Text="Zoom Margin:"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBox Name="MarginComboBox" SelectedIndex="0" Width="80" HorizontalAlignment="Left" SelectionChanged="MarginComboBox_SelectionChanged"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBoxItem&gt;1.0&lt;/ComboBoxItem&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBoxItem&gt;1.2&lt;/ComboBoxItem&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBoxItem&gt;1.5&lt;/ComboBoxItem&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ComboBoxItem&gt;2.0&lt;/ComboBoxItem&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ComboBox&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBlock Margin="0 2 0 0" TextWrapping="Wrap" Foreground="DimGray" Text="Margin defines how much space will visible around selected object."/&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBlock Margin="0 15 0 0" Text="Animation Duration (h:m:s):"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;TextBox Name="DurationTextBox" Width="60" HorizontalAlignment="Left" Height="20"&gt;0:0:0.5&lt;/TextBox&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/StackPanel&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Border&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Grid&gt;<br />
&lt;/Page&gt;</code></div></div>
<br />
ZoomToObjectSample.xaml.cs:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Windows;<br />
using System.Windows.Controls;<br />
using System.Windows.Data;<br />
using System.Windows.Documents;<br />
using System.Windows.Input;<br />
using System.Windows.Media;<br />
using System.Windows.Media.Imaging;<br />
using System.Windows.Navigation;<br />
using System.Windows.Shapes;<br />
<br />
namespace Ab2d.ZoomControlSample.ZoomPanel<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;summary&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;/// Interaction logic for ZoomToObjectSample.xaml<br />
&nbsp;&nbsp;&nbsp;&nbsp;/// &lt;/summary&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public partial class ZoomToObjectSample : Page<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private FrameworkElement _selectedObject;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public ZoomToObjectSample()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitializeComponent();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.Loaded += new RoutedEventHandler(ZoomToObjectSample_Loaded);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void ZoomToObjectSample_Loaded(object sender, RoutedEventArgs e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FillObjects();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private void ObjectsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!this.IsLoaded)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (ObjectsListBox.SelectedIndex == 0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Show all objects<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZoomPanel1.Reset();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_selectedObject = null;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FrameworkElement targetObject = ((ListBoxItem)ObjectsListBox.SelectedItem).Tag as FrameworkElement;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZoomToObject(targetObject);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private void MarginComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (_selectedObject == null)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZoomToObject(_selectedObject);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private void ZoomToObject(FrameworkElement targetObject)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// First get the position of the selected object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// For our simple sample we can also use Canvas.GetLeft and Canvas.GetTop<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// But for more complex scenarios where the object is inside many parents with transformations we need to use TransformToAncestor<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GeneralTransform transform = targetObject.TransformToAncestor(ContentCanvas);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Point objectsPosition = transform.Transform(new Point(0, 0));<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get the size of object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Size objectsSize = new Size(targetObject.ActualWidth, targetObject.ActualHeight);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// We will zoom to the center of the object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Point centerPosition = new Point(objectsPosition.X + objectsSize.Width / 2, objectsPosition.Y + objectsSize.Height / 2);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Now get the required zoom level (1 = no zoom, 2 = 200% zoom, etc.)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double zoomX, zoomY;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double zoomFactor;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// get zoom factor for width and height of the object<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomX = ContentCanvas.ActualWidth / objectsSize.Width;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomY = ContentCanvas.ActualHeight / objectsSize.Height;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get min value (so the whole object is shown) and adjust it for the selected margin<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomFactor = Math.Min(zoomX, zoomY);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomFactor /= GetSelectedMargin();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Set the new zoom position and zoom factor<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZoomPanel1.SetZoom(centerPosition, Controls.ZoomPanel.CenterPositionUnitsType.Absolute, zoomFactor);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_selectedObject = targetObject;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private double GetSelectedMargin()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double margin;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// NOTE: This is not very generic but works for this simple sample<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch (MarginComboBox.SelectedIndex)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 0:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;margin = 2.0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return margin;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private void FillObjects()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shape newShape;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string shapeName;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ListBoxItem item;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Random rnd = new Random();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContentCanvas.Children.Clear();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectsListBox.Items.Clear();<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Add special object to show all objects (zoom out)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item = new ListBoxItem();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.Content = "Show all objects";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.IsSelected = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectsListBox.Items.Add(item);<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Color[] colors = new Color[] { Colors.Red, Colors.Blue, Colors.Green, Colors.Orange };<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string[] colorNames = new string[] { "Red", "Blue", "Green", "Orange" };<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int c = 0; c &lt; colors.Length; c++ )<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Color color = colors[c];<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; 3; i++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double x, y;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double width, height;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get random position and size<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width = 50 + rnd.NextDouble() * 100;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height = 20 + rnd.NextDouble() * 50;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Use ZoomPanel1's actual size because Canvas size is set at the end of this method<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x = 20 + rnd.NextDouble() * (ZoomPanel1.ActualWidth - 40 - width);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y = 20 + rnd.NextDouble() * (ZoomPanel1.ActualHeight - 40 - height);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch (i)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 0:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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bsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.Fill = new SolidColorBrush(color);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.Stroke = Brushes.Black;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newShape.StrokeThickness = 1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Canvas.SetLeft(newShape, x);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Canvas.SetTop(newShape, y);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContentCanvas.Children.Add(newShape);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item = new ListBoxItem();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.Tag = newShape;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.Content = string.Format("{0} {1}", colorNames[c], shapeName);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectsListBox.Items.Add(item);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Without setting the size of the Canvas its content would not be visible<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Use ZoomPanel1's actual size because it is already set in Loaded event<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContentCanvas.Width = ZoomPanel1.ActualWidth;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContentCanvas.Height = ZoomPanel1.ActualHeight;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectsListBox.Focus();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div>
<br />
The sample will be also part of the samples that will come with the next version of ZoomPanel.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Cant capture MouseUp of left button on childen of zoom panel]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=198</link>
			<pubDate>Fri, 04 Nov 2011 20:46:58 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=198</guid>
			<description><![CDATA[No matter how I declare the handler for the MouseUp event on children within the zoompanel, the event never fires. It does on right mouse button and if I remove the zoompanel from around it. I even went as far as attaching to the event manually using AddHandler and using the "handledEventsToo" option. Any thoughts on why this is happenning?<hr />
To elaborate just a bit more, I have a zoompanel with a canvas inside it. The canvas is loaded with content dynamically at runtime that want to capture all mouseup events from every child. The canvas itself is not being clicked. When I add the handler to the canvas, it never fires. The content within the canvas should be firing the event, and they do when they are not within the zoompanel. They bubble up to the canvas as they should in that case. What is the zoompanel doing that would prevent this from working?]]></description>
			<content:encoded><![CDATA[No matter how I declare the handler for the MouseUp event on children within the zoompanel, the event never fires. It does on right mouse button and if I remove the zoompanel from around it. I even went as far as attaching to the event manually using AddHandler and using the "handledEventsToo" option. Any thoughts on why this is happenning?<hr />
To elaborate just a bit more, I have a zoompanel with a canvas inside it. The canvas is loaded with content dynamically at runtime that want to capture all mouseup events from every child. The canvas itself is not being clicked. When I add the handler to the canvas, it never fires. The content within the canvas should be firing the event, and they do when they are not within the zoompanel. They bubble up to the canvas as they should in that case. What is the zoompanel doing that would prevent this from working?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How to reset without losing rotation?]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=196</link>
			<pubDate>Wed, 02 Nov 2011 20:31:21 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=196</guid>
			<description><![CDATA[Is there a way to reproduce the behavior of ResetToLimits() but keep the current rotation angle?]]></description>
			<content:encoded><![CDATA[Is there a way to reproduce the behavior of ResetToLimits() but keep the current rotation angle?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Problem with ReaderWmf Class in Web Service (WCF)]]></title>
			<link>http://forum.wpf-graphics.com/showthread.php?tid=195</link>
			<pubDate>Wed, 02 Nov 2011 14:28:35 +0100</pubDate>
			<guid isPermaLink="false">http://forum.wpf-graphics.com/showthread.php?tid=195</guid>
			<description><![CDATA[Hello.<br />
<br />
I had a problem with emf/wmf to Silverlight xaml conversion.<br />
<br />
I have a Web Service WCF in IIS, and I want do a conversion on the server side.<br />
<br />
The following code is a code example :<br />
<br />
ReaderWmf wmfReader = new ReaderWmf();<br />
MemoryStream stream = new MemoryStream(_buffer);<br />
wmfReader.Read(stream);<br />
<br />
When I use the Read(stream) method of ReaderWmf class :<br />
<br />
public Viewbox Read(Stream stream)<br />
<br />
I get the following exception (UnauthorizedAccessException):<br />
<br />
Access to the path 'c:\windows\system32\inetsrv\be156149-e1c8-4327-a8c5-ef809e05fbad.emf' is denied.<br />
<br />
I tried to give the user permissions IIUSR_USERS in this folder, but is not allowed.<br />
<br />
As I can do?<br />
<br />
Regards.]]></description>
			<content:encoded><![CDATA[Hello.<br />
<br />
I had a problem with emf/wmf to Silverlight xaml conversion.<br />
<br />
I have a Web Service WCF in IIS, and I want do a conversion on the server side.<br />
<br />
The following code is a code example :<br />
<br />
ReaderWmf wmfReader = new ReaderWmf();<br />
MemoryStream stream = new MemoryStream(_buffer);<br />
wmfReader.Read(stream);<br />
<br />
When I use the Read(stream) method of ReaderWmf class :<br />
<br />
public Viewbox Read(Stream stream)<br />
<br />
I get the following exception (UnauthorizedAccessException):<br />
<br />
Access to the path 'c:\windows\system32\inetsrv\be156149-e1c8-4327-a8c5-ef809e05fbad.emf' is denied.<br />
<br />
I tried to give the user permissions IIUSR_USERS in this folder, but is not allowed.<br />
<br />
As I can do?<br />
<br />
Regards.]]></content:encoded>
		</item>
	</channel>
</rss>
